incoporating K, L, twophaseflag to FluidStateCompositionModules

It was done by Norce in the co2-compositional branch.
It removes some compilation errors.
This commit is contained in:
Kai Bao 2021-11-08 15:27:35 +01:00 committed by Trine Mykkeltvedt
parent 7fa4f4796f
commit 871bc77ca1

View File

@ -158,6 +158,59 @@ public:
Valgrind::CheckDefined(moleFraction_);
Valgrind::CheckDefined(averageMolarMass_);
Valgrind::CheckDefined(sumMoleFractions_);
Valgrind::CheckDefined(K_);
Valgrind::CheckDefined(L_);
}
const Scalar& K(unsigned compIdx) const
{ return K_[compIdx]; }
/*!
* \brief Set the K value of a component [-]
*/
void setKvalue(unsigned compIdx, const Scalar& value)
{
K_[compIdx] = value;
}
/*!
* \brief The L value of a composition [-]
*/
const Scalar& L(unsigned /*phaseIdx*/) const
{ return L_; }
/*!
* \brief Set the L value [-]
*/
void setLvalue(const Scalar& value)
{ L_ = value; }
/*!
* \brief The twophaseflag
*/
const bool& twophaseflag(unsigned /*phaseIdx*/) const
{ return twophaseflag_; }
/*!
* \brief Set the twophaseflag
*/
void setTwophaseflag(const bool& value)
{ twophaseflag_ = value; }
/*!
* \brief Wilson formula to calculate K
*
*/
Scalar wilsonK_(unsigned compIdx) const
{
const auto& acf = FluidSystem::acentricFactor(compIdx);
const auto& T_crit = FluidSystem::criticalTemperature(compIdx);
const auto& T = asImp_().temperature(0);
const auto& p_crit = FluidSystem::criticalPressure(compIdx);
const auto& p = asImp_().pressure(0); //for now assume no capillary pressure
const auto& tmp = exp(5.3727 * (1+acf) * (1-T_crit/T)) * (p_crit/p);
return tmp;
}
protected:
@ -167,6 +220,9 @@ protected:
std::array<std::array<Scalar,numComponents>,numPhases> moleFraction_;
std::array<Scalar,numPhases> averageMolarMass_;
std::array<Scalar,numPhases> sumMoleFractions_;
std::array<Scalar,numComponents> K_;
Scalar L_;
bool twophaseflag_;
};
/*!