[Thermo] Check to make sure parameterizations are of the correct type

This commit is contained in:
Ray Speth 2014-09-27 00:09:02 +00:00
parent 1cb688150e
commit 473827a8a6
3 changed files with 18 additions and 1 deletions

View file

@ -133,7 +133,12 @@ public:
*/
virtual void install(const std::string& name, size_t index, int type, const doublereal* c,
doublereal minTemp_, doublereal maxTemp_, doublereal refPressure_) {
if (type != SIMPLE) {
throw CanteraError("SimpleThermo::install",
"Incompatible thermo parameterization: Got " +
int2str(type) + " but " + int2str(SIMPLE) +
" was expected.");
}
m_logt0.push_back(log(c[0]));
m_t0.push_back(c[0]);
m_h0_R.push_back(c[1]/GasConstant);

View file

@ -59,6 +59,12 @@ void NasaThermo::install(const std::string& name, size_t index, int type,
doublereal min_temp, doublereal max_temp,
doublereal ref_pressure)
{
if (type != NASA) {
throw CanteraError("NasaThermo::install",
"Incompatible thermo parameterization: Got " +
int2str(type) + " but " + int2str(NASA) +
" was expected.");
}
m_name[index] = name;
int imid = int(c[0]); // midpoint temp converted to integer
int igrp = m_index[imid]; // has this value been seen before?

View file

@ -148,6 +148,12 @@ public:
const doublereal* c,
doublereal minTemp, doublereal maxTemp,
doublereal refPressure) {
if (type != SHOMATE) {
throw CanteraError("ShomateThermo::install",
"Incompatible thermo parameterization: Got " +
int2str(type) + " but " + int2str(SHOMATE) +
" was expected.");
}
int imid = int(c[0]); // midpoint temp converted to integer
int igrp = m_index[imid]; // has this value been seen before?
if (igrp == 0) { // if not, prepare new group