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