throw error for non NASA 7-coefficient thermo data in cti file
This commit is contained in:
parent
663384bf3b
commit
13525889be
2 changed files with 24 additions and 20 deletions
32
ct2foam.C
32
ct2foam.C
|
|
@ -33,6 +33,7 @@ Description
|
|||
|
||||
#include <cantera/transport.h>
|
||||
#include <cantera/IdealGasMix.h>
|
||||
#include <cantera/thermo/speciesThermoTypes.h>
|
||||
|
||||
#include <fstream>
|
||||
|
||||
|
|
@ -266,7 +267,14 @@ int main(int argc, char *argv[])
|
|||
doublereal minTemp, maxTemp, refPressure;
|
||||
|
||||
// get the NASA coefficients in array c
|
||||
switch(gas_.speciesThermo().reportType(n))
|
||||
{
|
||||
case NASA2:
|
||||
gas_.speciesThermo().reportParams(n, type, c, minTemp, maxTemp, refPressure);
|
||||
break;
|
||||
default:
|
||||
throw std::domain_error(gas_.speciesName(n) + " has a non-NASA2-type thermodynamics interpolator");
|
||||
}
|
||||
|
||||
fthermo<<(
|
||||
fmt::format(
|
||||
|
|
@ -328,13 +336,11 @@ int main(int argc, char *argv[])
|
|||
{
|
||||
case Cantera::ELEMENTARY_RXN:
|
||||
|
||||
frxn<<( fmt::format( rxnTypeFormat, irn + rate + rxn));
|
||||
|
||||
frxn<<( fmt::format( rxnEqnFormat, ofReactionString(r) ) );
|
||||
|
||||
frxn<<(
|
||||
fmt::format(
|
||||
arrheniusFormat,
|
||||
rxnTypeFormat + rxnEqnFormat + arrheniusFormat,
|
||||
irn + rate + rxn,
|
||||
ofReactionString(r),
|
||||
std::dynamic_pointer_cast<Cantera::ElementaryReaction>(r)->rate.preExponentialFactor(),
|
||||
std::dynamic_pointer_cast<Cantera::ElementaryReaction>(r)->rate.temperatureExponent(),
|
||||
std::dynamic_pointer_cast<Cantera::ElementaryReaction>(r)->rate.activationEnergy_R()
|
||||
|
|
@ -346,13 +352,11 @@ int main(int argc, char *argv[])
|
|||
|
||||
rate = "thirdBody" + rate;
|
||||
|
||||
frxn<<( fmt::format( rxnTypeFormat, irn + rate + rxn));
|
||||
|
||||
frxn<<( fmt::format( rxnEqnFormat, ofReactionString(r) ) );
|
||||
|
||||
frxn<<(
|
||||
fmt::format(
|
||||
arrheniusFormat,
|
||||
rxnTypeFormat + rxnEqnFormat + arrheniusFormat,
|
||||
irn + rate + rxn,
|
||||
ofReactionString(r),
|
||||
std::dynamic_pointer_cast<Cantera::ElementaryReaction>(r)->rate.preExponentialFactor(),
|
||||
std::dynamic_pointer_cast<Cantera::ElementaryReaction>(r)->rate.temperatureExponent(),
|
||||
std::dynamic_pointer_cast<Cantera::ElementaryReaction>(r)->rate.activationEnergy_R()
|
||||
|
|
@ -403,13 +407,11 @@ int main(int argc, char *argv[])
|
|||
break;
|
||||
}
|
||||
|
||||
frxn<<( fmt::format( rxnTypeFormat, irn + rate + rxn));
|
||||
|
||||
frxn<<( fmt::format( rxnEqnFormat, ofReactionString(r) ) );
|
||||
|
||||
frxn<<(
|
||||
fmt::format(
|
||||
falloffFormat,
|
||||
rxnTypeFormat + rxnEqnFormat + falloffFormat,
|
||||
irn + rate + rxn,
|
||||
ofReactionString(r),
|
||||
std::dynamic_pointer_cast<Cantera::FalloffReaction>(r)->low_rate.preExponentialFactor(),
|
||||
std::dynamic_pointer_cast<Cantera::FalloffReaction>(r)->low_rate.temperatureExponent(),
|
||||
std::dynamic_pointer_cast<Cantera::FalloffReaction>(r)->low_rate.activationEnergy_R(),
|
||||
|
|
|
|||
10
ofFormats.h
10
ofFormats.h
|
|
@ -28,6 +28,12 @@ std::string thermoFormat = std::string() +
|
|||
"}}\n"
|
||||
;
|
||||
|
||||
std::string rxnTypeFormat =
|
||||
" type {};\n";
|
||||
|
||||
std::string rxnEqnFormat =
|
||||
" reaction \"{}\";\n";
|
||||
|
||||
std::string arrheniusFormat = std::string() +
|
||||
" A {};\n" +
|
||||
" beta {};\n" +
|
||||
|
|
@ -80,8 +86,4 @@ std::string sriFormat = std::string() +
|
|||
;
|
||||
|
||||
|
||||
std::string rxnTypeFormat = " type {};\n";
|
||||
|
||||
std::string rxnEqnFormat = " reaction \"{}\";\n";
|
||||
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue