Cantera  2.2.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
IdealGasPhase.h
Go to the documentation of this file.
1 /**
2  * @file IdealGasPhase.h
3  * ThermoPhase object for the ideal gas equation of
4  * state - workhorse for %Cantera (see \ref thermoprops
5  * and class \link Cantera::IdealGasPhase IdealGasPhase\endlink).
6  */
7 
8 // Copyright 2001 California Institute of Technology
9 #ifndef CT_IDEALGASPHASE_H
10 #define CT_IDEALGASPHASE_H
11 
12 #include "mix_defs.h"
13 #include "ThermoPhase.h"
14 
15 namespace Cantera
16 {
17 
18 //! Class IdealGasPhase represents low-density gases that obey the
19 //! ideal gas equation of state.
20 /*!
21  *
22  * IdealGasPhase derives from class ThermoPhase,
23  * and overloads the virtual methods defined there with ones that
24  * use expressions appropriate for ideal gas mixtures.
25  *
26  * The independent unknowns are density, mass fraction, and temperature.
27  * the #setPressure() function will calculate the density consistent with
28  * the current mass fraction vector and temperature and the desired pressure,
29  * and then set the density.
30  *
31  * <HR>
32  * <H2> Specification of Species Standard State Properties </H2>
33  * <HR>
34  *
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 in the base class, ThermoPhase::m_spthermo
38  * (see the base class \link Cantera#SpeciesThermo SpeciesThermo \endlink for a
39  * description of the specification of reference state species thermodynamics functions).
40  * The reference state,
41  * where the pressure is fixed at a single pressure,
42  * is a key species property calculation for the Ideal Gas Equation
43  * of state.
44  *
45  * This class is optimized for speed of execution. All calls to thermodynamic functions
46  * first call internal routines (aka #enthalpy_RT_ref()) which return references
47  * the reference state thermodynamics functions. Within these internal reference
48  * state functions, the function #_updateThermo() is called, that first checks to see
49  * whether the temperature has changed. If it has, it updates the internal reference
50  * state thermo functions by calling the SpeciesThermo object.
51  *
52  * Functions for the calculation of standard state properties for species
53  * at arbitrary pressure are provided in IdealGasPhase. However, they
54  * are all derived from their reference state counterparts.
55  *
56  * The standard state enthalpy is independent of pressure:
57  *
58  * \f[
59  * h^o_k(T,P) = h^{ref}_k(T)
60  * \f]
61  *
62  * The standard state constant-pressure heat capacity is independent of pressure:
63  *
64  * \f[
65  * Cp^o_k(T,P) = Cp^{ref}_k(T)
66  * \f]
67  *
68  * The standard state entropy depends in the following fashion on pressure:
69  *
70  * \f[
71  * S^o_k(T,P) = S^{ref}_k(T) - R \ln(\frac{P}{P_{ref}})
72  * \f]
73  * The standard state Gibbs free energy is obtained from the enthalpy and entropy
74  * functions:
75  *
76  * \f[
77  * \mu^o_k(T,P) = h^o_k(T,P) - S^o_k(T,P) T
78  * \f]
79  *
80  * \f[
81  * \mu^o_k(T,P) = \mu^{ref}_k(T) + R T \ln( \frac{P}{P_{ref}})
82  * \f]
83  *
84  * where
85  * \f[
86  * \mu^{ref}_k(T) = h^{ref}_k(T) - T S^{ref}_k(T)
87  * \f]
88  *
89  * The standard state internal energy is obtained from the enthalpy function also
90  *
91  * \f[
92  * u^o_k(T,P) = h^o_k(T) - R T
93  * \f]
94  *
95  * The molar volume of a species is given by the ideal gas law
96  *
97  * \f[
98  * V^o_k(T,P) = \frac{R T}{P}
99  * \f]
100  *
101  * where R is the molar gas constant. For a complete list of physical constants
102  * used within %Cantera, see \ref physConstants .
103  *
104  * <HR>
105  * <H2> Specification of Solution Thermodynamic Properties </H2>
106  * <HR>
107  *
108  * The activity of a species defined in the phase is given by the ideal gas law:
109  * \f[
110  * a_k = X_k
111  * \f]
112  * where \f$ X_k \f$ is the mole fraction of species <I>k</I>.
113  * The chemical potential for species <I>k</I> is equal to
114  *
115  * \f[
116  * \mu_k(T,P) = \mu^o_k(T, P) + R T \log(X_k)
117  * \f]
118  *
119  * In terms of the reference state, the above can be rewritten
120  *
121  *
122  * \f[
123  * \mu_k(T,P) = \mu^{ref}_k(T, P) + R T \log(\frac{P X_k}{P_{ref}})
124  * \f]
125  *
126  * The partial molar entropy for species <I>k</I> is given by the following relation,
127  *
128  * \f[
129  * \tilde{s}_k(T,P) = s^o_k(T,P) - R \log(X_k) = s^{ref}_k(T) - R \log(\frac{P X_k}{P_{ref}})
130  * \f]
131  *
132  * The partial molar enthalpy for species <I>k</I> is
133  *
134  * \f[
135  * \tilde{h}_k(T,P) = h^o_k(T,P) = h^{ref}_k(T)
136  * \f]
137  *
138  * The partial molar Internal Energy for species <I>k</I> is
139  *
140  * \f[
141  * \tilde{u}_k(T,P) = u^o_k(T,P) = u^{ref}_k(T)
142  * \f]
143  *
144  * The partial molar Heat Capacity for species <I>k</I> is
145  *
146  * \f[
147  * \tilde{Cp}_k(T,P) = Cp^o_k(T,P) = Cp^{ref}_k(T)
148  * \f]
149  *
150  *
151  * <HR>
152  * <H2> %Application within Kinetics Managers </H2>
153  * <HR>
154  *
155  * \f$ C^a_k\f$ are defined such that \f$ a_k = C^a_k /
156  * C^s_k, \f$ where \f$ C^s_k \f$ is a standard concentration
157  * defined below and \f$ a_k \f$ are activities used in the
158  * thermodynamic functions. These activity (or generalized)
159  * concentrations are used
160  * by kinetics manager classes to compute the forward and
161  * reverse rates of elementary reactions.
162  * The activity concentration,\f$ C^a_k \f$,is given by the following expression.
163  *
164  * \f[
165  * C^a_k = C^s_k X_k = \frac{P}{R T} X_k
166  * \f]
167  *
168  * The standard concentration for species <I>k</I> is independent of <I>k</I> and equal to
169  *
170  * \f[
171  * C^s_k = C^s = \frac{P}{R T}
172  * \f]
173  *
174  * For example, a bulk-phase binary gas reaction between species j and k, producing
175  * a new gas species l would have the
176  * following equation for its rate of progress variable, \f$ R^1 \f$, which has
177  * units of kmol m-3 s-1.
178  *
179  * \f[
180  * R^1 = k^1 C_j^a C_k^a = k^1 (C^s a_j) (C^s a_k)
181  * \f]
182  * where
183  * \f[
184  * C_j^a = C^s a_j \quad \mbox{and} \quad C_k^a = C^s a_k
185  * \f]
186  *
187  * \f$ C_j^a \f$ is the activity concentration of species j, and
188  * \f$ C_k^a \f$ is the activity concentration of species k. \f$ C^s \f$
189  * is the standard concentration. \f$ a_j \f$ is
190  * the activity of species j which is equal to the mole fraction of j.
191  *
192  * The reverse rate constant can then be obtained from the law of microscopic reversibility
193  * and the equilibrium expression for the system.
194  *
195  * \f[
196  * \frac{a_j a_k}{ a_l} = K_a^{o,1} = \exp(\frac{\mu^o_l - \mu^o_j - \mu^o_k}{R T} )
197  * \f]
198  *
199  * \f$ K_a^{o,1} \f$ is the dimensionless form of the equilibrium constant, associated with
200  * the pressure dependent standard states \f$ \mu^o_l(T,P) \f$ and their associated activities,
201  * \f$ a_l \f$, repeated here:
202  *
203  * \f[
204  * \mu_l(T,P) = \mu^o_l(T, P) + R T \log(a_l)
205  * \f]
206  *
207  * We can switch over to expressing the equilibrium constant in terms of the reference
208  * state chemical potentials
209  *
210  * \f[
211  * K_a^{o,1} = \exp(\frac{\mu^{ref}_l - \mu^{ref}_j - \mu^{ref}_k}{R T} ) * \frac{P_{ref}}{P}
212  * \f]
213  *
214  * The concentration equilibrium constant, \f$ K_c \f$, may be obtained by changing over
215  * to activity concentrations. When this is done:
216  *
217  * \f[
218  * \frac{C^a_j C^a_k}{ C^a_l} = C^o K_a^{o,1} = K_c^1 =
219  * \exp(\frac{\mu^{ref}_l - \mu^{ref}_j - \mu^{ref}_k}{R T} ) * \frac{P_{ref}}{RT}
220  * \f]
221  *
222  * %Kinetics managers will calculate the concentration equilibrium constant, \f$ K_c \f$,
223  * using the second and third part of the above expression as a definition for the concentration
224  * equilibrium constant.
225  *
226  * For completeness, the pressure equilibrium constant may be obtained as well
227  *
228  * \f[
229  * \frac{P_j P_k}{ P_l P_{ref}} = K_p^1 =
230  \exp\left(\frac{\mu^{ref}_l - \mu^{ref}_j - \mu^{ref}_k}{R T} \right)
231  * \f]
232  *
233  * \f$ K_p \f$ is the simplest form of the equilibrium constant for ideal gases. However, it isn't
234  * necessarily the simplest form of the equilibrium constant for other types of phases; \f$ K_c \f$ is
235  * used instead because it is completely general.
236  *
237  * The reverse rate of progress may be written down as
238  * \f[
239  * R^{-1} = k^{-1} C_l^a = k^{-1} (C^o a_l)
240  * \f]
241  *
242  * where we can use the concept of microscopic reversibility to
243  * write the reverse rate constant in terms of the
244  * forward rate constant and the concentration equilibrium
245  * constant, \f$ K_c \f$.
246  *
247  * \f[
248  * k^{-1} = k^1 K^1_c
249  * \f]
250  *
251  * \f$k^{-1} \f$ has units of s-1.
252  *
253  * <HR>
254  * <H2> Instantiation of the Class </H2>
255  * <HR>
256  *
257  * The constructor for this phase is located in the default ThermoFactory
258  * for %Cantera. A new IdealGasPhase may be created by the following code
259  * snippet:
260  *
261  * @code
262  * XML_Node *xc = get_XML_File("silane.xml");
263  * XML_Node * const xs = xc->findNameID("phase", "silane");
264  * ThermoPhase *silane_tp = newPhase(*xs);
265  * IdealGasPhase *silaneGas = dynamic_cast <IdealGasPhase *>(silane_tp);
266  * @endcode
267  *
268  * or by the following constructor:
269  *
270  * @code
271  * XML_Node *xc = get_XML_File("silane.xml");
272  * XML_Node * const xs = xc->findNameID("phase", "silane");
273  * IdealGasPhase *silaneGas = new IdealGasPhase(*xs);
274  * @endcode
275  *
276  * <HR>
277  * <H2> XML Example </H2>
278  * <HR>
279  * An example of an XML Element named phase setting up a IdealGasPhase
280  * object named silane is given below.
281  *
282  * @code
283  * <!-- phase silane -->
284  * <phase dim="3" id="silane">
285  * <elementArray datasrc="elements.xml"> Si H He </elementArray>
286  * <speciesArray datasrc="#species_data">
287  * H2 H HE SIH4 SI SIH SIH2 SIH3 H3SISIH SI2H6
288  * H2SISIH2 SI3H8 SI2 SI3
289  * </speciesArray>
290  * <reactionArray datasrc="#reaction_data"/>
291  * <thermo model="IdealGas"/>
292  * <kinetics model="GasKinetics"/>
293  * <transport model="None"/>
294  * </phase>
295  * @endcode
296  *
297  * The model attribute "IdealGas" of the thermo XML element identifies the phase as
298  * being of the type handled by the IdealGasPhase object.
299  *
300  * @ingroup thermoprops
301  *
302  */
304 {
305 public:
306  //! Default empty Constructor
307  IdealGasPhase();
308 
309  //! Construct and initialize an IdealGasPhase ThermoPhase object
310  //! directly from an ASCII input file
311  /*!
312  * @param inputFile Name of the input file containing the phase XML data
313  * to set up the object
314  * @param id ID of the phase in the input file. Defaults to the
315  * empty string.
316  */
317  IdealGasPhase(const std::string& inputFile, const std::string& id = "");
318 
319  //! Construct and initialize an IdealGasPhase ThermoPhase object
320  //! directly from an XML database
321  /*!
322  * @param phaseRef XML phase node containing the description of the phase
323  * @param id id attribute containing the name of the phase.
324  * (default is the empty string)
325  */
326  IdealGasPhase(XML_Node& phaseRef, const std::string& id = "");
327 
328  //! Copy Constructor
329  /*!
330  * Copy constructor for the object. Constructed
331  * object will be a clone of this object, but will
332  * also own all of its data.
333  * This is a wrapper around the assignment operator
334  *
335  * @param right Object to be copied.
336  */
337  IdealGasPhase(const IdealGasPhase& right);
338 
339  //! Assignment operator
340  /*!
341  * Assignment operator for the object. Constructed
342  * object will be a clone of this object, but will
343  * also own all of its data.
344  *
345  * @param right Object to be copied.
346  */
347  IdealGasPhase& operator=(const IdealGasPhase& right);
348 
349  //! Duplicator from the ThermoPhase parent class
350  /*!
351  * Given a pointer to a ThermoPhase object, this function will
352  * duplicate the ThermoPhase object and all underlying structures.
353  * This is basically a wrapper around the inherited copy constructor.
354  *
355  * @return returns a pointer to a ThermoPhase object, containing
356  * a copy of the current object
357  */
359 
360  //! Equation of state flag.
361  /*!
362  * Returns the value cIdealGas, defined in mix_defs.h.
363  */
364  virtual int eosType() const {
365  return cIdealGas;
366  }
367 
368  //! @name Molar Thermodynamic Properties of the Solution
369  //! @{
370 
371  //! Return the Molar enthalpy. Units: J/kmol.
372  /*!
373  * For an ideal gas mixture,
374  * \f[
375  * \hat h(T) = \sum_k X_k \hat h^0_k(T),
376  * \f]
377  * and is a function only of temperature.
378  * The standard-state pure-species enthalpies
379  * \f$ \hat h^0_k(T) \f$ are computed by the species thermodynamic
380  * property manager.
381  *
382  * \see SpeciesThermo
383  */
384  virtual doublereal enthalpy_mole() const {
386  }
387 
388  /**
389  * Molar entropy. Units: J/kmol/K.
390  * For an ideal gas mixture,
391  * \f[
392  * \hat s(T, P) = \sum_k X_k \hat s^0_k(T) - \hat R \log (P/P^0).
393  * \f]
394  * The reference-state pure-species entropies
395  * \f$ \hat s^0_k(T) \f$ are computed by the species thermodynamic
396  * property manager.
397  * @see SpeciesThermo
398  */
399  virtual doublereal entropy_mole() const;
400 
401  /**
402  * Molar heat capacity at constant pressure. Units: J/kmol/K.
403  * For an ideal gas mixture,
404  * \f[
405  * \hat c_p(t) = \sum_k \hat c^0_{p,k}(T).
406  * \f]
407  * The reference-state pure-species heat capacities
408  * \f$ \hat c^0_{p,k}(T) \f$ are computed by the species thermodynamic
409  * property manager.
410  * @see SpeciesThermo
411  */
412  virtual doublereal cp_mole() const;
413 
414  /**
415  * Molar heat capacity at constant volume. Units: J/kmol/K.
416  * For an ideal gas mixture,
417  * \f[ \hat c_v = \hat c_p - \hat R. \f]
418  */
419  virtual doublereal cv_mole() const;
420 
421  /**
422  * @returns species translational/rotational specific heat at
423  * constant volume. Inferred from the species gas
424  * constant and number of translational/rotational
425  * degrees of freedom. The translational/rotational
426  * modes are assumed to be fully populated, and are
427  * given by
428  * \f[
429  * C^{tr}_{v,s} \equiv \frac{\partial e^{tr}_s}{\partial T} = \frac{5}{2} R_s
430  * \f]
431  * for diatomic molecules and
432  * \f[
433  * C^{tr}_{v,s} \equiv \frac{\partial e^{tr}_s}{\partial T} = \frac{3}{2} R_s
434  * \f]
435  * for atoms.
436  * @deprecated To be removed after Cantera 2.2.
437  */
438  virtual doublereal cv_tr(doublereal) const;
439 
440  /**
441  * @returns species translational specific heat at constant volume.
442  * Since the translational modes are assumed to be fully populated
443  * this is simply
444  * \f[
445  * C^{trans}_{v,s} \equiv \frac{\partial e^{trans}_s}{\partial T} = \frac{3}{2} R_s
446  * \f]
447  * @deprecated To be removed after Cantera 2.2.
448  */
449  virtual doublereal cv_trans() const;
450 
451  /**
452  * @returns species rotational specific heat at constant volume.
453  * By convention, we lump the translational/rotational components
454  * \f[
455  * C^{tr}_{v,s} \equiv C^{trans}_{v,s} + C^{rot}_{v,s}
456  * \f]
457  * so then
458  * \f[
459  * C^{rot}_{v,s} \equiv C^{tr}_{v,s} - C^{trans}_{v,s}
460  * \f]
461  * @deprecated To be removed after Cantera 2.2.
462  */
463  virtual doublereal cv_rot(double atomicity) const;
464 
465  /**
466  * @returns species vibrational specific heat at
467  * constant volume,
468  * \f[
469  * C^{vib}_{v,s} = \frac{\partial e^{vib}_{v,s} }{\partial T}
470  * \f]
471  * where the species vibration energy \f$ e^{vib}_{v,s} \f$ is
472  * - atom:
473  * 0
474  * - Diatomic:
475  * \f[ \frac{R_s \theta_{v,s}}{e^{\theta_{v,s}/T}-1} \f]
476  * - General Molecule:
477  * \f[
478  * \sum_i \frac{R_s \theta_{v,s,i}}{e^{\theta_{v,s,i}/T}-1}
479  * \f]
480  * @deprecated To be removed after Cantera 2.2.
481  */
482  virtual doublereal cv_vib(int k, doublereal T) const;
483 
484  //! @}
485  //! @name Mechanical Equation of State
486  //! @{
487 
488  /**
489  * Pressure. Units: Pa.
490  * For an ideal gas mixture,
491  * \f[ P = n \hat R T. \f]
492  */
493  virtual doublereal pressure() const {
494  return GasConstant * molarDensity() * temperature();
495  }
496 
497  //! Set the pressure at constant temperature and composition.
498  /*!
499  * Units: Pa.
500  * This method is implemented by setting the mass density to
501  * \f[
502  * \rho = \frac{P \overline W}{\hat R T }.
503  * \f]
504  *
505  * @param p Pressure (Pa)
506  */
507  virtual void setPressure(doublereal p) {
509  }
510 
511  //! Returns the isothermal compressibility. Units: 1/Pa.
512  /**
513  * The isothermal compressibility is defined as
514  * \f[
515  * \kappa_T = -\frac{1}{v}\left(\frac{\partial v}{\partial P}\right)_T
516  * \f]
517  * For ideal gases it's equal to the inverse of the pressure
518  */
519  virtual doublereal isothermalCompressibility() const {
520  return 1.0 / pressure();
521  }
522 
523  //! Return the volumetric thermal expansion coefficient. Units: 1/K.
524  /*!
525  * The thermal expansion coefficient is defined as
526  * \f[
527  * \beta = \frac{1}{v}\left(\frac{\partial v}{\partial T}\right)_P
528  * \f]
529  * For ideal gases, it's equal to the inverse of the temperature.
530  */
531  virtual doublereal thermalExpansionCoeff() const {
532  return 1.0 / temperature();
533  }
534 
535  //@}
536 
537  /**
538  * @name Chemical Potentials and Activities
539  *
540  * The activity \f$a_k\f$ of a species in solution is
541  * related to the chemical potential by
542  * \f[
543  * \mu_k(T,P,X_k) = \mu_k^0(T,P)
544  * + \hat R T \log a_k.
545  * \f]
546  * The quantity \f$\mu_k^0(T,P)\f$ is
547  * the standard state chemical potential at unit activity.
548  * It may depend on the pressure and the temperature. However,
549  * it may not depend on the mole fractions of the species
550  * in the solution.
551  *
552  * The activities are related to the generalized
553  * concentrations, \f$\tilde C_k\f$, and standard
554  * concentrations, \f$C^0_k\f$, by the following formula:
555  *
556  * \f[
557  * a_k = \frac{\tilde C_k}{C^0_k}
558  * \f]
559  * The generalized concentrations are used in the kinetics classes
560  * to describe the rates of progress of reactions involving the
561  * species. Their formulation depends upon the specification
562  * of the rate constants for reaction, especially the units used
563  * in specifying the rate constants. The bridge between the
564  * thermodynamic equilibrium expressions that use a_k and the
565  * kinetics expressions which use the generalized concentrations
566  * is provided by the multiplicative factor of the
567  * standard concentrations.
568  * @{
569  */
570 
571  //! This method returns the array of generalized concentrations.
572  /*!
573  * For an ideal gas mixture, these are simply the actual concentrations.
574  *
575  * @param c Output array of generalized concentrations. The
576  * units depend upon the implementation of the
577  * reaction rate expressions within the phase.
578  */
579  virtual void getActivityConcentrations(doublereal* c) const {
581  }
582 
583  //! Returns the standard concentration \f$ C^0_k \f$, which is used to normalize
584  //! the generalized concentration.
585  /*!
586  * This is defined as the concentration by which the generalized
587  * concentration is normalized to produce the activity.
588  * In many cases, this quantity will be the same for all species in a phase.
589  * Since the activity for an ideal gas mixture is
590  * simply the mole fraction, for an ideal gas \f$ C^0_k = P/\hat R T \f$.
591  *
592  * @param k Optional parameter indicating the species. The default
593  * is to assume this refers to species 0.
594  * @return
595  * Returns the standard Concentration in units of m3 kmol-1.
596  */
597  virtual doublereal standardConcentration(size_t k = 0) const;
598 
599  //! Get the array of non-dimensional activity coefficients at
600  //! the current solution temperature, pressure, and solution concentration.
601  /*!
602  * For ideal gases, the activity coefficients are all equal to one.
603  *
604  * @param ac Output vector of activity coefficients. Length: m_kk.
605  */
606  virtual void getActivityCoefficients(doublereal* ac) const;
607 
608  //@}
609  /// @name Partial Molar Properties of the Solution
610  //@{
611 
612  //! Get the species chemical potentials. Units: J/kmol.
613  /*!
614  * This function returns a vector of chemical potentials of the
615  * species in solution at the current temperature, pressure
616  * and mole fraction of the solution.
617  *
618  * @param mu Output vector of species chemical
619  * potentials. Length: m_kk. Units: J/kmol
620  */
621  virtual void getChemPotentials(doublereal* mu) const;
622 
623  //! Get the species partial molar enthalpies. Units: J/kmol.
624  /*!
625  * @param hbar Output vector of species partial molar enthalpies.
626  * Length: m_kk. units are J/kmol.
627  */
628  virtual void getPartialMolarEnthalpies(doublereal* hbar) const;
629 
630  //! Get the species partial molar entropies. Units: J/kmol/K.
631  /*!
632  * @param sbar Output vector of species partial molar entropies.
633  * Length = m_kk. units are J/kmol/K.
634  */
635  virtual void getPartialMolarEntropies(doublereal* sbar) const;
636 
637  //! Get the species partial molar enthalpies. Units: J/kmol.
638  /*!
639  * @param ubar Output vector of species partial molar internal energies.
640  * Length = m_kk. units are J/kmol.
641  */
642  virtual void getPartialMolarIntEnergies(doublereal* ubar) const;
643 
644  //! Get the partial molar heat capacities Units: J/kmol/K
645  /*!
646  * @param cpbar Output vector of species partial molar heat capacities at constant pressure.
647  * Length = m_kk. units are J/kmol/K.
648  */
649  virtual void getPartialMolarCp(doublereal* cpbar) const;
650 
651  //! Get the species partial molar volumes. Units: m^3/kmol.
652  /*!
653  * @param vbar Output vector of species partial molar volumes.
654  * Length = m_kk. units are m^3/kmol.
655  */
656  virtual void getPartialMolarVolumes(doublereal* vbar) const;
657 
658  //@}
659  /// @name Properties of the Standard State of the Species in the Solution
660  //@{
661 
662  //! Get the array of chemical potentials at unit activity for the
663  //! species standard states at the current <I>T</I> and <I>P</I> of the solution.
664  /*!
665  * These are the standard state chemical potentials \f$ \mu^0_k(T,P)
666  * \f$. The values are evaluated at the current
667  * temperature and pressure of the solution
668  *
669  * @param mu Output vector of chemical potentials.
670  * Length: m_kk.
671  */
672  virtual void getStandardChemPotentials(doublereal* mu) const;
673 
674  //! Get the nondimensional Enthalpy functions for the species standard states
675  //! at their standard states at the current <I>T</I> and <I>P</I> of the solution.
676  /*!
677  * @param hrt Output vector of nondimensional standard state enthalpies.
678  * Length: m_kk.
679  */
680  virtual void getEnthalpy_RT(doublereal* hrt) const;
681 
682  //! Get the array of nondimensional Entropy functions for the
683  //! species standard states at the current <I>T</I> and <I>P</I> of the solution.
684  /*!
685  * @param sr Output vector of nondimensional standard state entropies.
686  * Length: m_kk.
687  */
688  virtual void getEntropy_R(doublereal* sr) const;
689 
690  //! Get the nondimensional Gibbs functions for the species
691  //! standard states at the current <I>T</I> and <I>P</I> of the solution.
692  /*!
693  * @param grt Output vector of nondimensional standard state Gibbs free energies
694  * Length: m_kk.
695  */
696  virtual void getGibbs_RT(doublereal* grt) const;
697 
698  //! Get the Gibbs functions for the standard
699  //! state of the species at the current <I>T</I> and <I>P</I> of the solution
700  /*!
701  * Units are Joules/kmol
702  * @param gpure Output vector of standard state Gibbs free energies
703  * Length: m_kk.
704  */
705  virtual void getPureGibbs(doublereal* gpure) const;
706 
707  //! Returns the vector of nondimensional Internal Energies of the standard
708  //! state species at the current <I>T</I> and <I>P</I> of the solution
709  /*!
710  * @param urt output vector of nondimensional standard state internal energies
711  * of the species. Length: m_kk.
712  */
713  virtual void getIntEnergy_RT(doublereal* urt) const;
714 
715  //! Get the nondimensional Heat Capacities at constant
716  //! pressure for the species standard states
717  //! at the current <I>T</I> and <I>P</I> of the solution
718  /*!
719  * @param cpr Output vector of nondimensional standard state heat capacities
720  * Length: m_kk.
721  */
722  virtual void getCp_R(doublereal* cpr) const;
723 
724  //! Get the molar volumes of the species standard states at the current
725  //! <I>T</I> and <I>P</I> of the solution.
726  /*!
727  * units = m^3 / kmol
728  *
729  * @param vol Output vector containing the standard state volumes.
730  * Length: m_kk.
731  */
732  virtual void getStandardVolumes(doublereal* vol) const;
733 
734  //@}
735  /// @name Thermodynamic Values for the Species Reference States
736  //@{
737 
738  //! Returns the vector of nondimensional
739  //! enthalpies of the reference state at the current temperature
740  //! of the solution and the reference pressure for the species.
741  /*!
742  * @param hrt Output vector containing the nondimensional reference state
743  * enthalpies. Length: m_kk.
744  */
745  virtual void getEnthalpy_RT_ref(doublereal* hrt) const;
746 
747  //! Returns the vector of nondimensional
748  //! Gibbs Free Energies of the reference state at the current temperature
749  //! of the solution and the reference pressure for the species.
750  /*!
751  * @param grt Output vector containing the nondimensional reference state
752  * Gibbs Free energies. Length: m_kk.
753  */
754  virtual void getGibbs_RT_ref(doublereal* grt) const;
755 
756  //! Returns the vector of the
757  //! Gibbs function of the reference state at the current temperature
758  //! of the solution and the reference pressure for the species.
759  /*!
760  * units = J/kmol
761  *
762  * @param g Output vector containing the reference state
763  * Gibbs Free energies. Length: m_kk. Units: J/kmol.
764  */
765  virtual void getGibbs_ref(doublereal* g) const;
766 
767  //! Returns the vector of nondimensional
768  //! entropies of the reference state at the current temperature
769  //! of the solution and the reference pressure for each species.
770  /*!
771  * @param er Output vector containing the nondimensional reference state
772  * entropies. Length: m_kk.
773  */
774  virtual void getEntropy_R_ref(doublereal* er) const;
775 
776  //! Returns the vector of nondimensional
777  //! internal Energies of the reference state at the current temperature
778  //! of the solution and the reference pressure for each species.
779  /*!
780  * @param urt Output vector of nondimensional reference state
781  * internal energies of the species.
782  * Length: m_kk
783  */
784  virtual void getIntEnergy_RT_ref(doublereal* urt) const;
785 
786  //! Returns the vector of nondimensional
787  //! constant pressure heat capacities of the reference state
788  //! at the current temperature of the solution
789  //! and reference pressure for each species.
790  /*!
791  * @param cprt Output vector of nondimensional reference state
792  * heat capacities at constant pressure for the species.
793  * Length: m_kk
794  */
795  virtual void getCp_R_ref(doublereal* cprt) const;
796 
797  //! Get the molar volumes of the species standard states at the current
798  //! <I>T</I> and <I>P_ref</I> of the solution.
799  /*!
800  * units = m^3 / kmol
801  *
802  * @param vol Output vector containing the standard state volumes.
803  * Length: m_kk.
804  */
805  virtual void getStandardVolumes_ref(doublereal* vol) const;
806 
807  //@}
808  /// @name NonVirtual Internal methods to Return References to Reference State Thermo
809  //@{
810 
811  //! Returns a reference to the dimensionless reference state enthalpy vector.
812  /*!
813  * This function is part of the layer that checks/recalculates the reference
814  * state thermo functions.
815  */
816  const vector_fp& enthalpy_RT_ref() const {
817  _updateThermo();
818  return m_h0_RT;
819  }
820 
821  //! Returns a reference to the dimensionless reference state Gibbs free energy vector.
822  /*!
823  * This function is part of the layer that checks/recalculates the reference
824  * state thermo functions.
825  */
826  const vector_fp& gibbs_RT_ref() const {
827  _updateThermo();
828  return m_g0_RT;
829  }
830 
831  //! Returns a reference to the dimensionless reference state Entropy vector.
832  /*!
833  * This function is part of the layer that checks/recalculates the reference
834  * state thermo functions.
835  */
836  const vector_fp& entropy_R_ref() const {
837  _updateThermo();
838  return m_s0_R;
839  }
840 
841  //! Returns a reference to the dimensionless reference state Heat Capacity vector.
842  /*!
843  * This function is part of the layer that checks/recalculates the reference
844  * state thermo functions.
845  */
846  const vector_fp& cp_R_ref() const {
847  _updateThermo();
848  return m_cp0_R;
849  }
850 
851  //@}
852 
853  //! Initialize the ThermoPhase object after all species have been set up
854  /*!
855  * @internal Initialize.
856  *
857  * This method performs any initialization required after all
858  * species have been added. For example, it is used to
859  * resize internal work arrays that must have an entry for
860  * each species.
861  * This method is called from ThermoPhase::initThermoXML(),
862  * which is called from importPhase(),
863  * just prior to returning from the function, importPhase().
864  */
865  virtual void initThermo();
866 
867  //! Method used by the ChemEquil equilibrium solver.
868  /*!
869  * @internal
870  *
871  * Set mixture to an equilibrium state consistent with specified
872  * element potentials and temperature.
873  * It sets the state such that the chemical potentials satisfy
874  * \f[ \frac{\mu_k}{\hat R T} = \sum_m A_{k,m}
875  * \left(\frac{\lambda_m} {\hat R T}\right) \f] where
876  * \f$ \lambda_m \f$ is the element potential of element m. The
877  * temperature is unchanged. Any phase (ideal or not) that
878  * implements this method can be equilibrated by ChemEquil.
879  *
880  * @param lambda_RT vector of non-dimensional element potentials
881  * \f[ \lambda_m/RT \f].
882  */
883  virtual void setToEquilState(const doublereal* lambda_RT);
884 
885 protected:
886  //! Reference state pressure
887  /*!
888  * Value of the reference state pressure in Pascals.
889  * All species must have the same reference state pressure.
890  */
891  doublereal m_p0;
892 
893  //! Temporary storage for log of p/RT
894  mutable doublereal m_logc0;
895 
896  //! Temporary storage for dimensionless reference state enthalpies
898 
899  //! Temporary storage for dimensionless reference state heat capacities
901 
902  //! Temporary storage for dimensionless reference state Gibbs energies
904 
905  //! Temporary storage for dimensionless reference state entropies
906  mutable vector_fp m_s0_R;
907 
908  mutable vector_fp m_expg0_RT;
909 
910  //! Temporary array containing internally calculated partial pressures
911  mutable vector_fp m_pp;
912 
913 private:
914  //! Update the species reference state thermodynamic functions
915  /*!
916  * This method is called each time a thermodynamic property is requested,
917  * to check whether the internal species properties within the object
918  * need to be updated. Currently, this updates the species thermo
919  * polynomial values for the current value of the temperature. A check is
920  * made to see if the temperature has changed since the last evaluation.
921  * This object does not contain any persistent data that depends on the
922  * concentration, that needs to be updated. The state object modifies its
923  * concentration dependent information at the time the setMoleFractions()
924  * (or equivalent) call is made.
925  */
926  void _updateThermo() const;
927 };
928 }
929 
930 #endif
virtual int eosType() const
Equation of state flag.
virtual void getEntropy_R(doublereal *sr) const
Get the array of nondimensional Entropy functions for the species standard states at the current T an...
const vector_fp & entropy_R_ref() const
Returns a reference to the dimensionless reference state Entropy vector.
virtual doublereal standardConcentration(size_t k=0) const
Returns the standard concentration , which is used to normalize the generalized concentration.
virtual void setToEquilState(const doublereal *lambda_RT)
Method used by the ChemEquil equilibrium solver.
void _updateThermo() const
Update the species reference state thermodynamic functions.
virtual void getCp_R_ref(doublereal *cprt) const
Returns the vector of nondimensional constant pressure heat capacities of the reference state at the ...
ThermoPhase * duplMyselfAsThermoPhase() const
Duplicator from the ThermoPhase parent class.
virtual void getGibbs_RT_ref(doublereal *grt) const
Returns the vector of nondimensional Gibbs Free Energies of the reference state at the current temper...
vector_fp m_pp
Temporary array containing internally calculated partial pressures.
virtual void getPartialMolarCp(doublereal *cpbar) const
Get the partial molar heat capacities Units: J/kmol/K.
virtual void getIntEnergy_RT_ref(doublereal *urt) const
Returns the vector of nondimensional internal Energies of the reference state at the current temperat...
virtual void getCp_R(doublereal *cpr) const
Get the nondimensional Heat Capacities at constant pressure for the species standard states at the cu...
Class IdealGasPhase represents low-density gases that obey the ideal gas equation of state...
virtual doublereal isothermalCompressibility() const
Returns the isothermal compressibility. Units: 1/Pa.
virtual void getIntEnergy_RT(doublereal *urt) const
Returns the vector of nondimensional Internal Energies of the standard state species at the current T...
virtual void getStandardVolumes(doublereal *vol) const
Get the molar volumes of the species standard states at the current T and P of the solution...
virtual doublereal pressure() const
Pressure.
Class XML_Node is a tree-based representation of the contents of an XML file.
Definition: xml.h:100
virtual void getPartialMolarIntEnergies(doublereal *ubar) const
Get the species partial molar enthalpies. Units: J/kmol.
doublereal m_p0
Reference state pressure.
virtual void getPartialMolarEnthalpies(doublereal *hbar) const
Get the species partial molar enthalpies. Units: J/kmol.
virtual doublereal cv_mole() const
Molar heat capacity at constant volume.
doublereal molarDensity() const
Molar density (kmol/m^3).
Definition: Phase.cpp:663
virtual void getChemPotentials(doublereal *mu) const
Get the species chemical potentials. Units: J/kmol.
virtual void getEnthalpy_RT_ref(doublereal *hrt) const
Returns the vector of nondimensional enthalpies of the reference state at the current temperature of ...
void getConcentrations(doublereal *const c) const
Get the species concentrations (kmol/m^3).
Definition: Phase.cpp:609
const vector_fp & gibbs_RT_ref() const
Returns a reference to the dimensionless reference state Gibbs free energy vector.
vector_fp m_g0_RT
Temporary storage for dimensionless reference state Gibbs energies.
Base class for a phase with thermodynamic properties.
Definition: ThermoPhase.h:97
virtual doublereal cv_trans() const
doublereal mean_X(const doublereal *const Q) const
Evaluate the mole-fraction-weighted mean of an array Q.
Definition: Phase.cpp:687
virtual void getActivityCoefficients(doublereal *ac) const
Get the array of non-dimensional activity coefficients at the current solution temperature, pressure, and solution concentration.
IdealGasPhase()
Default empty Constructor.
virtual void getEntropy_R_ref(doublereal *er) const
Returns the vector of nondimensional entropies of the reference state at the current temperature of t...
virtual void getPureGibbs(doublereal *gpure) const
Get the Gibbs functions for the standard state of the species at the current T and P of the solution...
virtual void getStandardChemPotentials(doublereal *mu) const
Get the array of chemical potentials at unit activity for the species standard states at the current ...
virtual void getActivityConcentrations(doublereal *c) const
This method returns the array of generalized concentrations.
doublereal m_logc0
Temporary storage for log of p/RT.
virtual doublereal cp_mole() const
Molar heat capacity at constant pressure.
virtual doublereal enthalpy_mole() const
Return the Molar enthalpy. Units: J/kmol.
virtual void getPartialMolarVolumes(doublereal *vbar) const
Get the species partial molar volumes. Units: m^3/kmol.
virtual void initThermo()
Initialize the ThermoPhase object after all species have been set up.
IdealGasPhase & operator=(const IdealGasPhase &right)
Assignment operator.
doublereal temperature() const
Temperature (K).
Definition: Phase.h:602
const vector_fp & cp_R_ref() const
Returns a reference to the dimensionless reference state Heat Capacity vector.
std::vector< double > vector_fp
Turn on the use of stl vectors for the basic array type within cantera Vector of doubles.
Definition: ct_defs.h:157
virtual doublereal thermalExpansionCoeff() const
Return the volumetric thermal expansion coefficient. Units: 1/K.
doublereal meanMolecularWeight() const
The mean molecular weight. Units: (kg/kmol)
Definition: Phase.h:669
const doublereal GasConstant
Universal Gas Constant. [J/kmol/K].
Definition: ct_defs.h:64
virtual void getGibbs_ref(doublereal *g) const
Returns the vector of the Gibbs function of the reference state at the current temperature of the sol...
virtual doublereal cv_rot(double atomicity) const
const vector_fp & enthalpy_RT_ref() const
Returns a reference to the dimensionless reference state enthalpy vector.
virtual void getGibbs_RT(doublereal *grt) const
Get the nondimensional Gibbs functions for the species standard states at the current T and P of the ...
virtual void getEnthalpy_RT(doublereal *hrt) const
Get the nondimensional Enthalpy functions for the species standard states at their standard states at...
virtual void getPartialMolarEntropies(doublereal *sbar) const
Get the species partial molar entropies. Units: J/kmol/K.
virtual doublereal cv_tr(doublereal) const
Header file for class ThermoPhase, the base class for phases with thermodynamic properties, and the text for the Module thermoprops (see Thermodynamic Properties and class ThermoPhase).
virtual void getStandardVolumes_ref(doublereal *vol) const
Get the molar volumes of the species standard states at the current T and P_ref of the solution...
vector_fp m_s0_R
Temporary storage for dimensionless reference state entropies.
vector_fp m_h0_RT
Temporary storage for dimensionless reference state enthalpies.
const int cIdealGas
Equation of state types:
Definition: mix_defs.h:37
virtual doublereal cv_vib(int k, doublereal T) const
vector_fp m_cp0_R
Temporary storage for dimensionless reference state heat capacities.
virtual doublereal entropy_mole() const
Molar entropy.
virtual void setDensity(const doublereal density_)
Set the internally stored density (kg/m^3) of the phase Note the density of a phase is an independent...
Definition: Phase.h:623
virtual void setPressure(doublereal p)
Set the pressure at constant temperature and composition.