Cantera  2.5.1
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 https://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  Mu0Poly();
77 
78  //! Constructor with all input data
79  /*!
80  * @param tlow Minimum temperature
81  * @param thigh Maximum temperature
82  * @param pref reference pressure (Pa).
83  * @param coeffs Vector of coefficients used to set the parameters for the
84  * standard state for species n. There are \f$ 2+npoints*2
85  * \f$ coefficients, where \f$ npoints \f$ are the number of
86  * temperature points. Their identity is further broken down:
87  * - coeffs[0] = number of points (integer)
88  * - coeffs[1] = \f$ h^o(298.15 K) \f$ (J/kmol)
89  * - coeffs[2] = \f$ T_1 \f$ (Kelvin)
90  * - coeffs[3] = \f$ \mu^o(T_1) \f$ (J/kmol)
91  * - coeffs[4] = \f$ T_2 \f$ (Kelvin)
92  * - coeffs[5] = \f$ \mu^o(T_2) \f$ (J/kmol)
93  * - coeffs[6] = \f$ T_3 \f$ (Kelvin)
94  * - coeffs[7] = \f$ \mu^o(T_3) \f$ (J/kmol)
95  * - ........
96  * .
97  */
98  Mu0Poly(double tlow, double thigh, double pref, const double* coeffs);
99 
100  //! Set parameters for \f$ \mu^o(T) \f$
101  /*!
102  * Calculates and stores the piecewise linear approximation to the
103  * thermodynamic functions.
104  *
105  * @param h0 Enthalpy at the reference temperature of 298.15 K [J/kmol]
106  * @param T_mu Map with temperature [K] as the keys and the Gibbs free
107  * energy [J/kmol] as the values. Must contain one point at
108  * 298.15 K.
109  */
110  void setParameters(double h0, const std::map<double, double>& T_mu);
111 
112  virtual int reportType() const {
113  return MU0_INTERP;
114  }
115 
116  /*!
117  * @copydoc SpeciesThermoInterpType::updateProperties
118  *
119  * Temperature Polynomial:
120  * tt[0] = temp (Kelvin)
121  */
122  virtual void updateProperties(const doublereal* tt,
123  doublereal* cp_R, doublereal* h_RT,
124  doublereal* s_R) const;
125 
126  virtual void updatePropertiesTemp(const doublereal temp,
127  doublereal* cp_R,
128  doublereal* h_RT,
129  doublereal* s_R) const;
130 
131  virtual size_t nCoeffs() const;
132 
133  virtual void reportParameters(size_t& n, int& type,
134  doublereal& tlow, doublereal& thigh,
135  doublereal& pref,
136  doublereal* const coeffs) const;
137 
138 protected:
139  //! Number of intervals in the interpolating linear approximation. Number
140  //! of points is one more than the number of intervals.
142 
143  //! Value of the enthalpy at T = 298.15. This value is tied to the Heat of
144  //! formation of the species at 298.15.
145  doublereal m_H298;
146 
147  //! Points at which the standard state chemical potential are given.
149 
150  //! Mu0's are primary input data. They aren't strictly needed, but are kept
151  //! here for convenience.
153 
154  //! Dimensionless Enthalpies at the temperature points
156 
157  //! Entropy at the points
159 
160  //! Heat capacity at the points
162 };
163 
164 //! Install a Mu0 polynomial thermodynamic reference state
165 /*!
166  * Install a Mu0 polynomial thermodynamic reference state property
167  * parameterization for species k into a MultiSpeciesThermo instance, getting
168  * the information from an XML database.
169  *
170  * @param Mu0Node Pointer to the XML element containing the Mu0 information.
171  *
172  * @ingroup spthermo
173  *
174  * @deprecated The XML input format is deprecated and will be removed in
175  * Cantera 3.0.
176  */
177 Mu0Poly* newMu0ThermoFromXML(const XML_Node& Mu0Node);
178 }
179 
180 #endif
Pure Virtual Base class for individual species reference state thermodynamic managers and text for th...
The Mu0Poly class implements an interpolation of the Gibbs free energy based on a piecewise constant ...
Definition: Mu0Poly.h:74
doublereal m_H298
Value of the enthalpy at T = 298.15.
Definition: Mu0Poly.h:145
vector_fp m_mu0_R_int
Mu0's are primary input data.
Definition: Mu0Poly.h:152
vector_fp m_cp0_R_int
Heat capacity at the points.
Definition: Mu0Poly.h:161
void setParameters(double h0, const std::map< double, double > &T_mu)
Set parameters for .
Definition: Mu0Poly.cpp:40
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:126
virtual size_t nCoeffs() const
This utility function returns the number of coefficients for a given type of species parameterization...
Definition: Mu0Poly.cpp:134
virtual void reportParameters(size_t &n, int &type, doublereal &tlow, doublereal &thigh, doublereal &pref, doublereal *const coeffs) const
This utility function returns the type of parameterization and all of the parameters for the species.
Definition: Mu0Poly.cpp:139
vector_fp m_s0_R_int
Entropy at the points.
Definition: Mu0Poly.h:158
size_t m_numIntervals
Number of intervals in the interpolating linear approximation.
Definition: Mu0Poly.h:141
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:107
virtual int reportType() const
Returns an integer representing the type of parameterization.
Definition: Mu0Poly.h:112
vector_fp m_t0_int
Points at which the standard state chemical potential are given.
Definition: Mu0Poly.h:148
vector_fp m_h0_R_int
Dimensionless Enthalpies at the temperature points.
Definition: Mu0Poly.h:155
Abstract Base class for the thermodynamic manager for an individual species' reference state.
Class XML_Node is a tree-based representation of the contents of an XML file.
Definition: xml.h:104
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:180
Mu0Poly * newMu0ThermoFromXML(const XML_Node &Mu0Node)
Install a Mu0 polynomial thermodynamic reference state.
Definition: Mu0Poly.cpp:159
Namespace for the Cantera kernel.
Definition: AnyMap.cpp:264
#define MU0_INTERP
piecewise interpolation of mu0.