cleanup based on review

This commit is contained in:
Tor Harald Sandve 2023-03-22 11:26:06 +01:00
parent f8a61f537b
commit 92b0477a14
2 changed files with 18 additions and 11 deletions

View File

@ -169,7 +169,7 @@ int main(int argc, char **argv)
} }
} else if (prop == "internalEnergy") { } else if (prop == "internalEnergy") {
if (phase == "CO2") { if (phase == "CO2") {
value = co2Pvt.internalEnergy(/*regionIdx=*/0 ,T,p, rv, rv); value = co2Pvt.internalEnergy(/*regionIdx=*/0 ,T,p, rv, 0.0);
} else if (phase == "brine") { } else if (phase == "brine") {
value = brineCo2Pvt.internalEnergy(/*regionIdx=*/0 ,T,p, rs); value = brineCo2Pvt.internalEnergy(/*regionIdx=*/0 ,T,p, rs);
} else { } else {
@ -177,7 +177,7 @@ int main(int argc, char **argv)
} }
} else if (prop == "enthalpy") { } else if (prop == "enthalpy") {
if (phase == "CO2") { if (phase == "CO2") {
value = p / densityGas(co2Pvt, p, T, rv) + co2Pvt.internalEnergy(/*regionIdx=*/0 ,T,p, rv, rv); value = p / densityGas(co2Pvt, p, T, rv) + co2Pvt.internalEnergy(/*regionIdx=*/0 ,T,p, rv, 0.0);
} else if (phase == "brine") { } else if (phase == "brine") {
value = p / densityBrine(brineCo2Pvt, p, T, rs) + brineCo2Pvt.internalEnergy(/*regionIdx=*/0 ,T,p, rs); value = p / densityBrine(brineCo2Pvt, p, T, rs) + brineCo2Pvt.internalEnergy(/*regionIdx=*/0 ,T,p, rs);
} else { } else {

View File

@ -137,6 +137,10 @@ public:
{ {
// assume ideal mixture // assume ideal mixture
Evaluation result = 0; Evaluation result = 0;
// The CO2STORE option both works for GAS/WATER and GAS/OIL systems
// Either rv og rvw should be zero
assert(rv == 0.0 || rvw == 0.0);
const Evaluation xBrine = convertRvwToXgW_(max(rvw,rv),regionIdx); const Evaluation xBrine = convertRvwToXgW_(max(rvw,rv),regionIdx);
result += xBrine * H2O::gasInternalEnergy(temperature, pressure); result += xBrine * H2O::gasInternalEnergy(temperature, pressure);
result += (1 - xBrine) * CO2::gasInternalEnergy(temperature, pressure, extrapolate); result += (1 - xBrine) * CO2::gasInternalEnergy(temperature, pressure, extrapolate);
@ -181,6 +185,9 @@ public:
return CO2::gasDensity(temperature, pressure, extrapolate)/gasReferenceDensity_[regionIdx]; return CO2::gasDensity(temperature, pressure, extrapolate)/gasReferenceDensity_[regionIdx];
// assume ideal mixture // assume ideal mixture
// The CO2STORE option both works for GAS/WATER and GAS/OIL systems
// Either rv og rvw should be zero
assert(rv == 0.0 || rvw == 0.0);
const Evaluation xBrine = convertRvwToXgW_(max(rvw,rv),regionIdx); const Evaluation xBrine = convertRvwToXgW_(max(rvw,rv),regionIdx);
const auto& rhoCo2 = CO2::gasDensity(temperature, pressure, extrapolate); const auto& rhoCo2 = CO2::gasDensity(temperature, pressure, extrapolate);
const auto& rhoH2O = H2O::gasDensity(temperature, pressure); const auto& rhoH2O = H2O::gasDensity(temperature, pressure);
@ -196,19 +203,19 @@ public:
const Evaluation& pressure) const const Evaluation& pressure) const
{ {
const Evaluation rvw = rvwSat_(regionIdx, temperature, pressure); const Evaluation rvw = rvwSat_(regionIdx, temperature, pressure);
return inverseFormationVolumeFactor(regionIdx,temperature,pressure, rvw, rvw); return inverseFormationVolumeFactor(regionIdx,temperature,pressure, Evaluation(0.0), rvw);
} }
/*! /*!
* \brief Returns the saturation pressure of the gas phase [Pa] * \brief Returns the saturation pressure of the gas phase [Pa]
* depending on its mass fraction of the brine component * depending on its mass fraction of the brine component
* *
* \param Rv The surface volume of brine component vaporized in what will yield one cubic meter of water at the surface [-] * \param Rvw The surface volume of brine component vaporized in what will yield one cubic meter of water at the surface [-]
*/ */
template <class Evaluation> template <class Evaluation>
Evaluation saturationPressure(unsigned /*regionIdx*/, Evaluation saturationPressure(unsigned /*regionIdx*/,
const Evaluation& /*temperature*/, const Evaluation& /*temperature*/,
const Evaluation& /*Rv*/) const const Evaluation& /*Rvw*/) const
{ return 0.0; /* not implemented */ } { return 0.0; /* not implemented */ }
/*! /*!
@ -258,16 +265,16 @@ public:
return BinaryCoeffBrineCO2::gasDiffCoeff(temperature, pressure, extrapolate); return BinaryCoeffBrineCO2::gasDiffCoeff(temperature, pressure, extrapolate);
} }
const Scalar gasReferenceDensity(unsigned regionIdx) const Scalar gasReferenceDensity(unsigned regionIdx) const
{ return gasReferenceDensity_[regionIdx]; } { return gasReferenceDensity_[regionIdx]; }
const Scalar oilReferenceDensity(unsigned regionIdx) const Scalar oilReferenceDensity(unsigned regionIdx) const
{ return brineReferenceDensity_[regionIdx]; } { return brineReferenceDensity_[regionIdx]; }
const Scalar waterReferenceDensity(unsigned regionIdx) const Scalar waterReferenceDensity(unsigned regionIdx) const
{ return brineReferenceDensity_[regionIdx]; } { return brineReferenceDensity_[regionIdx]; }
const Scalar salinity(unsigned regionIdx) const Scalar salinity(unsigned regionIdx) const
{ return salinity_[regionIdx]; } { return salinity_[regionIdx]; }
private: private:
@ -321,8 +328,8 @@ private:
Scalar rho_wRef = brineReferenceDensity_[regionIdx]; Scalar rho_wRef = brineReferenceDensity_[regionIdx];
Scalar rho_gRef = gasReferenceDensity_[regionIdx]; Scalar rho_gRef = gasReferenceDensity_[regionIdx];
const LhsEval& rho_wG = Rvw*rho_gRef; const LhsEval& rho_wG = Rvw*rho_wRef;
return rho_wG/(rho_wRef + rho_wG); return rho_wG/(rho_gRef + rho_wG);
} }
/*! /*!
* \brief Convert a water mole fraction in the gas phase the corresponding mass fraction. * \brief Convert a water mole fraction in the gas phase the corresponding mass fraction.