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