28 double thigh,
double pref,
const double* coeffs)
32 return new NasaPoly1(tlow, thigh, pref, coeffs);
39 return new Mu0Poly(tlow, thigh, pref, coeffs);
43 return new NasaPoly2(tlow, thigh, pref, coeffs);
48 "Unknown species thermo type: {}.", type);
53 double tlow,
double thigh,
double pref,
const double* coeffs)
57 if (type ==
"nasa2" || type ==
"nasa") {
59 }
else if (type ==
"const_cp" || type ==
"simple") {
61 }
else if (type ==
"shomate" || type ==
"shomate1") {
63 }
else if (type ==
"shomate2") {
65 }
else if (type ==
"nasa1") {
67 }
else if (type ==
"nasa9") {
69 }
else if (type ==
"nasa9multi") {
71 }
else if (type ==
"mu0") {
75 "Unknown species thermo type: '" + stype +
"'.");
80 void setupSpeciesThermo(SpeciesThermoInterpType& thermo,
83 double Pref = node.convert(
"reference-pressure",
"Pa",
OneAtm);
84 thermo.setRefPressure(Pref);
85 thermo.input() = node;
88 void setupNasaPoly(NasaPoly2& thermo,
const AnyMap& node)
90 setupSpeciesThermo(thermo, node);
91 vector<double> Tranges = node.convertVector(
"temperature-ranges",
"K", 2, 3);
92 const auto& data = node[
"data"].asVector<vector<double>>(Tranges.size()-1);
93 for (
const auto& poly : data) {
94 if (poly.size() != 7) {
95 throw CanteraError(
"setupNasaPoly",
"Wrong number of coefficients "
96 "for NASA polynomial. Expected 7, but got {}", poly.size());
99 thermo.setMinTemp(Tranges.front());
100 thermo.setMaxTemp(Tranges.back());
101 if (Tranges.size() == 3) {
102 thermo.setParameters(Tranges[1], data[0], data[1]);
104 thermo.setParameters(Tranges[1], data[0], data[0]);
108 void setupShomatePoly(ShomatePoly2& thermo,
const AnyMap& node)
110 setupSpeciesThermo(thermo, node);
111 vector<double> Tranges = node.convertVector(
"temperature-ranges",
"K", 2, 3);
112 const auto& data = node[
"data"].asVector<vector<double>>(Tranges.size()-1);
113 for (
const auto& poly : data) {
114 if (poly.size() != 7) {
115 throw CanteraError(
"setupShomatePoly",
"Wrong number of coefficients "
116 "for Shomate polynomial. Expected 7, but got {}", poly.size());
119 thermo.setMinTemp(Tranges.front());
120 thermo.setMaxTemp(Tranges.back());
121 if (Tranges.size() == 3) {
122 thermo.setParameters(Tranges[1], data[0], data[1]);
124 thermo.setParameters(Tranges[1], data[0], data[0]);
128 void setupConstCp(ConstCpPoly& thermo,
const AnyMap& node)
130 setupSpeciesThermo(thermo, node);
131 if (node.hasKey(
"T-min")) {
132 thermo.setMinTemp(node.convert(
"T-min",
"K"));
134 if (node.hasKey(
"T-max")) {
135 thermo.setMaxTemp(node.convert(
"T-max",
"K"));
137 double T0 = node.convert(
"T0",
"K", 298.15);
138 double h0 = node.convert(
"h0",
"J/kmol", 0.0);
139 double s0 = node.convert(
"s0",
"J/kmol/K", 0.0);
140 double cp0 = node.convert(
"cp0",
"J/kmol/K", 0.0);
141 thermo.setParameters(T0, h0, s0, cp0);
144 void setupNasa9Poly(Nasa9PolyMultiTempRegion& thermo,
const AnyMap& node)
146 setupSpeciesThermo(thermo, node);
147 vector<double> Tranges = node.convertVector(
"temperature-ranges",
"K", 2, 999);
148 const auto& data = node[
"data"].asVector<vector<double>>(Tranges.size()-1);
149 map<double, vector<double>> regions;
150 for (
size_t i = 0; i < data.size(); i++) {
151 if (data[i].size() != 9) {
152 throw CanteraError(
"setupNasa9Poly",
"Wrong number of coefficients "
153 "for NASA9 polynomial. Expected 9, but got {}", data[i].size());
155 regions[Tranges[i]] = data[i];
157 thermo.setMinTemp(Tranges.front());
158 thermo.setMaxTemp(Tranges.back());
159 thermo.setParameters(regions);
163 void setupMu0(Mu0Poly& thermo,
const AnyMap& node)
165 setupSpeciesThermo(thermo, node);
166 if (node.hasKey(
"T-min")) {
167 thermo.setMinTemp(node.convert(
"T-min",
"K"));
169 if (node.hasKey(
"T-max")) {
170 thermo.setMaxTemp(node.convert(
"T-max",
"K"));
172 bool dimensionless = node.getBool(
"dimensionless",
false);
173 double h0 = node.convert(
"h0",
"J/kmol", 0.0);
174 map<double, double> T_mu;
175 for (
const auto& [T_str, mu] : node[
"data"]) {
176 double T = node.units().convertTo(
fpValueCheck(T_str),
"K");
180 T_mu[T] = node.units().convert(mu,
"J/kmol");
183 thermo.setParameters(h0, T_mu);
188 string model = node[
"model"].asString();
189 if (model ==
"NASA7") {
190 auto thermo = make_unique<NasaPoly2>();
191 setupNasaPoly(*thermo, node);
193 }
else if (model ==
"Shomate") {
194 auto thermo = make_unique<ShomatePoly2>();
195 setupShomatePoly(*thermo, node);
197 }
else if (model ==
"NASA9") {
198 auto thermo = make_unique<Nasa9PolyMultiTempRegion>();
199 setupNasa9Poly(*thermo, node);
201 }
else if (model ==
"constant-cp") {
202 auto thermo = make_unique<ConstCpPoly>();
203 setupConstCp(*thermo, node);
205 }
else if (model ==
"piecewise-Gibbs") {
206 auto thermo = make_unique<Mu0Poly>();
207 setupMu0(*thermo, node);
211 "Unknown thermo model '{}'", model);
Headers for the SpeciesThermoInterpType object that employs a constant heat capacity assumption (see ...
Header for a single-species standard state object derived from SpeciesThermoInterpType based on a pie...
Header for a general species thermodynamic property manager for a phase (see MultiSpeciesThermo).
Header for a single-species standard state object derived from SpeciesThermoInterpType based on the N...
Header for a single-species standard state object derived from SpeciesThermoInterpType based on the N...
Header for a single-species standard state object derived from SpeciesThermoInterpType based on the N...
Header for a single-species standard state object derived from SpeciesThermoInterpType based on the S...
Header for factory functions to build instances of classes that manage the standard-state thermodynam...
Header for unit conversion utilities, which are used to translate user input from input files (See In...
Header file for a derived class of ThermoPhase that handles variable pressure standard state methods ...
A map of string keys to values whose type can vary at runtime.
Base class for exceptions thrown by Cantera classes.
A constant-heat capacity species thermodynamic property manager class.
The Mu0Poly class implements an interpolation of the Gibbs free energy based on a piecewise constant ...
The NASA 9 polynomial parameterization for a single species encompassing multiple temperature regions...
The NASA polynomial parameterization for one temperature range.
The NASA polynomial parameterization for two temperature ranges.
The Shomate polynomial parameterization for two temperature ranges for one species.
The Shomate polynomial parameterization for one temperature range for one species.
Abstract Base class for the thermodynamic manager for an individual species' reference state.
double fpValueCheck(const string &val)
Translate a string into one double value, with error checking.
string toLowerCopy(const string &input)
Convert to lower case.
const double OneAtm
One atmosphere [Pa].
const double GasConstant
Universal Gas Constant [J/kmol/K].
Namespace for the Cantera kernel.
unique_ptr< SpeciesThermoInterpType > newSpeciesThermo(const AnyMap &node)
Create a new SpeciesThermoInterpType object using the specified parameters.
SpeciesThermoInterpType * newSpeciesThermoInterpType(int type, double tlow, double thigh, double pref, const double *coeffs)
Create a new SpeciesThermoInterpType object given a corresponding constant.
Contains const definitions for types of species reference-state thermodynamics managers (see Species ...
#define NASA1
7 coefficient NASA Polynomials This is implemented in the class NasaPoly1 in NasaPoly1....
#define CONSTANT_CP
Constant Cp.
#define MU0_INTERP
piecewise interpolation of mu0.
#define SHOMATE1
one region of Shomate Polynomials used in NIST database This is implemented in the NIST database.
#define NASA9MULTITEMP
9 coefficient NASA Polynomials in multiple temperature regions This is implemented in the class Nasa9...
#define NASA9
9 coefficient NASA Polynomials This is implemented in the class Nasa9Poly1 in Nasa9Poly1....
#define SHOMATE2
Two regions of Shomate Polynomials.
#define SIMPLE
Constant Cp thermo.
#define NASA2
Two regions of 7 coefficient NASA Polynomials This is implemented in the class NasaPoly2 in NasaPoly2...
Contains declarations for string manipulation functions within Cantera.