diff --git a/opm/simulators/flow/FIPContainer.cpp b/opm/simulators/flow/FIPContainer.cpp index 58c84950f..b86c5b1ee 100644 --- a/opm/simulators/flow/FIPContainer.cpp +++ b/opm/simulators/flow/FIPContainer.cpp @@ -82,6 +82,15 @@ FIPContainer::add(const Inplace::Phase phase) this->fip_[phase].resize(bufferSize_, 0.0); } +template +bool +FIPContainer:: +has(const Inplace::Phase phase) const +{ + const auto it = this->fip_.find(phase); + return it != this->fip_.end() && !it->second.empty(); +} + template void FIPContainer:: diff --git a/opm/simulators/flow/FIPContainer.hpp b/opm/simulators/flow/FIPContainer.hpp index b30a55ddc..2a8a927cb 100644 --- a/opm/simulators/flow/FIPContainer.hpp +++ b/opm/simulators/flow/FIPContainer.hpp @@ -77,6 +77,8 @@ public: Scalar strandedGas; }; + bool has(const Inplace::Phase phase) const; + void assignCo2InGas(const unsigned globalDofIdx, const Co2InGasInput& v); diff --git a/opm/simulators/flow/OutputBlackoilModule.hpp b/opm/simulators/flow/OutputBlackoilModule.hpp index 878b37971..6f72675c9 100644 --- a/opm/simulators/flow/OutputBlackoilModule.hpp +++ b/opm/simulators/flow/OutputBlackoilModule.hpp @@ -1569,8 +1569,9 @@ private: } Scalar trappedGasSaturation = scaledDrainageInfo.Sgcr; - if (!this->fip_[Inplace::Phase::CO2MassInGasPhaseMaximumTrapped].empty() || - !this->fip_[Inplace::Phase::CO2MassInGasPhaseMaximumUnTrapped].empty() ) { + if (this->fipC_.has(Inplace::Phase::CO2MassInGasPhaseMaximumTrapped) || + this->fipC_.has(Inplace::Phase::CO2MassInGasPhaseMaximumUnTrapped)) + { if (this->simulator_.problem().materialLawManager()->enableHysteresis()) { const auto& matParams = simulator_.problem().materialLawParams(globalDofIdx); // Get the maximum trapped gas saturation @@ -1580,8 +1581,8 @@ private: const Scalar sg = getValue(fs.saturation(gasPhaseIdx)); Scalar strandedGasSaturation = scaledDrainageInfo.Sgcr; - if (!this->fip_[Inplace::Phase::CO2MassInGasPhaseEffectiveTrapped].empty() || - !this->fip_[Inplace::Phase::CO2MassInGasPhaseEffectiveUnTrapped].empty()) + if (this->fipC_.has(Inplace::Phase::CO2MassInGasPhaseEffectiveTrapped) || + this->fipC_.has(Inplace::Phase::CO2MassInGasPhaseEffectiveUnTrapped)) { if (this->simulator_.problem().materialLawManager()->enableHysteresis()) { const auto& matParams = simulator_.problem().materialLawParams(globalDofIdx);