Cantera  2.4.0
Mu0Poly.h
Go to the documentation of this file.
1 /**
2  * @file Mu0Poly.h
3  * Header for a single-species standard state object derived
4  * from \link Cantera::SpeciesThermoInterpType SpeciesThermoInterpType\endlink based
5  * on a piecewise constant mu0 interpolation
6  * (see \ref spthermo and class \link Cantera::Mu0Poly Mu0Poly\endlink).
7  */
8 
9 // This file is part of Cantera. See License.txt in the top-level directory or
10 // at http://www.cantera.org/license.txt for license and copyright information.
11 
12 #ifndef CT_MU0POLY_H
13 #define CT_MU0POLY_H
14 
16 
17 namespace Cantera
18 {
19 class XML_Node;
20 
21 //! The Mu0Poly class implements an interpolation of the Gibbs free energy based
22 //! on a piecewise constant heat capacity approximation.
23 /*!
24  * The Mu0Poly class implements a piecewise constant heat capacity
25  * approximation. of the standard state chemical potential of one species at a
26  * single reference pressure. The chemical potential is input as a series of
27  * (\f$T\f$, \f$ \mu^o(T)\f$) values. The first temperature is assumed to be
28  * equal to 298.15 K; however, this may be relaxed in the future. This
29  * information, and an assumption of a constant heat capacity within each
30  * interval is enough to calculate all thermodynamic functions.
31  *
32  * The piece-wise constant heat capacity is calculated from the change in the
33  * chemical potential over each interval. Once the heat capacity is known, the
34  * other thermodynamic functions may be determined. The basic equation for going
35  * from temperature point 1 to temperature point 2 are as follows for \f$ T \f$,
36  * \f$ T_1 <= T <= T_2 \f$
37  *
38  * \f[
39  * \mu^o(T_1) = h^o(T_1) - T_1 * s^o(T_1)
40  * \f]
41  * \f[
42  * \mu^o(T_2) - \mu^o(T_1) = Cp^o(T_1)(T_2 - T_1) - Cp^o(T_1)(T_2)ln(\frac{T_2}{T_1}) - s^o(T_1)(T_2 - T_1)
43  * \f]
44  * \f[
45  * s^o(T_2) = s^o(T_1) + Cp^o(T_1)ln(\frac{T_2}{T_1})
46  * \f]
47  * \f[
48  * h^o(T_2) = h^o(T_1) + Cp^o(T_1)(T_2 - T_1)
49  * \f]
50  *
51  * Within each interval the following relations are used. For \f$ T \f$, \f$
52  * T_1 <= T <= T_2 \f$
53  *
54  * \f[
55  * \mu^o(T) = \mu^o(T_1) + Cp^o(T_1)(T - T_1) - Cp^o(T_1)(T_2)ln(\frac{T}{T_1}) - s^o(T_1)(T - T_1)
56  * \f]
57  * \f[
58  * s^o(T) = s^o(T_1) + Cp^o(T_1)ln(\frac{T}{T_1})
59  * \f]
60  * \f[
61  * h^o(T) = h^o(T_1) + Cp^o(T_1)(T - T_1)
62  * \f]
63  *
64  * Notes about temperature interpolation for \f$ T < T_1 \f$ and \f$ T >
65  * T_{npoints} \f$: These are achieved by assuming a constant heat capacity
66  * equal to the value in the closest temperature interval. No error is thrown.
67  *
68  * @note In the future, a better assumption about the heat capacity may be
69  * employed, so that it can be continuous.
70  *
71  * @ingroup spthermo
72  */
74 {
75 public:
76  //! Normal constructor
77  /*!
78  * In the constructor, we calculate and store the piecewise linear
79  * approximation to the thermodynamic functions.
80  *
81  * @param tlow Minimum temperature
82  * @param thigh Maximum temperature
83  * @param pref reference pressure (Pa).
84  * @param coeffs Vector of coefficients used to set the parameters for the
85  * standard state for species n. There are \f$ 2+npoints*2
86  * \f$ coefficients, where \f$ npoints \f$ are the number of
87  * temperature points. Their identity is further broken down:
88  * - coeffs[0] = number of points (integer)
89  * - coeffs[1] = \f$ h^o(298.15 K) \f$ (J/kmol)
90  * - coeffs[2] = \f$ T_1 \f$ (Kelvin)
91  * - coeffs[3] = \f$ \mu^o(T_1) \f$ (J/kmol)
92  * - coeffs[4] = \f$ T_2 \f$ (Kelvin)
93  * - coeffs[5] = \f$ \mu^o(T_2) \f$ (J/kmol)
94  * - coeffs[6] = \f$ T_3 \f$ (Kelvin)
95  * - coeffs[7] = \f$ \mu^o(T_3) \f$ (J/kmol)
96  * - ........
97  * .
98  */
99  Mu0Poly(double tlow, double thigh, double pref, const double* coeffs);
100 
101  virtual int reportType() const {
102  return MU0_INTERP;
103  }
104 
105  /*!
106  * @copydoc SpeciesThermoInterpType::updateProperties
107  *
108  * Temperature Polynomial:
109  * tt[0] = temp (Kelvin)
110  */
111  virtual void updateProperties(const doublereal* tt,
112  doublereal* cp_R, doublereal* h_RT,
113  doublereal* s_R) const;
114 
115  virtual void updatePropertiesTemp(const doublereal temp,
116  doublereal* cp_R,
117  doublereal* h_RT,
118  doublereal* s_R) const;
119  virtual void reportParameters(size_t& n, int& type,
120  doublereal& tlow, doublereal& thigh,
121  doublereal& pref,
122  doublereal* const coeffs) const;
123 
124 protected:
125  //! Number of intervals in the interpolating linear approximation. Number
126  //! of points is one more than the number of intervals.
128 
129  //! Value of the enthalpy at T = 298.15. This value is tied to the Heat of
130  //! formation of the species at 298.15.
131  doublereal m_H298;
132 
133  //! Points at which the standard state chemical potential are given.
135 
136  //! Mu0's are primary input data. They aren't strictly needed, but are kept
137  //! here for convenience.
139 
140  //! Dimensionless Enthalpies at the temperature points
142 
143  //! Entropy at the points
145 
146  //! Heat capacity at the points
148 
149 private:
150  //! process the coefficients
151  /*!
152  * In the constructor, we calculate and store the piecewise linear
153  * approximation to the thermodynamic functions.
154  *
155  * @param coeffs coefficients. These are defined as follows:
156  * - coeffs[0] = number of points (integer)
157  * - coeffs[1] = \f$ h^o(298.15 K) \f$ (J/kmol)
158  * - coeffs[2] = \f$ T_1 \f$ (Kelvin)
159  * - coeffs[3] = \f$ \mu^o(T_1) \f$ (J/kmol)
160  * - coeffs[4] = \f$ T_2 \f$ (Kelvin)
161  * - coeffs[5] = \f$ \mu^o(T_2) \f$ (J/kmol)
162  * - coeffs[6] = \f$ T_3 \f$ (Kelvin)
163  * - coeffs[7] = \f$ \mu^o(T_3) \f$ (J/kmol)
164  * - ........
165  */
166  void processCoeffs(const doublereal* coeffs);
167 };
168 
169 //! Install a Mu0 polynomial thermodynamic reference state
170 /*!
171  * Install a Mu0 polynomial thermodynamic reference state property
172  * parameterization for species k into a MultiSpeciesThermo instance, getting
173  * the information from an XML database.
174  *
175  * @param Mu0Node Pointer to the XML element containing the Mu0 information.
176  *
177  * @ingroup spthermo
178  */
179 Mu0Poly* newMu0ThermoFromXML(const XML_Node& Mu0Node);
180 }
181 
182 #endif
Abstract Base class for the thermodynamic manager for an individual species&#39; reference state...
vector_fp m_s0_R_int
Entropy at the points.
Definition: Mu0Poly.h:144
size_t m_numIntervals
Number of intervals in the interpolating linear approximation.
Definition: Mu0Poly.h:127
Class XML_Node is a tree-based representation of the contents of an XML file.
Definition: xml.h:97
vector_fp m_cp0_R_int
Heat capacity at the points.
Definition: Mu0Poly.h:147
The Mu0Poly class implements an interpolation of the Gibbs free energy based on a piecewise constant ...
Definition: Mu0Poly.h:73
doublereal m_H298
Value of the enthalpy at T = 298.15.
Definition: Mu0Poly.h:131
#define MU0_INTERP
piecewise interpolation of mu0.
Pure Virtual Base class for individual species reference state thermodynamic managers and text for th...
Mu0Poly(double tlow, double thigh, double pref, const double *coeffs)
Normal constructor.
Definition: Mu0Poly.cpp:21
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: Mu0Poly.cpp:48
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: Mu0Poly.cpp:29
vector_fp m_mu0_R_int
Mu0&#39;s are primary input data.
Definition: Mu0Poly.h:138
virtual int reportType() const
Returns an integer representing the type of parameterization.
Definition: Mu0Poly.h:101
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: Mu0Poly.cpp:56
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
vector_fp m_t0_int
Points at which the standard state chemical potential are given.
Definition: Mu0Poly.h:134
vector_fp m_h0_R_int
Dimensionless Enthalpies at the temperature points.
Definition: Mu0Poly.h:141
Namespace for the Cantera kernel.
Definition: AnyMap.cpp:8
Mu0Poly * newMu0ThermoFromXML(const XML_Node &Mu0Node)
Install a Mu0 polynomial thermodynamic reference state.
Definition: Mu0Poly.cpp:76
void processCoeffs(const doublereal *coeffs)
process the coefficients
Definition: Mu0Poly.cpp:137