| Cantera 3.0.0

Loading...
Searching...
No Matches
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
15#include "cantera/thermo/SpeciesThermoInterpType.h"
16#include "cantera/thermo/speciesThermoTypes.h"
17
18 namespace Cantera
19{
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 */
73 class Mu0Poly: public SpeciesThermoInterpType
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 Mu0Poly(double tlow, double thigh, double pref, const double* coeffs);
98
99 //! Set parameters for @f$ \mu^o(T) @f$
100 /*!
101 * Calculates and stores the piecewise linear approximation to the
102 * thermodynamic functions.
103 *
104 * @param h0 Enthalpy at the reference temperature of 298.15 K [J/kmol]
105 * @param T_mu Map with temperature [K] as the keys and the Gibbs free
106 * energy [J/kmol] as the values. Must contain one point at
107 * 298.15 K.
108 */
109 void setParameters(double h0, const map<double, double>& T_mu);
110
111 int reportType() const override {
112 return MU0_INTERP;
113 }
114
115 /**
116 * @copydoc SpeciesThermoInterpType::updateProperties
117 *
118 * Temperature Polynomial:
119 * tt[0] = temp (Kelvin)
120 */
121 void updateProperties(const double* tt, double* cp_R, double* h_RT,
122 double* s_R) const override;
123
124 void updatePropertiesTemp(const double temp, double* cp_R, double* h_RT,
125 double* s_R) const override;
126
127 size_t nCoeffs() const override;
128
129 void reportParameters(size_t& n, int& type, double& tlow, double& thigh,
130 double& pref, double* const coeffs) const override;
131
132 void getParameters(AnyMap& thermo) const override;
133
134 protected:
135 //! Number of intervals in the interpolating linear approximation. Number
136 //! of points is one more than the number of intervals.
137 size_t m_numIntervals = 0;
138
139 //! Value of the enthalpy at T = 298.15. This value is tied to the Heat of
140 //! formation of the species at 298.15.
141 double m_H298 = 0.0;
142
143 //! Points at which the standard state chemical potential are given.
144 vector<double> m_t0_int;
145
146 //! Mu0's are primary input data. They aren't strictly needed, but are kept
147 //! here for convenience.
148 vector<double> m_mu0_R_int;
149
150 //! Dimensionless Enthalpies at the temperature points
151 vector<double> m_h0_R_int;
152
153 //! Entropy at the points
154 vector<double> m_s0_R_int;
155
156 //! Heat capacity at the points
157 vector<double> m_cp0_R_int;
158};
159
160}
161
162#endif
SpeciesThermoInterpType.h
Pure Virtual Base class for individual species reference state thermodynamic managers and text for th...
Cantera::AnyMap
A map of string keys to values whose type can vary at runtime.
Definition AnyMap.h:427
Cantera::Mu0Poly
The Mu0Poly class implements an interpolation of the Gibbs free energy based on a piecewise constant ...
Definition Mu0Poly.h:74
Cantera::Mu0Poly::m_t0_int
vector< double > m_t0_int
Points at which the standard state chemical potential are given.
Definition Mu0Poly.h:144
Cantera::Mu0Poly::reportType
int reportType() const override
Returns an integer representing the type of parameterization.
Definition Mu0Poly.h:111
Cantera::Mu0Poly::m_H298
double m_H298
Value of the enthalpy at T = 298.15.
Definition Mu0Poly.h:141
Cantera::Mu0Poly::getParameters
void getParameters(AnyMap &thermo) const override
Store the parameters of the species thermo object such that an identical species thermo object could ...
Definition Mu0Poly.cpp:152
Cantera::Mu0Poly::m_h0_R_int
vector< double > m_h0_R_int
Dimensionless Enthalpies at the temperature points.
Definition Mu0Poly.h:151
Cantera::Mu0Poly::nCoeffs
size_t nCoeffs() const override
This utility function returns the number of coefficients for a given type of species parameterization...
Definition Mu0Poly.cpp:129
Cantera::Mu0Poly::reportParameters
void reportParameters(size_t &n, int &type, double &tlow, double &thigh, double &pref, double *const coeffs) const override
This utility function returns the type of parameterization and all of the parameters for the species.
Definition Mu0Poly.cpp:134
Cantera::Mu0Poly::m_cp0_R_int
vector< double > m_cp0_R_int
Heat capacity at the points.
Definition Mu0Poly.h:157
Cantera::Mu0Poly::m_numIntervals
size_t m_numIntervals
Number of intervals in the interpolating linear approximation.
Definition Mu0Poly.h:137
Cantera::Mu0Poly::m_s0_R_int
vector< double > m_s0_R_int
Entropy at the points.
Definition Mu0Poly.h:154
Cantera::Mu0Poly::updateProperties
void updateProperties(const double *tt, double *cp_R, double *h_RT, double *s_R) const override
Update the properties for this species, given a temperature polynomial.
Definition Mu0Poly.cpp:102
Cantera::Mu0Poly::setParameters
void setParameters(double h0, const map< double, double > &T_mu)
Set parameters for .
Definition Mu0Poly.cpp:36
Cantera::Mu0Poly::m_mu0_R_int
vector< double > m_mu0_R_int
Mu0's are primary input data.
Definition Mu0Poly.h:148
Cantera::Mu0Poly::updatePropertiesTemp
void updatePropertiesTemp(const double temp, double *cp_R, double *h_RT, double *s_R) const override
Compute the reference-state property of one species.
Definition Mu0Poly.cpp:121
Cantera::SpeciesThermoInterpType
Abstract Base class for the thermodynamic manager for an individual species' reference state.
Definition SpeciesThermoInterpType.h:113
Cantera
Namespace for the Cantera kernel.
Definition AnyMap.cpp:564
speciesThermoTypes.h
Contains const definitions for types of species reference-state thermodynamics managers (see Species ...
MU0_INTERP
#define MU0_INTERP
piecewise interpolation of mu0.
Definition speciesThermoTypes.h:41