From 58c1a16299ee8443858e9f34adeb5d6acee5dc4c Mon Sep 17 00:00:00 2001 From: Arne Morten Kvarving Date: Fri, 31 Jan 2025 09:19:32 +0100 Subject: [PATCH] move assignment of OilGasDistribution fip values into FIPContainer --- opm/simulators/flow/FIPContainer.cpp | 25 ++++++++++++++++++++ opm/simulators/flow/FIPContainer.hpp | 4 ++++ opm/simulators/flow/OutputBlackoilModule.hpp | 17 +------------ 3 files changed, 30 insertions(+), 16 deletions(-) diff --git a/opm/simulators/flow/FIPContainer.cpp b/opm/simulators/flow/FIPContainer.cpp index ee39229da..6aad416e2 100644 --- a/opm/simulators/flow/FIPContainer.cpp +++ b/opm/simulators/flow/FIPContainer.cpp @@ -254,6 +254,31 @@ assignVolumesReservoir(const unsigned globalDofIdx, } } +template +void +FIPContainer:: +assignOilGasDistribution(const unsigned globalDofIdx, + const Scalar gasInPlaceLiquid, + const Scalar oilInPlaceGas) +{ + if (!this->fip_[Inplace::Phase::GasInLiquidPhase].empty()) { + this->fip_[Inplace::Phase::GasInLiquidPhase][globalDofIdx] = gasInPlaceLiquid; + } + + if (!this->fip_[Inplace::Phase::OilInGasPhase].empty()) { + this->fip_[Inplace::Phase::OilInGasPhase][globalDofIdx] = oilInPlaceGas; + } + + // Add dissolved gas and vaporized oil to total Fip + if (!this->fip_[Inplace::Phase::OIL].empty()) { + this->fip_[Inplace::Phase::OIL][globalDofIdx] += oilInPlaceGas; + } + + if (!this->fip_[Inplace::Phase::GAS].empty()) { + this->fip_[Inplace::Phase::GAS][globalDofIdx] += gasInPlaceLiquid; + } +} + template using FS = BlackOilFluidSystem; #define INSTANTIATE_TYPE(T) \ diff --git a/opm/simulators/flow/FIPContainer.hpp b/opm/simulators/flow/FIPContainer.hpp index de690fbc7..3ac073c24 100644 --- a/opm/simulators/flow/FIPContainer.hpp +++ b/opm/simulators/flow/FIPContainer.hpp @@ -78,6 +78,10 @@ public: const Scalar gasInPlaceWater, const Scalar waterInPlaceGas); + void assignOilGasDistribution(const unsigned globalDofIdx, + const Scalar gasInPlaceLiquid, + const Scalar oilInPlaceGas); + void assignVolumesSurface(const unsigned globalDofIdx, const std::array& fip); diff --git a/opm/simulators/flow/OutputBlackoilModule.hpp b/opm/simulators/flow/OutputBlackoilModule.hpp index d08d28e69..0f9eccb7f 100644 --- a/opm/simulators/flow/OutputBlackoilModule.hpp +++ b/opm/simulators/flow/OutputBlackoilModule.hpp @@ -1538,22 +1538,7 @@ private: const auto gasInPlaceLiquid = getValue(fs.Rs()) * fip[oilPhaseIdx]; const auto oilInPlaceGas = getValue(fs.Rv()) * fip[gasPhaseIdx]; - if (!this->fip_[Inplace::Phase::GasInLiquidPhase].empty()) { - this->fip_[Inplace::Phase::GasInLiquidPhase][globalDofIdx] = gasInPlaceLiquid; - } - - if (!this->fip_[Inplace::Phase::OilInGasPhase].empty()) { - this->fip_[Inplace::Phase::OilInGasPhase][globalDofIdx] = oilInPlaceGas; - } - - // Add dissolved gas and vaporized oil to total Fip - if (!this->fip_[Inplace::Phase::OIL].empty()) { - this->fip_[Inplace::Phase::OIL][globalDofIdx] += oilInPlaceGas; - } - - if (!this->fip_[Inplace::Phase::GAS].empty()) { - this->fip_[Inplace::Phase::GAS][globalDofIdx] += gasInPlaceLiquid; - } + this->fipC_.assignOilGasDistribution(globalDofIdx, gasInPlaceLiquid, oilInPlaceGas); } template