Fix incorrect method names referenced in error messages

This commit is contained in:
Ray Speth
2019-12-04 19:45:31 -05:00
parent 3a06877370
commit 8083fc7372
37 changed files with 144 additions and 134 deletions
+2 -2
View File
@@ -1337,7 +1337,7 @@ public:
* @param x Fraction of vapor
*/
virtual void setState_Tsat(doublereal t, doublereal x) {
throw NotImplementedError("ThermoPhase::setState_sat");
throw NotImplementedError("ThermoPhase::setState_Tsat");
}
//! Set the state to a saturated system at a particular pressure
@@ -1346,7 +1346,7 @@ public:
* @param x Fraction of vapor
*/
virtual void setState_Psat(doublereal p, doublereal x) {
throw NotImplementedError("ThermoPhase::setState_sat");
throw NotImplementedError("ThermoPhase::setState_Psat");
}
//@}
+1 -1
View File
@@ -357,7 +357,7 @@ static std::pair<double, std::string> split_unit(const AnyValue& v) {
std::string val_units = v.asString();
size_t space = val_units.find(" ");
if (space == npos) {
throw CanteraError("UnitSystem::convert",
throw CanteraError("split_unit (UnitSystem)",
"Couldn't parse '{}' as a space-separated value/unit pair\n",
val_units);
}
+3 -3
View File
@@ -138,7 +138,7 @@ static std::string call_ctml_writer(const std::string& text, bool isfile)
message << "Error executing python while converting input file:\n";
message << "Python command was: '" << pypath() << "'\n";
message << err.what() << std::endl;
throw CanteraError("ct2ctml_string", message.str());
throw CanteraError("call_ctml_writer", message.str());
}
if (python_exit_code != 0) {
@@ -154,7 +154,7 @@ static std::string call_ctml_writer(const std::string& text, bool isfile)
} else {
message << "The command did not produce any output." << endl;
}
throw CanteraError("ct2ctml_string", message.str());
throw CanteraError("call_ctml_writer", message.str());
}
if (error_output.size() > 0) {
@@ -228,7 +228,7 @@ void ck2cti(const std::string& in_file, const std::string& thermo_file,
message << "Error executing python while converting input file:\n";
message << "Python command was: '" << pypath() << "'\n";
message << err.what() << std::endl;
throw CanteraError("ct2ctml", message.str());
throw CanteraError("ck2cti", message.str());
}
if (python_exit_code != 0) {
+1 -1
View File
@@ -580,7 +580,7 @@ void XML_Node::_require(const std::string& a, const std::string& v) const
}
string msg="XML_Node "+name()+" is required to have an attribute named " + a +
" with the value \"" + v +"\", but instead the value is \"" + attrib(a);
throw CanteraError("XML_Node::require", msg);
throw CanteraError("XML_Node::_require", msg);
}
XML_Node* XML_Node::findNameID(const std::string& nameTarget,
+3 -3
View File
@@ -157,7 +157,7 @@ extern "C" {
MultiPhase& mix = mixCabinet::item(i);
mix.checkPhaseIndex(n);
if (v < 0.0) {
throw CanteraError("setPhaseMoles",
throw CanteraError("mix_setPhaseMoles",
"Mole number must be non-negative.");
}
mix.setPhaseMoles(n, v);
@@ -194,7 +194,7 @@ extern "C" {
{
try {
if (t < 0.0) {
throw CanteraError("setTemperature",
throw CanteraError("mix_setTemperature",
"Temperature must be positive.");
}
mixCabinet::item(i).setTemperature(t);
@@ -255,7 +255,7 @@ extern "C" {
{
try {
if (p < 0.0) {
throw CanteraError("setPressure",
throw CanteraError("mix_setPressure",
"Pressure must be positive.");
}
mixCabinet::item(i).setPressure(p);
+2 -1
View File
@@ -390,7 +390,8 @@ extern "C" {
bool ok = FlowDeviceCabinet::item(i).install(ReactorCabinet::item(n),
ReactorCabinet::item(m));
if (!ok) {
throw CanteraError("install","Could not install flow device.");
throw CanteraError("flowdev_install",
"Could not install flow device.");
}
return 0;
} catch (...) {
+2 -3
View File
@@ -182,7 +182,7 @@ extern "C" {
if (c) {
return XmlCabinet::add(c);
} else {
throw CanteraError("xml_find_id","id not found: "+string(id));
throw CanteraError("xml_findID", "id not found: '{}'", id);
}
} catch (...) {
return handleAllExceptions(-1, ERR);
@@ -197,8 +197,7 @@ extern "C" {
if (c) {
return XmlCabinet::add(c);
} else {
throw CanteraError("xml_findByName","name "+string(nm)
+" not found");
throw CanteraError("xml_findByName", "name '{}' not found", nm);
}
} catch (...) {
return handleAllExceptions(-1, ERR);
+1 -1
View File
@@ -1258,7 +1258,7 @@ int ChemEquil::estimateEP_Brinkley(thermo_t& s, vector_fp& x,
solve(a1, resid.data());
} catch (CanteraError& err) {
s.restoreState(state);
throw CanteraError("equilibrate:estimateEP_Brinkley()",
throw CanteraError("ChemEquil::estimateEP_Brinkley",
"Jacobian is singular. \nTry adding more species, "
"changing the elemental composition slightly, \nor removing "
"unused elements.\n\n" + err.getMessage());
+4 -4
View File
@@ -237,7 +237,7 @@ int vcs_MultiPhaseEquil::equilibrate_HP(doublereal Htarget,
}
}
}
throw CanteraError("MultiPhase::equilibrate_HP",
throw CanteraError("vcs_MultiPhaseEquil::equilibrate_HP",
"No convergence for T");
}
@@ -363,7 +363,7 @@ int vcs_MultiPhaseEquil::equilibrate_SP(doublereal Starget,
}
}
}
throw CanteraError("MultiPhase::equilibrate_SP",
throw CanteraError("vcs_MultiPhaseEquil::equilibrate_SP",
"No convergence for T");
}
@@ -425,11 +425,11 @@ int vcs_MultiPhaseEquil::equilibrate_TP(int estimateEquil,
// Check obvious bounds on the temperature and pressure NOTE, we may want to
// do more here with the real bounds given by the ThermoPhase objects.
if (m_mix->temperature() <= 0.0) {
throw CanteraError("vcs_MultiPhaseEquil::equilibrate",
throw CanteraError("vcs_MultiPhaseEquil::equilibrate_TP",
"Temperature less than zero on input");
}
if (m_mix->pressure() <= 0.0) {
throw CanteraError("vcs_MultiPhaseEquil::equilibrate",
throw CanteraError("vcs_MultiPhaseEquil::equilibrate_TP",
"Pressure less than zero on input");
}
+1 -1
View File
@@ -169,7 +169,7 @@ size_t VCS_SOLVE::addOnePhaseSpecies(vcs_VolPhase* volPhase, size_t k, size_t kT
{
if (kT > m_nsp) {
// Need to expand the number of species here
throw CanteraError("VCS_PROB::addOnePhaseSpecies", "Shouldn't be here");
throw CanteraError("VCS_SOLVE::addOnePhaseSpecies", "Shouldn't be here");
}
const Array2D& fm = volPhase->getFormulaMatrix();
for (size_t eVP = 0; eVP < volPhase->nElemConstraints(); eVP++) {
+3 -3
View File
@@ -189,7 +189,7 @@ VCS_SOLVE::VCS_SOLVE(MultiPhase* mphase, int printLvl) :
} else if (eos == "IdealSolidSoln") {
VolPhase->m_eqnState = VCS_EOS_IDEAL_SOLN;
} else if (eos == "Surf" || eos == "Edge") {
throw CanteraError("VCSnonideal",
throw CanteraError("VCS_SOLVE::VCS_SOLVE",
"Surface/edge phase not handled yet.");
} else {
if (m_printLvl > 1) {
@@ -231,7 +231,7 @@ VCS_SOLVE::VCS_SOLVE(MultiPhase* mphase, int printLvl) :
} else if (m_speciesUnknownType[kT] == VCS_SPECIES_TYPE_INTERFACIALVOLTAGE) {
m_molNumSpecies_old[kT] = tPhase->electricPotential();
} else {
throw CanteraError(" vcs_Cantera_to_vsolve() ERROR",
throw CanteraError("VCS_SOLVE::VCS_SOLVE",
"Unknown species type: {}", m_speciesUnknownType[kT]);
}
@@ -425,7 +425,7 @@ VCS_SOLVE::VCS_SOLVE(MultiPhase* mphase, int printLvl) :
if (m_elType[i] == VCS_ELEM_TYPE_CHARGENEUTRALITY) {
if (m_elemAbundancesGoal[i] != 0.0) {
if (fabs(m_elemAbundancesGoal[i]) > 1.0E-9) {
throw CanteraError("VCS_SOLVE::vcs_prob_specifyFully",
throw CanteraError("VCS_SOLVE::VCS_SOLVE",
"Charge neutrality condition {} is signicantly "
"nonzero, {}. Giving up",
m_elementName[i], m_elemAbundancesGoal[i]);
+4 -3
View File
@@ -203,7 +203,8 @@ extern "C" {
if (c) {
return XmlCabinet::add(c);
} else {
throw CanteraError("fxml_find_id","id not found: "+f2string(id, idlen));
throw CanteraError("fxml_findid", "id not found: '{}'",
f2string(id, idlen));
}
} catch (...) {
return handleAllExceptions(-1, ERR);
@@ -219,8 +220,8 @@ extern "C" {
if (c) {
return XmlCabinet::add(c);
} else {
throw CanteraError("fxml_findByName","name "+f2string(nm, nmlen)
+" not found");
throw CanteraError("fxml_findByName", "name '{}' not found",
f2string(nm, nmlen));
}
} catch (...) {
return handleAllExceptions(-1, ERR);
+9 -6
View File
@@ -137,7 +137,8 @@ void InterfaceKinetics::updateKc()
for (size_t i = 0; i < m_revindex.size(); i++) {
size_t irxn = m_revindex[i];
if (irxn == npos || irxn >= nReactions()) {
throw CanteraError("InterfaceKinetics", "illegal value: irxn = {}", irxn);
throw CanteraError("InterfaceKinetics::updateKc",
"illegal value: irxn = {}", irxn);
}
// WARNING this may overflow HKM
m_rkcn[irxn] = exp(m_rkcn[irxn]*rrt);
@@ -639,7 +640,7 @@ SurfaceArrhenius InterfaceKinetics::buildSurfaceArrhenius(
if (iPhase != iInterface) {
// Non-interface species. There should be exactly one of these
if (foundStick) {
throw CanteraError("InterfaceKinetics::addReaction",
throw CanteraError("InterfaceKinetics::buildSurfaceArrhenius",
"Multiple non-interface species found"
"in sticking reaction: '" + r.equation() + "'");
}
@@ -648,7 +649,7 @@ SurfaceArrhenius InterfaceKinetics::buildSurfaceArrhenius(
}
}
if (!foundStick) {
throw CanteraError("InterfaceKinetics::addReaction",
throw CanteraError("InterfaceKinetics::buildSurfaceArrhenius",
"No non-interface species found"
"in sticking reaction: '" + r.equation() + "'");
}
@@ -726,13 +727,15 @@ void InterfaceKinetics::addPhase(thermo_t& thermo)
void InterfaceKinetics::init()
{
size_t ks = reactionPhaseIndex();
if (ks == npos) throw CanteraError("InterfaceKinetics::finalize",
"no surface phase is present.");
if (ks == npos) {
throw CanteraError("InterfaceKinetics::init",
"no surface phase is present.");
}
// Check to see that the interface routine has a dimension of 2
m_surf = (SurfPhase*)&thermo(ks);
if (m_surf->nDim() != m_nDim) {
throw CanteraError("InterfaceKinetics::finalize",
throw CanteraError("InterfaceKinetics::init",
"expected interface dimension = 2, but got dimension = {}",
m_surf->nDim());
}
+1 -1
View File
@@ -136,7 +136,7 @@ void addReactions(Kinetics& kin, const AnyMap& phaseNode, const AnyMap& rootNode
} else if (rules[i] == "declared-species") {
kin.skipUndeclaredSpecies(true);
} else if (rules[i] != "none") {
throw InputFileError("setupKinetics", phaseNode.at("reactions"),
throw InputFileError("addReactions", phaseNode.at("reactions"),
"Unknown rule '{}' for adding species from the '{}' section.",
rules[i], sections[i]);
}
+2 -2
View File
@@ -483,11 +483,11 @@ void parseReactionEquation(Reaction& R, const AnyValue& equation,
try {
stoich = fpValueCheck(tokens[i-2]);
} catch (CanteraError& err) {
throw InputFileError("fpValueCheck", equation,
throw InputFileError("parseReactionEquation", equation,
err.getMessage());
}
} else {
throw InputFileError("setupReaction", equation,
throw InputFileError("parseReactionEquation", equation,
"Error parsing reaction string '{}'.\n"
"Current token: '{}'\nlast_used: '{}'",
equation.asString(), tokens[i],
+1 -1
View File
@@ -160,7 +160,7 @@ void IonFlow::setSolvingStage(const size_t stage)
if (stage == 1 || stage == 2) {
m_stage = stage;
} else {
throw CanteraError("IonFlow::updateDiffFluxes",
throw CanteraError("IonFlow::setSolvingStage",
"solution stage must be set to: "
"1) frozenIonMethod, "
"2) electricFieldEqnMethod");
+3 -3
View File
@@ -359,13 +359,13 @@ void IdealMolalSoln::initThermoXML(XML_Node& phaseNode, const std::string& id_)
MolalityVPSSTP::initThermoXML(phaseNode, id_);
if (id_.size() > 0 && phaseNode.id() != id_) {
throw CanteraError("IdealMolalSoln::initThermo",
throw CanteraError("IdealMolalSoln::initThermoXML",
"phasenode and Id are incompatible");
}
// Find the Thermo XML node
if (!phaseNode.hasChild("thermo")) {
throw CanteraError("IdealMolalSoln::initThermo",
throw CanteraError("IdealMolalSoln::initThermoXML",
"no thermo XML node");
}
XML_Node& thermoNode = phaseNode.child("thermo");
@@ -463,7 +463,7 @@ void IdealMolalSoln::setStandardConcentrationModel(const std::string& model)
|| caseInsensitiveEquals(model, "solvent_volume")) {
m_formGC = 2;
} else {
throw CanteraError("IdealSolnGasVPSS::setStandardConcentrationModel",
throw CanteraError("IdealMolalSoln::setStandardConcentrationModel",
"Unknown standard concentration model '{}'", model);
}
}
+2 -2
View File
@@ -372,7 +372,7 @@ bool IdealSolidSolnPhase::addSpecies(shared_ptr<Species> spec)
if (spec->input.hasKey("equation-of-state")) {
auto& eos = spec->input["equation-of-state"].as<AnyMap>();
if (eos.getString("model", "") != "constant-volume") {
throw CanteraError("IdealSolidSolnPhase::initThermo",
throw CanteraError("IdealSolidSolnPhase::addSpecies",
"ideal-condensed model requires constant-volume "
"species model for species '{}'", spec->name);
}
@@ -384,7 +384,7 @@ bool IdealSolidSolnPhase::addSpecies(shared_ptr<Species> spec)
} else if (eos.hasKey("molar-volume")) {
mv = eos.convert("molar-volume", "m^3/kmol");
} else {
throw CanteraError("IdealSolidSolnPhase::initThermo",
throw CanteraError("IdealSolidSolnPhase::addSpecies",
"equation-of-state entry for species '{}' is missing "
"'density', 'molar-volume', or 'molar-density' "
"specification", spec->name);
+4 -3
View File
@@ -37,8 +37,9 @@ IdealSolnGasVPSS::IdealSolnGasVPSS(const std::string& infile, std::string id_) :
}
XML_Node* xphase = get_XML_NameID("phase", std::string("#")+id_, root);
if (!xphase) {
throw CanteraError("newPhase",
"Couldn't find phase named \"" + id_ + "\" in file, " + infile);
throw CanteraError("IdealSolnGasVPSS::IdealSolnGasVPSS",
"Couldn't find phase named '{} in file '{}'",
id_, infile);
}
importPhase(*xphase, this);
}
@@ -323,7 +324,7 @@ void IdealSolnGasVPSS::setParametersFromXML(const XML_Node& thermoNode)
} else if (model == "IdealSolnVPSS") {
setSolnMode();
} else {
throw CanteraError("IdealSolnGasVPSS::initThermoXML",
throw CanteraError("IdealSolnGasVPSS::setParametersFromXML",
"Unknown thermo model : " + model);
}
}
+20 -23
View File
@@ -150,14 +150,11 @@ void IonsFromNeutralVPSSTP::getChemPotentials(doublereal* mu) const
break;
case cIonSolnType_SINGLECATION:
throw CanteraError("eosType", "Unknown type");
break;
throw CanteraError("IonsFromNeutralVPSSTP::getChemPotentials", "Unknown type");
case cIonSolnType_MULTICATIONANION:
throw CanteraError("eosType", "Unknown type");
break;
throw CanteraError("IonsFromNeutralVPSSTP::getChemPotentials", "Unknown type");
default:
throw CanteraError("eosType", "Unknown type");
break;
throw CanteraError("IonsFromNeutralVPSSTP::getChemPotentials", "Unknown type");
}
}
@@ -646,14 +643,14 @@ void IonsFromNeutralVPSSTP::setParametersFromXML(const XML_Node& thermoNode)
GibbsExcessVPSSTP::setParametersFromXML(thermoNode);
// Find the Neutral Molecule Phase
if (!thermoNode.hasChild("neutralMoleculePhase")) {
throw CanteraError("IonsFromNeutralVPSSTP::initThermoXML",
throw CanteraError("IonsFromNeutralVPSSTP::setParametersFromXML",
"no neutralMoleculePhase XML node");
}
XML_Node& neutralMoleculeNode = thermoNode.child("neutralMoleculePhase");
XML_Node* neut_ptr = get_XML_Node(neutralMoleculeNode["datasrc"], 0);
if (!neut_ptr) {
throw CanteraError("IonsFromNeutralVPSSTP::initThermoXML",
throw CanteraError("IonsFromNeutralVPSSTP::setParametersFromXML",
"neut_ptr = 0");
}
@@ -748,13 +745,13 @@ void IonsFromNeutralVPSSTP::getdlnActCoeffds(const doublereal dTds, const double
break;
case cIonSolnType_SINGLECATION:
throw CanteraError("IonsFromNeutralVPSSTP::s_update_lnActCoeffds", "Unimplemented type");
throw CanteraError("IonsFromNeutralVPSSTP::getdlnActCoeffds", "Unimplemented type");
break;
case cIonSolnType_MULTICATIONANION:
throw CanteraError("IonsFromNeutralVPSSTP::s_update_lnActCoeffds", "Unimplemented type");
throw CanteraError("IonsFromNeutralVPSSTP::getdlnActCoeffds", "Unimplemented type");
break;
default:
throw CanteraError("IonsFromNeutralVPSSTP::s_update_lnActCoeffds", "Unimplemented type");
throw CanteraError("IonsFromNeutralVPSSTP::getdlnActCoeffds", "Unimplemented type");
break;
}
}
@@ -798,13 +795,13 @@ void IonsFromNeutralVPSSTP::s_update_dlnActCoeffdT() const
break;
case cIonSolnType_SINGLECATION:
throw CanteraError("IonsFromNeutralVPSSTP::s_update_lnActCoeffdT", "Unimplemented type");
throw CanteraError("IonsFromNeutralVPSSTP::s_update_dlnActCoeffdT", "Unimplemented type");
break;
case cIonSolnType_MULTICATIONANION:
throw CanteraError("IonsFromNeutralVPSSTP::s_update_lnActCoeffdT", "Unimplemented type");
throw CanteraError("IonsFromNeutralVPSSTP::s_update_dlnActCoeffdT", "Unimplemented type");
break;
default:
throw CanteraError("IonsFromNeutralVPSSTP::s_update_lnActCoeffdT", "Unimplemented type");
throw CanteraError("IonsFromNeutralVPSSTP::s_update_dlnActCoeffdT", "Unimplemented type");
break;
}
}
@@ -848,13 +845,13 @@ void IonsFromNeutralVPSSTP::s_update_dlnActCoeff_dlnX_diag() const
break;
case cIonSolnType_SINGLECATION:
throw CanteraError("IonsFromNeutralVPSSTP::s_update_lnActCoeff_dlnX_diag()", "Unimplemented type");
throw CanteraError("IonsFromNeutralVPSSTP::s_update_dlnActCoeff_dlnX_diag", "Unimplemented type");
break;
case cIonSolnType_MULTICATIONANION:
throw CanteraError("IonsFromNeutralVPSSTP::s_update_lnActCoeff_dlnX_diag()", "Unimplemented type");
throw CanteraError("IonsFromNeutralVPSSTP::s_update_dlnActCoeff_dlnX_diag", "Unimplemented type");
break;
default:
throw CanteraError("IonsFromNeutralVPSSTP::s_update_lnActCoeff_dlnX_diag()", "Unimplemented type");
throw CanteraError("IonsFromNeutralVPSSTP::s_update_dlnActCoeff_dlnX_diag", "Unimplemented type");
break;
}
}
@@ -898,13 +895,13 @@ void IonsFromNeutralVPSSTP::s_update_dlnActCoeff_dlnN_diag() const
break;
case cIonSolnType_SINGLECATION:
throw CanteraError("IonsFromNeutralVPSSTP::s_update_lnActCoeff_dlnN_diag()", "Unimplemented type");
throw CanteraError("IonsFromNeutralVPSSTP::s_update_dlnActCoeff_dlnN_diag", "Unimplemented type");
break;
case cIonSolnType_MULTICATIONANION:
throw CanteraError("IonsFromNeutralVPSSTP::s_update_lnActCoeff_dlnN_diag()", "Unimplemented type");
throw CanteraError("IonsFromNeutralVPSSTP::s_update_dlnActCoeff_dlnN_diag", "Unimplemented type");
break;
default:
throw CanteraError("IonsFromNeutralVPSSTP::s_update_lnActCoeff_dlnN_diag()", "Unimplemented type");
throw CanteraError("IonsFromNeutralVPSSTP::s_update_dlnActCoeff_dlnN_diag", "Unimplemented type");
break;
}
}
@@ -977,13 +974,13 @@ void IonsFromNeutralVPSSTP::s_update_dlnActCoeff_dlnN() const
break;
case cIonSolnType_SINGLECATION:
throw CanteraError("IonsFromNeutralVPSSTP::s_update_lnActCoeff_dlnN", "Unimplemented type");
throw CanteraError("IonsFromNeutralVPSSTP::s_update_dlnActCoeff_dlnN", "Unimplemented type");
break;
case cIonSolnType_MULTICATIONANION:
throw CanteraError("IonsFromNeutralVPSSTP::s_update_lnActCoeff_dlnN", "Unimplemented type");
throw CanteraError("IonsFromNeutralVPSSTP::s_update_dlnActCoeff_dlnN", "Unimplemented type");
break;
default:
throw CanteraError("IonsFromNeutralVPSSTP::s_update_lnActCoeff_dlnN", "Unimplemented type");
throw CanteraError("IonsFromNeutralVPSSTP::s_update_dlnActCoeff_dlnN", "Unimplemented type");
break;
}
}
+1 -1
View File
@@ -246,7 +246,7 @@ bool LatticePhase::addSpecies(shared_ptr<Species> spec)
if (spec->input.hasKey("equation-of-state")) {
auto& eos = spec->input["equation-of-state"].as<AnyMap>();
if (eos.getString("model", "") != "constant-volume") {
throw CanteraError("LatticePhase::initThermo",
throw CanteraError("LatticePhase::addSpecies",
"lattice model requires constant-volume species model "
"for species '{}'", spec->name);
}
+2 -2
View File
@@ -53,9 +53,9 @@ int MolalityVPSSTP::pHScale() const
void MolalityVPSSTP::setMoleFSolventMin(doublereal xmolSolventMIN)
{
if (xmolSolventMIN <= 0.0) {
throw CanteraError("MolalityVPSSTP::setSolute ", "trouble");
throw CanteraError("MolalityVPSSTP::setMoleFSolventMin ", "trouble");
} else if (xmolSolventMIN > 0.9) {
throw CanteraError("MolalityVPSSTP::setSolute ", "trouble");
throw CanteraError("MolalityVPSSTP::setMoleFSolventMin ", "trouble");
}
m_xmolSolventMIN = xmolSolventMIN;
}
+6 -6
View File
@@ -57,7 +57,8 @@ void Mu0Poly::setParameters(double h0, const std::map<double, double>& T_mu)
m_mu0_R_int.push_back(row.second / GasConstant);
}
if (iT298 == npos) {
throw CanteraError("Mu0Poly", "One temperature has to be 298.15");
throw CanteraError("Mu0Poly::setParameters",
"One temperature has to be 298.15");
}
// Resize according to the number of points
@@ -171,7 +172,7 @@ Mu0Poly* newMu0ThermoFromXML(const XML_Node& Mu0Node)
vector_fp cValues(numPoints);
const XML_Node* valNode_ptr = getByTitle(Mu0Node, "Mu0Values");
if (!valNode_ptr) {
throw CanteraError("installMu0ThermoFromXML", "missing Mu0Values");
throw CanteraError("newMu0ThermoFromXML", "missing Mu0Values");
}
getFloatArray(*valNode_ptr, cValues, true, "actEnergy");
@@ -182,18 +183,17 @@ Mu0Poly* newMu0ThermoFromXML(const XML_Node& Mu0Node)
dimensionlessMu0Values = true;
}
if (cValues.size() != numPoints) {
throw CanteraError("installMu0ThermoFromXML", "numPoints inconsistent");
throw CanteraError("newMu0ThermoFromXML", "numPoints inconsistent");
}
vector_fp cTemperatures(numPoints);
const XML_Node* tempNode_ptr = getByTitle(Mu0Node, "Mu0Temperatures");
if (!tempNode_ptr) {
throw CanteraError("installMu0ThermoFromXML",
"missing Mu0Temperatures");
throw CanteraError("newMu0ThermoFromXML", "missing Mu0Temperatures");
}
getFloatArray(*tempNode_ptr, cTemperatures, false);
if (cTemperatures.size() != numPoints) {
throw CanteraError("installMu0ThermoFromXML", "numPoints inconsistent");
throw CanteraError("newMu0ThermoFromXML", "numPoints inconsistent");
}
// Fix up dimensionless Mu0 values if input
+6 -4
View File
@@ -26,12 +26,14 @@ void PDSS_ConstVol::setParametersFromXML(const XML_Node& speciesNode)
const XML_Node* ss = speciesNode.findByName("standardState");
if (!ss) {
throw CanteraError("PDSS_ConstVol::constructPDSSXML",
"no standardState Node for species " + speciesNode.name());
throw CanteraError("PDSS_ConstVol::setParametersFromXML",
"no standardState Node for species '{}'",
speciesNode.name());
}
if (ss->attrib("model") != "constant_incompressible") {
throw CanteraError("PDSS_ConstVol::initThermoXML",
"standardState model for species isn't constant_incompressible: " + speciesNode.name());
throw CanteraError("PDSS_ConstVol::setParametersFromXML",
"standardState model for species '{}' isn't "
"'constant_incompressible'", speciesNode.name());
}
setMolarVolume(getFloat(*ss, "molarVolume", "toSI"));
+14 -13
View File
@@ -379,18 +379,18 @@ void PDSS_HKFT::setParametersFromXML(const XML_Node& speciesNode)
const XML_Node* tn = speciesNode.findByName("thermo");
if (!tn) {
throw CanteraError("PDSS_HKFT::constructPDSSXML",
"no thermo Node for species " + speciesNode.name());
throw CanteraError("PDSS_HKFT::setParametersFromXML",
"no thermo Node for species '{}'", speciesNode.name());
}
if (!caseInsensitiveEquals(tn->attrib("model"), "hkft")) {
throw CanteraError("PDSS_HKFT::initThermoXML",
"thermo model for species isn't hkft: "
+ speciesNode.name());
throw CanteraError("PDSS_HKFT::setParametersFromXML",
"thermo model for species '{}' isn't 'hkft'",
speciesNode.name());
}
const XML_Node* hh = tn->findByName("HKFT");
if (!hh) {
throw CanteraError("PDSS_HKFT::constructPDSSXML",
"no Thermo::HKFT Node for species " + speciesNode.name());
throw CanteraError("PDSS_HKFT::setParametersFromXML",
"no Thermo::HKFT Node for species '{}'", speciesNode.name());
}
// go get the attributes
@@ -427,13 +427,14 @@ void PDSS_HKFT::setParametersFromXML(const XML_Node& speciesNode)
const XML_Node* ss = speciesNode.findByName("standardState");
if (!ss) {
throw CanteraError("PDSS_HKFT::constructPDSSXML",
"no standardState Node for species " + speciesNode.name());
throw CanteraError("PDSS_HKFT::setParametersFromXML",
"no 'standardState' Node for species '{}'",
speciesNode.name());
}
if (!caseInsensitiveEquals(ss->attrib("model"), "hkft")) {
throw CanteraError("PDSS_HKFT::initThermoXML",
"standardState model for species isn't hkft: "
+ speciesNode.name());
throw CanteraError("PDSS_HKFT::setParametersFromXML",
"standardState model for species '{}' isn't 'hkft'",
speciesNode.name());
}
double a[4] = {getFloat(*ss, "a1", "toSI"), getFloat(*ss, "a2", "toSI"),
getFloat(*ss, "a3", "toSI"), getFloat(*ss, "a4", "toSI")};
@@ -446,7 +447,7 @@ void PDSS_HKFT::setParametersFromXML(const XML_Node& speciesNode)
int isum = hasDGO + hasDHO + hasSO;
if (isum < 2) {
throw CanteraError("PDSS_HKFT::constructPDSSXML",
throw CanteraError("PDSS_HKFT::setParametersFromXML",
"Missing 2 or more of DG0_f_Pr_Tr, DH0_f_Pr_Tr, or S0_f_Pr_Tr fields. "
"Need to supply at least two of these fields");
}
+8 -7
View File
@@ -44,18 +44,19 @@ void PDSS_IonsFromNeutral::setParametersFromXML(const XML_Node& speciesNode)
PDSS::setParametersFromXML(speciesNode);
const XML_Node* tn = speciesNode.findByName("thermo");
if (!tn) {
throw CanteraError("PDSS_IonsFromNeutral::constructPDSSXML",
"no thermo Node for species " + speciesNode.name());
throw CanteraError("PDSS_IonsFromNeutral::setParametersFromXML",
"no 'thermo' Node for species '{}'", speciesNode.name());
}
if (!caseInsensitiveEquals(tn->attrib("model"), "ionfromneutral")) {
throw CanteraError("PDSS_IonsFromNeutral::constructPDSSXML",
"thermo model for species isn't IonsFromNeutral: "
+ speciesNode.name());
throw CanteraError("PDSS_IonsFromNeutral::setParametersFromXML",
"thermo model for species '{}' isn't 'IonsFromNeutral'",
speciesNode.name());
}
const XML_Node* nsm = tn->findByName("neutralSpeciesMultipliers");
if (!nsm) {
throw CanteraError("PDSS_IonsFromNeutral::constructPDSSXML",
"no Thermo::neutralSpeciesMultipliers Node for species " + speciesNode.name());
throw CanteraError("PDSS_IonsFromNeutral::setParametersFromXML",
"no 'Thermo::neutralSpeciesMultipliers' Node for species '{}'",
speciesNode.name());
}
for (auto& species_mult : parseCompString(nsm->value())) {
+7 -5
View File
@@ -28,23 +28,25 @@ void PDSS_SSVol::setParametersFromXML(const XML_Node& speciesNode)
const XML_Node* ss = speciesNode.findByName("standardState");
if (!ss) {
throw CanteraError("PDSS_SSVol::constructPDSSXML",
"no standardState Node for species " + speciesNode.name());
throw CanteraError("PDSS_SSVol::setParametersFromXML",
"no 'standardState' Node for species '{}'",
speciesNode.name());
}
std::string model = ss->attrib("model");
vector_fp coeffs;
getFloatArray(*ss, coeffs, true, "toSI", "volumeTemperaturePolynomial");
if (coeffs.size() != 4) {
throw CanteraError("PDSS_SSVol::setParametersFromXML",
" Didn't get 4 density polynomial numbers for species " + speciesNode.name());
"Didn't get 4 density polynomial numbers for species '{}'",
speciesNode.name());
}
if (model == "temperature_polynomial") {
setVolumePolynomial(coeffs.data());
} else if (model == "density_temperature_polynomial") {
setDensityPolynomial(coeffs.data());
} else {
throw CanteraError("PDSS_SSVol::constructPDSSXML",
"Unknown standardState model '{}'' for species '{}'",
throw CanteraError("PDSS_SSVol::setParametersFromXML",
"Unknown 'standardState' model '{}' for species '{}'",
model, speciesNode.name());
}
}
+1 -1
View File
@@ -892,7 +892,7 @@ shared_ptr<Species> Phase::species(const std::string& name) const
if (k != npos) {
return m_species.at(speciesName(k));
} else {
throw CanteraError("Phase::setMassFractionsByName",
throw CanteraError("Phase::species",
"Unknown species '{}'", name);
}
}
+4 -4
View File
@@ -731,12 +731,12 @@ vector<double> RedlichKwongMFTP::getCoeff(const std::string& iName)
}
if (vParams <= 0.0) //Assuming that Pc and Tc are non zero.
{
throw CanteraError("RedlichKwongMFTP::GetCoeff",
throw CanteraError("RedlichKwongMFTP::getCoeff",
"Critical Temperature must be positive ");
}
T_crit = vParams;
} else {
throw CanteraError("RedlichKwongMFTP::GetCoeff",
throw CanteraError("RedlichKwongMFTP::getCoeff",
"Critical Temperature not in database ");
}
if (acNodeDoc.hasChild("Pc")) {
@@ -749,12 +749,12 @@ vector<double> RedlichKwongMFTP::getCoeff(const std::string& iName)
}
if (vParams <= 0.0) //Assuming that Pc and Tc are non zero.
{
throw CanteraError("RedlichKwongMFTP::GetCoeff",
throw CanteraError("RedlichKwongMFTP::getCoeff",
"Critical Pressure must be positive ");
}
P_crit = vParams;
} else {
throw CanteraError("RedlichKwongMFTP::GetCoeff",
throw CanteraError("RedlichKwongMFTP::getCoeff",
"Critical Pressure not in database ");
}
+5 -5
View File
@@ -133,7 +133,7 @@ static SpeciesThermoInterpType* newNasaThermoFromXML(vector<XML_Node*> nodes)
getFloatArray(nodes[1]->child("floatArray"), c0, false);
getFloatArray(f0.child("floatArray"), c1, false);
} else {
throw CanteraError("installNasaThermo",
throw CanteraError("newNasaThermoFromXML",
"non-continuous temperature ranges.");
}
@@ -218,7 +218,7 @@ static SpeciesThermoInterpType* newShomateThermoFromXML(
} else {
if(c0.size() != 7)
{
throw CanteraError("installShomateThermoFromXML",
throw CanteraError("newShomateThermoFromXML",
"Shomate thermo requires 7 coefficients in float array.");
}
c1.resize(7,0.0);
@@ -231,12 +231,12 @@ static SpeciesThermoInterpType* newShomateThermoFromXML(
getFloatArray(nodes[1]->child("floatArray"), c0, false);
getFloatArray(nodes[0]->child("floatArray"), c1, false);
} else {
throw CanteraError("installShomateThermoFromXML",
throw CanteraError("newShomateThermoFromXML",
"non-continuous temperature ranges.");
}
if(c0.size() != 7 || c1.size() != 7)
{
throw CanteraError("installShomateThermoFromXML",
throw CanteraError("newShomateThermoFromXML",
"Shomate thermo requires 7 coefficients in float array.");
}
vector_fp c(15);
@@ -331,7 +331,7 @@ static SpeciesThermoInterpType* newNasa9ThermoFromXML(
getFloatArray(fptr.child("floatArray"), cPoly, false);
if (cPoly.size() != 9) {
throw CanteraError("installNasa9ThermoFromXML",
throw CanteraError("newNasa9ThermoFromXML",
"Expected 9 coeff polynomial");
}
regionPtrs.push_back(new Nasa9Poly1(tmin, tmax, pref, &cPoly[0]));
+4 -4
View File
@@ -222,8 +222,8 @@ static void formSpeciesXMLNodeList(std::vector<XML_Node*> &spDataNodeList,
// Find the species in the database by name.
auto iter = speciesNodes.find(stemp);
if (iter == speciesNodes.end()) {
throw CanteraError("importPhase","no data for species, \""
+ stemp + "\"");
throw CanteraError("formSpeciesXMLNodeList",
"no data for species, \"{}\"", stemp);
}
spNamesList.push_back(stemp);
spDataNodeList.push_back(iter->second);
@@ -603,8 +603,8 @@ void installElements(Phase& th, const XML_Node& phaseNode)
e = dbe->findByAttr("name",enames[i]);
}
if (!e) {
throw CanteraError("addElementsFromXML","no data for element "
+enames[i]);
throw CanteraError("installElements", "no data for element '{}'",
enames[i]);
}
// Add the element
+2 -2
View File
@@ -142,10 +142,10 @@ doublereal WaterPropsIAPWS::density_const(doublereal pressure,
// relatively high -> convergence from above seems robust.
rhoguess = 1000.;
} else if (phase == WATER_UNSTABLELIQUID || phase == WATER_UNSTABLEGAS) {
throw CanteraError("WaterPropsIAPWS::density",
throw CanteraError("WaterPropsIAPWS::density_const",
"Unstable Branch finder is untested");
} else {
throw CanteraError("WaterPropsIAPWS::density",
throw CanteraError("WaterPropsIAPWS::density_const",
"unknown state: {}", phase);
}
}
+8 -7
View File
@@ -130,7 +130,7 @@ void WaterSSTP::getGibbs_RT(doublereal* grt) const
{
*grt = (m_sub.Gibbs() + EW_Offset) / RT() - SW_Offset / GasConstant;
if (!m_ready) {
throw CanteraError("waterSSTP::", "Phase not ready");
throw CanteraError("waterSSTP::getGibbs_RT", "Phase not ready");
}
}
@@ -138,7 +138,8 @@ void WaterSSTP::getStandardChemPotentials(doublereal* gss) const
{
*gss = (m_sub.Gibbs() + EW_Offset - SW_Offset*temperature());
if (!m_ready) {
throw CanteraError("waterSSTP::", "Phase not ready");
throw CanteraError("waterSSTP::getStandardChemPotentials",
"Phase not ready");
}
}
@@ -164,7 +165,7 @@ void WaterSSTP::getEnthalpy_RT_ref(doublereal* hrt) const
}
doublereal dd = m_sub.density(T, OneAtm, waterState, dens);
if (dd <= 0.0) {
throw CanteraError("setPressure", "error");
throw CanteraError("WaterSSTP::getEnthalpy_RT_ref", "error");
}
doublereal h = m_sub.enthalpy();
*hrt = (h + EW_Offset) / RT();
@@ -183,7 +184,7 @@ void WaterSSTP::getGibbs_RT_ref(doublereal* grt) const
}
doublereal dd = m_sub.density(T, OneAtm, waterState, dens);
if (dd <= 0.0) {
throw CanteraError("setPressure", "error");
throw CanteraError("WaterSSTP::getGibbs_RT_ref", "error");
}
m_sub.setState_TR(T, dd);
doublereal g = m_sub.Gibbs();
@@ -212,7 +213,7 @@ void WaterSSTP::getEntropy_R_ref(doublereal* sr) const
doublereal dd = m_sub.density(T, OneAtm, waterState, dens);
if (dd <= 0.0) {
throw CanteraError("setPressure", "error");
throw CanteraError("WaterSSTP::getEntropy_R_ref", "error");
}
m_sub.setState_TR(T, dd);
@@ -234,7 +235,7 @@ void WaterSSTP::getCp_R_ref(doublereal* cpr) const
doublereal dd = m_sub.density(T, OneAtm, waterState, dens);
m_sub.setState_TR(T, dd);
if (dd <= 0.0) {
throw CanteraError("setPressure", "error");
throw CanteraError("WaterSSTP::getCp_R_ref", "error");
}
doublereal cp = m_sub.cp();
*cpr = cp / GasConstant;
@@ -253,7 +254,7 @@ void WaterSSTP::getStandardVolumes_ref(doublereal* vol) const
}
doublereal dd = m_sub.density(T, OneAtm, waterState, dens);
if (dd <= 0.0) {
throw CanteraError("setPressure", "error");
throw CanteraError("WaterSSTP::getStandardVolumes_ref", "error");
}
*vol = meanMolecularWeight() /dd;
dd = m_sub.density(T, p, waterState, dens);
+1 -1
View File
@@ -167,7 +167,7 @@ void GasTransport::getBinaryDiffCoeffs(const size_t ld, doublereal* const d)
updateDiff_T();
}
if (ld < m_nsp) {
throw CanteraError(" MixTransport::getBinaryDiffCoeffs()", "ld is too small");
throw CanteraError("GasTransport::getBinaryDiffCoeffs", "ld is too small");
}
doublereal rp = 1.0/m_thermo->pressure();
for (size_t i = 0; i < m_nsp; i++) {
+3 -2
View File
@@ -148,7 +148,8 @@ void HighPressureGasTransport::getBinaryDiffCoeffs(const size_t ld, doublereal*
updateDiff_T();
//}
if (ld < nsp) {
throw CanteraError("HighPressureTransport::getBinaryDiffCoeffs()", "ld is too small");
throw CanteraError("HighPressureGasTransport::getBinaryDiffCoeffs",
"ld is too small");
}
doublereal rp = 1.0/m_thermo->pressure();
for (size_t i = 0; i < nsp; i++) {
@@ -215,7 +216,7 @@ void HighPressureGasTransport::getMultiDiffCoeffs(const size_t ld, doublereal* c
updateDiff_T();
if (ld < m_nsp) {
throw CanteraError("HighPressureTransport::getMultiDiffCoeffs()",
throw CanteraError("HighPressureGasTransport::getMultiDiffCoeffs",
"ld is too small");
}
for (size_t i = 0; i < m_nsp; i++) {
+2 -2
View File
@@ -441,7 +441,7 @@ void Reactor::resetSensitivity(double* params)
void Reactor::setAdvanceLimits(const double *limits)
{
if (m_thermo == 0) {
throw CanteraError("getState",
throw CanteraError("Reactor::setAdvanceLimits",
"Error: reactor is empty.");
}
m_advancelimits.assign(limits, limits + m_nv);
@@ -469,7 +469,7 @@ void Reactor::setAdvanceLimit(const string& nm, const double limit)
size_t k = componentIndex(nm);
if (m_thermo == 0) {
throw CanteraError("getState",
throw CanteraError("Reactor::setAdvanceLimit",
"Error: reactor is empty.");
}
if (m_nv == 0) {
@@ -43,7 +43,7 @@ void testProblem()
XML_Node* xc = get_XML_File("ReactionSurf.xml");
XML_Node* xg = xc->findNameID("phase", "reaction_surface");
if (!xg) {
throw CanteraError("couldn't find file", "");
throw CanteraError("testProblem", "couldn't find file");
}
unique_ptr<ThermoPhase> surfTP(newPhase(*xg));
unique_ptr<ThermoPhase> gasTP(newPhase("gas.xml"));