void MineralEQ3::initThermoXML(XML_Node& phaseNode, const std::string& id_) { /* * Find the Thermo XML node */ if (!phaseNode.hasChild("thermo")) { throw CanteraError("HMWSoln::initThermoXML", "no thermo XML node"); } std::vector<const XML_Node*> xspecies = speciesData(); const XML_Node* xsp = xspecies[0]; XML_Node* aStandardState = 0; if (xsp->hasChild("standardState")) { aStandardState = &xsp->child("standardState"); } else { throw CanteraError("MineralEQ3::initThermoXML", "no standard state mode"); } doublereal volVal = 0.0; string smodel = (*aStandardState)["model"]; if (smodel != "constantVolume") { throw CanteraError("MineralEQ3::initThermoXML", "wrong standard state mode"); } if (aStandardState->hasChild("V0_Pr_Tr")) { XML_Node& aV = aStandardState->child("V0_Pr_Tr"); string Aunits = ""; double Afactor = toSI("cm3/gmol"); if (aV.hasAttrib("units")) { Aunits = aV.attrib("units"); Afactor = toSI(Aunits); } volVal = ctml::getFloat(*aStandardState, "V0_Pr_Tr"); m_V0_pr_tr= volVal; volVal *= Afactor; m_speciesSize[0] = volVal; } else { throw CanteraError("MineralEQ3::initThermoXML", "wrong standard state mode"); } doublereal rho = molecularWeight(0) / volVal; setDensity(rho); const XML_Node& sThermo = xsp->child("thermo"); const XML_Node& MinEQ3node = sThermo.child("MinEQ3"); m_deltaG_formation_pr_tr = ctml::getFloatDefaultUnits(MinEQ3node, "DG0_f_Pr_Tr", "cal/gmol", "actEnergy"); m_deltaH_formation_pr_tr = ctml::getFloatDefaultUnits(MinEQ3node, "DH0_f_Pr_Tr", "cal/gmol", "actEnergy"); m_Entrop_pr_tr = ctml::getFloatDefaultUnits(MinEQ3node, "S0_Pr_Tr", "cal/gmol/K"); m_a = ctml::getFloatDefaultUnits(MinEQ3node, "a", "cal/gmol/K"); m_b = ctml::getFloatDefaultUnits(MinEQ3node, "b", "cal/gmol/K2"); m_c = ctml::getFloatDefaultUnits(MinEQ3node, "c", "cal-K/gmol"); convertDGFormation(); }
void MineralEQ3::initThermoXML(XML_Node& phaseNode, const std::string& id_) { // Find the Thermo XML node if (!phaseNode.hasChild("thermo")) { throw CanteraError("HMWSoln::initThermoXML", "no thermo XML node"); } const XML_Node* xsp = speciesData()[0]; XML_Node* aStandardState = 0; if (xsp->hasChild("standardState")) { aStandardState = &xsp->child("standardState"); } else { throw CanteraError("MineralEQ3::initThermoXML", "no standard state mode"); } doublereal volVal = 0.0; if (aStandardState->attrib("model") != "constantVolume") { throw CanteraError("MineralEQ3::initThermoXML", "wrong standard state mode"); } if (aStandardState->hasChild("V0_Pr_Tr")) { XML_Node& aV = aStandardState->child("V0_Pr_Tr"); double Afactor = toSI("cm3/gmol"); if (aV.hasAttrib("units")) { Afactor = toSI(aV.attrib("units")); } volVal = getFloat(*aStandardState, "V0_Pr_Tr"); m_V0_pr_tr= volVal; volVal *= Afactor; } else { throw CanteraError("MineralEQ3::initThermoXML", "wrong standard state mode"); } setDensity(molecularWeight(0) / volVal); const XML_Node& MinEQ3node = xsp->child("thermo").child("MinEQ3"); m_deltaG_formation_pr_tr = getFloat(MinEQ3node, "DG0_f_Pr_Tr", "actEnergy") / actEnergyToSI("cal/gmol"); m_deltaH_formation_pr_tr = getFloat(MinEQ3node, "DH0_f_Pr_Tr", "actEnergy") / actEnergyToSI("cal/gmol"); m_Entrop_pr_tr = getFloat(MinEQ3node, "S0_Pr_Tr", "toSI") / toSI("cal/gmol/K"); m_a = getFloat(MinEQ3node, "a", "toSI") / toSI("cal/gmol/K"); m_b = getFloat(MinEQ3node, "b", "toSI") / toSI("cal/gmol/K2"); m_c = getFloat(MinEQ3node, "c", "toSI") / toSI("cal-K/gmol"); convertDGFormation(); }