Eliminate unnecessary calles to std::string.c_str()

This commit is contained in:
Ray Speth 2015-09-08 00:38:48 -04:00
parent e669f912a5
commit 71bb73b728
35 changed files with 181 additions and 206 deletions

View file

@ -155,7 +155,7 @@ public:
*/ */
void writeCSV(std::string filename = "output.csv", void writeCSV(std::string filename = "output.csv",
bool dotitles = true, std::string ztitle = "z") const { bool dotitles = true, std::string ztitle = "z") const {
std::ofstream f(filename.c_str()); std::ofstream f(filename);
int np = nPoints(); int np = nPoints();
int nc = nComponents(); int nc = nComponents();
int n, m; int n, m;

View file

@ -503,7 +503,7 @@ std::string Application::findInputFile(const std::string& name)
inname = ""; inname = "";
for (size_t i = 0; i < nd; i++) { for (size_t i = 0; i < nd; i++) {
inname = dirs[i] + "/" + name; inname = dirs[i] + "/" + name;
std::ifstream fin(inname.c_str()); std::ifstream fin(inname);
if (fin) { if (fin) {
fin.close(); fin.close();
return inname; return inname;

View file

@ -72,7 +72,7 @@ void ct2ctml(const char* file, const int debug)
} else { } else {
out_name += ".xml"; out_name += ".xml";
} }
std::ofstream out(out_name.c_str()); std::ofstream out(out_name);
out << xml; out << xml;
} }

View file

@ -15,7 +15,7 @@ void writePlotFile(const std::string& fname, const std::string& fmt,
const std::vector<std::string> &names, const std::vector<std::string> &names,
const Array2D& data) const Array2D& data)
{ {
ofstream f(fname.c_str()); ofstream f(fname);
if (!f) { if (!f) {
throw CanteraError("writePlotFile","could not open file "+fname+ throw CanteraError("writePlotFile","could not open file "+fname+
" for writing."); " for writing.");

View file

@ -89,7 +89,7 @@ extern "C" {
try { try {
writelog("WARNING: xml_build called. Use get_XML_File instead."); writelog("WARNING: xml_build called. Use get_XML_File instead.");
string path = findInputFile(file); string path = findInputFile(file);
ifstream f(path.c_str()); ifstream f(path);
if (!f) { if (!f) {
throw CanteraError("xml_build", throw CanteraError("xml_build",
"file "+string(file)+" not found."); "file "+string(file)+" not found.");

View file

@ -241,11 +241,10 @@ size_t BasisOptimize(int* usedZeroedSpecies, bool doFormRxn, MultiPhase* mphase,
if (jr != k) { if (jr != k) {
if (DEBUG_MODE_ENABLED && BasisOptimize_print_lvl >= 1) { if (DEBUG_MODE_ENABLED && BasisOptimize_print_lvl >= 1) {
kk = orderVectorSpecies[k]; kk = orderVectorSpecies[k];
sname = mphase->speciesName(kk); writelogf(" --- %-12.12s", mphase->speciesName(kk));
writelogf(" --- %-12.12s", sname.c_str());
jj = orderVectorSpecies[jr]; jj = orderVectorSpecies[jr];
ename = mphase->speciesName(jj); writelogf("(%9.2g) replaces %-12.12s",
writelogf("(%9.2g) replaces %-12.12s", molSave, ename.c_str()); molSave, mphase->speciesName(jj));
writelogf("(%9.2g) as component %3d\n", molNum[jj], jr); writelogf("(%9.2g) as component %3d\n", molNum[jj], jr);
} }
std::swap(orderVectorSpecies[jr], orderVectorSpecies[k]); std::swap(orderVectorSpecies[jr], orderVectorSpecies[k]);
@ -336,8 +335,7 @@ size_t BasisOptimize(int* usedZeroedSpecies, bool doFormRxn, MultiPhase* mphase,
writelog("\n --- NonComponent | Moles | "); writelog("\n --- NonComponent | Moles | ");
for (i = 0; i < nComponents; i++) { for (i = 0; i < nComponents; i++) {
kk = orderVectorSpecies[i]; kk = orderVectorSpecies[i];
sname = mphase->speciesName(kk); writelogf("%-11.10s", mphase->speciesName(kk));
writelogf("%-11.10s", sname.c_str());
} }
writelog("\n"); writelog("\n");
@ -345,8 +343,7 @@ size_t BasisOptimize(int* usedZeroedSpecies, bool doFormRxn, MultiPhase* mphase,
k = i + nComponents; k = i + nComponents;
kk = orderVectorSpecies[k]; kk = orderVectorSpecies[k];
writelogf(" --- %3d (%3d) ", k, kk); writelogf(" --- %3d (%3d) ", k, kk);
sname = mphase->speciesName(kk); writelogf("%-10.10s", mphase->speciesName(kk));
writelogf("%-10.10s", sname.c_str());
writelogf("|%10.3g|", molNumBase[kk]); writelogf("|%10.3g|", molNumBase[kk]);
/* /*
* Print the negative of formRxnMatrix[]; it's easier to interpret. * Print the negative of formRxnMatrix[]; it's easier to interpret.
@ -596,13 +593,11 @@ void ElemRearrange(size_t nComponents, const vector_fp& elementAbundances,
if (jr != k) { if (jr != k) {
if (DEBUG_MODE_ENABLED && BasisOptimize_print_lvl > 0) { if (DEBUG_MODE_ENABLED && BasisOptimize_print_lvl > 0) {
kk = orderVectorElements[k]; kk = orderVectorElements[k];
ename = mphase->elementName(kk);
writelog(" --- "); writelog(" --- ");
writelogf("%-2.2s", ename.c_str()); writelogf("%-2.2s", mphase->elementName(kk));
writelog("replaces "); writelog("replaces ");
kk = orderVectorElements[jr]; kk = orderVectorElements[jr];
ename = mphase->elementName(kk); writelogf("%-2.2s", mphase->elementName(kk));
writelogf("%-2.2s", ename.c_str());
writelogf(" as element %3d\n", jr); writelogf(" as element %3d\n", jr);
} }
std::swap(orderVectorElements[jr], orderVectorElements[k]); std::swap(orderVectorElements[jr], orderVectorElements[k]);

View file

@ -216,15 +216,13 @@ int ChemEquil::setInitialMoles(thermo_t& s, vector_fp& elMoleGoal,
writelogf(" Temperature = %g\n", s.temperature()); writelogf(" Temperature = %g\n", s.temperature());
writelogf(" Pressure = %g\n", s.pressure()); writelogf(" Pressure = %g\n", s.pressure());
for (size_t k = 0; k < m_kk; k++) { for (size_t k = 0; k < m_kk; k++) {
string nnn = s.speciesName(k); writelogf(" %-12s % -10.5g\n",
double mf = s.moleFraction(k); s.speciesName(k), s.moleFraction(k));
writelogf(" %-12s % -10.5g\n", nnn.c_str(), mf);
} }
writelog(" Element_Name ElementGoal ElementMF\n"); writelog(" Element_Name ElementGoal ElementMF\n");
for (size_t m = 0; m < m_mm; m++) { for (size_t m = 0; m < m_mm; m++) {
string nnn = s.elementName(m);
writelogf(" %-12s % -10.5g% -10.5g\n", writelogf(" %-12s % -10.5g% -10.5g\n",
nnn.c_str(), elMoleGoal[m], m_elementmolefracs[m]); s.elementName(m), elMoleGoal[m], m_elementmolefracs[m]);
} }
} }
@ -276,9 +274,8 @@ int ChemEquil::estimateElementPotentials(thermo_t& s, vector_fp& lambda_RT,
if (DEBUG_MODE_ENABLED && ChemEquil_print_lvl > 0) { if (DEBUG_MODE_ENABLED && ChemEquil_print_lvl > 0) {
for (size_t m = 0; m < m_nComponents; m++) { for (size_t m = 0; m < m_nComponents; m++) {
int isp = static_cast<int>(m_component[m]); size_t isp = m_component[m];
string nnn = s.speciesName(isp); writelogf("isp = %d, %s\n", isp, s.speciesName(isp));
writelogf("isp = %d, %s\n", isp, nnn.c_str());
} }
double pres = s.pressure(); double pres = s.pressure();
double temp = s.temperature(); double temp = s.temperature();
@ -286,9 +283,8 @@ int ChemEquil::estimateElementPotentials(thermo_t& s, vector_fp& lambda_RT,
writelogf("Temperature = %g\n", temp); writelogf("Temperature = %g\n", temp);
writelog(" id Name MF mu/RT \n"); writelog(" id Name MF mu/RT \n");
for (size_t n = 0; n < s.nSpecies(); n++) { for (size_t n = 0; n < s.nSpecies(); n++) {
string nnn = s.speciesName(n);
writelogf("%10d %15s %10.5g %10.5g\n", writelogf("%10d %15s %10.5g %10.5g\n",
n, nnn.c_str(), xMF_est[n], mu_RT[n]); n, s.speciesName(n), xMF_est[n], mu_RT[n]);
} }
} }
DenseMatrix aa(m_nComponents, m_nComponents, 0.0); DenseMatrix aa(m_nComponents, m_nComponents, 0.0);
@ -315,18 +311,16 @@ int ChemEquil::estimateElementPotentials(thermo_t& s, vector_fp& lambda_RT,
for (size_t m = 0; m < m_nComponents; m++) { for (size_t m = 0; m < m_nComponents; m++) {
size_t isp = m_component[m]; size_t isp = m_component[m];
double tmp = 0.0; double tmp = 0.0;
string sname = s.speciesName(isp);
for (size_t n = 0; n < m_mm; n++) { for (size_t n = 0; n < m_mm; n++) {
tmp += nAtoms(isp, n) * lambda_RT[n]; tmp += nAtoms(isp, n) * lambda_RT[n];
} }
writelogf("%3d %16s %10.5g %10.5g %10.5g\n", writelogf("%3d %16s %10.5g %10.5g %10.5g\n",
m, sname.c_str(), mu_RT[isp], tmp, tmp - mu_RT[isp]); m, s.speciesName(isp), mu_RT[isp], tmp, tmp - mu_RT[isp]);
} }
writelog(" id ElName Lambda_RT\n"); writelog(" id ElName Lambda_RT\n");
for (size_t m = 0; m < m_mm; m++) { for (size_t m = 0; m < m_mm; m++) {
string ename = s.elementName(m); writelogf(" %3d %6s %10.5g\n", m, s.elementName(m), lambda_RT[m]);
writelogf(" %3d %6s %10.5g\n", m, ename.c_str(), lambda_RT[m]);
} }
} }
return info; return info;
@ -1037,16 +1031,15 @@ int ChemEquil::estimateEP_Brinkley(thermo_t& s, vector_fp& x,
writelog("Initial mole numbers and mu_SS:\n"); writelog("Initial mole numbers and mu_SS:\n");
writelog(" Name MoleNum mu_SS actCoeff\n"); writelog(" Name MoleNum mu_SS actCoeff\n");
for (k = 0; k < m_kk; k++) { for (k = 0; k < m_kk; k++) {
string nnn = s.speciesName(k);
writelogf("%15s %13.5g %13.5g %13.5g\n", writelogf("%15s %13.5g %13.5g %13.5g\n",
nnn.c_str(), n_i[k], m_muSS_RT[k], actCoeff[k]); s.speciesName(k), n_i[k], m_muSS_RT[k], actCoeff[k]);
} }
writelogf("Initial n_t = %10.5g\n", n_t); writelogf("Initial n_t = %10.5g\n", n_t);
writelog("Comparison of Goal Element Abundance with Initial Guess:\n"); writelog("Comparison of Goal Element Abundance with Initial Guess:\n");
writelog(" eName eCurrent eGoal\n"); writelog(" eName eCurrent eGoal\n");
for (m = 0; m < m_mm; m++) { for (m = 0; m < m_mm; m++) {
string nnn = s.elementName(m); writelogf("%5s %13.5g %13.5g\n",
writelogf("%5s %13.5g %13.5g\n",nnn.c_str(), eMolesFix[m], elMoles[m]); s.elementName(m), eMolesFix[m], elMoles[m]);
} }
} }
for (m = 0; m < m_mm; m++) { for (m = 0; m < m_mm; m++) {
@ -1086,14 +1079,14 @@ int ChemEquil::estimateEP_Brinkley(thermo_t& s, vector_fp& x,
if (DEBUG_MODE_ENABLED && ChemEquil_print_lvl > 0) { if (DEBUG_MODE_ENABLED && ChemEquil_print_lvl > 0) {
writelog(" Species: Calculated_Moles Calculated_Mole_Fraction\n"); writelog(" Species: Calculated_Moles Calculated_Mole_Fraction\n");
for (k = 0; k < m_kk; k++) { for (k = 0; k < m_kk; k++) {
string nnn = s.speciesName(k); writelogf("%15s: %10.5g %10.5g\n",
writelogf("%15s: %10.5g %10.5g\n", nnn.c_str(), n_i_calc[k], Xmol_i_calc[k]); s.speciesName(k), n_i_calc[k], Xmol_i_calc[k]);
} }
writelogf("%15s: %10.5g\n", "Total Molar Sum", n_t_calc); writelogf("%15s: %10.5g\n", "Total Molar Sum", n_t_calc);
writelogf("(iter %d) element moles bal: Goal Calculated\n", iter); writelogf("(iter %d) element moles bal: Goal Calculated\n", iter);
for (m = 0; m < m_mm; m++) { for (m = 0; m < m_mm; m++) {
string nnn = s.elementName(m); writelogf(" %8s: %10.5g %10.5g \n",
writelogf(" %8s: %10.5g %10.5g \n", nnn.c_str(), elMoles[m], eMolesCalc[m]); s.elementName(m), elMoles[m], eMolesCalc[m]);
} }
} }
@ -1197,8 +1190,8 @@ int ChemEquil::estimateEP_Brinkley(thermo_t& s, vector_fp& x,
} }
} }
if (DEBUG_MODE_ENABLED && ChemEquil_print_lvl > 0) { if (DEBUG_MODE_ENABLED && ChemEquil_print_lvl > 0) {
string nnn = s.elementName(m); writelogf(" %5s %3d : %5d %5d\n",
writelogf(" %5s %3d : %5d %5d\n",nnn.c_str(), lumpSum[m], kMSp, kMSp2); s.elementName(m), lumpSum[m], kMSp, kMSp2);
} }
} }
@ -1443,8 +1436,8 @@ int ChemEquil::estimateEP_Brinkley(thermo_t& s, vector_fp& x,
if (DEBUG_MODE_ENABLED && ChemEquil_print_lvl > 0) { if (DEBUG_MODE_ENABLED && ChemEquil_print_lvl > 0) {
writelogf("(it %d) OLD_SOLUTION NEW SOLUTION (undamped updated)\n", iter); writelogf("(it %d) OLD_SOLUTION NEW SOLUTION (undamped updated)\n", iter);
for (m = 0; m < m_mm; m++) { for (m = 0; m < m_mm; m++) {
string eee = s.elementName(m); writelogf(" %5s %10.5g %10.5g %10.5g\n",
writelogf(" %5s %10.5g %10.5g %10.5g\n", eee.c_str(), x_old[m], x[m], resid[m]); s.elementName(m), x_old[m], x[m], resid[m]);
} }
writelogf(" n_t %10.5g %10.5g %10.5g \n", x_old[m_mm], n_t, exp(resid[m_mm])); writelogf(" n_t %10.5g %10.5g %10.5g \n", x_old[m_mm], n_t, exp(resid[m_mm]));
} }
@ -1510,9 +1503,8 @@ void ChemEquil::adjustEloc(thermo_t& s, vector_fp& elMolesGoal)
} }
double factor = (elMolesGoal[m_eloc] + sumNeg) / sumPos; double factor = (elMolesGoal[m_eloc] + sumNeg) / sumPos;
if (DEBUG_MODE_ENABLED && ChemEquil_print_lvl > 0 && factor < 0.9999999999) { if (DEBUG_MODE_ENABLED && ChemEquil_print_lvl > 0 && factor < 0.9999999999) {
string nnn = s.speciesName(maxPosEloc);
writelogf("adjustEloc: adjusted %s and friends from %g to %g to ensure neutrality condition\n", writelogf("adjustEloc: adjusted %s and friends from %g to %g to ensure neutrality condition\n",
nnn.c_str(), s.speciesName(maxPosEloc),
m_molefractions[maxPosEloc], m_molefractions[maxPosEloc]*factor); m_molefractions[maxPosEloc], m_molefractions[maxPosEloc]*factor);
} }
for (k = 0; k < m_kk; k++) { for (k = 0; k < m_kk; k++) {
@ -1523,9 +1515,8 @@ void ChemEquil::adjustEloc(thermo_t& s, vector_fp& elMolesGoal)
} else { } else {
double factor = (-elMolesGoal[m_eloc] + sumPos) / sumNeg; double factor = (-elMolesGoal[m_eloc] + sumPos) / sumNeg;
if (DEBUG_MODE_ENABLED && ChemEquil_print_lvl > 0 && factor < 0.9999999999) { if (DEBUG_MODE_ENABLED && ChemEquil_print_lvl > 0 && factor < 0.9999999999) {
string nnn = s.speciesName(maxNegEloc);
writelogf("adjustEloc: adjusted %s and friends from %g to %g to ensure neutrality condition\n", writelogf("adjustEloc: adjusted %s and friends from %g to %g to ensure neutrality condition\n",
nnn.c_str(), s.speciesName(maxNegEloc),
m_molefractions[maxNegEloc], m_molefractions[maxNegEloc]*factor); m_molefractions[maxNegEloc], m_molefractions[maxNegEloc]*factor);
} }
for (k = 0; k < m_kk; k++) { for (k = 0; k < m_kk; k++) {

View file

@ -550,7 +550,7 @@ int vcs_MultiPhaseEquil::equilibrate_TP(int estimateEquil,
plogf("--------------------------------------------------" plogf("--------------------------------------------------"
"-----------\n"); "-----------\n");
for (size_t i = 0; i < m_vprob.nspecies; i++) { for (size_t i = 0; i < m_vprob.nspecies; i++) {
plogf("%-12s", m_vprob.SpName[i].c_str()); plogf("%-12s", m_vprob.SpName[i]);
if (m_vprob.SpeciesUnknownType[i] == VCS_SPECIES_TYPE_INTERFACIALVOLTAGE) { if (m_vprob.SpeciesUnknownType[i] == VCS_SPECIES_TYPE_INTERFACIALVOLTAGE) {
plogf(" %15.3e %15.3e ", 0.0, m_vprob.mf[i]); plogf(" %15.3e %15.3e ", 0.0, m_vprob.mf[i]);
plogf("%15.3e\n", m_vprob.m_gibbsSpecies[i]); plogf("%15.3e\n", m_vprob.m_gibbsSpecies[i]);
@ -1343,7 +1343,7 @@ int vcs_MultiPhaseEquil::determine_PhaseStability(int iph, double& funcStab, int
} }
plogf("-------------------------------------------------------------\n"); plogf("-------------------------------------------------------------\n");
for (size_t i = 0; i < m_vprob.nspecies; i++) { for (size_t i = 0; i < m_vprob.nspecies; i++) {
plogf("%-12s", m_vprob.SpName[i].c_str()); plogf("%-12s", m_vprob.SpName[i]);
if (m_vprob.SpeciesUnknownType[i] == VCS_SPECIES_TYPE_INTERFACIALVOLTAGE) { if (m_vprob.SpeciesUnknownType[i] == VCS_SPECIES_TYPE_INTERFACIALVOLTAGE) {
plogf(" %15.3e %15.3e ", 0.0, m_vprob.mf[i]); plogf(" %15.3e %15.3e ", 0.0, m_vprob.mf[i]);
plogf("%15.3e\n", m_vprob.m_gibbsSpecies[i]); plogf("%15.3e\n", m_vprob.m_gibbsSpecies[i]);

View file

@ -204,8 +204,8 @@ int VCS_SOLVE::vcs_elcorr(double aa[], double x[])
if (DEBUG_MODE_ENABLED && m_debug_print_lvl >= 3) { if (DEBUG_MODE_ENABLED && m_debug_print_lvl >= 3) {
plogf(" --- vcs_elcorr: Reduced species %s from %g to %g " plogf(" --- vcs_elcorr: Reduced species %s from %g to %g "
"due to %s max bounds constraint\n", "due to %s max bounds constraint\n",
m_speciesName[kspec].c_str(), m_molNumSpecies_old[kspec], m_speciesName[kspec], m_molNumSpecies_old[kspec],
maxPermissible, m_elementName[i].c_str()); maxPermissible, m_elementName[i]);
} }
m_molNumSpecies_old[kspec] = maxPermissible; m_molNumSpecies_old[kspec] = maxPermissible;
changed = true; changed = true;
@ -219,7 +219,7 @@ int VCS_SOLVE::vcs_elcorr(double aa[], double x[])
if (DEBUG_MODE_ENABLED && m_debug_print_lvl >= 2) { if (DEBUG_MODE_ENABLED && m_debug_print_lvl >= 2) {
plogf(" --- vcs_elcorr: Zeroed species %s and changed " plogf(" --- vcs_elcorr: Zeroed species %s and changed "
"status to %d due to max bounds constraint\n", "status to %d due to max bounds constraint\n",
m_speciesName[kspec].c_str(), m_speciesStatus[kspec]); m_speciesName[kspec], m_speciesStatus[kspec]);
} }
} }
} }
@ -460,7 +460,7 @@ L_CLEANUP:
" Final\n"); " Final\n");
for (size_t i = 0; i < m_numElemConstraints; ++i) { for (size_t i = 0; i < m_numElemConstraints; ++i) {
plogf(" --- "); plogf(" --- ");
plogf("%-2.2s", m_elementName[i].c_str()); plogf("%-2.2s", m_elementName[i]);
plogf(" %20.12E %20.12E %20.12E\n", m_elemAbundancesGoal[i], ga_save[i], m_elemAbundances[i]); plogf(" %20.12E %20.12E %20.12E\n", m_elemAbundancesGoal[i], ga_save[i], m_elemAbundances[i]);
} }
plogf(" --- Diff_Norm: %20.12E %20.12E\n", plogf(" --- Diff_Norm: %20.12E %20.12E\n",

View file

@ -147,9 +147,9 @@ int VCS_SOLVE::vcs_elem_rearrange(double* const aw, double* const sa,
if (jr != k) { if (jr != k) {
if (DEBUG_MODE_ENABLED && m_debug_print_lvl >= 2) { if (DEBUG_MODE_ENABLED && m_debug_print_lvl >= 2) {
plogf(" --- "); plogf(" --- ");
plogf("%-2.2s", m_elementName[k].c_str()); plogf("%-2.2s", m_elementName[k]);
plogf("(%9.2g) replaces ", m_elemAbundancesGoal[k]); plogf("(%9.2g) replaces ", m_elemAbundancesGoal[k]);
plogf("%-2.2s", m_elementName[jr].c_str()); plogf("%-2.2s", m_elementName[jr]);
plogf("(%9.2g) as element %3d", m_elemAbundancesGoal[jr], jr); plogf("(%9.2g) as element %3d", m_elemAbundancesGoal[jr], jr);
plogendl(); plogendl();
} }

View file

@ -38,7 +38,7 @@ void VCS_SOLVE::vcs_inest(double* const aw, double* const sa, double* const sm,
plogf("%s SPECIES MOLE_NUMBER -SS_ChemPotential\n", pprefix); plogf("%s SPECIES MOLE_NUMBER -SS_ChemPotential\n", pprefix);
for (size_t kspec = 0; kspec < nspecies; ++kspec) { for (size_t kspec = 0; kspec < nspecies; ++kspec) {
plogf("%s ", pprefix); plogf("%s ", pprefix);
plogf("%-12.12s", m_speciesName[kspec].c_str()); plogf("%-12.12s", m_speciesName[kspec]);
plogf(" %15.5g %12.3g\n", m_molNumSpecies_old[kspec], -m_SSfeSpecies[kspec]); plogf(" %15.5g %12.3g\n", m_molNumSpecies_old[kspec], -m_SSfeSpecies[kspec]);
} }
plogf("%s Element Abundance Agreement returned from linear " plogf("%s Element Abundance Agreement returned from linear "
@ -53,7 +53,7 @@ void VCS_SOLVE::vcs_inest(double* const aw, double* const sa, double* const sm,
tmp += m_formulaMatrix(kspec,j) * m_molNumSpecies_old[kspec]; tmp += m_formulaMatrix(kspec,j) * m_molNumSpecies_old[kspec];
} }
plogf("%s ", pprefix); plogf("%s ", pprefix);
plogf(" %-9.9s", m_elementName[j].c_str()); plogf(" %-9.9s", m_elementName[j]);
plogf(" %12.3g %12.3g\n", m_elemAbundancesGoal[j], tmp); plogf(" %12.3g %12.3g\n", m_elemAbundancesGoal[j], tmp);
} }
} }
@ -134,7 +134,7 @@ void VCS_SOLVE::vcs_inest(double* const aw, double* const sa, double* const sm,
if (DEBUG_MODE_ENABLED && m_debug_print_lvl >= 2) { if (DEBUG_MODE_ENABLED && m_debug_print_lvl >= 2) {
for (size_t kspec = 0; kspec < nspecies; ++kspec) { for (size_t kspec = 0; kspec < nspecies; ++kspec) {
plogf("%s", pprefix); plogf("%s", pprefix);
plogf("%-12.12s", m_speciesName[kspec].c_str()); plogf("%-12.12s", m_speciesName[kspec]);
if (kspec < m_numComponents) { if (kspec < m_numComponents) {
plogf("fe* = %15.5g ff = %15.5g\n", m_feSpecies_new[kspec], plogf("fe* = %15.5g ff = %15.5g\n", m_feSpecies_new[kspec],
m_SSfeSpecies[kspec]); m_SSfeSpecies[kspec]);
@ -195,7 +195,7 @@ void VCS_SOLVE::vcs_inest(double* const aw, double* const sa, double* const sm,
for (size_t kspec = 0; kspec < nspecies; ++kspec) { for (size_t kspec = 0; kspec < nspecies; ++kspec) {
if (m_speciesUnknownType[kspec] != VCS_SPECIES_TYPE_INTERFACIALVOLTAGE) { if (m_speciesUnknownType[kspec] != VCS_SPECIES_TYPE_INTERFACIALVOLTAGE) {
plogf("%sdirection (", pprefix); plogf("%sdirection (", pprefix);
plogf("%-12.12s", m_speciesName[kspec].c_str()); plogf("%-12.12s", m_speciesName[kspec]);
plogf(") = %g", m_deltaMolNumSpecies[kspec]); plogf(") = %g", m_deltaMolNumSpecies[kspec]);
if (m_SSPhase[kspec]) { if (m_SSPhase[kspec]) {
if (m_molNumSpecies_old[kspec] > 0.0) { if (m_molNumSpecies_old[kspec] > 0.0) {
@ -307,7 +307,7 @@ void VCS_SOLVE::vcs_inest(double* const aw, double* const sa, double* const sm,
plogf("%s SPECIES MOLE_NUMBER\n", pprefix); plogf("%s SPECIES MOLE_NUMBER\n", pprefix);
for (size_t kspec = 0; kspec < nspecies; ++kspec) { for (size_t kspec = 0; kspec < nspecies; ++kspec) {
plogf("%s ", pprefix); plogf("%s ", pprefix);
plogf("%-12.12s", m_speciesName[kspec].c_str()); plogf("%-12.12s", m_speciesName[kspec]);
plogf(" %g", m_molNumSpecies_old[kspec]); plogf(" %g", m_molNumSpecies_old[kspec]);
plogendl(); plogendl();
} }

View file

@ -229,9 +229,7 @@ size_t VCS_SOLVE::vcs_popPhaseID(std::vector<size_t> & phasePopPhaseIDs)
if (existence > 0) { if (existence > 0) {
if (DEBUG_MODE_ENABLED && m_debug_print_lvl >= 2) { if (DEBUG_MODE_ENABLED && m_debug_print_lvl >= 2) {
plogf(" --- %18s %5d NA %11.3e\n", plogf(" --- %18s %5d NA %11.3e\n",
Vphase->PhaseName.c_str(), Vphase->PhaseName, existence, m_tPhaseMoles_old[iph]);
existence,
m_tPhaseMoles_old[iph]);
} }
} else { } else {
if (Vphase->m_singleSpecies) { if (Vphase->m_singleSpecies) {
@ -262,8 +260,7 @@ size_t VCS_SOLVE::vcs_popPhaseID(std::vector<size_t> & phasePopPhaseIDs)
if (DEBUG_MODE_ENABLED && m_debug_print_lvl >= 2) { if (DEBUG_MODE_ENABLED && m_debug_print_lvl >= 2) {
plogf(" --- %18s %5d %10.3g %10.3g %s\n", plogf(" --- %18s %5d %10.3g %10.3g %s\n",
Vphase->PhaseName.c_str(), Vphase->PhaseName, existence, Fephase,
existence, Fephase,
m_tPhaseMoles_old[iph], anote); m_tPhaseMoles_old[iph], anote);
} }
} else { } else {
@ -282,14 +279,13 @@ size_t VCS_SOLVE::vcs_popPhaseID(std::vector<size_t> & phasePopPhaseIDs)
} }
if (DEBUG_MODE_ENABLED && m_debug_print_lvl >= 2) { if (DEBUG_MODE_ENABLED && m_debug_print_lvl >= 2) {
plogf(" --- %18s %5d %11.3g %11.3g\n", plogf(" --- %18s %5d %11.3g %11.3g\n",
Vphase->PhaseName.c_str(), Vphase->PhaseName, existence, Fephase,
existence, Fephase,
m_tPhaseMoles_old[iph]); m_tPhaseMoles_old[iph]);
} }
} else { } else {
if (DEBUG_MODE_ENABLED && m_debug_print_lvl >= 2) { if (DEBUG_MODE_ENABLED && m_debug_print_lvl >= 2) {
plogf(" --- %18s %5d blocked %11.3g\n", plogf(" --- %18s %5d blocked %11.3g\n",
Vphase->PhaseName.c_str(), Vphase->PhaseName,
existence, m_tPhaseMoles_old[iph]); existence, m_tPhaseMoles_old[iph]);
} }
} }
@ -329,7 +325,7 @@ int VCS_SOLVE::vcs_popPhaseRxnStepSizes(const size_t iphasePop)
"called for a phase that exists!"); "called for a phase that exists!");
if (DEBUG_MODE_ENABLED && m_debug_print_lvl >= 2) { if (DEBUG_MODE_ENABLED && m_debug_print_lvl >= 2) {
plogf(" --- vcs_popPhaseRxnStepSizes() called to pop phase %s %d into existence\n", plogf(" --- vcs_popPhaseRxnStepSizes() called to pop phase %s %d into existence\n",
Vphase->PhaseName.c_str(), iphasePop); Vphase->PhaseName, iphasePop);
} }
// Section for a single-species phase // Section for a single-species phase
if (Vphase->m_singleSpecies) { if (Vphase->m_singleSpecies) {

View file

@ -187,8 +187,8 @@ void VCS_PROB::prob_report(int print_lvl)
plogf(" Initial_Estimated_Moles Species_Type\n"); plogf(" Initial_Estimated_Moles Species_Type\n");
for (size_t i = 0; i < nspecies; i++) { for (size_t i = 0; i < nspecies; i++) {
vcs_VolPhase* Vphase = VPhaseList[PhaseID[i]]; vcs_VolPhase* Vphase = VPhaseList[PhaseID[i]];
plogf("%16s %5d %16s", SpName[i].c_str(), PhaseID[i], plogf("%16s %5d %16s", SpName[i], PhaseID[i],
Vphase->PhaseName.c_str()); Vphase->PhaseName);
if (iest >= 0) { if (iest >= 0) {
plogf(" %-10.5g", w[i]); plogf(" %-10.5g", w[i]);
} else { } else {
@ -216,9 +216,9 @@ void VCS_PROB::prob_report(int print_lvl)
for (size_t iphase = 0; iphase < NPhase; iphase++) { for (size_t iphase = 0; iphase < NPhase; iphase++) {
vcs_VolPhase* Vphase = VPhaseList[iphase]; vcs_VolPhase* Vphase = VPhaseList[iphase];
std::string EOS_cstr = string16_EOSType(Vphase->m_eqnState); std::string EOS_cstr = string16_EOSType(Vphase->m_eqnState);
plogf("%16s %5d %5d %8d ", Vphase->PhaseName.c_str(), plogf("%16s %5d %5d %8d ", Vphase->PhaseName,
Vphase->VP_ID_, Vphase->m_singleSpecies, Vphase->m_gasPhase); Vphase->VP_ID_, Vphase->m_singleSpecies, Vphase->m_gasPhase);
plogf("%16s %8d %16e ", EOS_cstr.c_str(), plogf("%16s %8d %16e ", EOS_cstr,
Vphase->nSpecies(), Vphase->totalMolesInert()); Vphase->nSpecies(), Vphase->totalMolesInert());
if (iest >= 0) { if (iest >= 0) {
plogf("%16e\n", Vphase->totalMoles()); plogf("%16e\n", Vphase->totalMoles());
@ -235,7 +235,7 @@ void VCS_PROB::prob_report(int print_lvl)
} }
for (size_t i = 0; i < ne; ++i) { for (size_t i = 0; i < ne; ++i) {
writeline(' ', 26, false); writeline(' ', 26, false);
plogf("%-2.2s", ElName[i].c_str()); plogf("%-2.2s", ElName[i]);
plogf("%20.12E ", fac * gai[i]); plogf("%20.12E ", fac * gai[i]);
plogf("%3d %3d\n", m_elType[i], ElActive[i]); plogf("%3d %3d\n", m_elType[i], ElActive[i]);
} }
@ -260,9 +260,9 @@ void VCS_PROB::prob_report(int print_lvl)
Vphase->setState_TP(T, PresPA); Vphase->setState_TP(T, PresPA);
for (size_t kindex = 0; kindex < Vphase->nSpecies(); kindex++) { for (size_t kindex = 0; kindex < Vphase->nSpecies(); kindex++) {
size_t kglob = Vphase->spGlobalIndexVCS(kindex); size_t kglob = Vphase->spGlobalIndexVCS(kindex);
plogf("%16s ", SpName[kglob].c_str()); plogf("%16s ", SpName[kglob]);
if (kindex == 0) { if (kindex == 0) {
plogf("%16s", Vphase->PhaseName.c_str()); plogf("%16s", Vphase->PhaseName);
} else { } else {
plogf(" "); plogf(" ");
} }

View file

@ -94,7 +94,7 @@ int VCS_SOLVE::vcs_report(int iconv)
plogf("Mole Fraction ChemPot/RT SpecUnkType\n"); plogf("Mole Fraction ChemPot/RT SpecUnkType\n");
writeline('-', 80); writeline('-', 80);
for (size_t i = 0; i < m_numComponents; ++i) { for (size_t i = 0; i < m_numComponents; ++i) {
plogf(" %-12.12s", m_speciesName[i].c_str()); plogf(" %-12.12s", m_speciesName[i]);
writeline(' ', 13, false); writeline(' ', 13, false);
plogf("%14.7E %14.7E %12.4E", m_molNumSpecies_old[i] * molScale, plogf("%14.7E %14.7E %12.4E", m_molNumSpecies_old[i] * molScale,
m_molNumSpecies_new[i] * molScale, m_feSpecies_old[i]); m_molNumSpecies_new[i] * molScale, m_feSpecies_old[i]);
@ -103,7 +103,7 @@ int VCS_SOLVE::vcs_report(int iconv)
} }
for (size_t i = m_numComponents; i < m_numSpeciesRdc; ++i) { for (size_t i = m_numComponents; i < m_numSpeciesRdc; ++i) {
size_t l = sortindex[i]; size_t l = sortindex[i];
plogf(" %-12.12s", m_speciesName[l].c_str()); plogf(" %-12.12s", m_speciesName[l]);
writeline(' ', 13, false); writeline(' ', 13, false);
if (m_speciesUnknownType[l] == VCS_SPECIES_TYPE_MOLNUM) { if (m_speciesUnknownType[l] == VCS_SPECIES_TYPE_MOLNUM) {
@ -125,7 +125,7 @@ int VCS_SOLVE::vcs_report(int iconv)
plogf(" Inert Gas Species "); plogf(" Inert Gas Species ");
} else { } else {
plogf(" Inert Species in phase %16s ", plogf(" Inert Species in phase %16s ",
m_VolPhaseList[i]->PhaseName.c_str()); m_VolPhaseList[i]->PhaseName);
} }
plogf("%14.7E %14.7E %12.4E\n", TPhInertMoles[i] * molScale, plogf("%14.7E %14.7E %12.4E\n", TPhInertMoles[i] * molScale,
TPhInertMoles[i] / m_tPhaseMoles_old[i], 0.0); TPhInertMoles[i] / m_tPhaseMoles_old[i], 0.0);
@ -134,7 +134,7 @@ int VCS_SOLVE::vcs_report(int iconv)
if (m_numSpeciesRdc != nspecies) { if (m_numSpeciesRdc != nspecies) {
plogf("\n SPECIES WITH LESS THAN 1.0E-32 KMOLES:\n\n"); plogf("\n SPECIES WITH LESS THAN 1.0E-32 KMOLES:\n\n");
for (size_t kspec = m_numSpeciesRdc; kspec < nspecies; ++kspec) { for (size_t kspec = m_numSpeciesRdc; kspec < nspecies; ++kspec) {
plogf(" %-12.12s", m_speciesName[kspec].c_str()); plogf(" %-12.12s", m_speciesName[kspec]);
// Note m_deltaGRxn_new[] stores in kspec slot not irxn slot, after solve // Note m_deltaGRxn_new[] stores in kspec slot not irxn slot, after solve
plogf(" %14.7E %14.7E %12.4E", plogf(" %14.7E %14.7E %12.4E",
m_molNumSpecies_old[kspec]*molScale, m_molNumSpecies_old[kspec]*molScale,
@ -163,7 +163,7 @@ int VCS_SOLVE::vcs_report(int iconv)
plogf(" | |\n"); plogf(" | |\n");
plogf(" | Components|"); plogf(" | Components|");
for (size_t j = 0; j < m_numComponents; j++) { for (size_t j = 0; j < m_numComponents; j++) {
plogf(" %10.10s", m_speciesName[j].c_str()); plogf(" %10.10s", m_speciesName[j]);
} }
plogf(" | |\n"); plogf(" | |\n");
plogf(" NonComponent | Moles |"); plogf(" NonComponent | Moles |");
@ -175,7 +175,7 @@ int VCS_SOLVE::vcs_report(int iconv)
for (size_t irxn = 0; irxn < m_numRxnTot; irxn++) { for (size_t irxn = 0; irxn < m_numRxnTot; irxn++) {
size_t kspec = m_indexRxnToSpecies[irxn]; size_t kspec = m_indexRxnToSpecies[irxn];
plogf(" %3d ", kspec); plogf(" %3d ", kspec);
plogf("%-10.10s", m_speciesName[kspec].c_str()); plogf("%-10.10s", m_speciesName[kspec]);
plogf("|%10.3g |", m_molNumSpecies_old[kspec]*molScale); plogf("|%10.3g |", m_molNumSpecies_old[kspec]*molScale);
for (size_t j = 0; j < m_numComponents; j++) { for (size_t j = 0; j < m_numComponents; j++) {
plogf(" %6.2f", m_stoichCoeffRxnMatrix(j,irxn)); plogf(" %6.2f", m_stoichCoeffRxnMatrix(j,irxn));
@ -204,7 +204,7 @@ int VCS_SOLVE::vcs_report(int iconv)
plogf(" | |\n"); plogf(" | |\n");
plogf(" | Element |"); plogf(" | Element |");
for (size_t j = 0; j < m_numElemConstraints; j++) { for (size_t j = 0; j < m_numElemConstraints; j++) {
plogf(" %10.10s", m_elementName[j].c_str()); plogf(" %10.10s", m_elementName[j]);
} }
plogf(" | |\n"); plogf(" | |\n");
plogf(" PhaseName |KMolTarget |"); plogf(" PhaseName |KMolTarget |");
@ -216,7 +216,7 @@ int VCS_SOLVE::vcs_report(int iconv)
for (size_t iphase = 0; iphase < m_numPhases; iphase++) { for (size_t iphase = 0; iphase < m_numPhases; iphase++) {
plogf(" %3d ", iphase); plogf(" %3d ", iphase);
vcs_VolPhase* VPhase = m_VolPhaseList[iphase]; vcs_VolPhase* VPhase = m_VolPhaseList[iphase];
plogf("%-12.12s |",VPhase->PhaseName.c_str()); plogf("%-12.12s |",VPhase->PhaseName);
plogf("%10.3e |", m_tPhaseMoles_old[iphase]*molScale); plogf("%10.3e |", m_tPhaseMoles_old[iphase]*molScale);
totalMoles += m_tPhaseMoles_old[iphase]; totalMoles += m_tPhaseMoles_old[iphase];
if (m_tPhaseMoles_old[iphase] != VPhase->totalMoles() && if (m_tPhaseMoles_old[iphase] != VPhase->totalMoles() &&
@ -263,7 +263,7 @@ int VCS_SOLVE::vcs_report(int iconv)
plogf(" Actual Target Type ElActive\n"); plogf(" Actual Target Type ElActive\n");
for (size_t i = 0; i < m_numElemConstraints; ++i) { for (size_t i = 0; i < m_numElemConstraints; ++i) {
writeline(' ', 26, false); writeline(' ', 26, false);
plogf("%-2.2s", m_elementName[i].c_str()); plogf("%-2.2s", m_elementName[i]);
plogf("%20.12E %20.12E", m_elemAbundances[i]*molScale, m_elemAbundancesGoal[i]*molScale); plogf("%20.12E %20.12E", m_elemAbundances[i]*molScale, m_elemAbundancesGoal[i]*molScale);
plogf(" %3d %3d\n", m_elType[i], m_elementActive[i]); plogf(" %3d %3d\n", m_elType[i], m_elementActive[i]);
} }
@ -286,7 +286,7 @@ int VCS_SOLVE::vcs_report(int iconv)
for (size_t i = 0; i < nspecies; ++i) { for (size_t i = 0; i < nspecies; ++i) {
size_t l = sortindex[i]; size_t l = sortindex[i];
size_t pid = m_phaseID[l]; size_t pid = m_phaseID[l];
plogf(" %-12.12s", m_speciesName[l].c_str()); plogf(" %-12.12s", m_speciesName[l]);
plogf(" %14.7E ", m_molNumSpecies_old[l]*molScale); plogf(" %14.7E ", m_molNumSpecies_old[l]*molScale);
plogf("%14.7E ", m_SSfeSpecies[l]); plogf("%14.7E ", m_SSfeSpecies[l]);
plogf("%14.7E ", log(m_actCoeffSpecies_old[l])); plogf("%14.7E ", log(m_actCoeffSpecies_old[l]));

View file

@ -132,7 +132,7 @@ size_t VCS_SOLVE::vcs_RxnStepSizes(int& forceComponentCalc, size_t& kSpecial)
if (DEBUG_MODE_ENABLED) { if (DEBUG_MODE_ENABLED) {
sprintf(ANOTE, "Skipped: superconverged DG = %11.3E", m_deltaGRxn_new[irxn]); sprintf(ANOTE, "Skipped: superconverged DG = %11.3E", m_deltaGRxn_new[irxn]);
if (m_debug_print_lvl >= 2) { if (m_debug_print_lvl >= 2) {
plogf(" --- %-12.12s", m_speciesName[kspec].c_str()); plogf(" --- %-12.12s", m_speciesName[kspec]);
plogf(" %12.4E %12.4E %12.4E | %s\n", plogf(" %12.4E %12.4E %12.4E | %s\n",
m_molNumSpecies_old[kspec], m_deltaMolNumSpecies[kspec], m_molNumSpecies_old[kspec], m_deltaMolNumSpecies[kspec],
m_deltaGRxn_new[irxn], ANOTE); m_deltaGRxn_new[irxn], ANOTE);
@ -148,7 +148,7 @@ size_t VCS_SOLVE::vcs_RxnStepSizes(int& forceComponentCalc, size_t& kSpecial)
if (DEBUG_MODE_ENABLED) { if (DEBUG_MODE_ENABLED) {
sprintf(ANOTE, "Skipped: IC = %3d and DG >0: %11.3E", m_speciesStatus[kspec], m_deltaGRxn_new[irxn]); sprintf(ANOTE, "Skipped: IC = %3d and DG >0: %11.3E", m_speciesStatus[kspec], m_deltaGRxn_new[irxn]);
if (m_debug_print_lvl >= 2) { if (m_debug_print_lvl >= 2) {
plogf(" --- %-12.12s", m_speciesName[kspec].c_str()); plogf(" --- %-12.12s", m_speciesName[kspec]);
plogf(" %12.4E %12.4E %12.4E | %s\n", plogf(" %12.4E %12.4E %12.4E | %s\n",
m_molNumSpecies_old[kspec], m_deltaMolNumSpecies[kspec], m_molNumSpecies_old[kspec], m_deltaMolNumSpecies[kspec],
m_deltaGRxn_new[irxn], ANOTE); m_deltaGRxn_new[irxn], ANOTE);
@ -286,7 +286,7 @@ size_t VCS_SOLVE::vcs_RxnStepSizes(int& forceComponentCalc, size_t& kSpecial)
} }
m_deltaMolNumSpecies[kspec] = -m_molNumSpecies_old[kspec]; m_deltaMolNumSpecies[kspec] = -m_molNumSpecies_old[kspec];
if (DEBUG_MODE_ENABLED && m_debug_print_lvl >= 2) { if (DEBUG_MODE_ENABLED && m_debug_print_lvl >= 2) {
plogf(" --- %-12.12s", m_speciesName[kspec].c_str()); plogf(" --- %-12.12s", m_speciesName[kspec]);
plogf(" %12.4E %12.4E %12.4E | %s\n", plogf(" %12.4E %12.4E %12.4E | %s\n",
m_molNumSpecies_old[kspec], m_deltaMolNumSpecies[kspec], m_molNumSpecies_old[kspec], m_deltaMolNumSpecies[kspec],
m_deltaGRxn_new[irxn], ANOTE); m_deltaGRxn_new[irxn], ANOTE);
@ -315,12 +315,12 @@ size_t VCS_SOLVE::vcs_RxnStepSizes(int& forceComponentCalc, size_t& kSpecial)
sprintf(ANOTE, "Delete this SS phase %lu - SS components only", iphDel); sprintf(ANOTE, "Delete this SS phase %lu - SS components only", iphDel);
} }
if (m_debug_print_lvl >= 2) { if (m_debug_print_lvl >= 2) {
plogf(" --- %-12.12s", m_speciesName[kspec].c_str()); plogf(" --- %-12.12s", m_speciesName[kspec]);
plogf(" %12.4E %12.4E %12.4E | %s\n", plogf(" %12.4E %12.4E %12.4E | %s\n",
m_molNumSpecies_old[kspec], m_deltaMolNumSpecies[kspec], m_molNumSpecies_old[kspec], m_deltaMolNumSpecies[kspec],
m_deltaGRxn_new[irxn], ANOTE); m_deltaGRxn_new[irxn], ANOTE);
plogf(" --- vcs_RxnStepSizes Special section to set up to delete %s", plogf(" --- vcs_RxnStepSizes Special section to set up to delete %s",
m_speciesName[k].c_str()); m_speciesName[k]);
plogendl(); plogendl();
} }
} }
@ -340,7 +340,7 @@ size_t VCS_SOLVE::vcs_RxnStepSizes(int& forceComponentCalc, size_t& kSpecial)
} }
} /* End of regular processing */ } /* End of regular processing */
if (DEBUG_MODE_ENABLED && m_debug_print_lvl >= 2) { if (DEBUG_MODE_ENABLED && m_debug_print_lvl >= 2) {
plogf(" --- %-12.12s", m_speciesName[kspec].c_str()); plogf(" --- %-12.12s", m_speciesName[kspec]);
plogf(" %12.4E %12.4E %12.4E | %s\n", plogf(" %12.4E %12.4E %12.4E | %s\n",
m_molNumSpecies_old[kspec], m_deltaMolNumSpecies[kspec], m_molNumSpecies_old[kspec], m_deltaMolNumSpecies[kspec],
m_deltaGRxn_new[irxn], ANOTE); m_deltaGRxn_new[irxn], ANOTE);
@ -416,7 +416,7 @@ int VCS_SOLVE::vcs_rxn_adj_cg()
if (DEBUG_MODE_ENABLED) { if (DEBUG_MODE_ENABLED) {
sprintf(ANOTE, "Skipped: converged DG = %11.3E\n", m_deltaGRxn_new[irxn]); sprintf(ANOTE, "Skipped: converged DG = %11.3E\n", m_deltaGRxn_new[irxn]);
plogf(" --- "); plogf(" --- ");
plogf("%-12.12s", m_speciesName[kspec].c_str()); plogf("%-12.12s", m_speciesName[kspec]);
plogf(" %12.4E %12.4E | %s\n", m_molNumSpecies_old[kspec], plogf(" %12.4E %12.4E | %s\n", m_molNumSpecies_old[kspec],
m_deltaMolNumSpecies[kspec], ANOTE); m_deltaMolNumSpecies[kspec], ANOTE);
} }
@ -430,7 +430,7 @@ int VCS_SOLVE::vcs_rxn_adj_cg()
if (DEBUG_MODE_ENABLED) { if (DEBUG_MODE_ENABLED) {
sprintf(ANOTE, "Skipped: IC = %3d and DG >0: %11.3E\n", m_speciesStatus[kspec], m_deltaGRxn_new[irxn]); sprintf(ANOTE, "Skipped: IC = %3d and DG >0: %11.3E\n", m_speciesStatus[kspec], m_deltaGRxn_new[irxn]);
plogf(" --- "); plogf(" --- ");
plogf("%-12.12s", m_speciesName[kspec].c_str()); plogf("%-12.12s", m_speciesName[kspec]);
plogf(" %12.4E %12.4E | %s\n", m_molNumSpecies_old[kspec], plogf(" %12.4E %12.4E | %s\n", m_molNumSpecies_old[kspec],
m_deltaMolNumSpecies[kspec], ANOTE); m_deltaMolNumSpecies[kspec], ANOTE);
} }
@ -515,7 +515,7 @@ int VCS_SOLVE::vcs_rxn_adj_cg()
m_tPhaseMoles_old[m_phaseID[k]] = 0.0; m_tPhaseMoles_old[m_phaseID[k]] = 0.0;
if (DEBUG_MODE_ENABLED) { if (DEBUG_MODE_ENABLED) {
plogf(" --- vcs_st2 Special section to delete "); plogf(" --- vcs_st2 Special section to delete ");
plogf("%-12.12s", m_speciesName[k].c_str()); plogf("%-12.12s", m_speciesName[k]);
plogf("\n --- Immediate return - Restart iteration\n"); plogf("\n --- Immediate return - Restart iteration\n");
} }
/* /*
@ -534,7 +534,7 @@ int VCS_SOLVE::vcs_rxn_adj_cg()
} /* End of regular processing */ } /* End of regular processing */
if (DEBUG_MODE_ENABLED) { if (DEBUG_MODE_ENABLED) {
plogf(" --- "); plogf(" --- ");
plogf("%-12.12s", m_speciesName[kspec].c_str()); plogf("%-12.12s", m_speciesName[kspec]);
plogf(" %12.4E %12.4E | %s\n", m_molNumSpecies_old[kspec], plogf(" %12.4E %12.4E | %s\n", m_molNumSpecies_old[kspec],
m_deltaMolNumSpecies[kspec], ANOTE); m_deltaMolNumSpecies[kspec], ANOTE);
} }

View file

@ -23,7 +23,7 @@ static void printProgress(const vector<string> &spName,
plogf(" --- Name Moles - SSGibbs \n"); plogf(" --- Name Moles - SSGibbs \n");
plogf(" -------------------------------------------------------------------------------------\n"); plogf(" -------------------------------------------------------------------------------------\n");
for (size_t k = 0; k < soln.size(); k++) { for (size_t k = 0; k < soln.size(); k++) {
plogf(" --- %20s %12.4g - %12.4g\n", spName[k].c_str(), soln[k], ff[k]); plogf(" --- %20s %12.4g - %12.4g\n", spName[k], soln[k], ff[k]);
sum += soln[k] * ff[k]; sum += soln[k] * ff[k];
} }
plogf(" --- Total sum to be minimized = %g\n", sum); plogf(" --- Total sum to be minimized = %g\n", sum);
@ -130,7 +130,7 @@ int VCS_SOLVE::vcs_setMolesLinProg()
// with a new set of components // with a new set of components
if (!redo && delta_xi < 1.0e-10 && (m_molNumSpecies_old[ik] >= 1.0E-10)) { if (!redo && delta_xi < 1.0e-10 && (m_molNumSpecies_old[ik] >= 1.0E-10)) {
if (DEBUG_MODE_ENABLED && m_debug_print_lvl >= 2) { if (DEBUG_MODE_ENABLED && m_debug_print_lvl >= 2) {
plogf(" --- Component too small: %s\n", m_speciesName[jcomp].c_str()); plogf(" --- Component too small: %s\n", m_speciesName[jcomp]);
} }
redo = true; redo = true;
} }

View file

@ -73,17 +73,17 @@ void VCS_SOLVE::vcs_initSizes(const size_t nspecies0, const size_t nelements,
string ser = "VCS_SOLVE: ERROR:\n\t"; string ser = "VCS_SOLVE: ERROR:\n\t";
if (nspecies0 <= 0) { if (nspecies0 <= 0) {
plogf("%s Number of species is nonpositive\n", ser.c_str()); plogf("%s Number of species is nonpositive\n", ser);
throw CanteraError("VCS_SOLVE()", ser + throw CanteraError("VCS_SOLVE()", ser +
" Number of species is nonpositive\n"); " Number of species is nonpositive\n");
} }
if (nelements <= 0) { if (nelements <= 0) {
plogf("%s Number of elements is nonpositive\n", ser.c_str()); plogf("%s Number of elements is nonpositive\n", ser);
throw CanteraError("VCS_SOLVE()", ser + throw CanteraError("VCS_SOLVE()", ser +
" Number of species is nonpositive\n"); " Number of species is nonpositive\n");
} }
if (nphase0 <= 0) { if (nphase0 <= 0) {
plogf("%s Number of phases is nonpositive\n", ser.c_str()); plogf("%s Number of phases is nonpositive\n", ser);
throw CanteraError("VCS_SOLVE()", ser + throw CanteraError("VCS_SOLVE()", ser +
" Number of species is nonpositive\n"); " Number of species is nonpositive\n");
} }
@ -429,7 +429,7 @@ int VCS_SOLVE::vcs_prob_specifyFully(const VCS_PROB* pub)
} }
if (!nonzero) { if (!nonzero) {
plogf("vcs_prob_specifyFully:: species %d %s has a zero formula matrix!\n", i, plogf("vcs_prob_specifyFully:: species %d %s has a zero formula matrix!\n", i,
pub->SpName[i].c_str()); pub->SpName[i]);
return VCS_PUB_BAD; return VCS_PUB_BAD;
} }
} }
@ -595,7 +595,7 @@ int VCS_SOLVE::vcs_prob_specifyFully(const VCS_PROB* pub)
vcs_VolPhase* Vphase = pub->VPhaseList[iph]; vcs_VolPhase* Vphase = pub->VPhaseList[iph];
if (numPhSp[iph] != Vphase->nSpecies()) { if (numPhSp[iph] != Vphase->nSpecies()) {
plogf("%sNumber of species in phase %d, %s, doesn't match\n", plogf("%sNumber of species in phase %d, %s, doesn't match\n",
ser, iph, Vphase->PhaseName.c_str()); ser, iph, Vphase->PhaseName);
return VCS_PUB_BAD; return VCS_PUB_BAD;
} }
} }
@ -644,7 +644,7 @@ int VCS_SOLVE::vcs_prob_specifyFully(const VCS_PROB* pub)
} 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",
m_elementName[i].c_str(), m_elemAbundancesGoal[i]); m_elementName[i], m_elemAbundancesGoal[i]);
} }
m_elemAbundancesGoal[i] = 0.0; m_elemAbundancesGoal[i] = 0.0;
} }
@ -782,38 +782,34 @@ int VCS_SOLVE::vcs_prob_specify(const VCS_PROB* pub)
vcs_VolPhase* pub_phase_ptr = pub->VPhaseList[iph]; vcs_VolPhase* pub_phase_ptr = pub->VPhaseList[iph];
if (vPhase->VP_ID_ != pub_phase_ptr->VP_ID_) { if (vPhase->VP_ID_ != pub_phase_ptr->VP_ID_) {
plogf("%sPhase numbers have changed:%d %d\n", yo.c_str(), plogf("%sPhase numbers have changed:%d %d\n",
vPhase->VP_ID_, pub_phase_ptr->VP_ID_); yo, vPhase->VP_ID_, pub_phase_ptr->VP_ID_);
retn = VCS_PUB_BAD; retn = VCS_PUB_BAD;
} }
if (vPhase->m_singleSpecies != pub_phase_ptr->m_singleSpecies) { if (vPhase->m_singleSpecies != pub_phase_ptr->m_singleSpecies) {
plogf("%sSingleSpecies value have changed:%d %d\n", yo.c_str(), plogf("%sSingleSpecies value have changed:%d %d\n",
vPhase->m_singleSpecies, yo, vPhase->m_singleSpecies, pub_phase_ptr->m_singleSpecies);
pub_phase_ptr->m_singleSpecies);
retn = VCS_PUB_BAD; retn = VCS_PUB_BAD;
} }
if (vPhase->m_gasPhase != pub_phase_ptr->m_gasPhase) { if (vPhase->m_gasPhase != pub_phase_ptr->m_gasPhase) {
plogf("%sGasPhase value have changed:%d %d\n", yo.c_str(), plogf("%sGasPhase value have changed:%d %d\n",
vPhase->m_gasPhase, yo, vPhase->m_gasPhase, pub_phase_ptr->m_gasPhase);
pub_phase_ptr->m_gasPhase);
retn = VCS_PUB_BAD; retn = VCS_PUB_BAD;
} }
vPhase->m_eqnState = pub_phase_ptr->m_eqnState; vPhase->m_eqnState = pub_phase_ptr->m_eqnState;
if (vPhase->nSpecies() != pub_phase_ptr->nSpecies()) { if (vPhase->nSpecies() != pub_phase_ptr->nSpecies()) {
plogf("%sNVolSpecies value have changed:%d %d\n", yo.c_str(), plogf("%sNVolSpecies value have changed:%d %d\n",
vPhase->nSpecies(), yo, vPhase->nSpecies(), pub_phase_ptr->nSpecies());
pub_phase_ptr->nSpecies());
retn = VCS_PUB_BAD; retn = VCS_PUB_BAD;
} }
if (vPhase->PhaseName != pub_phase_ptr->PhaseName) { if (vPhase->PhaseName != pub_phase_ptr->PhaseName) {
plogf("%sPhaseName value have changed:%s %s\n", yo.c_str(), plogf("%sPhaseName value have changed:%s %s\n",
vPhase->PhaseName.c_str(), yo, vPhase->PhaseName, pub_phase_ptr->PhaseName);
pub_phase_ptr->PhaseName.c_str());
retn = VCS_PUB_BAD; retn = VCS_PUB_BAD;
} }

View file

@ -105,7 +105,7 @@ int VCS_SOLVE::vcs_solve_TP(int print_lvl, int printDetails, int maxit)
/* ******************************************************* */ /* ******************************************************* */
if (print_lvl != 0) { if (print_lvl != 0) {
plogf("VCS CALCULATION METHOD\n\n "); plogf("VCS CALCULATION METHOD\n\n ");
plogf("%s\n", m_title.c_str()); plogf("%s\n", m_title);
plogf("\n\n%5d SPECIES\n%5d ELEMENTS\n", m_numSpeciesTot, m_numElemConstraints); plogf("\n\n%5d SPECIES\n%5d ELEMENTS\n", m_numSpeciesTot, m_numElemConstraints);
plogf("%5d COMPONENTS\n", m_numComponents); plogf("%5d COMPONENTS\n", m_numComponents);
plogf("%5d PHASES\n", m_numPhases); plogf("%5d PHASES\n", m_numPhases);
@ -122,7 +122,7 @@ int VCS_SOLVE::vcs_solve_TP(int print_lvl, int printDetails, int maxit)
plogf(" FROM ESTIMATE Type\n\n"); plogf(" FROM ESTIMATE Type\n\n");
for (size_t i = 0; i < m_numElemConstraints; ++i) { for (size_t i = 0; i < m_numElemConstraints; ++i) {
writeline(' ', 26, false); writeline(' ', 26, false);
plogf("%-2.2s", m_elementName[i].c_str()); plogf("%-2.2s", m_elementName[i]);
plogf("%20.12E%20.12E %3d\n", m_elemAbundancesGoal[i], m_elemAbundances[i], plogf("%20.12E%20.12E %3d\n", m_elemAbundancesGoal[i], m_elemAbundances[i],
m_elType[i]); m_elType[i]);
} }
@ -154,12 +154,12 @@ int VCS_SOLVE::vcs_solve_TP(int print_lvl, int printDetails, int maxit)
plogf(" STAN_CHEM_POT EQUILIBRIUM_EST. Species_Type\n\n"); plogf(" STAN_CHEM_POT EQUILIBRIUM_EST. Species_Type\n\n");
writeline(' ', 20, false); writeline(' ', 20, false);
for (size_t i = 0; i < m_numElemConstraints; ++i) { for (size_t i = 0; i < m_numElemConstraints; ++i) {
plogf("%-4.4s ", m_elementName[i].c_str()); plogf("%-4.4s ", m_elementName[i]);
} }
plogf(" PhaseID\n"); plogf(" PhaseID\n");
double RT = vcs_nondimMult_TP(m_VCS_UnitsFormat, m_temperature); double RT = vcs_nondimMult_TP(m_VCS_UnitsFormat, m_temperature);
for (size_t i = 0; i < m_numSpeciesTot; ++i) { for (size_t i = 0; i < m_numSpeciesTot; ++i) {
plogf(" %-18.18s", m_speciesName[i].c_str()); plogf(" %-18.18s", m_speciesName[i]);
for (size_t j = 0; j < m_numElemConstraints; ++j) { for (size_t j = 0; j < m_numElemConstraints; ++j) {
plogf("% -7.3g ", m_formulaMatrix(i,j)); plogf("% -7.3g ", m_formulaMatrix(i,j));
} }
@ -179,9 +179,8 @@ int VCS_SOLVE::vcs_solve_TP(int print_lvl, int printDetails, int maxit)
for (size_t i = 0; i < m_numSpeciesTot; ++i) { for (size_t i = 0; i < m_numSpeciesTot; ++i) {
if (m_molNumSpecies_old[i] < 0.0) { if (m_molNumSpecies_old[i] < 0.0) {
plogf("On Input species %-12s has a " plogf("On Input species %-12s has a negative MF, setting it small",
"negative MF, setting it small", m_speciesName[i]);
m_speciesName[i].c_str());
plogendl(); plogendl();
size_t iph = m_phaseID[i]; size_t iph = m_phaseID[i];
double tmp = m_tPhaseMoles_old[iph] * VCS_RELDELETE_SPECIES_CUTOFF * 10; double tmp = m_tPhaseMoles_old[iph] * VCS_RELDELETE_SPECIES_CUTOFF * 10;
@ -620,7 +619,7 @@ void VCS_SOLVE::solve_tp_inner(size_t& iti, size_t& it1,
bool resurrect = (m_deltaMolNumSpecies[kspec] > 0.0); bool resurrect = (m_deltaMolNumSpecies[kspec] > 0.0);
if (DEBUG_MODE_ENABLED && m_debug_print_lvl >= 3) { if (DEBUG_MODE_ENABLED && m_debug_print_lvl >= 3) {
plogf(" --- %s currently zeroed (SpStatus=%-2d):", plogf(" --- %s currently zeroed (SpStatus=%-2d):",
m_speciesName[kspec].c_str(), m_speciesStatus[kspec]); m_speciesName[kspec], m_speciesStatus[kspec]);
plogf("%3d DG = %11.4E WT = %11.4E W = %11.4E DS = %11.4E\n", plogf("%3d DG = %11.4E WT = %11.4E W = %11.4E DS = %11.4E\n",
irxn, m_deltaGRxn_new[irxn], m_molNumSpecies_new[kspec], irxn, m_deltaGRxn_new[irxn], m_molNumSpecies_new[kspec],
m_molNumSpecies_old[kspec], m_deltaMolNumSpecies[kspec]); m_molNumSpecies_old[kspec], m_deltaMolNumSpecies[kspec]);
@ -669,14 +668,14 @@ void VCS_SOLVE::solve_tp_inner(size_t& iti, size_t& it1,
if (Vphase->exists() == VCS_PHASE_EXIST_NO) { if (Vphase->exists() == VCS_PHASE_EXIST_NO) {
if (DEBUG_MODE_ENABLED && m_debug_print_lvl >= 2) { if (DEBUG_MODE_ENABLED && m_debug_print_lvl >= 2) {
plogf(" --- Zeroed species changed to major: "); plogf(" --- Zeroed species changed to major: ");
plogf("%-12s\n", m_speciesName[kspec].c_str()); plogf("%-12s\n", m_speciesName[kspec]);
} }
m_speciesStatus[kspec] = VCS_SPECIES_MAJOR; m_speciesStatus[kspec] = VCS_SPECIES_MAJOR;
allMinorZeroedSpecies = false; allMinorZeroedSpecies = false;
} else { } else {
if (DEBUG_MODE_ENABLED && m_debug_print_lvl >= 2) { if (DEBUG_MODE_ENABLED && m_debug_print_lvl >= 2) {
plogf(" --- Zeroed species changed to minor: "); plogf(" --- Zeroed species changed to minor: ");
plogf("%-12s\n", m_speciesName[kspec].c_str()); plogf("%-12s\n", m_speciesName[kspec]);
} }
m_speciesStatus[kspec] = VCS_SPECIES_MINOR; m_speciesStatus[kspec] = VCS_SPECIES_MINOR;
} }
@ -712,7 +711,7 @@ void VCS_SOLVE::solve_tp_inner(size_t& iti, size_t& it1,
sprintf(ANOTE,"minor species not considered"); sprintf(ANOTE,"minor species not considered");
if (m_debug_print_lvl >= 2) { if (m_debug_print_lvl >= 2) {
plogf(" --- "); plogf(" --- ");
plogf("%-12s", m_speciesName[kspec].c_str()); plogf("%-12s", m_speciesName[kspec]);
plogf("%3d%11.4E%11.4E%11.4E | %s", plogf("%3d%11.4E%11.4E%11.4E | %s",
m_speciesStatus[kspec], m_molNumSpecies_old[kspec], m_molNumSpecies_new[kspec], m_speciesStatus[kspec], m_molNumSpecies_old[kspec], m_molNumSpecies_new[kspec],
m_deltaMolNumSpecies[kspec], ANOTE); m_deltaMolNumSpecies[kspec], ANOTE);
@ -746,7 +745,7 @@ void VCS_SOLVE::solve_tp_inner(size_t& iti, size_t& it1,
/*******************************************************************/ /*******************************************************************/
if (DEBUG_MODE_ENABLED && m_debug_print_lvl >= 2) { if (DEBUG_MODE_ENABLED && m_debug_print_lvl >= 2) {
plogf(" --- Delete minor species in multispec phase: %-12s", plogf(" --- Delete minor species in multispec phase: %-12s",
m_speciesName[kspec].c_str()); m_speciesName[kspec]);
plogendl(); plogendl();
} }
m_deltaMolNumSpecies[kspec] = 0.0; m_deltaMolNumSpecies[kspec] = 0.0;
@ -792,7 +791,7 @@ void VCS_SOLVE::solve_tp_inner(size_t& iti, size_t& it1,
sprintf(ANOTE, "major species is converged"); sprintf(ANOTE, "major species is converged");
if (m_debug_print_lvl >= 2) { if (m_debug_print_lvl >= 2) {
plogf(" --- "); plogf(" --- ");
plogf("%-12s", m_speciesName[kspec].c_str()); plogf("%-12s", m_speciesName[kspec]);
plogf("%3d%11.4E%11.4E%11.4E | %s", plogf("%3d%11.4E%11.4E%11.4E | %s",
m_speciesStatus[kspec], m_molNumSpecies_old[kspec], m_molNumSpecies_new[kspec], m_speciesStatus[kspec], m_molNumSpecies_old[kspec], m_molNumSpecies_new[kspec],
m_deltaMolNumSpecies[kspec], ANOTE); m_deltaMolNumSpecies[kspec], ANOTE);
@ -910,7 +909,7 @@ void VCS_SOLVE::solve_tp_inner(size_t& iti, size_t& it1,
doPhaseDeleteKspec = kspec; doPhaseDeleteKspec = kspec;
if (m_debug_print_lvl >= 2 && m_speciesStatus[kspec] >= 0) { if (m_debug_print_lvl >= 2 && m_speciesStatus[kspec] >= 0) {
plogf(" --- SS species changed to zeroedss: "); plogf(" --- SS species changed to zeroedss: ");
plogf("%-12s", m_speciesName[kspec].c_str()); plogf("%-12s", m_speciesName[kspec]);
plogendl(); plogendl();
} }
} }
@ -974,7 +973,7 @@ void VCS_SOLVE::solve_tp_inner(size_t& iti, size_t& it1,
if (m_debug_print_lvl >= 2) { if (m_debug_print_lvl >= 2) {
m_molNumSpecies_new[kspec] = m_molNumSpecies_old[kspec] + m_deltaMolNumSpecies[kspec]; m_molNumSpecies_new[kspec] = m_molNumSpecies_old[kspec] + m_deltaMolNumSpecies[kspec];
plogf(" --- "); plogf(" --- ");
plogf("%-12.12s", m_speciesName[kspec].c_str()); plogf("%-12.12s", m_speciesName[kspec]);
plogf("%3d%11.4E%11.4E%11.4E | %s", plogf("%3d%11.4E%11.4E%11.4E | %s",
m_speciesStatus[kspec], m_molNumSpecies_old[kspec], m_speciesStatus[kspec], m_molNumSpecies_old[kspec],
m_molNumSpecies_new[kspec], m_molNumSpecies_new[kspec],
@ -986,7 +985,7 @@ void VCS_SOLVE::solve_tp_inner(size_t& iti, size_t& it1,
if (DEBUG_MODE_ENABLED && m_debug_print_lvl >= 2) { if (DEBUG_MODE_ENABLED && m_debug_print_lvl >= 2) {
plogf(" --- "); plogf(" --- ");
plogf("%-12.12s Main Loop Special Case deleting phase with species: ", plogf("%-12.12s Main Loop Special Case deleting phase with species: ",
m_speciesName[doPhaseDeleteKspec].c_str()); m_speciesName[doPhaseDeleteKspec]);
plogendl(); plogendl();
} }
break; break;
@ -995,7 +994,7 @@ void VCS_SOLVE::solve_tp_inner(size_t& iti, size_t& it1,
if (DEBUG_MODE_ENABLED && m_debug_print_lvl >= 2) { if (DEBUG_MODE_ENABLED && m_debug_print_lvl >= 2) {
for (size_t k = 0; k < m_numComponents; k++) { for (size_t k = 0; k < m_numComponents; k++) {
plogf(" --- "); plogf(" --- ");
plogf("%-12.12s", m_speciesName[k].c_str()); plogf("%-12.12s", m_speciesName[k]);
plogf(" c%11.4E%11.4E%11.4E |\n", plogf(" c%11.4E%11.4E%11.4E |\n",
m_molNumSpecies_old[k], m_molNumSpecies_old[k],
m_molNumSpecies_old[k]+m_deltaMolNumSpecies[k], m_deltaMolNumSpecies[k]); m_molNumSpecies_old[k]+m_deltaMolNumSpecies[k], m_deltaMolNumSpecies[k]);
@ -1038,7 +1037,7 @@ void VCS_SOLVE::solve_tp_inner(size_t& iti, size_t& it1,
par *= 0.99; par *= 0.99;
if (DEBUG_MODE_ENABLED && m_debug_print_lvl >= 2) { if (DEBUG_MODE_ENABLED && m_debug_print_lvl >= 2) {
plogf(" --- Reduction in step size due to component "); plogf(" --- Reduction in step size due to component ");
plogf("%s", m_speciesName[ll].c_str()); plogf("%s", m_speciesName[ll]);
plogf(" going negative = %11.3E", par); plogf(" going negative = %11.3E", par);
plogendl(); plogendl();
} }
@ -1123,13 +1122,13 @@ void VCS_SOLVE::solve_tp_inner(size_t& iti, size_t& it1,
plogf(" --- SPECIES Status INIT MOLES TENT_MOLES"); plogf(" --- SPECIES Status INIT MOLES TENT_MOLES");
plogf(" FINAL KMOLES INIT_DEL_G/RT TENT_DEL_G/RT FINAL_DELTA_G/RT\n"); plogf(" FINAL KMOLES INIT_DEL_G/RT TENT_DEL_G/RT FINAL_DELTA_G/RT\n");
for (size_t i = 0; i < m_numComponents; ++i) { for (size_t i = 0; i < m_numComponents; ++i) {
plogf(" --- %-12.12s", m_speciesName[i].c_str()); plogf(" --- %-12.12s", m_speciesName[i]);
plogf(" %14.6E %14.6E %14.6E\n", m_molNumSpecies_old[i], plogf(" %14.6E %14.6E %14.6E\n", m_molNumSpecies_old[i],
m_molNumSpecies_old[i] + m_deltaMolNumSpecies[i], m_molNumSpecies_new[i]); m_molNumSpecies_old[i] + m_deltaMolNumSpecies[i], m_molNumSpecies_new[i]);
} }
for (size_t kspec = m_numComponents; kspec < m_numSpeciesRdc; ++kspec) { for (size_t kspec = m_numComponents; kspec < m_numSpeciesRdc; ++kspec) {
size_t irxn = kspec - m_numComponents; size_t irxn = kspec - m_numComponents;
plogf(" --- %-12.12s", m_speciesName[kspec].c_str()); plogf(" --- %-12.12s", m_speciesName[kspec]);
plogf(" %2d %14.6E%14.6E%14.6E%14.6E%14.6E%14.6E\n", m_speciesStatus[kspec], plogf(" %2d %14.6E%14.6E%14.6E%14.6E%14.6E%14.6E\n", m_speciesStatus[kspec],
m_molNumSpecies_old[kspec], m_molNumSpecies_old[kspec],
m_molNumSpecies_old[kspec]+m_deltaMolNumSpecies[kspec], m_molNumSpecies_old[kspec]+m_deltaMolNumSpecies[kspec],
@ -1173,14 +1172,14 @@ void VCS_SOLVE::solve_tp_inner(size_t& iti, size_t& it1,
plogf(" --- Species Status Initial_KMoles Final_KMoles Initial_Mu/RT"); plogf(" --- Species Status Initial_KMoles Final_KMoles Initial_Mu/RT");
plogf(" Mu/RT Init_Del_G/RT Delta_G/RT\n"); plogf(" Mu/RT Init_Del_G/RT Delta_G/RT\n");
for (size_t i = 0; i < m_numComponents; ++i) { for (size_t i = 0; i < m_numComponents; ++i) {
plogf(" --- %-12.12s", m_speciesName[i].c_str()); plogf(" --- %-12.12s", m_speciesName[i]);
plogf(" "); plogf(" ");
plogf("%14.6E%14.6E%14.6E%14.6E\n", m_molNumSpecies_old[i], plogf("%14.6E%14.6E%14.6E%14.6E\n", m_molNumSpecies_old[i],
m_molNumSpecies_new[i], m_feSpecies_old[i], m_feSpecies_new[i]); m_molNumSpecies_new[i], m_feSpecies_old[i], m_feSpecies_new[i]);
} }
for (size_t i = m_numComponents; i < m_numSpeciesRdc; ++i) { for (size_t i = m_numComponents; i < m_numSpeciesRdc; ++i) {
size_t l1 = i - m_numComponents; size_t l1 = i - m_numComponents;
plogf(" --- %-12.12s", m_speciesName[i].c_str()); plogf(" --- %-12.12s", m_speciesName[i]);
plogf(" %2d %14.6E%14.6E%14.6E%14.6E%14.6E%14.6E\n", plogf(" %2d %14.6E%14.6E%14.6E%14.6E%14.6E%14.6E\n",
m_speciesStatus[i], m_molNumSpecies_old[i], m_speciesStatus[i], m_molNumSpecies_old[i],
m_molNumSpecies_new[i], m_feSpecies_old[i], m_feSpecies_new[i], m_molNumSpecies_new[i], m_feSpecies_old[i], m_feSpecies_new[i],
@ -1188,7 +1187,7 @@ void VCS_SOLVE::solve_tp_inner(size_t& iti, size_t& it1,
} }
for (size_t kspec = m_numSpeciesRdc; kspec < m_numSpeciesTot; ++kspec) { for (size_t kspec = m_numSpeciesRdc; kspec < m_numSpeciesTot; ++kspec) {
size_t l1 = kspec - m_numComponents; size_t l1 = kspec - m_numComponents;
plogf(" --- %-12.12s", m_speciesName[kspec].c_str()); plogf(" --- %-12.12s", m_speciesName[kspec]);
plogf(" %2d %14.6E%14.6E%14.6E%14.6E%14.6E%14.6E\n", plogf(" %2d %14.6E%14.6E%14.6E%14.6E%14.6E%14.6E\n",
m_speciesStatus[kspec], m_molNumSpecies_old[kspec], m_speciesStatus[kspec], m_molNumSpecies_old[kspec],
m_molNumSpecies_new[kspec], m_feSpecies_old[kspec], m_feSpecies_new[kspec], m_molNumSpecies_new[kspec], m_feSpecies_old[kspec], m_feSpecies_new[kspec],
@ -1206,7 +1205,7 @@ void VCS_SOLVE::solve_tp_inner(size_t& iti, size_t& it1,
writeline('-', 50); writeline('-', 50);
for (size_t iph = 0; iph < m_numPhases; iph++) { for (size_t iph = 0; iph < m_numPhases; iph++) {
vcs_VolPhase* Vphase = m_VolPhaseList[iph]; vcs_VolPhase* Vphase = m_VolPhaseList[iph];
plogf(" --- %18s = %15.7E\n", Vphase->PhaseName.c_str(), m_tPhaseMoles_new[iph]); plogf(" --- %18s = %15.7E\n", Vphase->PhaseName, m_tPhaseMoles_new[iph]);
} }
plogf(" "); plogf(" ");
writeline('-', 103); writeline('-', 103);
@ -1350,9 +1349,9 @@ void VCS_SOLVE::solve_tp_inner(size_t& iti, size_t& it1,
if (doSwap && m_stoichCoeffRxnMatrix(j,i) != 0.0) { if (doSwap && m_stoichCoeffRxnMatrix(j,i) != 0.0) {
if (DEBUG_MODE_ENABLED && m_debug_print_lvl >= 2) { if (DEBUG_MODE_ENABLED && m_debug_print_lvl >= 2) {
plogf(" --- Get a new basis because "); plogf(" --- Get a new basis because ");
plogf("%s", m_speciesName[l].c_str()); plogf("%s", m_speciesName[l]);
plogf(" is better than comp "); plogf(" is better than comp ");
plogf("%s", m_speciesName[j].c_str()); plogf("%s", m_speciesName[j]);
plogf(" and share nonzero stoic: %-9.1f", plogf(" and share nonzero stoic: %-9.1f",
m_stoichCoeffRxnMatrix(j,i)); m_stoichCoeffRxnMatrix(j,i));
plogendl(); plogendl();
@ -1387,7 +1386,7 @@ void VCS_SOLVE::solve_tp_inner(size_t& iti, size_t& it1,
if (speciesType < VCS_SPECIES_MINOR) { if (speciesType < VCS_SPECIES_MINOR) {
if (DEBUG_MODE_ENABLED && m_debug_print_lvl >= 2 && m_speciesStatus[kspec] >= VCS_SPECIES_MINOR) { if (DEBUG_MODE_ENABLED && m_debug_print_lvl >= 2 && m_speciesStatus[kspec] >= VCS_SPECIES_MINOR) {
plogf(" --- major/minor species is now zeroed out: %s\n", plogf(" --- major/minor species is now zeroed out: %s\n",
m_speciesName[kspec].c_str()); m_speciesName[kspec]);
} }
++m_numRxnMinorZeroed; ++m_numRxnMinorZeroed;
} else if (speciesType == VCS_SPECIES_MINOR) { } else if (speciesType == VCS_SPECIES_MINOR) {
@ -1400,7 +1399,7 @@ void VCS_SOLVE::solve_tp_inner(size_t& iti, size_t& it1,
plogf(" --- Zeroed Species turned into a " plogf(" --- Zeroed Species turned into a "
"minor species: "); "minor species: ");
} }
plogf("%s\n", m_speciesName[kspec].c_str()); plogf("%s\n", m_speciesName[kspec]);
} }
++m_numRxnMinorZeroed; ++m_numRxnMinorZeroed;
} else if (speciesType == VCS_SPECIES_MAJOR) { } else if (speciesType == VCS_SPECIES_MAJOR) {
@ -1413,7 +1412,7 @@ void VCS_SOLVE::solve_tp_inner(size_t& iti, size_t& it1,
} else { } else {
plogf(" --- Noncomponent turned from zeroed to major: "); plogf(" --- Noncomponent turned from zeroed to major: ");
} }
plogf("%s\n", m_speciesName[kspec].c_str()); plogf("%s\n", m_speciesName[kspec]);
} }
m_speciesStatus[kspec] = VCS_SPECIES_MAJOR; m_speciesStatus[kspec] = VCS_SPECIES_MAJOR;
} }
@ -1449,7 +1448,7 @@ void VCS_SOLVE::solve_tp_equilib_check(bool& allMinorZeroedSpecies,
stage = RETURN_A; stage = RETURN_A;
} else { } else {
if (DEBUG_MODE_ENABLED && m_debug_print_lvl >= 2) { if (DEBUG_MODE_ENABLED && m_debug_print_lvl >= 2) {
plogf("%s failed\n", m_speciesName[m_indexRxnToSpecies[irxn]].c_str()); plogf("%s failed\n", m_speciesName[m_indexRxnToSpecies[irxn]]);
} }
// Convergence amongst major species has not been achieved // Convergence amongst major species has not been achieved
/* /*
@ -1502,7 +1501,7 @@ void VCS_SOLVE::solve_tp_equilib_check(bool& allMinorZeroedSpecies,
return; return;
} }
if (DEBUG_MODE_ENABLED && m_debug_print_lvl >= 2) { if (DEBUG_MODE_ENABLED && m_debug_print_lvl >= 2) {
plogf("%s failed\n", m_speciesName[m_indexRxnToSpecies[irxn]].c_str()); plogf("%s failed\n", m_speciesName[m_indexRxnToSpecies[irxn]]);
} }
/* /*
* Set iti to zero to force a full calculation, and go back * Set iti to zero to force a full calculation, and go back
@ -1894,7 +1893,7 @@ void VCS_SOLVE::vcs_reinsert_deleted(size_t kspec)
{ {
size_t iph = m_phaseID[kspec]; size_t iph = m_phaseID[kspec];
if (DEBUG_MODE_ENABLED && m_debug_print_lvl >= 2) { if (DEBUG_MODE_ENABLED && m_debug_print_lvl >= 2) {
plogf(" --- Add back a deleted species: %-12s\n", m_speciesName[kspec].c_str()); plogf(" --- Add back a deleted species: %-12s\n", m_speciesName[kspec]);
} }
/* /*
* Set the species back to minor species status * Set the species back to minor species status
@ -1957,7 +1956,7 @@ bool VCS_SOLVE::vcs_delete_multiphase(const size_t iph)
*/ */
Vphase->setTotalMoles(0.0); Vphase->setTotalMoles(0.0);
if (DEBUG_MODE_ENABLED && m_debug_print_lvl >= 2) { if (DEBUG_MODE_ENABLED && m_debug_print_lvl >= 2) {
plogf(" --- delete_multiphase %d, %s\n", iph, Vphase->PhaseName.c_str()); plogf(" --- delete_multiphase %d, %s\n", iph, Vphase->PhaseName);
} }
/* /*
@ -1977,7 +1976,7 @@ bool VCS_SOLVE::vcs_delete_multiphase(const size_t iph)
successful = false; successful = false;
if (DEBUG_MODE_ENABLED && m_debug_print_lvl >= 2) { if (DEBUG_MODE_ENABLED && m_debug_print_lvl >= 2) {
plogf(" --- delete_multiphase %d, %s ERROR problems deleting species %s\n", plogf(" --- delete_multiphase %d, %s ERROR problems deleting species %s\n",
iph, Vphase->PhaseName.c_str(), m_speciesName[kspec].c_str()); iph, Vphase->PhaseName, m_speciesName[kspec]);
plogf(" --- delta attempted: %g achieved: %g " plogf(" --- delta attempted: %g achieved: %g "
" Zeroing it manually\n", dx, dxTent); " Zeroing it manually\n", dx, dxTent);
} }
@ -2008,7 +2007,7 @@ bool VCS_SOLVE::vcs_delete_multiphase(const size_t iph)
if (m_phaseID[kcomp] == iph) { if (m_phaseID[kcomp] == iph) {
if (DEBUG_MODE_ENABLED && m_debug_print_lvl >= 2) { if (DEBUG_MODE_ENABLED && m_debug_print_lvl >= 2) {
plogf(" --- delete_multiphase One of the species is a component %d - %s with mole number %g\n", plogf(" --- delete_multiphase One of the species is a component %d - %s with mole number %g\n",
kcomp, m_speciesName[kcomp].c_str(), m_molNumSpecies_old[kcomp]); kcomp, m_speciesName[kcomp], m_molNumSpecies_old[kcomp]);
} }
if (m_molNumSpecies_old[kcomp] != 0.0) { if (m_molNumSpecies_old[kcomp] != 0.0) {
for (size_t kspec = m_numComponents; kspec < m_numSpeciesRdc; ++kspec) { for (size_t kspec = m_numComponents; kspec < m_numSpeciesRdc; ++kspec) {
@ -2045,7 +2044,7 @@ bool VCS_SOLVE::vcs_delete_multiphase(const size_t iph)
if (m_molNumSpecies_old[kcomp] != 0.0) { if (m_molNumSpecies_old[kcomp] != 0.0) {
if (DEBUG_MODE_ENABLED && m_debug_print_lvl >= 2) { if (DEBUG_MODE_ENABLED && m_debug_print_lvl >= 2) {
plogf(" --- delete_multiphase One of the species is a component %d - %s still with mole number %g\n", plogf(" --- delete_multiphase One of the species is a component %d - %s still with mole number %g\n",
kcomp, m_speciesName[kcomp].c_str(), m_molNumSpecies_old[kcomp]); kcomp, m_speciesName[kcomp], m_molNumSpecies_old[kcomp]);
plogf(" --- zeroing it \n"); plogf(" --- zeroing it \n");
} }
m_molNumSpecies_old[kcomp] = 0.0; m_molNumSpecies_old[kcomp] = 0.0;
@ -2073,7 +2072,7 @@ bool VCS_SOLVE::vcs_delete_multiphase(const size_t iph)
++m_numRxnRdc; ++m_numRxnRdc;
++m_numSpeciesRdc; ++m_numSpeciesRdc;
if (DEBUG_MODE_ENABLED && m_debug_print_lvl >= 2) { if (DEBUG_MODE_ENABLED && m_debug_print_lvl >= 2) {
plogf(" --- Make %s", m_speciesName[kspec].c_str()); plogf(" --- Make %s", m_speciesName[kspec]);
plogf(" an active but zeroed species because its phase " plogf(" an active but zeroed species because its phase "
"was zeroed\n"); "was zeroed\n");
} }
@ -2264,21 +2263,21 @@ size_t VCS_SOLVE::vcs_add_all_deleted()
if (retn == 0) { if (retn == 0) {
if (DEBUG_MODE_ENABLED && m_debug_print_lvl) { if (DEBUG_MODE_ENABLED && m_debug_print_lvl) {
plogf(" --- add_deleted(): delta_species() failed for species %s (%d) with mol number %g\n", plogf(" --- add_deleted(): delta_species() failed for species %s (%d) with mol number %g\n",
m_speciesName[kspec].c_str(), kspec, dx); m_speciesName[kspec], kspec, dx);
} }
if (dx > 1.0E-50) { if (dx > 1.0E-50) {
dx = 1.0E-50; dx = 1.0E-50;
retn = delta_species(kspec, &dx); retn = delta_species(kspec, &dx);
if (DEBUG_MODE_ENABLED && retn == 0 && m_debug_print_lvl) { if (DEBUG_MODE_ENABLED && retn == 0 && m_debug_print_lvl) {
plogf(" --- add_deleted(): delta_species() failed for species %s (%d) with mol number %g\n", plogf(" --- add_deleted(): delta_species() failed for species %s (%d) with mol number %g\n",
m_speciesName[kspec].c_str(), kspec, dx); m_speciesName[kspec], kspec, dx);
} }
} }
} }
if (DEBUG_MODE_ENABLED && m_debug_print_lvl >= 2) { if (DEBUG_MODE_ENABLED && m_debug_print_lvl >= 2) {
if (retn != 0) { if (retn != 0) {
plogf(" --- add_deleted(): species %s added back in with mol number %g", plogf(" --- add_deleted(): species %s added back in with mol number %g",
m_speciesName[kspec].c_str(), dx); m_speciesName[kspec], dx);
plogendl(); plogendl();
} else { } else {
plogf(" --- add_deleted(): species %s failed to be added back in"); plogf(" --- add_deleted(): species %s failed to be added back in");
@ -2302,7 +2301,7 @@ size_t VCS_SOLVE::vcs_add_all_deleted()
retn++; retn++;
if (DEBUG_MODE_ENABLED && m_debug_print_lvl >= 2) { if (DEBUG_MODE_ENABLED && m_debug_print_lvl >= 2) {
plogf(" --- add_deleted(): species %s with mol number %g not converged: DG = %g", plogf(" --- add_deleted(): species %s with mol number %g not converged: DG = %g",
m_speciesName[kspec].c_str(), m_molNumSpecies_old[kspec], m_speciesName[kspec], m_molNumSpecies_old[kspec],
m_deltaGRxn_old[irxn]); m_deltaGRxn_old[irxn]);
plogendl(); plogendl();
} }
@ -2693,13 +2692,13 @@ int VCS_SOLVE::vcs_basopt(const bool doJustComponents, double aw[], double sa[],
/* ****************************************** */ /* ****************************************** */
if (jr != k) { if (jr != k) {
if (DEBUG_MODE_ENABLED && m_debug_print_lvl >= 2) { if (DEBUG_MODE_ENABLED && m_debug_print_lvl >= 2) {
plogf(" --- %-12.12s", m_speciesName[k].c_str()); plogf(" --- %-12.12s", m_speciesName[k]);
if (m_speciesUnknownType[k] == VCS_SPECIES_TYPE_INTERFACIALVOLTAGE) { if (m_speciesUnknownType[k] == VCS_SPECIES_TYPE_INTERFACIALVOLTAGE) {
plogf("(Volts = %9.2g)", m_molNumSpecies_old[k]); plogf("(Volts = %9.2g)", m_molNumSpecies_old[k]);
} else { } else {
plogf("(%9.2g)", m_molNumSpecies_old[k]); plogf("(%9.2g)", m_molNumSpecies_old[k]);
} }
plogf(" replaces %-12.12s", m_speciesName[jr].c_str()); plogf(" replaces %-12.12s", m_speciesName[jr]);
if (m_speciesUnknownType[jr] == VCS_SPECIES_TYPE_INTERFACIALVOLTAGE) { if (m_speciesUnknownType[jr] == VCS_SPECIES_TYPE_INTERFACIALVOLTAGE) {
plogf("(Volts = %9.2g)", m_molNumSpecies_old[jr]); plogf("(Volts = %9.2g)", m_molNumSpecies_old[jr]);
} else { } else {
@ -2710,7 +2709,7 @@ int VCS_SOLVE::vcs_basopt(const bool doJustComponents, double aw[], double sa[],
vcs_switch_pos(false, jr, k); vcs_switch_pos(false, jr, k);
std::swap(aw[jr], aw[k]); std::swap(aw[jr], aw[k]);
} else if (DEBUG_MODE_ENABLED && m_debug_print_lvl >= 2) { } else if (DEBUG_MODE_ENABLED && m_debug_print_lvl >= 2) {
plogf(" --- %-12.12s", m_speciesName[k].c_str()); plogf(" --- %-12.12s", m_speciesName[k]);
if (m_speciesUnknownType[k] == VCS_SPECIES_TYPE_INTERFACIALVOLTAGE) { if (m_speciesUnknownType[k] == VCS_SPECIES_TYPE_INTERFACIALVOLTAGE) {
plogf("(Volts = %9.2g) remains ", m_molNumSpecies_old[k]); plogf("(Volts = %9.2g) remains ", m_molNumSpecies_old[k]);
} else { } else {
@ -2862,12 +2861,12 @@ L_END_LOOP:
} }
plogf("\n --- NonComponent| Moles |"); plogf("\n --- NonComponent| Moles |");
for (size_t j = 0; j < ncTrial; j++) { for (size_t j = 0; j < ncTrial; j++) {
plogf(" %10.10s", m_speciesName[j].c_str()); plogf(" %10.10s", m_speciesName[j]);
} }
plogf("\n"); plogf("\n");
for (size_t i = 0; i < m_numRxnTot; i++) { for (size_t i = 0; i < m_numRxnTot; i++) {
plogf(" --- %3d ", m_indexRxnToSpecies[i]); plogf(" --- %3d ", m_indexRxnToSpecies[i]);
plogf("%-10.10s", m_speciesName[m_indexRxnToSpecies[i]].c_str()); plogf("%-10.10s", m_speciesName[m_indexRxnToSpecies[i]]);
if (m_speciesUnknownType[m_indexRxnToSpecies[i]] == VCS_SPECIES_TYPE_INTERFACIALVOLTAGE) { if (m_speciesUnknownType[m_indexRxnToSpecies[i]] == VCS_SPECIES_TYPE_INTERFACIALVOLTAGE) {
plogf("|% -10.3E|", 0.0); plogf("|% -10.3E|", 0.0);
} else { } else {
@ -2919,9 +2918,9 @@ L_END_LOOP:
} }
} }
plogf(" --- largest error in Stoich coeff = %g at rxn = %d ", sumMax, iMax); plogf(" --- largest error in Stoich coeff = %g at rxn = %d ", sumMax, iMax);
plogf("%-10.10s", m_speciesName[m_indexRxnToSpecies[iMax]].c_str()); plogf("%-10.10s", m_speciesName[m_indexRxnToSpecies[iMax]]);
plogf(" element = %d ", jMax); plogf(" element = %d ", jMax);
plogf("%-5.5s", m_elementName[jMax].c_str()); plogf("%-5.5s", m_elementName[jMax]);
plogf("\n"); plogf("\n");
plogf(" "); plogf(" ");
for (size_t i=0; i<77; i++) { for (size_t i=0; i<77; i++) {
@ -3058,7 +3057,7 @@ int VCS_SOLVE::vcs_species_type(const size_t kspec) const
if (DEBUG_MODE_ENABLED && m_debug_print_lvl >= 2) { if (DEBUG_MODE_ENABLED && m_debug_print_lvl >= 2) {
plogf(" --- %s can not be nonzero because" plogf(" --- %s can not be nonzero because"
" needed element %s is zero\n", " needed element %s is zero\n",
m_speciesName[kspec].c_str(), m_elementName[j].c_str()); m_speciesName[kspec], m_elementName[j]);
} }
if (m_SSPhase[kspec]) { if (m_SSPhase[kspec]) {
return VCS_SPECIES_ZEROEDSS; return VCS_SPECIES_ZEROEDSS;
@ -3087,7 +3086,7 @@ int VCS_SOLVE::vcs_species_type(const size_t kspec) const
if (DEBUG_MODE_ENABLED && m_debug_print_lvl >= 2) { if (DEBUG_MODE_ENABLED && m_debug_print_lvl >= 2) {
plogf(" --- %s is prevented from popping into existence because" plogf(" --- %s is prevented from popping into existence because"
" a needed component to be consumed, %s, has a zero mole number\n", " a needed component to be consumed, %s, has a zero mole number\n",
m_speciesName[kspec].c_str(), m_speciesName[j].c_str()); m_speciesName[kspec], m_speciesName[j]);
} }
if (m_SSPhase[kspec]) { if (m_SSPhase[kspec]) {
return VCS_SPECIES_ZEROEDSS; return VCS_SPECIES_ZEROEDSS;
@ -3103,7 +3102,7 @@ int VCS_SOLVE::vcs_species_type(const size_t kspec) const
plogf(" --- %s is prevented from popping into existence because" plogf(" --- %s is prevented from popping into existence because"
" a needed component %s is in a zeroed-phase that would be " " a needed component %s is in a zeroed-phase that would be "
"popped into existence at the same time\n", "popped into existence at the same time\n",
m_speciesName[kspec].c_str(), m_speciesName[j].c_str()); m_speciesName[kspec], m_speciesName[j]);
} }
if (m_SSPhase[kspec]) { if (m_SSPhase[kspec]) {
return VCS_SPECIES_ZEROEDSS; return VCS_SPECIES_ZEROEDSS;
@ -3284,7 +3283,7 @@ void VCS_SOLVE::vcs_dfe(const int stateCalc,
if (ll == 0) { if (ll == 0) {
if (lbot != 0) { if (lbot != 0) {
plogf(" --- Subroutine vcs_dfe called for one species: "); plogf(" --- Subroutine vcs_dfe called for one species: ");
plogf("%-12.12s", m_speciesName[lbot].c_str()); plogf("%-12.12s", m_speciesName[lbot]);
} else { } else {
plogf(" --- Subroutine vcs_dfe called for all species"); plogf(" --- Subroutine vcs_dfe called for all species");
} }
@ -3583,7 +3582,7 @@ void VCS_SOLVE::prneav() const
plogf(" Element Now Orignal Deviation Type\n"); plogf(" Element Now Orignal Deviation Type\n");
for (size_t j = 0; j < m_numElemConstraints; ++j) { for (size_t j = 0; j < m_numElemConstraints; ++j) {
plogf(" "); plogf(" ");
plogf("%-2.2s", m_elementName[j].c_str()); plogf("%-2.2s", m_elementName[j]);
plogf(" = %15.6E %15.6E %15.6E %3d\n", plogf(" = %15.6E %15.6E %15.6E %3d\n",
eav[j], m_elemAbundancesGoal[j], eav[j] - m_elemAbundancesGoal[j], m_elType[j]); eav[j], m_elemAbundancesGoal[j], eav[j] - m_elemAbundancesGoal[j], m_elType[j]);
if (m_elemAbundancesGoal[j] != 0.) { if (m_elemAbundancesGoal[j] != 0.) {
@ -3700,7 +3699,7 @@ bool VCS_SOLVE::vcs_evaluate_speciesType()
for (size_t kspec = 0; kspec < m_numSpeciesTot; ++kspec) { for (size_t kspec = 0; kspec < m_numSpeciesTot; ++kspec) {
m_speciesStatus[kspec] = vcs_species_type(kspec); m_speciesStatus[kspec] = vcs_species_type(kspec);
if (DEBUG_MODE_ENABLED && m_debug_print_lvl >= 5) { if (DEBUG_MODE_ENABLED && m_debug_print_lvl >= 5) {
plogf(" --- %-16s: ", m_speciesName[kspec].c_str()); plogf(" --- %-16s: ", m_speciesName[kspec]);
if (kspec < m_numComponents) { if (kspec < m_numComponents) {
plogf("(COMP) "); plogf("(COMP) ");
} else { } else {
@ -3715,31 +3714,31 @@ bool VCS_SOLVE::vcs_evaluate_speciesType()
case VCS_SPECIES_COMPONENT: case VCS_SPECIES_COMPONENT:
break; break;
case VCS_SPECIES_MAJOR: case VCS_SPECIES_MAJOR:
plogf(" --- Major Species : %-s\n", m_speciesName[kspec].c_str()); plogf(" --- Major Species : %-s\n", m_speciesName[kspec]);
break; break;
case VCS_SPECIES_ZEROEDPHASE: case VCS_SPECIES_ZEROEDPHASE:
plogf(" --- Purposely Zeroed-Phase Species (not in problem): %-s\n", plogf(" --- Purposely Zeroed-Phase Species (not in problem): %-s\n",
m_speciesName[kspec].c_str()); m_speciesName[kspec]);
break; break;
case VCS_SPECIES_ZEROEDMS: case VCS_SPECIES_ZEROEDMS:
plogf(" --- Zeroed-MS Phase Species: %-s\n", m_speciesName[kspec].c_str()); plogf(" --- Zeroed-MS Phase Species: %-s\n", m_speciesName[kspec]);
break; break;
case VCS_SPECIES_ZEROEDSS: case VCS_SPECIES_ZEROEDSS:
plogf(" --- Zeroed-SS Phase Species: %-s\n", m_speciesName[kspec].c_str()); plogf(" --- Zeroed-SS Phase Species: %-s\n", m_speciesName[kspec]);
break; break;
case VCS_SPECIES_DELETED: case VCS_SPECIES_DELETED:
plogf(" --- Deleted-Small Species : %-s\n", m_speciesName[kspec].c_str()); plogf(" --- Deleted-Small Species : %-s\n", m_speciesName[kspec]);
break; break;
case VCS_SPECIES_ACTIVEBUTZERO: case VCS_SPECIES_ACTIVEBUTZERO:
plogf(" --- Zeroed Species in an active MS phase (tmp): %-s\n", plogf(" --- Zeroed Species in an active MS phase (tmp): %-s\n",
m_speciesName[kspec].c_str()); m_speciesName[kspec]);
break; break;
case VCS_SPECIES_STOICHZERO: case VCS_SPECIES_STOICHZERO:
plogf(" --- Zeroed Species in an active MS phase (Stoich Constraint): %-s\n", plogf(" --- Zeroed Species in an active MS phase (Stoich Constraint): %-s\n",
m_speciesName[kspec].c_str()); m_speciesName[kspec]);
break; break;
case VCS_SPECIES_INTERFACIALVOLTAGE: case VCS_SPECIES_INTERFACIALVOLTAGE:
plogf(" --- InterfaceVoltage Species: %-s\n", m_speciesName[kspec].c_str()); plogf(" --- InterfaceVoltage Species: %-s\n", m_speciesName[kspec]);
break; break;
default: default:
throw CanteraError("VCS_SOLVE::vcs_evaluate_speciesType", throw CanteraError("VCS_SOLVE::vcs_evaluate_speciesType",
@ -3975,12 +3974,12 @@ void VCS_SOLVE::vcs_printDeltaG(const int stateCalc)
} }
plogf("\n --- NonComponent| Moles | "); plogf("\n --- NonComponent| Moles | ");
for (size_t j = 0; j < m_numComponents; j++) { for (size_t j = 0; j < m_numComponents; j++) {
plogf("%-10.10s", m_speciesName[j].c_str()); plogf("%-10.10s", m_speciesName[j]);
} }
plogf("\n"); plogf("\n");
for (size_t i = 0; i < m_numRxnTot; i++) { for (size_t i = 0; i < m_numRxnTot; i++) {
plogf(" --- %3d ", m_indexRxnToSpecies[i]); plogf(" --- %3d ", m_indexRxnToSpecies[i]);
plogf("%-10.10s", m_speciesName[m_indexRxnToSpecies[i]].c_str()); plogf("%-10.10s", m_speciesName[m_indexRxnToSpecies[i]]);
if (m_speciesUnknownType[m_indexRxnToSpecies[i]] == VCS_SPECIES_TYPE_INTERFACIALVOLTAGE) { if (m_speciesUnknownType[m_indexRxnToSpecies[i]] == VCS_SPECIES_TYPE_INTERFACIALVOLTAGE) {
plogf("| NA |"); plogf("| NA |");
} else { } else {

View file

@ -373,7 +373,7 @@ void OneDim::save(const std::string& fname, std::string id,
struct tm* newtime = localtime(&aclock); // Convert time to struct tm form struct tm* newtime = localtime(&aclock); // Convert time to struct tm form
XML_Node root("ctml"); XML_Node root("ctml");
ifstream fin(fname.c_str()); ifstream fin(fname);
if (fin) { if (fin) {
root.build(fin); root.build(fin);
// Remove existing solution with the same id // Remove existing solution with the same id
@ -395,7 +395,7 @@ void OneDim::save(const std::string& fname, std::string id,
d->save(sim, sol); d->save(sim, sol);
d = d->right(); d = d->right();
} }
ofstream s(fname.c_str()); ofstream s(fname);
if (!s) { if (!s) {
throw CanteraError("OneDim::save","could not open file "+fname); throw CanteraError("OneDim::save","could not open file "+fname);
} }

View file

@ -106,7 +106,7 @@ void Sim1D::saveResidual(const std::string& fname, const std::string& id,
void Sim1D::restore(const std::string& fname, const std::string& id, void Sim1D::restore(const std::string& fname, const std::string& id,
int loglevel) int loglevel)
{ {
ifstream s(fname.c_str()); ifstream s(fname);
if (!s) { if (!s) {
throw CanteraError("Sim1D::restore", throw CanteraError("Sim1D::restore",
"could not open input file "+fname); "could not open input file "+fname);

View file

@ -155,7 +155,7 @@ void IonsFromNeutralVPSSTP::constructPhaseFile(std::string inputFile, std::strin
"input file is null"); "input file is null");
} }
string path = findInputFile(inputFile); string path = findInputFile(inputFile);
std::ifstream fin(path.c_str()); std::ifstream fin(path);
if (!fin) { if (!fin) {
throw CanteraError("MargulesVPSSTP:constructPhaseFile","could not open " throw CanteraError("MargulesVPSSTP:constructPhaseFile","could not open "
+path+" for reading."); +path+" for reading.");

View file

@ -296,7 +296,6 @@ void LatticePhase::initThermoXML(XML_Node& phaseNode, const std::string& id_)
"ids don't match"); "ids don't match");
} }
std::string subname = "LatticePhase::initThermoXML";
/* /*
* Check on the thermo field. Must have: * Check on the thermo field. Must have:
* <thermo model="Lattice" /> * <thermo model="Lattice" />
@ -305,11 +304,11 @@ void LatticePhase::initThermoXML(XML_Node& phaseNode, const std::string& id_)
XML_Node& thNode = phaseNode.child("thermo"); XML_Node& thNode = phaseNode.child("thermo");
std::string mString = thNode.attrib("model"); std::string mString = thNode.attrib("model");
if (lowercase(mString) != "lattice") { if (lowercase(mString) != "lattice") {
throw CanteraError(subname.c_str(), throw CanteraError("LatticePhase::initThermoXML",
"Unknown thermo model: " + mString); "Unknown thermo model: " + mString);
} }
} else { } else {
throw CanteraError(subname.c_str(), throw CanteraError("LatticePhase::initThermoXML",
"Unspecified thermo model"); "Unspecified thermo model");
} }
/* /*

View file

@ -396,7 +396,7 @@ std::string MolarityIonicVPSSTP::report(bool show_thermo, doublereal threshold)
fmt::MemoryWriter b; fmt::MemoryWriter b;
try { try {
if (name() != "") { if (name() != "") {
b.write("\n {}:\n", name().c_str()); b.write("\n {}:\n", name());
} }
b.write("\n"); b.write("\n");
b.write(" temperature {:12.6g} K\n", temperature()); b.write(" temperature {:12.6g} K\n", temperature());

View file

@ -104,7 +104,7 @@ void PDSS_ConstVol::constructPDSSFile(VPStandardStateTP* tp, size_t spindex,
"input file is null"); "input file is null");
} }
std::string path = findInputFile(inputFile); std::string path = findInputFile(inputFile);
ifstream fin(path.c_str()); ifstream fin(path);
if (!fin) { if (!fin) {
throw CanteraError("PDSS_ConstVol::initThermo","could not open " throw CanteraError("PDSS_ConstVol::initThermo","could not open "
+path+" for reading."); +path+" for reading.");

View file

@ -626,7 +626,7 @@ void PDSS_HKFT::constructPDSSFile(VPStandardStateTP* tp, size_t spindex,
"input file is null"); "input file is null");
} }
std::string path = findInputFile(inputFile); std::string path = findInputFile(inputFile);
ifstream fin(path.c_str()); ifstream fin(path);
if (!fin) { if (!fin) {
throw CanteraError("PDSS_HKFT::initThermo","could not open " throw CanteraError("PDSS_HKFT::initThermo","could not open "
+path+" for reading."); +path+" for reading.");

View file

@ -85,7 +85,7 @@ void PDSS_IdealGas::constructPDSSFile(VPStandardStateTP* tp, size_t spindex,
"input file is null"); "input file is null");
} }
std::string path = findInputFile(inputFile); std::string path = findInputFile(inputFile);
ifstream fin(path.c_str()); ifstream fin(path);
if (!fin) { if (!fin) {
throw CanteraError("PDSS_IdealGas::constructPDSSFile","could not open " throw CanteraError("PDSS_IdealGas::constructPDSSFile","could not open "
+path+" for reading."); +path+" for reading.");

View file

@ -173,7 +173,7 @@ void PDSS_IonsFromNeutral::constructPDSSFile(VPStandardStateTP* tp, size_t spind
"input file is null"); "input file is null");
} }
std::string path = findInputFile(inputFile); std::string path = findInputFile(inputFile);
ifstream fin(path.c_str()); ifstream fin(path);
if (!fin) { if (!fin) {
throw CanteraError("PDSS_IonsFromNeutral::constructPDSSFile","could not open " throw CanteraError("PDSS_IonsFromNeutral::constructPDSSFile","could not open "
+path+" for reading."); +path+" for reading.");

View file

@ -132,7 +132,7 @@ void PDSS_SSVol::constructPDSSFile(VPStandardStateTP* tp, size_t spindex,
"input file is null"); "input file is null");
} }
std::string path = findInputFile(inputFile); std::string path = findInputFile(inputFile);
ifstream fin(path.c_str()); ifstream fin(path);
if (!fin) { if (!fin) {
throw CanteraError("PDSS_SSVol::initThermo","could not open " throw CanteraError("PDSS_SSVol::initThermo","could not open "
+path+" for reading."); +path+" for reading.");

View file

@ -149,7 +149,7 @@ void PDSS_Water::constructPDSSFile(VPStandardStateTP* tp, int spindex,
"input file is null"); "input file is null");
} }
std::string path = findInputFile(inputFile); std::string path = findInputFile(inputFile);
std::ifstream fin(path.c_str()); std::ifstream fin(path);
if (!fin) { if (!fin) {
throw CanteraError("PDSS_Water::initThermo","could not open " throw CanteraError("PDSS_Water::initThermo","could not open "
+path+" for reading."); +path+" for reading.");

View file

@ -354,7 +354,7 @@ std::string PureFluidPhase::report(bool show_thermo, doublereal threshold) const
{ {
fmt::MemoryWriter b; fmt::MemoryWriter b;
if (name() != "") { if (name() != "") {
b.write("\n {}:\n", name().c_str()); b.write("\n {}:\n", name());
} }
b.write("\n"); b.write("\n");
b.write(" temperature {:12.6g} K\n", temperature()); b.write(" temperature {:12.6g} K\n", temperature());

View file

@ -408,7 +408,7 @@ void TransportFactory::getLiquidSpeciesTransportData(const std::vector<const XML
size_t loc = specName.find(":"); size_t loc = specName.find(":");
std::string firstSpec = specName.substr(0,loc); std::string firstSpec = specName.substr(0,loc);
std::string secondSpec = specName.substr(loc+1); std::string secondSpec = specName.substr(loc+1);
size_t index = temp_thermo->speciesIndex(firstSpec.c_str())+nsp*temp_thermo->speciesIndex(secondSpec.c_str()); size_t index = temp_thermo->speciesIndex(firstSpec)+nsp*temp_thermo->speciesIndex(secondSpec);
data.mobilityRatio[index] = newLTP(propSpecNode, name, m_tranPropMap[nodeName], temp_thermo); data.mobilityRatio[index] = newLTP(propSpecNode, name, m_tranPropMap[nodeName], temp_thermo);
}; };
}; };
@ -417,7 +417,7 @@ void TransportFactory::getLiquidSpeciesTransportData(const std::vector<const XML
for (size_t iSpec = 0; iSpec< nsp; iSpec++) { for (size_t iSpec = 0; iSpec< nsp; iSpec++) {
XML_Node& propSpecNode = xmlChild.child(iSpec); XML_Node& propSpecNode = xmlChild.child(iSpec);
std::string specName = propSpecNode.name(); std::string specName = propSpecNode.name();
size_t index = temp_thermo->speciesIndex(specName.c_str()); size_t index = temp_thermo->speciesIndex(specName);
data.selfDiffusion[index] = newLTP(propSpecNode, name, m_tranPropMap[nodeName], temp_thermo); data.selfDiffusion[index] = newLTP(propSpecNode, name, m_tranPropMap[nodeName], temp_thermo);
}; };
}; };
@ -533,7 +533,7 @@ void TransportFactory::getLiquidInteractionsTransportData(const XML_Node& transp
size_t loc = specName.find(":"); size_t loc = specName.find(":");
string firstSpec = specName.substr(0,loc); string firstSpec = specName.substr(0,loc);
string secondSpec = specName.substr(loc+1); string secondSpec = specName.substr(loc+1);
size_t index = temp_thermo->speciesIndex(firstSpec.c_str())+nsp*temp_thermo->speciesIndex(secondSpec.c_str()); size_t index = temp_thermo->speciesIndex(firstSpec)+nsp*temp_thermo->speciesIndex(secondSpec);
trParam.mobilityRatio[index] = newLTI(propSpecNode, trParam.mobilityRatio[index] = newLTI(propSpecNode,
m_tranPropMap[nodeName], m_tranPropMap[nodeName],
trParam); trParam);
@ -544,7 +544,7 @@ void TransportFactory::getLiquidInteractionsTransportData(const XML_Node& transp
for (size_t iSpec = 0; iSpec< nsp; iSpec++) { for (size_t iSpec = 0; iSpec< nsp; iSpec++) {
XML_Node& propSpecNode = compDepNode.child(iSpec); XML_Node& propSpecNode = compDepNode.child(iSpec);
string specName = propSpecNode.name(); string specName = propSpecNode.name();
size_t index = temp_thermo->speciesIndex(specName.c_str()); size_t index = temp_thermo->speciesIndex(specName);
trParam.selfDiffusion[index] = newLTI(propSpecNode, trParam.selfDiffusion[index] = newLTI(propSpecNode,
m_tranPropMap[nodeName], m_tranPropMap[nodeName],
trParam); trParam);

View file

@ -18,7 +18,7 @@ public:
void initializeTestPhaseWithXML(const std::string & filename) void initializeTestPhaseWithXML(const std::string & filename)
{ {
test_phase = newPhase(filename.c_str()); test_phase = newPhase(filename);
} }
void set_r(const double r) { void set_r(const double r) {

View file

@ -75,8 +75,8 @@ class ChemkinConversionTest : public testing::Test {
public: public:
void copyInputFile(const std::string& name) { void copyInputFile(const std::string& name) {
std::string in_name = "../data/" + name; std::string in_name = "../data/" + name;
std::ifstream source(in_name.c_str(), std::ios::binary); std::ifstream source(in_name, std::ios::binary);
std::ofstream dest(name.c_str(), std::ios::binary); std::ofstream dest(name, std::ios::binary);
dest << source.rdbuf(); dest << source.rdbuf();
} }
}; };

View file

@ -7,7 +7,7 @@ class fileLog: public Cantera::Logger
public: public:
explicit fileLog(const std::string& fName) { explicit fileLog(const std::string& fName) {
m_fName = fName; m_fName = fName;
m_fs.open(fName.c_str(), std::ios::out); m_fs.open(fName, std::ios::out);
} }
virtual void write(const std::string& msg) { virtual void write(const std::string& msg) {

View file

@ -113,7 +113,6 @@ void printSurf(ostream& oooo, ThermoPhase* surfPhaseTP,
InterfaceKinetics* iKin_ptr, double* src) InterfaceKinetics* iKin_ptr, double* src)
{ {
double x[MSSIZE]; double x[MSSIZE];
char buf[256];
oooo.precision(3); oooo.precision(3);
string surfParticlePhaseName = surfPhaseTP->id(); string surfParticlePhaseName = surfPhaseTP->id();
surfPhaseTP->getMoleFractions(x); surfPhaseTP->getMoleFractions(x);