Cantera  2.0
Nasa9PolyMultiTempRegion.h
Go to the documentation of this file.
1 /**
2  * @file Nasa9PolyMultiTempRegion.h
3  * Header for a single-species standard state object derived
4  * from \link Cantera::SpeciesThermoInterpType
5  * SpeciesThermoInterpType\endlink based
6  * on the NASA 9 coefficient temperature polynomial form
7  * applied to multiple temperature regions
8  * (see \ref spthermo and class \link Cantera::Nasa9PolyMultiTempRegion Nasa9PolyMultiTempRegion\endlink).
9  *
10  * This parameterization has multiple NASA temperature regions.
11  */
12 
13 
14 #ifndef CT_NASA9POLYMULTITEMPREGION_H
15 #define CT_NASA9POLYMULTITEMPREGION_H
16 // Copyright 2007 Sandia National Laboratories
17 
18 
19 #include "cantera/base/global.h"
21 
22 namespace Cantera
23 {
24 
25 //! The NASA 9 polynomial parameterization for a single species
26 //! encompassing multiple temperature regions.
27 /*!
28  * This parameterization expresses the heat capacity via a
29  * 7 coefficient polynomial.
30  * Note that this is the form used in the
31  * 2002 NASA equilibrium program. A reference to the form is
32  * provided below:
33  *
34  * "NASA Glenn Coefficients for Calculating Thermodynamic
35  * Properties of Individual Species,"
36  * B. J. McBride, M. J. Zehe, S. Gordon
37  * NASA/TP-2002-211556, Sept. 2002
38  *
39  * Nine coefficients \f$(a_0,\dots,a_6)\f$ are used to represent
40  * \f$ C_p^0(T)\f$, \f$ H^0(T)\f$, and \f$ S^0(T) \f$ as
41  * polynomials in \f$ T \f$ :
42  * \f[
43  * \frac{C_p^0(T)}{R} = a_0 T^{-2} + a_1 T^{-1} + a_2 + a_3 T
44  * + a_4 T^2 + a_5 T^3 + a_6 T^4
45  * \f]
46  *
47  * \f[
48  * \frac{H^0(T)}{RT} = - a_0 T^{-2} + a_1 \frac{\ln(T)}{T} + a_2
49  * + a_3 T + a_4 T^2 + a_5 T^3 + a_6 T^4 + \frac{a_7}{T}
50  * \f]
51  *
52  * \f[
53  * \frac{s^0(T)}{R} = - \frac{a_0}{2} T^{-2} - a_1 T^{-1} + a_2 \ln(T)
54  + + a_3 T \frac{a_4}{2} T^2 + \frac{a_5}{3} T^3 + \frac{a_6}{4} T^4 + a_8
55  * \f]
56  *
57  * The standard state is assumed to be an ideal gas at the
58  * standard pressure of 1 bar, for gases.
59  * For condensed species, the standard state is the
60  * pure crystalline or liquid substance at the standard
61  * pressure of 1 atm.
62  *
63  * These NASA representations may have multiple temperature regions
64  * through the use of this %Nasa9PolyMultiTempRegion object, which uses
65  * multiple copies of the Nasa9Poly1 object to handle multiple temperature
66  * regions.
67  *
68  * @ingroup spthermo
69  */
71 {
72 
73 public:
74 
75  //! Empty constructor
77 
78  //! Constructor used in templated instantiations
79  /*!
80  * @param regionPts Vector of pointers to Nasa9Poly1 objects. These
81  * objects all refer to the temperature regions for the
82  * same species. The vector must be in increasing
83  * temperature region format. Together they
84  * represent the reference temperature parameterization
85  * for a single species.
86  *
87  * Note, after the constructor, we will own the underlying
88  * Nasa9Poly1 objects and be responsible for owning them.
89  */
90  Nasa9PolyMultiTempRegion(std::vector<Cantera::Nasa9Poly1*> &regionPts);
91 
92  //! Copy constructor
93  /*!
94  * @param b object to be copied
95  */
97 
98  //! Assignment operator
99  /*!
100  * @param b object to be copied
101  */
103 
104  //! Destructor
105  virtual ~Nasa9PolyMultiTempRegion();
106 
107  //! Duplicator
108  virtual SpeciesThermoInterpType*
110 
111  //! Returns the minimum temperature that the thermo
112  //! parameterization is valid
113  virtual doublereal minTemp() const;
114 
115  //! Returns the maximum temperature that the thermo
116  //! parameterization is valid
117  virtual doublereal maxTemp() const;
118 
119  //! Returns the reference pressure (Pa)
120  virtual doublereal refPressure() const;
121 
122  //! Returns an integer representing the type of parameterization
123  virtual int reportType() const;
124 
125  //! Returns an integer representing the species index
126  virtual size_t speciesIndex() const;
127 
128  //! Update the properties for this species, given a temperature polynomial
129  /*!
130  * This method is called with a pointer to an array containing the functions of
131  * temperature needed by this parameterization, and three pointers to arrays where the
132  * computed property values should be written. This method updates only one value in
133  * each array.
134  *
135  * Temperature Polynomial:
136  * tt[0] = t;
137  * tt[1] = t*t;
138  * tt[2] = t*t*t;
139  * tt[3] = t*t*t*t;
140  * tt[4] = 1.0/t;
141  * tt[5] = 1.0/(t*t);
142  * tt[6] = std::log(t);
143  *
144  * @param tt vector of temperature polynomials
145  * @param cp_R Vector of Dimensionless heat capacities.
146  * (length m_kk).
147  * @param h_RT Vector of Dimensionless enthalpies.
148  * (length m_kk).
149  * @param s_R Vector of Dimensionless entropies.
150  * (length m_kk).
151  */
152  virtual void updateProperties(const doublereal* tt,
153  doublereal* cp_R, doublereal* h_RT,
154  doublereal* s_R) const;
155 
156 
157  //! Compute the reference-state property of one species
158  /*!
159  * Given temperature T in K, this method updates the values of
160  * the non-dimensional heat capacity at constant pressure,
161  * enthalpy, and entropy, at the reference pressure, Pref
162  * of one of the species. The species index is used
163  * to reference into the cp_R, h_RT, and s_R arrays.
164  *
165  * Temperature Polynomial:
166  * tt[0] = t;
167  * tt[1] = t*t;
168  * tt[2] = t*t*t;
169  * tt[3] = t*t*t*t;
170  * tt[4] = 1.0/t;
171  * tt[5] = 1.0/(t*t);
172  * tt[6] = std::log(t);
173  *
174  * @param temp Temperature (Kelvin)
175  * @param cp_R Vector of Dimensionless heat capacities.
176  * (length m_kk).
177  * @param h_RT Vector of Dimensionless enthalpies.
178  * (length m_kk).
179  * @param s_R Vector of Dimensionless entropies.
180  * (length m_kk).
181  */
182  virtual void updatePropertiesTemp(const doublereal temp,
183  doublereal* cp_R, doublereal* h_RT,
184  doublereal* s_R) const;
185 
186  //!This utility function reports back the type of
187  //! parameterization and all of the parameters for the
188  //! species, index.
189  /*!
190  * All parameters are output variables
191  *
192  * @param n Species index
193  * @param type Integer type of the standard type
194  * @param tlow output - Minimum temperature
195  * @param thigh output - Maximum temperature
196  * @param pref output - reference pressure (Pa).
197  * @param coeffs Vector of coefficients used to set the
198  * parameters for the standard state.
199  * There are 1 + 11*nzones coefficients
200  * coeffs[0] is equal to nTempZones.
201  * index = 1
202  * for each zone:
203  * coeffs[index] = minTempZone
204  * coeffs[index+1] = maxTempZone
205  * coeffs[index+2+i] from i =0,9 are the coefficients themselves
206  */
207  virtual void reportParameters(size_t& n, int& type,
208  doublereal& tlow, doublereal& thigh,
209  doublereal& pref,
210  doublereal* const coeffs) const;
211 
212  //! Modify parameters for the standard state
213  /*!
214  * @param coeffs Vector of coefficients used to set the
215  * parameters for the standard state.
216  */
217  virtual void modifyParameters(doublereal* coeffs);
218 
219 protected:
220  //! lowest valid temperature
221  doublereal m_lowT;
222  //! highest valid temperature
223  doublereal m_highT;
224  //! standard-state pressure
225  doublereal m_Pref;
226  //! species index
227  size_t m_index;
228  //! Number of temperature regions
230 
231  //! Lower boundaries of each temperature regions
233 
234  //! pointers to the objects
235  /*!
236  * This object will now own these pointers and delete
237  * them when the current object is deleted.
238  */
239  std::vector<Nasa9Poly1*>m_regionPts;
240 
241  //! current region
242  mutable int m_currRegion;
243 };
244 
245 }
246 #endif
247