From 6d8b5b204b8228b642ac3d147c4884cb660ded63 Mon Sep 17 00:00:00 2001 From: Arne Morten Kvarving Date: Thu, 12 Sep 2024 10:55:56 +0200 Subject: [PATCH] fixed: make sure we have valid indices in readInitialCondition_ quells warnings building flowexp_comp --- opm/simulators/flow/FlowProblem.hpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/opm/simulators/flow/FlowProblem.hpp b/opm/simulators/flow/FlowProblem.hpp index f49e3be94..0e423a00c 100644 --- a/opm/simulators/flow/FlowProblem.hpp +++ b/opm/simulators/flow/FlowProblem.hpp @@ -1400,11 +1400,11 @@ protected: std::size_t numElems = this->model().numGridDof(); for (std::size_t elemIdx = 0; elemIdx < numElems; ++elemIdx) { const auto& fs = asImp_().initialFluidStates()[elemIdx]; - if (!this->maxWaterSaturation_.empty()) + if (!this->maxWaterSaturation_.empty() && waterPhaseIdx > -1) this->maxWaterSaturation_[elemIdx] = std::max(this->maxWaterSaturation_[elemIdx], fs.saturation(waterPhaseIdx)); - if (!this->maxOilSaturation_.empty()) + if (!this->maxOilSaturation_.empty() && oilPhaseIdx > -1) this->maxOilSaturation_[elemIdx] = std::max(this->maxOilSaturation_[elemIdx], fs.saturation(oilPhaseIdx)); - if (!this->minRefPressure_.empty()) + if (!this->minRefPressure_.empty() && refPressurePhaseIdx_() > -1) this->minRefPressure_[elemIdx] = std::min(this->minRefPressure_[elemIdx], fs.pressure(refPressurePhaseIdx_())); } }