22 : SpeciesThermoInterpType(0.0, std::numeric_limits<double>::infinity(), 0.0)
28Mu0Poly::Mu0Poly(
double tlow,
double thigh,
double pref,
const double* coeffs) :
33 std::map<double, double> T_mu;
34 size_t nPoints = (size_t) coeffs[0];
35 for (
size_t i = 0; i < nPoints; i++) {
36 T_mu[coeffs[2*i+2]] = coeffs[2*i+3];
43 size_t nPoints = T_mu.size();
45 throw CanteraError(
"Mu0Poly::setParameters",
"nPoints must be >= 2");
53 for (
const auto& row : T_mu) {
54 double T1 = row.first;
63 "One temperature has to be 298.15");
79 double deltaT = T2 - T1;
80 double cpi = (deltaMu - T1 * s1 + T2 * s1) / (deltaT - T2 * log(T2/T1));
91 for (
size_t i = iT298 - 1; i !=
npos; i--) {
96 double deltaT = T2 - T1;
97 double cpi = (deltaMu - T1 * s2 + T2 * s2) / (deltaT - T1 * log(T2/T1));
109 doublereal* h_RT, doublereal* s_R)
const
130 doublereal* s_R)
const
141 doublereal& tlow, doublereal& thigh,
143 doublereal*
const coeffs)
const
163 thermo[
"model"] =
"piecewise-Gibbs";
166 bool dimensionless = m_input.
getBool(
"dimensionless",
false);
168 thermo[
"dimensionless"] =
true;
174 data[fmt::format(
"{}",
m_t0_int[i])].setQuantity(
178 thermo[
"data"] = std::move(data);
183 bool dimensionlessMu0Values =
false;
185 doublereal h298 = 0.0;
187 h298 =
getFloat(Mu0Node,
"H298",
"actEnergy");
190 size_t numPoints = 1;
191 if (Mu0Node.
hasChild(
"numPoints")) {
198 throw CanteraError(
"newMu0ThermoFromXML",
"missing Mu0Values");
205 if (valNode_ptr->
attrib(
"units") ==
"Dimensionless") {
206 dimensionlessMu0Values =
true;
208 if (cValues.size() != numPoints) {
209 throw CanteraError(
"newMu0ThermoFromXML",
"numPoints inconsistent");
215 throw CanteraError(
"newMu0ThermoFromXML",
"missing Mu0Temperatures");
218 if (cTemperatures.size() != numPoints) {
219 throw CanteraError(
"newMu0ThermoFromXML",
"numPoints inconsistent");
223 if (dimensionlessMu0Values) {
224 for (
size_t i = 0; i < numPoints; i++) {
225 cValues[i] *= cTemperatures[i] / 273.15;
230 c[0] =
static_cast<double>(numPoints);
232 for (
size_t i = 0; i < numPoints; i++) {
233 c[2+i*2] = cTemperatures[i];
234 c[2+i*2+1] = cValues[i];
238 fpValue(Mu0Node[
"Pref"]), &c[0]);
Header for a single-species standard state object derived from SpeciesThermoInterpType based on a pie...
A map of string keys to values whose type can vary at runtime.
bool getBool(const std::string &key, bool default_) const
If key exists, return it as a bool, otherwise return default_.
Base class for exceptions thrown by Cantera classes.
The Mu0Poly class implements an interpolation of the Gibbs free energy based on a piecewise constant ...
doublereal m_H298
Value of the enthalpy at T = 298.15.
vector_fp m_mu0_R_int
Mu0's are primary input data.
virtual void getParameters(AnyMap &thermo) const
Store the parameters of the species thermo object such that an identical species thermo object could ...
vector_fp m_cp0_R_int
Heat capacity at the points.
void setParameters(double h0, const std::map< double, double > &T_mu)
Set parameters for .
virtual void updatePropertiesTemp(const doublereal temp, doublereal *cp_R, doublereal *h_RT, doublereal *s_R) const
Compute the reference-state property of one species.
virtual size_t nCoeffs() const
This utility function returns the number of coefficients for a given type of species parameterization...
virtual void reportParameters(size_t &n, int &type, doublereal &tlow, doublereal &thigh, doublereal &pref, doublereal *const coeffs) const
This utility function returns the type of parameterization and all of the parameters for the species.
vector_fp m_s0_R_int
Entropy at the points.
size_t m_numIntervals
Number of intervals in the interpolating linear approximation.
virtual void updateProperties(const doublereal *tt, doublereal *cp_R, doublereal *h_RT, doublereal *s_R) const
Update the properties for this species, given a temperature polynomial.
vector_fp m_t0_int
Points at which the standard state chemical potential are given.
vector_fp m_h0_R_int
Dimensionless Enthalpies at the temperature points.
Abstract Base class for the thermodynamic manager for an individual species' reference state.
virtual void getParameters(AnyMap &thermo) const
Store the parameters of the species thermo object such that an identical species thermo object could ...
doublereal m_lowT
lowest valid temperature
doublereal m_highT
Highest valid temperature.
doublereal m_Pref
Reference state pressure.
Class XML_Node is a tree-based representation of the contents of an XML file.
std::string attrib(const std::string &attr) const
Function returns the value of an attribute.
bool hasChild(const std::string &ch) const
Tests whether the current node has a child node with a particular name.
CTML ("Cantera Markup Language") is the variant of XML that Cantera uses to store data.
Mu0Poly * newMu0ThermoFromXML(const XML_Node &Mu0Node)
Install a Mu0 polynomial thermodynamic reference state.
Namespace for the Cantera kernel.
const size_t npos
index returned by functions to indicate "no position"
XML_Node * getByTitle(const XML_Node &node, const std::string &title)
Search the child nodes of the current node for an XML Node with a Title attribute of a given name.
doublereal getFloat(const XML_Node &parent, const std::string &name, const std::string &type="")
Get a floating-point value from a child element.
doublereal fpValue(const std::string &val)
Translate a string into one doublereal value.
std::vector< double > vector_fp
Turn on the use of stl vectors for the basic array type within cantera Vector of doubles.
const double GasConstant
Universal Gas Constant [J/kmol/K].
int getInteger(const XML_Node &parent, const std::string &name)
Get an integer value from a child element.
size_t getFloatArray(const XML_Node &node, vector_fp &v, const bool convert=true, const std::string &unitsString="", const std::string &nodeName="floatArray")
This function reads the current node or a child node of the current node with the default name,...
#define MU0_INTERP
piecewise interpolation of mu0.
Contains declarations for string manipulation functions within Cantera.