11 #ifndef CT_SHOMATETHERMO_H
12 #define CT_SHOMATETHERMO_H
104 if (&right ==
this) {
166 virtual void install(std::string name,
size_t index,
int type,
170 int imid = int(c[0]);
173 std::vector<ShomatePoly> v;
183 doublereal tmid = c[0];
186 const doublereal* clow = c + 1;
187 const doublereal* chigh = c + 8;
189 refPressure, chigh));
199 if (
m_tlow.size() < index + 1) {
200 m_tlow.resize(index + 1, tlow);
201 m_thigh.resize(index + 1, thigh);
208 }
else if (fabs(
m_p0 - refPressure) > 0.1) {
209 std::string logmsg =
" ERROR ShomateThermo: New Species, " + name
210 +
", has a different reference pressure, "
211 +
fp2str(refPressure) +
", than existing reference pressure, " +
fp2str(
m_p0) +
"\n";
213 logmsg =
" This is now a fatal error\n";
215 throw CanteraError(
"install()",
"Species have different reference pressures");
242 virtual void update_one(
size_t k, doublereal t, doublereal* cp_R,
243 doublereal* h_RT, doublereal* s_R)
const {
245 doublereal tt = 1.e-3*t;
256 const std::vector<ShomatePoly> &mlg =
m_low[grp-1];
259 doublereal tmid = nlow->
maxTemp();
263 const std::vector<ShomatePoly> &mhg =
m_high[grp-1];
284 virtual void update(doublereal t, doublereal* cp_R,
285 doublereal* h_RT, doublereal* s_R)
const {
288 doublereal tt = 1.e-3*t;
297 std::vector<ShomatePoly>::const_iterator _begin, _end;
300 _begin =
m_high[i].begin();
303 _begin =
m_low[i].begin();
304 _end =
m_low[i].end();
306 for (; _begin != _end; ++_begin) {
307 _begin->updateProperties(&
m_t[0], cp_R, h_RT, s_R);
399 const std::vector<ShomatePoly> &mlg =
m_low[grp-1];
400 const std::vector<ShomatePoly> &mhg =
m_high[grp-1];
403 doublereal tmid = lowPoly->
maxTemp();
439 std::vector<ShomatePoly> &mlg =
m_low[grp-1];
440 std::vector<ShomatePoly> &mhg =
m_high[grp-1];
443 doublereal tmid = lowPoly->
maxTemp();
444 if (fabs(c[0] - tmid) > 0.001) {
445 throw CanteraError(
"modifyParams",
"can't change mid temp");
457 #ifdef H298MODIFY_CAPABILITY
459 virtual doublereal reportOneHf298(
int k)
const {
461 doublereal t = 298.15;
465 const std::vector<ShomatePoly> &mlg =
m_low[grp-1];
468 doublereal tmid = nlow->
maxTemp();
470 h = nlow->reportHf298();
472 const std::vector<ShomatePoly> &mhg =
m_high[grp-1];
473 const ShomatePoly* nhigh = &(mhg[pos]);
474 h = nhigh->reportHf298();
479 virtual void modifyOneHf298(
const int k,
const doublereal Hf298New) {
483 std::vector<ShomatePoly> &mlg =
m_low[grp-1];
484 ShomatePoly* nlow = &(mlg[pos]);
485 std::vector<ShomatePoly> &mhg =
m_high[grp-1];
486 ShomatePoly* nhigh = &(mhg[pos]);
487 doublereal tmid = nlow->maxTemp();
489 double hnow = reportOneHf298(k);
490 double delH = Hf298New - hnow;
491 if (298.15 <= tmid) {
492 nlow->modifyOneHf298(k, Hf298New);
493 double h = nhigh->reportHf298(0);
494 double hnew = h + delH;
495 nhigh->modifyOneHf298(k, hnew);
497 nhigh->modifyOneHf298(k, Hf298New);
498 double h = nlow->reportHf298(0);
499 double hnew = h + delH;
500 nlow->modifyOneHf298(k, hnew);
516 std::vector<std::vector<ShomatePoly> >
m_high;
525 std::vector<std::vector<ShomatePoly> >
m_low;