vcs_VolPhase upgrade: more private data
This commit is contained in:
parent
f494e6ee78
commit
7f28666169
5 changed files with 77 additions and 25 deletions
|
|
@ -1443,7 +1443,7 @@ namespace VCSnonideal {
|
|||
plogf("%16s %5d %5d %8d %16s %8d %16e ", VolPhase->PhaseName.c_str(),
|
||||
VolPhase->VP_ID, VolPhase->m_singleSpecies,
|
||||
VolPhase->m_gasPhase, sEOS.c_str(),
|
||||
VolPhase->NVolSpecies, VolPhase->TMolesInert );
|
||||
VolPhase->NVolSpecies, VolPhase->totalMolesInert() );
|
||||
plogf("%16e\n", VolPhase->TotalMoles());
|
||||
}
|
||||
|
||||
|
|
@ -1562,7 +1562,7 @@ namespace VCSnonideal {
|
|||
plogf("%16s %5d %5d %8d %16s %8d %16e ", VolPhase->PhaseName.c_str(),
|
||||
VolPhase->VP_ID, VolPhase->m_singleSpecies,
|
||||
VolPhase->m_gasPhase, sEOS.c_str(),
|
||||
VolPhase->NVolSpecies, VolPhase->TMolesInert );
|
||||
VolPhase->NVolSpecies, VolPhase->totalMolesInert() );
|
||||
plogf("%16e\n", VolPhase->TotalMoles() );
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ namespace VCSnonideal {
|
|||
ChargeNeutralityElement(-1),
|
||||
ElGlobalIndex(0),
|
||||
NVolSpecies(0),
|
||||
TMolesInert(0.0),
|
||||
m_totalMolesInert(0.0),
|
||||
m_molarVolInert(1000.),
|
||||
m_activityConvention(0),
|
||||
m_isIdealSoln(false),
|
||||
|
|
@ -102,7 +102,7 @@ namespace VCSnonideal {
|
|||
nElemConstraints(b.nElemConstraints),
|
||||
ChargeNeutralityElement(b.ChargeNeutralityElement),
|
||||
NVolSpecies(b.NVolSpecies),
|
||||
TMolesInert(b.TMolesInert),
|
||||
m_totalMolesInert(b.m_totalMolesInert),
|
||||
m_activityConvention(b.m_activityConvention),
|
||||
m_isIdealSoln(b.m_isIdealSoln),
|
||||
m_existence(b.m_existence),
|
||||
|
|
@ -177,7 +177,7 @@ namespace VCSnonideal {
|
|||
ElGlobalIndex = b.ElGlobalIndex;
|
||||
NVolSpecies = b.NVolSpecies;
|
||||
PhaseName = b.PhaseName;
|
||||
TMolesInert = b.TMolesInert;
|
||||
m_totalMolesInert = b.m_totalMolesInert;
|
||||
m_activityConvention = b.m_activityConvention;
|
||||
m_isIdealSoln = b.m_isIdealSoln;
|
||||
m_existence = b.m_existence;
|
||||
|
|
@ -254,11 +254,7 @@ namespace VCSnonideal {
|
|||
std::exit(-1);
|
||||
}
|
||||
|
||||
TMolesInert = molesInert;
|
||||
if (TMolesInert > 0.0) {
|
||||
m_existence = 2;
|
||||
}
|
||||
|
||||
setTotalMolesInert(molesInert);
|
||||
m_phi = 0.0;
|
||||
m_phiVarIndex = -1;
|
||||
|
||||
|
|
@ -512,7 +508,7 @@ namespace VCSnonideal {
|
|||
const double * molesSpeciesVCS) {
|
||||
int kglob;
|
||||
double tmp;
|
||||
v_totalMoles = TMolesInert;
|
||||
v_totalMoles = m_totalMolesInert;
|
||||
|
||||
if (molesSpeciesVCS == 0) {
|
||||
#ifdef DEBUG_MODE
|
||||
|
|
@ -593,7 +589,7 @@ namespace VCSnonideal {
|
|||
}
|
||||
}
|
||||
_updateMoleFractionDependencies();
|
||||
if (TMolesInert > 0.0) {
|
||||
if (m_totalMolesInert > 0.0) {
|
||||
m_existence = 2;
|
||||
}
|
||||
/*
|
||||
|
|
@ -871,9 +867,9 @@ namespace VCSnonideal {
|
|||
}
|
||||
m_totalVol *= v_totalMoles;
|
||||
|
||||
if (TMolesInert > 0.0) {
|
||||
if (m_totalMolesInert > 0.0) {
|
||||
if (m_gasPhase) {
|
||||
double volI = TMolesInert * 8314.47215 * Temp / Pres;
|
||||
double volI = m_totalMolesInert * 8314.47215 * Temp / Pres;
|
||||
m_totalVol += volI;
|
||||
} else {
|
||||
printf("unknown situation\n");
|
||||
|
|
@ -1080,8 +1076,16 @@ namespace VCSnonideal {
|
|||
*/
|
||||
void vcs_VolPhase::setTotalMoles(const double totalMols) {
|
||||
v_totalMoles = totalMols;
|
||||
if (TMolesInert > 0.0) {
|
||||
if (m_totalMolesInert > 0.0) {
|
||||
m_existence = 2;
|
||||
#ifdef DEBUG_MODE
|
||||
if (totalMols < m_totalMolesInert) {
|
||||
printf(" vcs_VolPhase::setTotalMoles:: ERROR totalMoles "
|
||||
"less than inert moles: %g %g\n",
|
||||
totalMols, m_totalMolesInert);
|
||||
std::exit(-1);
|
||||
}
|
||||
#endif
|
||||
} else {
|
||||
if (totalMols > 0.0) {
|
||||
m_existence = 1;
|
||||
|
|
@ -1212,7 +1216,7 @@ namespace VCSnonideal {
|
|||
}
|
||||
#ifdef DEBUG_MODE
|
||||
else {
|
||||
if (TMolesInert == 0.0) {
|
||||
if (m_totalMolesInert == 0.0) {
|
||||
if (v_totalMoles == 0.0) {
|
||||
plogf("vcs_VolPhase::setExistence setting true existence for phase with no moles");
|
||||
plogendl();
|
||||
|
|
@ -1251,5 +1255,39 @@ namespace VCSnonideal {
|
|||
IndSpecies[spIndex] = spGlobalIndex;
|
||||
}
|
||||
/**********************************************************************/
|
||||
|
||||
// Sets the total moles of inert in the phase
|
||||
/*
|
||||
* @param tMolesInert Value of the total kmols of inert species in the
|
||||
* phase.
|
||||
*/
|
||||
void vcs_VolPhase::setTotalMolesInert(const double tMolesInert) {
|
||||
if (m_totalMolesInert != tMolesInert) {
|
||||
m_UpToDate = false;
|
||||
m_UpToDate_AC = false;
|
||||
m_UpToDate_VolStar = false;
|
||||
m_UpToDate_VolPM = false;
|
||||
m_UpToDate_GStar = false;
|
||||
m_UpToDate_G0 = false;
|
||||
v_totalMoles += (tMolesInert - m_totalMolesInert);
|
||||
m_totalMolesInert = tMolesInert;
|
||||
}
|
||||
if (m_totalMolesInert > 0.0) {
|
||||
m_existence = 2;
|
||||
} else {
|
||||
if (v_totalMoles > 0.0) {
|
||||
m_existence = 1;
|
||||
} else {
|
||||
m_existence = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
/**********************************************************************/
|
||||
|
||||
// returns the value of the total kmol of inert in the phase
|
||||
double vcs_VolPhase::totalMolesInert() const {
|
||||
return m_totalMolesInert;
|
||||
}
|
||||
/**********************************************************************/
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -452,6 +452,19 @@ namespace VCSnonideal {
|
|||
*/
|
||||
void setSpGlobalIndexVCS(const int spIndex, const int spGlobalIndex);
|
||||
|
||||
//! Sets the total moles of inert in the phase
|
||||
/*!
|
||||
* @param tMolesInert Value of the total kmols of inert species in the
|
||||
* phase.
|
||||
*/
|
||||
void setTotalMolesInert(const double tMolesInert);
|
||||
|
||||
//! returns the value of the total kmol of inert in the phase
|
||||
/*!
|
||||
* @return Returns the total value of the kmol of inert in the phase
|
||||
*/
|
||||
double totalMolesInert() const;
|
||||
|
||||
private:
|
||||
|
||||
//! Evaluate the activity coefficients at the current conditions
|
||||
|
|
@ -632,9 +645,10 @@ namespace VCSnonideal {
|
|||
//! String name for the phase
|
||||
std::string PhaseName;
|
||||
|
||||
private:
|
||||
//! Total moles of inert in the phase
|
||||
double TMolesInert;
|
||||
|
||||
double m_totalMolesInert;
|
||||
public:
|
||||
//! molar volume of the inert species if present
|
||||
/*!
|
||||
* units m**3 / kg
|
||||
|
|
|
|||
|
|
@ -285,7 +285,7 @@ namespace VCSnonideal {
|
|||
plogf("%16s %5d %5d %8d ", Vphase->PhaseName.c_str(),
|
||||
Vphase->VP_ID, Vphase->m_singleSpecies, Vphase->m_gasPhase);
|
||||
plogf("%16s %8d %16e ", EOS_cstr.c_str(),
|
||||
Vphase->NVolSpecies, Vphase->TMolesInert);
|
||||
Vphase->NVolSpecies, Vphase->totalMolesInert());
|
||||
if (iest >= 0) plogf("%16e\n", Vphase->TotalMoles());
|
||||
else plogf(" N/A\n");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -609,7 +609,7 @@ namespace VCSnonideal {
|
|||
*/
|
||||
for (iph = 0; iph < nph; iph++) {
|
||||
Vphase = pub->VPhaseList[iph];
|
||||
TPhInertMoles[iph] = Vphase->TMolesInert;
|
||||
TPhInertMoles[iph] = Vphase->totalMolesInert();
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
@ -882,14 +882,14 @@ namespace VCSnonideal {
|
|||
retn = VCS_PUB_BAD;
|
||||
}
|
||||
|
||||
if (vPhase->TMolesInert != pub_phase_ptr->TMolesInert) {
|
||||
if (vPhase->totalMolesInert() != pub_phase_ptr->totalMolesInert()) {
|
||||
status_change = true;
|
||||
}
|
||||
/*
|
||||
* Copy over the number of inert moles if it has changed.
|
||||
*/
|
||||
TPhInertMoles[iph] = pub_phase_ptr->TMolesInert;
|
||||
vPhase->TMolesInert = pub_phase_ptr->TMolesInert;
|
||||
TPhInertMoles[iph] = pub_phase_ptr->totalMolesInert();
|
||||
vPhase->setTotalMolesInert(pub_phase_ptr->totalMolesInert());
|
||||
if (TPhInertMoles[iph] > 0.0) {
|
||||
vPhase->setExistence(2);
|
||||
vPhase->m_singleSpecies = FALSE;
|
||||
|
|
@ -959,10 +959,10 @@ namespace VCSnonideal {
|
|||
for (int iph = 0; iph < pub->NPhase; iph++) {
|
||||
vcs_VolPhase *pubPhase = pub->VPhaseList[iph];
|
||||
vcs_VolPhase *vPhase = m_VolPhaseList[iph];
|
||||
pubPhase->TMolesInert = vPhase->TMolesInert;
|
||||
pubPhase->setTotalMolesInert(vPhase->totalMolesInert());
|
||||
pubPhase->setTotalMoles(vPhase->TotalMoles());
|
||||
pubPhase->setElectricPotential(vPhase->electricPotential());
|
||||
double sumMoles = pubPhase->TMolesInert;
|
||||
double sumMoles = pubPhase->totalMolesInert();
|
||||
pubPhase->setMoleFractions(VCS_DATA_PTR(vPhase->moleFractions()));
|
||||
for (int k = 0; k < pubPhase->NVolSpecies; k++) {
|
||||
kT = pubPhase->spGlobalIndexVCS(k);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue