23 MineralEQ3::MineralEQ3(
const std::string& infile,
const std::string& id_)
26 initThermoFile(infile, id_);
29 MineralEQ3::MineralEQ3(
XML_Node& xmlphase,
const std::string& id_)
37 doublereal MineralEQ3::pressure()
const 42 void MineralEQ3::setPressure(doublereal p)
47 doublereal MineralEQ3::isothermalCompressibility()
const 52 doublereal MineralEQ3::thermalExpansionCoeff()
const 59 void MineralEQ3::getActivityConcentrations(doublereal* c)
const 64 doublereal MineralEQ3::standardConcentration(
size_t k)
const 69 doublereal MineralEQ3::logStandardConc(
size_t k)
const 76 void MineralEQ3::getStandardChemPotentials(doublereal* mu0)
const 82 void MineralEQ3::getEnthalpy_RT(doublereal* hrt)
const 84 getEnthalpy_RT_ref(hrt);
85 doublereal presCorrect = (m_press - m_p0) / molarDensity();
86 hrt[0] += presCorrect / RT();
89 void MineralEQ3::getEntropy_R(doublereal* sr)
const 94 void MineralEQ3::getGibbs_RT(doublereal* grt)
const 100 void MineralEQ3::getCp_R(doublereal* cpr)
const 106 void MineralEQ3::getIntEnergy_RT(doublereal* urt)
const 109 urt[0] = m_h0_RT - m_p0 / molarDensity() / RT();
114 void MineralEQ3::getIntEnergy_RT_ref(doublereal* urt)
const 117 urt[0] = m_h0_RT - m_p0 / molarDensity() / RT();
122 void MineralEQ3::setParameters(
int n, doublereal*
const c)
127 void MineralEQ3::getParameters(
int& n, doublereal*
const c)
const 133 void MineralEQ3::initThermoXML(
XML_Node& phaseNode,
const std::string& id_)
136 if (!phaseNode.
hasChild(
"thermo")) {
138 "no thermo XML node");
141 const XML_Node* xsp = speciesData()[0];
144 if (xsp->
hasChild(
"standardState")) {
145 aStandardState = &xsp->
child(
"standardState");
148 "no standard state mode");
150 doublereal volVal = 0.0;
151 if (aStandardState->
attrib(
"model") !=
"constantVolume") {
153 "wrong standard state mode");
155 if (aStandardState->
hasChild(
"V0_Pr_Tr")) {
157 double Afactor =
toSI(
"cm3/gmol");
161 volVal =
getFloat(*aStandardState,
"V0_Pr_Tr");
166 "wrong standard state mode");
168 setDensity(molecularWeight(0) / volVal);
172 m_deltaG_formation_pr_tr =
174 m_deltaH_formation_pr_tr =
176 m_Entrop_pr_tr =
getFloat(MinEQ3node,
"S0_Pr_Tr",
"toSI") /
toSI(
"cal/gmol/K");
177 m_a =
getFloat(MinEQ3node,
"a",
"toSI") /
toSI(
"cal/gmol/K");
178 m_b =
getFloat(MinEQ3node,
"b",
"toSI") /
toSI(
"cal/gmol/K2");
179 m_c =
getFloat(MinEQ3node,
"c",
"toSI") /
toSI(
"cal-K/gmol");
181 convertDGFormation();
184 void MineralEQ3::setParametersFromXML(
const XML_Node& eosdata)
186 if (eosdata[
"model"] !=
"MineralEQ3") {
188 "thermo model attribute must be MineralEQ3");
192 doublereal MineralEQ3::LookupGe(
const std::string& elemName)
194 size_t iE = elementIndex(elemName);
196 throw CanteraError(
"PDSS_HKFT::LookupGe",
"element " + elemName +
" not found");
198 doublereal geValue = entropyElement298(iE);
200 throw CanteraError(
"PDSS_HKFT::LookupGe",
201 "element " + elemName +
" does not have a supplied entropy298");
203 geValue *= (-298.15);
207 void MineralEQ3::convertDGFormation()
210 doublereal totalSum = 0.0;
211 for (
size_t m = 0; m < nElements(); m++) {
212 double na = nAtoms(0, m);
214 totalSum += na * LookupGe(elementName(m));
218 doublereal dg = m_deltaG_formation_pr_tr *
toSI(
"cal/gmol");
220 m_Mu0_pr_tr = dg + totalSum;
222 double Hcalc = m_Mu0_pr_tr + 298.15 * m_Entrop_pr_tr *
toSI(
"cal/gmol");
223 double DHjmol = m_deltaH_formation_pr_tr *
toSI(
"kal/gmol");
226 if (fabs(Hcalc -DHjmol) > 100 *
toSI(
"cal/gmol")) {
227 throw CanteraError(
"installMinEQ3asShomateThermoFromXML()",
228 "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 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.