Use cppformat instead of int2str and fp2str
This commit is contained in:
parent
78e2d13da7
commit
3f6d8b0aca
52 changed files with 196 additions and 239 deletions
|
|
@ -366,12 +366,12 @@ size_t getFloatArray(const XML_Node& node, vector_fp & v,
|
||||||
}
|
}
|
||||||
doublereal vv = v.back();
|
doublereal vv = v.back();
|
||||||
if (vmin != Undef && vv < vmin - Tiny) {
|
if (vmin != Undef && vv < vmin - Tiny) {
|
||||||
writelog("\nWarning: value "+fp2str(vv)+
|
writelog("\nWarning: value {} is below lower limit of {}.\n",
|
||||||
" is below lower limit of " +fp2str(vmin)+".\n");
|
vv, vmin);
|
||||||
}
|
}
|
||||||
if (vmax != Undef && vv > vmax + Tiny) {
|
if (vmax != Undef && vv > vmax + Tiny) {
|
||||||
writelog("\nWarning: value "+fp2str(vv)+
|
writelog("\nWarning: value {} is above upper limit of {}.\n",
|
||||||
" is above upper limit of " +fp2str(vmin)+".\n");
|
vv, vmax);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (size_t n = 0; n < v.size(); n++) {
|
for (size_t n = 0; n < v.size(); n++) {
|
||||||
|
|
|
||||||
|
|
@ -141,7 +141,7 @@ public:
|
||||||
if (n < data.size()) {
|
if (n < data.size()) {
|
||||||
return *data[n];
|
return *data[n];
|
||||||
} else {
|
} else {
|
||||||
throw Cantera::CanteraError("Cabinet::item","index out of range"+Cantera::int2str(n));
|
throw Cantera::CanteraError("Cabinet::item","index out of range {}", n);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -287,7 +287,7 @@ extern "C" {
|
||||||
// array not big enough
|
// array not big enough
|
||||||
if (n < nv) {
|
if (n < nv) {
|
||||||
throw CanteraError("ctml_getFloatArray",
|
throw CanteraError("ctml_getFloatArray",
|
||||||
"array must be dimensioned at least "+int2str(nv));
|
"array must be dimensioned at least {}", nv);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (size_t i = 0; i < nv; i++) {
|
for (size_t i = 0; i < nv; i++) {
|
||||||
|
|
|
||||||
|
|
@ -118,12 +118,9 @@ void ChemEquil::initialize(thermo_t& s)
|
||||||
// the element should be an electron... if it isn't
|
// the element should be an electron... if it isn't
|
||||||
// print a warning.
|
// print a warning.
|
||||||
if (ewt > 1.0e-3) {
|
if (ewt > 1.0e-3) {
|
||||||
writelog(string("WARNING: species "
|
writelog("WARNING: species {} has {} atoms of element {},"
|
||||||
+s.speciesName(k)
|
" but this element is not an electron.\n",
|
||||||
+" has "+fp2str(s.nAtoms(k,m))
|
s.speciesName(k), s.nAtoms(k,m), s.elementName(m));
|
||||||
+" atoms of element "
|
|
||||||
+s.elementName(m)+
|
|
||||||
", but this element is not an electron.\n"));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -174,8 +171,8 @@ void ChemEquil::update(const thermo_t& s)
|
||||||
m_elementmolefracs[m] += nAtoms(k,m) * m_molefractions[k];
|
m_elementmolefracs[m] += nAtoms(k,m) * m_molefractions[k];
|
||||||
if (m_molefractions[k] < 0.0) {
|
if (m_molefractions[k] < 0.0) {
|
||||||
throw CanteraError("ChemEquil::update",
|
throw CanteraError("ChemEquil::update",
|
||||||
"negative mole fraction for "+s.speciesName(k)+
|
"negative mole fraction for {}: {}",
|
||||||
": "+fp2str(m_molefractions[k]));
|
s.speciesName(k), m_molefractions[k]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
sum += m_elementmolefracs[m];
|
sum += m_elementmolefracs[m];
|
||||||
|
|
@ -403,10 +400,9 @@ int ChemEquil::equilibrate(thermo_t& s, const char* XYstr,
|
||||||
if (tempFixed) {
|
if (tempFixed) {
|
||||||
double tfixed = s.temperature();
|
double tfixed = s.temperature();
|
||||||
if (tfixed > s.maxTemp() + 1.0 || tfixed < s.minTemp() - 1.0) {
|
if (tfixed > s.maxTemp() + 1.0 || tfixed < s.minTemp() - 1.0) {
|
||||||
throw CanteraError("ChemEquil","Specified temperature ("
|
throw CanteraError("ChemEquil::equilibrate", "Specified temperature"
|
||||||
+fp2str(s.temperature())+" K) outside "
|
" ({} K) outside valid range of {} K to {} K\n",
|
||||||
"valid range of "+fp2str(s.minTemp())+" K to "
|
s.temperature(), s.minTemp(), s.maxTemp());
|
||||||
+fp2str(s.maxTemp())+" K\n");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -670,10 +666,9 @@ int ChemEquil::equilibrate(thermo_t& s, const char* XYstr,
|
||||||
s.setElementPotentials(m_lambda);
|
s.setElementPotentials(m_lambda);
|
||||||
if (s.temperature() > s.maxTemp() + 1.0 ||
|
if (s.temperature() > s.maxTemp() + 1.0 ||
|
||||||
s.temperature() < s.minTemp() - 1.0) {
|
s.temperature() < s.minTemp() - 1.0) {
|
||||||
writelog("Warning: Temperature ("
|
writelog("Warning: Temperature ({} K) outside valid range of "
|
||||||
+fp2str(s.temperature())+" K) outside "
|
"{} K to {} K\n",
|
||||||
"valid range of "+fp2str(s.minTemp())+" K to "
|
s.temperature(), s.minTemp(), s.maxTemp());
|
||||||
+fp2str(s.maxTemp())+" K\n");
|
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
@ -770,9 +765,8 @@ int ChemEquil::equilibrate(thermo_t& s, const char* XYstr,
|
||||||
|
|
||||||
// no convergence
|
// no convergence
|
||||||
s.restoreState(state);
|
s.restoreState(state);
|
||||||
throw CanteraError("equilibrate",
|
throw CanteraError("ChemEquil::equilibrate",
|
||||||
"no convergence in "+int2str(options.maxIterations)
|
"no convergence in {} iterations.", options.maxIterations);
|
||||||
+" iterations.");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -751,7 +751,7 @@ void MultiPhase::equilibrate(const std::string& XY, const std::string& solver,
|
||||||
rtol, max_steps);
|
rtol, max_steps);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
throw CanteraError("MultiPhase::equilibrate",
|
throw CanteraError("MultiPhase::equilibrate",
|
||||||
"VCS solver failed. Return code: " + int2str(ret));
|
"VCS solver failed. Return code: {}", ret);
|
||||||
}
|
}
|
||||||
debuglog("VCS solver succeeded\n", log_level);
|
debuglog("VCS solver succeeded\n", log_level);
|
||||||
return;
|
return;
|
||||||
|
|
|
||||||
|
|
@ -179,8 +179,8 @@ doublereal MultiPhaseEquil::equilibrate(int XY, doublereal err,
|
||||||
}
|
}
|
||||||
if (i >= maxsteps) {
|
if (i >= maxsteps) {
|
||||||
throw CanteraError("MultiPhaseEquil::equilibrate",
|
throw CanteraError("MultiPhaseEquil::equilibrate",
|
||||||
"no convergence in " + int2str(maxsteps) +
|
"no convergence in {} iterations. Error = {}",
|
||||||
" iterations. Error = " + fp2str(error()));
|
maxsteps, error());
|
||||||
}
|
}
|
||||||
finish();
|
finish();
|
||||||
return error();
|
return error();
|
||||||
|
|
|
||||||
|
|
@ -55,7 +55,7 @@ int vcs_MultiPhaseEquil::equilibrate_TV(int XY, doublereal xtarget,
|
||||||
doublereal Vtarget = m_mix->volume();
|
doublereal Vtarget = m_mix->volume();
|
||||||
if ((XY != TV) && (XY != HV) && (XY != UV) && (XY != SV)) {
|
if ((XY != TV) && (XY != HV) && (XY != UV) && (XY != SV)) {
|
||||||
throw CanteraError("vcs_MultiPhaseEquil::equilibrate_TV",
|
throw CanteraError("vcs_MultiPhaseEquil::equilibrate_TV",
|
||||||
"Wrong XY flag:" + int2str(XY));
|
"Wrong XY flag: {}", XY);
|
||||||
}
|
}
|
||||||
int maxiter = 100;
|
int maxiter = 100;
|
||||||
int iSuccess = 0;
|
int iSuccess = 0;
|
||||||
|
|
@ -159,7 +159,7 @@ int vcs_MultiPhaseEquil::equilibrate_HP(doublereal Htarget,
|
||||||
int iSuccess;
|
int iSuccess;
|
||||||
if (XY != HP && XY != UP) {
|
if (XY != HP && XY != UP) {
|
||||||
throw CanteraError("vcs_MultiPhaseEquil::equilibrate_HP",
|
throw CanteraError("vcs_MultiPhaseEquil::equilibrate_HP",
|
||||||
"Wrong XP" + int2str(XY));
|
"Wrong XP", XY);
|
||||||
}
|
}
|
||||||
int strt = estimateEquil;
|
int strt = estimateEquil;
|
||||||
|
|
||||||
|
|
@ -907,7 +907,7 @@ int vcs_Cantera_to_vprob(MultiPhase* mphase, VCS_PROB* vprob)
|
||||||
vprob->mf[kT] = mphase->moleFraction(kT);
|
vprob->mf[kT] = mphase->moleFraction(kT);
|
||||||
} else {
|
} else {
|
||||||
throw CanteraError(" vcs_Cantera_to_vprob() ERROR",
|
throw CanteraError(" vcs_Cantera_to_vprob() ERROR",
|
||||||
"Unknown species type: " + int2str(vprob->SpeciesUnknownType[kT]));
|
"Unknown species type: {}", vprob->SpeciesUnknownType[kT]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
||||||
|
|
@ -397,8 +397,8 @@ void vcs_VolPhase::setMoleFractionsState(const double totalMoles,
|
||||||
if (m_totalMolesInert > 0.0) {
|
if (m_totalMolesInert > 0.0) {
|
||||||
if (m_totalMolesInert > v_totalMoles) {
|
if (m_totalMolesInert > v_totalMoles) {
|
||||||
throw CanteraError("vcs_VolPhase::setMolesFractionsState",
|
throw CanteraError("vcs_VolPhase::setMolesFractionsState",
|
||||||
"inerts greater than total: " + fp2str(v_totalMoles) + " " +
|
"inerts greater than total: {} {}",
|
||||||
fp2str(m_totalMolesInert));
|
v_totalMoles, m_totalMolesInert);
|
||||||
}
|
}
|
||||||
fractotal = 1.0 - m_totalMolesInert/v_totalMoles;
|
fractotal = 1.0 - m_totalMolesInert/v_totalMoles;
|
||||||
}
|
}
|
||||||
|
|
@ -518,8 +518,7 @@ void vcs_VolPhase::setMolesFromVCSCheck(const int vcsStateStatus,
|
||||||
Tcheck = v_totalMoles;
|
Tcheck = v_totalMoles;
|
||||||
} else {
|
} else {
|
||||||
throw CanteraError("vcs_VolPhase::setMolesFromVCSCheck",
|
throw CanteraError("vcs_VolPhase::setMolesFromVCSCheck",
|
||||||
"We have a consistency problem: " + fp2str(Tcheck) + " " +
|
"We have a consistency problem: {} {}", Tcheck, v_totalMoles);
|
||||||
fp2str(v_totalMoles));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -30,8 +30,7 @@ double VCS_SOLVE::vcs_nondim_Farad(int mu_units, double TKelvin) const
|
||||||
case VCS_UNITS_KELVIN:
|
case VCS_UNITS_KELVIN:
|
||||||
return ElectronCharge * Avogadro/ TKelvin;
|
return ElectronCharge * Avogadro/ TKelvin;
|
||||||
default:
|
default:
|
||||||
throw CanteraError("vcs_nondim_Farad",
|
throw CanteraError("vcs_nondim_Farad", "unknown units: {}", mu_units);
|
||||||
"unknown units: " + int2str(mu_units));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -52,8 +51,7 @@ double VCS_SOLVE::vcs_nondimMult_TP(int mu_units, double TKelvin) const
|
||||||
case VCS_UNITS_MKS:
|
case VCS_UNITS_MKS:
|
||||||
return TKelvin * GasConstant;
|
return TKelvin * GasConstant;
|
||||||
default:
|
default:
|
||||||
throw CanteraError("vcs_nondimMult_TP",
|
throw CanteraError("vcs_nondimMult_TP", "unknown units: {}", mu_units);
|
||||||
"unknown units: " + int2str(mu_units));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -101,8 +99,8 @@ void VCS_SOLVE::vcs_nondim_TP()
|
||||||
*/
|
*/
|
||||||
if (tmole_orig < 1.0E-200 || tmole_orig > 1.0E200) {
|
if (tmole_orig < 1.0E-200 || tmole_orig > 1.0E200) {
|
||||||
throw CanteraError("VCS_SOLVE::vcs_nondim_TP",
|
throw CanteraError("VCS_SOLVE::vcs_nondim_TP",
|
||||||
"Total input moles ," + fp2str(tmole_orig) +
|
"Total input moles, {} is outside the range handled by vcs.\n",
|
||||||
"is outside the range handled by vcs.\n");
|
tmole_orig);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Determine the scale of the problem
|
// Determine the scale of the problem
|
||||||
|
|
|
||||||
|
|
@ -638,9 +638,9 @@ int VCS_SOLVE::vcs_prob_specifyFully(const VCS_PROB* pub)
|
||||||
if (m_elemAbundancesGoal[i] != 0.0) {
|
if (m_elemAbundancesGoal[i] != 0.0) {
|
||||||
if (fabs(m_elemAbundancesGoal[i]) > 1.0E-9) {
|
if (fabs(m_elemAbundancesGoal[i]) > 1.0E-9) {
|
||||||
throw CanteraError("VCS_SOLVE::vcs_prob_specifyFully",
|
throw CanteraError("VCS_SOLVE::vcs_prob_specifyFully",
|
||||||
"Charge neutrality condition " + m_elementName[i] +
|
"Charge neutrality condition {} is signicantly "
|
||||||
" is signicantly nonzero, " + fp2str(m_elemAbundancesGoal[i]) +
|
"nonzero, {}. Giving up",
|
||||||
". Giving up");
|
m_elementName[i], m_elemAbundancesGoal[i]);
|
||||||
} else {
|
} else {
|
||||||
if (m_debug_print_lvl >= 2) {
|
if (m_debug_print_lvl >= 2) {
|
||||||
plogf("Charge neutrality condition %s not zero, %g. Setting it zero\n",
|
plogf("Charge neutrality condition %s not zero, %g. Setting it zero\n",
|
||||||
|
|
@ -896,16 +896,15 @@ int VCS_SOLVE::vcs_prob_update(VCS_PROB* pub)
|
||||||
double tmp = m_molNumSpecies_old[k1];
|
double tmp = m_molNumSpecies_old[k1];
|
||||||
if (! vcs_doubleEqual(pubPhase->electricPotential() , tmp)) {
|
if (! vcs_doubleEqual(pubPhase->electricPotential() , tmp)) {
|
||||||
throw CanteraError("VCS_SOLVE::vcs_prob_update",
|
throw CanteraError("VCS_SOLVE::vcs_prob_update",
|
||||||
"We have an inconsistency in voltage, " +
|
"We have an inconsistency in voltage, {} {}",
|
||||||
fp2str(pubPhase->electricPotential()) + " " +
|
pubPhase->electricPotential(), tmp);
|
||||||
fp2str(tmp));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! vcs_doubleEqual(pub->mf[kT], vPhase->molefraction(k))) {
|
if (! vcs_doubleEqual(pub->mf[kT], vPhase->molefraction(k))) {
|
||||||
throw CanteraError("VCS_SOLVE::vcs_prob_update",
|
throw CanteraError("VCS_SOLVE::vcs_prob_update",
|
||||||
"We have an inconsistency in mole fraction, " +
|
"We have an inconsistency in mole fraction, {} {}",
|
||||||
fp2str(pub->mf[kT]) + " " + fp2str(vPhase->molefraction(k)));
|
pub->mf[kT], vPhase->molefraction(k));
|
||||||
}
|
}
|
||||||
if (pubPhase->speciesUnknownType(k) != VCS_SPECIES_TYPE_INTERFACIALVOLTAGE) {
|
if (pubPhase->speciesUnknownType(k) != VCS_SPECIES_TYPE_INTERFACIALVOLTAGE) {
|
||||||
sumMoles += pub->w[kT];
|
sumMoles += pub->w[kT];
|
||||||
|
|
@ -913,8 +912,8 @@ int VCS_SOLVE::vcs_prob_update(VCS_PROB* pub)
|
||||||
}
|
}
|
||||||
if (! vcs_doubleEqual(sumMoles, vPhase->totalMoles())) {
|
if (! vcs_doubleEqual(sumMoles, vPhase->totalMoles())) {
|
||||||
throw CanteraError("VCS_SOLVE::vcs_prob_update",
|
throw CanteraError("VCS_SOLVE::vcs_prob_update",
|
||||||
"We have an inconsistency in total moles, " +
|
"We have an inconsistency in total moles, {} {}",
|
||||||
fp2str(sumMoles) + " " + fp2str(pubPhase->totalMoles()));
|
sumMoles, pubPhase->totalMoles());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1066,9 +1066,8 @@ void VCS_SOLVE::solve_tp_inner(size_t& iti, size_t& it1,
|
||||||
if (m_molNumSpecies_new[kspec] < 0.0 && (m_speciesUnknownType[kspec]
|
if (m_molNumSpecies_new[kspec] < 0.0 && (m_speciesUnknownType[kspec]
|
||||||
!= VCS_SPECIES_TYPE_INTERFACIALVOLTAGE)) {
|
!= VCS_SPECIES_TYPE_INTERFACIALVOLTAGE)) {
|
||||||
throw CanteraError("VCS_SOLVE::solve_tp_inner",
|
throw CanteraError("VCS_SOLVE::solve_tp_inner",
|
||||||
"vcs_solve_TP: ERROR on step change wt[" + int2str(kspec) + ":" +
|
"vcs_solve_TP: ERROR on step change wt[{}:{}]: {} < 0.0",
|
||||||
m_speciesName[kspec] + "]: " +
|
kspec, m_speciesName[kspec], m_molNumSpecies_new[kspec]);
|
||||||
fp2str(m_molNumSpecies_new[kspec]) + " < 0.0");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -3272,8 +3271,7 @@ void VCS_SOLVE::vcs_dfe(const int stateCalc,
|
||||||
molNum = &m_molNumSpecies_new[0];
|
molNum = &m_molNumSpecies_new[0];
|
||||||
} else if (DEBUG_MODE_ENABLED) {
|
} else if (DEBUG_MODE_ENABLED) {
|
||||||
throw CanteraError("VCS_SOLVE::vcs_dfe",
|
throw CanteraError("VCS_SOLVE::vcs_dfe",
|
||||||
"Subroutine vcs_dfe called with bad stateCalc value: "+
|
"Subroutine vcs_dfe called with bad stateCalc value: {}", stateCalc);
|
||||||
int2str(stateCalc));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
AssertThrowMsg(m_unitsState != VCS_DIMENSIONAL_G, "VCS_SOLVE::vcs_dfe",
|
AssertThrowMsg(m_unitsState != VCS_DIMENSIONAL_G, "VCS_SOLVE::vcs_dfe",
|
||||||
|
|
@ -3682,7 +3680,7 @@ void VCS_SOLVE::vcs_updateVP(const int vcsState)
|
||||||
&m_tPhaseMoles_new[0]);
|
&m_tPhaseMoles_new[0]);
|
||||||
} else if (DEBUG_MODE_ENABLED) {
|
} else if (DEBUG_MODE_ENABLED) {
|
||||||
throw CanteraError("VCS_SOLVE::vcs_updateVP",
|
throw CanteraError("VCS_SOLVE::vcs_updateVP",
|
||||||
"wrong stateCalc value: " + int2str(vcsState));
|
"wrong stateCalc value: {}", vcsState);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -3742,7 +3740,7 @@ bool VCS_SOLVE::vcs_evaluate_speciesType()
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
throw CanteraError("VCS_SOLVE::vcs_evaluate_speciesType",
|
throw CanteraError("VCS_SOLVE::vcs_evaluate_speciesType",
|
||||||
"Unknown type: " + int2str(m_speciesStatus[kspec]));
|
"Unknown type: {}", m_speciesStatus[kspec]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -73,8 +73,7 @@ double vcsUtil_gasConstant(int mu_units)
|
||||||
/* joules / kg-mol K = kg m2 / s2 kg-mol K */
|
/* joules / kg-mol K = kg m2 / s2 kg-mol K */
|
||||||
return GasConstant;
|
return GasConstant;
|
||||||
default:
|
default:
|
||||||
throw CanteraError("vcsUtil_gasConstant",
|
throw CanteraError("vcsUtil_gasConstant", "uknown units: {}", mu_units);
|
||||||
"uknown units: " + int2str(mu_units));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -154,7 +154,7 @@ bool AqueousKinetics::addReaction(shared_ptr<Reaction> r)
|
||||||
addElementaryReaction(dynamic_cast<ElementaryReaction&>(*r));
|
addElementaryReaction(dynamic_cast<ElementaryReaction&>(*r));
|
||||||
} else {
|
} else {
|
||||||
throw CanteraError("AqueousKinetics::addReaction",
|
throw CanteraError("AqueousKinetics::addReaction",
|
||||||
"Invalid reaction type: " + int2str(r->reaction_type));
|
"Invalid reaction type: {}", r->reaction_type);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -14,8 +14,8 @@ void Falloff::init(const vector_fp& c)
|
||||||
{
|
{
|
||||||
if (c.size() != 0) {
|
if (c.size() != 0) {
|
||||||
throw CanteraError("Falloff::init",
|
throw CanteraError("Falloff::init",
|
||||||
"Incorrect number of parameters. 0 required. Received " +
|
"Incorrect number of parameters. 0 required. Received {}.",
|
||||||
int2str(c.size()) + ".");
|
c.size());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -23,8 +23,8 @@ void Troe::init(const vector_fp& c)
|
||||||
{
|
{
|
||||||
if (c.size() != 3 && c.size() != 4) {
|
if (c.size() != 3 && c.size() != 4) {
|
||||||
throw CanteraError("Troe::init",
|
throw CanteraError("Troe::init",
|
||||||
"Incorrect number of parameters. 3 or 4 required. Received " +
|
"Incorrect number of parameters. 3 or 4 required. Received {}.",
|
||||||
int2str(c.size()) + ".");
|
c.size());
|
||||||
}
|
}
|
||||||
m_a = c[0];
|
m_a = c[0];
|
||||||
if (c[1] == 0.0) {
|
if (c[1] == 0.0) {
|
||||||
|
|
@ -73,13 +73,13 @@ void SRI::init(const vector_fp& c)
|
||||||
{
|
{
|
||||||
if (c.size() != 3 && c.size() != 5) {
|
if (c.size() != 3 && c.size() != 5) {
|
||||||
throw CanteraError("SRI::init",
|
throw CanteraError("SRI::init",
|
||||||
"Incorrect number of parameters. 3 or 5 required. Received " +
|
"Incorrect number of parameters. 3 or 5 required. Received {}.",
|
||||||
int2str(c.size()) + ".");
|
c.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (c[2] < 0.0) {
|
if (c[2] < 0.0) {
|
||||||
throw CanteraError("SRI::init()",
|
throw CanteraError("SRI::init()",
|
||||||
"m_c parameter is less than zero: " + fp2str(c[2]));
|
"m_c parameter is less than zero: {}", c[2]);
|
||||||
}
|
}
|
||||||
m_a = c[0];
|
m_a = c[0];
|
||||||
m_b = c[1];
|
m_b = c[1];
|
||||||
|
|
@ -88,7 +88,7 @@ void SRI::init(const vector_fp& c)
|
||||||
if (c.size() == 5) {
|
if (c.size() == 5) {
|
||||||
if (c[3] < 0.0) {
|
if (c[3] < 0.0) {
|
||||||
throw CanteraError("SRI::init()",
|
throw CanteraError("SRI::init()",
|
||||||
"m_d parameter is less than zero: " + fp2str(c[3]));
|
"m_d parameter is less than zero: {}", c[3]);
|
||||||
}
|
}
|
||||||
m_d = c[3];
|
m_d = c[3];
|
||||||
m_e = c[4];
|
m_e = c[4];
|
||||||
|
|
|
||||||
|
|
@ -264,7 +264,7 @@ bool GasKinetics::addReaction(shared_ptr<Reaction> r)
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
throw CanteraError("GasKinetics::addReaction",
|
throw CanteraError("GasKinetics::addReaction",
|
||||||
"Unknown reaction type specified: " + int2str(r->reaction_type));
|
"Unknown reaction type specified: {}", r->reaction_type);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
@ -356,7 +356,7 @@ void GasKinetics::modifyReaction(size_t i, shared_ptr<Reaction> rNew)
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
throw CanteraError("GasKinetics::modifyReaction",
|
throw CanteraError("GasKinetics::modifyReaction",
|
||||||
"Unknown reaction type specified: " + int2str(rNew->reaction_type));
|
"Unknown reaction type specified: {}", rNew->reaction_type);
|
||||||
}
|
}
|
||||||
|
|
||||||
// invalidate all cached data
|
// invalidate all cached data
|
||||||
|
|
|
||||||
|
|
@ -218,7 +218,7 @@ void InterfaceKinetics::updateKc()
|
||||||
for (size_t i = 0; i < m_nrev; i++) {
|
for (size_t i = 0; i < m_nrev; i++) {
|
||||||
size_t irxn = m_revindex[i];
|
size_t irxn = m_revindex[i];
|
||||||
if (irxn == npos || irxn >= nReactions()) {
|
if (irxn == npos || irxn >= nReactions()) {
|
||||||
throw CanteraError("InterfaceKinetics", "illegal value: irxn = "+int2str(irxn));
|
throw CanteraError("InterfaceKinetics", "illegal value: irxn = {}", irxn);
|
||||||
}
|
}
|
||||||
// WARNING this may overflow HKM
|
// WARNING this may overflow HKM
|
||||||
m_rkcn[irxn] = exp(m_rkcn[irxn]*rrt);
|
m_rkcn[irxn] = exp(m_rkcn[irxn]*rrt);
|
||||||
|
|
@ -892,8 +892,8 @@ void InterfaceKinetics::finalize()
|
||||||
m_surf = (SurfPhase*)&thermo(ks);
|
m_surf = (SurfPhase*)&thermo(ks);
|
||||||
if (m_surf->nDim() != 2) {
|
if (m_surf->nDim() != 2) {
|
||||||
throw CanteraError("InterfaceKinetics::finalize",
|
throw CanteraError("InterfaceKinetics::finalize",
|
||||||
"expected interface dimension = 2, but got dimension = "
|
"expected interface dimension = 2, but got dimension = {}",
|
||||||
+int2str(m_surf->nDim()));
|
m_surf->nDim());
|
||||||
}
|
}
|
||||||
m_StandardConc.resize(m_kk, 0.0);
|
m_StandardConc.resize(m_kk, 0.0);
|
||||||
m_deltaG0.resize(nReactions(), 0.0);
|
m_deltaG0.resize(nReactions(), 0.0);
|
||||||
|
|
@ -1077,8 +1077,8 @@ void EdgeKinetics::finalize()
|
||||||
m_surf = (SurfPhase*)&thermo(ks);
|
m_surf = (SurfPhase*)&thermo(ks);
|
||||||
if (m_surf->nDim() != 1) {
|
if (m_surf->nDim() != 1) {
|
||||||
throw CanteraError("EdgeKinetics::finalize",
|
throw CanteraError("EdgeKinetics::finalize",
|
||||||
"expected interface dimension = 1, but got dimension = "
|
"expected interface dimension = 1, but got dimension = {}",
|
||||||
+int2str(m_surf->nDim()));
|
m_surf->nDim());
|
||||||
}
|
}
|
||||||
m_StandardConc.resize(m_kk, 0.0);
|
m_StandardConc.resize(m_kk, 0.0);
|
||||||
m_deltaG0.resize(safe_reaction_size, 0.0);
|
m_deltaG0.resize(safe_reaction_size, 0.0);
|
||||||
|
|
|
||||||
|
|
@ -221,10 +221,10 @@ std::pair<size_t, size_t> Kinetics::checkDuplicates(bool throw_err) const
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (throw_err) {
|
if (throw_err) {
|
||||||
string msg = string("Undeclared duplicate reactions detected:\n")
|
throw CanteraError("installReaction",
|
||||||
+"Reaction "+int2str(i+1)+": "+other.equation()
|
"Undeclared duplicate reactions detected:\n"
|
||||||
+"\nReaction "+int2str(m+1)+": "+R.equation()+"\n";
|
"Reaction {}: {}\nReaction {}: {}\n",
|
||||||
throw CanteraError("installReaction", msg);
|
int2str(i+1), other.equation(), int2str(m+1), R.equation());
|
||||||
} else {
|
} else {
|
||||||
return make_pair(i,m);
|
return make_pair(i,m);
|
||||||
}
|
}
|
||||||
|
|
@ -304,8 +304,8 @@ void Kinetics::checkReactionBalance(const Reaction& R)
|
||||||
double elemdiff = fabs(balp[elem] - balr[elem]);
|
double elemdiff = fabs(balp[elem] - balr[elem]);
|
||||||
if (elemsum > 0.0 && elemdiff/elemsum > 1e-4) {
|
if (elemsum > 0.0 && elemdiff/elemsum > 1e-4) {
|
||||||
ok = false;
|
ok = false;
|
||||||
msg += " " + elem + " " + fp2str(balr[elem]) +
|
msg += fmt::format(" {} {} {}\n",
|
||||||
" " + fp2str(balp[elem]) + "\n";
|
elem, balr[elem], balp[elem]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!ok) {
|
if (!ok) {
|
||||||
|
|
@ -394,7 +394,7 @@ size_t Kinetics::speciesPhaseIndex(size_t k)
|
||||||
return n;
|
return n;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
throw CanteraError("speciesPhaseIndex", "illegal species index: "+int2str(k));
|
throw CanteraError("speciesPhaseIndex", "illegal species index: {}", k);
|
||||||
return npos;
|
return npos;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -632,20 +632,20 @@ void Kinetics::modifyReaction(size_t i, shared_ptr<Reaction> rNew)
|
||||||
shared_ptr<Reaction>& rOld = m_reactions[i];
|
shared_ptr<Reaction>& rOld = m_reactions[i];
|
||||||
if (rNew->reaction_type != rOld->reaction_type) {
|
if (rNew->reaction_type != rOld->reaction_type) {
|
||||||
throw CanteraError("Kinetics::modifyReaction",
|
throw CanteraError("Kinetics::modifyReaction",
|
||||||
"Reaction types are different: " + int2str(rOld->reaction_type) +
|
"Reaction types are different: {} != {}.",
|
||||||
" != " + int2str(rNew->reaction_type) + ".");
|
rOld->reaction_type, rNew->reaction_type);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (rNew->reactants != rOld->reactants) {
|
if (rNew->reactants != rOld->reactants) {
|
||||||
throw CanteraError("Kinetics::modifyReaction",
|
throw CanteraError("Kinetics::modifyReaction",
|
||||||
"Reactants are different: '" + rOld->reactantString() + "' != '" +
|
"Reactants are different: '{}' != '{}'.",
|
||||||
rNew->reactantString() + "'.");
|
rOld->reactantString(), rNew->reactantString());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (rNew->products != rOld->products) {
|
if (rNew->products != rOld->products) {
|
||||||
throw CanteraError("Kinetics::modifyReaction",
|
throw CanteraError("Kinetics::modifyReaction",
|
||||||
"Products are different: '" + rOld->productString() + "' != '" +
|
"Products are different: '{}' != '{}'.",
|
||||||
rNew->productString() + "'.");
|
rOld->productString(), rNew->productString());
|
||||||
}
|
}
|
||||||
m_reactions[i] = rNew;
|
m_reactions[i] = rNew;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -293,23 +293,23 @@ void readFalloff(FalloffReaction& R, const XML_Node& rc_node)
|
||||||
falloff_type = SIMPLE_FALLOFF;
|
falloff_type = SIMPLE_FALLOFF;
|
||||||
if (np != 0) {
|
if (np != 0) {
|
||||||
throw CanteraError("readFalloff", "Lindemann parameterization "
|
throw CanteraError("readFalloff", "Lindemann parameterization "
|
||||||
"takes no parameters, but " + int2str(np) + "were given");
|
"takes no parameters, but {} were given", np);
|
||||||
}
|
}
|
||||||
} else if (lowercase(falloff["type"]) == "troe") {
|
} else if (lowercase(falloff["type"]) == "troe") {
|
||||||
falloff_type = TROE_FALLOFF;
|
falloff_type = TROE_FALLOFF;
|
||||||
if (np != 3 && np != 4) {
|
if (np != 3 && np != 4) {
|
||||||
throw CanteraError("readFalloff", "Troe parameterization takes "
|
throw CanteraError("readFalloff", "Troe parameterization takes "
|
||||||
"3 or 4 parameters, but " + int2str(np) + "were given");
|
"3 or 4 parameters, but {} were given", np);
|
||||||
}
|
}
|
||||||
} else if (lowercase(falloff["type"]) == "sri") {
|
} else if (lowercase(falloff["type"]) == "sri") {
|
||||||
falloff_type = SRI_FALLOFF;
|
falloff_type = SRI_FALLOFF;
|
||||||
if (np != 3 && np != 5) {
|
if (np != 3 && np != 5) {
|
||||||
throw CanteraError("readFalloff", "SRI parameterization takes "
|
throw CanteraError("readFalloff", "SRI parameterization takes "
|
||||||
"3 or 5 parameters, but " + int2str(np) + "were given");
|
"3 or 5 parameters, but {} were given", np);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
throw CanteraError("readFalloff", "Unrecognized falloff type: '" +
|
throw CanteraError("readFalloff", "Unrecognized falloff type: '{}'",
|
||||||
falloff["type"] + "'");
|
falloff["type"]);
|
||||||
}
|
}
|
||||||
R.falloff = newFalloff(falloff_type, falloff_parameters);
|
R.falloff = newFalloff(falloff_type, falloff_parameters);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -105,9 +105,8 @@ void Plog::validate(const std::string& equation)
|
||||||
// message will correctly indicate that the problematic rate
|
// message will correctly indicate that the problematic rate
|
||||||
// expression is at the higher of the adjacent pressures.
|
// expression is at the higher of the adjacent pressures.
|
||||||
throw CanteraError("Plog::validate",
|
throw CanteraError("Plog::validate",
|
||||||
"Invalid rate coefficient for reaction '" + equation +
|
"Invalid rate coefficient for reaction '{}'\nat P = {}, T = {}",
|
||||||
"'\nat P = " + fp2str(std::exp((++iter)->first)) +
|
equation, std::exp((++iter)->first), T[i]);
|
||||||
", T = " + fp2str(T[i]));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -787,7 +787,7 @@ void solveSP::print_header(int ioflag, int ifunc, doublereal time_scale,
|
||||||
writelogf(" for a total of %9.3e sec\n", time_scale);
|
writelogf(" for a total of %9.3e sec\n", time_scale);
|
||||||
} else {
|
} else {
|
||||||
throw CanteraError("solveSP::print_header",
|
throw CanteraError("solveSP::print_header",
|
||||||
"Unknown ifunc flag = " + int2str(ifunc));
|
"Unknown ifunc flag = {}", ifunc);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_bulkFunc == BULK_DEPOSITION) {
|
if (m_bulkFunc == BULK_DEPOSITION) {
|
||||||
|
|
@ -796,7 +796,7 @@ void solveSP::print_header(int ioflag, int ifunc, doublereal time_scale,
|
||||||
writelog(" Bulk Phases have fixed compositions\n");
|
writelog(" Bulk Phases have fixed compositions\n");
|
||||||
} else {
|
} else {
|
||||||
throw CanteraError("solveSP::print_header",
|
throw CanteraError("solveSP::print_header",
|
||||||
"Unknown bulkFunc flag = " + int2str(m_bulkFunc));
|
"Unknown bulkFunc flag = {}", m_bulkFunc);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (damping) {
|
if (damping) {
|
||||||
|
|
|
||||||
|
|
@ -338,7 +338,7 @@ doublereal BandMatrix::rcond(doublereal a1norm)
|
||||||
writelogf("BandMatrix::rcond(): DGBCON returned INFO = %d\n", rinfo);
|
writelogf("BandMatrix::rcond(): DGBCON returned INFO = %d\n", rinfo);
|
||||||
}
|
}
|
||||||
if (! useReturnErrorCode) {
|
if (! useReturnErrorCode) {
|
||||||
throw CanteraError("BandMatrix::rcond()", "DGBCON returned INFO = " + int2str(rinfo));
|
throw CanteraError("BandMatrix::rcond()", "DGBCON returned INFO = {}", rinfo);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return rcond;
|
return rcond;
|
||||||
|
|
|
||||||
|
|
@ -40,9 +40,8 @@ doublereal polyfit(int n, doublereal* x, doublereal* y, doublereal* w,
|
||||||
&ierr, &awork[0]);
|
&ierr, &awork[0]);
|
||||||
if (ierr != 1) {
|
if (ierr != 1) {
|
||||||
throw CanteraError("polyfit",
|
throw CanteraError("polyfit",
|
||||||
"DPOLFT returned error code IERR = " + int2str(ierr) +
|
"DPOLFT returned error code IERR = {} while attempting to fit {}"
|
||||||
"while attempting to fit " + int2str(n) + " data points "
|
" data points to a polynomial of degree {}", ierr, n, maxdeg);
|
||||||
+ "to a polynomial of degree " + int2str(maxdeg));
|
|
||||||
}
|
}
|
||||||
ndeg = ndg;
|
ndeg = ndg;
|
||||||
_DPCOEF_(&ndg, &zer, r, &awork[0]);
|
_DPCOEF_(&ndg, &zer, r, &awork[0]);
|
||||||
|
|
|
||||||
|
|
@ -196,14 +196,11 @@ void MultiNewton::step(doublereal* x, doublereal* step,
|
||||||
size_t pt = offset/dom.nComponents();
|
size_t pt = offset/dom.nComponents();
|
||||||
size_t comp = offset - pt*dom.nComponents();
|
size_t comp = offset - pt*dom.nComponents();
|
||||||
throw CanteraError("MultiNewton::step",
|
throw CanteraError("MultiNewton::step",
|
||||||
"Jacobian is singular for domain "+
|
"Jacobian is singular for domain {}, component {} at point {}\n"
|
||||||
dom.id() + ", component "
|
"(Matrix row {}) \nsee file bandmatrix.csv\n",
|
||||||
+dom.componentName(comp)+" at point "
|
dom.id(), dom.componentName(comp), pt, iok);
|
||||||
+int2str(pt)+"\n(Matrix row "
|
|
||||||
+int2str(iok)+") \nsee file bandmatrix.csv\n");
|
|
||||||
} else if (int(iok) < 0) {
|
} else if (int(iok) < 0) {
|
||||||
throw CanteraError("MultiNewton::step",
|
throw CanteraError("MultiNewton::step", "iok = {}", iok);
|
||||||
"iok = "+int2str(iok));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -124,9 +124,8 @@ void Sim1D::restore(const std::string& fname, const std::string& id,
|
||||||
vector<XML_Node*> xd = f->getChildren("domain");
|
vector<XML_Node*> xd = f->getChildren("domain");
|
||||||
if (xd.size() != m_nd) {
|
if (xd.size() != m_nd) {
|
||||||
throw CanteraError("Sim1D::restore", "Solution does not contain the "
|
throw CanteraError("Sim1D::restore", "Solution does not contain the "
|
||||||
" correct number of domains. Found " +
|
" correct number of domains. Found {} expected {}.\n",
|
||||||
int2str(xd.size()) + "expected " +
|
xd.size(), m_nd);
|
||||||
int2str(m_nd) + ".\n");
|
|
||||||
}
|
}
|
||||||
size_t sz = 0;
|
size_t sz = 0;
|
||||||
for (size_t m = 0; m < m_nd; m++) {
|
for (size_t m = 0; m < m_nd; m++) {
|
||||||
|
|
@ -207,7 +206,7 @@ int Sim1D::newtonSolve(int loglevel)
|
||||||
return -1;
|
return -1;
|
||||||
} else {
|
} else {
|
||||||
throw CanteraError("Sim1D::newtonSolve",
|
throw CanteraError("Sim1D::newtonSolve",
|
||||||
"ERROR: OneDim::solve returned m = " + int2str(m) + "\n");
|
"ERROR: OneDim::solve returned m = {}", m);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -236,7 +235,7 @@ void Sim1D::solve(int loglevel, bool refine_grid)
|
||||||
writelog(" success.\n\n");
|
writelog(" success.\n\n");
|
||||||
writelog("Problem solved on [");
|
writelog("Problem solved on [");
|
||||||
for (size_t mm = 1; mm < nDomains(); mm+=2) {
|
for (size_t mm = 1; mm < nDomains(); mm+=2) {
|
||||||
writelog(int2str(domain(mm).nPoints()));
|
writelog("{}", domain(mm).nPoints());
|
||||||
if (mm + 2 < nDomains()) {
|
if (mm + 2 < nDomains()) {
|
||||||
writelog(", ");
|
writelog(", ");
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -754,9 +754,8 @@ void StFlow::restore(const XML_Node& dom, doublereal* soln, int loglevel)
|
||||||
m_do_energy[i] = x[i];
|
m_do_energy[i] = x[i];
|
||||||
}
|
}
|
||||||
} else if (!x.empty()) {
|
} else if (!x.empty()) {
|
||||||
throw CanteraError("StFlow::restore", "energy_enabled is length" +
|
throw CanteraError("StFlow::restore", "energy_enabled is length {}"
|
||||||
int2str(x.size()) + "but should be length" +
|
"but should be length {}", x.size(), nPoints());
|
||||||
int2str(nPoints()));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -770,9 +769,9 @@ void StFlow::restore(const XML_Node& dom, doublereal* soln, int loglevel)
|
||||||
// This may occur when restoring from a mechanism with a different
|
// This may occur when restoring from a mechanism with a different
|
||||||
// number of species.
|
// number of species.
|
||||||
if (loglevel > 0) {
|
if (loglevel > 0) {
|
||||||
writelog("\nWarning: StFlow::restore: species_enabled is length " +
|
writelog("\nWarning: StFlow::restore: species_enabled is "
|
||||||
int2str(x.size()) + " but should be length " +
|
"length {} but should be length {}. Enabling all species "
|
||||||
int2str(m_nsp) + ". Enabling all species equations by default.");
|
"equations by default.", x.size(), m_nsp);
|
||||||
}
|
}
|
||||||
m_do_species.assign(m_nsp, true);
|
m_do_species.assign(m_nsp, true);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -50,9 +50,8 @@ void Bdry1D::_init(size_t n)
|
||||||
m_phase_left = &m_flow_left->phase();
|
m_phase_left = &m_flow_left->phase();
|
||||||
} else {
|
} else {
|
||||||
throw CanteraError("Bdry1D::_init",
|
throw CanteraError("Bdry1D::_init",
|
||||||
"Boundary domains can only be "
|
"Boundary domains can only be connected on the left to flow "
|
||||||
"connected on the left to flow domains, not type "+int2str(r.domainType())
|
"domains, not type {} domains.", r.domainType());
|
||||||
+ " domains.");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -68,9 +67,8 @@ void Bdry1D::_init(size_t n)
|
||||||
m_phase_right = &m_flow_right->phase();
|
m_phase_right = &m_flow_right->phase();
|
||||||
} else {
|
} else {
|
||||||
throw CanteraError("Bdry1D::_init",
|
throw CanteraError("Bdry1D::_init",
|
||||||
"Boundary domains can only be "
|
"Boundary domains can only be connected on the right to flow "
|
||||||
"connected on the right to flow domains, not type "+int2str(r.domainType())
|
"domains, not type {} domains.", r.domainType());
|
||||||
+ " domains.");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -21,20 +21,17 @@ void Refiner::setCriteria(doublereal ratio, doublereal slope,
|
||||||
{
|
{
|
||||||
if (ratio < 2.0) {
|
if (ratio < 2.0) {
|
||||||
throw CanteraError("Refiner::setCriteria",
|
throw CanteraError("Refiner::setCriteria",
|
||||||
"'ratio' must be greater than 2.0 (" + fp2str(ratio) +
|
"'ratio' must be greater than 2.0 ({} was specified).", ratio);
|
||||||
" was specified).");
|
|
||||||
} else if (slope < 0.0 || slope > 1.0) {
|
} else if (slope < 0.0 || slope > 1.0) {
|
||||||
throw CanteraError("Refiner::setCriteria",
|
throw CanteraError("Refiner::setCriteria",
|
||||||
"'slope' must be between 0.0 and 1.0 (" + fp2str(slope) +
|
"'slope' must be between 0.0 and 1.0 ({} was specified).", slope);
|
||||||
" was specified).");
|
|
||||||
} else if (curve < 0.0 || curve > 1.0) {
|
} else if (curve < 0.0 || curve > 1.0) {
|
||||||
throw CanteraError("Refiner::setCriteria",
|
throw CanteraError("Refiner::setCriteria",
|
||||||
"'curve' must be between 0.0 and 1.0 (" + fp2str(curve) +
|
"'curve' must be between 0.0 and 1.0 ({} was specified).", curve);
|
||||||
" was specified).");
|
|
||||||
} else if (prune > curve || prune > slope) {
|
} else if (prune > curve || prune > slope) {
|
||||||
throw CanteraError("Refiner::setCriteria",
|
throw CanteraError("Refiner::setCriteria",
|
||||||
"'prune' must be less than 'curve' and 'slope' (" + fp2str(prune) +
|
"'prune' must be less than 'curve' and 'slope' ({} was specified).",
|
||||||
" was specified).");
|
prune);
|
||||||
}
|
}
|
||||||
m_ratio = ratio;
|
m_ratio = ratio;
|
||||||
m_slope = slope;
|
m_slope = slope;
|
||||||
|
|
@ -46,7 +43,7 @@ int Refiner::analyze(size_t n, const doublereal* z,
|
||||||
const doublereal* x)
|
const doublereal* x)
|
||||||
{
|
{
|
||||||
if (n >= m_npmax) {
|
if (n >= m_npmax) {
|
||||||
writelog("max number of grid points reached ("+int2str(m_npmax)+".\n");
|
writelog("max number of grid points reached ({}).\n", m_npmax);
|
||||||
return -2;
|
return -2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -214,7 +211,7 @@ void Refiner::show()
|
||||||
m_domain->id()+".\n"
|
m_domain->id()+".\n"
|
||||||
+" New points inserted after grid points ");
|
+" New points inserted after grid points ");
|
||||||
for (const auto& loc : m_loc) {
|
for (const auto& loc : m_loc) {
|
||||||
writelog(int2str(loc.first)+" ");
|
writelog("{} ", loc.first);
|
||||||
}
|
}
|
||||||
writelog("\n");
|
writelog("\n");
|
||||||
writelog(" to resolve ");
|
writelog(" to resolve ");
|
||||||
|
|
|
||||||
|
|
@ -192,7 +192,7 @@ double GibbsExcessVPSSTP::checkMFSum(const doublereal* const x) const
|
||||||
doublereal norm = std::accumulate(x, x + m_kk, 0.0);
|
doublereal norm = std::accumulate(x, x + m_kk, 0.0);
|
||||||
if (fabs(norm - 1.0) > 1.0E-9) {
|
if (fabs(norm - 1.0) > 1.0E-9) {
|
||||||
throw CanteraError("GibbsExcessVPSSTP::checkMFSum",
|
throw CanteraError("GibbsExcessVPSSTP::checkMFSum",
|
||||||
"(MF sum - 1) exceeded tolerance of 1.0E-9:" + fp2str(norm));
|
"(MF sum - 1) exceeded tolerance of 1.0E-9: {}", norm);
|
||||||
}
|
}
|
||||||
return norm;
|
return norm;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -519,7 +519,7 @@ void IonsFromNeutralVPSSTP::calcNeutralMoleculeMoleFractions() const
|
||||||
}
|
}
|
||||||
if (fabs(sum) > 1.0E-11) {
|
if (fabs(sum) > 1.0E-11) {
|
||||||
throw CanteraError("IonsFromNeutralVPSSTP::calcNeutralMoleculeMoleFractions",
|
throw CanteraError("IonsFromNeutralVPSSTP::calcNeutralMoleculeMoleFractions",
|
||||||
"molefracts don't sum to one: " + fp2str(sum));
|
"molefracts don't sum to one: {}", sum);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -608,7 +608,8 @@ void MargulesVPSSTP::readXMLBinarySpecies(XML_Node& xmLBinarySpecies)
|
||||||
// @TODO Figure out what the original reason is for putting an error condition for charged species
|
// @TODO Figure out what the original reason is for putting an error condition for charged species
|
||||||
// Seems OK to me.
|
// Seems OK to me.
|
||||||
if (charge(aSpecies) != 0.0) {
|
if (charge(aSpecies) != 0.0) {
|
||||||
throw CanteraError("MargulesVPSSTP::readXMLBinarySpecies", "speciesA has a charge: " + fp2str(charge(aSpecies)));
|
throw CanteraError("MargulesVPSSTP::readXMLBinarySpecies",
|
||||||
|
"speciesA has a charge: {}", charge(aSpecies));
|
||||||
}
|
}
|
||||||
size_t bSpecies = speciesIndex(bName);
|
size_t bSpecies = speciesIndex(bName);
|
||||||
if (bSpecies == npos) {
|
if (bSpecies == npos) {
|
||||||
|
|
@ -616,7 +617,8 @@ void MargulesVPSSTP::readXMLBinarySpecies(XML_Node& xmLBinarySpecies)
|
||||||
}
|
}
|
||||||
string bspName = speciesName(bSpecies);
|
string bspName = speciesName(bSpecies);
|
||||||
if (charge(bSpecies) != 0.0) {
|
if (charge(bSpecies) != 0.0) {
|
||||||
throw CanteraError("MargulesVPSSTP::readXMLBinarySpecies", "speciesB has a charge: " + fp2str(charge(bSpecies)));
|
throw CanteraError("MargulesVPSSTP::readXMLBinarySpecies",
|
||||||
|
"speciesB has a charge: {}", charge(bSpecies));
|
||||||
}
|
}
|
||||||
|
|
||||||
resizeNumInteractions(numBinaryInteractions_ + 1);
|
resizeNumInteractions(numBinaryInteractions_ + 1);
|
||||||
|
|
|
||||||
|
|
@ -283,8 +283,8 @@ void MineralEQ3::convertDGFormation()
|
||||||
// If the discrepancy is greater than 100 cal gmol-1, print an error
|
// If the discrepancy is greater than 100 cal gmol-1, print an error
|
||||||
if (fabs(Hcalc -DHjmol) > 10.* 1.0E6 * 4.184) {
|
if (fabs(Hcalc -DHjmol) > 10.* 1.0E6 * 4.184) {
|
||||||
throw CanteraError("installMinEQ3asShomateThermoFromXML()",
|
throw CanteraError("installMinEQ3asShomateThermoFromXML()",
|
||||||
"DHjmol is not consistent with G and S" +
|
"DHjmol is not consistent with G and S: {} vs {}",
|
||||||
fp2str(Hcalc) + " vs " + fp2str(DHjmol));
|
Hcalc, DHjmol);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -660,8 +660,8 @@ int MixtureFugacityTP::corr0(doublereal TKelvin, doublereal pres, doublereal& de
|
||||||
if (densGas <= 0.0) {
|
if (densGas <= 0.0) {
|
||||||
if (retn == -1) {
|
if (retn == -1) {
|
||||||
throw CanteraError("MixtureFugacityTP::corr0",
|
throw CanteraError("MixtureFugacityTP::corr0",
|
||||||
"Error occurred trying to find gas density at (T,P) = "
|
"Error occurred trying to find gas density at (T,P) = {} {}",
|
||||||
+ fp2str(TKelvin) + " " + fp2str(pres));
|
TKelvin, pres);
|
||||||
}
|
}
|
||||||
retn = -2;
|
retn = -2;
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
|
|
@ -84,7 +84,7 @@ void MolalityVPSSTP::setpHScale(const int pHscaleType)
|
||||||
m_pHScalingType = pHscaleType;
|
m_pHScalingType = pHscaleType;
|
||||||
if (pHscaleType != PHSCALE_PITZER && pHscaleType != PHSCALE_NBS) {
|
if (pHscaleType != PHSCALE_PITZER && pHscaleType != PHSCALE_NBS) {
|
||||||
throw CanteraError("MolalityVPSSTP::setpHScale",
|
throw CanteraError("MolalityVPSSTP::setpHScale",
|
||||||
"Unknown scale type: " + int2str(pHscaleType));
|
"Unknown scale type: {}", pHscaleType);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -13,37 +13,28 @@ void NasaPoly2::validate(const std::string& name)
|
||||||
|
|
||||||
double delta = cp_low - cp_high;
|
double delta = cp_low - cp_high;
|
||||||
if (fabs(delta/(fabs(cp_low)+1.0E-4)) > 0.001) {
|
if (fabs(delta/(fabs(cp_low)+1.0E-4)) > 0.001) {
|
||||||
writelog("\n\n**** WARNING ****\nFor species "+name+
|
writelog("\n\n**** WARNING ****\nFor species {}, discontinuity"
|
||||||
", discontinuity in cp/R detected at Tmid = "
|
" in cp/R detected at Tmid = {}\n", name, m_midT);
|
||||||
+fp2str(m_midT)+"\n");
|
writelog("\tValue computed using low-temperature polynomial: {}\n", cp_low);
|
||||||
writelog("\tValue computed using low-temperature polynomial: "
|
writelog("\tValue computed using high-temperature polynomial: {}\n", cp_high);
|
||||||
+fp2str(cp_low)+".\n");
|
|
||||||
writelog("\tValue computed using high-temperature polynomial: "
|
|
||||||
+fp2str(cp_high)+".\n");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// enthalpy
|
// enthalpy
|
||||||
delta = h_low - h_high;
|
delta = h_low - h_high;
|
||||||
if (fabs(delta/(fabs(h_low)+cp_low*m_midT)) > 0.001) {
|
if (fabs(delta/(fabs(h_low)+cp_low*m_midT)) > 0.001) {
|
||||||
writelog("\n\n**** WARNING ****\nFor species "+name+
|
writelog("\n\n**** WARNING ****\nFor species {}, discontinuity"
|
||||||
", discontinuity in h/RT detected at Tmid = "
|
" in h/RT detected at Tmid = {}\n", name, m_midT);
|
||||||
+fp2str(m_midT)+"\n");
|
writelog("\tValue computed using low-temperature polynomial: {}\n", h_low);
|
||||||
writelog("\tValue computed using low-temperature polynomial: "
|
writelog("\tValue computed using high-temperature polynomial: {}\n", h_high);
|
||||||
+fp2str(h_low)+".\n");
|
|
||||||
writelog("\tValue computed using high-temperature polynomial: "
|
|
||||||
+fp2str(h_high)+".\n");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// entropy
|
// entropy
|
||||||
delta = s_low - s_high;
|
delta = s_low - s_high;
|
||||||
if (fabs(delta/(fabs(s_low)+cp_low)) > 0.001) {
|
if (fabs(delta/(fabs(s_low)+cp_low)) > 0.001) {
|
||||||
writelog("\n\n**** WARNING ****\nFor species "+name+
|
writelog("\n\n**** WARNING ****\nFor species {}, discontinuity"
|
||||||
", discontinuity in s/R detected at Tmid = "
|
" in s/R detected at Tmid = {}\n", name, m_midT);
|
||||||
+fp2str(m_midT)+"\n");
|
writelog("\tValue computed using low-temperature polynomial: {}\n", s_low);
|
||||||
writelog("\tValue computed using low-temperature polynomial: "
|
writelog("\tValue computed using high-temperature polynomial: {}\n", s_high);
|
||||||
+fp2str(s_low)+".\n");
|
|
||||||
writelog("\tValue computed using high-temperature polynomial: "
|
|
||||||
+fp2str(s_high)+".\n");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -430,16 +430,14 @@ void PDSS_HKFT::initThermo()
|
||||||
if (fabs(Hcalc -DHjmol) > 100.* 1.0E3 * 4.184) {
|
if (fabs(Hcalc -DHjmol) > 100.* 1.0E3 * 4.184) {
|
||||||
std::string sname = m_tp->speciesName(m_spindex);
|
std::string sname = m_tp->speciesName(m_spindex);
|
||||||
if (s_InputInconsistencyErrorExit) {
|
if (s_InputInconsistencyErrorExit) {
|
||||||
throw CanteraError(" PDSS_HKFT::initThermo() for " + sname,
|
throw CanteraError("PDSS_HKFT::initThermo()", "For {}, DHjmol is"
|
||||||
"DHjmol is not consistent with G and S: " +
|
" not consistent with G and S: {} vs {} cal gmol-1",
|
||||||
fp2str(Hcalc/(4.184E3)) + " vs "
|
sname, Hcalc/4.184E3, m_deltaH_formation_tr_pr);
|
||||||
+ fp2str(m_deltaH_formation_tr_pr) + "cal gmol-1");
|
|
||||||
} else {
|
} else {
|
||||||
writelog(" PDSS_HKFT::initThermo() WARNING: "
|
writelog("PDSS_HKFT::initThermo() WARNING: DHjmol for {} is not"
|
||||||
"DHjmol for " + sname + " is not consistent with G and S: calculated " +
|
" consistent with G and S: calculated {} vs input {} cal gmol-1",
|
||||||
fp2str(Hcalc/(4.184E3)) + " vs input "
|
sname, Hcalc/4.184E3, m_deltaH_formation_tr_pr);
|
||||||
+ fp2str(m_deltaH_formation_tr_pr) + "cal gmol-1");
|
writelog(" : continuing with consistent DHjmol = {}", Hcalc/4.184E3);
|
||||||
writelog(" : continuing with consistent DHjmol = " + fp2str(Hcalc/(4.184E3)));
|
|
||||||
m_deltaH_formation_tr_pr = Hcalc / (1.0E3 * 4.184);
|
m_deltaH_formation_tr_pr = Hcalc / (1.0E3 * 4.184);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -310,10 +310,8 @@ void PDSS_Water::setPressure(doublereal p)
|
||||||
|
|
||||||
doublereal dd = m_sub.density(T, p, waterState, dens);
|
doublereal dd = m_sub.density(T, p, waterState, dens);
|
||||||
if (dd <= 0.0) {
|
if (dd <= 0.0) {
|
||||||
std::string stateString = "T = " +
|
|
||||||
fp2str(T) + " K and p = " + fp2str(p) + " Pa";
|
|
||||||
throw CanteraError("PDSS_Water:setPressure()",
|
throw CanteraError("PDSS_Water:setPressure()",
|
||||||
"Failed to set water SS state: " + stateString);
|
"Failed to set water SS state: T = {} K and p = {} Pa", T, p);
|
||||||
}
|
}
|
||||||
m_dens = dd;
|
m_dens = dd;
|
||||||
m_pres = p;
|
m_pres = p;
|
||||||
|
|
@ -339,7 +337,7 @@ doublereal PDSS_Water::dthermalExpansionCoeffdT() const
|
||||||
doublereal dd = m_sub.density(tt, pres, m_iState, m_dens);
|
doublereal dd = m_sub.density(tt, pres, m_iState, m_dens);
|
||||||
if (dd < 0.0) {
|
if (dd < 0.0) {
|
||||||
throw CanteraError("PDSS_Water::dthermalExpansionCoeffdT",
|
throw CanteraError("PDSS_Water::dthermalExpansionCoeffdT",
|
||||||
"unable to solve for the density at T = " + fp2str(tt) + ", P = " + fp2str(pres));
|
"unable to solve for the density at T = {}, P = {}", tt, pres);
|
||||||
}
|
}
|
||||||
doublereal vald = m_sub.coeffThermExp();
|
doublereal vald = m_sub.coeffThermExp();
|
||||||
m_sub.setState_TR(m_temp, dens_save);
|
m_sub.setState_TR(m_temp, dens_save);
|
||||||
|
|
|
||||||
|
|
@ -1289,10 +1289,9 @@ int RedlichKwongMFTP::NicholsSolve(double TKelvin, double pres, doublereal a, do
|
||||||
if (fabs(tmp) > 1.0E-4) {
|
if (fabs(tmp) > 1.0E-4) {
|
||||||
for (int j = 0; j < 3; j++) {
|
for (int j = 0; j < 3; j++) {
|
||||||
if (j != i && fabs(Vroot[i] - Vroot[j]) < 1.0E-4 * (fabs(Vroot[i]) + fabs(Vroot[j]))) {
|
if (j != i && fabs(Vroot[i] - Vroot[j]) < 1.0E-4 * (fabs(Vroot[i]) + fabs(Vroot[j]))) {
|
||||||
writelog("RedlichKwongMFTP::NicholsSolve(T = " + fp2str(TKelvin) + ", p = " +
|
writelog("RedlichKwongMFTP::NicholsSolve(T = {}, p = {}):"
|
||||||
fp2str(pres) + "): WARNING roots have merged: " +
|
" WARNING roots have merged: {}, {}\n",
|
||||||
fp2str(Vroot[i]) + ", " + fp2str(Vroot[j]));
|
TKelvin, pres, Vroot[i], Vroot[j]);
|
||||||
writelogendl();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1351,8 +1350,8 @@ int RedlichKwongMFTP::NicholsSolve(double TKelvin, double pres, doublereal a, do
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ((fabs(res) > 1.0E-14) && (fabs(res) > 1.0E-14 * fabs(dresdV) * fabs(Vroot[i]))) {
|
if ((fabs(res) > 1.0E-14) && (fabs(res) > 1.0E-14 * fabs(dresdV) * fabs(Vroot[i]))) {
|
||||||
writelog("RedlichKwongMFTP::NicholsSolve(T = " + fp2str(TKelvin) + ", p = " +
|
writelog("RedlichKwongMFTP::NicholsSolve(T = {}, p = {}): "
|
||||||
fp2str(pres) + "): WARNING root didn't converge V = " + fp2str(Vroot[i]));
|
"WARNING root didn't converge V = {}", TKelvin, pres, Vroot[i]);
|
||||||
writelogendl();
|
writelogendl();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -240,7 +240,7 @@ void SingleSpeciesTP::setState_HP(doublereal h, doublereal p,
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
throw CanteraError("setState_HP","no convergence. dt = " + fp2str(dt));
|
throw CanteraError("setState_HP","no convergence. dt = {}", dt);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SingleSpeciesTP::setState_UV(doublereal u, doublereal v,
|
void SingleSpeciesTP::setState_UV(doublereal u, doublereal v,
|
||||||
|
|
@ -259,9 +259,8 @@ void SingleSpeciesTP::setState_UV(doublereal u, doublereal v,
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
throw CanteraError("setState_UV",
|
throw CanteraError("setState_UV", "no convergence. dt = {}\n"
|
||||||
"no convergence. dt = " + fp2str(dt)+"\n"
|
"u = {} v = {}\n", dt, u, v);
|
||||||
+"u = "+fp2str(u)+" v = "+fp2str(v)+"\n");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void SingleSpeciesTP::setState_SP(doublereal s, doublereal p,
|
void SingleSpeciesTP::setState_SP(doublereal s, doublereal p,
|
||||||
|
|
@ -276,7 +275,7 @@ void SingleSpeciesTP::setState_SP(doublereal s, doublereal p,
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
throw CanteraError("setState_SP","no convergence. dt = " + fp2str(dt));
|
throw CanteraError("setState_SP","no convergence. dt = {}", dt);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SingleSpeciesTP::setState_SV(doublereal s, doublereal v,
|
void SingleSpeciesTP::setState_SV(doublereal s, doublereal v,
|
||||||
|
|
@ -295,7 +294,7 @@ void SingleSpeciesTP::setState_SV(doublereal s, doublereal v,
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
throw CanteraError("setState_SV","no convergence. dt = " + fp2str(dt));
|
throw CanteraError("setState_SV","no convergence. dt = {}", dt);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SingleSpeciesTP::initThermo()
|
void SingleSpeciesTP::initThermo()
|
||||||
|
|
|
||||||
|
|
@ -48,7 +48,7 @@ SpeciesThermoInterpType* newSpeciesThermoInterpType(int type, double tlow,
|
||||||
return new Adsorbate(tlow, thigh, pref, coeffs);
|
return new Adsorbate(tlow, thigh, pref, coeffs);
|
||||||
default:
|
default:
|
||||||
throw CanteraError("newSpeciesThermoInterpType",
|
throw CanteraError("newSpeciesThermoInterpType",
|
||||||
"Unknown species thermo type: " + int2str(type) + ".");
|
"Unknown species thermo type: {}.", type);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -254,7 +254,7 @@ void SurfPhase::setSiteDensity(doublereal n0)
|
||||||
{
|
{
|
||||||
if (n0 <= 0.0) {
|
if (n0 <= 0.0) {
|
||||||
throw CanteraError("SurfPhase::setSiteDensity",
|
throw CanteraError("SurfPhase::setSiteDensity",
|
||||||
"Site density must be positive. Got " + fp2str(n0));
|
"Site density must be positive. Got {}", n0);
|
||||||
}
|
}
|
||||||
m_n0 = n0;
|
m_n0 = n0;
|
||||||
m_logn0 = log(m_n0);
|
m_logn0 = log(m_n0);
|
||||||
|
|
|
||||||
|
|
@ -450,8 +450,8 @@ void importPhase(XML_Node& phase, ThermoPhase* th)
|
||||||
|
|
||||||
size_t nsp = spDataNodeList.size();
|
size_t nsp = spDataNodeList.size();
|
||||||
if (ssConvention == cSS_CONVENTION_SLAVE && nsp > 0) {
|
if (ssConvention == cSS_CONVENTION_SLAVE && nsp > 0) {
|
||||||
throw CanteraError("importPhase()", "For Slave standard states, number of species must be zero: "
|
throw CanteraError("importPhase()", "For Slave standard states, "
|
||||||
+ int2str(nsp));
|
"number of species must be zero: {}", nsp);
|
||||||
}
|
}
|
||||||
for (size_t k = 0; k < nsp; k++) {
|
for (size_t k = 0; k < nsp; k++) {
|
||||||
XML_Node* s = spDataNodeList[k];
|
XML_Node* s = spDataNodeList[k];
|
||||||
|
|
|
||||||
|
|
@ -287,7 +287,7 @@ doublereal WaterProps::coeffThermalExp_IAPWS(doublereal temp, doublereal press)
|
||||||
doublereal dens = m_waterIAPWS->density(temp, press, WATER_LIQUID);
|
doublereal dens = m_waterIAPWS->density(temp, press, WATER_LIQUID);
|
||||||
if (dens < 0.0) {
|
if (dens < 0.0) {
|
||||||
throw CanteraError("WaterProps::coeffThermalExp_IAPWS",
|
throw CanteraError("WaterProps::coeffThermalExp_IAPWS",
|
||||||
"Unable to solve for density at T = " + fp2str(temp) + " and P = " + fp2str(press));
|
"Unable to solve for density at T = {} and P = {}", temp, press);
|
||||||
}
|
}
|
||||||
return m_waterIAPWS->coeffThermExp();
|
return m_waterIAPWS->coeffThermExp();
|
||||||
}
|
}
|
||||||
|
|
@ -297,7 +297,7 @@ doublereal WaterProps::isothermalCompressibility_IAPWS(doublereal temp, doublere
|
||||||
doublereal dens = m_waterIAPWS->density(temp, press, WATER_LIQUID);
|
doublereal dens = m_waterIAPWS->density(temp, press, WATER_LIQUID);
|
||||||
if (dens < 0.0) {
|
if (dens < 0.0) {
|
||||||
throw CanteraError("WaterProps::isothermalCompressibility_IAPWS",
|
throw CanteraError("WaterProps::isothermalCompressibility_IAPWS",
|
||||||
"Unable to solve for density at T = " + fp2str(temp) + " and P = " + fp2str(press));
|
"Unable to solve for density at T = {} and P = {}", temp, press);
|
||||||
}
|
}
|
||||||
return m_waterIAPWS->isothermalCompressibility();
|
return m_waterIAPWS->isothermalCompressibility();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -130,7 +130,7 @@ doublereal WaterPropsIAPWS::density(doublereal temperature, doublereal pressure,
|
||||||
"Unstable Branch finder is untested");
|
"Unstable Branch finder is untested");
|
||||||
} else {
|
} else {
|
||||||
throw CanteraError("WaterPropsIAPWS::density",
|
throw CanteraError("WaterPropsIAPWS::density",
|
||||||
"unknown state: " + int2str(phase));
|
"unknown state: {}", phase);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -188,7 +188,7 @@ doublereal WaterPropsIAPWS::density_const(doublereal pressure,
|
||||||
"Unstable Branch finder is untested");
|
"Unstable Branch finder is untested");
|
||||||
} else {
|
} else {
|
||||||
throw CanteraError("WaterPropsIAPWS::density",
|
throw CanteraError("WaterPropsIAPWS::density",
|
||||||
"unknown state: " + int2str(phase));
|
"unknown state: {}", phase);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -309,8 +309,8 @@ void WaterPropsIAPWS::corr(doublereal temperature, doublereal pressure,
|
||||||
densLiq = density(temperature, pressure, WATER_LIQUID, densLiq);
|
densLiq = density(temperature, pressure, WATER_LIQUID, densLiq);
|
||||||
if (densLiq <= 0.0) {
|
if (densLiq <= 0.0) {
|
||||||
throw CanteraError("WaterPropsIAPWS::corr",
|
throw CanteraError("WaterPropsIAPWS::corr",
|
||||||
"Error occurred trying to find liquid density at (T,P) = "
|
"Error occurred trying to find liquid density at (T,P) = {} {}",
|
||||||
+ fp2str(temperature) + " " + fp2str(pressure));
|
temperature, pressure);
|
||||||
}
|
}
|
||||||
setState_TR(temperature, densLiq);
|
setState_TR(temperature, densLiq);
|
||||||
doublereal gibbsLiqRT = m_phi->gibbs_RT();
|
doublereal gibbsLiqRT = m_phi->gibbs_RT();
|
||||||
|
|
@ -318,8 +318,8 @@ void WaterPropsIAPWS::corr(doublereal temperature, doublereal pressure,
|
||||||
densGas = density(temperature, pressure, WATER_GAS, densGas);
|
densGas = density(temperature, pressure, WATER_GAS, densGas);
|
||||||
if (densGas <= 0.0) {
|
if (densGas <= 0.0) {
|
||||||
throw CanteraError("WaterPropsIAPWS::corr",
|
throw CanteraError("WaterPropsIAPWS::corr",
|
||||||
"Error occurred trying to find gas density at (T,P) = "
|
"Error occurred trying to find gas density at (T,P) = {} {}",
|
||||||
+ fp2str(temperature) + " " + fp2str(pressure));
|
temperature, pressure);
|
||||||
}
|
}
|
||||||
setState_TR(temperature, densGas);
|
setState_TR(temperature, densGas);
|
||||||
doublereal gibbsGasRT = m_phi->gibbs_RT();
|
doublereal gibbsGasRT = m_phi->gibbs_RT();
|
||||||
|
|
@ -333,8 +333,8 @@ void WaterPropsIAPWS::corr1(doublereal temperature, doublereal pressure,
|
||||||
densLiq = density(temperature, pressure, WATER_LIQUID, densLiq);
|
densLiq = density(temperature, pressure, WATER_LIQUID, densLiq);
|
||||||
if (densLiq <= 0.0) {
|
if (densLiq <= 0.0) {
|
||||||
throw CanteraError("WaterPropsIAPWS::corr1",
|
throw CanteraError("WaterPropsIAPWS::corr1",
|
||||||
"Error occurred trying to find liquid density at (T,P) = "
|
"Error occurred trying to find liquid density at (T,P) = {} {}",
|
||||||
+ fp2str(temperature) + " " + fp2str(pressure));
|
temperature, pressure);
|
||||||
}
|
}
|
||||||
setState_TR(temperature, densLiq);
|
setState_TR(temperature, densLiq);
|
||||||
doublereal prL = m_phi->phiR();
|
doublereal prL = m_phi->phiR();
|
||||||
|
|
@ -342,8 +342,8 @@ void WaterPropsIAPWS::corr1(doublereal temperature, doublereal pressure,
|
||||||
densGas = density(temperature, pressure, WATER_GAS, densGas);
|
densGas = density(temperature, pressure, WATER_GAS, densGas);
|
||||||
if (densGas <= 0.0) {
|
if (densGas <= 0.0) {
|
||||||
throw CanteraError("WaterPropsIAPWS::corr1",
|
throw CanteraError("WaterPropsIAPWS::corr1",
|
||||||
"Error occurred trying to find gas density at (T,P) = "
|
"Error occurred trying to find gas density at (T,P) = {} {}",
|
||||||
+ fp2str(temperature) + " " + fp2str(pressure));
|
temperature, pressure);
|
||||||
}
|
}
|
||||||
setState_TR(temperature, densGas);
|
setState_TR(temperature, densGas);
|
||||||
doublereal prG = m_phi->phiR();
|
doublereal prG = m_phi->phiR();
|
||||||
|
|
@ -389,7 +389,7 @@ doublereal WaterPropsIAPWS::psat(doublereal temperature, int waterState)
|
||||||
setState_TR(temperature, densGas);
|
setState_TR(temperature, densGas);
|
||||||
} else {
|
} else {
|
||||||
throw CanteraError("WaterPropsIAPWS::psat",
|
throw CanteraError("WaterPropsIAPWS::psat",
|
||||||
"unknown water state input: " + int2str(waterState));
|
"unknown water state input: {}", waterState);
|
||||||
}
|
}
|
||||||
return p;
|
return p;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -383,7 +383,7 @@ doublereal WaterSSTP::dthermalExpansionCoeffdT() const
|
||||||
doublereal dd = m_sub->density(tt, pres, WATER_LIQUID, dens_save);
|
doublereal dd = m_sub->density(tt, pres, WATER_LIQUID, dens_save);
|
||||||
if (dd < 0.0) {
|
if (dd < 0.0) {
|
||||||
throw CanteraError("WaterSSTP::dthermalExpansionCoeffdT",
|
throw CanteraError("WaterSSTP::dthermalExpansionCoeffdT",
|
||||||
"Unable to solve for the density at T = " + fp2str(tt) + ", P = " + fp2str(pres));
|
"Unable to solve for the density at T = {}, P = {}", tt, pres);
|
||||||
}
|
}
|
||||||
doublereal vald = m_sub->coeffThermExp();
|
doublereal vald = m_sub->coeffThermExp();
|
||||||
m_sub->setState_TR(T, dens_save);
|
m_sub->setState_TR(T, dens_save);
|
||||||
|
|
|
||||||
|
|
@ -258,7 +258,7 @@ void HighPressureGasTransport::getMultiDiffCoeffs(const size_t ld, doublereal* c
|
||||||
int ierr = invert(m_Lmatrix, m_nsp);
|
int ierr = invert(m_Lmatrix, m_nsp);
|
||||||
if (ierr != 0) {
|
if (ierr != 0) {
|
||||||
throw CanteraError("HighPressureGasTransport::getMultiDiffCoeffs",
|
throw CanteraError("HighPressureGasTransport::getMultiDiffCoeffs",
|
||||||
string(" invert returned ierr = ")+int2str(ierr));
|
"invert returned ierr = {}", ierr);
|
||||||
}
|
}
|
||||||
m_l0000_ok = false; // matrix is overwritten by inverse
|
m_l0000_ok = false; // matrix is overwritten by inverse
|
||||||
m_lmatrix_soln_ok = false;
|
m_lmatrix_soln_ok = false;
|
||||||
|
|
|
||||||
|
|
@ -719,7 +719,7 @@ bool LiquidTransport::update_T()
|
||||||
// Next do a reality check on temperature value
|
// Next do a reality check on temperature value
|
||||||
if (t < 0.0) {
|
if (t < 0.0) {
|
||||||
throw CanteraError("LiquidTransport::update_T()",
|
throw CanteraError("LiquidTransport::update_T()",
|
||||||
"negative temperature "+fp2str(t));
|
"negative temperature {}", t);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Compute various direct functions of temperature
|
// Compute various direct functions of temperature
|
||||||
|
|
|
||||||
|
|
@ -128,7 +128,7 @@ void MixTransport::update_T()
|
||||||
}
|
}
|
||||||
if (t < 0.0) {
|
if (t < 0.0) {
|
||||||
throw CanteraError("MixTransport::update_T",
|
throw CanteraError("MixTransport::update_T",
|
||||||
"negative temperature "+fp2str(t));
|
"negative temperature {}", t);
|
||||||
}
|
}
|
||||||
GasTransport::update_T();
|
GasTransport::update_T();
|
||||||
// temperature has changed, so polynomial fits will need to be redone.
|
// temperature has changed, so polynomial fits will need to be redone.
|
||||||
|
|
|
||||||
|
|
@ -347,12 +347,12 @@ void MultiTransport::getMassFluxes(const doublereal* state1, const doublereal* s
|
||||||
int info = m_aa.factor();
|
int info = m_aa.factor();
|
||||||
if (info) {
|
if (info) {
|
||||||
throw CanteraError("MultiTransport::getMassFluxes",
|
throw CanteraError("MultiTransport::getMassFluxes",
|
||||||
"Error in factorization. Info = "+int2str(info));
|
"Error in factorization. Info = {}", info);
|
||||||
}
|
}
|
||||||
info = m_aa.solve(fluxes);
|
info = m_aa.solve(fluxes);
|
||||||
if (info) {
|
if (info) {
|
||||||
throw CanteraError("MultiTransport::getMassFluxes",
|
throw CanteraError("MultiTransport::getMassFluxes",
|
||||||
"Error in linear solve. Info = "+int2str(info));
|
"Error in linear solve. Info = {}", info);
|
||||||
}
|
}
|
||||||
|
|
||||||
doublereal pp = pressure_ig();
|
doublereal pp = pressure_ig();
|
||||||
|
|
@ -403,7 +403,7 @@ void MultiTransport::getMultiDiffCoeffs(const size_t ld, doublereal* const d)
|
||||||
int ierr = invert(m_Lmatrix, m_nsp);
|
int ierr = invert(m_Lmatrix, m_nsp);
|
||||||
if (ierr != 0) {
|
if (ierr != 0) {
|
||||||
throw CanteraError("MultiTransport::getMultiDiffCoeffs",
|
throw CanteraError("MultiTransport::getMultiDiffCoeffs",
|
||||||
string(" invert returned ierr = ")+int2str(ierr));
|
"invert returned ierr = {}", ierr);
|
||||||
}
|
}
|
||||||
m_l0000_ok = false; // matrix is overwritten by inverse
|
m_l0000_ok = false; // matrix is overwritten by inverse
|
||||||
m_lmatrix_soln_ok = false;
|
m_lmatrix_soln_ok = false;
|
||||||
|
|
|
||||||
|
|
@ -616,7 +616,7 @@ bool SimpleTransport::update_T()
|
||||||
}
|
}
|
||||||
if (t < 0.0) {
|
if (t < 0.0) {
|
||||||
throw CanteraError("SimpleTransport::update_T",
|
throw CanteraError("SimpleTransport::update_T",
|
||||||
"negative temperature "+fp2str(t));
|
"negative temperature {}", t);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Compute various functions of temperature
|
// Compute various functions of temperature
|
||||||
|
|
|
||||||
|
|
@ -56,51 +56,49 @@ void GasTransportData::validate(const Species& sp)
|
||||||
if (geometry == "atom") {
|
if (geometry == "atom") {
|
||||||
if (nAtoms != 1) {
|
if (nAtoms != 1) {
|
||||||
throw CanteraError("GasTransportData::validate",
|
throw CanteraError("GasTransportData::validate",
|
||||||
"invalid geometry for species '" + sp.name + "'. 'atom' "
|
"invalid geometry for species '{}'. 'atom' specified, but "
|
||||||
"specified, but species contains multiple atoms.");
|
"species contains multiple atoms.", sp.name);
|
||||||
}
|
}
|
||||||
} else if (geometry == "linear") {
|
} else if (geometry == "linear") {
|
||||||
if (nAtoms == 1) {
|
if (nAtoms == 1) {
|
||||||
throw CanteraError("GasTransportData::validate",
|
throw CanteraError("GasTransportData::validate",
|
||||||
"invalid geometry for species '" + sp.name + "'. 'linear'"
|
"invalid geometry for species '{}'. 'linear' specified, but "
|
||||||
" specified, but species only contains one atom.");
|
"species only contains one atom.", sp.name);
|
||||||
}
|
}
|
||||||
} else if (geometry == "nonlinear") {
|
} else if (geometry == "nonlinear") {
|
||||||
if (nAtoms < 3) {
|
if (nAtoms < 3) {
|
||||||
throw CanteraError("GasTransportData::validate",
|
throw CanteraError("GasTransportData::validate",
|
||||||
"invalid geometry for species '" + sp.name + "'. 'nonlinear'"
|
"invalid geometry for species '{}'. 'nonlinear' specified, but "
|
||||||
" specified, but species only contains " + fp2str(nAtoms) +
|
"species only contains {} atoms.", sp.name, nAtoms);
|
||||||
" atoms.");
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
throw CanteraError("GasTransportData::validate",
|
throw CanteraError("GasTransportData::validate",
|
||||||
"invalid geometry for species '" + sp.name + "': '" +
|
"invalid geometry for species '{}': '{}'.", sp.name, geometry);
|
||||||
geometry + "'.");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (well_depth < 0.0) {
|
if (well_depth < 0.0) {
|
||||||
throw CanteraError("GasTransportData::validate",
|
throw CanteraError("GasTransportData::validate",
|
||||||
"negative well depth for species '" + sp.name + "'.");
|
"negative well depth for species '{}'.", sp.name);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (diameter <= 0.0) {
|
if (diameter <= 0.0) {
|
||||||
throw CanteraError("GasTransportData::validate",
|
throw CanteraError("GasTransportData::validate",
|
||||||
"negative or zero diameter for species '" + sp.name + "'.");
|
"negative or zero diameter for species '{}'.", sp.name);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dipole < 0.0) {
|
if (dipole < 0.0) {
|
||||||
throw CanteraError("GasTransportData::validate",
|
throw CanteraError("GasTransportData::validate",
|
||||||
"negative dipole moment for species '" + sp.name + "'.");
|
"negative dipole moment for species '{}'.", sp.name);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (polarizability < 0.0) {
|
if (polarizability < 0.0) {
|
||||||
throw CanteraError("GasTransportData::validate",
|
throw CanteraError("GasTransportData::validate",
|
||||||
"negative polarizability for species '" + sp.name + "'.");
|
"negative polarizability for species '{}'.", sp.name);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (rotational_relaxation < 0.0) {
|
if (rotational_relaxation < 0.0) {
|
||||||
throw CanteraError("GasTransportData::validate",
|
throw CanteraError("GasTransportData::validate",
|
||||||
"negative rotation relaxation number for species '" + sp.name + "'");
|
"negative rotation relaxation number for species '{}'.", sp.name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -163,12 +163,9 @@ void Reactor::updateState(doublereal* y)
|
||||||
T -= dT;
|
T -= dT;
|
||||||
i++;
|
i++;
|
||||||
if (i > 100) {
|
if (i > 100) {
|
||||||
std::string message = "no convergence";
|
throw CanteraError("Reactor::updateState",
|
||||||
message += "\nU/m = " + fp2str(U / m_mass);
|
"no convergence\nU/m = {}\nT = {}\nrho = {}\n",
|
||||||
message += "\nT = " + fp2str(T);
|
U / m_mass, T, m_mass / m_vol);
|
||||||
message += "\nrho = " + fp2str(m_mass / m_vol);
|
|
||||||
message += "\n";
|
|
||||||
throw CanteraError("Reactor::updateState", message);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -316,7 +313,7 @@ void Reactor::addSensitivityReaction(size_t rxn)
|
||||||
{
|
{
|
||||||
if (rxn >= m_kin->nReactions()) {
|
if (rxn >= m_kin->nReactions()) {
|
||||||
throw CanteraError("Reactor::addSensitivityReaction",
|
throw CanteraError("Reactor::addSensitivityReaction",
|
||||||
"Reaction number out of range ("+int2str(rxn)+")");
|
"Reaction number out of range ({})", rxn);
|
||||||
}
|
}
|
||||||
|
|
||||||
network().registerSensitivityReaction(this, rxn,
|
network().registerSensitivityReaction(this, rxn,
|
||||||
|
|
|
||||||
|
|
@ -143,7 +143,7 @@ void Wall::addSensitivityReaction(int leftright, size_t rxn)
|
||||||
{
|
{
|
||||||
if (rxn >= m_chem[leftright]->nReactions()) {
|
if (rxn >= m_chem[leftright]->nReactions()) {
|
||||||
throw CanteraError("Wall::addSensitivityReaction",
|
throw CanteraError("Wall::addSensitivityReaction",
|
||||||
"Reaction number out of range ("+int2str(rxn)+")");
|
"Reaction number out of range ({})", rxn);
|
||||||
}
|
}
|
||||||
if (leftright == 0) {
|
if (leftright == 0) {
|
||||||
m_left->network().registerSensitivityReaction(this, rxn,
|
m_left->network().registerSensitivityReaction(this, rxn,
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue