Cantera  2.1.2
ThermoPhase.h
Go to the documentation of this file.
1 /**
2  * @file ThermoPhase.h
3  * Header file for class ThermoPhase, the base class for phases with
4  * thermodynamic properties, and the text for the Module thermoprops
5  * (see \ref thermoprops and class \link Cantera::ThermoPhase ThermoPhase\endlink).
6  */
7 
8 // Copyright 2002 California Institute of Technology
9 
10 #ifndef CT_THERMOPHASE_H
11 #define CT_THERMOPHASE_H
12 
13 #include "Phase.h"
14 #include "SpeciesThermo.h"
15 
16 namespace Cantera
17 {
18 
19 /*!
20  * @name CONSTANTS - Specification of the Molality convention
21  */
22 //@{
23 //! Standard state uses the molar convention
24 const int cAC_CONVENTION_MOLAR = 0;
25 //! Standard state uses the molality convention
27 //@}
28 
29 /*!
30  * @name CONSTANTS - Specification of the SS convention
31  */
32 //@{
33 //! Standard state uses the molar convention
35 //! Standard state uses the molality convention
36 const int cSS_CONVENTION_VPSS = 1;
37 //! Standard state thermodynamics is obtained from slave %ThermoPhase objects
38 const int cSS_CONVENTION_SLAVE = 2;
39 //@}
40 
41 class XML_Node;
42 
43 //! Base class for a phase with thermodynamic properties.
44 /*!
45  * Class ThermoPhase is the base class for the family of classes
46  * that represent phases of matter of any type. It defines a
47  * common public interface, and implements a few methods. Most of
48  * the methods, however, are declared virtual and are meant to be
49  * overloaded in derived classes. The standard way used
50  * throughout Cantera to compute properties of phases of matter is
51  * through pointers of type ThermoPhase* that point to objects of
52  * subclasses of ThermoPhase.
53  *
54  * Class ThermoPhase extends class Phase by adding methods to compute
55  * thermodynamic properties in addition to the ones (temperature, density,
56  * composition) that class Phase provides. The distinction is that
57  * the methods declared in ThermoPhase require knowing the
58  * particular equation of state of the phase of interest, while
59  * those of class Phase do not, since they only involve data values
60  * stored within the object.
61  *
62  * Instances of subclasses of %ThermoPhase should be created using
63  * the factory class ThermoFactory, not by calling the constructor
64  * directly. This allows new classes to be used with the various
65  * Cantera language interfaces.
66  *
67  * To implement a new equation of state, derive a class from
68  * ThermoPhase and overload the virtual methods in
69  * ThermoPhase. Methods that are not needed can be left
70  * unimplemented, which will cause an exception to be thrown if it
71  * is called.
72  *
73  * Relationship with the kinetics operator:
74  *
75  * Describe activity coefficients.
76  *
77  * Describe K_a, K_p, and K_c, These are three different equilibrium
78  * constants.
79  *
80  * K_a is the calculation of the equilibrium constant from the
81  * standard state Gibbs free energy values. It is by definition
82  * dimensionless.
83  *
84  * K_p is the calculation of the equilibrium constant from the
85  * reference state gibbs free energy values. It is by definition
86  * dimensionless. The pressure dependence is handled entirely
87  * on the rhs of the equilibrium expression.
88  *
89  * K_c is the equilibrium constant calculated from the
90  * activity concentrations. The dimensions depend on the number
91  * of products and reactants.
92  *
93  *
94  * The kinetics manager requires the calculation of K_c for the
95  * calculation of the reverse rate constant
96  *
97  *
98  * @ingroup thermoprops
99  * @ingroup phases
100  */
101 class ThermoPhase : public Phase
102 {
103 
104 public:
105 
106  //! Constructor. Note that ThermoPhase is meant to be used as
107  //! a base class, so this constructor should not be called
108  //! explicitly.
109  ThermoPhase();
110 
111  //! Destructor. Deletes the species thermo manager.
112  virtual ~ThermoPhase();
113 
114  //!Copy Constructor for the %ThermoPhase object.
115  /*!
116  * @param right ThermoPhase to be copied
117  */
118  ThermoPhase(const ThermoPhase& right);
119 
120  //! Assignment operator
121  /*!
122  * This is NOT a virtual function.
123  *
124  * @param right Reference to %ThermoPhase object to be copied into the
125  * current one.
126  */
127  ThermoPhase& operator=(const ThermoPhase& right);
128 
129  //! Duplication routine for objects which inherit from
130  //! ThermoPhase.
131  /*!
132  * This virtual routine can be used to duplicate %ThermoPhase objects
133  * inherited from %ThermoPhase even if the application only has
134  * a pointer to %ThermoPhase to work with.
135  *
136  * These routines are basically wrappers around the derived copy
137  * constructor.
138  */
139  virtual ThermoPhase* duplMyselfAsThermoPhase() const;
140 
141  //! @name Information Methods
142  //! @{
143 
144  //! Equation of state type flag.
145  /*!
146  * The base class returns
147  * zero. Subclasses should define this to return a unique
148  * non-zero value. Constants defined for this purpose are
149  * listed in mix_defs.h.
150  */
151  virtual int eosType() const {
152  return 0;
153  }
154 
155  /**
156  * Returns the reference pressure in Pa. This function is a wrapper
157  * that calls the species thermo refPressure function.
158  */
159  virtual doublereal refPressure() const {
160  return m_spthermo->refPressure();
161  }
162 
163  //! Minimum temperature for which the thermodynamic data for the species
164  //! or phase are valid.
165  /*!
166  * If no argument is supplied, the
167  * value returned will be the lowest temperature at which the
168  * data for \e all species are valid. Otherwise, the value
169  * will be only for species \a k. This function is a wrapper
170  * that calls the species thermo minTemp function.
171  *
172  * @param k index of the species. Default is -1, which will return the max of the min value
173  * over all species.
174  */
175  virtual doublereal minTemp(size_t k = npos) const {
176  return m_spthermo->minTemp(k);
177  }
178 
179 #ifdef H298MODIFY_CAPABILITY
180 
181  //! Report the 298 K Heat of Formation of the standard state of one species (J kmol-1)
182  /*!
183  * The 298K Heat of Formation is defined as the enthalpy change to create the standard state
184  * of the species from its constituent elements in their standard states at 298 K and 1 bar.
185  *
186  * @param k species index
187  * @return Returns the current value of the Heat of Formation at 298K and 1 bar
188  */
189  doublereal Hf298SS(const int k) const {
190  return m_spthermo->reportOneHf298(k);
191  }
192 
193  //! Modify the value of the 298 K Heat of Formation of one species in the phase (J kmol-1)
194  /*!
195  * The 298K heat of formation is defined as the enthalpy change to create the standard state
196  * of the species from its constituent elements in their standard states at 298 K and 1 bar.
197  *
198  * @param k Species k
199  * @param Hf298New Specify the new value of the Heat of Formation at 298K and 1 bar
200  */
201  virtual void modifyOneHf298SS(const size_t& k, const doublereal Hf298New) {
202  m_spthermo->modifyOneHf298(k, Hf298New);
203  }
204 
205 #else
206 
207  //! Report the 298 K Heat of Formation of the standard state of one species (J kmol-1)
208  /*!
209  * The 298K Heat of Formation is defined as the enthalpy change to create the standard state
210  * of the species from its constituent elements in their standard states at 298 K and 1 bar.
211  *
212  * @param k species index
213  * @return Returns the current value of the Heat of Formation at 298K and 1 bar
214  */
215  doublereal Hf298SS(const int k) const {
216  return err("Hf298SS - H298MODIFY_CAPABILITY not compiled in");
217  }
218 
219  //! Modify the value of the 298 K Heat of Formation of one species in the phase (J kmol-1)
220  /*!
221  * The 298K heat of formation is defined as the enthalpy change to create the standard state
222  * of the species from its constituent elements in their standard states at 298 K and 1 bar.
223  *
224  * @param k Species k
225  * @param Hf298New Specify the new value of the Heat of Formation at 298K and 1 bar
226  */
227  virtual void modifyOneHf298SS(const int k, const doublereal Hf298New) {
228  (void) err("Hf298SS - H298MODIFY_CAPABILITY not compiled in");
229  }
230 #endif
231 
232  //! Maximum temperature for which the thermodynamic data for the species
233  //! are valid.
234  /*!
235  * If no argument is supplied, the
236  * value returned will be the highest temperature at which the
237  * data for \e all species are valid. Otherwise, the value
238  * will be only for species \a k. This function is a wrapper
239  * that calls the species thermo maxTemp function.
240  *
241  * @param k index of the species. Default is -1, which will return the min of the max value
242  * over all species.
243  */
244  virtual doublereal maxTemp(size_t k = npos) const {
245  return m_spthermo->maxTemp(k);
246  }
247 
248  //! Returns the chargeNeutralityNecessity boolean
249  /*!
250  * Some phases must have zero net charge in order for their thermodynamics functions to be valid.
251  * If this is so, then the value returned from this function is true.
252  * If this is not the case, then this is false. Now, ideal gases have this parameter set to false,
253  * while solution with molality-based activity coefficients have this parameter set to true.
254  */
257  }
258 
259  //! @}
260  //! @name Molar Thermodynamic Properties of the Solution
261  //! @{
262 
263  /// Molar enthalpy. Units: J/kmol.
264  virtual doublereal enthalpy_mole() const {
265  return err("enthalpy_mole");
266  }
267 
268  /// Molar internal energy. Units: J/kmol.
269  virtual doublereal intEnergy_mole() const {
270  return enthalpy_mole() - pressure()* molarVolume();
271  }
272 
273  /// Molar entropy. Units: J/kmol/K.
274  virtual doublereal entropy_mole() const {
275  return err("entropy_mole");
276  }
277 
278  /// Molar Gibbs function. Units: J/kmol.
279  virtual doublereal gibbs_mole() const {
280  return enthalpy_mole() - temperature()*entropy_mole();
281  }
282 
283  /// Molar heat capacity at constant pressure. Units: J/kmol/K.
284  virtual doublereal cp_mole() const {
285  return err("cp_mole");
286  }
287 
288  /// Molar heat capacity at constant volume. Units: J/kmol/K.
289  virtual doublereal cv_mole() const {
290  return err("cv_mole");
291  }
292 
293  /**
294  * @returns species vibrational specific heat at
295  * constant volume.
296  */
297  /// Molar heat capacity at constant volume. Units: J/kmol/K.
298  virtual doublereal cv_vib(int, double) const {
299  return err("cv_vib");
300  }
301 
302  //! @}
303  //! @name Mechanical Properties
304  //! @{
305 
306  //! Return the thermodynamic pressure (Pa).
307  /*!
308  * This method must be overloaded in derived classes. Since the
309  * mass density, temperature, and mass fractions are stored,
310  * this method should use these values to implement the
311  * mechanical equation of state \f$ P(T, \rho, Y_1, \dots,
312  * Y_K) \f$.
313  */
314  virtual doublereal pressure() const {
315  return err("pressure");
316  }
317 
318  //! Set the internally stored pressure (Pa) at constant
319  //! temperature and composition
320  /*!
321  * This method must be reimplemented in derived classes, where it
322  * may involve the solution of a nonlinear equation. Within %Cantera,
323  * the independent variable is the density. Therefore, this function
324  * solves for the density that will yield the desired input pressure.
325  * The temperature and composition iare held constant during this process.
326  *
327  * This base class function will print an error, if not overwritten.
328  *
329  * @param p input Pressure (Pa)
330  */
331  virtual void setPressure(doublereal p) {
332  err("setPressure");
333  }
334 
335  //! Returns the isothermal compressibility. Units: 1/Pa.
336  /*!
337  * The isothermal compressibility is defined as
338  * \f[
339  * \kappa_T = -\frac{1}{v}\left(\frac{\partial v}{\partial P}\right)_T
340  * \f]
341  * or
342  * \f[
343  * \kappa_T = \frac{1}{\rho}\left(\frac{\partial \rho}{\partial P}\right)_T
344  * \f]
345  */
346  virtual doublereal isothermalCompressibility() const {
347  err("isothermalCompressibility");
348  return -1.0;
349  }
350 
351  //! Return the volumetric thermal expansion coefficient. Units: 1/K.
352  /*!
353  * The thermal expansion coefficient is defined as
354  * \f[
355  * \beta = \frac{1}{v}\left(\frac{\partial v}{\partial T}\right)_P
356  * \f]
357  */
358  virtual doublereal thermalExpansionCoeff() const {
359  err("thermalExpansionCoeff()");
360  return -1.0;
361  }
362 
363  /**
364  * @}
365  * @name Electric Potential
366  *
367  * The phase may be at some non-zero electrical
368  * potential. These methods set or get the value of the
369  * electric potential.
370  */
371  //@{
372 
373  //! Set the electric potential of this phase (V).
374  /*!
375  * This is used by classes InterfaceKinetics and EdgeKinetics to
376  * compute the rates of charge-transfer reactions, and in computing
377  * the electrochemical potentials of the species.
378  *
379  * Each phase may have its own electric potential.
380  *
381  * @param v Input value of the electric potential in Volts
382  */
383  void setElectricPotential(doublereal v) {
384  m_phi = v;
385  }
386 
387  //! Returns the electric potential of this phase (V).
388  /*!
389  * Units are Volts (which are Joules/coulomb)
390  */
391  doublereal electricPotential() const {
392  return m_phi;
393  }
394 
395  /**
396  * @}
397  * @name Activities, Standard States, and Activity Concentrations
398  *
399  * The activity \f$a_k\f$ of a species in solution is related
400  * to the chemical potential by \f[ \mu_k = \mu_k^0(T,P) +
401  * \hat R T \log a_k. \f] The quantity \f$\mu_k^0(T,P)\f$ is
402  * the standard chemical potential at unit activity,
403  * which depends on temperature and pressure,
404  * but not on composition. The
405  * activity is dimensionless.
406  * @{
407  */
408 
409 
410  //! This method returns the convention used in specification
411  //! of the activities, of which there are currently two, molar-
412  //! and molality-based conventions.
413  /*!
414  * Currently, there are two activity conventions:
415  * - Molar-based activities
416  * %Unit activity of species at either a hypothetical pure
417  * solution of the species or at a hypothetical
418  * pure ideal solution at infinite dilution
419  * cAC_CONVENTION_MOLAR 0
420  * - default
421  *
422  * - Molality-based activities
423  * (unit activity of solutes at a hypothetical 1 molal
424  * solution referenced to infinite dilution at all
425  * pressures and temperatures).
426  * cAC_CONVENTION_MOLALITY 1
427  */
428  virtual int activityConvention() const;
429 
430  //! This method returns the convention used in specification
431  //! of the standard state, of which there are currently two,
432  //! temperature based, and variable pressure based.
433  /*!
434  * Currently, there are two standard state conventions:
435  * - Temperature-based activities
436  * cSS_CONVENTION_TEMPERATURE 0
437  * - default
438  *
439  * - Variable Pressure and Temperature -based activities
440  * cSS_CONVENTION_VPSS 1
441  *
442  * - Thermodynamics is set via slave ThermoPhase objects with
443  * nothing being carried out at this %ThermoPhase object level
444  * cSS_CONVENTION_SLAVE 2
445  */
446  virtual int standardStateConvention() const;
447 
448  //! This method returns an array of generalized concentrations
449  /*!
450  * \f$ C^a_k\f$ are defined such that \f$ a_k = C^a_k /
451  * C^0_k, \f$ where \f$ C^0_k \f$ is a standard concentration
452  * defined below and \f$ a_k \f$ are activities used in the
453  * thermodynamic functions. These activity (or generalized)
454  * concentrations are used
455  * by kinetics manager classes to compute the forward and
456  * reverse rates of elementary reactions. Note that they may
457  * or may not have units of concentration --- they might be
458  * partial pressures, mole fractions, or surface coverages,
459  * for example.
460  *
461  * @param c Output array of generalized concentrations. The
462  * units depend upon the implementation of the
463  * reaction rate expressions within the phase.
464  */
465  virtual void getActivityConcentrations(doublereal* c) const {
466  err("getActivityConcentrations");
467  }
468 
469  //! Return the standard concentration for the kth species
470  /*!
471  * The standard concentration \f$ C^0_k \f$ used to normalize
472  * the activity (i.e., generalized) concentration. In many cases, this quantity
473  * will be the same for all species in a phase - for example,
474  * for an ideal gas \f$ C^0_k = P/\hat R T \f$. For this
475  * reason, this method returns a single value, instead of an
476  * array. However, for phases in which the standard
477  * concentration is species-specific (e.g. surface species of
478  * different sizes), this method may be called with an
479  * optional parameter indicating the species.
480  *
481  * @param k Optional parameter indicating the species. The default
482  * is to assume this refers to species 0.
483  * @return
484  * Returns the standard concentration. The units are by definition
485  * dependent on the ThermoPhase and kinetics manager representation.
486  */
487  virtual doublereal standardConcentration(size_t k=0) const {
488  err("standardConcentration");
489  return -1.0;
490  }
491 
492  //! Natural logarithm of the standard concentration of the kth species.
493  /*!
494  * @param k index of the species (defaults to zero)
495  */
496  virtual doublereal logStandardConc(size_t k=0) const;
497 
498  //! Returns the units of the standard and generalized concentrations.
499  /*!
500  * Note they have the same units, as their
501  * ratio is defined to be equal to the activity of the kth
502  * species in the solution, which is unitless.
503  *
504  * This routine is used in print out applications where the
505  * units are needed. Usually, MKS units are assumed throughout
506  * the program and in the XML input files.
507  *
508  * The base %ThermoPhase class assigns the default quantities
509  * of (kmol/m3) for all species.
510  * Inherited classes are responsible for overriding the default
511  * values if necessary.
512  *
513  * On return uA contains the powers of the units (MKS assumed)
514  * of the standard concentrations and generalized concentrations
515  * for the kth species.
516  *
517  * @param uA Output vector containing the units
518  * uA[0] = kmol units - default = 1
519  * uA[1] = m units - default = -nDim(), the number of spatial
520  * dimensions in the Phase class.
521  * uA[2] = kg units - default = 0;
522  * uA[3] = Pa(pressure) units - default = 0;
523  * uA[4] = Temperature units - default = 0;
524  * uA[5] = time units - default = 0
525  * @param k species index. Defaults to 0.
526  * @param sizeUA output int containing the size of the vector.
527  * Currently, this is equal to 6.
528  * @deprecated
529  */
530  virtual void getUnitsStandardConc(double* uA, int k = 0,
531  int sizeUA = 6) const;
532 
533  //! Get the array of non-dimensional activities at
534  //! the current solution temperature, pressure, and solution concentration.
535  /*!
536  * Note, for molality based formulations, this returns the
537  * molality based activities.
538  *
539  * We resolve this function at this level by calling
540  * on the activityConcentration function. However,
541  * derived classes may want to override this default
542  * implementation.
543  *
544  * @param a Output vector of activities. Length: m_kk.
545  */
546  virtual void getActivities(doublereal* a) const;
547 
548  //! Get the array of non-dimensional molar-based activity coefficients at
549  //! the current solution temperature, pressure, and solution concentration.
550  /*!
551  * @param ac Output vector of activity coefficients. Length: m_kk.
552  */
553  virtual void getActivityCoefficients(doublereal* ac) const {
554  if (m_kk == 1) {
555  ac[0] = 1.0;
556  } else {
557  err("getActivityCoefficients");
558  }
559  }
560 
561  //! Get the array of non-dimensional molar-based ln activity coefficients at
562  //! the current solution temperature, pressure, and solution concentration.
563  /*!
564  * @param lnac Output vector of ln activity coefficients. Length: m_kk.
565  */
566  virtual void getLnActivityCoefficients(doublereal* lnac) const;
567 
568  //@}
569  /// @name Partial Molar Properties of the Solution
570  //@{
571 
572  /**
573  * Get the array of non-dimensional species chemical potentials
574  * These are partial molar Gibbs free energies.
575  * \f$ \mu_k / \hat R T \f$.
576  * Units: unitless
577  *
578  * @param mu Output vector of dimensionless chemical potentials.
579  * Length: m_kk.
580  */
581  virtual void getChemPotentials_RT(doublereal* mu) const {
582  err("getChemPotentials_RT");
583  }
584 
585 
586  //! Get the species chemical potentials. Units: J/kmol.
587  /*!
588  * This function returns a vector of chemical potentials of the
589  * species in solution at the current temperature, pressure
590  * and mole fraction of the solution.
591  *
592  * @param mu Output vector of species chemical
593  * potentials. Length: m_kk. Units: J/kmol
594  */
595  virtual void getChemPotentials(doublereal* mu) const {
596  err("getChemPotentials");
597  }
598 
599  //! Get the species electrochemical potentials.
600  /*!
601  * These are partial molar quantities. This method adds a term \f$ F z_k
602  * \phi_p \f$ to each chemical potential.
603  * The electrochemical potential of species k in a phase p, \f$ \zeta_k \f$,
604  * is related to the chemical potential via
605  * the following equation,
606  *
607  * \f[
608  * \zeta_{k}(T,P) = \mu_{k}(T,P) + F z_k \phi_p
609  * \f]
610  *
611  * @param mu Output vector of species electrochemical
612  * potentials. Length: m_kk. Units: J/kmol
613  */
614  void getElectrochemPotentials(doublereal* mu) const {
615  getChemPotentials(mu);
616  double ve = Faraday * electricPotential();
617  for (size_t k = 0; k < m_kk; k++) {
618  mu[k] += ve*charge(k);
619  }
620  }
621 
622  //! Returns an array of partial molar enthalpies for the species
623  //! in the mixture. 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  err("getPartialMolarEnthalpies");
630  }
631 
632  //! Returns an array of partial molar entropies of the species in the
633  //! solution. Units: J/kmol/K.
634  /*!
635  * @param sbar Output vector of species partial molar entropies.
636  * Length = m_kk. units are J/kmol/K.
637  */
638  virtual void getPartialMolarEntropies(doublereal* sbar) const {
639  err("getPartialMolarEntropies");
640  }
641 
642  //! Return an array of partial molar internal energies for the
643  //! species in the mixture. Units: J/kmol.
644  /*!
645  * @param ubar Output vector of species partial molar internal energies.
646  * Length = m_kk. units are J/kmol.
647  */
648  virtual void getPartialMolarIntEnergies(doublereal* ubar) const {
649  err("getPartialMolarIntEnergies");
650  }
651 
652  //! Return an array of partial molar heat capacities for the
653  //! species in the mixture. Units: J/kmol/K
654  /*!
655  * @param cpbar Output vector of species partial molar heat
656  * capacities at constant pressure.
657  * Length = m_kk. units are J/kmol/K.
658  */
659  virtual void getPartialMolarCp(doublereal* cpbar) const {
660  err("getPartialMolarCp");
661  }
662 
663  //! Return an array of partial molar volumes for the
664  //! species in the mixture. Units: m^3/kmol.
665  /*!
666  * @param vbar Output vector of species partial molar volumes.
667  * Length = m_kk. units are m^3/kmol.
668  */
669  virtual void getPartialMolarVolumes(doublereal* vbar) const {
670  err("getPartialMolarVolumes");
671  }
672 
673  //! Return an array of derivatives of partial molar volumes wrt temperature for the
674  //! species in the mixture. Units: m^3/kmol.
675  /*!
676  * The derivative is at constant pressure
677  *
678  * @param d_vbar_dT Output vector of derivatives of species partial molar volumes wrt T.
679  * Length = m_kk. units are m^3/kmol/K.
680  */
681  virtual void getdPartialMolarVolumes_dT(doublereal* d_vbar_dT) const {
682  err("getdPartialMolarVolumes_dT");
683  }
684 
685  //! Return an array of derivatives of partial molar volumes wrt pressure for the
686  //! species in the mixture. Units: m^3/kmol.
687  /*!
688  * The derivative is at constant temperature
689  *
690  * @param d_vbar_dP Output vector of derivatives of species partial molar volumes wrt P.
691  * Length = m_kk. units are m^3/kmol/Pa.
692  */
693  virtual void getdPartialMolarVolumes_dP(doublereal* d_vbar_dP) const {
694  err("getdPartialMolarVolumes_dP");
695  }
696 
697  //@}
698  /// @name Properties of the Standard State of the Species in the Solution
699  //@{
700 
701  //! Get the array of chemical potentials at unit activity for the species
702  //! at their standard states at the current <I>T</I> and <I>P</I> of the solution.
703  /*!
704  * These are the standard state chemical potentials \f$ \mu^0_k(T,P)
705  * \f$. The values are evaluated at the current
706  * temperature and pressure of the solution
707  *
708  * @param mu Output vector of chemical potentials.
709  * Length: m_kk.
710  */
711  virtual void getStandardChemPotentials(doublereal* mu) const {
712  err("getStandardChemPotentials");
713  }
714 
715  //! Get the nondimensional Enthalpy functions for the species
716  //! at their standard states at the current <I>T</I> and <I>P</I> of the solution.
717  /*!
718  * @param hrt Output vector of nondimensional standard state enthalpies.
719  * Length: m_kk.
720  */
721  virtual void getEnthalpy_RT(doublereal* hrt) const {
722  err("getEnthalpy_RT");
723  }
724 
725  //! Get the array of nondimensional Entropy functions for the
726  //! standard state species at the current <I>T</I> and <I>P</I> of the solution.
727  /*!
728  * @param sr Output vector of nondimensional standard state entropies.
729  * Length: m_kk.
730  */
731  virtual void getEntropy_R(doublereal* sr) const {
732  err("getEntropy_R");
733  }
734 
735  //! Get the nondimensional Gibbs functions for the species
736  //! in their standard states at the current <I>T</I> and <I>P</I> of the solution.
737  /*!
738  * @param grt Output vector of nondimensional standard state gibbs free energies
739  * Length: m_kk.
740  */
741  virtual void getGibbs_RT(doublereal* grt) const {
742  err("getGibbs_RT");
743  }
744 
745  //! Get the Gibbs functions for the standard
746  //! state of the species at the current <I>T</I> and <I>P</I> of the solution
747  /*!
748  * Units are Joules/kmol
749  * @param gpure Output vector of standard state gibbs free energies
750  * Length: m_kk.
751  */
752  virtual void getPureGibbs(doublereal* gpure) const {
753  err("getPureGibbs");
754  }
755 
756  //! Returns the vector of nondimensional Internal Energies of the standard
757  //! state species at the current <I>T</I> and <I>P</I> of the solution
758  /*!
759  * @param urt output vector of nondimensional standard state internal energies
760  * of the species. Length: m_kk.
761  */
762  virtual void getIntEnergy_RT(doublereal* urt) const {
763  err("getIntEnergy_RT");
764  }
765 
766  //! Get the nondimensional Heat Capacities at constant
767  //! pressure for the species standard states
768  //! at the current <I>T</I> and <I>P</I> of the solution
769  /*!
770  * @param cpr Output vector of nondimensional standard state heat capacities
771  * Length: m_kk.
772  */
773  virtual void getCp_R(doublereal* cpr) const {
774  err("getCp_R");
775  }
776 
777  //! Get the molar volumes of the species standard states at the current
778  //! <I>T</I> and <I>P</I> of the solution.
779  /*!
780  * units = m^3 / kmol
781  *
782  * @param vol Output vector containing the standard state volumes.
783  * Length: m_kk.
784  */
785  virtual void getStandardVolumes(doublereal* vol) const {
786  err("getStandardVolumes");
787  }
788 
789  //! Get the derivative of the molar volumes of the species standard states wrt temperature at the current
790  //! <I>T</I> and <I>P</I> of the solution.
791  /*!
792  * The derivative is at constant pressure
793  * units = m^3 / kmol / K
794  *
795  * @param d_vol_dT Output vector containing derivatives of standard state volumes wrt T
796  * Length: m_kk.
797  */
798  virtual void getdStandardVolumes_dT(doublereal* d_vol_dT) const {
799  err("getdStandardVolumes_dT");
800  }
801 
802  //! Get the derivative molar volumes of the species standard states wrt pressure at the current
803  //! <I>T</I> and <I>P</I> of the solution.
804  /*!
805  * The derivative is at constant temperature.
806  * units = m^3 / kmol / Pa
807  *
808  * @param d_vol_dP Output vector containing the derivative of standard state volumes wrt P.
809  * Length: m_kk.
810  */
811  virtual void getdStandardVolumes_dP(doublereal* d_vol_dP) const {
812  err("getdStandardVolumes_dP");
813  }
814 
815  //@}
816  /// @name Thermodynamic Values for the Species Reference States
817  //@{
818 
819  //! Returns the vector of nondimensional
820  //! enthalpies of the reference state at the current temperature
821  //! of the solution and the reference pressure for the species.
822  /*!
823  * This base function will throw a CanteraException unless
824  * it is overwritten in a derived class.
825  *
826  * @param hrt Output vector containing the nondimensional reference state
827  * enthalpies
828  * Length: m_kk.
829  */
830  virtual void getEnthalpy_RT_ref(doublereal* hrt) const {
831  err("getEnthalpy_RT_ref");
832  }
833 
834  //! Returns the vector of nondimensional
835  //! Gibbs Free Energies of the reference state at the current temperature
836  //! of the solution and the reference pressure for the species.
837  /*!
838  * @param grt Output vector containing the nondimensional reference state
839  * Gibbs Free energies. Length: m_kk.
840  */
841  virtual void getGibbs_RT_ref(doublereal* grt) const {
842  err("getGibbs_RT_ref");
843  }
844 
845  //! Returns the vector of the
846  //! gibbs function of the reference state at the current temperature
847  //! of the solution and the reference pressure for the species.
848  /*!
849  * units = J/kmol
850  *
851  * @param g Output vector containing the reference state
852  * Gibbs Free energies. Length: m_kk. Units: J/kmol.
853  */
854  virtual void getGibbs_ref(doublereal* g) const {
855  err("getGibbs_ref");
856  }
857 
858  //! Returns the vector of nondimensional
859  //! entropies of the reference state at the current temperature
860  //! of the solution and the reference pressure for each species.
861  /*!
862  * @param er Output vector containing the nondimensional reference state
863  * entropies. Length: m_kk.
864  */
865  virtual void getEntropy_R_ref(doublereal* er) const {
866  err("getEntropy_R_ref");
867  }
868 
869  //! Returns the vector of nondimensional
870  //! internal Energies of the reference state at the current temperature
871  //! of the solution and the reference pressure for each species.
872  /*!
873  * @param urt Output vector of nondimensional reference state
874  * internal energies of the species.
875  * Length: m_kk
876  */
877  virtual void getIntEnergy_RT_ref(doublereal* urt) const {
878  err("getIntEnergy_RT_ref");
879  }
880 
881  //! Returns the vector of nondimensional
882  //! constant pressure heat capacities of the reference state
883  //! at the current temperature of the solution
884  //! and reference pressure for each species.
885  /*!
886  * @param cprt Output vector of nondimensional reference state
887  * heat capacities at constant pressure for the species.
888  * Length: m_kk
889  */
890  virtual void getCp_R_ref(doublereal* cprt) const {
891  err("getCp_R_ref()");
892  }
893 
894  //! Get the molar volumes of the species reference states at the current
895  //! <I>T</I> and <I>P_ref</I> of the solution.
896  /*!
897  * units = m^3 / kmol
898  *
899  * @param vol Output vector containing the standard state volumes.
900  * Length: m_kk.
901  */
902  virtual void getStandardVolumes_ref(doublereal* vol) const {
903  err("getStandardVolumes_ref");
904  }
905 
906  //! Sets the reference composition
907  /*!
908  * @param x Mole fraction vector to set the reference composition to.
909  * If this is zero, then the reference mole fraction
910  * is set to the current mole fraction vector.
911  */
912  virtual void setReferenceComposition(const doublereal* const x);
913 
914  //! Gets the reference composition
915  /*!
916  * The reference mole fraction is a safe mole fraction.
917  * @param x Mole fraction vector containing the reference composition.
918  */
919  virtual void getReferenceComposition(doublereal* const x) const;
920 
921  //
922  // The methods below are not virtual, and should not
923  // be overloaded.
924  //
925 
926  //@}
927  //! @name Specific Properties
928  //@{
929 
930  /**
931  * Specific enthalpy. Units: J/kg.
932  */
933  doublereal enthalpy_mass() const {
935  }
936 
937  /**
938  * Specific internal energy. Units: J/kg.
939  */
940  doublereal intEnergy_mass() const {
942  }
943 
944  /**
945  * Specific entropy. Units: J/kg/K.
946  */
947  doublereal entropy_mass() const {
949  }
950 
951  /**
952  * Specific Gibbs function. Units: J/kg.
953  */
954  doublereal gibbs_mass() const {
955  return gibbs_mole()/meanMolecularWeight();
956  }
957 
958  /**
959  * Specific heat at constant pressure. Units: J/kg/K.
960  */
961  doublereal cp_mass() const {
962  return cp_mole()/meanMolecularWeight();
963  }
964 
965  /**
966  * Specific heat at constant volume. Units: J/kg/K.
967  */
968  doublereal cv_mass() const {
969  return cv_mole()/meanMolecularWeight();
970  }
971  //@}
972 
973  //! Return the Gas Constant multiplied by the current temperature
974  /*!
975  * The units are Joules kmol-1
976  */
977  doublereal _RT() const {
978  return temperature() * GasConstant;
979  }
980 
981  /**
982  * @name Setting the State
983  *
984  * These methods set all or part of the thermodynamic
985  * state.
986  * @{
987  */
988 
989  //! Set the temperature (K), pressure (Pa), and mole fractions.
990  /*!
991  * Note, the mole fractions are set first before the pressure is set.
992  * Setting the pressure may involve the solution of a nonlinear equation.
993  *
994  * @param t Temperature (K)
995  * @param p Pressure (Pa)
996  * @param x Vector of mole fractions.
997  * Length is equal to m_kk.
998  */
999  virtual void setState_TPX(doublereal t, doublereal p, const doublereal* x);
1000 
1001  //! Set the temperature (K), pressure (Pa), and mole fractions.
1002  /*!
1003  * Note, the mole fractions are set first before the pressure is set.
1004  * Setting the pressure may involve the solution of a nonlinear equation.
1005  *
1006  * @param t Temperature (K)
1007  * @param p Pressure (Pa)
1008  * @param x Composition map of mole fractions. Species not in
1009  * the composition map are assumed to have zero mole fraction
1010  */
1011  virtual void setState_TPX(doublereal t, doublereal p, compositionMap& x);
1012 
1013  //! Set the temperature (K), pressure (Pa), and mole fractions.
1014  /*!
1015  * Note, the mole fractions are set first before the pressure is set.
1016  * Setting the pressure may involve the solution of a nonlinear equation.
1017  *
1018  * @param t Temperature (K)
1019  * @param p Pressure (Pa)
1020  * @param x String containing a composition map of the mole fractions. Species not in
1021  * the composition map are assumed to have zero mole fraction
1022  */
1023  virtual void setState_TPX(doublereal t, doublereal p, const std::string& x);
1024 
1025  //! Set the internally stored temperature (K), pressure (Pa), and mass fractions of the phase.
1026  /*!
1027  * Note, the mass fractions are set first before the pressure is set.
1028  * Setting the pressure may involve the solution of a nonlinear equation.
1029  *
1030  * @param t Temperature (K)
1031  * @param p Pressure (Pa)
1032  * @param y Vector of mass fractions.
1033  * Length is equal to m_kk.
1034  */
1035  virtual void setState_TPY(doublereal t, doublereal p, const doublereal* y);
1036 
1037  //! Set the internally stored temperature (K), pressure (Pa), and mass fractions of the phase
1038  /*!
1039  * Note, the mass fractions are set first before the pressure is set.
1040  * Setting the pressure may involve the solution of a nonlinear equation.
1041  *
1042  * @param t Temperature (K)
1043  * @param p Pressure (Pa)
1044  * @param y Composition map of mass fractions. Species not in
1045  * the composition map are assumed to have zero mass fraction
1046  */
1047  virtual void setState_TPY(doublereal t, doublereal p, compositionMap& y);
1048 
1049  //! Set the internally stored temperature (K), pressure (Pa), and mass fractions of the phase
1050  /*!
1051  * Note, the mass fractions are set first before the pressure is set.
1052  * Setting the pressure may involve the solution of a nonlinear equation.
1053  *
1054  * @param t Temperature (K)
1055  * @param p Pressure (Pa)
1056  * @param y String containing a composition map of the mass fractions. Species not in
1057  * the composition map are assumed to have zero mass fraction
1058  */
1059  virtual void setState_TPY(doublereal t, doublereal p, const std::string& y);
1060 
1061  //! Set the temperature (K) and pressure (Pa)
1062  /*!
1063  * Setting the pressure may involve the solution of a nonlinear equation.
1064  *
1065  * @param t Temperature (K)
1066  * @param p Pressure (Pa)
1067  */
1068  virtual void setState_TP(doublereal t, doublereal p);
1069 
1070  //! Set the pressure (Pa) and mole fractions.
1071  /*!
1072  * Note, the mole fractions are set first before the pressure is set.
1073  * Setting the pressure may involve the solution of a nonlinear equation.
1074  *
1075  * @param p Pressure (Pa)
1076  * @param x Vector of mole fractions.
1077  * Length is equal to m_kk.
1078  */
1079  virtual void setState_PX(doublereal p, doublereal* x);
1080 
1081  //! Set the internally stored pressure (Pa) and mass fractions.
1082  /*!
1083  * Note, the temperature is held constant during this operation.
1084  * Note, the mass fractions are set first before the pressure is set.
1085  * Setting the pressure may involve the solution of a nonlinear equation.
1086  *
1087  * @param p Pressure (Pa)
1088  * @param y Vector of mass fractions.
1089  * Length is equal to m_kk.
1090  */
1091  virtual void setState_PY(doublereal p, doublereal* y);
1092 
1093  //! Set the internally stored specific enthalpy (J/kg) and pressure (Pa) of the phase.
1094  /*!
1095  * @param h Specific enthalpy (J/kg)
1096  * @param p Pressure (Pa)
1097  * @param tol Optional parameter setting the tolerance of the calculation.
1098  * Important for some applications where numerical Jacobians
1099  * are being calculated.Defaults to 1.0E-4
1100  */
1101  virtual void setState_HP(doublereal h, doublereal p, doublereal tol = 1.e-4);
1102 
1103  //! Set the specific internal energy (J/kg) and specific volume (m^3/kg).
1104  /*!
1105  * This function fixes the internal state of the phase so that
1106  * the specific internal energy and specific volume have the value of the input parameters.
1107  *
1108  * @param u specific internal energy (J/kg)
1109  * @param v specific volume (m^3/kg).
1110  * @param tol Optional parameter setting the tolerance of the calculation.
1111  * Important for some applications where numerical Jacobians
1112  * are being calculated.Defaults to 1.0E-4
1113  */
1114  virtual void setState_UV(doublereal u, doublereal v, doublereal tol = 1.e-4);
1115 
1116 private:
1117 
1118  //! Carry out work in HP and UV calculations.
1119  /*!
1120  * @param h Specific enthalpy or internal energy (J/kg)
1121  * @param p Pressure (Pa) or specific volume (m^3/kg)
1122  * @param tol Optional parameter setting the tolerance of the calculation.
1123  * Defaults to 1.0E-4. Important for some applications where
1124  * numerical Jacobians are being calculated.
1125  * @param doUV True if solving for UV, false for HP.
1126  */
1127  void setState_HPorUV(doublereal h, doublereal p,
1128  doublereal tol = 1.e-4, bool doUV = false);
1129 
1130 public:
1131 
1132  //! Set the specific entropy (J/kg/K) and pressure (Pa).
1133  /*!
1134  * This function fixes the internal state of the phase so that
1135  * the specific entropy and the pressure have the value of the input parameters.
1136  *
1137  * @param s specific entropy (J/kg/K)
1138  * @param p specific pressure (Pa).
1139  * @param tol Optional parameter setting the tolerance of the calculation.
1140  * Defaults to 1.0E-4. Important for some applications where
1141  * numerical Jacobians are being calculated.
1142  */
1143  virtual void setState_SP(doublereal s, doublereal p, doublereal tol = 1.e-4);
1144 
1145  //! Set the specific entropy (J/kg/K) and specific volume (m^3/kg).
1146  /*!
1147  * This function fixes the internal state of the phase so that
1148  * the specific entropy and specific volume have the value of the input parameters.
1149  *
1150  * @param s specific entropy (J/kg/K)
1151  * @param v specific volume (m^3/kg).
1152  * @param tol Optional parameter setting the tolerance of the calculation.
1153  * Defaults to 1.0E-4. Important for some applications where
1154  * numerical Jacobians are being calculated.
1155  */
1156  virtual void setState_SV(doublereal s, doublereal v, doublereal tol = 1.e-4);
1157 
1158 private:
1159 
1160  //! Carry out work in SP and SV calculations.
1161  /*!
1162  * @param s Specific entropy (J/kg)
1163  * @param p Pressure (Pa) or specific volume (m^3/kg)
1164  * @param tol Optional parameter setting the tolerance of the calculation.
1165  * Defaults to 1.0E-4. Important for some applications where
1166  * numerical Jacobians are being calculated.
1167  * @param doSV True if solving for SV, false for SP.
1168  */
1169  void setState_SPorSV(doublereal s, doublereal p,
1170  doublereal tol = 1.e-4, bool doSV = false);
1171 
1172  //! Helper function used by setState_HPorUV and setState_SPorSV.
1173  //! Sets the temperature and (if set_p is true) the pressure.
1174  void setState_conditional_TP(doublereal t, doublereal p, bool set_p);
1175 public:
1176 
1177  //@}
1178 
1179  /**
1180  * @name Chemical Equilibrium
1181  * Chemical equilibrium.
1182  * @{
1183  */
1184 
1185 
1186  //!This method is used by the ChemEquil equilibrium solver.
1187  /*!
1188  * It sets the state such that the chemical potentials satisfy
1189  * \f[ \frac{\mu_k}{\hat R T} = \sum_m A_{k,m}
1190  * \left(\frac{\lambda_m} {\hat R T}\right) \f] where
1191  * \f$ \lambda_m \f$ is the element potential of element m. The
1192  * temperature is unchanged. Any phase (ideal or not) that
1193  * implements this method can be equilibrated by ChemEquil.
1194  *
1195  * @param lambda_RT Input vector of dimensionless element potentials
1196  * The length is equal to nElements().
1197  */
1198  virtual void setToEquilState(const doublereal* lambda_RT) {
1199  err("setToEquilState");
1200  }
1201 
1202  //! Stores the element potentials in the ThermoPhase object
1203  /*!
1204  * Called by function 'equilibrate' in ChemEquil.h to transfer
1205  * the element potentials to this object after every successful
1206  * equilibration routine.
1207  * The element potentials are stored in their dimensionless
1208  * forms, calculated by dividing by RT.
1209  *
1210  * @param lambda Input vector containing the element potentials.
1211  * Length = nElements. Units are Joules/kmol.
1212  */
1213  void setElementPotentials(const vector_fp& lambda);
1214 
1215 
1216  //! Returns the element potentials stored in the ThermoPhase object
1217  /*!
1218  * Returns the stored element potentials.
1219  * The element potentials are retrieved from their stored
1220  * dimensionless forms by multiplying by RT.
1221  * @param lambda Output vector containing the element potentials.
1222  * Length = nElements. Units are Joules/kmol.
1223  * @return bool indicating whether there are any valid stored element
1224  * potentials. The calling routine should check this
1225  * bool. In the case that there aren't any, lambda is not
1226  * touched.
1227  */
1228  bool getElementPotentials(doublereal* lambda) const;
1229 
1230  //@}
1231 
1232 
1233  //---------------------------------------------------------
1234  /// @name Critical State Properties.
1235  /// These methods are only implemented by some subclasses, and may
1236  /// be moved out of ThermoPhase at a later date.
1237 
1238  //@{
1239 
1240  /// Critical temperature (K).
1241  virtual doublereal critTemperature() const {
1242  err("critTemperature");
1243  return -1.0;
1244  }
1245 
1246  /// Critical pressure (Pa).
1247  virtual doublereal critPressure() const {
1248  err("critPressure");
1249  return -1.0;
1250  }
1251 
1252  /// Critical density (kg/m3).
1253  virtual doublereal critDensity() const {
1254  err("critDensity");
1255  return -1.0;
1256  }
1257 
1258  //@}
1259 
1260  /** @name Saturation Properties.
1261  *
1262  * These methods are only implemented by subclasses that
1263  * implement full liquid-vapor equations of state. They may be
1264  * moved out of %ThermoPhase at a later date.
1265  */
1266  //@{
1267 
1268  //! Return the saturation temperature given the pressure
1269  /*!
1270  * @param p Pressure (Pa)
1271  */
1272  virtual doublereal satTemperature(doublereal p) const {
1273  err("satTemperature");
1274  return -1.0;
1275  }
1276 
1277  //! Return the saturation pressure given the temperature
1278  /*!
1279  * @param t Temperature (Kelvin)
1280  */
1281  virtual doublereal satPressure(doublereal t) {
1282  err("satPressure");
1283  return -1.0;
1284  }
1285 
1286  //! Return the fraction of vapor at the current conditions
1287  virtual doublereal vaporFraction() const {
1288  err("vaprFraction");
1289  return -1.0;
1290  }
1291 
1292  //! Set the state to a saturated system at a particular temperature
1293  /*!
1294  * @param t Temperature (kelvin)
1295  * @param x Fraction of vapor
1296  */
1297  virtual void setState_Tsat(doublereal t, doublereal x) {
1298  err("setState_sat");
1299  }
1300 
1301  //! Set the state to a saturated system at a particular pressure
1302  /*!
1303  * @param p Pressure (Pa)
1304  * @param x Fraction of vapor
1305  */
1306  virtual void setState_Psat(doublereal p, doublereal x) {
1307  err("setState_sat");
1308  }
1309 
1310  //@}
1311 
1312 
1313  //! @name Initialization Methods - For Internal Use (%ThermoPhase)
1314  /*!
1315  * The following methods are used in the process of constructing
1316  * the phase and setting its parameters from a specification in an
1317  * input file. They are not normally used in application programs.
1318  * To see how they are used,
1319  * see files importCTML.cpp and ThermoFactory.cpp.
1320  */
1321  //@{
1322 
1323  //! Store a reference pointer to the XML tree containing the species data
1324  //! for this phase.
1325  /*!
1326  * This is used to access data needed to construct transport manager later.
1327  * @internal
1328  *
1329  * @param k Species index
1330  * @param data Pointer to the XML_Node data containing
1331  * information about the species in the phase.
1332  */
1333  void saveSpeciesData(const size_t k, const XML_Node* const data);
1334 
1335  //! Return a pointer to the vector of XML nodes containing the species
1336  //! data for this phase.
1337  const std::vector<const XML_Node*> & speciesData() const;
1338 
1339  //! Install a species thermodynamic property manager.
1340  /*!
1341  * The species thermodynamic property manager
1342  * computes properties of the pure species for use in
1343  * constructing solution properties. It is meant for internal
1344  * use, and some classes derived from ThermoPhase may not use
1345  * any species thermodynamic property manager. This method is
1346  * called by function importPhase() in importCTML.cpp.
1347  *
1348  * @param spthermo input pointer to the species thermodynamic property
1349  * manager.
1350  *
1351  * @internal
1352  */
1353  void setSpeciesThermo(SpeciesThermo* spthermo);
1354 
1355  //! Return a changeable reference to the calculation manager
1356  //! for species reference-state thermodynamic properties
1357  /*!
1358  *
1359  * @param k Species id. The default is -1, meaning return the default
1360  *
1361  * @internal
1362  */
1363  virtual SpeciesThermo& speciesThermo(int k = -1);
1364 
1365  /**
1366  * @internal
1367  * Initialization of a ThermoPhase object using an
1368  * ctml file.
1369  *
1370  * This routine is a precursor to initThermoXML(XML_Node*)
1371  * routine, which does most of the work.
1372  * Here we read extra information about the XML description
1373  * of a phase. Regular information about elements and species
1374  * and their reference state thermodynamic information
1375  * have already been read at this point.
1376  * For example, we do not need to call this function for
1377  * ideal gas equations of state.
1378  *
1379  * @param inputFile XML file containing the description of the
1380  * phase
1381  *
1382  * @param id Optional parameter identifying the name of the
1383  * phase. If none is given, the first XML
1384  * phase element encountered will be used.
1385  */
1386  virtual void initThermoFile(const std::string& inputFile,
1387  const std::string& id);
1388 
1389  //!Import and initialize a ThermoPhase object using an XML tree.
1390  /*!
1391  * @internal
1392  *
1393  * Here we read extra information about the XML description
1394  * of a phase. Regular information about elements and species
1395  * and their reference state thermodynamic information
1396  * have already been read at this point.
1397  * For example, we do not need to call this function for
1398  * ideal gas equations of state. This function is called from importPhase()
1399  * after the elements and the species are initialized with
1400  * default ideal solution level data.
1401  *
1402  * The default implementation in ThermoPhase calls the
1403  * virtual function initThermo() and then sets the "state" of the
1404  * phase by looking for an XML element named "state", and then
1405  * interpreting its contents by calling the virtual function
1406  * setStateFromXML().
1407  *
1408  * @param phaseNode This object must be the phase node of a
1409  * complete XML tree
1410  * description of the phase, including all of the
1411  * species data. In other words while "phase" must
1412  * point to an XML phase object, it must have
1413  * sibling nodes "speciesData" that describe
1414  * the species in the phase.
1415  * @param id ID of the phase. If nonnull, a check is done
1416  * to see if phaseNode is pointing to the phase
1417  * with the correct id.
1418  */
1419  virtual void initThermoXML(XML_Node& phaseNode, const std::string& id);
1420 
1421  //! Initialize the ThermoPhase object after all species have been set up
1422  /*!
1423  * @internal Initialize.
1424  *
1425  * This method is provided to allow
1426  * subclasses to perform any initialization required after all
1427  * species have been added. For example, it might be used to
1428  * resize internal work arrays that must have an entry for
1429  * each species. The base class implementation does nothing,
1430  * and subclasses that do not require initialization do not
1431  * need to overload this method. When importing a CTML phase
1432  * description, this method is called from ThermoPhase::initThermoXML(),
1433  * which is called from importPhase(),
1434  * just prior to returning from function importPhase().
1435  *
1436  * @see importCTML.cpp
1437  */
1438  virtual void initThermo();
1439 
1440  //! Add in species from Slave phases
1441  /*!
1442  * This hook is used for cSS_CONVENTION_SLAVE phases
1443  *
1444  * @param phaseNode XML Element for the phase
1445  */
1446  virtual void installSlavePhases(Cantera::XML_Node* phaseNode);
1447 
1448  //! Set the equation of state parameters
1449  /*!
1450  * @internal
1451  * The number and meaning of these depends on the subclass.
1452  *
1453  * @param n number of parameters
1454  * @param c array of \a n coefficients
1455  * @deprecated Use methods specific to the derived class
1456  */
1457  virtual void setParameters(int n, doublereal* const c) {
1458  warn_deprecated("ThermoPhase::setParameters");
1459  }
1460 
1461 
1462  //! Get the equation of state parameters in a vector
1463  /*!
1464  * @internal
1465  * The number and meaning of these depends on the subclass.
1466  *
1467  * @param n number of parameters
1468  * @param c array of \a n coefficients
1469  * @deprecated Use methods specific to the derived class
1470  */
1471  virtual void getParameters(int& n, doublereal* const c) const {
1472  warn_deprecated("ThermoPhase::getParameters");
1473  }
1474 
1475 
1476  //! Set equation of state parameter values from XML entries.
1477  /*!
1478  *
1479  * This method is called by function importPhase() in
1480  * file importCTML.cpp when processing a phase definition in
1481  * an input file. It should be overloaded in subclasses to set
1482  * any parameters that are specific to that particular phase
1483  * model. Note, this method is called before the phase is
1484  * initialized with elements and/or species.
1485  *
1486  * @param eosdata An XML_Node object corresponding to
1487  * the "thermo" entry for this phase in the input file.
1488  */
1489  virtual void setParametersFromXML(const XML_Node& eosdata) {}
1490 
1491 
1492  //! Set the initial state of the phase to the conditions
1493  //! specified in the state XML element.
1494  /*!
1495  *
1496  * This method sets the temperature, pressure, and mole
1497  * fraction vector to a set default value.
1498  *
1499  * @param state AN XML_Node object corresponding to
1500  * the "state" entry for this phase in the
1501  * input file.
1502  */
1503  virtual void setStateFromXML(const XML_Node& state);
1504 
1505  //! @}
1506  //! @name Derivatives of Thermodynamic Variables needed for Applications
1507  //! @{
1508 
1509  //! Get the change in activity coefficients wrt changes in state (temp, mole fraction, etc) along
1510  //! a line in parameter space or along a line in physical space
1511  /*!
1512  *
1513  * @param dTds Input of temperature change along the path
1514  * @param dXds Input vector of changes in mole fraction along the path. length = m_kk
1515  * Along the path length it must be the case that the mole fractions sum to one.
1516  * @param dlnActCoeffds Output vector of the directional derivatives of the
1517  * log Activity Coefficients along the path. length = m_kk
1518  * units are 1/units(s). if s is a physical coordinate then the units are 1/m.
1519  */
1520  virtual void getdlnActCoeffds(const doublereal dTds, const doublereal* const dXds,
1521  doublereal* dlnActCoeffds) const {
1522  err("getdlnActCoeffds");
1523  }
1524 
1525  //! Get the array of ln mole fraction derivatives of the log activity coefficients - diagonal component only
1526  /*!
1527  * This function is a virtual method. For ideal mixtures
1528  * (unity activity coefficients), this can return zero.
1529  * Implementations should take the derivative of the
1530  * logarithm of the activity coefficient with respect to the
1531  * logarithm of the mole fraction variable
1532  * that represents the standard state.
1533  * This quantity is to be used in conjunction with derivatives of
1534  * that mole fraction variable when the derivative of the chemical
1535  * potential is taken.
1536  *
1537  * units = dimensionless
1538  *
1539  * @param dlnActCoeffdlnX_diag Output vector of derivatives of the
1540  * log Activity Coefficients wrt the mole fractions. length = m_kk
1541  */
1542  virtual void getdlnActCoeffdlnX_diag(doublereal* dlnActCoeffdlnX_diag) const {
1543  err("getdlnActCoeffdlnX_diag");
1544  }
1545 
1546  //! Get the array of log species mole number derivatives of the log activity coefficients
1547  /*!
1548  * This function is a virtual method.
1549  * For ideal mixtures (unity activity coefficients), this can return zero.
1550  * Implementations should take the derivative of the
1551  * logarithm of the activity coefficient with respect to the
1552  * logarithm of the concentration-like variable (i.e. moles)
1553  * that represents the standard state.
1554  * This quantity is to be used in conjunction with derivatives of
1555  * that species mole number variable when the derivative of the chemical
1556  * potential is taken.
1557  *
1558  * units = dimensionless
1559  *
1560  * @param dlnActCoeffdlnN_diag Output vector of derivatives of the
1561  * log Activity Coefficients. length = m_kk
1562  */
1563  virtual void getdlnActCoeffdlnN_diag(doublereal* dlnActCoeffdlnN_diag) const {
1564  err("getdlnActCoeffdlnN_diag");
1565  }
1566 
1567  //! Get the array of derivatives of the log activity coefficients with respect to the log of the species mole numbers
1568  /*!
1569  * Implementations should take the derivative of the logarithm of the activity coefficient with respect to a
1570  * species log mole number (with all other species mole numbers held constant). The default treatment in the
1571  * %ThermoPhase object is to set this vector to zero.
1572  *
1573  * units = 1 / kmol
1574  *
1575  * dlnActCoeffdlnN[ ld * k + m] will contain the derivative of log act_coeff for the <I>m</I><SUP>th</SUP>
1576  * species with respect to the number of moles of the <I>k</I><SUP>th</SUP> species.
1577  *
1578  * \f[
1579  * \frac{d \ln(\gamma_m) }{d \ln( n_k ) }\Bigg|_{n_i}
1580  * \f]
1581  *
1582  * @param ld Number of rows in the matrix
1583  * @param dlnActCoeffdlnN Output vector of derivatives of the
1584  * log Activity Coefficients. length = m_kk * m_kk
1585  */
1586  virtual void getdlnActCoeffdlnN(const size_t ld, doublereal* const dlnActCoeffdlnN);
1587 
1588  virtual void getdlnActCoeffdlnN_numderiv(const size_t ld, doublereal* const dlnActCoeffdlnN);
1589 
1590  //! @}
1591  //! @name Printing
1592  //! @{
1593 
1594  //! returns a summary of the state of the phase as a string
1595  /*!
1596  * @param show_thermo If true, extra information is printed out
1597  * about the thermodynamic state of the system.
1598  */
1599  virtual std::string report(bool show_thermo = true) const;
1600 
1601  //! returns a summary of the state of the phase to a comma separated file.
1602  //! To customize the data included in the report, derived classes should
1603  //! override the getCsvReportData method.
1604  /*!
1605  * @param csvFile ofstream file to print comma separated data for
1606  * the phase
1607  */
1608  virtual void reportCSV(std::ofstream& csvFile) const;
1609 
1610  //@}
1611 
1612 protected:
1613 
1614  //! Fills `names` and `data` with the column names and species thermo
1615  //! properties to be included in the output of the reportCSV method.
1616  virtual void getCsvReportData(std::vector<std::string>& names,
1617  std::vector<vector_fp>& data) const;
1618 
1619  //! Pointer to the calculation manager for species
1620  //! reference-state thermodynamic properties
1621  /*!
1622  * This class is called when the reference-state thermodynamic properties
1623  * of all the species in the phase needs to be evaluated.
1624  */
1626 
1627  //! Vector of pointers to the species databases.
1628  /*!
1629  * This is used to access data needed to
1630  * construct the transport manager and other properties
1631  * later in the initialization process.
1632  * We create a copy of the XML_Node data read in here. Therefore, we own this
1633  * data.
1634  */
1635  std::vector<const XML_Node*> m_speciesData;
1636 
1637  //! Stored value of the electric potential for this phase
1638  /*!
1639  * Units are Volts
1640  */
1641  doublereal m_phi;
1642 
1643  /// Vector of element potentials.
1644  /// Length equal to number of elements.
1646 
1647  //! Boolean indicating whether there is a valid set of saved element potentials
1648  //! for this phase
1650 
1651  //! Boolean indicating whether a charge neutrality condition is a necessity
1652  /*!
1653  * Note, the charge neutrality condition is not a necessity for ideal gas phases. There may
1654  * be a net charge in those phases, because the NASA polynomials for ionized species
1655  * in Ideal gases take this condition into account.
1656  * However, liquid phases usually require charge neutrality in order for their derived
1657  * thermodynamics to be valid.
1658  */
1660 
1661  //! Contains the standard state convention
1663 
1664  //! Reference Mole Fraction Composition
1665  /*!
1666  * Occasionally, the need arises to find a safe mole fraction vector to initialize
1667  * the object to. This contains such a vector.
1668  * The algorithm will pick up the mole fraction vector that is applied from
1669  * the state xml file in the input file
1670  */
1671  std::vector<doublereal> xMol_Ref;
1672 
1673 private:
1674 
1675  //! Error function that gets called for unhandled cases
1676  /*!
1677  * @param msg String containing the message.
1678  */
1679  doublereal err(const std::string& msg) const;
1680 
1681 };
1682 
1683 //! typedef for the ThermoPhase class
1685 
1686 }
1687 
1688 #endif
1689 
std::map< std::string, doublereal > compositionMap
Map connecting a string name with a double.
Definition: ct_defs.h:162
virtual void setState_HP(doublereal h, doublereal p, doublereal tol=1.e-4)
Set the internally stored specific enthalpy (J/kg) and pressure (Pa) of the phase.
ThermoPhase()
Constructor.
Definition: ThermoPhase.cpp:23
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...
Definition: ThermoPhase.h:854
virtual doublereal vaporFraction() const
Return the fraction of vapor at the current conditions.
Definition: ThermoPhase.h:1287
doublereal electricPotential() const
Returns the electric potential of this phase (V).
Definition: ThermoPhase.h:391
doublereal err(const std::string &msg) const
Error function that gets called for unhandled cases.
virtual doublereal gibbs_mole() const
Molar Gibbs function. Units: J/kmol.
Definition: ThermoPhase.h:279
virtual void getParameters(int &n, doublereal *const c) const
Get the equation of state parameters in a vector.
Definition: ThermoPhase.h:1471
virtual void getChemPotentials_RT(doublereal *mu) const
Get the array of non-dimensional species chemical potentials These are partial molar Gibbs free energ...
Definition: ThermoPhase.h:581
std::vector< const XML_Node * > m_speciesData
Vector of pointers to the species databases.
Definition: ThermoPhase.h:1635
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: ThermoPhase.h:721
virtual void setState_TPX(doublereal t, doublereal p, const doublereal *x)
Set the temperature (K), pressure (Pa), and mole fractions.
virtual void setState_Psat(doublereal p, doublereal x)
Set the state to a saturated system at a particular pressure.
Definition: ThermoPhase.h:1306
void setElectricPotential(doublereal v)
Set the electric potential of this phase (V).
Definition: ThermoPhase.h:383
virtual doublereal cv_vib(int, double) const
Definition: ThermoPhase.h:298
doublereal _RT() const
Return the Gas Constant multiplied by the current temperature.
Definition: ThermoPhase.h:977
virtual void initThermo()
Initialize the ThermoPhase object after all species have been set up.
const size_t npos
index returned by functions to indicate "no position"
Definition: ct_defs.h:173
ThermoPhase & operator=(const ThermoPhase &right)
Assignment operator.
Definition: ThermoPhase.cpp:57
Header file for class Phase.
const int cAC_CONVENTION_MOLAR
Standard state uses the molar convention.
Definition: ThermoPhase.h:24
virtual doublereal maxTemp(size_t k=npos) const =0
Maximum temperature.
void setState_HPorUV(doublereal h, doublereal p, doublereal tol=1.e-4, bool doUV=false)
Carry out work in HP and UV calculations.
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 void reportCSV(std::ofstream &csvFile) const
returns a summary of the state of the phase to a comma separated file.
const int cSS_CONVENTION_TEMPERATURE
Standard state uses the molar convention.
Definition: ThermoPhase.h:34
Class XML_Node is a tree-based representation of the contents of an XML file.
Definition: xml.h:100
void setState_conditional_TP(doublereal t, doublereal p, bool set_p)
Helper function used by setState_HPorUV and setState_SPorSV.
void warn_deprecated(const std::string &method, const std::string &extra)
Print a warning indicating that method is deprecated.
Definition: global.cpp:76
Virtual base class for the calculation of multiple-species thermodynamic reference-state property man...
virtual void getEntropy_R_ref(doublereal *er) const
Returns the vector of nondimensional entropies of the reference state at the current temperature of t...
Definition: ThermoPhase.h:865
virtual void getStandardVolumes(doublereal *vol) const
Get the molar volumes of the species standard states at the current T and P of the solution...
Definition: ThermoPhase.h:785
Base class for phases of matter.
Definition: Phase.h:98
virtual void getdlnActCoeffdlnX_diag(doublereal *dlnActCoeffdlnX_diag) const
Get the array of ln mole fraction derivatives of the log activity coefficients - diagonal component o...
Definition: ThermoPhase.h:1542
virtual doublereal critTemperature() const
Critical temperature (K).
Definition: ThermoPhase.h:1241
vector_fp m_lambdaRRT
Vector of element potentials.
Definition: ThermoPhase.h:1645
virtual void getStandardChemPotentials(doublereal *mu) const
Get the array of chemical potentials at unit activity for the species at their standard states at the...
Definition: ThermoPhase.h:711
virtual void getPartialMolarVolumes(doublereal *vbar) const
Return an array of partial molar volumes for the species in the mixture.
Definition: ThermoPhase.h:669
virtual doublereal satPressure(doublereal t)
Return the saturation pressure given the temperature.
Definition: ThermoPhase.h:1281
void saveSpeciesData(const size_t k, const XML_Node *const data)
Store a reference pointer to the XML tree containing the species data for this phase.
Pure Virtual base class for the species thermo manager classes.
virtual void setState_PY(doublereal p, doublereal *y)
Set the internally stored pressure (Pa) and mass fractions.
virtual doublereal entropy_mole() const
Molar entropy. Units: J/kmol/K.
Definition: ThermoPhase.h:274
virtual void getEnthalpy_RT_ref(doublereal *hrt) const
Returns the vector of nondimensional enthalpies of the reference state at the current temperature of ...
Definition: ThermoPhase.h:830
virtual void getdlnActCoeffdlnN_diag(doublereal *dlnActCoeffdlnN_diag) const
Get the array of log species mole number derivatives of the log activity coefficients.
Definition: ThermoPhase.h:1563
virtual doublereal standardConcentration(size_t k=0) const
Return the standard concentration for the kth species.
Definition: ThermoPhase.h:487
virtual doublereal thermalExpansionCoeff() const
Return the volumetric thermal expansion coefficient. Units: 1/K.
Definition: ThermoPhase.h:358
doublereal intEnergy_mass() const
Specific internal energy.
Definition: ThermoPhase.h:940
ThermoPhase thermo_t
typedef for the ThermoPhase class
Definition: ThermoPhase.h:1684
Base class for a phase with thermodynamic properties.
Definition: ThermoPhase.h:101
virtual void setReferenceComposition(const doublereal *const x)
Sets the reference composition.
bool getElementPotentials(doublereal *lambda) const
Returns the element potentials stored in the ThermoPhase object.
bool m_chargeNeutralityNecessary
Boolean indicating whether a charge neutrality condition is a necessity.
Definition: ThermoPhase.h:1659
virtual void setStateFromXML(const XML_Node &state)
Set the initial state of the phase to the conditions specified in the state XML element.
virtual doublereal intEnergy_mole() const
Molar internal energy. Units: J/kmol.
Definition: ThermoPhase.h:269
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...
Definition: ThermoPhase.h:752
virtual void getActivities(doublereal *a) const
Get the array of non-dimensional activities at the current solution temperature, pressure, and solution concentration.
virtual doublereal enthalpy_mole() const
Molar enthalpy. Units: J/kmol.
Definition: ThermoPhase.h:264
virtual doublereal critDensity() const
Critical density (kg/m3).
Definition: ThermoPhase.h:1253
doublereal gibbs_mass() const
Specific Gibbs function.
Definition: ThermoPhase.h:954
virtual void getIntEnergy_RT(doublereal *urt) const
Returns the vector of nondimensional Internal Energies of the standard state species at the current T...
Definition: ThermoPhase.h:762
doublereal entropy_mass() const
Specific entropy.
Definition: ThermoPhase.h:947
doublereal m_phi
Stored value of the electric potential for this phase.
Definition: ThermoPhase.h:1641
doublereal molarVolume() const
Molar volume (m^3/kmol).
Definition: Phase.cpp:607
virtual void getUnitsStandardConc(double *uA, int k=0, int sizeUA=6) const
Returns the units of the standard and generalized concentrations.
virtual ThermoPhase * duplMyselfAsThermoPhase() const
Duplication routine for objects which inherit from ThermoPhase.
virtual void getdStandardVolumes_dT(doublereal *d_vol_dT) const
Get the derivative of the molar volumes of the species standard states wrt temperature at the current...
Definition: ThermoPhase.h:798
virtual doublereal maxTemp(size_t k=npos) const
Maximum temperature for which the thermodynamic data for the species are valid.
Definition: ThermoPhase.h:244
virtual void getdPartialMolarVolumes_dT(doublereal *d_vbar_dT) const
Return an array of derivatives of partial molar volumes wrt temperature for the species in the mixtur...
Definition: ThermoPhase.h:681
virtual void getChemPotentials(doublereal *mu) const
Get the species chemical potentials. Units: J/kmol.
Definition: ThermoPhase.h:595
virtual void getGibbs_RT_ref(doublereal *grt) const
Returns the vector of nondimensional Gibbs Free Energies of the reference state at the current temper...
Definition: ThermoPhase.h:841
virtual void getCp_R(doublereal *cpr) const
Get the nondimensional Heat Capacities at constant pressure for the species standard states at the cu...
Definition: ThermoPhase.h:773
doublereal cp_mass() const
Specific heat at constant pressure.
Definition: ThermoPhase.h:961
bool chargeNeutralityNecessary() const
Returns the chargeNeutralityNecessity boolean.
Definition: ThermoPhase.h:255
virtual void setState_SP(doublereal s, doublereal p, doublereal tol=1.e-4)
Set the specific entropy (J/kg/K) and pressure (Pa).
virtual void setState_TPY(doublereal t, doublereal p, const doublereal *y)
Set the internally stored temperature (K), pressure (Pa), and mass fractions of the phase...
doublereal Hf298SS(const int k) const
Report the 298 K Heat of Formation of the standard state of one species (J kmol-1) ...
Definition: ThermoPhase.h:215
virtual void getCsvReportData(std::vector< std::string > &names, std::vector< vector_fp > &data) const
Fills names and data with the column names and species thermo properties to be included in the output...
int m_ssConvention
Contains the standard state convention.
Definition: ThermoPhase.h:1662
virtual doublereal refPressure(size_t k=npos) const =0
The reference-state pressure for species k.
virtual void getdlnActCoeffds(const doublereal dTds, const doublereal *const dXds, doublereal *dlnActCoeffds) const
Get the change in activity coefficients wrt changes in state (temp, mole fraction, etc) along a line in parameter space or along a line in physical space.
Definition: ThermoPhase.h:1520
virtual void getReferenceComposition(doublereal *const x) const
Gets the reference composition.
virtual void getPartialMolarEntropies(doublereal *sbar) const
Returns an array of partial molar entropies of the species in the solution.
Definition: ThermoPhase.h:638
const int cAC_CONVENTION_MOLALITY
Standard state uses the molality convention.
Definition: ThermoPhase.h:26
doublereal cv_mass() const
Specific heat at constant volume.
Definition: ThermoPhase.h:968
void setElementPotentials(const vector_fp &lambda)
Stores the element potentials in the ThermoPhase object.
virtual void setState_UV(doublereal u, doublereal v, doublereal tol=1.e-4)
Set the specific internal energy (J/kg) and specific volume (m^3/kg).
virtual std::string report(bool show_thermo=true) const
returns a summary of the state of the phase as a string
virtual void getdStandardVolumes_dP(doublereal *d_vol_dP) const
Get the derivative molar volumes of the species standard states wrt pressure at the current T and P o...
Definition: ThermoPhase.h:811
virtual void getPartialMolarIntEnergies(doublereal *ubar) const
Return an array of partial molar internal energies for the species in the mixture.
Definition: ThermoPhase.h:648
virtual void setState_TP(doublereal t, doublereal p)
Set the temperature (K) and pressure (Pa)
virtual doublereal refPressure() const
Returns the reference pressure in Pa.
Definition: ThermoPhase.h:159
virtual void getStandardVolumes_ref(doublereal *vol) const
Get the molar volumes of the species reference states at the current T and P_ref of the solution...
Definition: ThermoPhase.h:902
virtual doublereal cv_mole() const
Molar heat capacity at constant volume. Units: J/kmol/K.
Definition: ThermoPhase.h:289
virtual doublereal critPressure() const
Critical pressure (Pa).
Definition: ThermoPhase.h:1247
virtual doublereal minTemp(size_t k=npos) const =0
Minimum temperature.
virtual doublereal pressure() const
Return the thermodynamic pressure (Pa).
Definition: ThermoPhase.h:314
virtual void installSlavePhases(Cantera::XML_Node *phaseNode)
Add in species from Slave phases.
virtual doublereal isothermalCompressibility() const
Returns the isothermal compressibility. Units: 1/Pa.
Definition: ThermoPhase.h:346
virtual void setState_SV(doublereal s, doublereal v, doublereal tol=1.e-4)
Set the specific entropy (J/kg/K) and specific volume (m^3/kg).
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: ThermoPhase.h:731
doublereal temperature() const
Temperature (K).
Definition: Phase.h:528
virtual void getActivityConcentrations(doublereal *c) const
This method returns an array of generalized concentrations.
Definition: ThermoPhase.h:465
virtual void setPressure(doublereal p)
Set the internally stored pressure (Pa) at constant temperature and composition.
Definition: ThermoPhase.h:331
virtual void initThermoXML(XML_Node &phaseNode, const std::string &id)
Import and initialize a ThermoPhase object using an XML tree.
virtual int standardStateConvention() const
This method returns the convention used in specification of the standard state, of which there are cu...
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
void setState_SPorSV(doublereal s, doublereal p, doublereal tol=1.e-4, bool doSV=false)
Carry out work in SP and SV calculations.
virtual void getLnActivityCoefficients(doublereal *lnac) const
Get the array of non-dimensional molar-based ln activity coefficients at the current solution tempera...
virtual int eosType() const
Equation of state type flag.
Definition: ThermoPhase.h:151
doublereal enthalpy_mass() const
Specific enthalpy.
Definition: ThermoPhase.h:933
virtual void getdPartialMolarVolumes_dP(doublereal *d_vbar_dP) const
Return an array of derivatives of partial molar volumes wrt pressure for the species in the mixture...
Definition: ThermoPhase.h:693
virtual void setParametersFromXML(const XML_Node &eosdata)
Set equation of state parameter values from XML entries.
Definition: ThermoPhase.h:1489
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 getActivityCoefficients(doublereal *ac) const
Get the array of non-dimensional molar-based activity coefficients at the current solution temperatur...
Definition: ThermoPhase.h:553
virtual void setState_PX(doublereal p, doublereal *x)
Set the pressure (Pa) and mole fractions.
virtual int activityConvention() const
This method returns the convention used in specification of the activities, of which there are curren...
const int cSS_CONVENTION_VPSS
Standard state uses the molality convention.
Definition: ThermoPhase.h:36
const std::vector< const XML_Node * > & speciesData() const
Return a pointer to the vector of XML nodes containing the species data for this phase.
std::vector< doublereal > xMol_Ref
Reference Mole Fraction Composition.
Definition: ThermoPhase.h:1671
virtual void getCp_R_ref(doublereal *cprt) const
Returns the vector of nondimensional constant pressure heat capacities of the reference state at the ...
Definition: ThermoPhase.h:890
virtual void getPartialMolarEnthalpies(doublereal *hbar) const
Returns an array of partial molar enthalpies for the species in the mixture.
Definition: ThermoPhase.h:628
virtual doublereal cp_mole() const
Molar heat capacity at constant pressure. Units: J/kmol/K.
Definition: ThermoPhase.h:284
virtual void setParameters(int n, doublereal *const c)
Set the equation of state parameters.
Definition: ThermoPhase.h:1457
virtual SpeciesThermo & speciesThermo(int k=-1)
Return a changeable reference to the calculation manager for species reference-state thermodynamic pr...
virtual doublereal logStandardConc(size_t k=0) const
Natural logarithm of the standard concentration of the kth species.
size_t m_kk
Number of species in the phase.
Definition: Phase.h:716
virtual void getdlnActCoeffdlnN(const size_t ld, doublereal *const dlnActCoeffdlnN)
Get the array of derivatives of the log activity coefficients with respect to the log of the species ...
virtual void getPartialMolarCp(doublereal *cpbar) const
Return an array of partial molar heat capacities for the species in the mixture.
Definition: ThermoPhase.h:659
void setSpeciesThermo(SpeciesThermo *spthermo)
Install a species thermodynamic property manager.
virtual void initThermoFile(const std::string &inputFile, const std::string &id)
virtual void setState_Tsat(doublereal t, doublereal x)
Set the state to a saturated system at a particular temperature.
Definition: ThermoPhase.h:1297
virtual ~ThermoPhase()
Destructor. Deletes the species thermo manager.
Definition: ThermoPhase.cpp:33
virtual doublereal satTemperature(doublereal p) const
Return the saturation temperature given the pressure.
Definition: ThermoPhase.h:1272
virtual void getIntEnergy_RT_ref(doublereal *urt) const
Returns the vector of nondimensional internal Energies of the reference state at the current temperat...
Definition: ThermoPhase.h:877
bool m_hasElementPotentials
Boolean indicating whether there is a valid set of saved element potentials for this phase...
Definition: ThermoPhase.h:1649
void getElectrochemPotentials(doublereal *mu) const
Get the species electrochemical potentials.
Definition: ThermoPhase.h:614
virtual void setToEquilState(const doublereal *lambda_RT)
This method is used by the ChemEquil equilibrium solver.
Definition: ThermoPhase.h:1198
SpeciesThermo * m_spthermo
Pointer to the calculation manager for species reference-state thermodynamic properties.
Definition: ThermoPhase.h:1625
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: ThermoPhase.h:741
const int cSS_CONVENTION_SLAVE
Standard state thermodynamics is obtained from slave ThermoPhase objects.
Definition: ThermoPhase.h:38
virtual doublereal minTemp(size_t k=npos) const
Minimum temperature for which the thermodynamic data for the species or phase are valid...
Definition: ThermoPhase.h:175
doublereal charge(size_t k) const
Dimensionless electrical charge of a single molecule of species k The charge is normalized by the the...
Definition: Phase.h:504