10 #ifndef CT_SHOMATETHERMO_H
11 #define CT_SHOMATETHERMO_H
147 virtual void install(
const std::string& name,
size_t index,
int type,
151 int imid = int(c[0]);
154 std::vector<ShomatePoly> v;
164 doublereal tmid = c[0];
167 const doublereal* clow = c + 1;
168 const doublereal* chigh = c + 8;
170 refPressure, chigh));
180 if (
m_tlow.size() < index + 1) {
181 m_tlow.resize(index + 1, tlow);
182 m_thigh.resize(index + 1, thigh);
189 }
else if (fabs(
m_p0 - refPressure) > 0.1) {
190 std::string logmsg =
" ERROR ShomateThermo: New Species, " + name
191 +
", has a different reference pressure, "
192 +
fp2str(refPressure) +
", than existing reference pressure, " +
fp2str(
m_p0) +
"\n";
194 logmsg =
" This is now a fatal error\n";
196 throw CanteraError(
"install()",
"Species have different reference pressures");
214 virtual void update_one(
size_t k, doublereal t, doublereal* cp_R,
215 doublereal* h_RT, doublereal* s_R)
const {
216 doublereal tt = 1.e-3*t;
227 const std::vector<ShomatePoly> &mlg =
m_low[grp-1];
230 doublereal tmid = nlow->
maxTemp();
234 const std::vector<ShomatePoly> &mhg =
m_high[grp-1];
240 virtual void update(doublereal t, doublereal* cp_R,
241 doublereal* h_RT, doublereal* s_R)
const {
244 doublereal tt = 1.e-3*t;
253 std::vector<ShomatePoly>::const_iterator _begin, _end;
256 _begin =
m_high[i].begin();
259 _begin =
m_low[i].begin();
260 _end =
m_low[i].end();
262 for (; _begin != _end; ++_begin) {
263 _begin->updateProperties(&
m_t[0], cp_R, h_RT, s_R);
304 const std::vector<ShomatePoly> &mlg =
m_low[grp-1];
305 const std::vector<ShomatePoly> &mhg =
m_high[grp-1];
308 doublereal tmid = lowPoly->
maxTemp();
333 #ifdef H298MODIFY_CAPABILITY
335 virtual doublereal reportOneHf298(
int k)
const {
337 doublereal t = 298.15;
341 const std::vector<ShomatePoly> &mlg =
m_low[grp-1];
344 doublereal tmid = nlow->
maxTemp();
346 h = nlow->reportHf298();
348 const std::vector<ShomatePoly> &mhg =
m_high[grp-1];
349 const ShomatePoly* nhigh = &(mhg[pos]);
350 h = nhigh->reportHf298();
355 virtual void modifyOneHf298(
const int k,
const doublereal Hf298New) {
359 std::vector<ShomatePoly> &mlg =
m_low[grp-1];
360 ShomatePoly* nlow = &(mlg[pos]);
361 std::vector<ShomatePoly> &mhg =
m_high[grp-1];
362 ShomatePoly* nhigh = &(mhg[pos]);
363 doublereal tmid = nlow->maxTemp();
365 double hnow = reportOneHf298(k);
366 double delH = Hf298New - hnow;
367 if (298.15 <= tmid) {
368 nlow->modifyOneHf298(k, Hf298New);
369 double h = nhigh->reportHf298(0);
370 double hnew = h + delH;
371 nhigh->modifyOneHf298(k, hnew);
373 nhigh->modifyOneHf298(k, Hf298New);
374 double h = nlow->reportHf298(0);
375 double hnew = h + delH;
376 nlow->modifyOneHf298(k, hnew);
389 std::vector<std::vector<ShomatePoly> >
m_high;
397 std::vector<std::vector<ShomatePoly> >
m_low;
vector_fp m_tlow
Vector of low temperature limits (species index)
virtual void install(const std::string &name, size_t index, int type, const doublereal *c, doublereal minTemp, doublereal maxTemp, doublereal refPressure)
Install a new species thermodynamic property parameterization for one species using Shomate polynomia...
virtual int reportType(size_t index) const
This utility function reports the type of parameterization used for the species with index number ind...
Pure Virtual Base class for the thermodynamic manager for an individual species' reference state...
const int ID
Initialized to the type of parameterization.
#define SHOMATE
Two regions of Shomate Polynomials.
doublereal m_p0
Reference pressure (Pa)
const size_t npos
index returned by functions to indicate "no position"
virtual void reportParameters(size_t &n, int &type, doublereal &tlow, doublereal &thigh, doublereal &pref, doublereal *const coeffs) const
virtual void updateProperties(const doublereal *tt, doublereal *cp_R, doublereal *h_RT, doublereal *s_R) const
Update the properties for this species, given a temperature polynomial.
std::vector< std::vector< ShomatePoly > > m_low
Vector of vector of NasaPoly1's for the low temp region.
virtual void install_STIT(SpeciesThermoInterpType *stit_ptr)
Install a new species thermodynamic property parameterization for one species.
vector_fp m_t
Vector of temperature polynomials.
doublereal m_tlow_max
Maximum value of the low temperature limit.
void warn_deprecated(const std::string &method, const std::string &extra)
Print a warning indicating that method is deprecated.
virtual void reportParams(size_t index, int &type, doublereal *const c, doublereal &minTemp, doublereal &maxTemp, doublereal &refPressure) const
Pure Virtual base class for the species thermo manager classes.
ShomateThermo(const ShomateThermo &right)
Copy Constructor.
std::map< size_t, size_t > m_posInGroup_map
std::map< size_t, size_t > m_group_map
Contains const definitions for types of species reference-state thermodynamics managers (see Species ...
virtual doublereal maxTemp() const
Returns the maximum temperature that the thermo parameterization is valid.
std::vector< std::vector< ShomatePoly > > m_high
Vector of vector of NasaPoly1's for the high temp region.
doublereal m_thigh_min
Minimum value of the high temperature limit.
std::map< int, int > m_index
Map between the midpoint temperature, as an int, to the group number.
The Shomate polynomial parameterization for one temperature range for one species.
Header for a single-species standard state object derived from SpeciesThermoInterpType based on the S...
ShomateThermo & operator=(const ShomateThermo &right)
Assignment Operator.
std::string fp2str(const double x, const std::string &fmt)
Convert a double into a c++ string.
virtual void update(doublereal t, doublereal *cp_R, doublereal *h_RT, doublereal *s_R) const
Compute the reference-state properties for all species.
Base class for exceptions thrown by Cantera classes.
vector_fp m_thigh
Vector of low temperature limits (species index)
virtual doublereal minTemp(size_t k=npos) const
Minimum temperature.
virtual doublereal refPressure(size_t k=npos) const
The reference-state pressure for species k.
int m_ngroups
number of groups
This file contains descriptions of templated subclasses of the virtual base class, SpeciesThermo, which includes SpeciesThermoDuo (see Managers for Calculating Reference-State Thermodynamics and class SpeciesThermoDuo)
A species thermodynamic property manager for the Shomate polynomial parameterization.
std::vector< double > vector_fp
Turn on the use of stl vectors for the basic array type within cantera Vector of doubles.
virtual doublereal maxTemp(size_t k=npos) const
Maximum temperature.
virtual SpeciesThermo * duplMyselfAsSpeciesThermo() const
Duplication routine for objects derived from SpeciesThermo.
const doublereal GasConstant
Universal Gas Constant. [J/kmol/K].
vector_fp m_tmid
Vector of log temperature limits.
ShomateThermo()
constructor
void writelog(const std::string &msg)
Write a message to the screen.
virtual void update_one(size_t k, doublereal t, doublereal *cp_R, doublereal *h_RT, doublereal *s_R) const
Like update(), but only updates the single species k.
#define SHOMATE1
one region of Shomate Polynomials used in NIST database This is implemented in the NIST database...