Added a isIdealSoln() capability to volphase object and then used it
to reduce the amount of calculations.
This commit is contained in:
parent
7b4b970253
commit
ca3bc7c5be
4 changed files with 957 additions and 904 deletions
|
|
@ -1149,7 +1149,6 @@ namespace VCSnonideal {
|
|||
/*
|
||||
* Tell the vcs_VolPhase pointer about cantera
|
||||
*/
|
||||
VolPhase->UseCanteraCalls = true;
|
||||
VolPhase->m_VCS_UnitsFormat = vprob->m_VCS_UnitsFormat;
|
||||
VolPhase->setPtrThermoPhase(tPhase);
|
||||
VolPhase->setTotalMoles(0.0);
|
||||
|
|
@ -1198,7 +1197,7 @@ namespace VCSnonideal {
|
|||
plogf("Unknown Cantera EOS to VCSnonideal: %d\n", eos);
|
||||
}
|
||||
VolPhase->EqnState = VCS_EOS_UNK_CANTERA;
|
||||
if (!VolPhase->UseCanteraCalls) {
|
||||
if (!VolPhase->usingCanteraCalls()) {
|
||||
plogf("vcs functions asked for, but unimplemented\n");
|
||||
exit(-1);
|
||||
}
|
||||
|
|
@ -1301,7 +1300,7 @@ namespace VCSnonideal {
|
|||
* Transfer the thermo specification of the species
|
||||
* vprob->SpeciesThermo[]
|
||||
*/
|
||||
ts_ptr->UseCanteraCalls = VolPhase->UseCanteraCalls;
|
||||
ts_ptr->UseCanteraCalls = VolPhase->usingCanteraCalls();
|
||||
ts_ptr->m_VCS_UnitsFormat = VolPhase->m_VCS_UnitsFormat;
|
||||
/*
|
||||
* Add lookback connectivity into the thermo object first
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -230,6 +230,11 @@ public:
|
|||
*/
|
||||
int ActivityConvention;
|
||||
|
||||
//! Boolean indicating whether the phase is an ideal solution
|
||||
//! and therefore it's molar-based activity coefficients are
|
||||
//! uniformly equal to one.
|
||||
bool m_isIdealSoln;
|
||||
|
||||
//! Current state of existence:
|
||||
/*!
|
||||
* 0 : Doesn't exist currently
|
||||
|
|
@ -277,10 +282,6 @@ public:
|
|||
* The index into this vector is the species index within the phase.
|
||||
*/
|
||||
std::vector<vcs_SpeciesProperties *> ListSpeciesPtr;
|
||||
|
||||
//! If this is true, then calculations are actually performed within
|
||||
//! Cantera
|
||||
bool UseCanteraCalls;
|
||||
|
||||
//! Units for the chemical potential data, pressure data, volume,
|
||||
//! and species amounts
|
||||
|
|
@ -305,8 +306,10 @@ public:
|
|||
*/
|
||||
int m_VCS_UnitsFormat;
|
||||
|
||||
|
||||
private:
|
||||
//! If this is true, then calculations are actually performed within
|
||||
//! Cantera
|
||||
bool m_useCanteraCalls;
|
||||
/**
|
||||
* If we are using Cantera, this is the
|
||||
* pointer to the ThermoPhase object. If not, this is null.
|
||||
|
|
@ -733,6 +736,12 @@ public:
|
|||
//! Return a const reference to the mole fractions
|
||||
const std::vector<double> & moleFractions() const;
|
||||
|
||||
//! Returns whether the phase is an ideal solution phase
|
||||
bool isIdealSoln() const;
|
||||
|
||||
//! Returns whether the object is using cantera calls.
|
||||
bool usingCanteraCalls() const;
|
||||
|
||||
private:
|
||||
|
||||
//! Updates the mole fractions in subobjects
|
||||
|
|
|
|||
|
|
@ -306,9 +306,9 @@ namespace VCSnonideal {
|
|||
}
|
||||
/*****************************************************************************/
|
||||
|
||||
//! Recalculate all of the activity coefficients in all of the phases
|
||||
//! based on input mole numbers
|
||||
/*!
|
||||
// Recalculate all of the activity coefficients in all of the phases
|
||||
// based on input mole numbers
|
||||
/*
|
||||
*
|
||||
* @param moleSpeciesVCS kmol of species to be used in the update.
|
||||
*
|
||||
|
|
@ -323,7 +323,7 @@ namespace VCSnonideal {
|
|||
/*
|
||||
* We don't need to call single species phases;
|
||||
*/
|
||||
if (!Vphase->SingleSpecies) {
|
||||
if (!Vphase->SingleSpecies && !Vphase->isIdealSoln()) {
|
||||
/*
|
||||
* update the Ln Act Coeff jacobian entries with respect to the
|
||||
* mole number of species in the phase
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue