From b9533bcf348c2aa33dce75d7abe28f29b0a7e2b1 Mon Sep 17 00:00:00 2001 From: Harry Moffat Date: Thu, 17 Apr 2008 16:53:17 +0000 Subject: [PATCH] Changed name of a variable. --- Cantera/src/equil/vcs_TP.cpp | 6 +-- Cantera/src/equil/vcs_inest.cpp | 10 +++-- Cantera/src/equil/vcs_nondim.cpp | 4 +- Cantera/src/equil/vcs_prep.cpp | 2 +- Cantera/src/equil/vcs_report.cpp | 6 +-- Cantera/src/equil/vcs_setMolesLinProg.cpp | 10 ++--- Cantera/src/equil/vcs_solve.cpp | 4 +- Cantera/src/equil/vcs_solve.h | 9 ++-- Cantera/src/equil/vcs_solve_TP.cpp | 51 ++++++++++++----------- 9 files changed, 54 insertions(+), 48 deletions(-) diff --git a/Cantera/src/equil/vcs_TP.cpp b/Cantera/src/equil/vcs_TP.cpp index beaa9c1b0..aaecb9989 100644 --- a/Cantera/src/equil/vcs_TP.cpp +++ b/Cantera/src/equil/vcs_TP.cpp @@ -155,12 +155,12 @@ int VCS_SOLVE::vcs_evalSS_TP(int ipr, int ip1, double Temp, double pres) for (int iph = 0; iph < NPhase; iph++) { vcs_VolPhase* vph = VPhaseList[iph]; vph->setState_TP(T, Pres); - vph->sendToVCSGStar(VCS_DATA_PTR(ff)); + vph->sendToVCSGStar(VCS_DATA_PTR(m_SSfeSpecies)); } if (m_VCS_UnitsFormat == VCS_UNITS_UNITLESS) { for (int i = 0; i < m_numSpeciesTot; ++i) { - ff[i] /= Temp; + m_SSfeSpecies[i] /= Temp; } } return VCS_SUCCESS; @@ -185,7 +185,7 @@ void VCS_SOLVE::vcs_fePrep_TP(void) * potential. This value doesn't change during the calculation */ if (SSPhase[i]) { - m_gibbsSpecies[i] = ff[i]; + m_gibbsSpecies[i] = m_SSfeSpecies[i]; } } } /* vcs_fePrep_TP() ********************************************************/ diff --git a/Cantera/src/equil/vcs_inest.cpp b/Cantera/src/equil/vcs_inest.cpp index 5154579c6..5df9477c2 100644 --- a/Cantera/src/equil/vcs_inest.cpp +++ b/Cantera/src/equil/vcs_inest.cpp @@ -105,7 +105,7 @@ namespace VCSnonideal { plogf("%s SPECIES MOLE_NUMBER -SS_ChemPotential\n", pprefix); for (kspec = 0; kspec < nspecies; ++kspec) { plogf("%s ", pprefix); plogf("%-12.12s", SpName[kspec].c_str()); - plogf(" %15.5g %12.3g\n", molNum[kspec], -ff[kspec]); + plogf(" %15.5g %12.3g\n", molNum[kspec], -m_SSfeSpecies[kspec]); } plogf("%s Element Abundance Agreement returned from linear " "programming (vcs_inest initial guess):", @@ -195,7 +195,8 @@ namespace VCSnonideal { wt[kspec] = 0.0; } } - vcs_dcopy(VCS_DATA_PTR(m_gibbsSpecies), VCS_DATA_PTR(ff), nspecies); + vcs_dcopy(VCS_DATA_PTR(m_gibbsSpecies), VCS_DATA_PTR(m_SSfeSpecies), + nspecies); for (kspec = 0; kspec < m_numComponents; ++kspec) { if (SpeciesUnknownType[kspec] == VCS_SPECIES_TYPE_MOLNUM) { @@ -213,10 +214,11 @@ namespace VCSnonideal { for (kspec = 0; kspec < nspecies; ++kspec) { plogf("%s", pprefix); plogf("%-12.12s", SpName[kspec].c_str()); if (kspec < m_numComponents) - plogf("fe* = %15.5g ff = %15.5g\n", m_gibbsSpecies[kspec], ff[kspec]); + plogf("fe* = %15.5g ff = %15.5g\n", m_gibbsSpecies[kspec], + m_SSfeSpecies[kspec]); else plogf("fe* = %15.5g ff = %15.5g dg* = %15.5g\n", - m_gibbsSpecies[kspec], ff[kspec], dg[kspec-m_numComponents]); + m_gibbsSpecies[kspec], m_SSfeSpecies[kspec], dg[kspec-m_numComponents]); } } #endif diff --git a/Cantera/src/equil/vcs_nondim.cpp b/Cantera/src/equil/vcs_nondim.cpp index 8863b7911..d5ab86b4f 100644 --- a/Cantera/src/equil/vcs_nondim.cpp +++ b/Cantera/src/equil/vcs_nondim.cpp @@ -102,7 +102,7 @@ void VCS_SOLVE::vcs_nondim_TP(void) { * FF(I), to make it dimensionless, i.e., mu / RT. * Thus, we may divide it by the temperature. */ - ff[i] *= tf; + m_SSfeSpecies[i] *= tf; m_gibbsSpecies[i] *= tf; dg[i] *= tf; dgl[i] *= tf; @@ -142,7 +142,7 @@ void VCS_SOLVE::vcs_redim_TP(void) * Modify the standard state and total chemical potential data, * FF(I), to make it have units, i.e. mu = RT * mu_star */ - ff[i] *= tf; + m_SSfeSpecies[i] *= tf; m_gibbsSpecies[i] *= tf; dg[i] *= tf; dgl[i] *= tf; diff --git a/Cantera/src/equil/vcs_prep.cpp b/Cantera/src/equil/vcs_prep.cpp index efe5b3c88..d339f3202 100644 --- a/Cantera/src/equil/vcs_prep.cpp +++ b/Cantera/src/equil/vcs_prep.cpp @@ -196,7 +196,7 @@ int VCS_SOLVE::vcs_prep_oneTime(int printLvl) retn = vcs_evalSS_TP(0, 0, T, pres); for (kspec = 0; kspec < m_numSpeciesTot; ++kspec) { if (SpeciesUnknownType[kspec] == VCS_SPECIES_TYPE_MOLNUM) { - soln[kspec] = - ff[kspec]; + soln[kspec] = - m_SSfeSpecies[kspec]; } else { soln[kspec] = 0.0; } diff --git a/Cantera/src/equil/vcs_report.cpp b/Cantera/src/equil/vcs_report.cpp index 82c878152..e5ced8093 100644 --- a/Cantera/src/equil/vcs_report.cpp +++ b/Cantera/src/equil/vcs_report.cpp @@ -313,7 +313,7 @@ int VCS_SOLVE::vcs_report(int iconv) int pid = PhaseID[l]; plogf(" %-12.12s", SpName[l].c_str()); plogf(" %14.7E ", soln[l]); - plogf("%14.7E ", ff[l]); + plogf("%14.7E ", m_SSfeSpecies[l]); plogf("%14.7E ", log(ActCoeff[l])); double tpmoles = TPhMoles[pid]; double phi = phasePhi[pid]; @@ -325,12 +325,12 @@ int VCS_SOLVE::vcs_report(int iconv) if (tpmoles > 0.0 && soln[l] > 0.0) { lx = log(soln[l]) - log(tpmoles); } else { - lx = m_gibbsSpecies[l] - ff[l] - log(ActCoeff[l]) + SpecLnMnaught[l]; + lx = m_gibbsSpecies[l] - m_SSfeSpecies[l] - log(ActCoeff[l]) + SpecLnMnaught[l]; } } plogf("%14.7E |", lx); plogf("%14.7E | ", eContrib); - double tmp = ff[l] + log(ActCoeff[l]) + lx - SpecLnMnaught[l] + eContrib; + double tmp = m_SSfeSpecies[l] + log(ActCoeff[l]) + lx - SpecLnMnaught[l] + eContrib; if (fabs(m_gibbsSpecies[l] - tmp) > 1.0E-8) { plogf("\n\t\twe have a problem - doesn't add up\n"); exit(-1); diff --git a/Cantera/src/equil/vcs_setMolesLinProg.cpp b/Cantera/src/equil/vcs_setMolesLinProg.cpp index f7673206b..298d0ae70 100644 --- a/Cantera/src/equil/vcs_setMolesLinProg.cpp +++ b/Cantera/src/equil/vcs_setMolesLinProg.cpp @@ -98,7 +98,7 @@ int VCS_SOLVE::vcs_setMolesLinProg() { #ifdef DEBUG_MODE if (vcs_debug_print_lvl >= 2) { - printProgress(SpName, soln, ff); + printProgress(SpName, soln, m_SSfeSpecies); } #endif @@ -144,11 +144,11 @@ int VCS_SOLVE::vcs_setMolesLinProg() { // dg_rt is the Delta_G / RT value for the reaction ik = m_numComponents + irxn; - dg_rt = ff[ik]; + dg_rt = m_SSfeSpecies[ik]; dxi_min = 1.0e10; const double *sc_irxn = sc[irxn]; for (jcomp = 0; jcomp < m_numElemConstraints; jcomp++) { - dg_rt += ff[jcomp] * sc_irxn[jcomp]; + dg_rt += m_SSfeSpecies[jcomp] * sc_irxn[jcomp]; } // fwd or rev direction. // idir > 0 implies increasing the current species @@ -208,14 +208,14 @@ int VCS_SOLVE::vcs_setMolesLinProg() { // vcs_updateVP(0); #ifdef DEBUG_MODE if (vcs_debug_print_lvl >= 2) { - printProgress(SpName, soln, ff); + printProgress(SpName, soln, m_SSfeSpecies); } #endif } #ifdef DEBUG_MODE if (vcs_debug_print_lvl == 1) { - printProgress(SpName, soln, ff); + printProgress(SpName, soln, m_SSfeSpecies); plogf(" --- setInitialMoles end\n"); } #endif diff --git a/Cantera/src/equil/vcs_solve.cpp b/Cantera/src/equil/vcs_solve.cpp index 05ff5c747..7160c5e5a 100644 --- a/Cantera/src/equil/vcs_solve.cpp +++ b/Cantera/src/equil/vcs_solve.cpp @@ -110,7 +110,7 @@ namespace VCSnonideal { m_spSize.resize(nspecies0, 1.0); m_gibbsSpecies.resize(nspecies0, 0.0); - ff.resize(nspecies0, 0.0); + m_SSfeSpecies.resize(nspecies0, 0.0); feTrial.resize(nspecies0, 0.0); soln.resize(nspecies0, 0.0); @@ -300,7 +300,7 @@ namespace VCSnonideal { int iprintTime = MAX(ipr, ip1); if (m_timing_print_lvl < iprintTime) { - iprintTime = m_timing_print_lvl ; + iprintTime = m_timing_print_lvl ; } if (ifunc < 0 || ifunc > 2) { diff --git a/Cantera/src/equil/vcs_solve.h b/Cantera/src/equil/vcs_solve.h index aa5469a34..de235b842 100644 --- a/Cantera/src/equil/vcs_solve.h +++ b/Cantera/src/equil/vcs_solve.h @@ -417,12 +417,12 @@ public: std::vector m_spSize; //! Standard state chemical potentials for species K at the current - //! temperature and pressure. + //! temperature and pressure. /*! - * The first NC entries are for components. The following NR entries are + * The first NC entries are for components. The following NR entries are * for the current non-component species in the mechanism. */ - std::vector ff; + std::vector m_SSfeSpecies; //! Dimensionless/Dimensional free energy for all the species in the mechanism at the //! current T, P, and mole numbers. @@ -801,7 +801,8 @@ public: //! printing level of timing information /*! * 1 allowing printing of timing - * 0 do not allow printing of timing -> everything is a zero. + * 0 do not allow printing of timing -> everything is printed + * as a NA. */ int m_timing_print_lvl; diff --git a/Cantera/src/equil/vcs_solve_TP.cpp b/Cantera/src/equil/vcs_solve_TP.cpp index f2ba6eb74..6a5e925a5 100644 --- a/Cantera/src/equil/vcs_solve_TP.cpp +++ b/Cantera/src/equil/vcs_solve_TP.cpp @@ -294,7 +294,7 @@ namespace VCSnonideal { plogf(" 0"); } print_space(47-m_numElemConstraints*3); - plogf("%12.5E %12.5E", RT * ff[i], soln[i]); + plogf("%12.5E %12.5E", RT * m_SSfeSpecies[i], soln[i]); if (SpeciesUnknownType[i] == VCS_SPECIES_TYPE_MOLNUM) { plogf(" Mol_Num"); } else if (SpeciesUnknownType[i] == VCS_SPECIES_TYPE_INTERFACIALVOLTAGE) { @@ -2525,7 +2525,7 @@ namespace VCSnonideal { * for formation reactions */ for (kspec = m_numSpeciesRdc; kspec < m_numSpeciesTot; ++kspec) { - m_gibbsSpecies[kspec] = ff[kspec]; + m_gibbsSpecies[kspec] = m_SSfeSpecies[kspec]; } /* * Recalculate the DeltaG's of the formation reactions for the @@ -2613,7 +2613,7 @@ namespace VCSnonideal { * ~ infinite dilution. */ for (kspec = m_numSpeciesRdc; kspec < m_numSpeciesTot; ++kspec) { - m_gibbsSpecies[kspec] = ff[kspec]; + m_gibbsSpecies[kspec] = m_SSfeSpecies[kspec]; } /* * Recalculate the DeltaG's of the formation reactions for the @@ -3494,7 +3494,7 @@ namespace VCSnonideal { kfound = kspec; } else { // ok we are sitting pretty equal here decide on the raw ss Gibbs energy - if (ff[kspec] <= ff[kfound]) { + if (m_SSfeSpecies[kspec] <= m_SSfeSpecies[kfound]) { kfound = kspec; } } @@ -4106,15 +4106,15 @@ namespace VCSnonideal { exit(-1); } #endif - mu_i[kspec] = ff[kspec] + Charge[kspec] * Faraday_phi; + mu_i[kspec] = m_SSfeSpecies[kspec] + Charge[kspec] * Faraday_phi; } else { if (SSPhase[kspec]) { - mu_i[kspec] = ff[kspec] + Charge[kspec] * Faraday_phi; + mu_i[kspec] = m_SSfeSpecies[kspec] + Charge[kspec] * Faraday_phi; } else if (molNum[kspec] <= VCS_DELETE_MINORSPECIES_CUTOFF) { - mu_i[kspec] = ff[kspec] + log(ac[kspec] * VCS_DELETE_MINORSPECIES_CUTOFF) + mu_i[kspec] = m_SSfeSpecies[kspec] + log(ac[kspec] * VCS_DELETE_MINORSPECIES_CUTOFF) - tlogMoles - SpecLnMnaught[kspec] + Charge[kspec] * Faraday_phi; } else { - mu_i[kspec] = ff[kspec] + log(ac[kspec] * molNum[kspec]) + mu_i[kspec] = m_SSfeSpecies[kspec] + log(ac[kspec] * molNum[kspec]) - tlogMoles - SpecLnMnaught[kspec] + Charge[kspec] * Faraday_phi; } } @@ -4328,23 +4328,24 @@ namespace VCSnonideal { exit(-1); } #endif - m_gibbsSpecies[kspec] = ff[kspec] + Charge[kspec] * Faraday_dim * phasePhi[iphase]; + m_gibbsSpecies[kspec] = + m_SSfeSpecies[kspec] + Charge[kspec] * Faraday_dim * phasePhi[iphase]; } else { if (SSPhase[kspec]) { - m_gibbsSpecies[kspec] = ff[kspec]; + m_gibbsSpecies[kspec] = m_SSfeSpecies[kspec]; } else { if (z[kspec] <= VCS_DELETE_MINORSPECIES_CUTOFF) { iph = PhaseID[kspec]; if (tPhMoles_ptr[iph] > 0.0) { - m_gibbsSpecies[kspec] = ff[kspec] + m_gibbsSpecies[kspec] = m_SSfeSpecies[kspec] + log(ActCoeff[kspec] * VCS_DELETE_MINORSPECIES_CUTOFF) - tlogMoles[PhaseID[kspec]] - SpecLnMnaught[kspec] + Charge[kspec] * Faraday_dim * phasePhi[iphase]; } else { - m_gibbsSpecies[kspec] = ff[kspec]; + m_gibbsSpecies[kspec] = m_SSfeSpecies[kspec]; } } else { - m_gibbsSpecies[kspec] = ff[kspec] + log(ActCoeff[kspec] * z[kspec]) + m_gibbsSpecies[kspec] = m_SSfeSpecies[kspec] + log(ActCoeff[kspec] * z[kspec]) - tlogMoles[PhaseID[kspec]] - SpecLnMnaught[kspec] + Charge[kspec] * Faraday_dim * phasePhi[iphase]; } @@ -4370,23 +4371,24 @@ namespace VCSnonideal { exit(-1); } #endif - m_gibbsSpecies[kspec] = ff[kspec] + Charge[kspec] * Faraday_dim * phasePhi[iphase]; + m_gibbsSpecies[kspec] = + m_SSfeSpecies[kspec] + Charge[kspec] * Faraday_dim * phasePhi[iphase]; } else { if (SSPhase[kspec]) { - m_gibbsSpecies[kspec] = ff[kspec]; + m_gibbsSpecies[kspec] = m_SSfeSpecies[kspec]; } else { if (z[kspec] <= VCS_DELETE_MINORSPECIES_CUTOFF) { iph = PhaseID[kspec]; if (tPhMoles_ptr[iph] > 0.0) { - m_gibbsSpecies[kspec] = ff[kspec] + m_gibbsSpecies[kspec] = m_SSfeSpecies[kspec] + log(ActCoeff[kspec] * VCS_DELETE_MINORSPECIES_CUTOFF) - tlogMoles[PhaseID[kspec]] - SpecLnMnaught[kspec] + Charge[kspec] * Faraday_dim * phasePhi[iphase]; ; } else { - m_gibbsSpecies[kspec] = ff[kspec]; + m_gibbsSpecies[kspec] = m_SSfeSpecies[kspec]; } } else { - m_gibbsSpecies[kspec] = ff[kspec] + log(ActCoeff[kspec] * z[kspec]) + m_gibbsSpecies[kspec] = m_SSfeSpecies[kspec] + log(ActCoeff[kspec] * z[kspec]) - tlogMoles[PhaseID[kspec]] - SpecLnMnaught[kspec] + Charge[kspec] * Faraday_dim * phasePhi[iphase]; } @@ -4413,23 +4415,24 @@ namespace VCSnonideal { exit(-1); } #endif - m_gibbsSpecies[kspec] = ff[kspec] + Charge[kspec] * Faraday_dim * phasePhi[iphase]; ; + m_gibbsSpecies[kspec] = + m_SSfeSpecies[kspec] + Charge[kspec] * Faraday_dim * phasePhi[iphase]; ; } else { if (SSPhase[kspec]) { - m_gibbsSpecies[kspec] = ff[kspec]; + m_gibbsSpecies[kspec] = m_SSfeSpecies[kspec]; } else { if (z[kspec] <= VCS_DELETE_MINORSPECIES_CUTOFF) { iph = PhaseID[kspec]; if (tPhMoles_ptr[iph] > 0.0) { - m_gibbsSpecies[kspec] = ff[kspec] + m_gibbsSpecies[kspec] = m_SSfeSpecies[kspec] + log(ActCoeff[kspec] * VCS_DELETE_MINORSPECIES_CUTOFF) - tlogMoles[PhaseID[kspec]] - SpecLnMnaught[kspec]; } else { - m_gibbsSpecies[kspec] = ff[kspec]; + m_gibbsSpecies[kspec] = m_SSfeSpecies[kspec]; } } else { st_ptr = SpeciesThermo[kspec]; - m_gibbsSpecies[kspec] = ff[kspec] + log(ActCoeff[kspec] * z[kspec]) + m_gibbsSpecies[kspec] = m_SSfeSpecies[kspec] + log(ActCoeff[kspec] * z[kspec]) - tlogMoles[PhaseID[kspec]] - SpecLnMnaught[kspec]; } } @@ -4669,7 +4672,7 @@ namespace VCSnonideal { SWAP(soln[k1], soln[k2], t1); SWAP(SpeciesUnknownType[k1], SpeciesUnknownType[k2], j); SWAP(wt[k1], wt[k2], t1); - SWAP(ff[k1], ff[k2], t1); + SWAP(m_SSfeSpecies[k1], m_SSfeSpecies[k2], t1); SWAP(m_spSize[k1], m_spSize[k2], t1); SWAP(m_gibbsSpecies[k1], m_gibbsSpecies[k2], t1); SWAP(ds[k1], ds[k2], t1);