17 Mu0Poly::Mu0Poly() : m_numIntervals(0),
24 const doublereal* coeffs) :
42 m_numIntervals(b.m_numIntervals),
45 m_mu0_R_int(b.m_mu0_R_int),
46 m_h0_R_int(b.m_h0_R_int),
47 m_s0_R_int(b.m_s0_R_int),
48 m_cp0_R_int(b.m_cp0_R_int)
55 SpeciesThermoInterpType::operator=(b);
68 Mu0Poly::duplMyselfAsSpeciesThermoInterpType()
const
74 doublereal* h_RT, doublereal* s_R)
const
95 doublereal* s_R)
const
101 doublereal& tlow, doublereal& thigh,
103 doublereal*
const coeffs)
const
127 bool dimensionlessMu0Values =
false;
129 doublereal h298 = 0.0;
131 h298 =
getFloat(Mu0Node,
"H298",
"actEnergy");
134 size_t numPoints = 1;
135 if (Mu0Node.
hasChild(
"numPoints")) {
142 throw CanteraError(
"installMu0ThermoFromXML",
"missing Mu0Values");
150 if (valNode_ptr->
attrib(
"units") ==
"Dimensionless") {
151 dimensionlessMu0Values =
true;
153 if (cValues.size() != numPoints) {
154 throw CanteraError(
"installMu0ThermoFromXML",
"numPoints inconsistent");
161 "missing Mu0Temperatures");
164 if (cTemperatures.size() != numPoints) {
165 throw CanteraError(
"installMu0ThermoFromXML",
"numPoints inconsistent");
171 if (dimensionlessMu0Values) {
172 for (
size_t i = 0; i < numPoints; i++) {
173 cValues[i] *= cTemperatures[i] / 273.15;
180 c[0] =
static_cast<double>(numPoints);
182 for (
size_t i = 0; i < numPoints; i++) {
183 c[2+i*2] = cTemperatures[i];
184 c[2+i*2+1] = cValues[i];
188 fpValue(Mu0Node[
"Pref"]), &c[0]);
193 size_t nPoints = (size_t) coeffs[0];
196 "nPoints must be >= 2");
215 for (
size_t i = 0, iindex = 2; i < nPoints; i++) {
216 double T1 = coeffs[iindex];
223 if (i < nPoints - 1) {
224 if (coeffs[iindex+2] <= T1) {
226 "Temperatures are not monotonic increasing");
233 "One temperature has to be 298.15");
246 double deltaT = T2 - T1;
247 double cpi = (deltaMu - T1 * s1 + T2 * s1) / (deltaT - T2 * log(T2/T1));
260 for (
size_t i = iT298 - 1; i !=
npos; i--) {
265 double deltaT = T2 - T1;
266 double cpi = (deltaMu - T1 * s2 + T2 * s2) / (deltaT - T1 * log(T2/T1));
270 if (i == (m_numIntervals-1)) {
276 printf(
" Temp mu0(J/kmol) cp0(J/kmol/K) "
277 " h0(J/kmol) s0(J/kmol/K) \n");
278 for (i = 0; i < nPoints; i++) {
279 printf(
"%12.3g %12.5g %12.5g %12.5g %12.5g\n",
doublereal fpValue(const std::string &val)
Translate a string into one doublereal value.
Header for a single-species standard state object derived from SpeciesThermoInterpType based on a pie...
Pure Virtual Base class for the thermodynamic manager for an individual species' reference state...
CTML ("Cantera Markup Language") is the variant of XML that Cantera uses to store data...
std::string attrib(const std::string &attr) const
Function returns the value of an attribute.
vector_fp m_s0_R_int
Entropy at the points.
virtual void updatePropertiesTemp(const doublereal temp, doublereal *cp_R, doublereal *h_RT, doublereal *s_R) const
Compute the reference-state property of one species.
const size_t npos
index returned by functions to indicate "no position"
size_t m_index
species index
size_t m_numIntervals
Number of intervals in the interpolating linear approximation.
Class XML_Node is a tree-based representation of the contents of an XML file.
vector_fp m_cp0_R_int
Heat capacity at the points.
Virtual base class for the calculation of multiple-species thermodynamic reference-state property man...
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.
#define MU0_INTERP
piecewise interpolation of mu0.
virtual void reportParameters(size_t &n, int &type, doublereal &tlow, doublereal &thigh, doublereal &pref, doublereal *const coeffs) const
This utility function reports back the type of parameterization and all of the parameters for the spe...
Mu0Poly & operator=(const Mu0Poly &)
Assignment operator.
doublereal m_highT
Highest valid temperature.
vector_fp m_mu0_R_int
Mu0's are primary input data.
Base class for exceptions thrown by Cantera classes.
bool hasChild(const std::string &ch) const
Tests whether the current node has a child node with a particular name.
virtual void modifyParameters(doublereal *coeffs)
Modify parameters for the standard state.
doublereal m_lowT
lowest valid temperature
int getInteger(const XML_Node &parent, const std::string &name)
Get an integer value from a child element.
virtual void updateProperties(const doublereal *tPoly, doublereal *cp_R, doublereal *h_RT, doublereal *s_R) const
Update the properties for this species, given a temperature polynomial.
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...
std::vector< double > vector_fp
Turn on the use of stl vectors for the basic array type within cantera Vector of doubles.
size_t getFloatArray(const XML_Node &node, std::vector< doublereal > &v, const bool convert, const std::string &unitsString, const std::string &nodeName)
This function reads the current node or a child node of the current node with the default name...
const doublereal GasConstant
Universal Gas Constant. [J/kmol/K].
vector_fp m_t0_int
Points at which the standard state chemical potential are given.
Contains declarations for string manipulation functions within Cantera.
doublereal getFloat(const XML_Node &parent, const std::string &name, const std::string &type)
Get a floating-point value from a child element.
vector_fp m_h0_R_int
Dimensionless Enthalpies at the temperature points.
doublereal m_Pref
Reference state pressure.
Mu0Poly * newMu0ThermoFromXML(const XML_Node &Mu0Node)
Install a Mu0 polynomial thermodynamic reference state.
void processCoeffs(const doublereal *coeffs)
process the coefficients