[CTML] Deprecate getFloatDefaultUnits

This function is unnecessarily complicated and rarely needed.
This commit is contained in:
Ray Speth 2016-04-14 19:41:44 -04:00
parent a288d5c6f7
commit ef441e4182
7 changed files with 19 additions and 16 deletions

View file

@ -575,6 +575,7 @@ int getInteger(const XML_Node& parent, const std::string& name);
* @param type String type. Currently known types are "toSI" and "actEnergy",
* and "" , for no conversion. The default value is "",
* which implies that no conversion is allowed.
* @deprecated Use getFloat and toSI directly. To be removed after Cantera 2.3.
*/
doublereal getFloatDefaultUnits(const XML_Node& parent,
const std::string& name,

View file

@ -237,6 +237,8 @@ doublereal getFloatDefaultUnits(const XML_Node& parent,
const std::string& defaultUnits,
const std::string& type)
{
warn_deprecated("getFloatDefaultUnits",
"Use getFloat and toSI directly. To be removed after Cantera 2.3.");
doublereal fctr = 1.0;
if (defaultUnits == "") {
throw CanteraError("getFloatDefaultUnits",

View file

@ -235,7 +235,7 @@ void FixedChemPotSSTP::initThermoXML(XML_Node& phaseNode, const std::string& id_
SingleSpeciesTP::initThermoXML(phaseNode, id_);
if (model == "FixedChemPot") {
double val = getFloatDefaultUnits(tnode, "chemicalPotential", "J/kmol");
double val = getFloat(tnode, "chemicalPotential", "toSI");
chemPot_ = val;
} else {
_updateThermo();
@ -262,7 +262,7 @@ void FixedChemPotSSTP::setParametersFromXML(const XML_Node& eosdata)
"thermo model attribute must be FixedChemPot or StoichSubstance or StoichSubstanceSSTP");
}
if (model == "FixedChemPotSSTP") {
doublereal val = getFloatDefaultUnits(eosdata, "chemicalPotential", "J/kmol");
doublereal val = getFloat(eosdata, "chemicalPotential", "toSI");
chemPot_ = val;
}
}

View file

@ -157,7 +157,7 @@ void MetalSHEelectrons::initThermoXML(XML_Node& phaseNode, const std::string& id
XML_Node& tnode = phaseNode.child("thermo");
doublereal dens = 2.65E3;
if (tnode.hasChild("density")) {
dens = getFloatDefaultUnits(tnode, "density", "kg/m3");
dens = getFloat(tnode, "density", "toSI");
}
setDensity(dens);
SingleSpeciesTP::initThermoXML(phaseNode, id_);

View file

@ -210,13 +210,13 @@ void MineralEQ3::initThermoXML(XML_Node& phaseNode, const std::string& id_)
const XML_Node& MinEQ3node = xsp->child("thermo").child("MinEQ3");
m_deltaG_formation_pr_tr =
getFloatDefaultUnits(MinEQ3node, "DG0_f_Pr_Tr", "cal/gmol", "actEnergy");
getFloat(MinEQ3node, "DG0_f_Pr_Tr", "actEnergy") / actEnergyToSI("cal/gmol");
m_deltaH_formation_pr_tr =
getFloatDefaultUnits(MinEQ3node, "DH0_f_Pr_Tr", "cal/gmol", "actEnergy");
m_Entrop_pr_tr = getFloatDefaultUnits(MinEQ3node, "S0_Pr_Tr", "cal/gmol/K");
m_a = getFloatDefaultUnits(MinEQ3node, "a", "cal/gmol/K");
m_b = getFloatDefaultUnits(MinEQ3node, "b", "cal/gmol/K2");
m_c = getFloatDefaultUnits(MinEQ3node, "c", "cal-K/gmol");
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();
}

View file

@ -158,13 +158,13 @@ SpeciesThermoInterpType* newShomateForMineralEQ3(const XML_Node& MinEQ3node)
doublereal p0 = strSItoDbl(MinEQ3node["Pref"]);
doublereal deltaG_formation_pr_tr =
getFloatDefaultUnits(MinEQ3node, "DG0_f_Pr_Tr", "cal/gmol", "actEnergy");
getFloat(MinEQ3node, "DG0_f_Pr_Tr", "actEnergy") / actEnergyToSI("cal/gmol");
doublereal deltaH_formation_pr_tr =
getFloatDefaultUnits(MinEQ3node, "DH0_f_Pr_Tr", "cal/gmol", "actEnergy");
doublereal Entrop_pr_tr = getFloatDefaultUnits(MinEQ3node, "S0_Pr_Tr", "cal/gmol/K");
doublereal a = getFloatDefaultUnits(MinEQ3node, "a", "cal/gmol/K");
doublereal b = getFloatDefaultUnits(MinEQ3node, "b", "cal/gmol/K2");
doublereal c = getFloatDefaultUnits(MinEQ3node, "c", "cal-K/gmol");
getFloat(MinEQ3node, "DH0_f_Pr_Tr", "actEnergy") / actEnergyToSI("cal/gmol");
doublereal Entrop_pr_tr = getFloat(MinEQ3node, "S0_Pr_Tr", "toSI") / toSI("cal/gmol/K");
doublereal a = getFloat(MinEQ3node, "a", "toSI") / toSI("cal/gmol/K");
doublereal b = getFloat(MinEQ3node, "b", "toSI") / toSI("cal/gmol/K2");
doublereal c = getFloat(MinEQ3node, "c", "toSI") / toSI("cal-K/gmol");
doublereal dg = deltaG_formation_pr_tr * 4.184 * 1.0E3;
doublereal DHjmol = deltaH_formation_pr_tr * 1.0E3 * 4.184;
doublereal fac = DHjmol - dg - 298.15 * Entrop_pr_tr * 1.0E3 * 4.184;

View file

@ -179,7 +179,7 @@ void StoichSubstance::initThermoXML(XML_Node& phaseNode, const std::string& id_)
throw CanteraError("StoichSubstance::initThermoXML",
"thermo model attribute must be StoichSubstance");
}
double dens = getFloatDefaultUnits(tnode, "density", "kg/m3");
double dens = getFloat(tnode, "density", "toSI");
setDensity(dens);
SingleSpeciesTP::initThermoXML(phaseNode, id_);
}