From 80b54a85ada8582203d920f8a3a4d1c634b54f6f Mon Sep 17 00:00:00 2001 From: Arne Morten Kvarving Date: Wed, 5 Oct 2022 11:26:44 +0200 Subject: [PATCH] changed: use updateProperty_ in updateMaxWaterSaturation_ --- ebos/eclproblem.hh | 28 ++++++++-------------------- 1 file changed, 8 insertions(+), 20 deletions(-) diff --git a/ebos/eclproblem.hh b/ebos/eclproblem.hh index 8a2e953cd..6a4d10694 100644 --- a/ebos/eclproblem.hh +++ b/ebos/eclproblem.hh @@ -2234,26 +2234,14 @@ private: return false; this->maxWaterSaturation_[/*timeIdx=*/1] = this->maxWaterSaturation_[/*timeIdx=*/0]; - ElementContext elemCtx(this->simulator()); - const auto& vanguard = this->simulator().vanguard(); - auto elemIt = vanguard.gridView().template begin(); - const auto& elemEndIt = vanguard.gridView().template end(); - OPM_BEGIN_PARALLEL_TRY_CATCH(); - for (; elemIt != elemEndIt; ++elemIt) { - const Element& elem = *elemIt; - - elemCtx.updatePrimaryStencil(elem); - elemCtx.updatePrimaryIntensiveQuantities(/*timeIdx=*/0); - - unsigned compressedDofIdx = elemCtx.globalSpaceIndex(/*spaceIdx=*/0, /*timeIdx=*/0); - const auto& iq = elemCtx.intensiveQuantities(/*spaceIdx=*/0, /*timeIdx=*/0); - const auto& fs = iq.fluidState(); - - Scalar Sw = decay(fs.saturation(waterPhaseIdx)); - this->maxWaterSaturation_[compressedDofIdx] = std::max(this->maxWaterSaturation_[compressedDofIdx], Sw); - } - OPM_END_PARALLEL_TRY_CATCH("EclProblem::updateMayWaterSaturation() failed: ", vanguard.grid().comm()); - + this->updateProperty_("EclProblem::updateMaxWaterSaturation_() failed:", + [this](unsigned compressedDofIdx, const IntensiveQuantities& iq) + { + const auto& fs = iq.fluidState(); + const Scalar Sw = decay(fs.saturation(waterPhaseIdx)); + auto& mow = this->maxWaterSaturation_; + mow[compressedDofIdx] = std::max(mow[compressedDofIdx], Sw); + }); return true; }