Cantera
2.2.1
|
The Mu0Poly class implements an interpolation of the Gibbs free energy based on a piecewise constant heat capacity approximation. More...
#include <Mu0Poly.h>
Public Member Functions | |
Mu0Poly () | |
Constructor. More... | |
Mu0Poly (size_t n, doublereal tlow, doublereal thigh, doublereal pref, const doublereal *coeffs) | |
Constructor used in templated instantiations. More... | |
Mu0Poly (double tlow, double thigh, double pref, const double *coeffs) | |
Normal constructor. More... | |
Mu0Poly (const Mu0Poly &) | |
Copy constructor. More... | |
Mu0Poly & | operator= (const Mu0Poly &) |
Assignment operator. More... | |
virtual SpeciesThermoInterpType * | duplMyselfAsSpeciesThermoInterpType () const |
virtual int | reportType () const |
Returns an integer representing the type of parameterization. More... | |
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. More... | |
virtual void | updatePropertiesTemp (const doublereal temp, doublereal *cp_R, doublereal *h_RT, doublereal *s_R) const |
Compute the reference-state property of one species. More... | |
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 species, index. More... | |
virtual void | modifyParameters (doublereal *coeffs) |
Modify parameters for the standard state. More... | |
Public Member Functions inherited from SpeciesThermoInterpType | |
SpeciesThermoInterpType (size_t n, doublereal tlow, doublereal thigh, doublereal pref) | |
SpeciesThermoInterpType (double tlow, double thigh, double pref) | |
SpeciesThermoInterpType (const SpeciesThermoInterpType &b) | |
virtual doublereal | minTemp () const |
Returns the minimum temperature that the thermo parameterization is valid. More... | |
virtual doublereal | maxTemp () const |
Returns the maximum temperature that the thermo parameterization is valid. More... | |
virtual doublereal | refPressure () const |
Returns the reference pressure (Pa) More... | |
virtual void | validate (const std::string &name) |
Check for problems with the parameterization, and generate warnings or throw and exception if any are found. More... | |
virtual size_t | speciesIndex () const |
Returns an integer representing the species index. More... | |
virtual void | setIndex (size_t index) |
virtual size_t | temperaturePolySize () const |
Number of terms in the temperature polynomial for this parameterization. More... | |
virtual void | updateTemperaturePoly (double T, double *T_poly) const |
Given the temperature T, compute the terms of the temperature polynomial T_poly. More... | |
virtual doublereal | reportHf298 (doublereal *const h298=0) const |
Report the 298 K Heat of Formation of the standard state of one species (J kmol-1) More... | |
virtual void | modifyOneHf298 (const size_t k, const doublereal Hf298New) |
Modify the value of the 298 K Heat of Formation of one species in the phase (J kmol-1) More... | |
Protected Attributes | |
size_t | m_numIntervals |
Number of intervals in the interpolating linear approximation. More... | |
doublereal | m_H298 |
Value of the enthalpy at T = 298.15. More... | |
vector_fp | m_t0_int |
Points at which the standard state chemical potential are given. More... | |
vector_fp | m_mu0_R_int |
Mu0's are primary input data. More... | |
vector_fp | m_h0_R_int |
Dimensionless Enthalpies at the temperature points. More... | |
vector_fp | m_s0_R_int |
Entropy at the points. More... | |
vector_fp | m_cp0_R_int |
Heat capacity at the points. More... | |
Protected Attributes inherited from SpeciesThermoInterpType | |
doublereal | m_lowT |
lowest valid temperature More... | |
doublereal | m_highT |
Highest valid temperature. More... | |
doublereal | m_Pref |
Reference state pressure. More... | |
size_t | m_index |
species index More... | |
Private Member Functions | |
void | processCoeffs (const doublereal *coeffs) |
process the coefficients More... | |
The Mu0Poly class implements an interpolation of the Gibbs free energy based on a piecewise constant heat capacity approximation.
The Mu0Poly class implements a piecewise constant heat capacity approximation. of the standard state chemical potential of one species at a single reference pressure. The chemical potential is input as a series of ( \(T\), \( \mu^o(T)\)) values. The first temperature is assumed to be equal to 298.15 K; however, this may be relaxed in the future. This information, and an assumption of a constant heat capacity within each interval is enough to calculate all thermodynamic functions.
The piece-wise constant heat capacity is calculated from the change in the chemical potential over each interval. Once the heat capacity is known, the other thermodynamic functions may be determined. The basic equation for going from temperature point 1 to temperature point 2 are as follows for \( T \), \( T_1 <= T <= T_2 \)
\[ \mu^o(T_1) = h^o(T_1) - T_1 * s^o(T_1) \]
\[ \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) \]
\[ s^o(T_2) = s^o(T_1) + Cp^o(T_1)ln(\frac{T_2}{T_1}) \]
\[ h^o(T_2) = h^o(T_1) + Cp^o(T_1)(T_2 - T_1) \]
Within each interval the following relations are used. For \( T \), \( T_1 <= T <= T_2 \)
\[ \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) \]
\[ s^o(T) = s^o(T_1) + Cp^o(T_1)ln(\frac{T}{T_1}) \]
\[ h^o(T) = h^o(T_1) + Cp^o(T_1)(T - T_1) \]
Notes about temperature interpolation for \( T < T_1 \) and \( T > T_{npoints} \). These are achieved by assuming a constant heat capacity equal to the value in the closest temperature interval. No error is thrown.
Mu0Poly | ( | ) |
Constructor.
Definition at line 17 of file Mu0Poly.cpp.
Mu0Poly | ( | size_t | n, |
doublereal | tlow, | ||
doublereal | thigh, | ||
doublereal | pref, | ||
const doublereal * | coeffs | ||
) |
Constructor used in templated instantiations.
In the constructor, we calculate and store the piecewise linear approximation to the thermodynamic functions.
n | Species index |
tlow | Minimum temperature |
thigh | Maximum temperature |
pref | reference pressure (Pa). |
coeffs | Vector of coefficients used to set the parameters for the standard state for species n. There are \( 2+npoints*2 \) coefficients, where \( npoints \) are the number of temperature points. Their identity is further broken down:
|
Definition at line 22 of file Mu0Poly.cpp.
References Mu0Poly::processCoeffs().
Mu0Poly | ( | double | tlow, |
double | thigh, | ||
double | pref, | ||
const double * | coeffs | ||
) |
Normal constructor.
In the constructor, we calculate and store the piecewise linear approximation to the thermodynamic functions.
tlow | Minimum temperature |
thigh | Maximum temperature |
pref | reference pressure (Pa). |
coeffs | Vector of coefficients used to set the parameters for the standard state for species n. There are \( 2+npoints*2 \) coefficients, where \( npoints \) are the number of temperature points. Their identity is further broken down:
|
Definition at line 32 of file Mu0Poly.cpp.
References Mu0Poly::processCoeffs().
Copy constructor.
Definition at line 40 of file Mu0Poly.cpp.
Assignment operator.
Definition at line 52 of file Mu0Poly.cpp.
References Mu0Poly::m_cp0_R_int, Mu0Poly::m_h0_R_int, Mu0Poly::m_H298, Mu0Poly::m_mu0_R_int, Mu0Poly::m_numIntervals, Mu0Poly::m_s0_R_int, and Mu0Poly::m_t0_int.
|
inlinevirtual |
Returns an integer representing the type of parameterization.
Implements SpeciesThermoInterpType.
Definition at line 143 of file Mu0Poly.h.
References MU0_INTERP.
|
virtual |
Update the properties for this species, given a temperature polynomial.
This method is called with a pointer to an array containing the functions of temperature needed by this parameterization, and three pointers to arrays where the computed property values should be written. This method updates only one value in each array.
Temperature Polynomial:
tPoly[0] = temp (Kelvin)
tPoly | vector of temperature polynomials. Length = 1 |
cp_R | Vector of Dimensionless heat capacities. (length m_kk). |
h_RT | Vector of Dimensionless enthalpies. (length m_kk). |
s_R | Vector of Dimensionless entropies. (length m_kk). |
Reimplemented from SpeciesThermoInterpType.
Definition at line 73 of file Mu0Poly.cpp.
References Mu0Poly::m_cp0_R_int, Mu0Poly::m_h0_R_int, SpeciesThermoInterpType::m_index, Mu0Poly::m_numIntervals, Mu0Poly::m_s0_R_int, and Mu0Poly::m_t0_int.
Referenced by Mu0Poly::updatePropertiesTemp().
|
virtual |
Compute the reference-state property of one species.
Given temperature T in K, this method updates the values of the non-dimensional heat capacity at constant pressure, enthalpy, and entropy, at the reference pressure, Pref of one of the species. The species index is used to reference into the cp_R, h_RT, and s_R arrays.
temp | Temperature (Kelvin) |
cp_R | Vector of Dimensionless heat capacities. (length m_kk). |
h_RT | Vector of Dimensionless enthalpies. (length m_kk). |
s_R | Vector of Dimensionless entropies. (length m_kk). |
Implements SpeciesThermoInterpType.
Definition at line 92 of file Mu0Poly.cpp.
References Mu0Poly::updateProperties().
|
virtual |
This utility function reports back the type of parameterization and all of the parameters for the species, index.
All parameters are output variables
index | Species index |
type | Integer type of the standard type |
minTemp | output - Minimum temperature |
maxTemp | output - Maximum temperature |
refPressure | output - reference pressure (Pa). |
coeffs | Vector of coefficients used to set the parameters for the standard state. |
Implements SpeciesThermoInterpType.
Definition at line 100 of file Mu0Poly.cpp.
References Cantera::GasConstant, Mu0Poly::m_H298, SpeciesThermoInterpType::m_highT, SpeciesThermoInterpType::m_index, SpeciesThermoInterpType::m_lowT, Mu0Poly::m_mu0_R_int, Mu0Poly::m_numIntervals, SpeciesThermoInterpType::m_Pref, Mu0Poly::m_t0_int, and MU0_INTERP.
|
virtual |
Modify parameters for the standard state.
coeffs | Vector of coefficients used to set the parameters for the standard state. |
Reimplemented from SpeciesThermoInterpType.
Definition at line 120 of file Mu0Poly.cpp.
References Mu0Poly::processCoeffs().
|
private |
process the coefficients
In the constructor, we calculate and store the piecewise linear approximation to the thermodynamic functions.
coeffs | coefficients. These are defined as follows: |
coeffs[0] = number of points (integer) 1 = H298(J/kmol) 2 = T1 (Kelvin) 3 = mu1 (J/kmol) 4 = T2 (Kelvin) 5 = mu2 (J/kmol) 6 = T3 (Kelvin) 7 = mu3 (J/kmol) ........
Definition at line 191 of file Mu0Poly.cpp.
References Cantera::GasConstant, Mu0Poly::m_cp0_R_int, Mu0Poly::m_h0_R_int, Mu0Poly::m_H298, Mu0Poly::m_mu0_R_int, Mu0Poly::m_numIntervals, Mu0Poly::m_s0_R_int, Mu0Poly::m_t0_int, and Cantera::npos.
Referenced by Mu0Poly::modifyParameters(), and Mu0Poly::Mu0Poly().
|
protected |
Number of intervals in the interpolating linear approximation.
Number of points is one more than the number of intervals.
Definition at line 188 of file Mu0Poly.h.
Referenced by Mu0Poly::operator=(), Mu0Poly::processCoeffs(), Mu0Poly::reportParameters(), and Mu0Poly::updateProperties().
|
protected |
Value of the enthalpy at T = 298.15.
This value is tied to the Heat of formation of the species at 298.15.
Definition at line 194 of file Mu0Poly.h.
Referenced by Mu0Poly::operator=(), Mu0Poly::processCoeffs(), and Mu0Poly::reportParameters().
|
protected |
Points at which the standard state chemical potential are given.
Definition at line 197 of file Mu0Poly.h.
Referenced by Mu0Poly::operator=(), Mu0Poly::processCoeffs(), Mu0Poly::reportParameters(), and Mu0Poly::updateProperties().
|
protected |
Mu0's are primary input data.
They aren't strictly needed, but are kept here for convenience.
Definition at line 203 of file Mu0Poly.h.
Referenced by Mu0Poly::operator=(), Mu0Poly::processCoeffs(), and Mu0Poly::reportParameters().
|
protected |
Dimensionless Enthalpies at the temperature points.
Definition at line 206 of file Mu0Poly.h.
Referenced by Mu0Poly::operator=(), Mu0Poly::processCoeffs(), and Mu0Poly::updateProperties().
|
protected |
Entropy at the points.
Definition at line 209 of file Mu0Poly.h.
Referenced by Mu0Poly::operator=(), Mu0Poly::processCoeffs(), and Mu0Poly::updateProperties().
|
protected |
Heat capacity at the points.
Definition at line 212 of file Mu0Poly.h.
Referenced by Mu0Poly::operator=(), Mu0Poly::processCoeffs(), and Mu0Poly::updateProperties().