Cantera  2.1.2
SpeciesThermo.h
Go to the documentation of this file.
1 /**
2  * @file SpeciesThermo.h
3  * Virtual base class for the calculation of multiple-species thermodynamic
4  * reference-state property managers and text for the mgrsrefcalc module (see \ref mgrsrefcalc
6  */
7 // Copyright 2001 California Institute of Technology
8
9 #ifndef CT_SPECIESTHERMO_H
10 #define CT_SPECIESTHERMO_H
11
12 #include "cantera/base/ct_defs.h"
13
14 namespace Cantera
15 {
16 class SpeciesThermoInterpType;
17
18 /**
19  * @defgroup mgrsrefcalc Managers for Calculating Reference-State Thermodynamics
20  *
21  * The ThermoPhase object relies on a set of manager classes to calculate
22  * the thermodynamic properties of the reference state for all
23  * of the species in the phase. This may be a computationally
24  * significant cost, so efficiency is important.
25  * This group describes how this is done efficiently within Cantera.
26  *
27  * To compute the thermodynamic properties of multicomponent
28  * solutions, it is necessary to know something about the
29  * thermodynamic properties of the individual species present in
30  * the solution. Exactly what sort of species properties are
31  * required depends on the thermodynamic model for the
32  * solution. For a gaseous solution (i.e., a gas mixture), the
33  * species properties required are usually ideal gas properties at
34  * the mixture temperature and at a reference pressure (almost always at
35  * 1 bar).
36  *
37  * In defining these standard states for species in a phase, we make
38  * the following definition. A reference state is a standard state
39  * of a species in a phase limited to one particular pressure, the reference
40  * pressure. The reference state specifies the dependence of all
41  * thermodynamic functions as a function of the temperature, in
42  * between a minimum temperature and a maximum temperature. The
43  * reference state also specifies the molar volume of the species
44  * as a function of temperature. The molar volume is a thermodynamic
45  * function. By contrast, a full standard state does the same thing
46  * as a reference state, but specifies the thermodynamics functions
47  * at all pressures.
48  *
49  * Whatever the conventions used by a particular solution model,
50  * means need to be provided to compute the species properties in
51  * the reference state. Class SpeciesThermo is the base class
52  * for a family of classes that compute properties of all
53  * species in a phase in their reference states, for a range of temperatures.
54  * Note, the pressure dependence of the species thermodynamic functions is not
55  * handled by this particular species thermodynamic model. %SpeciesThermo
56  * calculates the reference-state thermodynamic values of all species in a single
57  * phase during each call. The vector nature of the operation leads to
58  * a lower operation count and better efficiency, especially if the
59  * individual reference state classes are known to the reference-state
60  * manager class so that common operations may be grouped together.
61  *
62  * The most important member function for the %SpeciesThermo class
64  * The function calculates the values of Cp, H, and S for all of the
65  * species at once at the specified temperature.
66  *
67  * Usually, all of the species in a phase are installed into a %SpeciesThermo
68  * class. However, there is no requirement that a %SpeciesThermo
69  * object handles all of the species in a phase. There are
70  * two member functions that are called to install each species into
71  * the %SpeciesThermo.
73  * It is called with the index of the species in the phase,
74  * an integer type delineating
75  * the SpeciesThermoInterpType object, and a listing of the
76  * parameters for that parameterization. A factory routine is called based
77  * on the integer type. The other routine is called
79  * It accepts as an argument a pointer to an already formed
80  * SpeciesThermoInterpType object.
81  *
82  * The following classes inherit from %SpeciesThermo. Each of these classes
83  * handle multiple species, usually all of the species in a phase. However,
84  * there is no requirement that a %SpeciesThermo object handles all of the
85  * species in a phase.
86  *
87  * - NasaThermo in file NasaThermo.h
88  * - This is a two zone model, with each zone consisting of a 7
89  * coefficient Nasa Polynomial format.
90  * - ShomateThermo in file ShomateThermo.h
91  * - This is a two zone model, with each zone consisting of a 7
92  * coefficient Shomate Polynomial format.
93  * - SimpleThermo in file SimpleThermo.h
94  * - This is a one-zone constant heat capacity model.
95  * - GeneralSpeciesThermo in file GeneralSpeciesThermo.h
96  * - This is a general model. Each species is handled separately
97  * via a vector over SpeciesThermoInterpType classes.
98  * - SpeciesThermoDuo in file SpeciesThermoMgr.h
99  * - This is a combination of two SpeciesThermo types.
100  *
101  * The class SpeciesThermoInterpType is a pure virtual base class for
102  * calculation of thermodynamic functions for a single species
103  * in its reference state.
104  * The following classes inherit from %SpeciesThermoInterpType.
105  *
106  * - NasaPoly1 in file NasaPoly1.h
107  * - This is a one zone model, consisting of a 7
108  * coefficient Nasa Polynomial format.
109  * - NasaPoly2 in file NasaPoly2.h
110  * - This is a two zone model, with each zone consisting of a 7
111  * coefficient Nasa Polynomial format.
112  * - ShomatePoly in file ShomatePoly.h
113  * - This is a one zone model, consisting of a 7
114  * coefficient Shomate Polynomial format.
115  * - ShomatePoly2 in file ShomatePoly.h
116  * - This is a two zone model, with each zone consisting of a 7
117  * coefficient Shomate Polynomial format.
118  * - ConstCpPoly in file ConstCpPoly.h
119  * - This is a one-zone constant heat capacity model.
120  * - Mu0Poly in file Mu0Poly.h
121  * - This is a multizoned model. The chemical potential is given
122  * at a set number of temperatures. Between each temperature
123  * the heat capacity is treated as a constant.
124  * - Nasa9Poly1 in file Nasa9Poly1.h
125  * - This is a one zone model, consisting of the 9
126  * coefficient Nasa Polynomial format.
127  * - Nasa9PolyMultiTempRegion in file Nasa9PolyMultiTempRegion.h
128  * - This is a multiple zone model, consisting of the 9
129  * coefficient Nasa Polynomial format in each zone.
130  *
131  * In particular the NasaThermo %SpeciesThermo-derived model has been
132  * optimized for execution speed. It's the main-stay of gas phase computations
133  * involving large numbers of species in a phase. It combines the calculation
134  * of each species, which individually have NasaPoly2 representations, to
135  * minimize the computational time.
136  *
137  * The GeneralSpeciesThermo %SpeciesThermo object is completely general. It
138  * does not try to coordinate the individual species calculations at all and
139  * therefore is the slowest but most general implementation.
140  *
141  * @ingroup thermoprops
142  */
143 //@{
144
145 //! Pure Virtual base class for the species thermo manager classes.
146 /*!
147  * This class defines the interface which all subclasses must implement.
148  *
149  * Class SpeciesThermo is the base class for a family of classes that compute
150  * properties of a set of species in their reference state at a range of
151  * temperatures. Note, the pressure dependence of the reference state is not
152  * handled by this particular species standard state model.
153  */
155 {
156 public:
157
158  //! Constructor
159  SpeciesThermo() : m_allow_discontinuities(false) {}
160
161  //! Destructor
162  virtual ~SpeciesThermo() {}
163
164  //! Copy Constructor for the %SpeciesThermo object.
165  /*!
166  * @param right Reference to %SpeciesThermo object to be copied into the
167  * current one.
168  */
169  SpeciesThermo(const SpeciesThermo& right) {}
170
171  //! Assignment operator for the %SpeciesThermo object
172  /*!
173  * @param right Reference to %SpeciesThermo object to be copied into the
174  * current one.
175  */
177  return *this;
178  }
179
180  //! Duplication routine for objects derived from SpeciesThermo
181  /*!
182  * This function can be used to duplicate objects derived from
183  * SpeciesThermo even if the application only has a pointer to
184  * SpeciesThermo to work with.
185  */
186  virtual SpeciesThermo* duplMyselfAsSpeciesThermo() const = 0;
187
188  //! Install a new species thermodynamic property
189  //! parameterization for one species.
190  /*!
191  * @see speciesThermoTypes.h
192  *
193  * @param name Name of the species
194  * @param index The 'update' method will update the property
195  * values for this species
196  * at position i index in the property arrays.
197  * @param type int flag specifying the type of parameterization to be
198  * installed.
199  * @param c vector of coefficients for the parameterization.
200  * This vector is simply passed through to the
201  * parameterization constructor.
202  * @param minTemp minimum temperature for which this parameterization
203  * is valid.
204  * @param maxTemp maximum temperature for which this parameterization
205  * is valid.
206  * @param refPressure standard-state pressure for this
207  * parameterization.
208  */
209  virtual void install(const std::string& name, size_t index, int type,
210  const doublereal* c,
211  doublereal minTemp, doublereal maxTemp,
212  doublereal refPressure)=0;
213
214  //! Install a new species thermodynamic property
215  //! parameterization for one species.
216  /*!
217  * @param stit_ptr Pointer to the SpeciesThermoInterpType object
218  * This will set up the thermo for one species
219  */
220  virtual void install_STIT(SpeciesThermoInterpType* stit_ptr) = 0;
221
222  //! Compute the reference-state properties for all species.
223  /*!
224  * Given temperature T in K, this method updates the values of the non-
225  * dimensional heat capacity at constant pressure, enthalpy, and entropy,
226  * at the reference pressure, Pref of each of the standard states.
227  *
228  * @param T Temperature (Kelvin)
229  * @param cp_R Vector of Dimensionless heat capacities. (length m_kk).
230  * @param h_RT Vector of Dimensionless enthalpies. (length m_kk).
231  * @param s_R Vector of Dimensionless entropies. (length m_kk).
232  */
233  virtual void update(doublereal T, doublereal* cp_R,
234  doublereal* h_RT, doublereal* s_R) const=0;
235
236  //! Like update(), but only updates the single species k.
237  /*!
238  * The default treatment is to just call update() which means that
239  * potentially the operation takes a m_kk*m_kk hit.
240  *
241  * @param k species index
242  * @param T Temperature (Kelvin)
243  * @param cp_R Vector of Dimensionless heat capacities. (length m_kk).
244  * @param h_RT Vector of Dimensionless enthalpies. (length m_kk).
245  * @param s_R Vector of Dimensionless entropies. (length m_kk).
246  */
247  virtual void update_one(size_t k, doublereal T,
248  doublereal* cp_R,
249  doublereal* h_RT,
250  doublereal* s_R) const {
251  update(T, cp_R, h_RT, s_R);
252  }
253
254  //! Minimum temperature.
255  /*!
256  * If no argument is supplied, this method returns the minimum temperature
257  * for which \e all parameterizations are valid. If an integer index k is
258  * supplied, then the value returned is the minimum temperature for
259  * species k in the phase.
260  *
261  * @param k Species index
262  */
263  virtual doublereal minTemp(size_t k=npos) const =0;
264
265  //! Maximum temperature.
266  /*!
267  * If no argument is supplied, this method returns the maximum temperature
268  * for which \e all parameterizations are valid. If an integer index k is
269  * supplied, then the value returned is the maximum temperature for
270  * parameterization k.
271  *
272  * @param k Species Index
273  */
274  virtual doublereal maxTemp(size_t k=npos) const =0;
275
276  //! The reference-state pressure for species k.
277  /*!
278  * Returns the reference state pressure in Pascals for species k. If k is
279  * left out of the argument list, it returns the reference state pressure
280  * for the first species. Note that some SpeciesThermo implementations,
281  * such as those for ideal gases, require that all species in the same
282  * phase have the same reference state pressures.
283  *
284  * @param k Species Index
285  */
286  virtual doublereal refPressure(size_t k=npos) const =0;
287
288  //! This utility function reports the type of parameterization
289  //! used for the species with index number *index*.
290  /*!
291  * @param index Species index
292  */
293  virtual int reportType(size_t index=npos) const = 0;
294
295  //! This utility function reports back the type of parameterization and
296  //! all of the parameters for the species with index number *index*.
297  /*!
298  * @param index Species index
299  * @param type Integer type of the standard type
300  * @param c Vector of coefficients used to set the
301  * parameters for the standard state.
302  * @param minTemp output - Minimum temperature
303  * @param maxTemp output - Maximum temperature
304  * @param refPressure output - reference pressure (Pa).
305  * @deprecated
306  */
307  virtual void reportParams(size_t index, int& type,
308  doublereal* const c,
309  doublereal& minTemp,
310  doublereal& maxTemp,
311  doublereal& refPressure) const =0;
312
313 #ifdef H298MODIFY_CAPABILITY
314  //! Report the 298 K Heat of Formation of the standard state of one species (J kmol-1)
315  /*!
316  * The 298K Heat of Formation is defined as the enthalpy change to create the standard state
317  * of the species from its constituent elements in their standard states at 298 K and 1 bar.
318  *
319  * @param k species index
320  * @return Returns the current value of the Heat of Formation at 298K and 1 bar
321  */
322  virtual doublereal reportOneHf298(int k) const = 0;
323
324  //! Modify the value of the 298 K Heat of Formation of the standard state of
325  //! one species in the phase (J kmol-1)
326  /*!
327  * The 298K heat of formation is defined as the enthalpy change to create the standard state
328  * of the species from its constituent elements in their standard states at 298 K and 1 bar.
329  *
330  * @param k Index of the species
331  * @param Hf298New Specify the new value of the Heat of Formation at 298K and 1 bar.
332  * units = J/kmol.
333  */
334  virtual void modifyOneHf298(const int k, const doublereal Hf298New) = 0;
335 #endif
336
337  bool m_allow_discontinuities;
338 };
339 //@}
340 }
341
342 #endif
Pure Virtual Base class for the thermodynamic manager for an individual species' reference state...
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 =0
Maximum temperature.
virtual void update_one(size_t k, doublereal T, doublereal *cp_R, doublereal *h_RT, doublereal *s_R) const
Like update(), but only updates the single species k.
virtual void install(const std::string &name, size_t index, int type, const doublereal *c, doublereal minTemp, doublereal maxTemp, doublereal refPressure)=0
Install a new species thermodynamic property parameterization for one species.
This file contains definitions of terms that are used in internal routines and are unlikely to need m...
Pure Virtual base class for the species thermo manager classes.
virtual int reportType(size_t index=npos) const =0
This utility function reports the type of parameterization used for the species with index number ind...
virtual SpeciesThermo * duplMyselfAsSpeciesThermo() const =0
Duplication routine for objects derived from SpeciesThermo.
virtual void install_STIT(SpeciesThermoInterpType *stit_ptr)=0
Install a new species thermodynamic property parameterization for one species.
virtual ~SpeciesThermo()
Destructor.
virtual doublereal refPressure(size_t k=npos) const =0
The reference-state pressure for species k.
SpeciesThermo(const SpeciesThermo &right)
Copy Constructor for the SpeciesThermo object.
virtual doublereal minTemp(size_t k=npos) const =0
Minimum temperature.
SpeciesThermo()
Constructor.
virtual void reportParams(size_t index, int &type, doublereal *const c, doublereal &minTemp, doublereal &maxTemp, doublereal &refPressure) const =0
This utility function reports back the type of parameterization and all of the parameters for the spe...
virtual void update(doublereal T, doublereal *cp_R, doublereal *h_RT, doublereal *s_R) const =0
Compute the reference-state properties for all species.
SpeciesThermo & operator=(const SpeciesThermo &right)
Assignment operator for the SpeciesThermo object.