Cantera  2.1.2
Mu0Poly.h
Go to the documentation of this file.
1 /**
2  * @file Mu0Poly.h
3  * Header for a single-species standard state object derived
5  * on a piecewise constant mu0 interpolation
7  */
8 #ifndef CT_MU0POLY_H
9 #define CT_MU0POLY_H
10
12
13 namespace Cantera
14 {
15 class SpeciesThermo;
16 class XML_Node;
17
18 //! The %Mu0Poly class implements an interpolation of the Gibbs free energy based on a
19 //! piecewise constant heat capacity approximation.
20 /*!
21  * The %Mu0Poly class implements a piecewise constant heat capacity approximation.
22  * of the standard state chemical potential of one
23  * species at a single reference pressure.
24  * The chemical potential is input as a series of (\f$T\f$, \f$\mu^o(T)\f$)
25  * values. The first temperature is assumed to be equal
26  * to 298.15 K; however, this may be relaxed in the future.
27  * This information, and an assumption of a constant
28  * heat capacity within each interval is enough to
29  * calculate all thermodynamic functions.
30  *
31  * The piece-wise constant heat capacity is calculated from the change in the chemical potential over each interval.
32  * Once the heat capacity is known, the other thermodynamic functions may be determined.
33  * The basic equation for going from temperature point 1 to temperature point 2
34  * are as follows for \f$T \f$, \f$T_1 <= T <= T_2 \f$
35  *
36  * \f[
37  * \mu^o(T_1) = h^o(T_1) - T_1 * s^o(T_1)
38  * \f]
39  * \f[
40  * \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)
41  * \f]
42  * \f[
43  * s^o(T_2) = s^o(T_1) + Cp^o(T_1)ln(\frac{T_2}{T_1})
44  * \f]
45  * \f[
46  * h^o(T_2) = h^o(T_1) + Cp^o(T_1)(T_2 - T_1)
47  * \f]
48  *
49  * Within each interval the following relations are used. For \f$T \f$, \f$T_1 <= T <= T_2 \f$
50  *
51  * \f[
52  * \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)
53  * \f]
54  * \f[
55  * s^o(T) = s^o(T_1) + Cp^o(T_1)ln(\frac{T}{T_1})
56  * \f]
57  * \f[
58  * h^o(T) = h^o(T_1) + Cp^o(T_1)(T - T_1)
59  * \f]
60  *
61  * Notes about temperature interpolation for \f$T < T_1 \f$ and \f$T > T_{npoints} \f$.
62  * These are achieved by assuming a constant heat capacity
63  * equal to the value in the closest temperature interval.
64  * No error is thrown.
65  *
66  * @note In the future, a better assumption about the heat
67  * capacity may be employed, so that it can be continuous.
68  *
69  * @ingroup spthermo
70  */
72 {
73 public:
74  //! Constructor
75  Mu0Poly();
76
77  //! Constructor used in templated instantiations
78  /*!
79  * In the constructor, we calculate and store the
80  * piecewise linear approximation to the thermodynamic
81  * functions.
82  *
83  * @param n Species index
84  * @param tlow Minimum temperature
85  * @param thigh Maximum temperature
86  * @param pref reference pressure (Pa).
87  * @param coeffs Vector of coefficients used to set the
88  * parameters for the standard state for species n.
89  * There are \f$2+npoints*2 \f$ coefficients, where
90  * \f$npoints \f$ are the number of temperature points.
91  * Their identity is further broken down:
92  * - coeffs = number of points (integer)
93  * - coeffs = \f$h^o(298.15 K) \f$ (J/kmol)
94  * - coeffs = \f$T_1 \f$ (Kelvin)
95  * - coeffs = \f$\mu^o(T_1) \f$ (J/kmol)
96  * - coeffs = \f$T_2 \f$ (Kelvin)
97  * - coeffs = \f$\mu^o(T_2) \f$ (J/kmol)
98  * - coeffs = \f$T_3 \f$ (Kelvin)
99  * - coeffs = \f$\mu^o(T_3) \f$ (J/kmol)
100  * - ........
101  * .
102  */
103  Mu0Poly(size_t n, doublereal tlow, doublereal thigh,
104  doublereal pref, const doublereal* coeffs);
105
106  //! Copy constructor
107  Mu0Poly(const Mu0Poly&);
108
109  //! Assignment operator
110  Mu0Poly& operator=(const Mu0Poly&);
111
112  virtual SpeciesThermoInterpType*
114
115  virtual int reportType() const {
116  return MU0_INTERP;
117  }
118
119  //! Update the properties for this species, given a temperature polynomial
120  /*!
121  * This method is called with a pointer to an array containing the functions of
122  * temperature needed by this parameterization, and three pointers to arrays where the
123  * computed property values should be written. This method updates only one value in
124  * each array.
125  *
126  * Temperature Polynomial:
127  *
128  * tPoly = temp (Kelvin)
129  *
130  * @param tPoly vector of temperature polynomials. Length = 1
131  * @param cp_R Vector of Dimensionless heat capacities. (length m_kk).
132  * @param h_RT Vector of Dimensionless enthalpies. (length m_kk).
133  * @param s_R Vector of Dimensionless entropies. (length m_kk).
134  */
135  virtual void updateProperties(const doublereal* tPoly,
136  doublereal* cp_R, doublereal* h_RT,
137  doublereal* s_R) const ;
138
139  virtual void updatePropertiesTemp(const doublereal temp,
140  doublereal* cp_R,
141  doublereal* h_RT,
142  doublereal* s_R) const ;
143  //! @deprecated
144  virtual void reportParameters(size_t& n, int& type,
145  doublereal& tlow, doublereal& thigh,
146  doublereal& pref,
147  doublereal* const coeffs) const;
148
149  //! Modify parameters for the standard state
150  /*!
151  * @param coeffs Vector of coefficients used to set the
152  * parameters for the standard state.
153  */
154  virtual void modifyParameters(doublereal* coeffs);
155
156 protected:
157  /**
158  * Number of intervals in the interpolating linear approximation. Number
159  * of points is one more than the number of intervals.
160  */
162
163  /**
164  * Value of the enthalpy at T = 298.15. This value is tied to the Heat of
165  * formation of the species at 298.15.
166  */
167  doublereal m_H298;
168
169  //! Points at which the standard state chemical potential are given.
171
172  /**
173  * Mu0's are primary input data. They aren't strictly
174  * needed, but are kept here for convenience.
175  */
177
178  //! Dimensionless Enthalpies at the temperature points
180
181  //! Entropy at the points
183
184  //! Heat capacity at the points
186
187 private:
188  //! process the coefficients
189  /*!
190  * Mu0Poly():
191  *
192  * In the constructor, we calculate and store the piecewise linear
193  * approximation to the thermodynamic functions.
194  *
195  * @param coeffs coefficients. These are defined as follows:
196  *
197  * coeffs = number of points (integer)
198  * 1 = H298(J/kmol)
199  * 2 = T1 (Kelvin)
200  * 3 = mu1 (J/kmol)
201  * 4 = T2 (Kelvin)
202  * 5 = mu2 (J/kmol)
203  * 6 = T3 (Kelvin)
204  * 7 = mu3 (J/kmol)
205  * ........
206  */
207  void processCoeffs(const doublereal* coeffs);
208 };
209
210 //! Install a Mu0 polynomial thermodynamic reference state
211 /*!
212  * Install a Mu0 polynomial thermodynamic reference state property
213  * parameterization for species k into a SpeciesThermo instance,
214  * getting the information from an XML database.
215  *
216  * @param speciesName Name of the species
217  * @param sp Owning SpeciesThermo object
218  * @param k Species index
219  * @param Mu0Node_ptr Pointer to the XML element containing the
220  * Mu0 information.
221  *
222  * @ingroup spthermo
223  */
224 void installMu0ThermoFromXML(const std::string& speciesName,
225  SpeciesThermo& sp, size_t k,
226  const XML_Node* Mu0Node_ptr);
227 }
228
229 #endif
Pure Virtual Base class for the thermodynamic manager for an individual species' reference state...
vector_fp m_s0_R_int
Entropy at the points.
Definition: Mu0Poly.h:182
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:92
Mu0Poly()
Constructor.
Definition: Mu0Poly.cpp:21
size_t m_numIntervals
Number of intervals in the interpolating linear approximation.
Definition: Mu0Poly.h:161
Class XML_Node is a tree-based representation of the contents of an XML file.
Definition: xml.h:100
vector_fp m_cp0_R_int
Heat capacity at the points.
Definition: Mu0Poly.h:185
The Mu0Poly class implements an interpolation of the Gibbs free energy based on a piecewise constant ...
Definition: Mu0Poly.h:71
virtual int reportType() const
Returns an integer representing the type of parameterization.
Definition: Mu0Poly.h:115
void installMu0ThermoFromXML(const std::string &speciesName, SpeciesThermo &sp, size_t k, const XML_Node *Mu0Node_ptr)
Install a Mu0 polynomial thermodynamic reference state.
Definition: Mu0Poly.cpp:126
Pure Virtual base class for the species thermo manager classes.
doublereal m_H298
Value of the enthalpy at T = 298.15.
Definition: Mu0Poly.h:167
#define MU0_INTERP
piecewise interpolation of mu0.
Pure Virtual Base class for individual species reference state thermodynamic managers and text for th...
virtual void reportParameters(size_t &n, int &type, doublereal &tlow, doublereal &thigh, doublereal &pref, doublereal *const coeffs) const
Definition: Mu0Poly.cpp:100
Mu0Poly & operator=(const Mu0Poly &)
Assignment operator.
Definition: Mu0Poly.cpp:48
virtual SpeciesThermoInterpType * duplMyselfAsSpeciesThermoInterpType() const
duplicator
Definition: Mu0Poly.cpp:64
vector_fp m_mu0_R_int
Mu0's are primary input data.
Definition: Mu0Poly.h:176
virtual void modifyParameters(doublereal *coeffs)
Modify parameters for the standard state.
Definition: Mu0Poly.cpp:121
virtual void updateProperties(const doublereal *tPoly, doublereal *cp_R, doublereal *h_RT, doublereal *s_R) const
Update the properties for this species, given a temperature polynomial.
Definition: Mu0Poly.cpp:70
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:165
vector_fp m_t0_int
Points at which the standard state chemical potential are given.
Definition: Mu0Poly.h:170
vector_fp m_h0_R_int
Dimensionless Enthalpies at the temperature points.
Definition: Mu0Poly.h:179
void processCoeffs(const doublereal *coeffs)
process the coefficients
Definition: Mu0Poly.cpp:212