24 MineralEQ3::MineralEQ3(
const std::string& infile,
const std::string& id_)
26 initThermoFile(infile, id_);
29 MineralEQ3::MineralEQ3(
XML_Node& xmlphase,
const std::string& id_)
34 MineralEQ3::MineralEQ3(
const MineralEQ3& right)
40 MineralEQ3::operator=(
const MineralEQ3& right)
45 StoichSubstance::operator=(right);
46 m_Mu0_pr_tr = right.m_Mu0_pr_tr;
47 m_Entrop_pr_tr = right.m_Entrop_pr_tr;
48 m_deltaG_formation_pr_tr = right.m_deltaG_formation_pr_tr;
49 m_deltaH_formation_pr_tr = right.m_deltaH_formation_pr_tr;
50 m_V0_pr_tr = right.m_V0_pr_tr;
65 int MineralEQ3::eosType()
const 68 "To be removed after Cantera 2.3.");
69 return cStoichSubstance;
74 doublereal MineralEQ3::pressure()
const 79 void MineralEQ3::setPressure(doublereal p)
84 doublereal MineralEQ3::isothermalCompressibility()
const 89 doublereal MineralEQ3::thermalExpansionCoeff()
const 96 void MineralEQ3::getActivityConcentrations(doublereal* c)
const 101 doublereal MineralEQ3::standardConcentration(
size_t k)
const 106 doublereal MineralEQ3::logStandardConc(
size_t k)
const 113 void MineralEQ3::getStandardChemPotentials(doublereal* mu0)
const 119 void MineralEQ3::getEnthalpy_RT(doublereal* hrt)
const 121 getEnthalpy_RT_ref(hrt);
122 doublereal presCorrect = (m_press - m_p0) / molarDensity();
123 hrt[0] += presCorrect / RT();
126 void MineralEQ3::getEntropy_R(doublereal* sr)
const 128 getEntropy_R_ref(sr);
131 void MineralEQ3::getGibbs_RT(doublereal* grt)
const 137 void MineralEQ3::getCp_R(doublereal* cpr)
const 143 void MineralEQ3::getIntEnergy_RT(doublereal* urt)
const 146 urt[0] = m_h0_RT - m_p0 / molarDensity() / RT();
151 void MineralEQ3::getIntEnergy_RT_ref(doublereal* urt)
const 154 urt[0] = m_h0_RT - m_p0 / molarDensity() / RT();
159 void MineralEQ3::setParameters(
int n, doublereal*
const c)
164 void MineralEQ3::getParameters(
int& n, doublereal*
const c)
const 170 void MineralEQ3::initThermoXML(
XML_Node& phaseNode,
const std::string& id_)
173 if (!phaseNode.
hasChild(
"thermo")) {
175 "no thermo XML node");
178 const XML_Node* xsp = speciesData()[0];
181 if (xsp->
hasChild(
"standardState")) {
182 aStandardState = &xsp->
child(
"standardState");
185 "no standard state mode");
187 doublereal volVal = 0.0;
188 if (aStandardState->
attrib(
"model") !=
"constantVolume") {
190 "wrong standard state mode");
192 if (aStandardState->
hasChild(
"V0_Pr_Tr")) {
194 double Afactor =
toSI(
"cm3/gmol");
198 volVal =
getFloat(*aStandardState,
"V0_Pr_Tr");
201 m_speciesSize[0] = volVal;
204 "wrong standard state mode");
206 setDensity(molecularWeight(0) / volVal);
210 m_deltaG_formation_pr_tr =
212 m_deltaH_formation_pr_tr =
214 m_Entrop_pr_tr =
getFloat(MinEQ3node,
"S0_Pr_Tr",
"toSI") /
toSI(
"cal/gmol/K");
215 m_a =
getFloat(MinEQ3node,
"a",
"toSI") /
toSI(
"cal/gmol/K");
216 m_b =
getFloat(MinEQ3node,
"b",
"toSI") /
toSI(
"cal/gmol/K2");
217 m_c =
getFloat(MinEQ3node,
"c",
"toSI") /
toSI(
"cal-K/gmol");
219 convertDGFormation();
222 void MineralEQ3::setParametersFromXML(
const XML_Node& eosdata)
224 if (eosdata[
"model"] !=
"MineralEQ3") {
226 "thermo model attribute must be MineralEQ3");
230 doublereal MineralEQ3::LookupGe(
const std::string& elemName)
232 size_t iE = elementIndex(elemName);
234 throw CanteraError(
"PDSS_HKFT::LookupGe",
"element " + elemName +
" not found");
236 doublereal geValue = entropyElement298(iE);
238 throw CanteraError(
"PDSS_HKFT::LookupGe",
239 "element " + elemName +
" does not have a supplied entropy298");
241 geValue *= (-298.15);
245 void MineralEQ3::convertDGFormation()
248 doublereal totalSum = 0.0;
249 for (
size_t m = 0; m < nElements(); m++) {
250 double na = nAtoms(0, m);
252 totalSum += na * LookupGe(elementName(m));
256 doublereal dg = m_deltaG_formation_pr_tr *
toSI(
"cal/gmol");
258 m_Mu0_pr_tr = dg + totalSum;
260 double Hcalc = m_Mu0_pr_tr + 298.15 * m_Entrop_pr_tr *
toSI(
"cal/gmol");
261 double DHjmol = m_deltaH_formation_pr_tr *
toSI(
"kal/gmol");
264 if (fabs(Hcalc -DHjmol) > 100 *
toSI(
"cal/gmol")) {
265 throw CanteraError(
"installMinEQ3asShomateThermoFromXML()",
266 "DHjmol is not consistent with G and S: {} vs {}",
CTML ("Cantera Markup Language") is the variant of XML that Cantera uses to store data...
doublereal actEnergyToSI(const std::string &unit)
Return the conversion factor to convert activation energy unit std::string 'unit' to Kelvin...
doublereal toSI(const std::string &unit)
Return the conversion factor to convert unit std::string 'unit' to SI units.
const size_t npos
index returned by functions to indicate "no position"
Headers for the factory class that can create known ThermoPhase objects (see Thermodynamic Properties...
Class XML_Node is a tree-based representation of the contents of an XML file.
void warn_deprecated(const std::string &method, const std::string &extra)
Print a warning indicating that method is deprecated.
bool hasAttrib(const std::string &a) const
Tests whether the current node has an attribute with a particular name.
Base class for a phase with thermodynamic properties.
Base class for exceptions thrown by Cantera classes.
void importPhase(XML_Node &phase, ThermoPhase *th)
Import a phase information into an empty ThermoPhase object.
#define ENTROPY298_UNKNOWN
Number indicating we don't know the entropy of the element in its most stable state at 298...
bool hasChild(const std::string &ch) const
Tests whether the current node has a child node with a particular name.
XML_Node & child(const size_t n) const
Return a changeable reference to the n'th child of the current node.
std::string attrib(const std::string &attr) const
Function returns the value of an attribute.
Header file for the MineralEQ3 class, which represents a fixed-composition incompressible substance b...
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.
Namespace for the Cantera kernel.
Class MineralEQ3 represents a stoichiometric (fixed composition) incompressible substance based on EQ...