Cantera  3.1.0a1
Nasa9Poly1.h
Go to the documentation of this file.
1 /**
2  * @file Nasa9Poly1.h Header for a single-species standard state object derived
3  * from @link Cantera::SpeciesThermoInterpType
4  * SpeciesThermoInterpType@endlink based on the NASA 9 coefficient
5  * temperature polynomial form applied to one temperature region (see @ref
6  * spthermo and class @link Cantera::Nasa9Poly1 Nasa9Poly1@endlink).
7  *
8  * This parameterization has one NASA temperature region.
9  */
10 
11 // This file is part of Cantera. See License.txt in the top-level directory or
12 // at https://cantera.org/license.txt for license and copyright information.
13 
14 #ifndef CT_NASA9POLY1_H
15 #define CT_NASA9POLY1_H
16 
18 #include "speciesThermoTypes.h"
19 
20 namespace Cantera
21 {
22 //! The NASA 9 polynomial parameterization for one temperature range.
23 /*!
24  * This parameterization expresses the heat capacity via a 7 coefficient
25  * polynomial. Note that this is the form used in the 2002 NASA equilibrium
26  * program. A reference to the form is provided in McBride, et al.
27  * @cite mcbride2002.
28  *
29  * Nine coefficients @f$ (a_0,\dots,a_8) @f$ are used to represent
30  * @f$ C_p^0(T) @f$, @f$ H^0(T) @f$, and @f$ S^0(T) @f$ as
31  * polynomials in @f$ T @f$ :
32  * @f[
33  * \frac{C_p^0(T)}{R} = a_0 T^{-2} + a_1 T^{-1} + a_2 + a_3 T
34  * + a_4 T^2 + a_5 T^3 + a_6 T^4
35  * @f]
36  *
37  * @f[
38  * \frac{H^0(T)}{RT} = - a_0 T^{-2} + a_1 \frac{\ln T}{T} + a_2
39  * + \frac{a_3}{2} T + \frac{a_4}{3} T^2 + \frac{a_5}{4} T^3 +
40  * \frac{a_6}{5} T^4 + \frac{a_7}{T}
41  * @f]
42  *
43  * @f[
44  * \frac{s^0(T)}{R} = - \frac{a_0}{2} T^{-2} - a_1 T^{-1} + a_2 \ln T
45  * + a_3 T + \frac{a_4}{2} T^2 + \frac{a_5}{3} T^3 + \frac{a_6}{4} T^4 + a_8
46  * @f]
47  *
48  * The standard state is assumed to be an ideal gas at the standard pressure of
49  * 1 bar, for gases. For condensed species, the standard state is the pure
50  * crystalline or liquid substance at the standard pressure of 1 atm.
51  *
52  * These NASA representations may have multiple temperature regions through the
53  * use of the Nasa9PolyMultiTempRegion object, which uses multiple copies of
54  * this Nasa9Poly1 object to handle multiple temperature regions.
55  *
56  * @ingroup spthermo
57  * @see Nasa9PolyMultiTempRegion
58  */
60 {
61 public:
62  Nasa9Poly1();
63 
64  //! Constructor with all input data
65  /*!
66  * @param tlow Minimum temperature
67  * @param thigh Maximum temperature
68  * @param pref reference pressure (Pa).
69  * @param coeffs Vector of coefficients used to set the
70  * parameters for the standard state.
71  */
72  Nasa9Poly1(double tlow, double thigh, double pref, const double* coeffs);
73 
74  //! Set the array of 9 polynomial coefficients
75  void setParameters(const vector<double>& coeffs);
76 
77  int reportType() const override;
78 
79  size_t temperaturePolySize() const override { return 7; }
80  void updateTemperaturePoly(double T, double* T_poly) const override;
81 
82  /**
83  * @copydoc SpeciesThermoInterpType::updateProperties
84  *
85  * Temperature Polynomial:
86  * - tt[0] = t;
87  * - tt[1] = t*t;
88  * - tt[2] = t*t*t;
89  * - tt[3] = t*t*t*t;
90  * - tt[4] = 1.0/t;
91  * - tt[5] = 1.0/(t*t);
92  * - tt[6] = std::log(t);
93  */
94  void updateProperties(const double* tt, double* cp_R, double* h_RT,
95  double* s_R) const override;
96 
97  void updatePropertiesTemp(const double temp, double* cp_R, double* h_RT,
98  double* s_R) const override;
99 
100  //! This utility function reports back the type of parameterization and all
101  //! of the parameters for the species
102  /*!
103  * All parameters are output variables
104  *
105  * @param n Species index
106  * @param type Integer type of the standard type
107  * @param tlow output - Minimum temperature
108  * @param thigh output - Maximum temperature
109  * @param pref output - reference pressure (Pa).
110  * @param coeffs Vector of coefficients used to set the parameters for
111  * the standard state. There are 12 of them, designed to be compatible
112  * with the multiple temperature formulation.
113  * - coeffs[0] is equal to one.
114  * - coeffs[1] is min temperature
115  * - coeffs[2] is max temperature
116  * - coeffs[3+i] from i =0,9 are the coefficients themselves
117  */
118  void reportParameters(size_t& n, int& type, double& tlow, double& thigh,
119  double& pref, double* const coeffs) const override;
120 
121  void getParameters(AnyMap& thermo) const override;
122 
123 protected:
124  //! array of polynomial coefficients
125  vector<double> m_coeff;
126 };
127 
128 }
129 #endif
Pure Virtual Base class for individual species reference state thermodynamic managers and text for th...
A map of string keys to values whose type can vary at runtime.
Definition: AnyMap.h:427
The NASA 9 polynomial parameterization for one temperature range.
Definition: Nasa9Poly1.h:60
vector< double > m_coeff
array of polynomial coefficients
Definition: Nasa9Poly1.h:125
int reportType() const override
Returns an integer representing the type of parameterization.
Definition: Nasa9Poly1.cpp:42
void setParameters(const vector< double > &coeffs)
Set the array of 9 polynomial coefficients.
Definition: Nasa9Poly1.cpp:33
size_t temperaturePolySize() const override
Number of terms in the temperature polynomial for this parameterization.
Definition: Nasa9Poly1.h:79
void getParameters(AnyMap &thermo) const override
Store the parameters of the species thermo object such that an identical species thermo object could ...
Definition: Nasa9Poly1.cpp:106
void updateTemperaturePoly(double T, double *T_poly) const override
Given the temperature T, compute the terms of the temperature polynomial T_poly.
Definition: Nasa9Poly1.cpp:47
void reportParameters(size_t &n, int &type, double &tlow, double &thigh, double &pref, double *const coeffs) const override
This utility function reports back the type of parameterization and all of the parameters for the spe...
Definition: Nasa9Poly1.cpp:90
void updateProperties(const double *tt, double *cp_R, double *h_RT, double *s_R) const override
Update the properties for this species, given a temperature polynomial.
Definition: Nasa9Poly1.cpp:58
void updatePropertiesTemp(const double temp, double *cp_R, double *h_RT, double *s_R) const override
Compute the reference-state property of one species.
Definition: Nasa9Poly1.cpp:82
Abstract Base class for the thermodynamic manager for an individual species' reference state.
Namespace for the Cantera kernel.
Definition: AnyMap.cpp:564
Contains const definitions for types of species reference-state thermodynamics managers (see Species ...