diff --git a/include/cantera/equil/vcs_solve.h b/include/cantera/equil/vcs_solve.h index b48a97d18..76e1d250e 100644 --- a/include/cantera/equil/vcs_solve.h +++ b/include/cantera/equil/vcs_solve.h @@ -522,7 +522,7 @@ public: * coefficients for these reactions. A stoichiometric coefficient of * one is assumed for species irxn in this reaction. * - * @param l + * @param L * - `L < 0`: Calculate reactions corresponding to major noncomponent * and zeroed species only * - `L = 0`: Do all noncomponent reactions, i, between @@ -542,7 +542,7 @@ public: * condition feeds back into the algorithm in several places, and leads * to a infinite loop in at least one case. */ - void vcs_deltag(const int l, const bool doDeleted, const int vcsState, + void vcs_deltag(const int L, const bool doDeleted, const int vcsState, const bool alterZeroedPhases = true); void vcs_printDeltaG(const int stateCalc); diff --git a/src/equil/BasisOptimize.cpp b/src/equil/BasisOptimize.cpp index a4f200fd1..dc9785255 100644 --- a/src/equil/BasisOptimize.cpp +++ b/src/equil/BasisOptimize.cpp @@ -28,7 +28,7 @@ size_t BasisOptimize(int* usedZeroedSpecies, bool doFormRxn, MultiPhase* mphase, std::vector& orderVectorElements, vector_fp& formRxnMatrix) { - size_t j, jj, k=0, kk, l, i, jl, ml; + size_t j, jj, k=0, kk, i, jl, ml; std::string ename; std::string sname; @@ -186,8 +186,8 @@ size_t BasisOptimize(int* usedZeroedSpecies, bool doFormRxn, MultiPhase* mphase, // Now make the new column, (*,JR), orthogonal to the previous // columns for (j = 0; j < jl; ++j) { - for (l = 0; l < ne; ++l) { - sm[l + jr*ne] -= ss[j] * sm[l + j*ne]; + for (size_t i = 0; i < ne; ++i) { + sm[i + jr*ne] -= ss[j] * sm[i + j*ne]; } } } @@ -372,7 +372,7 @@ void ElemRearrange(size_t nComponents, const vector_fp& elementAbundances, std::vector& orderVectorSpecies, std::vector& orderVectorElements) { - size_t j, k, l, i, jl, ml, jr, ielem, jj, kk=0; + size_t j, k, i, jl, ml, jr, ielem, jj, kk=0; size_t nelements = mphase->nElements(); std::string ename; // Get the total number of species in the multiphase object @@ -497,8 +497,8 @@ void ElemRearrange(size_t nComponents, const vector_fp& elementAbundances, // Now make the new column, (*,JR), orthogonal to the // previous columns for (j = 0; j < jl; ++j) { - for (l = 0; l < nComponents; ++l) { - sm[l + jr*nComponents] -= ss[j] * sm[l + j*nComponents]; + for (size_t i = 0; i < nComponents; ++i) { + sm[i + jr*nComponents] -= ss[j] * sm[i + j*nComponents]; } } } diff --git a/src/equil/vcs_elem_rearrange.cpp b/src/equil/vcs_elem_rearrange.cpp index 4bdf0d218..ed3226aca 100644 --- a/src/equil/vcs_elem_rearrange.cpp +++ b/src/equil/vcs_elem_rearrange.cpp @@ -103,8 +103,8 @@ int VCS_SOLVE::vcs_elem_rearrange(double* const aw, double* const sa, // Now make the new column, (*,JR), orthogonal to the previous // columns for (size_t j = 0; j < jl; ++j) { - for (size_t l = 0; l < ncomponents; ++l) { - sm[l + jr*ncomponents] -= ss[j] * sm[l + j*ncomponents]; + for (size_t i = 0; i < ncomponents; ++i) { + sm[i + jr*ncomponents] -= ss[j] * sm[i + j*ncomponents]; } } } diff --git a/src/equil/vcs_rearrange.cpp b/src/equil/vcs_rearrange.cpp index 7c32ba47b..bb7267cb0 100644 --- a/src/equil/vcs_rearrange.cpp +++ b/src/equil/vcs_rearrange.cpp @@ -21,9 +21,9 @@ int VCS_SOLVE::vcs_rearrange() // Find the index of I in the index vector m_speciesIndexVector[]. Call // it k1 and continue. for (size_t j = 0; j < m_numSpeciesTot; ++j) { - size_t l = m_speciesMapIndex[j]; + size_t n = m_speciesMapIndex[j]; k1 = j; - if (l == i) { + if (n == i) { break; } } diff --git a/src/equil/vcs_report.cpp b/src/equil/vcs_report.cpp index c050f363c..10b51fbc4 100644 --- a/src/equil/vcs_report.cpp +++ b/src/equil/vcs_report.cpp @@ -27,11 +27,11 @@ int VCS_SOLVE::vcs_report(int iconv) // Sort the XY vector, the mole fraction vector, and the sort index vector, // sortindex, according to the magnitude of the mole fraction vector. - for (size_t l = m_numComponents; l < m_numSpeciesRdc; ++l) { - size_t k = vcs_optMax(&xy[0], 0, l, m_numSpeciesRdc); - if (k != l) { - std::swap(xy[k], xy[l]); - std::swap(sortindex[k], sortindex[l]); + for (size_t i = m_numComponents; i < m_numSpeciesRdc; ++i) { + size_t k = vcs_optMax(&xy[0], 0, i, m_numSpeciesRdc); + if (k != i) { + std::swap(xy[k], xy[i]); + std::swap(sortindex[k], sortindex[i]); } } @@ -90,17 +90,17 @@ int VCS_SOLVE::vcs_report(int iconv) plogf("\n"); } for (size_t i = m_numComponents; i < m_numSpeciesRdc; ++i) { - size_t l = sortindex[i]; - plogf(" %-12.12s", m_speciesName[l]); + size_t j = sortindex[i]; + plogf(" %-12.12s", m_speciesName[j]); writeline(' ', 13, false); - if (m_speciesUnknownType[l] == VCS_SPECIES_TYPE_MOLNUM) { - plogf("%14.7E %14.7E %12.4E", m_molNumSpecies_old[l] * molScale, - m_molNumSpecies_new[l] * molScale, m_feSpecies_old[l]); + if (m_speciesUnknownType[j] == VCS_SPECIES_TYPE_MOLNUM) { + plogf("%14.7E %14.7E %12.4E", m_molNumSpecies_old[j] * molScale, + m_molNumSpecies_new[j] * molScale, m_feSpecies_old[j]); plogf(" KMolNum "); - } else if (m_speciesUnknownType[l] == VCS_SPECIES_TYPE_INTERFACIALVOLTAGE) { - plogf(" NA %14.7E %12.4E", 1.0, m_feSpecies_old[l]); - plogf(" Voltage = %14.7E", m_molNumSpecies_old[l] * molScale); + } else if (m_speciesUnknownType[j] == VCS_SPECIES_TYPE_INTERFACIALVOLTAGE) { + plogf(" NA %14.7E %12.4E", 1.0, m_feSpecies_old[j]); + plogf(" Voltage = %14.7E", m_molNumSpecies_old[j] * molScale); } else { throw CanteraError("VCS_SOLVE::vcs_report", "we have a problem"); } @@ -261,43 +261,43 @@ int VCS_SOLVE::vcs_report(int iconv) plogf("| (MolNum ChemPot)|"); writeline('-', 147, true, true); for (size_t i = 0; i < nspecies; ++i) { - size_t l = sortindex[i]; - size_t pid = m_phaseID[l]; - plogf(" %-12.12s", m_speciesName[l]); - plogf(" %14.7E ", m_molNumSpecies_old[l]*molScale); - plogf("%14.7E ", m_SSfeSpecies[l]); - plogf("%14.7E ", log(m_actCoeffSpecies_old[l])); + size_t j = sortindex[i]; + size_t pid = m_phaseID[j]; + plogf(" %-12.12s", m_speciesName[j]); + plogf(" %14.7E ", m_molNumSpecies_old[j]*molScale); + plogf("%14.7E ", m_SSfeSpecies[j]); + plogf("%14.7E ", log(m_actCoeffSpecies_old[j])); double tpmoles = m_tPhaseMoles_old[pid]; double phi = m_phasePhi[pid]; - double eContrib = phi * m_chargeSpecies[l] * m_Faraday_dim; + double eContrib = phi * m_chargeSpecies[j] * m_Faraday_dim; double lx = 0.0; - if (m_speciesUnknownType[l] == VCS_SPECIES_TYPE_INTERFACIALVOLTAGE) { + if (m_speciesUnknownType[j] == VCS_SPECIES_TYPE_INTERFACIALVOLTAGE) { lx = 0.0; } else { - if (tpmoles > 0.0 && m_molNumSpecies_old[l] > 0.0) { - double tmp = std::max(VCS_DELETE_MINORSPECIES_CUTOFF, m_molNumSpecies_old[l]); + if (tpmoles > 0.0 && m_molNumSpecies_old[j] > 0.0) { + double tmp = std::max(VCS_DELETE_MINORSPECIES_CUTOFF, m_molNumSpecies_old[j]); lx = log(tmp) - log(tpmoles); } else { - lx = m_feSpecies_old[l] - m_SSfeSpecies[l] - - log(m_actCoeffSpecies_old[l]) + m_lnMnaughtSpecies[l]; + lx = m_feSpecies_old[j] - m_SSfeSpecies[j] + - log(m_actCoeffSpecies_old[j]) + m_lnMnaughtSpecies[j]; } } plogf("%14.7E |", lx); plogf("%14.7E | ", eContrib); - double tmp = m_SSfeSpecies[l] + log(m_actCoeffSpecies_old[l]) - + lx - m_lnMnaughtSpecies[l] + eContrib; - if (fabs(m_feSpecies_old[l] - tmp) > 1.0E-7) { + double tmp = m_SSfeSpecies[j] + log(m_actCoeffSpecies_old[j]) + + lx - m_lnMnaughtSpecies[j] + eContrib; + if (fabs(m_feSpecies_old[j] - tmp) > 1.0E-7) { throw CanteraError("VCS_SOLVE::vcs_report", "we have a problem - doesn't add up"); } - plogf(" %12.4E |", m_feSpecies_old[l]); - if (m_lnMnaughtSpecies[l] != 0.0) { - plogf("(%11.5E)", - m_lnMnaughtSpecies[l]); + plogf(" %12.4E |", m_feSpecies_old[j]); + if (m_lnMnaughtSpecies[j] != 0.0) { + plogf("(%11.5E)", - m_lnMnaughtSpecies[j]); } else { plogf(" "); } - plogf("| %20.9E |", m_feSpecies_old[l] * m_molNumSpecies_old[l] * molScale); + plogf("| %20.9E |", m_feSpecies_old[j] * m_molNumSpecies_old[j] * molScale); plogf("\n"); } for (size_t i = 0; i < 125; i++) { diff --git a/src/equil/vcs_rxnadj.cpp b/src/equil/vcs_rxnadj.cpp index 8aa5eb5df..f5f1039cd 100644 --- a/src/equil/vcs_rxnadj.cpp +++ b/src/equil/vcs_rxnadj.cpp @@ -543,18 +543,18 @@ double VCS_SOLVE::vcs_Hessian_actCoeff_diag(size_t irxn) // Next, the other terms. Note this only a loop over the components So, it's // not too expensive to calculate. - for (size_t l = 0; l < m_numComponents; l++) { - if (!m_SSPhase[l]) { + for (size_t j = 0; j < m_numComponents; j++) { + if (!m_SSPhase[j]) { for (size_t k = 0; k < m_numComponents; ++k) { - if (m_phaseID[k] == m_phaseID[l]) { + if (m_phaseID[k] == m_phaseID[j]) { double np = m_tPhaseMoles_old[m_phaseID[k]]; if (np > 0.0) { - s += sc_irxn[k] * sc_irxn[l] * m_np_dLnActCoeffdMolNum(l,k) / np; + s += sc_irxn[k] * sc_irxn[j] * m_np_dLnActCoeffdMolNum(j,k) / np; } } } - if (kph == m_phaseID[l]) { - s += sc_irxn[l] * (m_np_dLnActCoeffdMolNum(l,kspec) + m_np_dLnActCoeffdMolNum(kspec,l)) / np_kspec; + if (kph == m_phaseID[j]) { + s += sc_irxn[j] * (m_np_dLnActCoeffdMolNum(j,kspec) + m_np_dLnActCoeffdMolNum(kspec,j)) / np_kspec; } } } diff --git a/src/equil/vcs_solve_TP.cpp b/src/equil/vcs_solve_TP.cpp index 1b29abbdd..2b9f87c87 100644 --- a/src/equil/vcs_solve_TP.cpp +++ b/src/equil/vcs_solve_TP.cpp @@ -1167,34 +1167,34 @@ void VCS_SOLVE::solve_tp_inner(size_t& iti, size_t& it1, // CHECK FOR OPTIMUM BASIS for (size_t i = 0; i < m_numRxnRdc; ++i) { - size_t l = m_indexRxnToSpecies[i]; - if (m_speciesUnknownType[l] == VCS_SPECIES_TYPE_INTERFACIALVOLTAGE) { + size_t k = m_indexRxnToSpecies[i]; + if (m_speciesUnknownType[k] == VCS_SPECIES_TYPE_INTERFACIALVOLTAGE) { continue; } for (size_t j = 0; j < m_numComponents; ++j) { bool doSwap = false; if (m_SSPhase[j]) { - doSwap = (m_molNumSpecies_old[l] * m_spSize[l]) > + doSwap = (m_molNumSpecies_old[k] * m_spSize[k]) > (m_molNumSpecies_old[j] * m_spSize[j] * 1.01); - if (!m_SSPhase[l] && doSwap) { - doSwap = m_molNumSpecies_old[l] > (m_molNumSpecies_old[j] * 1.01); + if (!m_SSPhase[k] && doSwap) { + doSwap = m_molNumSpecies_old[k] > (m_molNumSpecies_old[j] * 1.01); } } else { - if (m_SSPhase[l]) { - doSwap = (m_molNumSpecies_old[l] * m_spSize[l]) > + if (m_SSPhase[k]) { + doSwap = (m_molNumSpecies_old[k] * m_spSize[k]) > (m_molNumSpecies_old[j] * m_spSize[j] * 1.01); if (!doSwap) { - doSwap = m_molNumSpecies_old[l] > (m_molNumSpecies_old[j] * 1.01); + doSwap = m_molNumSpecies_old[k] > (m_molNumSpecies_old[j] * 1.01); } } else { - doSwap = (m_molNumSpecies_old[l] * m_spSize[l]) > + doSwap = (m_molNumSpecies_old[k] * m_spSize[k]) > (m_molNumSpecies_old[j] * m_spSize[j] * 1.01); } } if (doSwap && m_stoichCoeffRxnMatrix(j,i) != 0.0) { if (DEBUG_MODE_ENABLED && m_debug_print_lvl >= 2) { plogf(" --- Get a new basis because "); - plogf("%s", m_speciesName[l]); + plogf("%s", m_speciesName[k]); plogf(" is better than comp "); plogf("%s", m_speciesName[j]); plogf(" and share nonzero stoic: %-9.1f", @@ -2396,8 +2396,8 @@ int VCS_SOLVE::vcs_basopt(const bool doJustComponents, double aw[], double sa[], // Now make the new column, (*,JR), orthogonal to the previous // columns for (size_t j = 0; j < jl; ++j) { - for (size_t l = 0; l < m_numElemConstraints; ++l) { - sm[l + jr*m_numElemConstraints] -= ss[j] * sm[l + j*m_numElemConstraints]; + for (size_t i = 0; i < m_numElemConstraints; ++i) { + sm[i + jr*m_numElemConstraints] -= ss[j] * sm[i + j*m_numElemConstraints]; } } } @@ -3432,7 +3432,7 @@ bool VCS_SOLVE::vcs_evaluate_speciesType() return (m_numRxnMinorZeroed >= m_numRxnRdc); } -void VCS_SOLVE::vcs_deltag(const int l, const bool doDeleted, +void VCS_SOLVE::vcs_deltag(const int L, const bool doDeleted, const int vcsState, const bool alterZeroedPhases) { int icase = 0; @@ -3461,16 +3461,16 @@ void VCS_SOLVE::vcs_deltag(const int l, const bool doDeleted, if (DEBUG_MODE_ENABLED && m_debug_print_lvl >= 2) { plogf(" --- Subroutine vcs_deltag called for "); - if (l < 0) { + if (L < 0) { plogf("major noncomponents\n"); - } else if (l == 0) { + } else if (L == 0) { plogf("all noncomponents\n"); } else { plogf("minor noncomponents\n"); } } - if (l < 0) { + if (L < 0) { // MAJORS and ZEROED SPECIES ONLY for (size_t irxn = 0; irxn < m_numRxnRdc; ++irxn) { size_t kspec = irxn + m_numComponents; @@ -3489,7 +3489,7 @@ void VCS_SOLVE::vcs_deltag(const int l, const bool doDeleted, } } } - } else if (l == 0) { + } else if (L == 0) { // ALL REACTIONS for (size_t irxn = 0; irxn < irxnl; ++irxn) { icase = 0; diff --git a/src/kinetics/ReactionPath.cpp b/src/kinetics/ReactionPath.cpp index e6717db61..d9df10cde 100644 --- a/src/kinetics/ReactionPath.cpp +++ b/src/kinetics/ReactionPath.cpp @@ -716,9 +716,9 @@ string reactionLabel(size_t i, size_t kr, size_t nr, const std::vector& slist, const Kinetics& s) { string label = ""; - for (size_t l = 0; l < nr; l++) { - if (l != kr) { - label += " + "+ s.kineticsSpeciesName(slist[l]); + for (size_t j = 0; j < nr; j++) { + if (j != kr) { + label += " + "+ s.kineticsSpeciesName(slist[j]); } } if (s.reactionType(i) == THREE_BODY_RXN) { @@ -775,9 +775,9 @@ int ReactionPathBuilder::build(Kinetics& s, const string& element, for (size_t kp = 0; kp < np; kp++) { size_t kkp = m_prod[i][kp]; revlabel = ""; - for (size_t l = 0; l < np; l++) { - if (l != kp) { - revlabel += " + "+ s.kineticsSpeciesName(m_prod[i][l]); + for (size_t j = 0; j < np; j++) { + if (j != kp) { + revlabel += " + "+ s.kineticsSpeciesName(m_prod[i][j]); } } if (s.reactionType(i) == THREE_BODY_RXN) { diff --git a/src/thermo/RedlichKisterVPSSTP.cpp b/src/thermo/RedlichKisterVPSSTP.cpp index 3ea0922f7..d0ac1de98 100644 --- a/src/thermo/RedlichKisterVPSSTP.cpp +++ b/src/thermo/RedlichKisterVPSSTP.cpp @@ -453,8 +453,8 @@ void RedlichKisterVPSSTP::getdlnActCoeffds(const doublereal dTds, const doublere s_update_dlnActCoeff_dX_(); for (size_t k = 0; k < m_kk; k++) { dlnActCoeffds[k] = dlnActCoeffdT_Scaled_[k] * dTds; - for (size_t l = 0; l < m_kk; l++) { - dlnActCoeffds[k] += dlnActCoeff_dX_(k, l) * dXds[l]; + for (size_t j = 0; j < m_kk; j++) { + dlnActCoeffds[k] += dlnActCoeff_dX_(k, j) * dXds[j]; } } } @@ -462,10 +462,10 @@ void RedlichKisterVPSSTP::getdlnActCoeffds(const doublereal dTds, const doublere void RedlichKisterVPSSTP::getdlnActCoeffdlnN_diag(doublereal* dlnActCoeffdlnN_diag) const { s_update_dlnActCoeff_dX_(); - for (size_t l = 0; l < m_kk; l++) { - dlnActCoeffdlnN_diag[l] = dlnActCoeff_dX_(l, l); + for (size_t j = 0; j < m_kk; j++) { + dlnActCoeffdlnN_diag[j] = dlnActCoeff_dX_(j, j); for (size_t k = 0; k < m_kk; k++) { - dlnActCoeffdlnN_diag[k] -= dlnActCoeff_dX_(l, k) * moleFractions_[k]; + dlnActCoeffdlnN_diag[k] -= dlnActCoeff_dX_(j, k) * moleFractions_[k]; } } } diff --git a/src/transport/DustyGasTransport.cpp b/src/transport/DustyGasTransport.cpp index 546842212..999552ac6 100644 --- a/src/transport/DustyGasTransport.cpp +++ b/src/transport/DustyGasTransport.cpp @@ -151,8 +151,8 @@ void DustyGasTransport::eval_H_matrix() doublereal sum; for (size_t k = 0; k < m_nsp; k++) { // evaluate off-diagonal terms - for (size_t l = 0; l < m_nsp; l++) { - m_multidiff(k,l) = -m_x[k]/m_d(k,l); + for (size_t j = 0; j < m_nsp; j++) { + m_multidiff(k,j) = -m_x[k]/m_d(k,j); } // evaluate diagonal term diff --git a/src/transport/LiquidTransport.cpp b/src/transport/LiquidTransport.cpp index 029a54d1c..ceac0f358 100644 --- a/src/transport/LiquidTransport.cpp +++ b/src/transport/LiquidTransport.cpp @@ -187,11 +187,11 @@ LiquidTransport::~LiquidTransport() for (size_t k = 0; k < m_nsp; k++) { delete m_viscTempDep_Ns[k]; delete m_ionCondTempDep_Ns[k]; - for (size_t l = 0; l < m_nsp; l++) { - delete m_selfDiffTempDep_Ns[l][k]; + for (size_t j = 0; j < m_nsp; j++) { + delete m_selfDiffTempDep_Ns[j][k]; } - for (size_t l=0; l < m_nsp2; l++) { - delete m_mobRatTempDep_Ns[l][k]; + for (size_t j=0; j < m_nsp2; j++) { + delete m_mobRatTempDep_Ns[j][k]; } delete m_lambdaTempDep_Ns[k]; delete m_radiusTempDep_Ns[k];