A few algorithm changes. Starting to use the m_speciesStatus[] spots

for component species.
This commit is contained in:
Harry Moffat 2008-10-23 01:13:35 +00:00
parent 1e68f099d5
commit 2d13664743
3 changed files with 35 additions and 42 deletions

View file

@ -307,7 +307,6 @@ namespace VCSnonideal {
int elType = m_elType[i];
if (elType == VCS_ELEM_TYPE_ABSPOS) {
for (kspec = 0; kspec < m_numSpeciesTot; kspec++) {
// int irxn = kspec - m_numComponents;
if (m_speciesUnknownType[kspec] != VCS_SPECIES_TYPE_INTERFACIALVOLTAGE) {
double atomComp = m_formulaMatrix[i][kspec];
if (atomComp > 0.0) {
@ -327,17 +326,14 @@ namespace VCSnonideal {
if (m_molNumSpecies_old[kspec] < VCS_DELETE_MINORSPECIES_CUTOFF) {
m_molNumSpecies_old[kspec] = 0.0;
if (m_SSPhase[kspec]) {
// m_rxnStatus[kspec] = VCS_SPECIES_ZEROEDSS;
m_speciesStatus[kspec] = VCS_SPECIES_ZEROEDSS;
m_speciesStatus[kspec] = VCS_SPECIES_ZEROEDSS;
} else {
// m_rxnStatus[kspec] = VCS_SPECIES_ZEROEDMS;
m_speciesStatus[kspec] = VCS_SPECIES_ZEROEDMS;
m_speciesStatus[kspec] = VCS_SPECIES_ACTIVEBUTZERO;
}
#ifdef DEBUG_MODE
if (m_debug_print_lvl >= 2) {
plogf(" --- vcs_elcorr: Zeroed species %s and changed "
"status to %d due to max bounds constraint\n",
// m_speciesName[kspec].c_str(), m_rxnStatus[irxn]);
m_speciesName[kspec].c_str(), m_speciesStatus[kspec]);
}
#endif

View file

@ -1531,7 +1531,7 @@ public:
/*!
* m_deltaMolNumPhase[irxn][iphase] = k = nc + irxn
*/
DoubleStarStar m_deltaMolNumPhase;
DoubleStarStar m_deltaMolNumPhase;
//! This is 1 if the phase, iphase, participates in the formation reaction
//! irxn, and zero otherwise. PhaseParticipation[irxn][iphase]

View file

@ -2453,51 +2453,47 @@ namespace VCSnonideal {
}
#endif
/*
* Loop over all of the active noncomponent species in the phase.
* Loop over all of the species in the phase.
*/
for (kspec = m_numComponents; kspec < m_numSpeciesRdc; ++kspec) {
if (m_phaseID[kspec] == iph) {
if (m_speciesUnknownType[kspec] != VCS_SPECIES_TYPE_INTERFACIALVOLTAGE) {
irxn = kspec - m_numComponents;
/*
* calculate an extent of rxn, dx, that zeroes out the species.
*/
dx = - (m_molNumSpecies_old[kspec]);
double dxTent = dx;
/*
* calculate an extent of rxn, dx, that zeroes out the species.
*/
dx = - (m_molNumSpecies_old[kspec]);
double dxTent = dx;
int retn = delta_species(kspec, &dxTent);
if (retn != 1) {
successful = false;
int retn = delta_species(kspec, &dxTent);
if (retn != 1) {
successful = false;
#ifdef DEBUG_MODE
if (m_debug_print_lvl >= 2) {
plogf(" --- delete_multiphase %d, %s ERROR problems deleting species %s\n",
iph, Vphase->PhaseName.c_str(), m_speciesName[kspec].c_str() );
plogf(" --- delta attempted: %g achieved: %g "
" Zeroing it manually\n", dx, dxTent);
}
#endif
m_molNumSpecies_old[kspec] = 0.0;
m_molNumSpecies_new[kspec] = 0.0;
m_deltaMolNumSpecies[kspec] = 0.0;
// recover the total phase moles.
vcs_tmoles();
} else {
/*
* Set the mole number of that species to zero.
*/
m_molNumSpecies_old[kspec] = 0.0;
m_molNumSpecies_new[kspec] = 0.0;
m_deltaMolNumSpecies[kspec] = 0.0;
if (m_debug_print_lvl >= 2) {
plogf(" --- delete_multiphase %d, %s ERROR problems deleting species %s\n",
iph, Vphase->PhaseName.c_str(), m_speciesName[kspec].c_str() );
plogf(" --- delta attempted: %g achieved: %g "
" Zeroing it manually\n", dx, dxTent);
}
#endif
m_molNumSpecies_old[kspec] = 0.0;
m_molNumSpecies_new[kspec] = 0.0;
m_deltaMolNumSpecies[kspec] = 0.0;
// recover the total phase moles.
vcs_tmoles();
} else {
/*
* Change the status flag of the species to that of an
* zeroed phase
* Set the mole number of that species to zero.
*/
m_speciesStatus[kspec] = VCS_SPECIES_ZEROEDMS;
m_molNumSpecies_old[kspec] = 0.0;
m_molNumSpecies_new[kspec] = 0.0;
m_deltaMolNumSpecies[kspec] = 0.0;
}
/*
* Change the status flag of the species to that of an
* zeroed phase
*/
m_speciesStatus[kspec] = VCS_SPECIES_ZEROEDMS;
}
}
}
@ -2554,6 +2550,7 @@ namespace VCSnonideal {
#endif
m_molNumSpecies_old[kcomp] = 0.0;
}
m_speciesStatus[kcomp] = VCS_SPECIES_ZEROEDMS;
}
}