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