diff --git a/opm/simulators/flow/GenericOutputBlackoilModule.cpp b/opm/simulators/flow/GenericOutputBlackoilModule.cpp index 8acce5c5b..4d4b0111f 100644 --- a/opm/simulators/flow/GenericOutputBlackoilModule.cpp +++ b/opm/simulators/flow/GenericOutputBlackoilModule.cpp @@ -128,10 +128,10 @@ std::string EclString(const Opm::Inplace::Phase phase) return "GMDS"; case Opm::Inplace::Phase::CO2MassInGasPhaseInMob: - return "GMTR"; + return "GCDI_KG"; //Not used case Opm::Inplace::Phase::CO2MassInGasPhaseMob: - return "GMMO"; + return "GKDM_KG"; //Not used case Opm::Inplace::Phase::CO2MassInGasPhaseInMobKrg: return "GKTR"; @@ -139,6 +139,18 @@ std::string EclString(const Opm::Inplace::Phase phase) case Opm::Inplace::Phase::CO2MassInGasPhaseMobKrg: return "GKMO"; + case Opm::Inplace::Phase::CO2MassInGasPhaseMaximumTrapped: + return "GMIM"; + + case Opm::Inplace::Phase::CO2MassInGasPhaseMaximumUnTrapped: + return "GMMO"; + + case Opm::Inplace::Phase::CO2MassInGasPhaseEffectiveTrapped: + return "GMST"; + + case Opm::Inplace::Phase::CO2MassInGasPhaseEffectiveUnTrapped: + return "GMUS"; + default: throw std::logic_error { fmt::format("Phase enum with integer value: " diff --git a/opm/simulators/flow/LogOutputHelper.cpp b/opm/simulators/flow/LogOutputHelper.cpp index a1a91ae29..097dffcd7 100644 --- a/opm/simulators/flow/LogOutputHelper.cpp +++ b/opm/simulators/flow/LogOutputHelper.cpp @@ -975,6 +975,11 @@ fipUnitConvert_(std::unordered_map& fip) const {Inplace::Phase::CO2MassInGasPhaseMob, M::mass}, {Inplace::Phase::CO2MassInGasPhaseInMobKrg, M::mass}, {Inplace::Phase::CO2MassInGasPhaseMobKrg, M::mass}, + {Inplace::Phase::CO2MassInGasPhaseEffectiveTrapped, M::mass}, + {Inplace::Phase::CO2MassInGasPhaseEffectiveUnTrapped, M::mass}, + {Inplace::Phase::CO2MassInGasPhaseMaximumTrapped, M::mass}, + {Inplace::Phase::CO2MassInGasPhaseMaximumUnTrapped, M::mass}, + }; for (auto& [phase, value] : fip) { diff --git a/opm/simulators/flow/OutputBlackoilModule.hpp b/opm/simulators/flow/OutputBlackoilModule.hpp index 11c6b284b..08bcf919d 100644 --- a/opm/simulators/flow/OutputBlackoilModule.hpp +++ b/opm/simulators/flow/OutputBlackoilModule.hpp @@ -1442,12 +1442,17 @@ private: !this->fip_[Inplace::Phase::CO2MassInGasPhaseInMob].empty() || !this->fip_[Inplace::Phase::CO2MassInGasPhaseMob].empty() || !this->fip_[Inplace::Phase::CO2Mass].empty() || + !this->fip_[Inplace::Phase::CO2MassInGasPhase].empty() || !this->fip_[Inplace::Phase::CO2InGasPhaseInMobKrg].empty() || !this->fip_[Inplace::Phase::CO2InGasPhaseMobKrg].empty() || !this->fip_[Inplace::Phase::CO2MassInGasPhaseInMobKrg].empty() || - !this->fip_[Inplace::Phase::CO2MassInGasPhaseMobKrg].empty())) + !this->fip_[Inplace::Phase::CO2MassInGasPhaseMobKrg].empty() || + !this->fip_[Inplace::Phase::CO2MassInGasPhaseEffectiveTrapped].empty() || + !this->fip_[Inplace::Phase::CO2MassInGasPhaseEffectiveUnTrapped].empty() || + !this->fip_[Inplace::Phase::CO2MassInGasPhaseMaximumTrapped].empty() || + !this->fip_[Inplace::Phase::CO2MassInGasPhaseMaximumUnTrapped].empty())) { - this->updateCO2InGas(globalDofIdx, pv, fs); + this->updateCO2InGas(globalDofIdx, pv, intQuants); } if ((!this->fip_[Inplace::Phase::CO2InWaterPhase].empty() || @@ -1587,18 +1592,19 @@ private: } } - template + template void updateCO2InGas(const unsigned globalDofIdx, const double pv, - const FluidState& fs) + const IntensiveQuantities& intQuants) { const auto& scaledDrainageInfo = this->simulator_.problem().materialLawManager() ->oilWaterScaledEpsInfoDrainage(globalDofIdx); + const auto& fs = intQuants.fluidState(); Scalar sgcr = scaledDrainageInfo.Sgcr; if (this->simulator_.problem().materialLawManager()->enableHysteresis()) { const auto& matParams = simulator_.problem().materialLawParams(globalDofIdx); - sgcr = MaterialLaw::trappedGasSaturation(matParams); + sgcr = MaterialLaw::trappedGasSaturation(matParams, /*maximumTrapping*/false); } const double sg = getValue(fs.saturation(gasPhaseIdx)); @@ -1613,6 +1619,10 @@ private: this->fip_[Inplace::Phase::CO2Mass][globalDofIdx] = massGas * sg; } + if (!this->fip_[Inplace::Phase::CO2MassInGasPhase].empty()) { + this->fip_[Inplace::Phase::CO2MassInGasPhase][globalDofIdx] = massGas * sg; + } + if (!this->fip_[Inplace::Phase::CO2InGasPhaseInMob].empty()) { const Scalar imMobileGas = massGas / mM * std::min(sgcr , sg); this->fip_[Inplace::Phase::CO2InGasPhaseInMob][globalDofIdx] = imMobileGas; @@ -1668,6 +1678,42 @@ private: this->fip_[Inplace::Phase::CO2MassInGasPhaseMobKrg][globalDofIdx] = 0; } } + + if (!this->fip_[Inplace::Phase::CO2MassInGasPhaseMaximumTrapped].empty() || + !this->fip_[Inplace::Phase::CO2MassInGasPhaseMaximumUnTrapped].empty() ) { + Scalar trappedGasSaturation = scaledDrainageInfo.Sgcr; + if (this->simulator_.problem().materialLawManager()->enableHysteresis()) { + const auto& matParams = simulator_.problem().materialLawParams(globalDofIdx); + // Get the maximum trapped gas saturation + trappedGasSaturation = MaterialLaw::trappedGasSaturation(matParams, /*maximumTrapping*/true); + } + if (!this->fip_[Inplace::Phase::CO2MassInGasPhaseMaximumTrapped].empty()) { + const Scalar imMobileMassGas = massGas * std::min(trappedGasSaturation , sg); + this->fip_[Inplace::Phase::CO2MassInGasPhaseMaximumTrapped][globalDofIdx] = imMobileMassGas; + } + if (!this->fip_[Inplace::Phase::CO2MassInGasPhaseMaximumUnTrapped].empty()) { + const Scalar mobileMassGas = massGas * std::max(0.0, sg - trappedGasSaturation); + this->fip_[Inplace::Phase::CO2MassInGasPhaseMaximumUnTrapped][globalDofIdx] = mobileMassGas; + } + } + + if (!this->fip_[Inplace::Phase::CO2MassInGasPhaseEffectiveTrapped].empty() || + !this->fip_[Inplace::Phase::CO2MassInGasPhaseEffectiveUnTrapped].empty()) { + Scalar trappedGasSaturation = scaledDrainageInfo.Sgcr; + if (this->simulator_.problem().materialLawManager()->enableHysteresis()) { + const auto& matParams = simulator_.problem().materialLawParams(globalDofIdx); + const double krg = getValue(intQuants.relativePermeability(gasPhaseIdx)); + trappedGasSaturation = MaterialLaw::strandedGasSaturation(matParams, sg, krg); + } + if (!this->fip_[Inplace::Phase::CO2MassInGasPhaseEffectiveTrapped].empty()) { + const Scalar imMobileMassGas = massGas * std::min(trappedGasSaturation , sg); + this->fip_[Inplace::Phase::CO2MassInGasPhaseEffectiveTrapped][globalDofIdx] = imMobileMassGas; + } + if (!this->fip_[Inplace::Phase::CO2MassInGasPhaseEffectiveUnTrapped].empty()) { + const Scalar mobileMassGas = massGas * std::max(0.0, sg - trappedGasSaturation); + this->fip_[Inplace::Phase::CO2MassInGasPhaseEffectiveUnTrapped][globalDofIdx] = mobileMassGas; + } + } } template