Add co2 mass in place summary vectors

This commit is contained in:
Tor Harald Sandve 2024-01-22 16:17:46 +01:00
parent 2626fbb84b
commit de05c84b1d
3 changed files with 54 additions and 6 deletions

View File

@ -115,6 +115,21 @@ std::string EclString(const Opm::Inplace::Phase phase)
case Opm::Inplace::Phase::WaterInWaterPhase:
return "WIPL";
case Opm::Inplace::Phase::CO2Mass:
return "GMIP";
case Opm::Inplace::Phase::CO2MassInWaterPhase:
return "GMGP";
case Opm::Inplace::Phase::CO2MassInGasPhase:
return "GMDS";
case Opm::Inplace::Phase::CO2MassInGasPhaseInMob:
return "GMTR";
case Opm::Inplace::Phase::CO2MassInGasPhaseMob:
return "GMMO";
default:
throw std::logic_error {
fmt::format("Phase enum with integer value: "

View File

@ -1315,12 +1315,17 @@ private:
if (FluidSystem::phaseIsActive(gasPhaseIdx) &&
(!this->fip_[Inplace::Phase::CO2InGasPhaseInMob].empty() ||
!this->fip_[Inplace::Phase::CO2InGasPhaseMob].empty()))
!this->fip_[Inplace::Phase::CO2InGasPhaseMob].empty() ||
!this->fip_[Inplace::Phase::CO2MassInGasPhaseInMob].empty() ||
!this->fip_[Inplace::Phase::CO2MassInGasPhaseMob].empty() ||
!this->fip_[Inplace::Phase::CO2Mass].empty()))
{
this->updateCO2InGas(globalDofIdx, pv, fs);
}
if (!this->fip_[Inplace::Phase::CO2InWaterPhase].empty() &&
if ((!this->fip_[Inplace::Phase::CO2InWaterPhase].empty() ||
!this->fip_[Inplace::Phase::CO2MassInWaterPhase].empty() ||
!this->fip_[Inplace::Phase::CO2Mass].empty()) &&
(FluidSystem::phaseIsActive(waterPhaseIdx) ||
FluidSystem::phaseIsActive(oilPhaseIdx)))
{
@ -1328,7 +1333,16 @@ private:
? this->co2InWaterFromOil(fs, pv)
: this->co2InWaterFromWater(fs, pv);
this->fip_[Inplace::Phase::CO2InWaterPhase][globalDofIdx] = co2InWater;
const Scalar mM = FluidSystem::molarMass(gasCompIdx, fs.pvtRegionIndex());
if (!this->fip_[Inplace::Phase::CO2Mass].empty()) {
this->fip_[Inplace::Phase::CO2Mass][globalDofIdx] += co2InWater * mM;
}
if (!this->fip_[Inplace::Phase::CO2MassInWaterPhase].empty()) {
this->fip_[Inplace::Phase::CO2MassInWaterPhase][globalDofIdx] = co2InWater * mM;
}
if (!this->fip_[Inplace::Phase::CO2InWaterPhase].empty()) {
this->fip_[Inplace::Phase::CO2InWaterPhase][globalDofIdx] = co2InWater;
}
}
}
@ -1480,16 +1494,30 @@ private:
: FluidSystem::convertRvToXgO(getValue(fs.Rv()), fs.pvtRegionIndex());
const Scalar mM = FluidSystem::molarMass(gasCompIdx, fs.pvtRegionIndex());
const Scalar massGas = (1 - xgW) * pv * rhog;
if (!this->fip_[Inplace::Phase::CO2Mass].empty()) {
this->fip_[Inplace::Phase::CO2Mass][globalDofIdx] = massGas;
}
if (!this->fip_[Inplace::Phase::CO2InGasPhaseInMob].empty()) {
const Scalar imMobileGas = (1 - xgW) * pv * rhog / mM * std::min(sgcr , sg);
const Scalar imMobileGas = massGas / mM * std::min(sgcr , sg);
this->fip_[Inplace::Phase::CO2InGasPhaseInMob][globalDofIdx] = imMobileGas;
}
if (!this->fip_[Inplace::Phase::CO2InGasPhaseMob].empty()) {
const Scalar mobileGas = (1 - xgW) * pv * rhog / mM * std::max(0.0, sg - sgcr);
const Scalar mobileGas = massGas / mM * std::max(0.0, sg - sgcr);
this->fip_[Inplace::Phase::CO2InGasPhaseMob][globalDofIdx] = mobileGas;
}
if (!this->fip_[Inplace::Phase::CO2MassInGasPhaseInMob].empty()) {
const Scalar imMobileMassGas = massGas * std::min(sgcr , sg);
this->fip_[Inplace::Phase::CO2MassInGasPhaseInMob][globalDofIdx] = imMobileMassGas;
}
if (!this->fip_[Inplace::Phase::CO2MassInGasPhaseMob].empty()) {
const Scalar mobileMassGas = massGas * std::max(0.0, sg - sgcr);
this->fip_[Inplace::Phase::CO2MassInGasPhaseMob][globalDofIdx] = mobileMassGas;
}
}
template <typename FluidState>

View File

@ -966,6 +966,11 @@ fipUnitConvert_(std::unordered_map<Inplace::Phase, Scalar>& fip) const
{Inplace::Phase::CO2InGasPhaseMob, M::moles},
{Inplace::Phase::WaterInWaterPhase, M::liquid_surface_volume},
{Inplace::Phase::WaterInGasPhase, M::liquid_surface_volume},
{Inplace::Phase::CO2Mass, M::mass},
{Inplace::Phase::CO2MassInWaterPhase, M::mass},
{Inplace::Phase::CO2MassInGasPhase, M::mass},
{Inplace::Phase::CO2MassInGasPhaseInMob,M::mass},
{Inplace::Phase::CO2MassInGasPhaseMob, M::mass},
};
for (auto& [phase, value] : fip) {