Cantera  2.4.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 {
19 
20 Nasa9Poly1::Nasa9Poly1(double tlow, double thigh, double pref,
21  const double* coeffs) :
22  SpeciesThermoInterpType(tlow, thigh, pref),
23  m_coeff(coeffs, coeffs + 9)
24 {
25 }
26 
28 {
29  return NASA9;
30 }
31 
32 void Nasa9Poly1::updateTemperaturePoly(double T, double* T_poly) const
33 {
34  T_poly[0] = T;
35  T_poly[1] = T * T;
36  T_poly[2] = T_poly[1] * T;
37  T_poly[3] = T_poly[2] * T;
38  T_poly[4] = 1.0 / T;
39  T_poly[5] = T_poly[4] / T;
40  T_poly[6] = std::log(T);
41 }
42 
43 void Nasa9Poly1::updateProperties(const doublereal* tt,
44  doublereal* cp_R, doublereal* h_RT,
45  doublereal* s_R) const
46 {
47 
48  doublereal ct0 = m_coeff[0] * tt[5]; // a0 / (T^2)
49  doublereal ct1 = m_coeff[1] * tt[4]; // a1 / T
50  doublereal ct2 = m_coeff[2]; // a2
51  doublereal ct3 = m_coeff[3] * tt[0]; // a3 * T
52  doublereal ct4 = m_coeff[4] * tt[1]; // a4 * T^2
53  doublereal ct5 = m_coeff[5] * tt[2]; // a5 * T^3
54  doublereal ct6 = m_coeff[6] * tt[3]; // a6 * T^4
55 
56  doublereal cpdivR = ct0 + ct1 + ct2 + ct3 + ct4 + ct5 + ct6;
57  doublereal hdivRT = -ct0 + tt[6]*ct1 + ct2 + 0.5*ct3 + 1.0/3.0*ct4
58  + 0.25*ct5 + 0.2*ct6 + m_coeff[7] * tt[4];
59  doublereal sdivR = -0.5*ct0 - ct1 + tt[6]*ct2 + ct3 + 0.5*ct4
60  + 1.0/3.0*ct5 + 0.25*ct6 + m_coeff[8];
61 
62  // return the computed properties for this species
63  *cp_R = cpdivR;
64  *h_RT = hdivRT;
65  *s_R = sdivR;
66 }
67 
68 void Nasa9Poly1::updatePropertiesTemp(const doublereal temp,
69  doublereal* cp_R, doublereal* h_RT,
70  doublereal* s_R) const
71 {
72  double tPoly[7];
73  updateTemperaturePoly(temp, tPoly);
74  updateProperties(tPoly, cp_R, h_RT, s_R);
75 }
76 
77 void Nasa9Poly1::reportParameters(size_t& n, int& type,
78  doublereal& tlow, doublereal& thigh,
79  doublereal& pref,
80  doublereal* const coeffs) const
81 {
82  n = 0;
83  type = NASA9;
84  tlow = m_lowT;
85  thigh = m_highT;
86  pref = m_Pref;
87  coeffs[0] = 1;
88  coeffs[1] = m_lowT;
89  coeffs[2] = m_highT;
90  for (int i = 0; i < 9; i++) {
91  coeffs[i+3] = m_coeff[i];
92  }
93 }
94 
95 }
Abstract Base class for the thermodynamic manager for an individual species&#39; reference state...
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:43
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:32
#define NASA9
9 coefficient NASA Polynomials This is implemented in the class Nasa9Poly1 in Nasa9Poly1.h
Nasa9Poly1(double tlow, double thigh, double pref, const double *coeffs)
Normal constructor.
Definition: Nasa9Poly1.cpp:20
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:77
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:68
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:27
doublereal m_Pref
Reference state pressure.
Namespace for the Cantera kernel.
Definition: AnyMap.cpp:8
vector_fp m_coeff
array of polynomial coefficients
Definition: Nasa9Poly1.h:123