Changed names of some variables.
This commit is contained in:
parent
03a1f8dca2
commit
9fcced29d0
11 changed files with 134 additions and 134 deletions
|
|
@ -24,8 +24,8 @@ namespace VCSnonideal {
|
|||
for (int j = 0; j < m_numElemConstraints; ++j) {
|
||||
m_elemAbundances[j] = 0.0;
|
||||
for (int i = 0; i < m_numSpeciesTot; ++i) {
|
||||
if (SpeciesUnknownType[i] != VCS_SPECIES_TYPE_INTERFACIALVOLTAGE) {
|
||||
m_elemAbundances[j] += FormulaMatrix[j][i] * m_molNumSpecies_old[i];
|
||||
if (m_speciesUnknownType[i] != VCS_SPECIES_TYPE_INTERFACIALVOLTAGE) {
|
||||
m_elemAbundances[j] += m_formulaMatrix[j][i] * m_molNumSpecies_old[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -92,7 +92,7 @@ namespace VCSnonideal {
|
|||
numNonZero = 0;
|
||||
multisign = false;
|
||||
for (int kspec = 0; kspec < m_numSpeciesTot; kspec++) {
|
||||
eval = FormulaMatrix[i][kspec];
|
||||
eval = m_formulaMatrix[i][kspec];
|
||||
if (eval < 0.0) {
|
||||
multisign = true;
|
||||
}
|
||||
|
|
@ -146,9 +146,9 @@ namespace VCSnonideal {
|
|||
for (j = 0; j < m_numElemConstraints; ++j) {
|
||||
elemAbundPhase[j] = 0.0;
|
||||
for (i = 0; i < m_numSpeciesTot; ++i) {
|
||||
if (SpeciesUnknownType[i] != VCS_SPECIES_TYPE_INTERFACIALVOLTAGE) {
|
||||
if (m_speciesUnknownType[i] != VCS_SPECIES_TYPE_INTERFACIALVOLTAGE) {
|
||||
if (PhaseID[i] == iphase) {
|
||||
elemAbundPhase[j] += FormulaMatrix[j][i] * m_molNumSpecies_old[i];
|
||||
elemAbundPhase[j] += m_formulaMatrix[j][i] * m_molNumSpecies_old[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -190,7 +190,7 @@ namespace VCSnonideal {
|
|||
* ga Current element abundances
|
||||
* m_elemAbundancesGoal Required elemental abundances
|
||||
* m_molNumSpecies_old Current mole number of species.
|
||||
* FormulaMatrix[][] Formular matrix of the species
|
||||
* m_formulaMatrix[][] Formular matrix of the species
|
||||
* ne Number of elements
|
||||
* nc Number of components.
|
||||
*
|
||||
|
|
@ -240,8 +240,8 @@ namespace VCSnonideal {
|
|||
numNonZero = 0;
|
||||
multisign = false;
|
||||
for (kspec = 0; kspec < m_numSpeciesTot; kspec++) {
|
||||
if (SpeciesUnknownType[kspec] != VCS_SPECIES_TYPE_INTERFACIALVOLTAGE) {
|
||||
double eval = FormulaMatrix[i][kspec];
|
||||
if (m_speciesUnknownType[kspec] != VCS_SPECIES_TYPE_INTERFACIALVOLTAGE) {
|
||||
double eval = m_formulaMatrix[i][kspec];
|
||||
if (eval < 0.0) {
|
||||
multisign = true;
|
||||
}
|
||||
|
|
@ -253,8 +253,8 @@ namespace VCSnonideal {
|
|||
if (!multisign) {
|
||||
if (numNonZero < 2) {
|
||||
for (kspec = 0; kspec < m_numSpeciesTot; kspec++) {
|
||||
if (SpeciesUnknownType[kspec] != VCS_SPECIES_TYPE_INTERFACIALVOLTAGE) {
|
||||
double eval = FormulaMatrix[i][kspec];
|
||||
if (m_speciesUnknownType[kspec] != VCS_SPECIES_TYPE_INTERFACIALVOLTAGE) {
|
||||
double eval = m_formulaMatrix[i][kspec];
|
||||
if (eval > 0.0) {
|
||||
m_molNumSpecies_old[kspec] = m_elemAbundancesGoal[i] / eval;
|
||||
changed = true;
|
||||
|
|
@ -265,8 +265,8 @@ namespace VCSnonideal {
|
|||
int numCompNonZero = 0;
|
||||
int compID = -1;
|
||||
for (kspec = 0; kspec < m_numComponents; kspec++) {
|
||||
if (SpeciesUnknownType[kspec] != VCS_SPECIES_TYPE_INTERFACIALVOLTAGE) {
|
||||
double eval = FormulaMatrix[i][kspec];
|
||||
if (m_speciesUnknownType[kspec] != VCS_SPECIES_TYPE_INTERFACIALVOLTAGE) {
|
||||
double eval = m_formulaMatrix[i][kspec];
|
||||
if (eval > 0.0) {
|
||||
compID = kspec;
|
||||
numCompNonZero++;
|
||||
|
|
@ -276,11 +276,11 @@ namespace VCSnonideal {
|
|||
if (numCompNonZero == 1) {
|
||||
double diff = m_elemAbundancesGoal[i];
|
||||
for (kspec = m_numComponents; kspec < m_numSpeciesTot; kspec++) {
|
||||
if (SpeciesUnknownType[kspec] != VCS_SPECIES_TYPE_INTERFACIALVOLTAGE) {
|
||||
double eval = FormulaMatrix[i][kspec];
|
||||
if (m_speciesUnknownType[kspec] != VCS_SPECIES_TYPE_INTERFACIALVOLTAGE) {
|
||||
double eval = m_formulaMatrix[i][kspec];
|
||||
diff -= eval * m_molNumSpecies_old[kspec];
|
||||
}
|
||||
m_molNumSpecies_old[compID] = MAX(0.0,diff/FormulaMatrix[i][compID]);
|
||||
m_molNumSpecies_old[compID] = MAX(0.0,diff/m_formulaMatrix[i][compID]);
|
||||
changed = true;
|
||||
}
|
||||
}
|
||||
|
|
@ -305,8 +305,8 @@ namespace VCSnonideal {
|
|||
int elType = m_elType[i];
|
||||
if (elType == VCS_ELEM_TYPE_ABSPOS) {
|
||||
for (kspec = 0; kspec < m_numSpeciesTot; kspec++) {
|
||||
if (SpeciesUnknownType[kspec] != VCS_SPECIES_TYPE_INTERFACIALVOLTAGE) {
|
||||
double atomComp = FormulaMatrix[i][kspec];
|
||||
if (m_speciesUnknownType[kspec] != VCS_SPECIES_TYPE_INTERFACIALVOLTAGE) {
|
||||
double atomComp = m_formulaMatrix[i][kspec];
|
||||
if (atomComp > 0.0) {
|
||||
double maxPermissible = m_elemAbundancesGoal[i] / atomComp;
|
||||
if (m_molNumSpecies_old[kspec] > maxPermissible) {
|
||||
|
|
@ -354,7 +354,7 @@ namespace VCSnonideal {
|
|||
x[i] = m_elemAbundances[i] - m_elemAbundancesGoal[i];
|
||||
if (fabs(x[i]) > 1.0E-13) retn = 1;
|
||||
for (j = 0; j < m_numComponents; ++j) {
|
||||
aa[j + i*m_numElemConstraints] = FormulaMatrix[j][i];
|
||||
aa[j + i*m_numElemConstraints] = m_formulaMatrix[j][i];
|
||||
}
|
||||
}
|
||||
i = vcsUtil_mlequ(aa, m_numElemConstraints, m_numComponents, x, 1);
|
||||
|
|
@ -424,13 +424,13 @@ namespace VCSnonideal {
|
|||
* situation.
|
||||
*/
|
||||
for (kspec = 0; kspec < m_numSpeciesTot; kspec++) {
|
||||
if (SpeciesUnknownType[kspec] == VCS_SPECIES_TYPE_INTERFACIALVOLTAGE) {
|
||||
if (m_speciesUnknownType[kspec] == VCS_SPECIES_TYPE_INTERFACIALVOLTAGE) {
|
||||
continue;
|
||||
}
|
||||
saveDir = 0.0;
|
||||
goodSpec = TRUE;
|
||||
for (i = 0; i < m_numComponents; ++i) {
|
||||
dir = FormulaMatrix[i][kspec] * (m_elemAbundancesGoal[i] - m_elemAbundances[i]);
|
||||
dir = m_formulaMatrix[i][kspec] * (m_elemAbundancesGoal[i] - m_elemAbundances[i]);
|
||||
if (fabs(dir) > 1.0E-10) {
|
||||
if (dir > 0.0) {
|
||||
if (saveDir < 0.0) {
|
||||
|
|
@ -445,7 +445,7 @@ namespace VCSnonideal {
|
|||
}
|
||||
saveDir = dir;
|
||||
} else {
|
||||
if (FormulaMatrix[i][kspec] != 0.) {
|
||||
if (m_formulaMatrix[i][kspec] != 0.) {
|
||||
goodSpec = FALSE;
|
||||
break;
|
||||
}
|
||||
|
|
@ -455,8 +455,8 @@ namespace VCSnonideal {
|
|||
its = 0;
|
||||
xx = 0.0;
|
||||
for (i = 0; i < m_numComponents; ++i) {
|
||||
if (FormulaMatrix[i][kspec] != 0.0) {
|
||||
xx += (m_elemAbundancesGoal[i] - m_elemAbundances[i]) / FormulaMatrix[i][kspec];
|
||||
if (m_formulaMatrix[i][kspec] != 0.0) {
|
||||
xx += (m_elemAbundancesGoal[i] - m_elemAbundances[i]) / m_formulaMatrix[i][kspec];
|
||||
its++;
|
||||
}
|
||||
}
|
||||
|
|
@ -487,8 +487,8 @@ namespace VCSnonideal {
|
|||
(m_elType[i] == VCS_ELEM_TYPE_ABSPOS && m_elemAbundancesGoal[i] == 0.0)) {
|
||||
for (kspec = 0; kspec < m_numSpeciesRdc; kspec++) {
|
||||
if (m_elemAbundances[i] > 0.0) {
|
||||
if (FormulaMatrix[i][kspec] < 0.0) {
|
||||
m_molNumSpecies_old[kspec] -= m_elemAbundances[i] / FormulaMatrix[i][kspec] ;
|
||||
if (m_formulaMatrix[i][kspec] < 0.0) {
|
||||
m_molNumSpecies_old[kspec] -= m_elemAbundances[i] / m_formulaMatrix[i][kspec] ;
|
||||
if (m_molNumSpecies_old[kspec] < 0.0) {
|
||||
m_molNumSpecies_old[kspec] = 0.0;
|
||||
}
|
||||
|
|
@ -497,8 +497,8 @@ namespace VCSnonideal {
|
|||
}
|
||||
}
|
||||
if (m_elemAbundances[i] < 0.0) {
|
||||
if (FormulaMatrix[i][kspec] > 0.0) {
|
||||
m_molNumSpecies_old[kspec] -= m_elemAbundances[i] / FormulaMatrix[i][kspec];
|
||||
if (m_formulaMatrix[i][kspec] > 0.0) {
|
||||
m_molNumSpecies_old[kspec] -= m_elemAbundances[i] / m_formulaMatrix[i][kspec];
|
||||
if (m_molNumSpecies_old[kspec] < 0.0) {
|
||||
m_molNumSpecies_old[kspec] = 0.0;
|
||||
}
|
||||
|
|
@ -525,13 +525,13 @@ namespace VCSnonideal {
|
|||
bool useZeroed = true;
|
||||
for (kspec = 0; kspec < m_numSpeciesRdc; kspec++) {
|
||||
if (dev < 0.0) {
|
||||
if (FormulaMatrix[i][kspec] < 0.0) {
|
||||
if (m_formulaMatrix[i][kspec] < 0.0) {
|
||||
if (m_molNumSpecies_old[kspec] > 0.0) {
|
||||
useZeroed = false;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (FormulaMatrix[i][kspec] > 0.0) {
|
||||
if (m_formulaMatrix[i][kspec] > 0.0) {
|
||||
if (m_molNumSpecies_old[kspec] > 0.0) {
|
||||
useZeroed = false;
|
||||
}
|
||||
|
|
@ -541,8 +541,8 @@ namespace VCSnonideal {
|
|||
for (kspec = 0; kspec < m_numSpeciesRdc; kspec++) {
|
||||
if (m_molNumSpecies_old[kspec] > 0.0 || useZeroed) {
|
||||
if (dev < 0.0) {
|
||||
if (FormulaMatrix[i][kspec] < 0.0) {
|
||||
double delta = dev / FormulaMatrix[i][kspec] ;
|
||||
if (m_formulaMatrix[i][kspec] < 0.0) {
|
||||
double delta = dev / m_formulaMatrix[i][kspec] ;
|
||||
m_molNumSpecies_old[kspec] += delta;
|
||||
if (m_molNumSpecies_old[kspec] < 0.0) {
|
||||
m_molNumSpecies_old[kspec] = 0.0;
|
||||
|
|
@ -552,8 +552,8 @@ namespace VCSnonideal {
|
|||
}
|
||||
}
|
||||
if (dev > 0.0) {
|
||||
if (FormulaMatrix[i][kspec] > 0.0) {
|
||||
double delta = dev / FormulaMatrix[i][kspec] ;
|
||||
if (m_formulaMatrix[i][kspec] > 0.0) {
|
||||
double delta = dev / m_formulaMatrix[i][kspec] ;
|
||||
m_molNumSpecies_old[kspec] += delta;
|
||||
if (m_molNumSpecies_old[kspec] < 0.0) {
|
||||
m_molNumSpecies_old[kspec] = 0.0;
|
||||
|
|
|
|||
|
|
@ -141,7 +141,7 @@ namespace VCSnonideal {
|
|||
* from the current component.
|
||||
*/
|
||||
for (j = 0; j < ncomponents; ++j) {
|
||||
sm[j + jr*ncomponents] = FormulaMatrix[k][j];
|
||||
sm[j + jr*ncomponents] = m_formulaMatrix[k][j];
|
||||
}
|
||||
if (jl > 0) {
|
||||
/*
|
||||
|
|
@ -252,7 +252,7 @@ namespace VCSnonideal {
|
|||
vcsUtil_isw(VCS_DATA_PTR(m_elType), ipos, jpos);
|
||||
vcsUtil_isw(VCS_DATA_PTR(ElActive), ipos, jpos);
|
||||
for (j = 0; j < m_numSpeciesTot; ++j) {
|
||||
SWAP(FormulaMatrix[ipos][j], FormulaMatrix[jpos][j], dtmp);
|
||||
SWAP(m_formulaMatrix[ipos][j], m_formulaMatrix[jpos][j], dtmp);
|
||||
}
|
||||
vcsUtil_stsw(ElName, ipos, jpos);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -116,7 +116,7 @@ namespace VCSnonideal {
|
|||
if (ElActive[j]) {
|
||||
double tmp = 0.0;
|
||||
for (kspec = 0; kspec < nspecies; ++kspec) {
|
||||
tmp += FormulaMatrix[j][kspec] * molNum[kspec];
|
||||
tmp += m_formulaMatrix[j][kspec] * molNum[kspec];
|
||||
}
|
||||
plogf("%s ", pprefix); plogf(" %-9.9s", (ElName[j]).c_str());
|
||||
plogf(" %12.3g %12.3g\n", m_elemAbundancesGoal[j], tmp);
|
||||
|
|
@ -136,7 +136,7 @@ namespace VCSnonideal {
|
|||
for (kspec = 0; kspec < nspecies; ++kspec) {
|
||||
iph = PhaseID[kspec];
|
||||
Vphase = VPhaseList[iph];
|
||||
if (SpeciesUnknownType[kspec] != VCS_SPECIES_TYPE_INTERFACIALVOLTAGE) {
|
||||
if (m_speciesUnknownType[kspec] != VCS_SPECIES_TYPE_INTERFACIALVOLTAGE) {
|
||||
if (molNum[kspec] <= 0.0) {
|
||||
/*
|
||||
* HKM Should eventually include logic here for non SS phases
|
||||
|
|
@ -178,7 +178,7 @@ namespace VCSnonideal {
|
|||
m_tPhaseMoles_new[iph] = TPhInertMoles[iph] + 1.0E-20;
|
||||
}
|
||||
for (kspec = 0; kspec < m_numComponents; ++kspec) {
|
||||
if (SpeciesUnknownType[kspec] == VCS_SPECIES_TYPE_MOLNUM) {
|
||||
if (m_speciesUnknownType[kspec] == VCS_SPECIES_TYPE_MOLNUM) {
|
||||
m_tPhaseMoles_new[PhaseID[kspec]] += molNum[kspec];
|
||||
}
|
||||
}
|
||||
|
|
@ -190,7 +190,7 @@ namespace VCSnonideal {
|
|||
}
|
||||
vcs_dcopy(VCS_DATA_PTR(m_molNumSpecies_new), molNum, nspecies);
|
||||
for (kspec = 0; kspec < m_numComponents; ++kspec) {
|
||||
if (SpeciesUnknownType[kspec] != VCS_SPECIES_TYPE_MOLNUM) {
|
||||
if (m_speciesUnknownType[kspec] != VCS_SPECIES_TYPE_MOLNUM) {
|
||||
m_molNumSpecies_new[kspec] = 0.0;
|
||||
}
|
||||
}
|
||||
|
|
@ -198,7 +198,7 @@ namespace VCSnonideal {
|
|||
nspecies);
|
||||
|
||||
for (kspec = 0; kspec < m_numComponents; ++kspec) {
|
||||
if (SpeciesUnknownType[kspec] == VCS_SPECIES_TYPE_MOLNUM) {
|
||||
if (m_speciesUnknownType[kspec] == VCS_SPECIES_TYPE_MOLNUM) {
|
||||
if (! SSPhase[kspec]) {
|
||||
iph = PhaseID[kspec];
|
||||
m_feSpecies_curr[kspec] += log(m_molNumSpecies_new[kspec] / m_tPhaseMoles_old[iph]);
|
||||
|
|
@ -265,7 +265,7 @@ namespace VCSnonideal {
|
|||
#ifdef DEBUG_MODE
|
||||
if (vcs_debug_print_lvl >= 2) {
|
||||
for (kspec = 0; kspec < nspecies; ++kspec) {
|
||||
if (SpeciesUnknownType[kspec] != VCS_SPECIES_TYPE_INTERFACIALVOLTAGE) {
|
||||
if (m_speciesUnknownType[kspec] != VCS_SPECIES_TYPE_INTERFACIALVOLTAGE) {
|
||||
plogf("%sdirection (", pprefix); plogf("%-12.12s", SpName[kspec].c_str());
|
||||
plogf(") = %g", m_deltaMolNumSpecies[kspec]);
|
||||
if (SSPhase[kspec]) {
|
||||
|
|
@ -285,7 +285,7 @@ namespace VCSnonideal {
|
|||
/* *********************************************************** */
|
||||
par = 0.5;
|
||||
for (kspec = 0; kspec < m_numComponents; ++kspec) {
|
||||
if (SpeciesUnknownType[kspec] != VCS_SPECIES_TYPE_INTERFACIALVOLTAGE) {
|
||||
if (m_speciesUnknownType[kspec] != VCS_SPECIES_TYPE_INTERFACIALVOLTAGE) {
|
||||
if (par < -m_deltaMolNumSpecies[kspec] / m_molNumSpecies_new[kspec]) {
|
||||
par = -m_deltaMolNumSpecies[kspec] / m_molNumSpecies_new[kspec];
|
||||
}
|
||||
|
|
@ -303,14 +303,14 @@ namespace VCSnonideal {
|
|||
finished = FALSE;
|
||||
do {
|
||||
for (kspec = 0; kspec < m_numComponents; ++kspec) {
|
||||
if (SpeciesUnknownType[kspec] != VCS_SPECIES_TYPE_INTERFACIALVOLTAGE) {
|
||||
if (m_speciesUnknownType[kspec] != VCS_SPECIES_TYPE_INTERFACIALVOLTAGE) {
|
||||
molNum[kspec] = m_molNumSpecies_new[kspec] + par * m_deltaMolNumSpecies[kspec];
|
||||
} else {
|
||||
m_deltaMolNumSpecies[kspec] = 0.0;
|
||||
}
|
||||
}
|
||||
for (kspec = m_numComponents; kspec < nspecies; ++kspec) {
|
||||
if (SpeciesUnknownType[kspec] != VCS_SPECIES_TYPE_INTERFACIALVOLTAGE) {
|
||||
if (m_speciesUnknownType[kspec] != VCS_SPECIES_TYPE_INTERFACIALVOLTAGE) {
|
||||
if (m_deltaMolNumSpecies[kspec] != 0.0) molNum[kspec] = m_deltaMolNumSpecies[kspec] * par;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -125,7 +125,7 @@ namespace VCSnonideal {
|
|||
Faraday_dim = vcs_nondim_Farad(m_VCS_UnitsFormat, m_temperature);
|
||||
if (m_VCS_UnitsFormat == VCS_UNITS_MKS) {
|
||||
for (i = 0; i < m_numSpeciesTot; ++i) {
|
||||
if (SpeciesUnknownType[i] != VCS_SPECIES_TYPE_INTERFACIALVOLTAGE) {
|
||||
if (m_speciesUnknownType[i] != VCS_SPECIES_TYPE_INTERFACIALVOLTAGE) {
|
||||
//m_molNumSpecies_old[i] *= 1.0E3;
|
||||
m_molNumSpecies_old[i] *= 1.0;
|
||||
}
|
||||
|
|
@ -170,7 +170,7 @@ namespace VCSnonideal {
|
|||
}
|
||||
if (m_VCS_UnitsFormat == VCS_UNITS_MKS) {
|
||||
for (i = 0; i < m_numSpeciesTot; ++i) {
|
||||
if (SpeciesUnknownType[i] != VCS_SPECIES_TYPE_INTERFACIALVOLTAGE) {
|
||||
if (m_speciesUnknownType[i] != VCS_SPECIES_TYPE_INTERFACIALVOLTAGE) {
|
||||
//m_molNumSpecies_old[i] /= 1.0E3;
|
||||
m_molNumSpecies_old[i] /= 1.0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -180,7 +180,7 @@ namespace VCSnonideal {
|
|||
if (m_doEstimateEquil < 0) {
|
||||
double sum = 0.0;
|
||||
for (kspec = 0; kspec < m_numSpeciesTot; ++kspec) {
|
||||
if (SpeciesUnknownType[kspec] == VCS_SPECIES_TYPE_MOLNUM) {
|
||||
if (m_speciesUnknownType[kspec] == VCS_SPECIES_TYPE_MOLNUM) {
|
||||
sum += fabs(m_molNumSpecies_old[kspec]);
|
||||
}
|
||||
}
|
||||
|
|
@ -190,7 +190,7 @@ namespace VCSnonideal {
|
|||
else pres = m_pressurePA;
|
||||
retn = vcs_evalSS_TP(0, 0, m_temperature, pres);
|
||||
for (kspec = 0; kspec < m_numSpeciesTot; ++kspec) {
|
||||
if (SpeciesUnknownType[kspec] == VCS_SPECIES_TYPE_MOLNUM) {
|
||||
if (m_speciesUnknownType[kspec] == VCS_SPECIES_TYPE_MOLNUM) {
|
||||
m_molNumSpecies_old[kspec] = - m_SSfeSpecies[kspec];
|
||||
} else {
|
||||
m_molNumSpecies_old[kspec] = 0.0;
|
||||
|
|
|
|||
|
|
@ -124,7 +124,7 @@ int VCS_SOLVE::vcs_report(int iconv)
|
|||
plogf(" %-12.12s", SpName[i].c_str());
|
||||
print_space(13);
|
||||
plogf("%14.7E %14.7E %12.4E", m_molNumSpecies_old[i], m_molNumSpecies_new[i], m_feSpecies_curr[i]);
|
||||
plogf(" %3d", SpeciesUnknownType[i]);
|
||||
plogf(" %3d", m_speciesUnknownType[i]);
|
||||
plogf("\n");
|
||||
}
|
||||
for (i = m_numComponents; i < m_numSpeciesRdc; ++i) {
|
||||
|
|
@ -132,10 +132,10 @@ int VCS_SOLVE::vcs_report(int iconv)
|
|||
plogf(" %-12.12s", SpName[l].c_str());
|
||||
print_space(13);
|
||||
|
||||
if (SpeciesUnknownType[l] == VCS_SPECIES_TYPE_MOLNUM) {
|
||||
if (m_speciesUnknownType[l] == VCS_SPECIES_TYPE_MOLNUM) {
|
||||
plogf("%14.7E %14.7E %12.4E", m_molNumSpecies_old[l], m_molNumSpecies_new[l], m_feSpecies_curr[l]);
|
||||
plogf(" KMolNum ");
|
||||
} else if (SpeciesUnknownType[l] == VCS_SPECIES_TYPE_INTERFACIALVOLTAGE) {
|
||||
} else if (m_speciesUnknownType[l] == VCS_SPECIES_TYPE_INTERFACIALVOLTAGE) {
|
||||
plogf(" NA %14.7E %12.4E", 1.0, m_feSpecies_curr[l]);
|
||||
plogf(" Voltage = %14.7E", m_molNumSpecies_old[l]);
|
||||
} else {
|
||||
|
|
@ -163,9 +163,9 @@ int VCS_SOLVE::vcs_report(int iconv)
|
|||
plogf(" %-12.12s", SpName[kspec].c_str());
|
||||
plogf(" %14.7E %14.7E %12.4E",
|
||||
m_molNumSpecies_old[kspec], m_molNumSpecies_new[kspec], m_deltaGRxn_new[kspec]);
|
||||
if (SpeciesUnknownType[i] == VCS_SPECIES_TYPE_MOLNUM) {
|
||||
if (m_speciesUnknownType[i] == VCS_SPECIES_TYPE_MOLNUM) {
|
||||
plogf(" KMol_Num");
|
||||
} else if (SpeciesUnknownType[i] == VCS_SPECIES_TYPE_INTERFACIALVOLTAGE) {
|
||||
} else if (m_speciesUnknownType[i] == VCS_SPECIES_TYPE_INTERFACIALVOLTAGE) {
|
||||
plogf(" Voltage");
|
||||
} else {
|
||||
plogf(" Unknown");
|
||||
|
|
@ -317,10 +317,10 @@ int VCS_SOLVE::vcs_report(int iconv)
|
|||
plogf("%14.7E ", m_SSfeSpecies[l]);
|
||||
plogf("%14.7E ", log(ActCoeff[l]));
|
||||
double tpmoles = m_tPhaseMoles_old[pid];
|
||||
double phi = phasePhi[pid];
|
||||
double phi = m_phasePhi[pid];
|
||||
double eContrib = phi * Charge[l] * Faraday_dim;
|
||||
double lx = 0.0;
|
||||
if (SpeciesUnknownType[l] == VCS_SPECIES_TYPE_INTERFACIALVOLTAGE) {
|
||||
if (m_speciesUnknownType[l] == VCS_SPECIES_TYPE_INTERFACIALVOLTAGE) {
|
||||
lx = 0.0;
|
||||
} else {
|
||||
if (tpmoles > 0.0 && m_molNumSpecies_old[l] > 0.0) {
|
||||
|
|
|
|||
|
|
@ -91,7 +91,7 @@ int VCS_SOLVE::vcs_setMolesLinProg() {
|
|||
std::vector<double> aw(m_numSpeciesTot, 0.0);
|
||||
|
||||
for (ik = 0; ik < m_numSpeciesTot; ik++) {
|
||||
if (SpeciesUnknownType[ik] != VCS_SPECIES_INTERFACIALVOLTAGE) {
|
||||
if (m_speciesUnknownType[ik] != VCS_SPECIES_INTERFACIALVOLTAGE) {
|
||||
m_molNumSpecies_old[ik] = MAX(0.0, m_molNumSpecies_old[ik]);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -106,7 +106,7 @@ namespace VCSnonideal {
|
|||
*/
|
||||
m_stoichCoeffRxnMatrix.resize(nspecies0, nelements, 0.0);
|
||||
|
||||
scSize.resize(nspecies0, 0.0);
|
||||
m_scSize.resize(nspecies0, 0.0);
|
||||
m_spSize.resize(nspecies0, 1.0);
|
||||
|
||||
m_feSpecies_curr.resize(nspecies0, 0.0);
|
||||
|
|
@ -114,11 +114,11 @@ namespace VCSnonideal {
|
|||
m_feSpecies_new.resize(nspecies0, 0.0);
|
||||
m_molNumSpecies_old.resize(nspecies0, 0.0);
|
||||
|
||||
SpeciesUnknownType.resize(nspecies0, VCS_SPECIES_TYPE_MOLNUM);
|
||||
m_speciesUnknownType.resize(nspecies0, VCS_SPECIES_TYPE_MOLNUM);
|
||||
|
||||
DnPhase.resize(nspecies0, nphase0, 0.0);
|
||||
PhaseParticipation.resize(nspecies0, nphase0, 0);
|
||||
phasePhi.resize(nphase0, 0.0);
|
||||
m_phasePhi.resize(nphase0, 0.0);
|
||||
|
||||
m_molNumSpecies_new.resize(nspecies0, 0.0);
|
||||
|
||||
|
|
@ -137,7 +137,7 @@ namespace VCSnonideal {
|
|||
TmpPhase.resize(nphase0, 0.0);
|
||||
TmpPhase2.resize(nphase0, 0.0);
|
||||
|
||||
FormulaMatrix.resize(nelements, nspecies0);
|
||||
m_formulaMatrix.resize(nelements, nspecies0);
|
||||
|
||||
TPhInertMoles.resize(nphase0, 0.0);
|
||||
|
||||
|
|
@ -497,7 +497,7 @@ namespace VCSnonideal {
|
|||
*/
|
||||
for (i = 0; i < nspecies; i++) {
|
||||
for (j = 0; j < nelements; j++) {
|
||||
FormulaMatrix[j][i] = pub->FormulaMatrix[j][i];
|
||||
m_formulaMatrix[j][i] = pub->FormulaMatrix[j][i];
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -530,7 +530,7 @@ namespace VCSnonideal {
|
|||
/*
|
||||
* Copy the species unknown type
|
||||
*/
|
||||
vcs_icopy(VCS_DATA_PTR(SpeciesUnknownType),
|
||||
vcs_icopy(VCS_DATA_PTR(m_speciesUnknownType),
|
||||
VCS_DATA_PTR(pub->SpeciesUnknownType), nspecies);
|
||||
|
||||
/*
|
||||
|
|
@ -558,8 +558,8 @@ namespace VCSnonideal {
|
|||
for (j = 0; j < nelements; j++) {
|
||||
m_elemAbundancesGoal[j] = 0.0;
|
||||
for (kspec = 0; kspec < nspecies; kspec++) {
|
||||
if (SpeciesUnknownType[kspec] != VCS_SPECIES_TYPE_INTERFACIALVOLTAGE) {
|
||||
m_elemAbundancesGoal[j] += FormulaMatrix[j][kspec] * m_molNumSpecies_old[kspec];
|
||||
if (m_speciesUnknownType[kspec] != VCS_SPECIES_TYPE_INTERFACIALVOLTAGE) {
|
||||
m_elemAbundancesGoal[j] += m_formulaMatrix[j][kspec] * m_molNumSpecies_old[kspec];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -733,7 +733,7 @@ public:
|
|||
*
|
||||
* Both element and species indecies are swapped.
|
||||
*/
|
||||
DoubleStarStar FormulaMatrix;
|
||||
DoubleStarStar m_formulaMatrix;
|
||||
|
||||
//! Stoichiometric coefficient matrix for the reaction mechanism
|
||||
//! expressed in Reduced Canonical Form.
|
||||
|
|
@ -763,7 +763,7 @@ public:
|
|||
* handled by the alt_min treatment or
|
||||
* should be handled as a major species.
|
||||
*/
|
||||
std::vector<double> scSize;
|
||||
std::vector<double> m_scSize;
|
||||
|
||||
//! total size of the species
|
||||
/*!
|
||||
|
|
@ -837,7 +837,7 @@ public:
|
|||
* set to zero in this initial treatment.
|
||||
* Later we may have non-zero interfacial currents.
|
||||
*/
|
||||
std::vector<int> SpeciesUnknownType;
|
||||
std::vector<int> m_speciesUnknownType;
|
||||
|
||||
//! Change in the number of moles of phase, iphase, due to the noncomponent formation
|
||||
//! reaction, irxn, for species, k:
|
||||
|
|
@ -851,7 +851,7 @@ public:
|
|||
IntStarStar PhaseParticipation;
|
||||
|
||||
//! electric potential of the iph phase
|
||||
std::vector<double> phasePhi;
|
||||
std::vector<double> m_phasePhi;
|
||||
|
||||
//! Tentative value of the mole number vector. It's also used to store the
|
||||
//! mole fraction vector.
|
||||
|
|
|
|||
|
|
@ -59,7 +59,7 @@ namespace VCSnonideal {
|
|||
double * const delTPhMoles, int kspec) {
|
||||
std::vector<double> dchange(m_numPhases, 0.0);
|
||||
for (int k = 0; k < kspec; k++) {
|
||||
if (SpeciesUnknownType[k] != VCS_SPECIES_TYPE_INTERFACIALVOLTAGE) {
|
||||
if (m_speciesUnknownType[k] != VCS_SPECIES_TYPE_INTERFACIALVOLTAGE) {
|
||||
int iph = PhaseID[k];
|
||||
dchange[iph] += dsLocal[k];
|
||||
}
|
||||
|
|
@ -291,7 +291,7 @@ namespace VCSnonideal {
|
|||
for (i = 0; i < m_numSpeciesTot; ++i) {
|
||||
plogf(" %-12s", SpName[i].c_str());
|
||||
for (j = 0; j < m_numElemConstraints; ++j) {
|
||||
plogf("%3g", FormulaMatrix[j][i]);
|
||||
plogf("%3g", m_formulaMatrix[j][i]);
|
||||
}
|
||||
if (PhaseID[i] == 0) {
|
||||
plogf(" 1");
|
||||
|
|
@ -303,9 +303,9 @@ namespace VCSnonideal {
|
|||
}
|
||||
print_space(47-m_numElemConstraints*3);
|
||||
plogf("%12.5E %12.5E", RT * m_SSfeSpecies[i], m_molNumSpecies_old[i]);
|
||||
if (SpeciesUnknownType[i] == VCS_SPECIES_TYPE_MOLNUM) {
|
||||
if (m_speciesUnknownType[i] == VCS_SPECIES_TYPE_MOLNUM) {
|
||||
plogf(" Mol_Num");
|
||||
} else if (SpeciesUnknownType[i] == VCS_SPECIES_TYPE_INTERFACIALVOLTAGE) {
|
||||
} else if (m_speciesUnknownType[i] == VCS_SPECIES_TYPE_INTERFACIALVOLTAGE) {
|
||||
plogf(" Voltage");
|
||||
} else {
|
||||
plogf(" Unknown");
|
||||
|
|
@ -602,7 +602,7 @@ namespace VCSnonideal {
|
|||
for (int j = 0; j < m_numElemConstraints; ++j) {
|
||||
int elType = m_elType[j];
|
||||
if (elType == VCS_ELEM_TYPE_ABSPOS) {
|
||||
double atomComp = FormulaMatrix[j][kspec];
|
||||
double atomComp = m_formulaMatrix[j][kspec];
|
||||
if (atomComp > 0.0) {
|
||||
double maxPermissible = m_elemAbundancesGoal[j] / atomComp;
|
||||
if (maxPermissible < VCS_DELETE_MINORSPECIES_CUTOFF) {
|
||||
|
|
@ -945,7 +945,7 @@ namespace VCSnonideal {
|
|||
* Skip the line search if we are birthing a species
|
||||
*/
|
||||
if (dx != 0.0 && (m_molNumSpecies_old[kspec] > 0.0) &&
|
||||
(SpeciesUnknownType[kspec] != VCS_SPECIES_TYPE_INTERFACIALVOLTAGE)) {
|
||||
(m_speciesUnknownType[kspec] != VCS_SPECIES_TYPE_INTERFACIALVOLTAGE)) {
|
||||
double dx_old = dx;
|
||||
#ifdef DEBUG_MODE
|
||||
dx = vcs_line_search(irxn, dx_old, ANOTE);
|
||||
|
|
@ -959,7 +959,7 @@ namespace VCSnonideal {
|
|||
/***********************************************************************/
|
||||
/****** CALCULATE KMOLE NUMBER CHANGE FOR THE COMPONENT BASIS **********/
|
||||
/***********************************************************************/
|
||||
if (dx != 0.0 && (SpeciesUnknownType[kspec] != VCS_SPECIES_TYPE_INTERFACIALVOLTAGE)) {
|
||||
if (dx != 0.0 && (m_speciesUnknownType[kspec] != VCS_SPECIES_TYPE_INTERFACIALVOLTAGE)) {
|
||||
/*
|
||||
* Change the amount of the component compounds according
|
||||
* to the reaction delta that we just computed.
|
||||
|
|
@ -1083,7 +1083,7 @@ namespace VCSnonideal {
|
|||
*/
|
||||
for (kspec = 0; kspec < m_numSpeciesTot; ++kspec) {
|
||||
m_molNumSpecies_new[kspec] = m_molNumSpecies_old[kspec] + m_deltaMolNumSpecies[kspec];
|
||||
if (m_molNumSpecies_new[kspec] < 0.0 && (SpeciesUnknownType[kspec]
|
||||
if (m_molNumSpecies_new[kspec] < 0.0 && (m_speciesUnknownType[kspec]
|
||||
!= VCS_SPECIES_TYPE_INTERFACIALVOLTAGE)) {
|
||||
plogf("vcs_solve_TP: ERROR on step change wt[%d:%s]: %g < 0.0",
|
||||
kspec, SpName[kspec].c_str(), m_molNumSpecies_new[kspec]);
|
||||
|
|
@ -2030,7 +2030,7 @@ namespace VCSnonideal {
|
|||
int iphase = PhaseID[kspec];
|
||||
vcs_VolPhase *Vphase = VPhaseList[iphase];
|
||||
*do_delete = FALSE;
|
||||
if (SpeciesUnknownType[kspec] != VCS_SPECIES_TYPE_INTERFACIALVOLTAGE) {
|
||||
if (m_speciesUnknownType[kspec] != VCS_SPECIES_TYPE_INTERFACIALVOLTAGE) {
|
||||
if (w_kspec <= 0.0) {
|
||||
w_kspec = VCS_DELETE_MINORSPECIES_CUTOFF;
|
||||
}
|
||||
|
|
@ -2144,7 +2144,7 @@ namespace VCSnonideal {
|
|||
int j;
|
||||
double tmp;
|
||||
double delta = *delta_ptr;
|
||||
if (SpeciesUnknownType[kspec] != VCS_SPECIES_TYPE_INTERFACIALVOLTAGE) {
|
||||
if (m_speciesUnknownType[kspec] != VCS_SPECIES_TYPE_INTERFACIALVOLTAGE) {
|
||||
/*
|
||||
* Attempt the given dx. If it doesn't work, try to see if a smaller
|
||||
* one would work,
|
||||
|
|
@ -2214,7 +2214,7 @@ namespace VCSnonideal {
|
|||
/*
|
||||
* Calculate a delta that will eliminate the species.
|
||||
*/
|
||||
if (SpeciesUnknownType[kspec] != VCS_SPECIES_TYPE_INTERFACIALVOLTAGE) {
|
||||
if (m_speciesUnknownType[kspec] != VCS_SPECIES_TYPE_INTERFACIALVOLTAGE) {
|
||||
double dx = -(m_molNumSpecies_old[kspec]);
|
||||
if (dx != 0.0) {
|
||||
retn = delta_species(kspec, &dx);
|
||||
|
|
@ -2301,7 +2301,7 @@ namespace VCSnonideal {
|
|||
if (Vphase->Existence != 2) {
|
||||
Vphase->Existence = 0;
|
||||
for (kspec = 0; kspec < m_numSpeciesRdc; kspec++) {
|
||||
if (SpeciesUnknownType[kspec] != VCS_SPECIES_TYPE_INTERFACIALVOLTAGE) {
|
||||
if (m_speciesUnknownType[kspec] != VCS_SPECIES_TYPE_INTERFACIALVOLTAGE) {
|
||||
if (PhaseID[kspec] == iph) {
|
||||
if (m_molNumSpecies_old[kspec] > 0.0) {
|
||||
Vphase->Existence = 1;
|
||||
|
|
@ -2440,7 +2440,7 @@ namespace VCSnonideal {
|
|||
*/
|
||||
for (kspec = 0; kspec < m_numSpeciesRdc; ++kspec) {
|
||||
if (PhaseID[kspec] == iph) {
|
||||
if (SpeciesUnknownType[kspec] != VCS_SPECIES_TYPE_INTERFACIALVOLTAGE) {
|
||||
if (m_speciesUnknownType[kspec] != VCS_SPECIES_TYPE_INTERFACIALVOLTAGE) {
|
||||
irxn = kspec - m_numComponents;
|
||||
/*
|
||||
* calculate an extent of rxn, dx, that zeroes out the species.
|
||||
|
|
@ -2856,7 +2856,7 @@ namespace VCSnonideal {
|
|||
|
||||
kspec = ir[irxn];
|
||||
|
||||
if (SpeciesUnknownType[kspec] != VCS_SPECIES_TYPE_INTERFACIALVOLTAGE) {
|
||||
if (m_speciesUnknownType[kspec] != VCS_SPECIES_TYPE_INTERFACIALVOLTAGE) {
|
||||
|
||||
dnPhase_irxn = DnPhase[irxn];
|
||||
|
||||
|
|
@ -3099,7 +3099,7 @@ namespace VCSnonideal {
|
|||
m_deltaGRxn_new[irxn], ANOTE);
|
||||
}
|
||||
#endif
|
||||
} /* End of loop over SpeciesUnknownType */
|
||||
} /* End of loop over m_speciesUnknownType */
|
||||
} /* End of loop over non-component stoichiometric formation reactions */
|
||||
#ifdef DEBUG_MODE
|
||||
if (vcs_debug_print_lvl >= 2) {
|
||||
|
|
@ -3268,7 +3268,7 @@ namespace VCSnonideal {
|
|||
double sum = 0.0;
|
||||
for (k = 0; k < Vphase->NVolSpecies; k++) {
|
||||
kspec = Vphase->IndSpecies[k];
|
||||
if (SpeciesUnknownType[kspec] != VCS_SPECIES_TYPE_INTERFACIALVOLTAGE) {
|
||||
if (m_speciesUnknownType[kspec] != VCS_SPECIES_TYPE_INTERFACIALVOLTAGE) {
|
||||
sum += m_molNumSpecies_old[kspec];
|
||||
}
|
||||
if (sum > 0.0) break;
|
||||
|
|
@ -3386,7 +3386,7 @@ namespace VCSnonideal {
|
|||
vcs_print_stringTrunc(SpName[k].c_str(), 11, 1);
|
||||
plogf(" | ");
|
||||
for (j = 0; j < m_numElemConstraints; j++) {
|
||||
plogf(" %8.2g", FormulaMatrix[j][k]);
|
||||
plogf(" %8.2g", m_formulaMatrix[j][k]);
|
||||
}
|
||||
plogf("\n");
|
||||
}
|
||||
|
|
@ -3412,7 +3412,7 @@ namespace VCSnonideal {
|
|||
* Take out the Voltage unknowns from consideration
|
||||
*/
|
||||
for (k = 0; k < m_numSpeciesTot; k++) {
|
||||
if (SpeciesUnknownType[k] == VCS_SPECIES_TYPE_INTERFACIALVOLTAGE) {
|
||||
if (m_speciesUnknownType[k] == VCS_SPECIES_TYPE_INTERFACIALVOLTAGE) {
|
||||
aw[k] = test;
|
||||
}
|
||||
}
|
||||
|
|
@ -3485,13 +3485,13 @@ namespace VCSnonideal {
|
|||
int nonZeroesKspec = 0;
|
||||
for (kspec = ncTrial; kspec < m_numSpeciesTot; kspec++) {
|
||||
if (aw[kspec] >= 0.0) {
|
||||
if (SpeciesUnknownType[kspec] != VCS_SPECIES_TYPE_INTERFACIALVOLTAGE) {
|
||||
if (m_speciesUnknownType[kspec] != VCS_SPECIES_TYPE_INTERFACIALVOLTAGE) {
|
||||
maxConcPossKspec = 1.0E10;
|
||||
nonZeroesKspec = 0;
|
||||
for (int j = 0; j < m_numElemConstraints; ++j) {
|
||||
if (ElActive[j]) {
|
||||
if (m_elType[j] == VCS_ELEM_TYPE_ABSPOS) {
|
||||
double nu = FormulaMatrix[j][kspec];
|
||||
double nu = m_formulaMatrix[j][kspec];
|
||||
if (nu != 0.0) {
|
||||
nonZeroesKspec++;
|
||||
maxConcPossKspec = MIN(m_elemAbundancesGoal[j] / nu, maxConcPossKspec);
|
||||
|
|
@ -3573,7 +3573,7 @@ namespace VCSnonideal {
|
|||
*/
|
||||
jl = jr;
|
||||
for (j = 0; j < m_numElemConstraints; ++j) {
|
||||
sm[j + jr*m_numElemConstraints] = FormulaMatrix[j][k];
|
||||
sm[j + jr*m_numElemConstraints] = m_formulaMatrix[j][k];
|
||||
}
|
||||
if (jl > 0) {
|
||||
/*
|
||||
|
|
@ -3662,12 +3662,12 @@ namespace VCSnonideal {
|
|||
* This algorithm makes the assumption that the
|
||||
* first nc rows of the formula matrix aren't rank deficient.
|
||||
* However, this might not be the case. For example, assume
|
||||
* that the first element in FormulaMatrix[] is argon. Assume that
|
||||
* that the first element in m_formulaMatrix[] is argon. Assume that
|
||||
* no species in the matrix problem actually includes argon.
|
||||
* Then, the first row in sm[], below will be indentically
|
||||
* zero. bleh.
|
||||
* What needs to be done is to perform a rearrangement
|
||||
* of the ELEMENTS -> i.e. rearrange, FormulaMatrix, sp, and m_elemAbundancesGoal, such
|
||||
* of the ELEMENTS -> i.e. rearrange, m_formulaMatrix, sp, and m_elemAbundancesGoal, such
|
||||
* that the first nc elements form in combination with the
|
||||
* nc components create an invertible sm[]. not a small
|
||||
* project, but very doable.
|
||||
|
|
@ -3681,13 +3681,13 @@ namespace VCSnonideal {
|
|||
*/
|
||||
for (j = 0; j < ncTrial; ++j) {
|
||||
for (i = 0; i < ncTrial; ++i) {
|
||||
sm[i + j*m_numElemConstraints] = FormulaMatrix[i][j];
|
||||
sm[i + j*m_numElemConstraints] = m_formulaMatrix[i][j];
|
||||
}
|
||||
}
|
||||
for (i = 0; i < m_numRxnTot; ++i) {
|
||||
k = ir[i];
|
||||
for (j = 0; j < ncTrial; ++j) {
|
||||
m_stoichCoeffRxnMatrix[i][j] = FormulaMatrix[j][k];
|
||||
m_stoichCoeffRxnMatrix[i][j] = m_formulaMatrix[j][k];
|
||||
}
|
||||
}
|
||||
/*
|
||||
|
|
@ -3722,14 +3722,14 @@ namespace VCSnonideal {
|
|||
}
|
||||
}
|
||||
for (k = 0; k < m_numSpeciesTot; k++) {
|
||||
if (SpeciesUnknownType[k] == VCS_SPECIES_TYPE_INTERFACIALVOLTAGE) {
|
||||
if (m_speciesUnknownType[k] == VCS_SPECIES_TYPE_INTERFACIALVOLTAGE) {
|
||||
|
||||
for (j = 0; j < ncTrial; ++j) {
|
||||
for (i = 0; i < ncTrial; ++i) {
|
||||
if (i == jlose) {
|
||||
sm[i + j*m_numElemConstraints] = FormulaMatrix[juse][j];
|
||||
sm[i + j*m_numElemConstraints] = m_formulaMatrix[juse][j];
|
||||
} else {
|
||||
sm[i + j*m_numElemConstraints] = FormulaMatrix[i][j];
|
||||
sm[i + j*m_numElemConstraints] = m_formulaMatrix[i][j];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -3737,9 +3737,9 @@ namespace VCSnonideal {
|
|||
k = ir[i];
|
||||
for (j = 0; j < ncTrial; ++j) {
|
||||
if (j == jlose) {
|
||||
aw[j] = FormulaMatrix[juse][k];
|
||||
aw[j] = m_formulaMatrix[juse][k];
|
||||
} else {
|
||||
aw[j] = FormulaMatrix[j][k];
|
||||
aw[j] = m_formulaMatrix[j][k];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -3764,7 +3764,7 @@ namespace VCSnonideal {
|
|||
for (j = 0; j < ncTrial; j++) {
|
||||
szTmp += fabs(m_stoichCoeffRxnMatrix[i][j]);
|
||||
}
|
||||
scSize[i] = szTmp;
|
||||
m_scSize[i] = szTmp;
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -3782,7 +3782,7 @@ namespace VCSnonideal {
|
|||
for (j = 0; j < ncTrial; j++) {
|
||||
plogf("%-10.10s", SpName[j].c_str());
|
||||
}
|
||||
//plogf("| scSize");
|
||||
//plogf("| m_scSize");
|
||||
plogf("\n");
|
||||
for (i = 0; i < m_numRxnTot; i++) {
|
||||
plogf(" --- %3d ", ir[i]);
|
||||
|
|
@ -3791,7 +3791,7 @@ namespace VCSnonideal {
|
|||
for (j = 0; j < ncTrial; j++) {
|
||||
plogf(" %6.2f", m_stoichCoeffRxnMatrix[i][j]);
|
||||
}
|
||||
//plogf(" | %6.2f", scSize[i]);
|
||||
//plogf(" | %6.2f", m_scSize[i]);
|
||||
plogf("\n");
|
||||
}
|
||||
plogf(" "); for(i=0; i<77; i++) plogf("-"); plogf("\n");
|
||||
|
|
@ -3899,7 +3899,7 @@ namespace VCSnonideal {
|
|||
int iph, k;
|
||||
|
||||
if (kspec < m_numComponents) return VCS_SPECIES_COMPONENT;
|
||||
if (SpeciesUnknownType[kspec] == VCS_SPECIES_TYPE_INTERFACIALVOLTAGE) {
|
||||
if (m_speciesUnknownType[kspec] == VCS_SPECIES_TYPE_INTERFACIALVOLTAGE) {
|
||||
return VCS_SPECIES_INTERFACIALVOLTAGE;
|
||||
}
|
||||
iph = PhaseID[kspec];
|
||||
|
|
@ -3952,7 +3952,7 @@ namespace VCSnonideal {
|
|||
for (int j = 0; j < m_numElemConstraints; ++j) {
|
||||
int elType = m_elType[j];
|
||||
if (elType == VCS_ELEM_TYPE_ABSPOS) {
|
||||
double atomComp = FormulaMatrix[j][kspec];
|
||||
double atomComp = m_formulaMatrix[j][kspec];
|
||||
if (atomComp > 0.0) {
|
||||
double maxPermissible = m_elemAbundancesGoal[j] / atomComp;
|
||||
if (maxPermissible < VCS_DELETE_MINORSPECIES_CUTOFF) {
|
||||
|
|
@ -3992,7 +3992,7 @@ namespace VCSnonideal {
|
|||
* phase and shares a non-zero stoichiometric coefficient, then
|
||||
* the current species is a major species.
|
||||
*/
|
||||
double szAdj = scSize[irxn] * std::sqrt((double)m_numRxnTot);
|
||||
double szAdj = m_scSize[irxn] * std::sqrt((double)m_numRxnTot);
|
||||
for (k = 0; k < m_numComponents; ++k) {
|
||||
if (!(SSPhase[k])) {
|
||||
if (m_stoichCoeffRxnMatrix[irxn][k] != 0.0) {
|
||||
|
|
@ -4106,7 +4106,7 @@ namespace VCSnonideal {
|
|||
continue;
|
||||
}
|
||||
}
|
||||
if (SpeciesUnknownType[kspec] == VCS_SPECIES_TYPE_INTERFACIALVOLTAGE) {
|
||||
if (m_speciesUnknownType[kspec] == VCS_SPECIES_TYPE_INTERFACIALVOLTAGE) {
|
||||
#ifdef DEBUG_MODE
|
||||
if (molNum[kspec] != phi) {
|
||||
plogf("We have an inconsistency!\n");
|
||||
|
|
@ -4159,7 +4159,7 @@ namespace VCSnonideal {
|
|||
* Ideal Mixtures:
|
||||
*
|
||||
* m_feSpecies(I) = m_SSfeSpecies(I) + ln(z(I)) - ln(m_tPhaseMoles[iph])
|
||||
* + Charge[I] * Faraday_dim * phasePhi[iphase];
|
||||
* + Charge[I] * Faraday_dim * m_phasePhi[iphase];
|
||||
*
|
||||
* ( This is equivalent to the adding the log of the
|
||||
* mole fraction onto the standard chemical
|
||||
|
|
@ -4170,7 +4170,7 @@ namespace VCSnonideal {
|
|||
*
|
||||
* m_feSpecies(I) = m_SSfeSpecies(I)
|
||||
* + ln(ActCoeff[I] * z(I)) - ln(m_tPhaseMoles[iph])
|
||||
* + Charge[I] * Faraday_dim * phasePhi[iphase];
|
||||
* + Charge[I] * Faraday_dim * m_phasePhi[iphase];
|
||||
*
|
||||
* ( This is equivalent to the adding the log of the
|
||||
* mole fraction multiplied by the activity coefficient
|
||||
|
|
@ -4184,7 +4184,7 @@ namespace VCSnonideal {
|
|||
* m_feSpecies(I) = m_SSfeSpecies(I)
|
||||
* + ln(ActCoeff[I] * z(I)) - ln(m_tPhaseMoles[iph])
|
||||
* - ln(Mnaught * m_units)
|
||||
* + Charge[I] * Faraday_dim * phasePhi[iphase];
|
||||
* + Charge[I] * Faraday_dim * m_phasePhi[iphase];
|
||||
*
|
||||
* note: m_SSfeSpecies(I) is the molality based standard state.
|
||||
* However, ActCoeff[I] is the molar based activity coefficient
|
||||
|
|
@ -4196,7 +4196,7 @@ namespace VCSnonideal {
|
|||
*
|
||||
* m_feSpecies(I) = m_SSfeSpecies(I)
|
||||
* + ln(ActCoeff_M[I] * m(I))
|
||||
* + Charge[I] * Faraday_dim * phasePhi[iphase];
|
||||
* + Charge[I] * Faraday_dim * m_phasePhi[iphase];
|
||||
* where m[I] is the molality of the ith solute
|
||||
*
|
||||
* m[I] = Xmol[I] / ( Xmol[N] * Mnaught * m_units)
|
||||
|
|
@ -4299,7 +4299,7 @@ namespace VCSnonideal {
|
|||
|
||||
}
|
||||
for (kspec = 0; kspec < m_numSpeciesTot; kspec++) {
|
||||
if(SpeciesUnknownType[kspec] != VCS_SPECIES_TYPE_INTERFACIALVOLTAGE) {
|
||||
if(m_speciesUnknownType[kspec] != VCS_SPECIES_TYPE_INTERFACIALVOLTAGE) {
|
||||
iph = PhaseID[kspec];
|
||||
tlogMoles[iph] += z[kspec];
|
||||
}
|
||||
|
|
@ -4344,7 +4344,7 @@ namespace VCSnonideal {
|
|||
Vphase->setMolesFromVCS(z);
|
||||
Vphase->sendToVCSActCoeff(VCS_DATA_PTR(ActCoeff));
|
||||
}
|
||||
phasePhi[iphase] = Vphase->electricPotential();
|
||||
m_phasePhi[iphase] = Vphase->electricPotential();
|
||||
CurrPhAC[iphase] = 1;
|
||||
}
|
||||
}
|
||||
|
|
@ -4359,9 +4359,9 @@ namespace VCSnonideal {
|
|||
*/
|
||||
for (kspec = l1; kspec < l2; ++kspec) {
|
||||
iphase = PhaseID[kspec];
|
||||
if (SpeciesUnknownType[kspec] == VCS_SPECIES_TYPE_INTERFACIALVOLTAGE) {
|
||||
if (m_speciesUnknownType[kspec] == VCS_SPECIES_TYPE_INTERFACIALVOLTAGE) {
|
||||
#ifdef DEBUG_MODE
|
||||
if (z[kspec] != phasePhi[iphase]) {
|
||||
if (z[kspec] != m_phasePhi[iphase]) {
|
||||
plogf("We have an inconsistency!\n");
|
||||
exit(-1);
|
||||
}
|
||||
|
|
@ -4371,7 +4371,7 @@ namespace VCSnonideal {
|
|||
}
|
||||
#endif
|
||||
m_feSpecies_curr[kspec] =
|
||||
m_SSfeSpecies[kspec] + Charge[kspec] * Faraday_dim * phasePhi[iphase];
|
||||
m_SSfeSpecies[kspec] + Charge[kspec] * Faraday_dim * m_phasePhi[iphase];
|
||||
} else {
|
||||
if (SSPhase[kspec]) {
|
||||
m_feSpecies_curr[kspec] = m_SSfeSpecies[kspec];
|
||||
|
|
@ -4382,14 +4382,14 @@ namespace VCSnonideal {
|
|||
m_feSpecies_curr[kspec] = m_SSfeSpecies[kspec]
|
||||
+ log(ActCoeff[kspec] * VCS_DELETE_MINORSPECIES_CUTOFF)
|
||||
- tlogMoles[PhaseID[kspec]] - SpecLnMnaught[kspec]
|
||||
+ Charge[kspec] * Faraday_dim * phasePhi[iphase];
|
||||
+ Charge[kspec] * Faraday_dim * m_phasePhi[iphase];
|
||||
} else {
|
||||
m_feSpecies_curr[kspec] = m_SSfeSpecies[kspec];
|
||||
}
|
||||
} else {
|
||||
m_feSpecies_curr[kspec] = m_SSfeSpecies[kspec] + log(ActCoeff[kspec] * z[kspec])
|
||||
- tlogMoles[PhaseID[kspec]] - SpecLnMnaught[kspec]
|
||||
+ Charge[kspec] * Faraday_dim * phasePhi[iphase];
|
||||
+ Charge[kspec] * Faraday_dim * m_phasePhi[iphase];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -4402,9 +4402,9 @@ namespace VCSnonideal {
|
|||
if (spStatus[irxn] != VCS_SPECIES_MINOR) {
|
||||
kspec = ir[irxn];
|
||||
iphase = PhaseID[kspec];
|
||||
if (SpeciesUnknownType[kspec] == VCS_SPECIES_TYPE_INTERFACIALVOLTAGE) {
|
||||
if (m_speciesUnknownType[kspec] == VCS_SPECIES_TYPE_INTERFACIALVOLTAGE) {
|
||||
#ifdef DEBUG_MODE
|
||||
if (z[kspec] != phasePhi[iphase]) {
|
||||
if (z[kspec] != m_phasePhi[iphase]) {
|
||||
plogf("We have an inconsistency!\n");
|
||||
exit(-1);
|
||||
}
|
||||
|
|
@ -4414,7 +4414,7 @@ namespace VCSnonideal {
|
|||
}
|
||||
#endif
|
||||
m_feSpecies_curr[kspec] =
|
||||
m_SSfeSpecies[kspec] + Charge[kspec] * Faraday_dim * phasePhi[iphase];
|
||||
m_SSfeSpecies[kspec] + Charge[kspec] * Faraday_dim * m_phasePhi[iphase];
|
||||
} else {
|
||||
if (SSPhase[kspec]) {
|
||||
m_feSpecies_curr[kspec] = m_SSfeSpecies[kspec];
|
||||
|
|
@ -4425,14 +4425,14 @@ namespace VCSnonideal {
|
|||
m_feSpecies_curr[kspec] = m_SSfeSpecies[kspec]
|
||||
+ log(ActCoeff[kspec] * VCS_DELETE_MINORSPECIES_CUTOFF)
|
||||
- tlogMoles[PhaseID[kspec]] - SpecLnMnaught[kspec]
|
||||
+ Charge[kspec] * Faraday_dim * phasePhi[iphase]; ;
|
||||
+ Charge[kspec] * Faraday_dim * m_phasePhi[iphase]; ;
|
||||
} else {
|
||||
m_feSpecies_curr[kspec] = m_SSfeSpecies[kspec];
|
||||
}
|
||||
} else {
|
||||
m_feSpecies_curr[kspec] = m_SSfeSpecies[kspec] + log(ActCoeff[kspec] * z[kspec])
|
||||
- tlogMoles[PhaseID[kspec]] - SpecLnMnaught[kspec]
|
||||
+ Charge[kspec] * Faraday_dim * phasePhi[iphase];
|
||||
+ Charge[kspec] * Faraday_dim * m_phasePhi[iphase];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -4446,9 +4446,9 @@ namespace VCSnonideal {
|
|||
if (spStatus[irxn] == VCS_SPECIES_MINOR) {
|
||||
kspec = ir[irxn];
|
||||
iphase = PhaseID[kspec];
|
||||
if (SpeciesUnknownType[kspec] == VCS_SPECIES_TYPE_INTERFACIALVOLTAGE) {
|
||||
if (m_speciesUnknownType[kspec] == VCS_SPECIES_TYPE_INTERFACIALVOLTAGE) {
|
||||
#ifdef DEBUG_MODE
|
||||
if (z[kspec] != phasePhi[iphase]) {
|
||||
if (z[kspec] != m_phasePhi[iphase]) {
|
||||
plogf("We have an inconsistency!\n");
|
||||
exit(-1);
|
||||
}
|
||||
|
|
@ -4458,7 +4458,7 @@ namespace VCSnonideal {
|
|||
}
|
||||
#endif
|
||||
m_feSpecies_curr[kspec] =
|
||||
m_SSfeSpecies[kspec] + Charge[kspec] * Faraday_dim * phasePhi[iphase]; ;
|
||||
m_SSfeSpecies[kspec] + Charge[kspec] * Faraday_dim * m_phasePhi[iphase]; ;
|
||||
} else {
|
||||
if (SSPhase[kspec]) {
|
||||
m_feSpecies_curr[kspec] = m_SSfeSpecies[kspec];
|
||||
|
|
@ -4499,8 +4499,8 @@ namespace VCSnonideal {
|
|||
|
||||
for (j = 0; j < m_numElemConstraints; ++j) {
|
||||
for (int i = 0; i < m_numSpeciesTot; ++i) {
|
||||
if (SpeciesUnknownType[i] == VCS_SPECIES_TYPE_INTERFACIALVOLTAGE) {
|
||||
eav[j] += FormulaMatrix[j][i] * m_molNumSpecies_old[i];
|
||||
if (m_speciesUnknownType[i] == VCS_SPECIES_TYPE_INTERFACIALVOLTAGE) {
|
||||
eav[j] += m_formulaMatrix[j][i] * m_molNumSpecies_old[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -4565,7 +4565,7 @@ namespace VCSnonideal {
|
|||
m_tPhaseMoles_old[i] = TPhInertMoles[i];
|
||||
}
|
||||
for (i = 0; i < m_numSpeciesTot; i++) {
|
||||
if (SpeciesUnknownType[i] == VCS_SPECIES_TYPE_MOLNUM) {
|
||||
if (m_speciesUnknownType[i] == VCS_SPECIES_TYPE_MOLNUM) {
|
||||
m_tPhaseMoles_old[PhaseID[i]] += m_molNumSpecies_old[i];
|
||||
}
|
||||
}
|
||||
|
|
@ -4697,7 +4697,7 @@ namespace VCSnonideal {
|
|||
|
||||
vcsUtil_stsw(SpName, k1, k2);
|
||||
SWAP(m_molNumSpecies_old[k1], m_molNumSpecies_old[k2], t1);
|
||||
SWAP(SpeciesUnknownType[k1], SpeciesUnknownType[k2], j);
|
||||
SWAP(m_speciesUnknownType[k1], m_speciesUnknownType[k2], j);
|
||||
SWAP(m_molNumSpecies_new[k1], m_molNumSpecies_new[k2], t1);
|
||||
SWAP(m_SSfeSpecies[k1], m_SSfeSpecies[k2], t1);
|
||||
SWAP(m_spSize[k1], m_spSize[k2], t1);
|
||||
|
|
@ -4719,7 +4719,7 @@ namespace VCSnonideal {
|
|||
SWAP(VolPM[k1], VolPM[k2], t1);
|
||||
|
||||
for (j = 0; j < m_numElemConstraints; ++j) {
|
||||
SWAP(FormulaMatrix[j][k1], FormulaMatrix[j][k2], t1);
|
||||
SWAP(m_formulaMatrix[j][k1], m_formulaMatrix[j][k2], t1);
|
||||
}
|
||||
if (UseActCoeffJac) {
|
||||
vcs_switch2D(dLnActCoeffdMolNum.baseDataAddr(), k1, k2);
|
||||
|
|
@ -4746,7 +4746,7 @@ namespace VCSnonideal {
|
|||
for (j = 0; j < m_numComponents; ++j) {
|
||||
SWAP(m_stoichCoeffRxnMatrix[i1][j], m_stoichCoeffRxnMatrix[i2][j], t1);
|
||||
}
|
||||
SWAP(scSize[i1], scSize[i2], t1);
|
||||
SWAP(m_scSize[i1], m_scSize[i2], t1);
|
||||
for (iph = 0; iph < m_numPhases; iph++) {
|
||||
SWAP(DnPhase[i1][iph], DnPhase[i2][iph], t1);
|
||||
SWAP(PhaseParticipation[i1][iph],
|
||||
|
|
@ -4825,7 +4825,7 @@ namespace VCSnonideal {
|
|||
|
||||
for (irxn = 0; irxn < irxnl; ++irxn) {
|
||||
kspec = ir[irxn];
|
||||
if (SpeciesUnknownType[kspec] != VCS_SPECIES_TYPE_INTERFACIALVOLTAGE) {
|
||||
if (m_speciesUnknownType[kspec] != VCS_SPECIES_TYPE_INTERFACIALVOLTAGE) {
|
||||
iph = PhaseID[kspec];
|
||||
if (iph == iphase ) {
|
||||
if (m_molNumSpecies_old[kspec] > 0.0) zeroedPhase = FALSE;
|
||||
|
|
@ -4917,7 +4917,7 @@ namespace VCSnonideal {
|
|||
int irxn = kspec - m_numComponents;
|
||||
int soldel = false;
|
||||
double dx = 0.0;
|
||||
if (SpeciesUnknownType[kspec] == VCS_SPECIES_TYPE_INTERFACIALVOLTAGE) {
|
||||
if (m_speciesUnknownType[kspec] == VCS_SPECIES_TYPE_INTERFACIALVOLTAGE) {
|
||||
return dx;
|
||||
}
|
||||
double w_kspec = VCS_DELETE_SPECIES_CUTOFF;
|
||||
|
|
@ -4962,7 +4962,7 @@ namespace VCSnonideal {
|
|||
double *sc_irxn = m_stoichCoeffRxnMatrix[irxn];
|
||||
for (int j = 0; j < m_numComponents; ++j) {
|
||||
// Only loop over element contraints that involve positive def. constraints
|
||||
if (SpeciesUnknownType[j] != VCS_SPECIES_TYPE_INTERFACIALVOLTAGE) {
|
||||
if (m_speciesUnknownType[j] != VCS_SPECIES_TYPE_INTERFACIALVOLTAGE) {
|
||||
if (m_molNumSpecies_old[j] > 0.0) {
|
||||
double tmp = sc_irxn[j] * dx;
|
||||
if (3.0*(-tmp) > m_molNumSpecies_old[j]) {
|
||||
|
|
|
|||
|
|
@ -433,7 +433,7 @@ double VCS_SOLVE::vcs_Gxs_calc(int iphase)
|
|||
if (totmol != 0.0 && Vphase->Activity_Coeff_Model != VCS_AC_CONSTANT) {
|
||||
for (kspec = 0; kspec < m_numSpeciesRdc; kspec++) {
|
||||
if (PhaseID[kspec] == iphase) {
|
||||
if (SpeciesUnknownType[kspec] != VCS_SPECIES_TYPE_INTERFACIALVOLTAGE) {
|
||||
if (m_speciesUnknownType[kspec] != VCS_SPECIES_TYPE_INTERFACIALVOLTAGE) {
|
||||
ts_ptr = SpeciesThermo[kspec];
|
||||
ac = ts_ptr->eval_ac(kspec);
|
||||
Gxs += m_molNumSpecies_old[kspec]/totmol * log(ac);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue