Cantera 2.6.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 https://cantera.org/license.txt for license and copyright information.
11
12#ifndef CT_MU0POLY_H
13#define CT_MU0POLY_H
14
17
18namespace Cantera
19{
20class XML_Node;
21
22//! The Mu0Poly class implements an interpolation of the Gibbs free energy based
23//! on a piecewise constant heat capacity approximation.
24/*!
25 * The Mu0Poly class implements a piecewise constant heat capacity
26 * approximation. of the standard state chemical potential of one species at a
27 * single reference pressure. The chemical potential is input as a series of
28 * (\f$T\f$, \f$ \mu^o(T)\f$) values. The first temperature is assumed to be
29 * equal to 298.15 K; however, this may be relaxed in the future. This
30 * information, and an assumption of a constant heat capacity within each
31 * interval is enough to calculate all thermodynamic functions.
32 *
33 * The piece-wise constant heat capacity is calculated from the change in the
34 * chemical potential over each interval. Once the heat capacity is known, the
35 * other thermodynamic functions may be determined. The basic equation for going
36 * from temperature point 1 to temperature point 2 are as follows for \f$ T \f$,
37 * \f$ T_1 <= T <= T_2 \f$
38 *
39 * \f[
40 * \mu^o(T_1) = h^o(T_1) - T_1 * s^o(T_1)
41 * \f]
42 * \f[
43 * \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)
44 * \f]
45 * \f[
46 * s^o(T_2) = s^o(T_1) + Cp^o(T_1)ln(\frac{T_2}{T_1})
47 * \f]
48 * \f[
49 * h^o(T_2) = h^o(T_1) + Cp^o(T_1)(T_2 - T_1)
50 * \f]
51 *
52 * Within each interval the following relations are used. For \f$ T \f$, \f$
53 * T_1 <= T <= T_2 \f$
54 *
55 * \f[
56 * \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)
57 * \f]
58 * \f[
59 * s^o(T) = s^o(T_1) + Cp^o(T_1)ln(\frac{T}{T_1})
60 * \f]
61 * \f[
62 * h^o(T) = h^o(T_1) + Cp^o(T_1)(T - T_1)
63 * \f]
64 *
65 * Notes about temperature interpolation for \f$ T < T_1 \f$ and \f$ T >
66 * T_{npoints} \f$: These are achieved by assuming a constant heat capacity
67 * equal to the value in the closest temperature interval. No error is thrown.
68 *
69 * @note In the future, a better assumption about the heat capacity may be
70 * employed, so that it can be continuous.
71 *
72 * @ingroup spthermo
73 */
75{
76public:
77 Mu0Poly();
78
79 //! Constructor with all input data
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 //! Set parameters for \f$ \mu^o(T) \f$
102 /*!
103 * Calculates and stores the piecewise linear approximation to the
104 * thermodynamic functions.
105 *
106 * @param h0 Enthalpy at the reference temperature of 298.15 K [J/kmol]
107 * @param T_mu Map with temperature [K] as the keys and the Gibbs free
108 * energy [J/kmol] as the values. Must contain one point at
109 * 298.15 K.
110 */
111 void setParameters(double h0, const std::map<double, double>& T_mu);
112
113 virtual int reportType() const {
114 return MU0_INTERP;
115 }
116
117 /*!
118 * @copydoc SpeciesThermoInterpType::updateProperties
119 *
120 * Temperature Polynomial:
121 * tt[0] = temp (Kelvin)
122 */
123 virtual void updateProperties(const doublereal* tt,
124 doublereal* cp_R, doublereal* h_RT,
125 doublereal* s_R) const;
126
127 virtual void updatePropertiesTemp(const doublereal temp,
128 doublereal* cp_R,
129 doublereal* h_RT,
130 doublereal* s_R) const;
131
132 virtual size_t nCoeffs() const;
133
134 virtual void reportParameters(size_t& n, int& type,
135 doublereal& tlow, doublereal& thigh,
136 doublereal& pref,
137 doublereal* const coeffs) const;
138
139 virtual void getParameters(AnyMap& thermo) const;
140
141protected:
142 //! Number of intervals in the interpolating linear approximation. Number
143 //! of points is one more than the number of intervals.
145
146 //! Value of the enthalpy at T = 298.15. This value is tied to the Heat of
147 //! formation of the species at 298.15.
148 doublereal m_H298;
149
150 //! Points at which the standard state chemical potential are given.
152
153 //! Mu0's are primary input data. They aren't strictly needed, but are kept
154 //! here for convenience.
156
157 //! Dimensionless Enthalpies at the temperature points
159
160 //! Entropy at the points
162
163 //! Heat capacity at the points
165};
166
167//! Install a Mu0 polynomial thermodynamic reference state
168/*!
169 * Install a Mu0 polynomial thermodynamic reference state property
170 * parameterization for species k into a MultiSpeciesThermo instance, getting
171 * the information from an XML database.
172 *
173 * @param Mu0Node Pointer to the XML element containing the Mu0 information.
174 *
175 * @ingroup spthermo
176 *
177 * @deprecated The XML input format is deprecated and will be removed in
178 * Cantera 3.0.
179 */
180Mu0Poly* newMu0ThermoFromXML(const XML_Node& Mu0Node);
181}
182
183#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:399
The Mu0Poly class implements an interpolation of the Gibbs free energy based on a piecewise constant ...
Definition: Mu0Poly.h:75
doublereal m_H298
Value of the enthalpy at T = 298.15.
Definition: Mu0Poly.h:148
vector_fp m_mu0_R_int
Mu0's are primary input data.
Definition: Mu0Poly.h:155
virtual void getParameters(AnyMap &thermo) const
Store the parameters of the species thermo object such that an identical species thermo object could ...
Definition: Mu0Poly.cpp:160
vector_fp m_cp0_R_int
Heat capacity at the points.
Definition: Mu0Poly.h:164
void setParameters(double h0, const std::map< double, double > &T_mu)
Set parameters for .
Definition: Mu0Poly.cpp:41
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:127
virtual size_t nCoeffs() const
This utility function returns the number of coefficients for a given type of species parameterization...
Definition: Mu0Poly.cpp:135
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:140
vector_fp m_s0_R_int
Entropy at the points.
Definition: Mu0Poly.h:161
size_t m_numIntervals
Number of intervals in the interpolating linear approximation.
Definition: Mu0Poly.h:144
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:108
virtual int reportType() const
Returns an integer representing the type of parameterization.
Definition: Mu0Poly.h:113
vector_fp m_t0_int
Points at which the standard state chemical potential are given.
Definition: Mu0Poly.h:151
vector_fp m_h0_R_int
Dimensionless Enthalpies at the temperature points.
Definition: Mu0Poly.h:158
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:103
Mu0Poly * newMu0ThermoFromXML(const XML_Node &Mu0Node)
Install a Mu0 polynomial thermodynamic reference state.
Definition: Mu0Poly.cpp:181
Namespace for the Cantera kernel.
Definition: AnyMap.h:29
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:184
Contains const definitions for types of species reference-state thermodynamics managers (see Species ...
#define MU0_INTERP
piecewise interpolation of mu0.