Cantera  2.3.0
VPSSMgr.h
Go to the documentation of this file.
1 /**
2  * @file VPSSMgr.h
3  * Declaration file for a virtual base class that manages
4  * the calculation of standard state properties for all of the
5  * species in a single phase, assuming a variable P and T standard state
6  * (see \ref mgrpdssthermocalc and
7  * class \link Cantera::VPSSMgr VPSSMgr\endlink).
8  */
9 
10 // This file is part of Cantera. See License.txt in the top-level directory or
11 // at http://www.cantera.org/license.txt for license and copyright information.
12 
13 #ifndef CT_VPSSMGR_H
14 #define CT_VPSSMGR_H
15 
16 #include "mix_defs.h"
17 #include "cantera/base/global.h"
18 
19 namespace Cantera
20 {
21 
22 class VPStandardStateTP;
23 class MultiSpeciesThermo;
24 class PDSS;
25 /**
26  * @defgroup mgrpdssthermocalc Managers for Calculating Standard-State
27  * Thermodynamics
28  *
29  * To compute the thermodynamic properties of multicomponent solutions, it is
30  * necessary to know something about the thermodynamic properties of the
31  * individual species present in the solution. Exactly what sort of species
32  * properties are required depends on the thermodynamic model for the solution.
33  * For a gaseous solution (i.e., a gas mixture), the species properties required
34  * are usually ideal gas properties at the mixture temperature and at a
35  * reference pressure (almost always at 1 bar). For other types of solutions,
36  * however, it may not be possible to isolate the species in a "pure" state. For
37  * example, the thermodynamic properties of, say, Na+ and Cl- in saltwater are
38  * not easily determined from data on the properties of solid NaCl, or solid Na
39  * metal, or chlorine gas. In this case, the solvation in water is fundamental
40  * to the identity of the species, and some other reference state must be used.
41  * One common convention for liquid solutions is to use thermodynamic data for
42  * the solutes in the limit of infinite dilution within the pure solvent;
43  * another convention is to reference all properties to unit molality.
44  *
45  * In defining these standard states for species in a phase, we make the
46  * following definition. A reference state is a standard state of a species in a
47  * phase limited to one particular pressure, the reference pressure. The
48  * reference state specifies the dependence of all thermodynamic functions as a
49  * function of the temperature, in between a minimum temperature and a maximum
50  * temperature. The reference state also specifies the molar volume of the
51  * species as a function of temperature. The molar volume is a thermodynamic
52  * function. A full standard state does the same thing as a reference state, but
53  * specifies the thermodynamics functions at all pressures.
54  *
55  * Class VPSSMgr is the base class for a family of classes that compute
56  * properties of all species in a phase in their standard states, for a range
57  * of temperatures and pressures.
58  *
59  * Phases which use the VPSSMGr class must have their respective ThermoPhase
60  * objects actually be derivatives of the VPStandardState class. These classes
61  * assume that there exists a standard state for each species in the phase,
62  * where the Thermodynamic functions are specified as a function of
63  * temperature and pressure. Standard state thermo objects for each species
64  * in the phase are all derived from the PDSS virtual base class. Calculators
65  * for these standard state thermo , which coordinate the calculation for all
66  * of the species in a phase, are all derived from VPSSMgr. In turn, these
67  * standard states may employ reference state calculation to aid in their
68  * calculations. And the VPSSMgr calculators may also employ SimpleThermo
69  * calculators to help in calculating the properties for all of the species in
70  * a phase. However, there are some PDSS objects which do not employ reference
71  * state calculations. An example of this is a real equation of state for
72  * liquid water used within the calculation of brine thermodynamics.
73  *
74  * Typically calls to calculate standard state thermo properties are virtual
75  * calls at the ThermoPhase level. It is left to the child classes of
76  * ThermoPhase to specify how these are carried out. Usually, this will involve
77  * calling the m_spthermo pointer to a MultiSpeciesThermo object to calculate the
78  * reference state thermodynamic properties. Then, the pressure dependence is
79  * added in within the child ThermoPhase object to complete the specification of
80  * the standard state. The VPStandardStateTP class, however, redefines the calls
81  * to the calculation of standard state properties to use VPSSMgr class calls.
82  * A listing of these classes and important pointers are supplied below.
83  *
84  * - ThermoPhase
85  * - \link Cantera::ThermoPhase::m_spthermo m_spthermo\endlink
86  * This is a pointer to a MultiSpeciesThermo manager class that
87  * handles the reference %state Thermodynamic calculations.
88  * - VPStandardStateTP (inherits from ThermoPhase)
89  * - \link Cantera::ThermoPhase::m_spthermo m_spthermo\endlink
90  * MultiSpeciesThermo manager handling reference %state Thermodynamic calculations.
91  * may or may not be used by the VPSSMgr class. For species
92  * which don't have a reference state class defined, a default
93  * class, called STITbyPDSS which is installed into the MultiSpeciesThermo
94  * class, actually calculates reference state
95  * thermo by calling a PDSS object.
96  * - \link Cantera::VPStandardStateTP::m_VPSS_ptr m_VPSS_ptr\endlink
97  * This is a pointer to a VPSSMgr class which handles the
98  * standard %state thermo calculations. It may
99  * or may not use the pointer, m_spthermo, in its calculations.
100  *
101  * The following classes inherit from VPSSMgr. Each of these classes handle
102  * multiple species and by definition all of the species in a phase. It is a
103  * requirement that a VPSSMgr object handles all of the species in a phase.
104  *
105  * - VPSSMgr_IdealGas
106  * - standardState model = "IdealGas"
107  * - This model assumes that all species in the phase obey the
108  * ideal gas law for their pressure dependence. The manager
109  * uses a MultiSpeciesThermo object to handle the calculation of the
110  * reference state.
111  * - VPSSMgr_ConstVol
112  * - standardState model = "ConstVol"
113  * - This model assumes that all species in the phase obey the
114  * constant partial molar volume pressure dependence.
115  * The manager uses a MultiSpeciesThermo object to handle the
116  * calculation of the reference state.
117  * - VPSSMgr_Water_ConstVol
118  * - standardState model = "Water_ConstVol"
119  * - This model assumes that all species but one in the phase obey the
120  * constant partial molar volume pressure dependence.
121  * The manager uses a MultiSpeciesThermo object to handle the
122  * calculation of the reference state for those species.
123  * Species 0 is assumed to be water, and a real equation
124  * of state is used to model the T, P behavior.
125  * - VPSSMgr_Water_HKFT
126  * - standardState model = "Water_HKFT"
127  * - This model assumes that all species but one in the phase obey the
128  * HKFT equation of state.
129  * Species 0 is assumed to be water, and a real equation
130  * of state is used to model the T, P behavior.
131  * - VPSSMgr_General
132  * - standardState model = "General"
133  * - This model is completely general. Nothing is assumed at this
134  * level. Calls consist of loops to PDSS property evaluations.
135  *
136  * The choice of which VPSSMgr object to be used is implicitly made by %Cantera
137  * by querying the XML data file for compatibility. However, each of these
138  * VPSSMgr objects may be explicitly requested in the XML file by adding in the
139  * following XML node into the thermo section of the phase XML Node. For
140  * example, the code example listed below explicitly requests that the
141  * VPSSMgr_IdealGas object be used to handle the standard state thermodynamics
142  * calculations.
143  *
144  * @code
145  * <phase id="Silane_Pyrolysis" dim="3">
146  * . . .
147  * <thermo model="VPIdealGas">
148  * <standardState model="IdealGas">
149  * <\thermo>
150  * . . .
151  * <\phase>
152  * @endcode
153  *
154  * If it turns out that the VPSSMgr_IdealGas class can not handle the standard
155  * state calculation, then %Cantera will fail during the instantiation phase
156  * printing out an informative error message.
157  *
158  * In the source code listing above, the thermo model, VPIdealGas ,was
159  * requested. The thermo model specifies the type of ThermoPhase object to use.
160  * In this case the object IdealSolnGasVPSS (with the ideal gas suboption) is
161  * used. IdealSolnGasVPSS inherits from VPStandardStateTP, so that it actually
162  * has a VPSSMgr pointer to be specified. Note, in addition to the IdealGas
163  * entry to the model parameter in standardState node, we could have also
164  * specified the "General" option. The general option will always work. An
165  * example of this usage is listed below.
166  *
167  * @code
168  * <phase id="Silane_Pyrolysis" dim="3">
169  * . . .
170  * <thermo model="VPIdealGas">
171  * <standardState model="General">
172  * <\thermo>
173  * . . .
174  * <\phase>
175  * @endcode
176  *
177  * The "General" option will cause the VPSSMgr_General VPSSMgr class to be used.
178  * In this manager, the calculations are all handled at the PDSS object level.
179  * This is completely general, but, may be significantly slower.
180  *
181  * @ingroup thermoprops
182  */
183 
184 //! Virtual base class for the classes that manage the calculation
185 //! of standard state properties for all the species in a phase.
186 /*!
187  * This class defines the interface which all subclasses must implement.
188  *
189  * Class VPSSMgr is the base class for a family of classes that compute
190  * properties of a set of species in their standard state at a range of
191  * temperatures and pressures.
192  *
193  * If #m_useTmpRefStateStorage is set to true, then the following internal
194  * arrays, containing information about the reference arrays,
195  * are calculated and kept up to date at every call.
196  *
197  * - #m_h0_RT
198  * - #m_g0_RT
199  * - #m_s0_R
200  * - #m_cp0_R
201  *
202  * The virtual function #_updateRefStateThermo() is supplied to do this and may
203  * be reimplemented in child routines. A default implementation based on the
204  * speciesThermo class is supplied in this base class.
205  * #_updateStandardStateThermo() is called whenever a reference state property
206  * is needed.
207  *
208  * When #m_useTmpStandardStateStorage is true, then the following internal
209  * arrays, containing information on the standard state properties are
210  * calculated and kept up to date.
211  *
212  * - #m_hss_RT;
213  * - #m_cpss_R;
214  * - #m_gss_RT;
215  * - #m_sss_R;
216  * - #m_Vss
217  *
218  * The virtual function #_updateStandardStateThermo() is supplied to do this and
219  * must be reimplemented in child routines, when #m_useTmpStandardStateStorage
220  * is true. It may be optionally reimplemented in child routines if
221  * #m_useTmpStandardStateStorage is false. #_updateStandardStateThermo() is
222  * called whenever a standard state property is needed.
223  *
224  * This class is usually used for nearly incompressible phases. For those
225  * phases, it makes sense to change the equation of state independent variable
226  * from density to pressure.
227  */
228 class VPSSMgr
229 {
230 public:
231  //! Constructor
232  /*!
233  * @param vptp_ptr Pointer to the Variable pressure ThermoPhase object
234  * @param spth Pointer to the optional MultiSpeciesThermo object
235  * that will handle the calculation of the reference
236  * state thermodynamic coefficients.
237  */
238  VPSSMgr(VPStandardStateTP* vptp_ptr, MultiSpeciesThermo* spth = 0);
239 
240  virtual ~VPSSMgr() {}
241 
242  //! @deprecated Copy constructor to be removed after Cantera 2.3 for all
243  //! classes derived from VPSSMgr.
244  VPSSMgr(const VPSSMgr& right);
245  //! @deprecated Assignment operator to be removed after Cantera 2.3 for all
246  //! classes derived from VPSSMgr.
247  VPSSMgr& operator=(const VPSSMgr& right);
248 
249  //! Duplication routine for objects which derive from VPSSMgr
250  /*!
251  * This function can be used to duplicate objects derived from VPSSMgr
252  * even if the application only has a pointer to VPSSMgr to work with.
253  * @deprecated To be removed after Cantera 2.3 for all classes derived from
254  * VPSSMgr.
255  */
256  virtual VPSSMgr* duplMyselfAsVPSSMgr() const;
257 
258  //! @name Properties of the Standard State of the Species in the Solution
259  //! @{
260 
261  //!Get the array of chemical potentials at unit activity.
262  /*!
263  * These are the standard state chemical potentials \f$ \mu^0_k(T,P)
264  * \f$. The values are evaluated at the current temperature and pressure.
265  *
266  * @param mu Output vector of standard state chemical potentials.
267  * length = m_kk. units are J / kmol.
268  */
269  virtual void getStandardChemPotentials(doublereal* mu) const;
270 
271  /**
272  * Get the nondimensional Gibbs functions for the species at their
273  * standard states of solution at the current T and P of the solution.
274  *
275  * @param grt Output vector of nondimensional standard state
276  * Gibbs free energies. length = m_kk.
277  */
278  virtual void getGibbs_RT(doublereal* grt) const;
279 
280  /**
281  * Get the nondimensional Enthalpy functions for the species at their
282  * standard states at the current *T* and *P* of the solution.
283  *
284  * @param hrt Output vector of standard state enthalpies.
285  * length = m_kk. units are unitless.
286  */
287  virtual void getEnthalpy_RT(doublereal* hrt) const;
288 
289  //! Return a reference to a vector of the molar enthalpies of the
290  //! species in their standard states
291  const vector_fp& enthalpy_RT() const {
292  return m_hss_RT;
293  }
294 
295  /**
296  * Get the array of nondimensional Enthalpy functions for the standard
297  * state species at the current *T* and *P* of the solution.
298  *
299  * @param sr Output vector of nondimensional standard state
300  * entropies. length = m_kk.
301  */
302  virtual void getEntropy_R(doublereal* sr) const;
303 
304  //! Return a reference to a vector of the entropies of the species
305  const vector_fp& entropy_R() const {
306  return m_sss_R;
307  }
308 
309  //! Returns the vector of nondimensional internal Energies of the standard
310  //! state at the current temperature and pressure of the solution for each
311  //! species.
312  /*!
313  * The internal energy is calculated from the enthalpy from the
314  * following formula:
315  *
316  * \f[
317  * u^{ss}_k(T,P) = h^{ss}_k(T) - P * V^{ss}_k
318  * \f]
319  *
320  * @param urt Output vector of nondimensional standard state
321  * internal energies. length = m_kk.
322  */
323  virtual void getIntEnergy_RT(doublereal* urt) const;
324 
325  //! Get the nondimensional Heat Capacities at constant pressure for the
326  //! standard state of the species at the current T and P.
327  /*!
328  * This is redefined here to call the internal function,
329  * _updateStandardStateThermo(), which calculates all standard state
330  * properties at the same time.
331  *
332  * @param cpr Output vector containing the the nondimensional Heat
333  * Capacities at constant pressure for the standard state of
334  * the species. Length: m_kk.
335  */
336  virtual void getCp_R(doublereal* cpr) const;
337 
338  //! Return a reference to a vector of the constant pressure
339  //! heat capacities of the species
340  const vector_fp& cp_R() const {
341  return m_cpss_R;
342  }
343 
344  //! Get the molar volumes of each species in their standard states at the
345  //! current *T* and *P* of the solution.
346  /*!
347  * units = m^3 / kmol
348  *
349  * This is redefined here to call the internal function,
350  * _updateStandardStateThermo(), which calculates all standard state
351  * properties at the same time.
352  *
353  * @param vol Output vector of species volumes. length = m_kk.
354  * units = m^3 / kmol
355  */
356  virtual void getStandardVolumes(doublereal* vol) const;
357  virtual const vector_fp& getStandardVolumes() const;
358 
359  //! Return a reference to a vector of the species standard molar volumes
360  const vector_fp& standardVolumes() const {
361  return m_Vss;
362  }
363 
364 public:
365  //@}
366  /*! @name Thermodynamic Values for the Species Reference States
367  * There are also temporary variables for holding the species reference-
368  * state values of Cp, H, S, and V at the last temperature and reference
369  * pressure called. These functions are not recalculated if a new call is
370  * made using the previous temperature. All calculations are done within
371  * the routine _updateRefStateThermo().
372  */
373  //@{
374 
375  /*!
376  * Returns the vector of nondimensional enthalpies of the reference state at
377  * the current temperature of the solution and the reference pressure for
378  * the species.
379  *
380  * @param hrt Output vector contains the nondimensional enthalpies of the
381  * reference state of the species. length = m_kk, units = dimensionless.
382  */
383  virtual void getEnthalpy_RT_ref(doublereal* hrt) const;
384 
385  /*!
386  * Returns the vector of nondimensional Gibbs free energies of the reference
387  * state at the current temperature of the solution and the reference
388  * pressure for the species.
389  *
390  * @param grt Output vector contains the nondimensional Gibbs free energies
391  * of the reference state of the species. length = m_kk, units =
392  * dimensionless.
393  */
394  virtual void getGibbs_RT_ref(doublereal* grt) const;
395 
396 
397  //! Return a reference to the vector of Gibbs free energies of the species
398  const vector_fp& Gibbs_RT_ref() const {
399  return m_g0_RT;
400  }
401 
402  /*!
403  * Returns the vector of the Gibbs function of the reference state at the
404  * current temperature of the solution and the reference pressure for the
405  * species. units = J/kmol
406  *
407  * @param g Output vector contain the Gibbs free energies of the reference
408  * state of the species. length = m_kk, units = J/kmol.
409  */
410  virtual void getGibbs_ref(doublereal* g) const;
411 
412  /*!
413  * Returns the vector of nondimensional entropies of the reference state at
414  * the current temperature of the solution and the reference pressure for
415  * the species.
416  *
417  * @param er Output vector contain the nondimensional entropies of the
418  * species in their reference states. length: m_kk, units:
419  * dimensionless.
420  */
421  virtual void getEntropy_R_ref(doublereal* er) const;
422 
423  /*!
424  * Returns the vector of nondimensional constant pressure heat capacities of
425  * the reference state at the current temperature of the solution and
426  * reference pressure for the species.
427  *
428  * @param cpr Output vector contains the nondimensional heat capacities of
429  * the species in their reference states. length: m_kk, units:
430  * dimensionless.
431  */
432  virtual void getCp_R_ref(doublereal* cpr) const;
433 
434  //! Get the molar volumes of the species reference states at the current *T*
435  //! and *P_ref* of the solution.
436  /*!
437  * units = m^3 / kmol
438  *
439  * @param vol Output vector containing the standard state volumes.
440  * Length: m_kk.
441  */
442  virtual void getStandardVolumes_ref(doublereal* vol) const;
443 
444  //@}
445  /*! @name Setting the Internal State of the System
446  * All calls to change the internal state of the system's T and P
447  * are done through these routines
448  * - setState_TP()
449  * - setState_T()
450  * - setState_P()
451  *
452  * These routine in turn call the following underlying virtual functions
453  *
454  * - _updateRefStateThermo()
455  * - _updateStandardStateThermo()
456  *
457  * An important point to note is that between calls the assumption that the
458  * underlying PDSS objects will retain their set Temperatures and Pressure
459  * CAN NOT BE MADE. For efficiency reasons, we may twiddle these to get
460  * derivatives.
461  */
462  //@{
463 
464  //! Set the temperature (K) and pressure (Pa)
465  /*!
466  * This sets the temperature and pressure and triggers calculation of
467  * underlying quantities
468  *
469  * @param T Temperature (K)
470  * @param P Pressure (Pa)
471  */
472  virtual void setState_TP(doublereal T, doublereal P);
473 
474  //! Set the temperature (K)
475  /*!
476  * @param T Temperature (K)
477  */
478  virtual void setState_T(doublereal T);
479 
480  //! Set the pressure (Pa)
481  /*!
482  * @param P Pressure (Pa)
483  */
484  virtual void setState_P(doublereal P);
485 
486  //! Return the temperature stored in the object
487  doublereal temperature() const {
488  return m_tlast;
489  }
490 
491  //! Return the pressure stored in the object
492  doublereal pressure() const {
493  return m_plast;
494  }
495 
496  //! Return the pointer to the reference-state Thermo calculator
497  //! MultiSpeciesThermo object.
499  return m_spthermo;
500  }
501 
502  //! Updates the internal standard state thermodynamic vectors at the
503  //! current T and P of the solution.
504  /*!
505  * If you are to peek internally inside the object, you need to
506  * call these functions after setState functions in order to be sure
507  * that the vectors are current.
508  */
509  virtual void updateStandardStateThermo();
510 
511  //! Updates the internal reference state thermodynamic vectors at the
512  //! current T of the solution and the reference pressure.
513  /*!
514  * If you are to peek internally inside the object, you need to
515  * call these functions after setState functions in order to be sure
516  * that the vectors are current.
517  */
518  virtual void updateRefStateThermo() const;
519 
520 protected:
521  //! Updates the standard state thermodynamic functions at the
522  //! current T and P of the solution.
523  /*!
524  * @internal
525  *
526  * If m_useTmpStandardStateStorage is true, this function must be called
527  * for every call to functions in this class. It checks to see whether the
528  * temperature or pressure has changed and thus the ss thermodynamics
529  * functions for all of the species must be recalculated.
530  *
531  * This function is responsible for updating the following internal members,
532  * when m_useTmpStandardStateStorage is true.
533  *
534  * - m_hss_RT;
535  * - m_cpss_R;
536  * - m_gss_RT;
537  * - m_sss_R;
538  * - m_Vss
539  *
540  * If m_useTmpStandardStateStorage is not true, this function may be
541  * required to be called by child classes to update internal member data.
542  *
543  * Note, the base class implementation will throw an error. It must be
544  * reimplemented in derived classes.
545  *
546  * Underscore updates never check for the state of the system
547  * They just do the calculation.
548  */
549  virtual void _updateStandardStateThermo();
550 
551  //! Updates the reference state thermodynamic functions at the
552  //! current T of the solution and the reference pressure
553  /*!
554  * Underscore updates never check for the state of the system. They just do
555  * the calculation.
556  */
557  virtual void _updateRefStateThermo() const;
558 
559 public:
560  //@}
561  //! @name Utility Methods - Reports on various quantities
562  /*!
563  * The following methods are used in the process of reporting various states
564  * and attributes
565  */
566  //@{
567 
568  //! This utility function reports the type of parameterization used for the
569  //! species with index number index.
570  /*!
571  * @param index Species index
572  * @deprecated To be removed after Cantera 2.3.
573  */
574  virtual PDSS_enumType reportPDSSType(int index = -1) const;
575 
576  //! This utility function reports the type of manager for the calculation of
577  //! ss properties
578  /*!
579  * @returns an enum type called VPSSMgr_enumType, which is a list of the
580  * known VPSSMgr objects
581  * @deprecated Unused. To be removed after Cantera 2.3.
582  */
583  virtual VPSSMgr_enumType reportVPSSMgrType() const;
584 
585  //! Minimum temperature.
586  /*!
587  * If no argument is supplied, this method returns the minimum temperature
588  * for which \e all parameterizations are valid. If an integer index k is
589  * supplied, then the value returned is the minimum temperature for
590  * species k in the phase.
591  *
592  * @param k Species index
593  */
594  virtual doublereal minTemp(size_t k=npos) const;
595 
596  //! Maximum temperature.
597  /*!
598  * If no argument is supplied, this method returns the maximum temperature
599  * for which \e all parameterizations are valid. If an integer index k is
600  * supplied, then the value returned is the maximum temperature for
601  * parameterization k.
602  *
603  * @param k Species Index
604  */
605  virtual doublereal maxTemp(size_t k=npos) const;
606 
607  //! The reference-state pressure for the standard state
608  /*!
609  * Returns the reference state pressure in Pascals for species k. If k is
610  * left out of the argument list, it returns the reference state pressure
611  * for the first species.
612  *
613  * @param k Species index. Default is -1, which returns the generic answer.
614  */
615  virtual doublereal refPressure(size_t k=npos) const;
616 
617  //@}
618  /*! @name Initialization Methods - For Internal use
619  * The following methods are used in the process of constructing the phase
620  * and setting its parameters from a specification in an input file. They
621  * are not normally used in application programs. To see how they are
622  * used, see importPhase().
623  */
624  //@{
625 
626  //! @internal Initialize the object
627  /*!
628  * This method is provided to allow subclasses to perform any
629  * initialization required after all species have been added. For example,
630  * it might be used to resize internal work arrays that must have an entry
631  * for each species. The base class implementation does nothing, and
632  * subclasses that do not require initialization do not need to overload
633  * this method. When importing a CTML phase description, this method is
634  * called just prior to returning from function importPhase().
635  */
636  virtual void initThermo();
637 
638  //! Initialize the lengths within the object
639  /*!
640  * Note this function is not virtual
641  */
642  void initLengths();
643 
644  //! Finalize the thermo after all species have been entered
645  /*!
646  * This function is the LAST initialization routine to be called. It's
647  * called after createInstallPDSS() has been called for each species in the
648  * phase, and after initThermo() has been called. It's called via an inner-
649  * to-outer onion shell like manner.
650  *
651  * In this routine, we currently calculate the reference pressure, the
652  * minimum and maximum temperature for the applicability of the thermo
653  * formulation.
654  *
655  * @param phaseNode Reference to the phaseNode XML node.
656  * @param id ID of the phase.
657  */
658  virtual void initThermoXML(XML_Node& phaseNode, const std::string& id);
659 
660  //! Install specific content for species k in the reference-state
661  //! thermodynamic SpeciesManager object
662  /*!
663  * This occurs before matrices are sized appropriately.
664  *
665  * @param k Species index in the phase
666  * @param speciesNode XML Node corresponding to the species
667  * @param phaseNode_ptr Pointer to the XML Node corresponding
668  * to the phase which owns the species
669  */
670  void installSTSpecies(size_t k, const XML_Node& speciesNode,
671  const XML_Node* phaseNode_ptr);
672 
673  //! Install specific content for species k in the standard-state
674  //! thermodynamic calculator and also create/return a PDSS object
675  //! for that species.
676  /*!
677  * This occurs before matrices are sized appropriately.
678  *
679  * @param k Species index in the phase
680  * @param speciesNode XML Node corresponding to the species
681  * @param phaseNode_ptr Pointer to the XML Node corresponding
682  * to the phase which owns the species
683  */
684  virtual PDSS* createInstallPDSS(size_t k, const XML_Node& speciesNode,
685  const XML_Node* const phaseNode_ptr);
686 
687  //! Initialize the internal shallow pointers in this object
688  /*!
689  * There are a bunch of internal shallow pointers that point to the owning
690  * VPStandardStateTP and MultiSpeciesThermo objects. This function reinitializes
691  * them. This function is called like an onion.
692  *
693  * @param vp_ptr Pointer to the VPStandardStateTP standard state
694  * @param sp_ptr Pointer to the MultiSpeciesThermo standard state
695  * @deprecated To be removed after Cantera 2.3 for all classes derived from
696  * VPSSMgr.
697  */
698  virtual void initAllPtrs(VPStandardStateTP* vp_ptr, MultiSpeciesThermo* sp_ptr);
699 
700  //!@}
701 
702 protected:
703  //! Number of species in the phase
704  size_t m_kk;
705 
706  //! Variable pressure ThermoPhase object
708 
709  //! Pointer to reference state thermo calculator
710  /*!
711  * Note, this can have a value of 0
712  */
714 
715  //! The last temperature at which the standard state thermodynamic
716  //! properties were calculated at.
717  mutable doublereal m_tlast;
718 
719  //! The last pressure at which the Standard State thermodynamic
720  //! properties were calculated at.
721  mutable doublereal m_plast;
722 
723  //! Reference pressure (Pa) must be the same for all species - defaults to 1 atm.
724  mutable doublereal m_p0;
725 
726  //! minimum temperature for the standard state calculations
727  doublereal m_minTemp;
728 
729  //! maximum temperature for the standard state calculations
730  doublereal m_maxTemp;
731 
732  //! boolean indicating whether temporary reference state storage is used ->
733  //! default is false
735 
736  //! Vector containing the species reference enthalpies at T = m_tlast
737  //! and P = p_ref.
739 
740  //! Vector containing the species reference constant pressure heat
741  //! capacities at T = m_tlast and P = p_ref.
743 
744  //! Vector containing the species reference Gibbs functions at T = m_tlast
745  //! and P = p_ref.
747 
748  //! Vector containing the species reference entropies at T = m_tlast
749  //! and P = p_ref.
750  mutable vector_fp m_s0_R;
751 
752  //! Vector containing the species reference molar volumes
753  mutable vector_fp m_V0;
754 
755  //! boolean indicating whether temporary standard state storage is used ->
756  //! default is false
758 
759  //! Vector containing the species Standard State enthalpies at T = m_tlast
760  //! and P = m_plast.
762 
763  //! Vector containing the species Standard State constant pressure heat
764  //! capacities at T = m_tlast and P = m_plast.
766 
767  //! Vector containing the species Standard State Gibbs functions at T =
768  //! m_tlast and P = m_plast.
770 
771  //! Vector containing the species Standard State entropies at T = m_tlast
772  //! and P = m_plast.
774 
775  //! Vector containing the species standard state volumes at T = m_tlast and
776  //! P = m_plast
777  mutable vector_fp m_Vss;
778 
779  //! species reference enthalpies - used by individual PDSS objects
780  /*!
781  * Vector containing the species reference enthalpies at T = m_tlast
782  * and P = p_ref.
783  */
785 
786  //! species reference heat capacities - used by individual PDSS objects
787  /**
788  * Vector containing the species reference constant pressure
789  * heat capacities at T = m_tlast and P = p_ref.
790  */
792 
793  //! species reference Gibbs free energies - used by individual PDSS objects
794  /**
795  * Vector containing the species reference Gibbs functions
796  * at T = m_tlast and P = p_ref.
797  */
799 
800  //! species reference entropies - used by individual PDSS objects
801  /**
802  * Vector containing the species reference entropies
803  * at T = m_tlast and P = p_ref.
804  */
806 
807  //! species reference state molar Volumes - used by individual PDSS objects
808  /**
809  * Vector containing the rf molar volumes
810  * at T = m_tlast and P = p_ref.
811  */
813 
814  //! species standard state enthalpies - used by individual PDSS objects
815  /*!
816  * Vector containing the species standard state enthalpies at T = m_tlast
817  * and P = p_ref.
818  */
820 
821  //! species standard state heat capacities - used by individual PDSS objects
822  /**
823  * Vector containing the species standard state constant pressure
824  * heat capacities at T = m_tlast and P = p_ref.
825  */
827 
828  //! species standard state Gibbs free energies - used by individual PDSS objects
829  /**
830  * Vector containing the species standard state Gibbs functions
831  * at T = m_tlast and P = p_ref.
832  */
834 
835  //! species standard state entropies - used by individual PDSS objects
836  /**
837  * Vector containing the species standard state entropies
838  * at T = m_tlast and P = p_ref.
839  */
841 
842  //! species standard state molar Volumes - used by individual PDSS objects
843  /**
844  * Vector containing the ss molar volumes
845  * at T = m_tlast and P = p_ref.
846  */
848 
849  friend class PDSS;
850 };
851 //@}
852 }
853 
854 #endif
vector_fp m_V0
Vector containing the species reference molar volumes.
Definition: VPSSMgr.h:753
virtual void updateRefStateThermo() const
Updates the internal reference state thermodynamic vectors at the current T of the solution and the r...
Definition: VPSSMgr.cpp:306
vector_fp mPDSS_s0_R
species reference entropies - used by individual PDSS objects
Definition: VPSSMgr.h:805
doublereal m_minTemp
minimum temperature for the standard state calculations
Definition: VPSSMgr.h:727
doublereal pressure() const
Return the pressure stored in the object.
Definition: VPSSMgr.h:492
bool m_useTmpRefStateStorage
boolean indicating whether temporary reference state storage is used -> default is false ...
Definition: VPSSMgr.h:734
void initLengths()
Initialize the lengths within the object.
Definition: VPSSMgr.cpp:337
doublereal temperature() const
Return the temperature stored in the object.
Definition: VPSSMgr.h:487
vector_fp mPDSS_V0
species reference state molar Volumes - used by individual PDSS objects
Definition: VPSSMgr.h:812
vector_fp m_sss_R
Vector containing the species Standard State entropies at T = m_tlast and P = m_plast.
Definition: VPSSMgr.h:773
doublereal m_maxTemp
maximum temperature for the standard state calculations
Definition: VPSSMgr.h:730
const vector_fp & cp_R() const
Return a reference to a vector of the constant pressure heat capacities of the species.
Definition: VPSSMgr.h:340
Virtual base class for the classes that manage the calculation of standard state properties for all t...
Definition: VPSSMgr.h:228
virtual void getEntropy_R(doublereal *sr) const
Get the array of nondimensional Enthalpy functions for the standard state species at the current T an...
Definition: VPSSMgr.cpp:170
VPSSMgr & operator=(const VPSSMgr &right)
Definition: VPSSMgr.cpp:60
const size_t npos
index returned by functions to indicate "no position"
Definition: ct_defs.h:165
bool m_useTmpStandardStateStorage
boolean indicating whether temporary standard state storage is used -> default is false ...
Definition: VPSSMgr.h:757
virtual void initAllPtrs(VPStandardStateTP *vp_ptr, MultiSpeciesThermo *sp_ptr)
Initialize the internal shallow pointers in this object.
Definition: VPSSMgr.cpp:121
virtual PDSS * createInstallPDSS(size_t k, const XML_Node &speciesNode, const XML_Node *const phaseNode_ptr)
Install specific content for species k in the standard-state thermodynamic calculator and also create...
Definition: VPSSMgr.cpp:386
virtual void initThermoXML(XML_Node &phaseNode, const std::string &id)
Finalize the thermo after all species have been entered.
Definition: VPSSMgr.cpp:364
size_t m_kk
Number of species in the phase.
Definition: VPSSMgr.h:704
vector_fp mPDSS_cpss_R
species standard state heat capacities - used by individual PDSS objects
Definition: VPSSMgr.h:826
Class XML_Node is a tree-based representation of the contents of an XML file.
Definition: xml.h:97
virtual void getStandardChemPotentials(doublereal *mu) const
Get the array of chemical potentials at unit activity.
Definition: VPSSMgr.cpp:142
virtual void getGibbs_RT(doublereal *grt) const
Get the nondimensional Gibbs functions for the species at their standard states of solution at the cu...
Definition: VPSSMgr.cpp:152
virtual void initThermo()
Definition: VPSSMgr.cpp:332
This file contains definitions for utility functions and text for modules, inputfiles, logs, textlogs, (see Input File Handling, Diagnostic Output, and Writing messages to the screen).
virtual doublereal minTemp(size_t k=npos) const
Minimum temperature.
Definition: VPSSMgr.cpp:394
VPSSMgr_enumType
enum for VPSSMgr types that are responsible for calculating the species standard state and reference-...
Definition: mix_defs.h:119
virtual void getGibbs_RT_ref(doublereal *grt) const
Definition: VPSSMgr.cpp:227
virtual doublereal refPressure(size_t k=npos) const
The reference-state pressure for the standard state.
Definition: VPSSMgr.cpp:410
virtual void _updateStandardStateThermo()
Updates the standard state thermodynamic functions at the current T and P of the solution.
Definition: VPSSMgr.cpp:311
vector_fp mPDSS_cp0_R
species reference heat capacities - used by individual PDSS objects
Definition: VPSSMgr.h:791
virtual void getCp_R_ref(doublereal *cpr) const
Definition: VPSSMgr.cpp:255
vector_fp m_cp0_R
Vector containing the species reference constant pressure heat capacities at T = m_tlast and P = p_re...
Definition: VPSSMgr.h:742
virtual doublereal maxTemp(size_t k=npos) const
Maximum temperature.
Definition: VPSSMgr.cpp:402
VPStandardStateTP * m_vptp_ptr
Variable pressure ThermoPhase object.
Definition: VPSSMgr.h:707
MultiSpeciesThermo * m_spthermo
Pointer to reference state thermo calculator.
Definition: VPSSMgr.h:713
const vector_fp & enthalpy_RT() const
Return a reference to a vector of the molar enthalpies of the species in their standard states...
Definition: VPSSMgr.h:291
MultiSpeciesThermo * SpeciesThermoMgr()
Return the pointer to the reference-state Thermo calculator MultiSpeciesThermo object.
Definition: VPSSMgr.h:498
virtual void getEnthalpy_RT_ref(doublereal *hrt) const
Definition: VPSSMgr.cpp:218
doublereal m_plast
The last pressure at which the Standard State thermodynamic properties were calculated at...
Definition: VPSSMgr.h:721
PDSS_enumType
Types of PDSS&#39;s.
Definition: mix_defs.h:105
vector_fp mPDSS_g0_RT
species reference Gibbs free energies - used by individual PDSS objects
Definition: VPSSMgr.h:798
virtual void setState_T(doublereal T)
Set the temperature (K)
Definition: VPSSMgr.cpp:279
virtual void _updateRefStateThermo() const
Updates the reference state thermodynamic functions at the current T of the solution and the referenc...
Definition: VPSSMgr.cpp:320
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: VPSSMgr.cpp:264
virtual VPSSMgr_enumType reportVPSSMgrType() const
This utility function reports the type of manager for the calculation of ss properties.
Definition: VPSSMgr.cpp:423
const vector_fp & entropy_R() const
Return a reference to a vector of the entropies of the species.
Definition: VPSSMgr.h:305
This is a filter class for ThermoPhase that implements some prepatory steps for efficiently handling ...
virtual void getIntEnergy_RT(doublereal *urt) const
Returns the vector of nondimensional internal Energies of the standard state at the current temperatu...
Definition: VPSSMgr.cpp:179
vector_fp mPDSS_sss_R
species standard state entropies - used by individual PDSS objects
Definition: VPSSMgr.h:840
vector_fp mPDSS_Vss
species standard state molar Volumes - used by individual PDSS objects
Definition: VPSSMgr.h:847
vector_fp m_Vss
Vector containing the species standard state volumes at T = m_tlast and P = m_plast.
Definition: VPSSMgr.h:777
vector_fp mPDSS_gss_RT
species standard state Gibbs free energies - used by individual PDSS objects
Definition: VPSSMgr.h:833
virtual void updateStandardStateThermo()
Updates the internal standard state thermodynamic vectors at the current T and P of the solution...
Definition: VPSSMgr.cpp:301
vector_fp m_hss_RT
Vector containing the species Standard State enthalpies at T = m_tlast and P = m_plast.
Definition: VPSSMgr.h:761
VPSSMgr(VPStandardStateTP *vptp_ptr, MultiSpeciesThermo *spth=0)
Constructor.
Definition: VPSSMgr.cpp:25
vector_fp m_cpss_R
Vector containing the species Standard State constant pressure heat capacities at T = m_tlast and P =...
Definition: VPSSMgr.h:765
vector_fp m_h0_RT
Vector containing the species reference enthalpies at T = m_tlast and P = p_ref.
Definition: VPSSMgr.h:738
std::vector< double > vector_fp
Turn on the use of stl vectors for the basic array type within cantera Vector of doubles.
Definition: ct_defs.h:157
Virtual base class for a species with a pressure dependent standard state.
Definition: PDSS.h:176
vector_fp mPDSS_hss_RT
species standard state enthalpies - used by individual PDSS objects
Definition: VPSSMgr.h:819
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: VPSSMgr.cpp:161
vector_fp m_g0_RT
Vector containing the species reference Gibbs functions at T = m_tlast and P = p_ref.
Definition: VPSSMgr.h:746
doublereal m_p0
Reference pressure (Pa) must be the same for all species - defaults to 1 atm.
Definition: VPSSMgr.h:724
virtual void getEntropy_R_ref(doublereal *er) const
Definition: VPSSMgr.cpp:246
const vector_fp & standardVolumes() const
Return a reference to a vector of the species standard molar volumes.
Definition: VPSSMgr.h:360
A species thermodynamic property manager for a phase.
const vector_fp & Gibbs_RT_ref() const
Return a reference to the vector of Gibbs free energies of the species.
Definition: VPSSMgr.h:398
vector_fp mPDSS_h0_RT
species reference enthalpies - used by individual PDSS objects
Definition: VPSSMgr.h:784
void installSTSpecies(size_t k, const XML_Node &speciesNode, const XML_Node *phaseNode_ptr)
Install specific content for species k in the reference-state thermodynamic SpeciesManager object...
Definition: VPSSMgr.cpp:375
doublereal m_tlast
The last temperature at which the standard state thermodynamic properties were calculated at...
Definition: VPSSMgr.h:717
virtual PDSS_enumType reportPDSSType(int index=-1) const
This utility function reports the type of parameterization used for the species with index number ind...
Definition: VPSSMgr.cpp:418
Namespace for the Cantera kernel.
Definition: application.cpp:29
virtual void setState_TP(doublereal T, doublereal P)
Set the temperature (K) and pressure (Pa)
Definition: VPSSMgr.cpp:288
vector_fp m_gss_RT
Vector containing the species Standard State Gibbs functions at T = m_tlast and P = m_plast...
Definition: VPSSMgr.h:769
virtual VPSSMgr * duplMyselfAsVPSSMgr() const
Duplication routine for objects which derive from VPSSMgr.
Definition: VPSSMgr.cpp:114
virtual void setState_P(doublereal P)
Set the pressure (Pa)
Definition: VPSSMgr.cpp:271
virtual void getGibbs_ref(doublereal *g) const
Definition: VPSSMgr.cpp:236
vector_fp m_s0_R
Vector containing the species reference entropies at T = m_tlast and P = p_ref.
Definition: VPSSMgr.h:750
virtual void getCp_R(doublereal *cpr) const
Get the nondimensional Heat Capacities at constant pressure for the standard state of the species at ...
Definition: VPSSMgr.cpp:191