variable name changes and documentation update

This commit is contained in:
Harry Moffat 2008-05-09 19:57:09 +00:00
parent dc69f9cb9f
commit 03a1f8dca2
11 changed files with 237 additions and 163 deletions

View file

@ -39,7 +39,7 @@ namespace VCSnonideal {
{
double g = 0.0;
for (int iph = 0; iph < NPhase; iph++) {
for (int iph = 0; iph < m_numPhases; iph++) {
vcs_VolPhase *Vphase = VPhaseList[iph];
if ((TPhInertMoles[iph] > 0.0) && (tPhMoles[iph] > 0.0)) {
g += TPhInertMoles[iph] *

View file

@ -152,7 +152,7 @@ namespace VCSnonideal {
// ff[i] = R * spt->GStar_R_calc(i, Temp, pres);
//}
for (int iph = 0; iph < NPhase; iph++) {
for (int iph = 0; iph < m_numPhases; iph++) {
vcs_VolPhase* vph = VPhaseList[iph];
vph->setState_TP(m_temperature, m_pressurePA);
vph->sendToVCSGStar(VCS_DATA_PTR(m_SSfeSpecies));

View file

@ -235,7 +235,7 @@ namespace VCSnonideal {
* Change the element Global Index list in each phase object
* to reflect the switch in the element positions.
*/
for (int iph = 0; iph < NPhase; iph++) {
for (int iph = 0; iph < m_numPhases; iph++) {
volPhase = VPhaseList[iph];
for (int e = 0; e < volPhase->nElemConstraints; e++) {
if (volPhase->ElGlobalIndex[e] == ipos) {

View file

@ -174,7 +174,7 @@ namespace VCSnonideal {
/*
* m_tPhaseMoles_new[] will consist of just the component moles
*/
for (iph = 0; iph < NPhase; iph++) {
for (iph = 0; iph < m_numPhases; iph++) {
m_tPhaseMoles_new[iph] = TPhInertMoles[iph] + 1.0E-20;
}
for (kspec = 0; kspec < m_numComponents; ++kspec) {
@ -183,7 +183,7 @@ namespace VCSnonideal {
}
}
TMolesMultiphase = 0.0;
for (iph = 0; iph < NPhase; iph++) {
for (iph = 0; iph < m_numPhases; iph++) {
if (! VPhaseList[iph]->SingleSpecies) {
TMolesMultiphase += m_tPhaseMoles_new[iph];
}
@ -224,8 +224,8 @@ namespace VCSnonideal {
/* ********************************************************** */
/* **** ESTIMATE REACTION ADJUSTMENTS *********************** */
/* ********************************************************** */
vcs_dzero(VCS_DATA_PTR(m_deltaPhaseMoles), NPhase);
for (iph = 0; iph < NPhase; iph++) {
vcs_dzero(VCS_DATA_PTR(m_deltaPhaseMoles), m_numPhases);
for (iph = 0; iph < m_numPhases; iph++) {
xtphMax[iph] = log(m_tPhaseMoles_new[iph] * 1.0E32);
xtphMin[iph] = log(m_tPhaseMoles_new[iph] * 1.0E-32);
}
@ -257,7 +257,7 @@ namespace VCSnonideal {
m_deltaMolNumSpecies[k] += m_stoichCoeffRxnMatrix[irxn][k] * m_deltaMolNumSpecies[kspec];
}
for (iph = 0; iph < NPhase; iph++) {
for (iph = 0; iph < m_numPhases; iph++) {
m_deltaPhaseMoles[iph] += DnPhase[irxn][iph] * m_deltaMolNumSpecies[kspec];
}
}

View file

@ -1,6 +1,6 @@
/**
* @file vcs_nondim.cpp
* Nondimensionalization routines with VCSnonideal
* Nondimensionalization routines within VCSnonideal
*/
/*
* $Id$
@ -19,78 +19,91 @@
namespace VCSnonideal {
/**************************************************************************
*
* vcs_nondimMult:
*
* Returns the multiplier for the nondimensionalization of the equations
* (this is basically equal to RT)
**************************************************************************/
double VCS_SOLVE::vcs_nondim_Farad(int mu_units, double TKelvin)
{
double Farad;
if (TKelvin <= 0.0) TKelvin = 293.15;
switch (mu_units) {
case VCS_UNITS_MKS:
case VCS_UNITS_KJMOL:
case VCS_UNITS_KCALMOL:
Farad = 1.602E-19 * 6.022136736e26/ (TKelvin * 8.314472E3);
break;
case VCS_UNITS_UNITLESS:
Farad = 1.602E-19 * 6.022136736e26;
break;
case VCS_UNITS_KELVIN:
Farad = 1.602E-19 * 6.022136736e26/ (TKelvin);
break;
default:
plogf("vcs_nondim_Farad error: unknown units: %d\n", mu_units);
exit(-1);
}
return Farad;
}
// Returns the multiplier for electric charge terms
/*
* This is basically equal to F/RT
*
* @param mu_units integer representing the dimensional units system
* @param TKelvin double Temperature in Kelvin
*
* @return Returns the value of F/RT
*/
double VCS_SOLVE::vcs_nondim_Farad(int mu_units, double TKelvin) const {
double Farad;
if (TKelvin <= 0.0) TKelvin = 293.15;
switch (mu_units) {
case VCS_UNITS_MKS:
case VCS_UNITS_KJMOL:
case VCS_UNITS_KCALMOL:
Farad = 1.602E-19 * 6.022136736e26/ (TKelvin * 8.314472E3);
break;
case VCS_UNITS_UNITLESS:
Farad = 1.602E-19 * 6.022136736e26;
break;
case VCS_UNITS_KELVIN:
Farad = 1.602E-19 * 6.022136736e26/ (TKelvin);
break;
default:
plogf("vcs_nondim_Farad error: unknown units: %d\n", mu_units);
plogendl();
exit(-1);
}
return Farad;
}
double VCS_SOLVE::vcs_nondimMult_TP(int mu_units, double TKelvin)
{
double rt;
if (TKelvin <= 0.0) TKelvin = 293.15;
switch (mu_units) {
case VCS_UNITS_KCALMOL:
rt = TKelvin * 8.314472E-3 / 4.184;
break;
case VCS_UNITS_UNITLESS:
rt = 1.0;
break;
case VCS_UNITS_KJMOL:
rt = TKelvin * 0.008314472;
break;
case VCS_UNITS_KELVIN:
rt = TKelvin;
break;
case VCS_UNITS_MKS:
rt = TKelvin * 8.314472E3;
break;
default:
plogf("vcs_nondimMult_TP error: unknown units: %d\n", mu_units);
exit(-1);
}
return rt;
}
// Returns the multiplier for the nondimensionalization of the equations
/*
* This is basically equal to RT
*
* @param mu_units integer representing the dimensional units system
* @param TKelvin double Temperature in Kelvin
*
* @return Returns the value of RT
*/
double VCS_SOLVE::vcs_nondimMult_TP(int mu_units, double TKelvin) const {
double rt;
if (TKelvin <= 0.0) TKelvin = 293.15;
switch (mu_units) {
case VCS_UNITS_KCALMOL:
rt = TKelvin * 8.314472E-3 / 4.184;
break;
case VCS_UNITS_UNITLESS:
rt = 1.0;
break;
case VCS_UNITS_KJMOL:
rt = TKelvin * 0.008314472;
break;
case VCS_UNITS_KELVIN:
rt = TKelvin;
break;
case VCS_UNITS_MKS:
rt = TKelvin * 8.314472E3;
break;
default:
plogf("vcs_nondimMult_TP error: unknown units: %d\n", mu_units);
plogendl();
exit(-1);
}
return rt;
}
/**************************************************************************
*
* vcs_nondim_TP:
* Nondimensionalize the problem data:
* ->nondimensionalize the free energies using
* the divisor, R * T
*
*
* HKM -> I don't think we need to modify the mole nubmers by 1E3 for the
* case of MKS units. However, what we need to do is to add a scale
* factor so that the number of moles or kmoles is ~ 1.0. Many of the
* algorithms rely on this I think in a subtle way. This is the perfect
* place to add this in.
**************************************************************************/
void VCS_SOLVE::vcs_nondim_TP(void) {
// Nondimensionalize the problem data
/*
* Nondimensionalize the free energies using the divisor, R * T
*
* Essentially the internal data can either be in dimensional form
* or in nondimensional form. This routine switches the data from
* dimensional form into nondimensional form.
*
* What we do is to divide by RT.
*
* @todo Add a scale factor based on the total mole numbers.
* The algorithm contains hard coded numbers based on the
* total mole number. If we ever were faced with a problem
* with significantly different total kmol numbers than one
* the algorithm would have problems.
*/
void VCS_SOLVE::vcs_nondim_TP() {
int i;
double tf;
if (UnitsState == VCS_DIMENSIONAL_G) {
@ -123,17 +136,20 @@ void VCS_SOLVE::vcs_nondim_TP(void) {
}
}
}
} /* vcs_nondim_TP() *********************************************************/
}
/**************************************************************************
*
* vcs_nondim_TP:
* Redimensionalize the problem data:
* ->redimensionalize the free energies using the reverse
* of vcs_nondim_TP
**************************************************************************/
void VCS_SOLVE::vcs_redim_TP(void)
{
// Redimensionalize the problem data
/*
* Redimensionalize the free energies using the multiplier R * T
*
* Essentially the internal data can either be in dimensional form
* or in nondimensional form. This routine switches the data from
* nondimensional form into dimensional form.
*
* What we do is to multiply by RT.
*/
void VCS_SOLVE::vcs_redim_TP(void)
{
int i;
double tf;
if (UnitsState != VCS_DIMENSIONAL_G) {
@ -153,42 +169,47 @@ void VCS_SOLVE::vcs_redim_TP(void)
Faraday_dim *= tf;
}
if (m_VCS_UnitsFormat == VCS_UNITS_MKS) {
for (i = 0; i < m_numSpeciesTot; ++i) {
if (SpeciesUnknownType[i] != VCS_SPECIES_TYPE_INTERFACIALVOLTAGE) {
//m_molNumSpecies_old[i] /= 1.0E3;
m_molNumSpecies_old[i] /= 1.0;
}
}
for (i = 0; i < m_numElemConstraints; ++i) {
//m_elemAbundancesGoal[i] /= 1.0E3;
m_elemAbundancesGoal[i] /= 1.0;
for (i = 0; i < m_numSpeciesTot; ++i) {
if (SpeciesUnknownType[i] != VCS_SPECIES_TYPE_INTERFACIALVOLTAGE) {
//m_molNumSpecies_old[i] /= 1.0E3;
m_molNumSpecies_old[i] /= 1.0;
}
}
for (i = 0; i < m_numElemConstraints; ++i) {
//m_elemAbundancesGoal[i] /= 1.0E3;
m_elemAbundancesGoal[i] /= 1.0;
}
}
} /* vcs_redim_TP() **********************************************************/
}
void VCS_SOLVE::vcs_printChemPotUnits(int unitsFormat) {
// Computes the current elemental abundances vector
/*
* Computes the elemental abundances vector, m_elemAbundances[], and stores it
* back into the global structure
*/
void VCS_SOLVE::vcs_printChemPotUnits(int unitsFormat) const {
switch(unitsFormat) {
case VCS_UNITS_KCALMOL:
plogf("kcal/gmol");
break;
plogf("kcal/gmol");
break;
case VCS_UNITS_UNITLESS:
plogf("dimensionless");
break;
plogf("dimensionless");
break;
case VCS_UNITS_KJMOL:
plogf("kJ/gmol");
break;
plogf("kJ/gmol");
break;
case VCS_UNITS_KELVIN:
plogf("Kelvin");
break;
plogf("Kelvin");
break;
case VCS_UNITS_MKS:
plogf("J/kmol");
break;
plogf("J/kmol");
break;
default:
plogf("unknown units!");
exit(-1);
plogf("unknown units!");
exit(-1);
}
}
}
}

View file

@ -40,7 +40,7 @@ namespace VCSnonideal {
int kspec, iph;
vcs_VolPhase *Vphase;
std::vector<int> numPhSpecies(NPhase, 0);
std::vector<int> numPhSpecies(m_numPhases, 0);
for (kspec = 0; kspec < m_numSpeciesTot; ++kspec) {
numPhSpecies[PhaseID[kspec]]++;
@ -50,7 +50,7 @@ namespace VCSnonideal {
* has been earmarked as a multispecies phase.
* Treat that species as a single-species phase
*/
for (iph = 0; iph < NPhase; iph++) {
for (iph = 0; iph < m_numPhases; iph++) {
Vphase = VPhaseList[iph];
Vphase->SingleSpecies = false;
if (TPhInertMoles[iph] > 0.0) {
@ -282,10 +282,10 @@ namespace VCSnonideal {
vcs_dzero(VCS_DATA_PTR(m_feSpecies_curr), m_numSpeciesTot);
vcs_vdzero(m_feSpecies_old, m_numSpeciesTot);
vcs_vdzero(m_molNumSpecies_new, m_numSpeciesTot);
vcs_dzero(&(DnPhase[0][0]), m_numSpeciesTot*NPhase);
vcs_izero(&(PhaseParticipation[0][0]), m_numSpeciesTot*NPhase);
vcs_dzero(VCS_DATA_PTR(m_deltaPhaseMoles), NPhase);
vcs_dzero(VCS_DATA_PTR(m_tPhaseMoles_new), NPhase);
vcs_dzero(&(DnPhase[0][0]), m_numSpeciesTot * m_numPhases);
vcs_izero(&(PhaseParticipation[0][0]), m_numSpeciesTot * m_numPhases);
vcs_dzero(VCS_DATA_PTR(m_deltaPhaseMoles), m_numPhases);
vcs_dzero(VCS_DATA_PTR(m_tPhaseMoles_new), m_numPhases);
/*
* Calculate the total number of moles in all phases.
*/

View file

@ -144,7 +144,7 @@ int VCS_SOLVE::vcs_report(int iconv)
}
plogf("\n");
}
for (i = 0; i < NPhase; i++) {
for (i = 0; i < m_numPhases; i++) {
if (TPhInertMoles[i] > 0.0) {
inertYes = TRUE;
if (i == 0) {
@ -239,7 +239,7 @@ int VCS_SOLVE::vcs_report(int iconv)
}
plogf(" | Gibbs Total |\n");
print_line("-", m_numElemConstraints*10 + 58);
for (int iphase = 0; iphase < NPhase; iphase++) {
for (int iphase = 0; iphase < m_numPhases; iphase++) {
plogf(" %3d ", iphase);
vcs_VolPhase *VPhase = VPhaseList[iphase];
plogf("%-12.12s |",VPhase->PhaseName.c_str());

View file

@ -140,7 +140,7 @@ int VCS_SOLVE::vcs_rxn_adj_cg(void)
for (j = 0; j < m_numComponents; ++j) {
if (! SSPhase[j]) s += SQUARE(m_stoichCoeffRxnMatrix[irxn][j]) / m_molNumSpecies_old[j];
}
for (j = 0; j < NPhase; j++) {
for (j = 0; j < m_numPhases; j++) {
if (! (VPhaseList[j])->SingleSpecies) {
if (m_tPhaseMoles_old[j] > 0.0)
s -= SQUARE(dnPhase_irxn[j]) / m_tPhaseMoles_old[j];
@ -338,7 +338,7 @@ void VCS_SOLVE::vcs_CalcLnActCoeffJac(const double * const moleSpeciesVCS)
/*
* Loop over all of the phases in the problem
*/
for (int iphase = 0; iphase < NPhase; iphase++) {
for (int iphase = 0; iphase < m_numPhases; iphase++) {
vcs_VolPhase *Vphase = VPhaseList[iphase];
/*
* We don't need to call single species phases;
@ -376,7 +376,7 @@ double VCS_SOLVE::deltaG_Recalc_Rxn(int irxn, const double *const molNum,
{
int kspec = irxn + m_numComponents;
int *pp_ptr = PhaseParticipation[irxn];
for (int iphase = 0; iphase < NPhase; iphase++) {
for (int iphase = 0; iphase < m_numPhases; iphase++) {
if (pp_ptr[iphase]) {
vcs_chemPotPhase(iphase, molNum, ac, mu_i);
}

View file

@ -40,7 +40,7 @@ namespace VCSnonideal {
m_numRxnTot(0),
m_numSpeciesRdc(0),
m_numRxnMinorZeroed(0),
NPhase(0),
m_numPhases(0),
m_doEstimateEquil(0),
m_totalMolNum(0.0),
m_temperature(0.0),
@ -232,10 +232,10 @@ namespace VCSnonideal {
void VCS_SOLVE::delete_memory(void)
{
int j, nph = NPhase;
int j;
int nspecies = m_numSpeciesTot;
for (j = 0; j < nph; j++) {
for (j = 0; j < m_numPhases; j++) {
delete VPhaseList[j];
VPhaseList[j] = 0;
}
@ -486,7 +486,7 @@ namespace VCSnonideal {
/*
* NPhase = number of phases
*/
NPhase = nph;
m_numPhases = nph;
#ifdef DEBUG_MODE
vcs_debug_print_lvl = pub->vcs_debug_print_lvl;
@ -647,7 +647,7 @@ namespace VCSnonideal {
}
}
} else {
if (NPhase == 1) {
if (m_numPhases == 1) {
for (kspec = 0; kspec < nspecies; kspec++) {
PhaseID[kspec] = 0;
indPhSp[kspec] = kspec;
@ -818,7 +818,7 @@ namespace VCSnonideal {
* condition.
*/
for (iph = 0; iph < NPhase; iph++) {
for (iph = 0; iph < m_numPhases; iph++) {
vcs_VolPhase *vPhase = VPhaseList[iph];
vcs_VolPhase *pub_phase_ptr = pub->VPhaseList[iph];
@ -1040,7 +1040,7 @@ double VCS_SOLVE::vcs_VolTotal(double tkelvin, double pres, double w[],
double volPM[])
{
double volTot = 0.0;
for (int iphase = 0; iphase < NPhase; iphase++) {
for (int iphase = 0; iphase < m_numPhases; iphase++) {
vcs_VolPhase *Vphase = VPhaseList[iphase];
Vphase->setState_TP(tkelvin, pres);
Vphase->setMolesFromVCS(w);

View file

@ -455,12 +455,65 @@ public:
int vcs_rearrange(void);
//! Returns the multiplier for electric charge terms
/*
* This is basically equal to F/RT
*
* @param mu_units integer representing the dimensional units system
* @param TKelvin double Temperature in Kelvin
*
* @return Returns the value of F/RT
*/
double vcs_nondim_Farad(int mu_units, double TKelvin) const;
double vcs_nondim_Farad(int mu_units, double TKelvin);
double vcs_nondimMult_TP(int mu_units, double TKelvin);
void vcs_nondim_TP(void);
void vcs_redim_TP(void);
void vcs_printChemPotUnits(int unitsFormat);
//! Returns the multiplier for the nondimensionalization of the equations
/*!
* This is basically equal to RT
*
* @param mu_units integer representing the dimensional units system
* @param TKelvin double Temperature in Kelvin
*
* @return Returns the value of RT
*/
double vcs_nondimMult_TP(int mu_units, double TKelvin) const;
//! Nondimensionalize the problem data
/*!
* Nondimensionalize the free energies using the divisor, R * T
*
* Essentially the internal data can either be in dimensional form
* or in nondimensional form. This routine switches the data from
* dimensional form into nondimensional form.
*
* What we do is to divide by RT.
*
* @todo Add a scale factor based on the total mole numbers.
* The algorithm contains hard coded numbers based on the
* total mole number. If we ever were faced with a problem
* with significantly different total kmol numbers than one
* the algorithm would have problems.
*/
void vcs_nondim_TP();
//! Redimensionalize the problem data
/*!
* Reddimensionalize the free energies using the multiplier R * T
*
* Essentially the internal data can either be in dimensional form
* or in nondimensional form. This routine switches the data from
* nondimensional form into dimensional form.
*
* What we do is to multiply by RT.
*/
void vcs_redim_TP();
//! Print the string representing the Chemical potential units
/*!
* This gets printed using plogf()
*
* @param unitsFormat Integer representing the units system
*/
void vcs_printChemPotUnits(int unitsFormat) const;
//! Computes the current elemental abundances vector
/*!
@ -672,7 +725,7 @@ public:
int m_numRxnMinorZeroed;
//! Number of Phases in the problem
int NPhase;
int m_numPhases;
//! Formula matrix for the problem
/*!

View file

@ -57,14 +57,14 @@ namespace VCSnonideal {
#ifdef DEBUG_MODE
void VCS_SOLVE::checkDelta1(double * const dsLocal,
double * const delTPhMoles, int kspec) {
std::vector<double> dchange(NPhase, 0.0);
std::vector<double> dchange(m_numPhases, 0.0);
for (int k = 0; k < kspec; k++) {
if (SpeciesUnknownType[k] != VCS_SPECIES_TYPE_INTERFACIALVOLTAGE) {
int iph = PhaseID[k];
dchange[iph] += dsLocal[k];
}
}
for (int iphase = 0; iphase < NPhase; iphase++) {
for (int iphase = 0; iphase < m_numPhases; iphase++) {
double denom = MAX(m_totalMolNum, 1.0E-4);
if (!vcs_doubleEqual(dchange[iphase]/denom, delTPhMoles[iphase]/denom)) {
plogf("checkDelta1: we have found a problem\n");
@ -223,7 +223,7 @@ namespace VCSnonideal {
/* ******************************************************* */
/* **** Printout the initial conditions for problem ****** */
/* ******************************************************* */
if (NPhase > 1) {
if (m_numPhases > 1) {
if (! VPhaseList[1]->SingleSpecies) {
liqphase = TRUE;
numSpecliquid = VPhaseList[1]->NVolSpecies;
@ -507,7 +507,7 @@ namespace VCSnonideal {
/*
* Zero out the net change in moles of multispecies phases
*/
vcs_dzero(VCS_DATA_PTR(m_deltaPhaseMoles), NPhase);
vcs_dzero(VCS_DATA_PTR(m_deltaPhaseMoles), m_numPhases);
/* **************************************************************** */
/* ***************** MAIN LOOP IN CALCULATION ******************** */
/* **************************************************************** */
@ -894,7 +894,7 @@ namespace VCSnonideal {
* identically zero.
*/
dnPhase_irxn = DnPhase[irxn];
for (int iphase = 0; iphase < NPhase; iphase++) {
for (int iphase = 0; iphase < m_numPhases; iphase++) {
m_tPhaseMoles_old[iphase] += dnPhase_irxn[iphase] * dx;
}
m_tPhaseMoles_old[iph] = 0.0;
@ -982,7 +982,7 @@ namespace VCSnonideal {
*/
dnPhase_irxn = DnPhase[irxn];
for (iph = 0; iph < NPhase; iph++) {
for (iph = 0; iph < m_numPhases; iph++) {
m_deltaPhaseMoles[iph] += dx * dnPhase_irxn[iph];
}
}
@ -1064,7 +1064,7 @@ namespace VCSnonideal {
for (i = 0; i < m_numSpeciesTot; ++i) {
m_deltaMolNumSpecies[i] *= par;
}
for (iph = 0; iph < NPhase; iph++) {
for (iph = 0; iph < m_numPhases; iph++) {
m_deltaPhaseMoles[iph] *= par;
}
} else {
@ -1095,7 +1095,7 @@ namespace VCSnonideal {
/*
* Calculate the tentative total mole numbers for each phase
*/
for (iph = 0; iph < NPhase; iph++) {
for (iph = 0; iph < m_numPhases; iph++) {
m_tPhaseMoles_new[iph] = m_tPhaseMoles_old[iph] + m_deltaPhaseMoles[iph];
}
/*
@ -1164,7 +1164,7 @@ namespace VCSnonideal {
l2normdg(VCS_DATA_PTR(m_deltaGRxn_old)),
l2normdg(VCS_DATA_PTR(m_deltaGRxn_new)));
plogf(" Total kmoles of gas = %15.7E\n", m_tPhaseMoles_old[0]);
if ((NPhase > 1) && (! (VPhaseList[1])->SingleSpecies)) {
if ((m_numPhases > 1) && (! (VPhaseList[1])->SingleSpecies)) {
plogf(" Total kmoles of liquid = %15.7E\n", m_tPhaseMoles_old[1]);
} else {
plogf(" Total kmoles of liquid = %15.7E\n", 0.0);
@ -1219,7 +1219,7 @@ namespace VCSnonideal {
plogf(" --- Phase_Name KMoles(after update)\n");
plogf(" --- "); vcs_print_line("-", 50);
for (iph = 0; iph < NPhase; iph++) {
for (iph = 0; iph < m_numPhases; iph++) {
Vphase = VPhaseList[iph];
plogf(" --- %18s = %15.7E\n", Vphase->PhaseName.c_str(), m_tPhaseMoles_new[iph]);
}
@ -1253,7 +1253,7 @@ namespace VCSnonideal {
* we have already done this inside the FORCED
* loop.
*/
vcs_dcopy(VCS_DATA_PTR(m_tPhaseMoles_old), VCS_DATA_PTR(m_tPhaseMoles_new), NPhase);
vcs_dcopy(VCS_DATA_PTR(m_tPhaseMoles_old), VCS_DATA_PTR(m_tPhaseMoles_new), m_numPhases);
vcs_dcopy(VCS_DATA_PTR(m_molNumSpecies_old), VCS_DATA_PTR(m_molNumSpecies_new), m_numSpeciesRdc);
vcs_dcopy(VCS_DATA_PTR(m_deltaGRxn_old), VCS_DATA_PTR(m_deltaGRxn_new), m_numRxnRdc);
vcs_dcopy(VCS_DATA_PTR(m_feSpecies_old), VCS_DATA_PTR(m_feSpecies_curr), m_numSpeciesRdc);
@ -1282,7 +1282,7 @@ namespace VCSnonideal {
* absolute zero.
*/
justDeletedMultiPhase = FALSE;
for (iph = 0; iph < NPhase; iph++) {
for (iph = 0; iph < m_numPhases; iph++) {
Vphase = VPhaseList[iph];
if (!(Vphase->SingleSpecies)) {
if (m_tPhaseMoles_old[iph] != 0.0 &&
@ -2545,7 +2545,7 @@ namespace VCSnonideal {
*/
vcs_deltag(0, true);
for (iph = 0; iph < NPhase; iph++) {
for (iph = 0; iph < m_numPhases; iph++) {
if (m_tPhaseMoles_old[iph] > 0.0)
xtcutoff[iph] = log (m_tPhaseMoles_old[iph] / VCS_DELETE_SPECIES_CUTOFF);
else
@ -2759,7 +2759,7 @@ namespace VCSnonideal {
for (kspec = 0; kspec < m_numSpeciesRdc; ++kspec) {
m_molNumSpecies_new[kspec] = m_molNumSpecies_old[kspec] + al * m_deltaMolNumSpecies[kspec];
}
for (iph = 0; iph < NPhase; iph++) {
for (iph = 0; iph < m_numPhases; iph++) {
m_tPhaseMoles_new[iph] = m_tPhaseMoles_old[iph] + al * m_deltaPhaseMoles[iph];
}
vcs_updateVP(1);
@ -2953,7 +2953,7 @@ namespace VCSnonideal {
}
}
}
for (j = 0; j < NPhase; j++) {
for (j = 0; j < m_numPhases; j++) {
Vphase = VPhaseList[j];
if (! Vphase->SingleSpecies) {
if (m_tPhaseMoles_old[j] > 0.0)
@ -3261,7 +3261,7 @@ namespace VCSnonideal {
* This should be implemented.
*/
int k;
for (iph = 0; iph < NPhase; iph++) {
for (iph = 0; iph < m_numPhases; iph++) {
lneed = FALSE;
vcs_VolPhase *Vphase = VPhaseList[iph];
if (! Vphase->SingleSpecies) {
@ -4294,7 +4294,7 @@ namespace VCSnonideal {
* and compare to the storred one. They should be correct.
*/
double *tPhInertMoles = VCS_DATA_PTR(TPhInertMoles);
for (iph = 0; iph < NPhase; iph++) {
for (iph = 0; iph < m_numPhases; iph++) {
tlogMoles[iph] = tPhInertMoles[iph];
}
@ -4305,7 +4305,7 @@ namespace VCSnonideal {
}
}
#ifdef DEBUG_MODE
for (iph = 0; iph < NPhase; iph++) {
for (iph = 0; iph < m_numPhases; iph++) {
if (! vcs_doubleEqual(tlogMoles[iph], tPhMoles_ptr[iph])) {
plogf("phase Moles may be off, iph = %d, %20.14g %20.14g \n",
iph, tlogMoles[iph], tPhMoles_ptr[iph]);
@ -4313,8 +4313,8 @@ namespace VCSnonideal {
}
}
#endif
vcs_dzero(tlogMoles, NPhase);
for (iph = 0; iph < NPhase; iph++) {
vcs_dzero(tlogMoles, m_numPhases);
for (iph = 0; iph < m_numPhases; iph++) {
if (tPhMoles_ptr[iph] > 0.0) {
tlogMoles[iph] = log(tPhMoles_ptr[iph]);
}
@ -4323,7 +4323,7 @@ namespace VCSnonideal {
* Zero the indicator that that tells us the activity coefficients
* are current
*/
vcs_izero(VCS_DATA_PTR(CurrPhAC), NPhase);
vcs_izero(VCS_DATA_PTR(CurrPhAC), m_numPhases);
if (ll != 0) {
l1 = lbot;
@ -4337,7 +4337,7 @@ namespace VCSnonideal {
* Calculate activity coefficients for all phases that are
* not current
*/
for (iphase = 0; iphase < NPhase; iphase++) {
for (iphase = 0; iphase < m_numPhases; iphase++) {
if (!CurrPhAC[iphase]) {
Vphase = VPhaseList[iphase];
if (!Vphase->SingleSpecies) {
@ -4561,7 +4561,7 @@ namespace VCSnonideal {
int i;
double sum;
vcs_VolPhase *Vphase;
for (i = 0; i < NPhase; i++) {
for (i = 0; i < m_numPhases; i++) {
m_tPhaseMoles_old[i] = TPhInertMoles[i];
}
for (i = 0; i < m_numSpeciesTot; i++) {
@ -4570,7 +4570,7 @@ namespace VCSnonideal {
}
}
sum = 0.0;
for (i = 0; i < NPhase; i++) {
for (i = 0; i < m_numPhases; i++) {
sum += m_tPhaseMoles_old[i];
Vphase = VPhaseList[i];
// Took out because we aren't updating mole fractions in Vphase
@ -4603,7 +4603,7 @@ namespace VCSnonideal {
*************************************************************************/
{
vcs_VolPhase *Vphase;
for (int i = 0; i < NPhase; i++) {
for (int i = 0; i < m_numPhases; i++) {
Vphase = VPhaseList[i];
if (place == 0) {
Vphase->setMolesFromVCSCheck(VCS_DATA_PTR(m_molNumSpecies_old),
@ -4747,7 +4747,7 @@ namespace VCSnonideal {
SWAP(m_stoichCoeffRxnMatrix[i1][j], m_stoichCoeffRxnMatrix[i2][j], t1);
}
SWAP(scSize[i1], scSize[i2], t1);
for (iph = 0; iph < NPhase; iph++) {
for (iph = 0; iph < m_numPhases; iph++) {
SWAP(DnPhase[i1][iph], DnPhase[i2][iph], t1);
SWAP(PhaseParticipation[i1][iph],
PhaseParticipation[i2][iph], j);