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