Cantera  3.1.0b1
Loading...
Searching...
No Matches

The Mu0Poly class implements an interpolation of the Gibbs free energy based on a piecewise constant heat capacity approximation. More...

#include <Mu0Poly.h>

Inheritance diagram for Mu0Poly:
[legend]

Detailed Description

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.

Note
In the future, a better assumption about the heat capacity may be employed, so that it can be continuous.

Definition at line 73 of file Mu0Poly.h.

Public Member Functions

 Mu0Poly (double tlow, double thigh, double pref, const double *coeffs)
 Constructor with all input data.
 
void setParameters (double h0, const map< double, double > &T_mu)
 Set parameters for \( \mu^o(T) \).
 
int reportType () const override
 Returns an integer representing the type of parameterization.
 
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.
 
void updatePropertiesTemp (const double temp, double *cp_R, double *h_RT, double *s_R) const override
 Compute the reference-state property of one species.
 
size_t nCoeffs () const override
 This utility function returns the number of coefficients for a given type of species parameterization.
 
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.
 
void getParameters (AnyMap &thermo) const override
 Store the parameters of the species thermo object such that an identical species thermo object could be reconstructed using the newSpeciesThermo() function.
 
- Public Member Functions inherited from SpeciesThermoInterpType
 SpeciesThermoInterpType (double tlow, double thigh, double pref)
 
 SpeciesThermoInterpType (const SpeciesThermoInterpType &b)=delete
 
SpeciesThermoInterpTypeoperator= (const SpeciesThermoInterpType &b)=delete
 
virtual double minTemp () const
 Returns the minimum temperature that the thermo parameterization is valid.
 
virtual void setMinTemp (double Tmin)
 Set the minimum temperature at which the thermo parameterization is valid.
 
virtual double maxTemp () const
 Returns the maximum temperature that the thermo parameterization is valid.
 
virtual void setMaxTemp (double Tmax)
 Set the maximum temperature at which the thermo parameterization is valid.
 
virtual double refPressure () const
 Returns the reference pressure (Pa)
 
virtual void setRefPressure (double Pref)
 Set the reference pressure [Pa].
 
virtual void validate (const string &name)
 Check for problems with the parameterization, and generate warnings or throw and exception if any are found.
 
virtual int reportType () const
 Returns an integer representing the type of parameterization.
 
virtual size_t temperaturePolySize () const
 Number of terms in the temperature polynomial for this parameterization.
 
virtual void updateTemperaturePoly (double T, double *T_poly) const
 Given the temperature T, compute the terms of the temperature polynomial T_poly.
 
virtual void updateProperties (const double *tt, double *cp_R, double *h_RT, double *s_R) const
 Update the properties for this species, given a temperature polynomial.
 
virtual void updatePropertiesTemp (const double temp, double *cp_R, double *h_RT, double *s_R) const
 Compute the reference-state property of one species.
 
virtual size_t nCoeffs () const
 This utility function returns the number of coefficients for a given type of species parameterization.
 
virtual void reportParameters (size_t &index, int &type, double &minTemp, double &maxTemp, double &refPressure, double *const coeffs) const
 This utility function returns the type of parameterization and all of the parameters for the species.
 
AnyMap parameters (bool withInput=true) const
 Return the parameters of the species thermo object such that an identical species thermo object could be reconstructed using the newSpeciesThermo() function.
 
virtual double reportHf298 (double *const h298=0) const
 Report the 298 K Heat of Formation of the standard state of one species (J kmol-1)
 
virtual void modifyOneHf298 (const size_t k, const double Hf298New)
 Modify the value of the 298 K Heat of Formation of one species in the phase (J kmol-1)
 
virtual void resetHf298 ()
 Restore the original heat of formation for this species.
 
const AnyMapinput () const
 Access input data associated with the species thermo definition.
 
AnyMapinput ()
 

Protected Attributes

size_t m_numIntervals = 0
 Number of intervals in the interpolating linear approximation.
 
double m_H298 = 0.0
 Value of the enthalpy at T = 298.15.
 
vector< double > m_t0_int
 Points at which the standard state chemical potential are given.
 
vector< double > m_mu0_R_int
 Mu0's are primary input data.
 
vector< double > m_h0_R_int
 Dimensionless Enthalpies at the temperature points.
 
vector< double > m_s0_R_int
 Entropy at the points.
 
vector< double > m_cp0_R_int
 Heat capacity at the points.
 
- Protected Attributes inherited from SpeciesThermoInterpType
double m_lowT = 0.0
 lowest valid temperature
 
double m_highT = 0.0
 Highest valid temperature.
 
double m_Pref = 0.0
 Reference state pressure.
 
AnyMap m_input
 

Additional Inherited Members

virtual void getParameters (AnyMap &thermo) const
 Store the parameters of the species thermo object such that an identical species thermo object could be reconstructed using the newSpeciesThermo() function.
 

Constructor & Destructor Documentation

◆ Mu0Poly() [1/2]

Mu0Poly ( )

Definition at line 18 of file Mu0Poly.cpp.

◆ Mu0Poly() [2/2]

Mu0Poly ( double  tlow,
double  thigh,
double  pref,
const double *  coeffs 
)

Constructor with all input data.

Parameters
tlowMinimum temperature
thighMaximum temperature
prefreference pressure (Pa).
coeffsVector 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:
  • coeffs[0] = number of points (integer)
  • coeffs[1] = \( h^o(298.15 K) \) (J/kmol)
  • coeffs[2] = \( T_1 \) (Kelvin)
  • coeffs[3] = \( \mu^o(T_1) \) (J/kmol)
  • coeffs[4] = \( T_2 \) (Kelvin)
  • coeffs[5] = \( \mu^o(T_2) \) (J/kmol)
  • coeffs[6] = \( T_3 \) (Kelvin)
  • coeffs[7] = \( \mu^o(T_3) \) (J/kmol)
  • ........

Definition at line 23 of file Mu0Poly.cpp.

Member Function Documentation

◆ setParameters()

void setParameters ( double  h0,
const map< double, double > &  T_mu 
)

Set parameters for \( \mu^o(T) \).

Calculates and stores the piecewise linear approximation to the thermodynamic functions.

Parameters
h0Enthalpy at the reference temperature of 298.15 K [J/kmol]
T_muMap with temperature [K] as the keys and the Gibbs free energy [J/kmol] as the values. Must contain one point at 298.15 K.

Definition at line 36 of file Mu0Poly.cpp.

◆ reportType()

int reportType ( ) const
inlineoverridevirtual

Returns an integer representing the type of parameterization.

Reimplemented from SpeciesThermoInterpType.

Definition at line 111 of file Mu0Poly.h.

◆ updateProperties()

void updateProperties ( const double *  tt,
double *  cp_R,
double *  h_RT,
double *  s_R 
) const
overridevirtual

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.

The form and length of the Temperature Polynomial may vary depending on the parameterization.

Parameters
ttvector of evaluated temperature functions
cp_RVector of Dimensionless heat capacities. (length m_kk).
h_RTVector of Dimensionless enthalpies. (length m_kk).
s_RVector of Dimensionless entropies. (length m_kk).

Temperature Polynomial: tt[0] = temp (Kelvin)

Reimplemented from SpeciesThermoInterpType.

Definition at line 102 of file Mu0Poly.cpp.

◆ updatePropertiesTemp()

void updatePropertiesTemp ( const double  temp,
double *  cp_R,
double *  h_RT,
double *  s_R 
) const
overridevirtual

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, of the species.

Parameters
tempTemperature (Kelvin)
cp_RVector of Dimensionless heat capacities. (length m_kk).
h_RTVector of Dimensionless enthalpies. (length m_kk).
s_RVector of Dimensionless entropies. (length m_kk).

Reimplemented from SpeciesThermoInterpType.

Definition at line 121 of file Mu0Poly.cpp.

◆ nCoeffs()

size_t nCoeffs ( ) const
overridevirtual

This utility function returns the number of coefficients for a given type of species parameterization.

Reimplemented from SpeciesThermoInterpType.

Definition at line 129 of file Mu0Poly.cpp.

◆ reportParameters()

void reportParameters ( size_t &  index,
int &  type,
double &  minTemp,
double &  maxTemp,
double &  refPressure,
double *const  coeffs 
) const
overridevirtual

This utility function returns the type of parameterization and all of the parameters for the species.

All parameters are output variables

Parameters
indexSpecies index
typeInteger type of the standard type
minTempoutput - Minimum temperature
maxTempoutput - Maximum temperature
refPressureoutput - reference pressure (Pa).
coeffsVector of coefficients used to set the parameters for the standard state.

Reimplemented from SpeciesThermoInterpType.

Definition at line 134 of file Mu0Poly.cpp.

◆ getParameters()

void getParameters ( AnyMap thermo) const
overridevirtual

Store the parameters of the species thermo object such that an identical species thermo object could be reconstructed using the newSpeciesThermo() function.

Reimplemented from SpeciesThermoInterpType.

Definition at line 152 of file Mu0Poly.cpp.

Member Data Documentation

◆ m_numIntervals

size_t m_numIntervals = 0
protected

Number of intervals in the interpolating linear approximation.

Number of points is one more than the number of intervals.

Definition at line 137 of file Mu0Poly.h.

◆ m_H298

double m_H298 = 0.0
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 141 of file Mu0Poly.h.

◆ m_t0_int

vector<double> m_t0_int
protected

Points at which the standard state chemical potential are given.

Definition at line 144 of file Mu0Poly.h.

◆ m_mu0_R_int

vector<double> m_mu0_R_int
protected

Mu0's are primary input data.

They aren't strictly needed, but are kept here for convenience.

Definition at line 148 of file Mu0Poly.h.

◆ m_h0_R_int

vector<double> m_h0_R_int
protected

Dimensionless Enthalpies at the temperature points.

Definition at line 151 of file Mu0Poly.h.

◆ m_s0_R_int

vector<double> m_s0_R_int
protected

Entropy at the points.

Definition at line 154 of file Mu0Poly.h.

◆ m_cp0_R_int

vector<double> m_cp0_R_int
protected

Heat capacity at the points.

Definition at line 157 of file Mu0Poly.h.


The documentation for this class was generated from the following files: