14#ifndef CT_SHOMATEPOLY1_H
15#define CT_SHOMATEPOLY1_H
74 ShomatePoly(
double tlow,
double thigh,
double pref,
const double* coeffs) :
78 for (
size_t i = 0; i < 7; i++) {
87 if (coeffs.size() != 7) {
88 throw CanteraError(
"ShomatePoly::setParameters",
"Array must "
89 "contain 7 coefficients, but {} were given.", coeffs.size());
91 for (
size_t i = 0; i < 7; i++) {
107 T_poly[2] = T_poly[1] * tt;
108 T_poly[3] = 1.0/T_poly[1];
109 T_poly[4] = std::log(tt);
126 double* s_R)
const override {
131 double Etm2 =
m_coeff[4]*tt[3];
132 double Ftm1 =
m_coeff[5]*tt[5];
135 *cp_R = A + Bt + Ct2 + Dt3 + Etm2;
136 *h_RT = A + 0.5*Bt + 1.0/3.0*Ct2 + 0.25*Dt3 - Etm2 + Ftm1;
137 *s_R = A*tt[4] + Bt + 0.5*Ct2 + 1.0/3.0*Dt3 - 0.5*Etm2 + G;
141 double* s_R)
const override {
148 double& pref,
double*
const coeffs)
const override {
154 for (
int i = 0; i < 7; i++) {
162 vector<double> dimensioned_coeffs(
m_coeff.size());
163 for (
size_t i = 0; i <
m_coeff.size(); i++) {
166 thermo[
"data"].asVector<vector<double>>().push_back(dimensioned_coeffs);
170 double cp_R, h_RT, s_R;
177 double delH = Hf298New - hnow;
188 double m_coeff5_orig;
245 ShomatePoly2(
double tlow,
double thigh,
double pref,
const double* coeffs) :
248 msp_low(tlow, coeffs[0], pref, coeffs+1),
249 msp_high(coeffs[0], thigh, pref, coeffs+8)
275 void setParameters(
double Tmid,
const vector<double>& low,
const vector<double>& high) {
295 double* s_R)
const override {
296 double T = 1000 * tt[0];
305 double* s_R)
const override {
313 size_t nCoeffs()
const override {
return 15; }
316 double& pref,
double*
const coeffs)
const override {
324 thermo[
"model"] =
"Shomate";
326 thermo[
"temperature-ranges"].setQuantity(Tranges,
"K");
327 thermo[
"data"] = vector<vector<double>>();
347 double delH = Hf298New - h298now;
349 double hnew = h + delH;
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.
Base class for exceptions thrown by Cantera classes.
The Shomate polynomial parameterization for two temperature ranges for one species.
void setMinTemp(double Tmin) override
Set the minimum temperature at which the thermo parameterization is valid.
int reportType() const override
Returns an integer representing the type of parameterization.
ShomatePoly msp_low
Shomate polynomial for the low temperature region.
size_t temperaturePolySize() const override
Number of terms in the temperature polynomial for this parameterization.
void getParameters(AnyMap &thermo) const override
Store the parameters of the species thermo object such that an identical species thermo object could ...
size_t nCoeffs() const override
This utility function returns the number of coefficients for a given type of species parameterization...
void updateTemperaturePoly(double T, double *T_poly) const override
Given the temperature T, compute the terms of the temperature polynomial T_poly.
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 setParameters(double Tmid, const vector< double > &low, const vector< double > &high)
ShomatePoly2(double tlow, double thigh, double pref, const double *coeffs)
Constructor with all input data.
void setRefPressure(double Pref) override
Set the reference pressure [Pa].
ShomatePoly msp_high
Shomate polynomial for the high temperature region.
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.
double reportHf298(double *const h298=nullptr) const override
Report the 298 K Heat of Formation of the standard state of one species (J kmol-1)
void resetHf298() override
Restore the original heat of formation for this species.
void setMaxTemp(double Tmax) override
Set the maximum temperature at which the thermo parameterization is valid.
double m_midT
Midrange temperature (kelvin)
void modifyOneHf298(const size_t k, const double Hf298New) override
Modify the value of the 298 K Heat of Formation of one species in the phase (J kmol-1)
void updatePropertiesTemp(const double temp, double *cp_R, double *h_RT, double *s_R) const override
Compute the reference-state property of one species.
The Shomate polynomial parameterization for one temperature range for one species.
vector< double > m_coeff
Array of coefficients.
int reportType() const override
Returns an integer representing the type of parameterization.
void setParameters(const vector< double > &coeffs)
Set array of 7 polynomial coefficients.
size_t temperaturePolySize() const override
Number of terms in the temperature polynomial for this parameterization.
void getParameters(AnyMap &thermo) const override
Store the parameters of the species thermo object such that an identical species thermo object could ...
void updateTemperaturePoly(double T, double *T_poly) const override
Given the temperature T, compute the terms of the temperature polynomial T_poly.
ShomatePoly(double tlow, double thigh, double pref, const double *coeffs)
Constructor with all input data.
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 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.
double reportHf298(double *const h298=nullptr) const override
Report the 298 K Heat of Formation of the standard state of one species (J kmol-1)
void resetHf298() override
Restore the original heat of formation for this species.
void modifyOneHf298(const size_t k, const double Hf298New) override
Modify the value of the 298 K Heat of Formation of one species in the phase (J kmol-1)
void updatePropertiesTemp(const double temp, double *cp_R, double *h_RT, double *s_R) const override
Compute the reference-state property of one species.
Abstract Base class for the thermodynamic manager for an individual species' reference state.
double m_Pref
Reference state pressure.
virtual void setRefPressure(double Pref)
Set the reference pressure [Pa].
virtual void getParameters(AnyMap &thermo) const
Store the parameters of the species thermo object such that an identical species thermo object could ...
double m_lowT
lowest valid temperature
virtual void setMinTemp(double Tmin)
Set the minimum temperature at which the thermo parameterization is valid.
double m_highT
Highest valid temperature.
virtual void setMaxTemp(double Tmax)
Set the maximum temperature at which the thermo parameterization is valid.
const double GasConstant
Universal Gas Constant [J/kmol/K].
Namespace for the Cantera kernel.
#define SHOMATE
Two regions of Shomate Polynomials.
#define SHOMATE2
Two regions of Shomate Polynomials.