Cantera  2.3.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  //! Constructor
77  //! @deprecated Default constructor to be removed after Cantera 2.3.
78  Mu0Poly();
79 
80  //! Normal constructor
81  /*!
82  * In the constructor, we calculate and store the piecewise linear
83  * approximation to the thermodynamic functions.
84  *
85  * @param tlow Minimum temperature
86  * @param thigh Maximum temperature
87  * @param pref reference pressure (Pa).
88  * @param coeffs Vector of coefficients used to set the parameters for the
89  * standard state for species n. There are \f$ 2+npoints*2
90  * \f$ coefficients, where \f$ npoints \f$ are the number of
91  * temperature points. Their identity is further broken down:
92  * - coeffs[0] = number of points (integer)
93  * - coeffs[1] = \f$ h^o(298.15 K) \f$ (J/kmol)
94  * - coeffs[2] = \f$ T_1 \f$ (Kelvin)
95  * - coeffs[3] = \f$ \mu^o(T_1) \f$ (J/kmol)
96  * - coeffs[4] = \f$ T_2 \f$ (Kelvin)
97  * - coeffs[5] = \f$ \mu^o(T_2) \f$ (J/kmol)
98  * - coeffs[6] = \f$ T_3 \f$ (Kelvin)
99  * - coeffs[7] = \f$ \mu^o(T_3) \f$ (J/kmol)
100  * - ........
101  * .
102  */
103  Mu0Poly(double tlow, double thigh, double pref, const double* coeffs);
104 
105  virtual SpeciesThermoInterpType*
107 
108  virtual int reportType() const {
109  return MU0_INTERP;
110  }
111 
112  /*!
113  * @copydoc SpeciesThermoInterpType::updateProperties
114  *
115  * Temperature Polynomial:
116  * tt[0] = temp (Kelvin)
117  */
118  virtual void updateProperties(const doublereal* tt,
119  doublereal* cp_R, doublereal* h_RT,
120  doublereal* s_R) const;
121 
122  virtual void updatePropertiesTemp(const doublereal temp,
123  doublereal* cp_R,
124  doublereal* h_RT,
125  doublereal* s_R) const;
126  virtual void reportParameters(size_t& n, int& type,
127  doublereal& tlow, doublereal& thigh,
128  doublereal& pref,
129  doublereal* const coeffs) const;
130 
131  //! @deprecated To be removed after Cantera 2.3. Use
132  //! MultiSpeciesThermo::modifySpecies instead.
133  virtual void modifyParameters(doublereal* coeffs);
134 
135 protected:
136  //! Number of intervals in the interpolating linear approximation. Number
137  //! of points is one more than the number of intervals.
139 
140  //! Value of the enthalpy at T = 298.15. This value is tied to the Heat of
141  //! formation of the species at 298.15.
142  doublereal m_H298;
143 
144  //! Points at which the standard state chemical potential are given.
146 
147  //! Mu0's are primary input data. They aren't strictly needed, but are kept
148  //! here for convenience.
150 
151  //! Dimensionless Enthalpies at the temperature points
153 
154  //! Entropy at the points
156 
157  //! Heat capacity at the points
159 
160 private:
161  //! process the coefficients
162  /*!
163  * In the constructor, we calculate and store the piecewise linear
164  * approximation to the thermodynamic functions.
165  *
166  * @param coeffs coefficients. These are defined as follows:
167  * - coeffs[0] = number of points (integer)
168  * - coeffs[1] = \f$ h^o(298.15 K) \f$ (J/kmol)
169  * - coeffs[2] = \f$ T_1 \f$ (Kelvin)
170  * - coeffs[3] = \f$ \mu^o(T_1) \f$ (J/kmol)
171  * - coeffs[4] = \f$ T_2 \f$ (Kelvin)
172  * - coeffs[5] = \f$ \mu^o(T_2) \f$ (J/kmol)
173  * - coeffs[6] = \f$ T_3 \f$ (Kelvin)
174  * - coeffs[7] = \f$ \mu^o(T_3) \f$ (J/kmol)
175  * - ........
176  */
177  void processCoeffs(const doublereal* coeffs);
178 };
179 
180 //! Install a Mu0 polynomial thermodynamic reference state
181 /*!
182  * Install a Mu0 polynomial thermodynamic reference state property
183  * parameterization for species k into a MultiSpeciesThermo instance, getting
184  * the information from an XML database.
185  *
186  * @param Mu0Node Pointer to the XML element containing the Mu0 information.
187  *
188  * @ingroup spthermo
189  */
190 Mu0Poly* newMu0ThermoFromXML(const XML_Node& Mu0Node);
191 }
192 
193 #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:155
Mu0Poly()
Constructor.
Definition: Mu0Poly.cpp:20
size_t m_numIntervals
Number of intervals in the interpolating linear approximation.
Definition: Mu0Poly.h:138
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:158
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:142
#define MU0_INTERP
piecewise interpolation of mu0.
Pure Virtual Base class for individual species reference state thermodynamic managers and text for th...
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:59
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:40
vector_fp m_mu0_R_int
Mu0&#39;s are primary input data.
Definition: Mu0Poly.h:149
virtual void modifyParameters(doublereal *coeffs)
Definition: Mu0Poly.cpp:87
virtual int reportType() const
Returns an integer representing the type of parameterization.
Definition: Mu0Poly.h:108
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:67
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:145
virtual SpeciesThermoInterpType * duplMyselfAsSpeciesThermoInterpType() const
Definition: Mu0Poly.cpp:35
vector_fp m_h0_R_int
Dimensionless Enthalpies at the temperature points.
Definition: Mu0Poly.h:152
Namespace for the Cantera kernel.
Definition: application.cpp:29
Mu0Poly * newMu0ThermoFromXML(const XML_Node &Mu0Node)
Install a Mu0 polynomial thermodynamic reference state.
Definition: Mu0Poly.cpp:94
void processCoeffs(const doublereal *coeffs)
process the coefficients
Definition: Mu0Poly.cpp:155