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