00001 /** 00002 * @file Nasa9PolyMultiTempRegion.h 00003 * Header for a single-species standard state object derived 00004 * from \link Cantera::SpeciesThermoInterpType 00005 * SpeciesThermoInterpType\endlink based 00006 * on the NASA 9 coefficient temperature polynomial form 00007 * applied to multiple temperature regions 00008 * (see \ref spthermo and class \link Cantera::Nasa9PolyMultiTempRegion Nasa9PolyMultiTempRegion\endlink). 00009 * 00010 * This parameterization has multiple NASA temperature regions. 00011 */ 00012 00013 00014 #ifndef CT_NASA9POLYMULTITEMPREGION_H 00015 #define CT_NASA9POLYMULTITEMPREGION_H 00016 00017 /* $Author: hkmoffa $ 00018 * $Revision: 279 $ 00019 * $Date: 2009-12-05 14:08:43 -0500 (Sat, 05 Dec 2009) $ 00020 */ 00021 00022 // Copyright 2007 Sandia National Laboratories 00023 00024 00025 #include "global.h" 00026 #include "Nasa9Poly1.h" 00027 00028 namespace Cantera { 00029 00030 //! The NASA 9 polynomial parameterization for a single species 00031 //! encompassing multiple temperature regions. 00032 /*! 00033 * This parameterization expresses the heat capacity via a 00034 * 7 coefficient polynomial. 00035 * Note that this is the form used in the 00036 * 2002 NASA equilibrium program. A reference to the form is 00037 * provided below: 00038 * 00039 * "NASA Glenn Coefficients for Calculating Thermodynamic 00040 * Properties of Individual Species," 00041 * B. J. McBride, M. J. Zehe, S. Gordon 00042 * NASA/TP-2002-211556, Sept. 2002 00043 * 00044 * Nine coefficients \f$(a_0,\dots,a_6)\f$ are used to represent 00045 * \f$ C_p^0(T)\f$, \f$ H^0(T)\f$, and \f$ S^0(T) \f$ as 00046 * polynomials in \f$ T \f$ : 00047 * \f[ 00048 * \frac{C_p^0(T)}{R} = a_0 T^{-2} + a_1 T^{-1} + a_2 + a_3 T 00049 * + a_4 T^2 + a_5 T^3 + a_6 T^4 00050 * \f] 00051 * 00052 * \f[ 00053 * \frac{H^0(T)}{RT} = - a_0 T^{-2} + a_1 \frac{\ln(T)}{T} + a_2 00054 * + a_3 T + a_4 T^2 + a_5 T^3 + a_6 T^4 + \frac{a_7}{T} 00055 * \f] 00056 * 00057 * \f[ 00058 * \frac{s^0(T)}{R} = - \frac{a_0}{2} T^{-2} - a_1 T^{-1} + a_2 \ln(T) 00059 + + a_3 T \frac{a_4}{2} T^2 + \frac{a_5}{3} T^3 + \frac{a_6}{4} T^4 + a_8 00060 * \f] 00061 * 00062 * The standard state is assumed to be an ideal gas at the 00063 * standard pressure of 1 bar, for gases. 00064 * For condensed species, the standard state is the 00065 * pure crystalline or liquid substance at the standard 00066 * pressure of 1 atm. 00067 * 00068 * These NASA representations may have multiple temperature regions 00069 * through the use of this %Nasa9PolyMultiTempRegion object, which uses 00070 * multiple copies of the Nasa9Poly1 object to handle multiple temperature 00071 * regions. 00072 * 00073 * @ingroup spthermo 00074 */ 00075 class Nasa9PolyMultiTempRegion : public SpeciesThermoInterpType { 00076 00077 public: 00078 00079 //! Empty constructor 00080 Nasa9PolyMultiTempRegion(); 00081 00082 //! Constructor used in templated instantiations 00083 /*! 00084 * @param regionPts Vector of pointers to Nasa9Poly1 objects. These 00085 * objects all refer to the temperature regions for the 00086 * same species. The vector must be in increasing 00087 * temperature region format. Together they 00088 * represent the reference temperature parameterization 00089 * for a single species. 00090 * 00091 * Note, after the constructor, we will own the underlying 00092 * Nasa9Poly1 objects and be responsible for owning them. 00093 */ 00094 Nasa9PolyMultiTempRegion(std::vector<Cantera::Nasa9Poly1 *> ®ionPts); 00095 00096 //! Copy constructor 00097 /*! 00098 * @param b object to be copied 00099 */ 00100 Nasa9PolyMultiTempRegion(const Nasa9PolyMultiTempRegion& b); 00101 00102 //! Assignment operator 00103 /*! 00104 * @param b object to be copied 00105 */ 00106 Nasa9PolyMultiTempRegion& operator=(const Nasa9PolyMultiTempRegion& b); 00107 00108 //! Destructor 00109 virtual ~Nasa9PolyMultiTempRegion(); 00110 00111 //! Duplicator 00112 virtual SpeciesThermoInterpType * 00113 duplMyselfAsSpeciesThermoInterpType() const; 00114 00115 //! Returns the minimum temperature that the thermo 00116 //! parameterization is valid 00117 virtual doublereal minTemp() const; 00118 00119 //! Returns the maximum temperature that the thermo 00120 //! parameterization is valid 00121 virtual doublereal maxTemp() const; 00122 00123 //! Returns the reference pressure (Pa) 00124 virtual doublereal refPressure() const; 00125 00126 //! Returns an integer representing the type of parameterization 00127 virtual int reportType() const; 00128 00129 //! Returns an integer representing the species index 00130 virtual int speciesIndex() const; 00131 00132 //! Update the properties for this species, given a temperature polynomial 00133 /*! 00134 * This method is called with a pointer to an array containing the functions of 00135 * temperature needed by this parameterization, and three pointers to arrays where the 00136 * computed property values should be written. This method updates only one value in 00137 * each array. 00138 * 00139 * Temperature Polynomial: 00140 * tt[0] = t; 00141 * tt[1] = t*t; 00142 * tt[2] = t*t*t; 00143 * tt[3] = t*t*t*t; 00144 * tt[4] = 1.0/t; 00145 * tt[5] = 1.0/(t*t); 00146 * tt[6] = std::log(t); 00147 * 00148 * @param tt vector of temperature polynomials 00149 * @param cp_R Vector of Dimensionless heat capacities. 00150 * (length m_kk). 00151 * @param h_RT Vector of Dimensionless enthalpies. 00152 * (length m_kk). 00153 * @param s_R Vector of Dimensionless entropies. 00154 * (length m_kk). 00155 */ 00156 virtual void updateProperties(const doublereal* tt, 00157 doublereal* cp_R, doublereal* h_RT, 00158 doublereal* s_R) const; 00159 00160 00161 //! Compute the reference-state property of one species 00162 /*! 00163 * Given temperature T in K, this method updates the values of 00164 * the non-dimensional heat capacity at constant pressure, 00165 * enthalpy, and entropy, at the reference pressure, Pref 00166 * of one of the species. The species index is used 00167 * to reference into the cp_R, h_RT, and s_R arrays. 00168 * 00169 * Temperature Polynomial: 00170 * tt[0] = t; 00171 * tt[1] = t*t; 00172 * tt[2] = t*t*t; 00173 * tt[3] = t*t*t*t; 00174 * tt[4] = 1.0/t; 00175 * tt[5] = 1.0/(t*t); 00176 * tt[6] = std::log(t); 00177 * 00178 * @param temp Temperature (Kelvin) 00179 * @param cp_R Vector of Dimensionless heat capacities. 00180 * (length m_kk). 00181 * @param h_RT Vector of Dimensionless enthalpies. 00182 * (length m_kk). 00183 * @param s_R Vector of Dimensionless entropies. 00184 * (length m_kk). 00185 */ 00186 virtual void updatePropertiesTemp(const doublereal temp, 00187 doublereal* cp_R, doublereal* h_RT, 00188 doublereal* s_R) const; 00189 00190 //!This utility function reports back the type of 00191 //! parameterization and all of the parameters for the 00192 //! species, index. 00193 /*! 00194 * All parameters are output variables 00195 * 00196 * @param n Species index 00197 * @param type Integer type of the standard type 00198 * @param tlow output - Minimum temperature 00199 * @param thigh output - Maximum temperature 00200 * @param pref output - reference pressure (Pa). 00201 * @param coeffs Vector of coefficients used to set the 00202 * parameters for the standard state. 00203 * There are 1 + 11*nzones coefficients 00204 * coeffs[0] is equal to nTempZones. 00205 * index = 1 00206 * for each zone: 00207 * coeffs[index] = minTempZone 00208 * coeffs[index+1] = maxTempZone 00209 * coeffs[index+2+i] from i =0,9 are the coefficients themselves 00210 */ 00211 virtual void reportParameters(int &n, int &type, 00212 doublereal &tlow, doublereal &thigh, 00213 doublereal &pref, 00214 doublereal* const coeffs) const; 00215 00216 //! Modify parameters for the standard state 00217 /*! 00218 * @param coeffs Vector of coefficients used to set the 00219 * parameters for the standard state. 00220 */ 00221 virtual void modifyParameters(doublereal* coeffs); 00222 00223 protected: 00224 //! lowest valid temperature 00225 doublereal m_lowT; 00226 //! highest valid temperature 00227 doublereal m_highT; 00228 //! standard-state pressure 00229 doublereal m_Pref; 00230 //! species index 00231 int m_index; 00232 //! Number of temperature regions 00233 int m_numTempRegions; 00234 00235 //! Lower boundaries of each temperature regions 00236 vector_fp m_lowerTempBounds; 00237 00238 //! pointers to the objects 00239 /*! 00240 * This object will now own these pointers and delete 00241 * them when the current object is deleted. 00242 */ 00243 std::vector<Nasa9Poly1 *>m_regionPts; 00244 00245 //! current region 00246 mutable int m_currRegion; 00247 }; 00248 00249 } 00250 #endif 00251