Cantera  2.0
Nasa9Poly1.h
Go to the documentation of this file.
1 /**
2  * @file Nasa9Poly1.h
3  * Header for a single-species standard state object derived
4  * from
5  * \link Cantera::SpeciesThermoInterpType SpeciesThermoInterpType\endlink based
6  * on the NASA 9 coefficient temperature polynomial form applied to
7  * one temperature region
8  * (see \ref spthermo and class \link Cantera::Nasa9Poly1 Nasa9Poly1\endlink).
9  *
10  * This parameterization has one NASA temperature region.
11  */
12 /*
13  * Copyright (2006) Sandia Corporation. Under the terms of
14  * Contract DE-AC04-94AL85000 with Sandia Corporation, the
15  * U.S. Government retains certain rights in this software.
16  */
17 
18 #ifndef CT_NASA9POLY1_H
19 #define CT_NASA9POLY1_H
20 #include "cantera/base/global.h"
22 
23 namespace Cantera
24 {
25 
26 
27 //! The NASA 9 polynomial parameterization for one temperature range.
28 /*!
29  * This parameterization expresses the heat capacity via a
30  * 7 coefficient polynomial.
31  * Note that this is the form used in the
32  * 2002 NASA equilibrium program. A reference to the form is
33  * provided below:
34  *
35  * "NASA Glenn Coefficients for Calculating Thermodynamic
36  * Properties of Individual Species,"
37  * B. J. McBride, M. J. Zehe, S. Gordon
38  * NASA/TP-2002-211556, Sept. 2002
39  *
40  * Nine coefficients \f$(a_0,\dots,a_6)\f$ are used to represent
41  * \f$ C_p^0(T)\f$, \f$ H^0(T)\f$, and \f$ S^0(T) \f$ as
42  * polynomials in \f$ T \f$ :
43  * \f[
44  * \frac{C_p^0(T)}{R} = a_0 T^{-2} + a_1 T^{-1} + a_2 + a_3 T
45  * + a_4 T^2 + a_5 T^3 + a_6 T^4
46  * \f]
47  *
48  * \f[
49  * \frac{H^0(T)}{RT} = - a_0 T^{-2} + a_1 \frac{\ln(T)}{T} + a_2
50  * + a_3 T + a_4 T^2 + a_5 T^3 + a_6 T^4 + \frac{a_7}{T}
51  * \f]
52  *
53  * \f[
54  * \frac{s^0(T)}{R} = - \frac{a_0}{2} T^{-2} - a_1 T^{-1} + a_2 \ln(T)
55  + + a_3 T \frac{a_4}{2} T^2 + \frac{a_5}{3} T^3 + \frac{a_6}{4} T^4 + a_8
56  * \f]
57  *
58  * The standard state is assumed to be an ideal gas at the
59  * standard pressure of 1 bar, for gases.
60  * For condensed species, the standard state is the
61  * pure crystalline or liquid substance at the standard
62  * pressure of 1 atm.
63  *
64  * These NASA representations may have multiple temperature regions
65  * through the use of the Nasa9PolyMultiTempRegion object, which uses
66  * multiple copies of this %Nasa9Poly1 object to handle multiple temperature
67  * regions.
68  *
69  * @ingroup spthermo
70  */
72 {
73 
74 public:
75 
76  //! Empty constructor
77  Nasa9Poly1();
78 
79 
80  //! constructor used in templated instantiations
81  /*!
82  * @param n Species index
83  * @param tlow Minimum temperature
84  * @param thigh Maximum temperature
85  * @param pref reference pressure (Pa).
86  * @param coeffs Vector of coefficients used to set the
87  * parameters for the standard state.
88  */
89  Nasa9Poly1(size_t n, doublereal tlow, doublereal thigh, doublereal pref,
90  const doublereal* coeffs);
91 
92  //! copy constructor
93  /*!
94  * @param b object to be copied
95  */
96  Nasa9Poly1(const Nasa9Poly1& b);
97 
98  //! assignment operator
99  /*!
100  * @param b object to be copied
101  */
102  Nasa9Poly1& operator=(const Nasa9Poly1& b);
103 
104  //! Destructor
105  virtual ~Nasa9Poly1();
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, doublereal* s_R) const;
154 
155 
156  //! Compute the reference-state property of one species
157  /*!
158  * Given temperature T in K, this method updates the values of
159  * the non-dimensional heat capacity at constant pressure,
160  * enthalpy, and entropy, at the reference pressure, Pref
161  * of one of the species. The species index is used
162  * to reference into the cp_R, h_RT, and s_R arrays.
163  *
164  * Temperature Polynomial:
165  * tt[0] = t;
166  * tt[1] = t*t;
167  * tt[2] = t*t*t;
168  * tt[3] = t*t*t*t;
169  * tt[4] = 1.0/t;
170  * tt[5] = 1.0/(t*t);
171  * tt[6] = std::log(t);
172  *
173  * @param temp Temperature (Kelvin)
174  * @param cp_R Vector of Dimensionless heat capacities.
175  * (length m_kk).
176  * @param h_RT Vector of Dimensionless enthalpies.
177  * (length m_kk).
178  * @param s_R Vector of Dimensionless entropies.
179  * (length m_kk).
180  */
181  virtual void updatePropertiesTemp(const doublereal temp,
182  doublereal* cp_R, doublereal* h_RT,
183  doublereal* s_R) const;
184 
185  //!This utility function reports back the type of
186  //! parameterization and all of the parameters for the
187  //! species, index.
188  /*!
189  * All parameters are output variables
190  *
191  * @param n Species index
192  * @param type Integer type of the standard type
193  * @param tlow output - Minimum temperature
194  * @param thigh output - Maximum temperature
195  * @param pref output - reference pressure (Pa).
196  * @param coeffs Vector of coefficients used to set the
197  * parameters for the standard state. There are
198  * 12 of them, designed to be compatible
199  * with the multiple temperature formulation.
200  * coeffs[0] is equal to one.
201  * coeffs[1] is min temperature
202  * coeffs[2] is max temperature
203  * coeffs[3+i] from i =0,9 are the coefficients themselves
204  */
205  virtual void reportParameters(size_t& n, int& type,
206  doublereal& tlow, doublereal& thigh,
207  doublereal& pref,
208  doublereal* const coeffs) const;
209 
210  //! Modify parameters for the standard state
211  /*!
212  * @param coeffs Vector of coefficients used to set the
213  * parameters for the standard state.
214  */
215  virtual void modifyParameters(doublereal* coeffs);
216 
217 protected:
218  //! lowest valid temperature
219  doublereal m_lowT;
220  //! highest valid temperature
221  doublereal m_highT;
222  //! standard-state pressure
223  doublereal m_Pref;
224  //! species index
225  size_t m_index;
226  //! array of polynomial coefficients
228 };
229 
230 }
231 #endif
232