Cleaning up pressure implementation in MixtureFugacityTP and derived classes.
Cleaning up `RedlichKwongMFTP:pressure()` and removing `m_Pcurrent` as a cached value in `RedlichKwongMFTP` and `MixtureFugacityTP`. The stored value was only ever called in one location `RedlichKwongMFTP:getPartialMolarVolumes()`, and the function call it replaced (`RedlichKwongMFTP:pressure()`) is not all that involved.
This commit is contained in:
parent
ecbd819e91
commit
dd521de254
3 changed files with 0 additions and 33 deletions
|
|
@ -302,18 +302,6 @@ protected:
|
|||
virtual void compositionChanged();
|
||||
void setMoleFractions_NoState(const doublereal* const x);
|
||||
|
||||
public:
|
||||
//! Returns the current pressure of the phase
|
||||
/*!
|
||||
* The pressure is an independent variable in this phase. Its current value
|
||||
* is stored in the object MixtureFugacityTP.
|
||||
*
|
||||
* @returns the pressure in pascals.
|
||||
*/
|
||||
virtual doublereal pressure() const {
|
||||
return m_Pcurrent;
|
||||
}
|
||||
|
||||
protected:
|
||||
//! Updates the reference state thermodynamic functions at the current T of
|
||||
//! the solution.
|
||||
|
|
@ -550,15 +538,6 @@ protected:
|
|||
protected:
|
||||
virtual void invalidateCache();
|
||||
|
||||
//! Current value of the pressure
|
||||
/*!
|
||||
* Because the pressure is now a calculation, we store the result of the
|
||||
* calculation whenever it is recalculated.
|
||||
*
|
||||
* units = Pascals
|
||||
*/
|
||||
doublereal m_Pcurrent;
|
||||
|
||||
//! Storage for the current values of the mole fractions of the species
|
||||
/*!
|
||||
* This vector is kept up-to-date when some the setState functions are called.
|
||||
|
|
|
|||
|
|
@ -18,7 +18,6 @@ namespace Cantera
|
|||
{
|
||||
|
||||
MixtureFugacityTP::MixtureFugacityTP() :
|
||||
m_Pcurrent(-1.0),
|
||||
iState_(FLUID_GAS),
|
||||
forcedState_(FLUID_UNDEFINED),
|
||||
m_Tlast_ref(-1.0)
|
||||
|
|
@ -264,21 +263,18 @@ void MixtureFugacityTP::setState_TP(doublereal t, doublereal pres)
|
|||
_updateReferenceStateThermo();
|
||||
// Depends on the mole fractions and the temperature
|
||||
updateMixingExpressions();
|
||||
m_Pcurrent = pres;
|
||||
|
||||
if (forcedState_ == FLUID_UNDEFINED) {
|
||||
double rhoNow = Phase::density();
|
||||
double rho = densityCalc(t, pres, iState_, rhoNow);
|
||||
if (rho > 0.0) {
|
||||
Phase::setDensity(rho);
|
||||
m_Pcurrent = pres;
|
||||
iState_ = phaseState(true);
|
||||
} else {
|
||||
if (rho < -1.5) {
|
||||
rho = densityCalc(t, pres, FLUID_UNDEFINED , rhoNow);
|
||||
if (rho > 0.0) {
|
||||
Phase::setDensity(rho);
|
||||
m_Pcurrent = pres;
|
||||
iState_ = phaseState(true);
|
||||
} else {
|
||||
throw CanteraError("MixtureFugacityTP::setState_TP()", "neg rho");
|
||||
|
|
@ -294,7 +290,6 @@ void MixtureFugacityTP::setState_TP(doublereal t, doublereal pres)
|
|||
double rho = densityCalc(t, pres, iState_, rhoNow);
|
||||
if (rho > 0.0) {
|
||||
Phase::setDensity(rho);
|
||||
m_Pcurrent = pres;
|
||||
iState_ = phaseState(true);
|
||||
if (iState_ >= FLUID_LIQUID_0) {
|
||||
throw CanteraError("MixtureFugacityTP::setState_TP()", "wrong state");
|
||||
|
|
@ -309,7 +304,6 @@ void MixtureFugacityTP::setState_TP(doublereal t, doublereal pres)
|
|||
double rho = densityCalc(t, pres, iState_, rhoNow);
|
||||
if (rho > 0.0) {
|
||||
Phase::setDensity(rho);
|
||||
m_Pcurrent = pres;
|
||||
iState_ = phaseState(true);
|
||||
if (iState_ == FLUID_GAS) {
|
||||
throw CanteraError("MixtureFugacityTP::setState_TP()", "wrong state");
|
||||
|
|
@ -330,8 +324,6 @@ void MixtureFugacityTP::setState_TR(doublereal T, doublereal rho)
|
|||
doublereal mv = molarVolume();
|
||||
// depends on mole fraction and temperature
|
||||
updateMixingExpressions();
|
||||
|
||||
m_Pcurrent = pressureCalc(T, mv);
|
||||
iState_ = phaseState(true);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -171,10 +171,6 @@ doublereal RedlichKwongMFTP::pressure() const
|
|||
doublereal T = temperature();
|
||||
double molarV = meanMolecularWeight() / density();
|
||||
double pp = GasConstant * T/(molarV - m_b_current) - m_a_current/(sqrt(T) * molarV * (molarV + m_b_current));
|
||||
// if (fabs(pp -m_Pcurrent) > 1.0E-5 * fabs(m_Pcurrent)) {
|
||||
// throw CanteraError(" RedlichKwongMFTP::pressure()", "setState broken down, maybe");
|
||||
// }
|
||||
|
||||
return pp;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue