Cantera  2.3.0
Nasa9Poly1.cpp
Go to the documentation of this file.
1 /**
2  * @file Nasa9Poly1.cpp Definitions for a single-species standard state object
3  * derived from
4  * \link Cantera::SpeciesThermoInterpType SpeciesThermoInterpType\endlink based
5  * on the NASA 9 coefficient temperature polynomial form applied to one
6  * temperature region (see \ref spthermo and class \link Cantera::Nasa9Poly1
7  * Nasa9Poly1\endlink).
8  *
9  * This parameterization has one NASA temperature region.
10  */
11 
12 // This file is part of Cantera. See License.txt in the top-level directory or
13 // at http://www.cantera.org/license.txt for license and copyright information.
14 
16 
17 namespace Cantera
18 {
20  : m_coeff(9, 0.0)
21 {
22  warn_deprecated("Nasa9Poly1::Nasa9Poly1()",
23  "Default constructor to be removed after Cantera 2.3.");
24  m_Pref = 1.0e5;
25 }
26 
27 Nasa9Poly1::Nasa9Poly1(double tlow, double thigh, double pref,
28  const double* coeffs) :
29  SpeciesThermoInterpType(tlow, thigh, pref),
30  m_coeff(coeffs, coeffs + 9)
31 {
32 }
33 
35 {
36  return new Nasa9Poly1(*this);
37 }
38 
40 {
41  return NASA9;
42 }
43 
44 void Nasa9Poly1::updateTemperaturePoly(double T, double* T_poly) const
45 {
46  T_poly[0] = T;
47  T_poly[1] = T * T;
48  T_poly[2] = T_poly[1] * T;
49  T_poly[3] = T_poly[2] * T;
50  T_poly[4] = 1.0 / T;
51  T_poly[5] = T_poly[4] / T;
52  T_poly[6] = std::log(T);
53 }
54 
55 void Nasa9Poly1::updateProperties(const doublereal* tt,
56  doublereal* cp_R, doublereal* h_RT,
57  doublereal* s_R) const
58 {
59 
60  doublereal ct0 = m_coeff[0] * tt[5]; // a0 / (T^2)
61  doublereal ct1 = m_coeff[1] * tt[4]; // a1 / T
62  doublereal ct2 = m_coeff[2]; // a2
63  doublereal ct3 = m_coeff[3] * tt[0]; // a3 * T
64  doublereal ct4 = m_coeff[4] * tt[1]; // a4 * T^2
65  doublereal ct5 = m_coeff[5] * tt[2]; // a5 * T^3
66  doublereal ct6 = m_coeff[6] * tt[3]; // a6 * T^4
67 
68  doublereal cpdivR = ct0 + ct1 + ct2 + ct3 + ct4 + ct5 + ct6;
69  doublereal hdivRT = -ct0 + tt[6]*ct1 + ct2 + 0.5*ct3 + 1.0/3.0*ct4
70  + 0.25*ct5 + 0.2*ct6 + m_coeff[7] * tt[4];
71  doublereal sdivR = -0.5*ct0 - ct1 + tt[6]*ct2 + ct3 + 0.5*ct4
72  + 1.0/3.0*ct5 + 0.25*ct6 + m_coeff[8];
73 
74  // return the computed properties for this species
75  *cp_R = cpdivR;
76  *h_RT = hdivRT;
77  *s_R = sdivR;
78 }
79 
80 void Nasa9Poly1::updatePropertiesTemp(const doublereal temp,
81  doublereal* cp_R, doublereal* h_RT,
82  doublereal* s_R) const
83 {
84  double tPoly[7];
85  updateTemperaturePoly(temp, tPoly);
86  updateProperties(tPoly, cp_R, h_RT, s_R);
87 }
88 
89 void Nasa9Poly1::reportParameters(size_t& n, int& type,
90  doublereal& tlow, doublereal& thigh,
91  doublereal& pref,
92  doublereal* const coeffs) const
93 {
94  n = 0;
95  type = NASA9;
96  tlow = m_lowT;
97  thigh = m_highT;
98  pref = m_Pref;
99  coeffs[0] = 1;
100  coeffs[1] = m_lowT;
101  coeffs[2] = m_highT;
102  for (int i = 0; i < 9; i++) {
103  coeffs[i+3] = m_coeff[i];
104  }
105 }
106 
107 void Nasa9Poly1::modifyParameters(doublereal* coeffs)
108 {
109  warn_deprecated("Nasa9Poly1::modifyParameters", "To be removed after "
110  "Cantera 2.3. Use MultiSpeciesThermo::modifySpecies instead.");
111  for (int i = 0; i < 9; i++) {
112  m_coeff[i] = coeffs[i];
113  }
114 }
115 
116 }
Nasa9Poly1()
Empty constructor.
Definition: Nasa9Poly1.cpp:19
virtual void modifyParameters(doublereal *coeffs)
Definition: Nasa9Poly1.cpp:107
Abstract Base class for the thermodynamic manager for an individual species&#39; reference state...
virtual SpeciesThermoInterpType * duplMyselfAsSpeciesThermoInterpType() const
Definition: Nasa9Poly1.cpp:34
Header for a single-species standard state object derived from SpeciesThermoInterpType based on the N...
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:55
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:44
void warn_deprecated(const std::string &method, const std::string &extra)
Print a warning indicating that method is deprecated.
Definition: global.cpp:54
#define NASA9
9 coefficient NASA Polynomials This is implemented in the class Nasa9Poly1 in Nasa9Poly1.h
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:89
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:80
doublereal m_highT
Highest valid temperature.
doublereal m_lowT
lowest valid temperature
virtual int reportType() const
Returns an integer representing the type of parameterization.
Definition: Nasa9Poly1.cpp:39
doublereal m_Pref
Reference state pressure.
Namespace for the Cantera kernel.
Definition: application.cpp:29
vector_fp m_coeff
array of polynomial coefficients
Definition: Nasa9Poly1.h:134