Cantera  2.1.2
MineralEQ3.h
Go to the documentation of this file.
1 /**
2  * @file MineralEQ3.h
3  * Header file for the MineralEQ3 class, which represents a fixed-composition
4  * incompressible substance based on EQ3's parameterization (see \ref thermoprops and
5  * class \link Cantera::MineralEQ3 MineralEQ3\endlink)
6  */
7 
8 /*
9  * Copyright (2006) Sandia Corporation. Under the terms of
10  * Contract DE-AC04-94AL85000 with Sandia Corporation, the
11  * U.S. Government retains certain rights in this software.
12  *
13  * Copyright 2001 California Institute of Technology
14  */
15 #ifndef CT_MINERALEQ3_H
16 #define CT_MINERALEQ3_H
17 
18 #include "mix_defs.h"
19 #include "SingleSpeciesTP.h"
20 #include "SpeciesThermo.h"
21 #include "StoichSubstanceSSTP.h"
22 
23 namespace Cantera
24 {
25 
26 //! Class %MineralEQ3 represents a stoichiometric (fixed
27 //! composition) incompressible substance based on EQ3's parameterization
28 /*!
29  * This class inherits from SingleSpeciesSSTP class.
30  * EQ's parameterization is mapped onto the Shomate polynomial class.
31  *
32  * <b> Specification of Species Standard %State Properties </b>
33  *
34  * This class inherits from SingleSpeciesTP.
35  * It is assumed that the reference state thermodynamics may be
36  * obtained by a pointer to a populated species thermodynamic property
37  * manager class (see ThermoPhase::m_spthermo). How to relate pressure
38  * changes to the reference state thermodynamics is resolved at this level.
39  *
40  * For an incompressible,
41  * stoichiometric substance, the molar internal energy is
42  * independent of pressure. Since the thermodynamic properties
43  * are specified by giving the standard-state enthalpy, the
44  * term \f$ P_0 \hat v\f$ is subtracted from the specified molar
45  * enthalpy to compute the molar internal energy. The entropy is
46  * assumed to be independent of the pressure.
47  *
48  * The enthalpy function is given by the following relation.
49  *
50  * \f[
51  * h^o_k(T,P) =
52  * h^{ref}_k(T) + \tilde v \left( P - P_{ref} \right)
53  * \f]
54  *
55  * For an incompressible,
56  * stoichiometric substance, the molar internal energy is
57  * independent of pressure. Since the thermodynamic properties
58  * are specified by giving the standard-state enthalpy, the
59  * term \f$ P_{ref} \tilde v\f$ is subtracted from the specified reference molar
60  * enthalpy to compute the molar internal energy.
61  *
62  * \f[
63  * u^o_k(T,P) = h^{ref}_k(T) - P_{ref} \tilde v
64  * \f]
65  *
66  * The standard state heat capacity and entropy are independent
67  * of pressure. The standard state gibbs free energy is obtained
68  * from the enthalpy and entropy functions.
69  *
70  * <b> Specification of Solution Thermodynamic Properties </b>
71  *
72  * All solution properties are obtained from the standard state
73  * species functions, since there is only one species in the phase.
74  *
75  * <b> %Application within %Kinetics Managers </b>
76  *
77  * The standard concentration is equal to 1.0. This means that the
78  * kinetics operator works on an (activities basis). Since this
79  * is a stoichiometric substance, this means that the concentration
80  * of this phase drops out of kinetics expressions.
81  *
82  * An example of a reaction using this is a sticking coefficient
83  * reaction of a substance in an ideal gas phase on a surface with a bulk phase
84  * species in this phase. In this case, the rate of progress for this
85  * reaction, \f$ R_s \f$, may be expressed via the following equation:
86  * \f[
87  * R_s = k_s C_{gas}
88  * \f]
89  * where the units for \f$ R_s \f$ are kmol m-2 s-1. \f$ C_{gas} \f$ has units
90  * of kmol m-3. Therefore, the kinetic rate constant, \f$ k_s \f$, has
91  * units of m s-1. Nowhere does the concentration of the bulk phase
92  * appear in the rate constant expression, since it's a stoichiometric
93  * phase and the activity is always equal to 1.0.
94  *
95  * @ingroup thermoprops
96  */
98 {
99 public:
100  //! Default constructor for the StoichSubstanceSSTP class
101  MineralEQ3();
102 
103  //! Construct and initialize a StoichSubstanceSSTP ThermoPhase object
104  //! directly from an ASCII input file
105  /*!
106  * @param infile name of the input file
107  * @param id name of the phase id in the file.
108  * If this is blank, the first phase in the file is used.
109  */
110  MineralEQ3(const std::string& infile, std::string id = "");
111 
112  //! Construct and initialize a StoichSubstanceSSTP ThermoPhase object
113  //! directly from an XML database
114  /*!
115  * @param phaseRef XML node pointing to a StoichSubstanceSSTP description
116  * @param id Id of the phase.
117  */
118  MineralEQ3(XML_Node& phaseRef, const std::string& id = "");
119 
120  //! Copy constructor
121  /*!
122  * @param right Object to be copied
123  */
124  MineralEQ3(const MineralEQ3& right);
125 
126  //! Assignment operator
127  /*!
128  * @param right Object to be copied
129  */
130  MineralEQ3& operator=(const MineralEQ3& right);
131 
132  //! Duplication function
133  /*!
134  * This virtual function is used to create a duplicate of the
135  * current phase. It's used to duplicate the phase when given
136  * a ThermoPhase pointer to the phase.
137  *
138  * @return It returns a ThermoPhase pointer.
139  */
141 
142  /**
143  * Equation of state flag.
144  *
145  * Returns the value cStoichSubstance, defined in mix_defs.h.
146  */
147  virtual int eosType() const;
148 
149  //! @name Mechanical Equation of State
150  //! @{
151 
152  //! Report the Pressure. Units: Pa.
153  /*!
154  * For an incompressible substance, the density is independent
155  * of pressure. This method simply returns the stored
156  * pressure value.
157  */
158  virtual doublereal pressure() const;
159 
160  //! Set the pressure at constant temperature. Units: Pa.
161  /*!
162  * For an incompressible substance, the density is
163  * independent of pressure. Therefore, this method only
164  * stores the specified pressure value. It does not
165  * modify the density.
166  *
167  * @param p Pressure (units - Pa)
168  */
169  virtual void setPressure(doublereal p);
170 
171  //! Returns the isothermal compressibility. Units: 1/Pa.
172  /*!
173  * The isothermal compressibility is defined as
174  * \f[
175  * \kappa_T = -\frac{1}{v}\left(\frac{\partial v}{\partial P}\right)_T
176  * \f]
177  */
178  virtual doublereal isothermalCompressibility() const;
179 
180  //! Return the volumetric thermal expansion coefficient. Units: 1/K.
181  /*!
182  * The thermal expansion coefficient is defined as
183  * \f[
184  * \beta = \frac{1}{v}\left(\frac{\partial v}{\partial T}\right)_P
185  * \f]
186  */
187  virtual doublereal thermalExpansionCoeff() const ;
188 
189  /**
190  * @}
191  * @name Activities, Standard States, and Activity Concentrations
192  *
193  * This section is largely handled by parent classes, since there
194  * is only one species. Therefore, the activity is equal to one.
195  * @{
196  */
197 
198  //! This method returns an array of generalized concentrations
199  /*!
200  * \f$ C^a_k\f$ are defined such that \f$ a_k = C^a_k /
201  * C^0_k, \f$ where \f$ C^0_k \f$ is a standard concentration
202  * defined below and \f$ a_k \f$ are activities used in the
203  * thermodynamic functions. These activity (or generalized)
204  * concentrations are used
205  * by kinetics manager classes to compute the forward and
206  * reverse rates of elementary reactions.
207  *
208  * For a stoichiometric substance, there is
209  * only one species, and the generalized concentration is 1.0.
210  *
211  * @param c Output array of generalized concentrations. The
212  * units depend upon the implementation of the
213  * reaction rate expressions within the phase.
214  */
215  virtual void getActivityConcentrations(doublereal* c) const;
216 
217  //! Return the standard concentration for the kth species
218  /*!
219  * The standard concentration \f$ C^0_k \f$ used to normalize
220  * the activity (i.e., generalized) concentration.
221  * This phase assumes that the kinetics operator works on an
222  * dimensionless basis. Thus, the standard concentration is
223  * equal to 1.0.
224  *
225  * @param k Optional parameter indicating the species. The default
226  * is to assume this refers to species 0.
227  * @return
228  * Returns The standard Concentration as 1.0
229  */
230  virtual doublereal standardConcentration(size_t k=0) const;
231 
232  //! Natural logarithm of the standard concentration of the kth species.
233  /*!
234  * @param k index of the species (defaults to zero)
235  */
236  virtual doublereal logStandardConc(size_t k=0) const;
237 
238  //! Get the array of chemical potentials at unit activity for the species
239  //! at their standard states at the current <I>T</I> and <I>P</I> of the solution.
240  /*!
241  * For a stoichiometric substance, there is no activity term in
242  * the chemical potential expression, and therefore the
243  * standard chemical potential and the chemical potential
244  * are both equal to the molar Gibbs function.
245  *
246  * These are the standard state chemical potentials \f$ \mu^0_k(T,P)
247  * \f$. The values are evaluated at the current
248  * temperature and pressure of the solution
249  *
250  * @param mu0 Output vector of chemical potentials.
251  * Length: m_kk.
252  */
253  virtual void getStandardChemPotentials(doublereal* mu0) const;
254 
255  //! Returns the units of the standard and generalized concentrations.
256  /*!
257  * Note they have the same units, as their
258  * ratio is defined to be equal to the activity of the kth
259  * species in the solution, which is unitless.
260  *
261  * This routine is used in print out applications where the
262  * units are needed. Usually, MKS units are assumed throughout
263  * the program and in the XML input files.
264  *
265  * The base %ThermoPhase class assigns the default quantities
266  * of (kmol/m3) for all species.
267  * Inherited classes are responsible for overriding the default
268  * values if necessary.
269  *
270  * @param uA Output vector containing the units
271  *
272  * uA[0] = kmol units - default = 1
273  * uA[1] = m units - default = -nDim(), the number of spatial
274  * dimensions in the Phase class.
275  * uA[2] = kg units - default = 0;
276  * uA[3] = Pa(pressure) units - default = 0;
277  * uA[4] = Temperature units - default = 0;
278  * uA[5] = time units - default = 0
279  *
280  * @param k species index. Defaults to 0.
281  * @param sizeUA output int containing the size of the vector.
282  * Currently, this is equal to 6.
283  * @deprecated
284  */
285  virtual void getUnitsStandardConc(doublereal* uA, int k = 0,
286  int sizeUA = 6) const;
287 
288  //@}
289  /// @name Properties of the Standard State of the Species in the Solution
290  //@{
291 
292  //! Get the nondimensional Enthalpy functions for the species
293  //! at their standard states at the current <I>T</I> and <I>P</I> of the solution.
294  /*!
295  * @param hrt Output vector of nondimensional standard state enthalpies.
296  * Length: m_kk.
297  */
298  virtual void getEnthalpy_RT(doublereal* hrt) const;
299 
300  //! Get the array of nondimensional Entropy functions for the
301  //! standard state species at the current <I>T</I> and <I>P</I> of the solution.
302  /*!
303  * @param sr Output vector of nondimensional standard state entropies.
304  * Length: m_kk.
305  */
306  virtual void getEntropy_R(doublereal* sr) const;
307 
308  //! Get the nondimensional Gibbs functions for the species
309  //! in their standard states at the current <I>T</I> and <I>P</I> of the solution.
310  /*!
311  * @param grt Output vector of nondimensional standard state gibbs free energies
312  * Length: m_kk.
313  */
314  virtual void getGibbs_RT(doublereal* grt) const;
315 
316  //! Get the nondimensional Heat Capacities at constant
317  //! pressure for the species standard states
318  //! at the current <I>T</I> and <I>P</I> of the solution
319  /*!
320  * @param cpr Output vector of nondimensional standard state heat capacities
321  * Length: m_kk.
322  */
323  virtual void getCp_R(doublereal* cpr) const;
324 
325  //! Returns the vector of nondimensional Internal Energies of the standard
326  //! state species at the current <I>T</I> and <I>P</I> of the solution
327  /*!
328  * For an incompressible,
329  * stoichiometric substance, the molar internal energy is
330  * independent of pressure. Since the thermodynamic properties
331  * are specified by giving the standard-state enthalpy, the
332  * term \f$ P_{ref} \hat v\f$ is subtracted from the specified reference molar
333  * enthalpy to compute the standard state molar internal energy.
334  *
335  * @param urt output vector of nondimensional standard state
336  * internal energies of the species. Length: m_kk.
337  */
338  virtual void getIntEnergy_RT(doublereal* urt) const;
339 
340  //@}
341  /// @name Thermodynamic Values for the Species Reference States
342  //@{
343 
344  //! Returns the vector of nondimensional
345  //! internal Energies of the reference state at the current temperature
346  //! of the solution and the reference pressure for each species.
347  /*!
348  * @param urt Output vector of nondimensional reference state
349  * internal energies of the species.
350  * Length: m_kk
351  */
352  virtual void getIntEnergy_RT_ref(doublereal* urt) const;
353  //! @}
354 
355  //! Internal initialization required after all species have
356  //! been added
357  /*!
358  * @internal Initialize. This method is provided to allow
359  * subclasses to perform any initialization required after all
360  * species have been added. For example, it might be used to
361  * resize internal work arrays that must have an entry for
362  * each species. The base class implementation does nothing,
363  * and subclasses that do not require initialization do not
364  * need to overload this method. When importing a CTML phase
365  * description, this method is called just prior to returning
366  * from function importPhase.
367  *
368  * @see importCTML.cpp
369  */
370  virtual void initThermo();
371 
372  //! Initialize the phase parameters from an XML file.
373  /*!
374  * initThermoXML() (virtual from ThermoPhase)
375  *
376  * This gets called from importPhase(). It processes the XML file
377  * after the species are set up. This is the main routine for
378  * reading in activity coefficient parameters.
379  *
380  * @param phaseNode This object must be the phase node of a
381  * complete XML tree
382  * description of the phase, including all of the
383  * species data. In other words while "phase" must
384  * point to an XML phase object, it must have
385  * sibling nodes "speciesData" that describe
386  * the species in the phase.
387  * @param id ID of the phase. If nonnull, a check is done
388  * to see if phaseNode is pointing to the phase
389  * with the correct id.
390  */
391  virtual void initThermoXML(XML_Node& phaseNode, const std::string& id);
392 
393  //! Set the equation of state parameters
394  /*!
395  * @internal
396  *
397  * @param n number of parameters
398  * @param c array of \a n coefficients
399  * c[0] = density of phase [ kg/m3 ]
400  * @deprecated Use setDensity()
401  */
402  virtual void setParameters(int n, doublereal* const c);
403 
404  //! Get the equation of state parameters in a vector
405  /*!
406  * @internal
407  *
408  * @param n number of parameters
409  * @param c array of \a n coefficients
410  *
411  * For this phase:
412  * - n = 1
413  * - c[0] = density of phase [ kg/m3 ]
414  * @deprecated use density()
415  */
416  virtual void getParameters(int& n, doublereal* const c) const;
417 
418  //! Set equation of state parameter values from XML entries.
419  /*!
420  * This method is called by function importPhase() in
421  * file importCTML.cpp when processing a phase definition in
422  * an input file. It should be overloaded in subclasses to set
423  * any parameters that are specific to that particular phase
424  * model. Note, this method is called before the phase is
425  * initialized with elements and/or species.
426  *
427  * For this phase, the density of the phase is specified in this block.
428  *
429  * @param eosdata An XML_Node object corresponding to
430  * the "thermo" entry for this phase in the input file.
431  */
432  virtual void setParametersFromXML(const XML_Node& eosdata);
433  doublereal LookupGe(const std::string& elemName);
434  void convertDGFormation();
435 
436 protected:
437  //! Value of the Absolute Gibbs Free Energy NIST scale at T_r and P_r
438  /*!
439  * This is the NIST scale value of Gibbs free energy at T_r = 298.15
440  * and P_r = 1 atm.
441  *
442  * J kmol-1
443  */
444  doublereal m_Mu0_pr_tr;
445 
446  //! Input value of S_j at Tr and Pr (cal gmol-1 K-1)
447  /*!
448  * Tr = 298.15 Pr = 1 atm
449  */
450  doublereal m_Entrop_pr_tr;
451 
452  //! Input Value of deltaG of Formation at Tr and Pr (cal gmol-1)
453  /*!
454  * Tr = 298.15 Pr = 1 atm
455  *
456  * This is the delta G for the formation reaction of the
457  * ion from elements in their stable state at Tr, Pr.
458  */
460 
461  //! Input Value of deltaH of Formation at Tr and Pr (cal gmol-1)
462  /*!
463  * Tr = 298.15 Pr = 1 atm
464  *
465  * This is the delta H for the formation reaction of the
466  * ion from elements in their stable state at Tr, Pr.
467  */
469 
470  //! Input Value of the molar volume at T_r and P_r
471  /*!
472  * cm^3 / gmol
473  */
474  doublereal m_V0_pr_tr;
475 
476  //! a coefficient (cal gmol-1 K-1)
477  doublereal m_a;
478 
479  //! b coefficient (cal gmol-1 K-2) x 10^3
480  doublereal m_b;
481 
482  //! c coefficient (cal K gmol-1 K) x 10^-5
483  doublereal m_c;
484 };
485 
486 }
487 
488 #endif
doublereal m_Entrop_pr_tr
Input value of S_j at Tr and Pr (cal gmol-1 K-1)
Definition: MineralEQ3.h:450
doublereal m_deltaH_formation_pr_tr
Input Value of deltaH of Formation at Tr and Pr (cal gmol-1)
Definition: MineralEQ3.h:468
virtual void getActivityConcentrations(doublereal *c) const
This method returns an array of generalized concentrations.
Definition: MineralEQ3.cpp:146
virtual void initThermo()
Internal initialization required after all species have been added.
Definition: MineralEQ3.cpp:227
virtual doublereal logStandardConc(size_t k=0) const
Natural logarithm of the standard concentration of the kth species.
Definition: MineralEQ3.cpp:156
virtual void getEntropy_R(doublereal *sr) const
Get the array of nondimensional Entropy functions for the standard state species at the current T and...
Definition: MineralEQ3.cpp:188
virtual void getGibbs_RT(doublereal *grt) const
Get the nondimensional Gibbs functions for the species in their standard states at the current T and ...
Definition: MineralEQ3.cpp:193
Class XML_Node is a tree-based representation of the contents of an XML file.
Definition: xml.h:100
virtual void getParameters(int &n, doublereal *const c) const
Get the equation of state parameters in a vector.
Definition: MineralEQ3.cpp:242
Virtual base class for the calculation of multiple-species thermodynamic reference-state property man...
doublereal m_deltaG_formation_pr_tr
Input Value of deltaG of Formation at Tr and Pr (cal gmol-1)
Definition: MineralEQ3.h:459
virtual void setPressure(doublereal p)
Set the pressure at constant temperature. Units: Pa.
Definition: MineralEQ3.cpp:126
virtual void getUnitsStandardConc(doublereal *uA, int k=0, int sizeUA=6) const
Returns the units of the standard and generalized concentrations.
Definition: MineralEQ3.cpp:162
ThermoPhase * duplMyselfAsThermoPhase() const
Duplication function.
Definition: MineralEQ3.cpp:103
virtual void getStandardChemPotentials(doublereal *mu0) const
Get the array of chemical potentials at unit activity for the species at their standard states at the...
Definition: MineralEQ3.cpp:174
Base class for a phase with thermodynamic properties.
Definition: ThermoPhase.h:101
Class StoichSubstanceSSTP represents a stoichiometric (fixed composition) incompressible substance...
virtual doublereal standardConcentration(size_t k=0) const
Return the standard concentration for the kth species.
Definition: MineralEQ3.cpp:151
doublereal m_c
c coefficient (cal K gmol-1 K) x 10^-5
Definition: MineralEQ3.h:483
MineralEQ3()
Default constructor for the StoichSubstanceSSTP class.
Definition: MineralEQ3.cpp:32
virtual void setParameters(int n, doublereal *const c)
Set the equation of state parameters.
Definition: MineralEQ3.cpp:235
doublereal m_a
a coefficient (cal gmol-1 K-1)
Definition: MineralEQ3.h:477
virtual int eosType() const
Equation of state flag.
Definition: MineralEQ3.cpp:112
virtual void getCp_R(doublereal *cpr) const
Get the nondimensional Heat Capacities at constant pressure for the species standard states at the cu...
Definition: MineralEQ3.cpp:199
MineralEQ3 & operator=(const MineralEQ3 &right)
Assignment operator.
Definition: MineralEQ3.cpp:85
Header for the SingleSpeciesTP class, which is a filter class for ThermoPhase, that eases the constru...
doublereal m_V0_pr_tr
Input Value of the molar volume at T_r and P_r.
Definition: MineralEQ3.h:474
doublereal m_b
b coefficient (cal gmol-1 K-2) x 10^3
Definition: MineralEQ3.h:480
virtual void getEnthalpy_RT(doublereal *hrt) const
Get the nondimensional Enthalpy functions for the species at their standard states at the current T a...
Definition: MineralEQ3.cpp:180
virtual void setParametersFromXML(const XML_Node &eosdata)
Set equation of state parameter values from XML entries.
Definition: MineralEQ3.cpp:311
Header file for the StoichSubstanceSSTP class, which represents a fixed-composition incompressible su...
virtual doublereal pressure() const
Report the Pressure. Units: Pa.
Definition: MineralEQ3.cpp:121
virtual doublereal thermalExpansionCoeff() const
Return the volumetric thermal expansion coefficient. Units: 1/K.
Definition: MineralEQ3.cpp:136
Class MineralEQ3 represents a stoichiometric (fixed composition) incompressible substance based on EQ...
Definition: MineralEQ3.h:97
virtual doublereal isothermalCompressibility() const
Returns the isothermal compressibility. Units: 1/Pa.
Definition: MineralEQ3.cpp:131
virtual void getIntEnergy_RT(doublereal *urt) const
Returns the vector of nondimensional Internal Energies of the standard state species at the current T...
Definition: MineralEQ3.cpp:205
virtual void getIntEnergy_RT_ref(doublereal *urt) const
Returns the vector of nondimensional internal Energies of the reference state at the current temperat...
Definition: MineralEQ3.cpp:216
doublereal m_Mu0_pr_tr
Value of the Absolute Gibbs Free Energy NIST scale at T_r and P_r.
Definition: MineralEQ3.h:444
virtual void initThermoXML(XML_Node &phaseNode, const std::string &id)
Initialize the phase parameters from an XML file.
Definition: MineralEQ3.cpp:250