From b499180776bbfa60580c4686c9f85a1c41a3b0d5 Mon Sep 17 00:00:00 2001 From: Tor Harald Sandve Date: Wed, 29 Jan 2020 08:41:41 +0100 Subject: [PATCH] only double check the current group constraint at the start of a report step --- opm/simulators/wells/BlackoilWellModel.hpp | 1 + opm/simulators/wells/BlackoilWellModel_impl.hpp | 8 ++++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/opm/simulators/wells/BlackoilWellModel.hpp b/opm/simulators/wells/BlackoilWellModel.hpp index 7723ebd38..0396cc489 100644 --- a/opm/simulators/wells/BlackoilWellModel.hpp +++ b/opm/simulators/wells/BlackoilWellModel.hpp @@ -270,6 +270,7 @@ namespace Opm { double gravity_; std::vector depth_; bool initial_step_; + bool report_step_starts_; std::unique_ptr rateConverter_; std::unique_ptr> vfp_properties_; diff --git a/opm/simulators/wells/BlackoilWellModel_impl.hpp b/opm/simulators/wells/BlackoilWellModel_impl.hpp index 17a575a0a..fe3e6545a 100644 --- a/opm/simulators/wells/BlackoilWellModel_impl.hpp +++ b/opm/simulators/wells/BlackoilWellModel_impl.hpp @@ -206,6 +206,7 @@ namespace Opm { beginReportStep(const int timeStepIdx) { Opm::DeferredLogger local_deferredLogger; + report_step_starts_ = true; const Grid& grid = ebosSimulator_.vanguard().grid(); const auto& summaryState = ebosSimulator_.vanguard().summaryState(); @@ -439,6 +440,9 @@ namespace Opm { BlackoilWellModel:: timeStepSucceeded(const double& simulationTime, const double dt) { + // time step is finished and we are not any more at the beginning of an report step + report_step_starts_ = false; + Opm::DeferredLogger local_deferredLogger; for (const auto& well : well_container_) { if (GET_PROP_VALUE(TypeTag, EnablePolymerMW) && well->isInjector()) { @@ -834,10 +838,10 @@ namespace Opm { calculateExplicitQuantities(local_deferredLogger); prepareTimeStep(local_deferredLogger); } - // also check the current group control the first two iterations. The first itertion is needed for changes in group/well controls and closing of wells etc. + // check the current group control in the beginning of an episode for the first two iterations. The first itertion is needed for changes in group/well controls and closing of wells etc. // a second check is needed for REIN and VREP controls since they depend on results from other wells. // This check can probably be made more sofisticated, but this simple rule seems to work - bool checkCurrentGroupControls = (iterationIdx < 2); + bool checkCurrentGroupControls = (report_step_starts_ && iterationIdx < 2); updateWellControls(local_deferredLogger, /*allow for switching to group controls*/true, checkCurrentGroupControls); // Set the well primary variables based on the value of well solutions