Cantera  2.2.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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 
22 
23 namespace Cantera
24 {
25 //! The NASA 9 polynomial parameterization for one temperature range.
26 /*!
27  * This parameterization expresses the heat capacity via a
28  * 7 coefficient polynomial.
29  * Note that this is the form used in the
30  * 2002 NASA equilibrium program. A reference to the form is
31  * provided below:
32  *
33  * "NASA Glenn Coefficients for Calculating Thermodynamic
34  * Properties of Individual Species,"
35  * B. J. McBride, M. J. Zehe, S. Gordon
36  * NASA/TP-2002-211556, Sept. 2002
37  *
38  * Nine coefficients \f$(a_0,\dots,a_8)\f$ are used to represent
39  * \f$ C_p^0(T)\f$, \f$ H^0(T)\f$, and \f$ S^0(T) \f$ as
40  * polynomials in \f$ T \f$ :
41  * \f[
42  * \frac{C_p^0(T)}{R} = a_0 T^{-2} + a_1 T^{-1} + a_2 + a_3 T
43  * + a_4 T^2 + a_5 T^3 + a_6 T^4
44  * \f]
45  *
46  * \f[
47  * \frac{H^0(T)}{RT} = - a_0 T^{-2} + a_1 \frac{\ln T}{T} + a_2
48  * + \frac{a_3}{2} T + \frac{a_4}{3} T^2 + \frac{a_5}{4} T^3 +
49  * \frac{a_6}{5} 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 the Nasa9PolyMultiTempRegion object, which uses
65  * multiple copies of this Nasa9Poly1 object to handle multiple temperature
66  * regions.
67  *
68  * @ingroup spthermo
69  * @see Nasa9PolyMultiTempRegion
70  */
72 {
73 public:
74  //! Empty constructor
75  Nasa9Poly1();
76 
77  //! constructor used in templated instantiations
78  /*!
79  * @param n Species index
80  * @param tlow Minimum temperature
81  * @param thigh Maximum temperature
82  * @param pref reference pressure (Pa).
83  * @param coeffs Vector of coefficients used to set the
84  * parameters for the standard state.
85  * @deprecated Use the constructor whic hdoes not require the species
86  * index. To be removed after Cantera 2.2.
87  */
88  Nasa9Poly1(size_t n, doublereal tlow, doublereal thigh, doublereal pref,
89  const doublereal* coeffs);
90 
91  //! Normal constructor
92  /*!
93  * @param tlow Minimum temperature
94  * @param thigh Maximum temperature
95  * @param pref reference pressure (Pa).
96  * @param coeffs Vector of coefficients used to set the
97  * parameters for the standard state.
98  */
99  Nasa9Poly1(double tlow, double thigh, double pref, const double* coeffs);
100 
101  //! copy constructor
102  /*!
103  * @param b object to be copied
104  */
105  Nasa9Poly1(const Nasa9Poly1& b);
106 
107  //! assignment operator
108  /*!
109  * @param b object to be copied
110  */
111  Nasa9Poly1& operator=(const Nasa9Poly1& b);
112 
113  virtual SpeciesThermoInterpType*
114  duplMyselfAsSpeciesThermoInterpType() const;
115 
116  virtual int reportType() const;
117 
118  virtual size_t temperaturePolySize() const { return 7; }
119  virtual void updateTemperaturePoly(double T, double* T_poly) const;
120 
121  //! Update the properties for this species, given a temperature polynomial
122  /*!
123  * This method is called with a pointer to an array containing the
124  * functions of temperature needed by this parameterization, and three
125  * pointers to arrays where the computed property values should be
126  * written. This method updates only one value in each array.
127  *
128  * Temperature Polynomial:
129  * tt[0] = t;
130  * tt[1] = t*t;
131  * tt[2] = t*t*t;
132  * tt[3] = t*t*t*t;
133  * tt[4] = 1.0/t;
134  * tt[5] = 1.0/(t*t);
135  * tt[6] = std::log(t);
136  *
137  * @param tt vector of temperature polynomials
138  * @param cp_R Vector of Dimensionless heat capacities. (length m_kk).
139  * @param h_RT Vector of Dimensionless enthalpies. (length m_kk).
140  * @param s_R Vector of Dimensionless entropies. (length m_kk).
141  */
142  virtual void updateProperties(const doublereal* tt,
143  doublereal* cp_R, doublereal* h_RT, doublereal* s_R) const;
144 
145  //! Compute the reference-state property of one species
146  /*!
147  * Given temperature T in K, this method updates the values of the non-
148  * dimensional heat capacity at constant pressure, enthalpy, and entropy,
149  * at the reference pressure, Pref of one of the species. The species
150  * index is used to reference into the cp_R, h_RT, and s_R arrays.
151  *
152  * Temperature Polynomial:
153  * tt[0] = t;
154  * tt[1] = t*t;
155  * tt[2] = t*t*t;
156  * tt[3] = t*t*t*t;
157  * tt[4] = 1.0/t;
158  * tt[5] = 1.0/(t*t);
159  * tt[6] = std::log(t);
160  *
161  * @param temp Temperature (Kelvin)
162  * @param cp_R Vector of Dimensionless heat capacities. (length m_kk).
163  * @param h_RT Vector of Dimensionless enthalpies. (length m_kk).
164  * @param s_R Vector of Dimensionless entropies. (length m_kk).
165  */
166  virtual void updatePropertiesTemp(const doublereal temp,
167  doublereal* cp_R, doublereal* h_RT,
168  doublereal* s_R) const;
169 
170  //!This utility function reports back the type of
171  //! parameterization and all of the parameters for the
172  //! species, index.
173  /*!
174  * All parameters are output variables
175  *
176  * @param n Species index
177  * @param type Integer type of the standard type
178  * @param tlow output - Minimum temperature
179  * @param thigh output - Maximum temperature
180  * @param pref output - reference pressure (Pa).
181  * @param coeffs Vector of coefficients used to set the
182  * parameters for the standard state. There are
183  * 12 of them, designed to be compatible
184  * with the multiple temperature formulation.
185  * coeffs[0] is equal to one.
186  * coeffs[1] is min temperature
187  * coeffs[2] is max temperature
188  * coeffs[3+i] from i =0,9 are the coefficients themselves
189  */
190  virtual void reportParameters(size_t& n, int& type,
191  doublereal& tlow, doublereal& thigh,
192  doublereal& pref,
193  doublereal* const coeffs) const;
194 
195  //! Modify parameters for the standard state
196  /*!
197  * @param coeffs Vector of coefficients used to set the
198  * parameters for the standard state.
199  */
200  virtual void modifyParameters(doublereal* coeffs);
201 
202 protected:
203  //! array of polynomial coefficients
205 };
206 
207 }
208 #endif
Nasa9Poly1()
Empty constructor.
Definition: Nasa9Poly1.cpp:18
virtual void modifyParameters(doublereal *coeffs)
Modify parameters for the standard state.
Definition: Nasa9Poly1.cpp:130
virtual void reportParameters(size_t &n, int &type, doublereal &tlow, doublereal &thigh, doublereal &pref, doublereal *const coeffs) const
This utility function reports back the type of parameterization and all of the parameters for the spe...
Definition: Nasa9Poly1.cpp:112
Pure Virtual Base class for the thermodynamic manager for an individual species' reference state...
virtual size_t temperaturePolySize() const
Number of terms in the temperature polynomial for this parameterization.
Definition: Nasa9Poly1.h:118
virtual int reportType() const
Returns an integer representing the type of parameterization.
Definition: Nasa9Poly1.cpp:60
Pure Virtual Base class for individual species reference state thermodynamic managers and text for th...
virtual void updatePropertiesTemp(const doublereal temp, doublereal *cp_R, doublereal *h_RT, doublereal *s_R) const
Compute the reference-state property of one species.
Definition: Nasa9Poly1.cpp:103
virtual void updateTemperaturePoly(double T, double *T_poly) const
Given the temperature T, compute the terms of the temperature polynomial T_poly.
Definition: Nasa9Poly1.cpp:65
Nasa9Poly1 & operator=(const Nasa9Poly1 &b)
assignment operator
Definition: Nasa9Poly1.cpp:45
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:157
virtual void updateProperties(const doublereal *tt, doublereal *cp_R, doublereal *h_RT, doublereal *s_R) const
Update the properties for this species, given a temperature polynomial.
Definition: Nasa9Poly1.cpp:76
The NASA 9 polynomial parameterization for one temperature range.
Definition: Nasa9Poly1.h:71
vector_fp m_coeff
array of polynomial coefficients
Definition: Nasa9Poly1.h:204