10 #ifndef CT_NASATHERMO_H
11 #define CT_NASATHERMO_H
154 virtual void install(std::string name,
size_t index,
int type,
160 int imid = int(c[0]);
163 std::vector<NasaPoly1> v;
175 doublereal tmid = c[0];
177 const doublereal* clow = c + 1;
180 copy(c + 8, c + 15, chigh.begin());
183 refPressure, &chigh[0]));
190 copy(clow+2, clow+7, clu.begin());
193 copy(chigh.begin()+2, chigh.begin()+7, chu.begin());
203 if (
m_tlow.size() < index + 1) {
204 m_tlow.resize(index + 1, tlow);
205 m_thigh.resize(index + 1, thigh);
211 }
else if (fabs(
m_p0 - refPressure) > 0.1) {
212 std::string logmsg =
" ERROR NasaThermo: New Species, " + name +
", has a different reference pressure, "
213 +
fp2str(refPressure) +
", than existing reference pressure, " +
fp2str(
m_p0) +
"\n";
215 logmsg =
" This is now a fatal error\n";
217 throw CanteraError(
"install()",
"species have different reference pressures");
245 virtual void update_one(
size_t k, doublereal t, doublereal* cp_R,
246 doublereal* h_RT, doublereal* s_R)
const {
257 const std::vector<NasaPoly1> &mlg =
m_low[grp-1];
260 doublereal tmid = nlow->
maxTemp();
264 const std::vector<NasaPoly1> &mhg =
m_high[grp-1];
285 virtual void update(doublereal t, doublereal* cp_R,
286 doublereal* h_RT, doublereal* s_R)
const {
298 std::vector<NasaPoly1>::const_iterator _begin, _end;
301 _begin =
m_high[i].begin();
304 _begin =
m_low[i].begin();
305 _end =
m_low[i].end();
307 for (; _begin != _end; ++_begin) {
308 _begin->updateProperties(&
m_t[0], cp_R, h_RT, s_R);
399 const std::vector<NasaPoly1> &mlg =
m_low[grp-1];
400 const std::vector<NasaPoly1> &mhg =
m_high[grp-1];
404 doublereal tmid = lowPoly->
maxTemp();
413 if (itype !=
NASA1) {
421 if (itype !=
NASA1) {
447 std::vector<NasaPoly1> &mlg =
m_low[grp-1];
448 std::vector<NasaPoly1> &mhg =
m_high[grp-1];
451 doublereal tmid = lowPoly->
maxTemp();
463 #ifdef H298MODIFY_CAPABILITY
464 virtual doublereal reportOneHf298(
const int k)
const {
468 const std::vector<NasaPoly1> &mlg =
m_low[grp-1];
470 doublereal tmid = nlow->
maxTemp();
472 if (298.15 <= tmid) {
473 h = nlow->reportHf298(0);
475 const std::vector<NasaPoly1> &mhg =
m_high[grp-1];
476 const NasaPoly1* nhigh = &(mhg[pos]);
477 h = nhigh->reportHf298(0);
482 virtual void modifyOneHf298(
const int k,
const doublereal Hf298New) {
485 std::vector<NasaPoly1> &mlg =
m_low[grp-1];
486 NasaPoly1* nlow = &(mlg[pos]);
487 std::vector<NasaPoly1> &mhg =
m_high[grp-1];
488 NasaPoly1* nhigh = &(mhg[pos]);
489 doublereal tmid = nlow->maxTemp();
491 double hnow = reportOneHf298(k);
492 double delH = Hf298New - hnow;
493 if (298.15 <= tmid) {
494 nlow->modifyOneHf298(k, Hf298New);
495 double h = nhigh->reportHf298(0);
496 double hnew = h + delH;
497 nhigh->modifyOneHf298(k, hnew);
499 nhigh->modifyOneHf298(k, Hf298New);
500 double h = nlow->reportHf298(0);
501 double hnew = h + delH;
502 nlow->modifyOneHf298(k, hnew);
516 std::vector<std::vector<NasaPoly1> >
m_high;
525 std::vector<std::vector<NasaPoly1> >
m_low;
585 mutable std::map<size_t, std::string>
m_name;
596 void checkContinuity(std::string name,
double tmid,
const doublereal* clow,
605 return c[0] + 0.5*c[1]*t +
OneThird*c[2]*t*t
606 + 0.25*c[3]*t*t*t + 0.2*c[4]*t*t*t*t
616 return c[0]*log(t) + c[1]*t + 0.5*c[2]*t*t
617 +
OneThird*c[3]*t*t*t + 0.25*c[4]*t*t*t*t