From 04d436444f8b2110e447ccb420fd2a4e3cd98033 Mon Sep 17 00:00:00 2001 From: Tor Harald Sandve Date: Tue, 12 Nov 2024 15:12:29 +0100 Subject: [PATCH] Also update REIN if REIN changes significantly --- .../wells/BlackoilWellModelGeneric.cpp | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/opm/simulators/wells/BlackoilWellModelGeneric.cpp b/opm/simulators/wells/BlackoilWellModelGeneric.cpp index 76ffefa7c7..59633662ab 100644 --- a/opm/simulators/wells/BlackoilWellModelGeneric.cpp +++ b/opm/simulators/wells/BlackoilWellModelGeneric.cpp @@ -1197,12 +1197,14 @@ updateAndCommunicateGroupData(const int reportStepIdx, const Phase all[] = { Phase::WATER, Phase::OIL, Phase::GAS }; for (Phase phase : all) { if (this->groupState().has_injection_control(gr_name, phase)) { - if (this->groupState().injection_control(gr_name, phase) == Group::InjectionCMode::VREP) { + if (this->groupState().injection_control(gr_name, phase) == Group::InjectionCMode::VREP || + this->groupState().injection_control(gr_name, phase) == Group::InjectionCMode::REIN) { + const bool is_vrep = this->groupState().injection_control(gr_name, phase) == Group::InjectionCMode::VREP; const Group& group = schedule().getGroup(gr_name, reportStepIdx); const int np = this->wellState().numPhases(); - Scalar resv_nupcol = 0.0; + Scalar gr_rate_nupcol = 0.0; for (int phaseIdx = 0; phaseIdx < np; ++phaseIdx) { - resv_nupcol += WellGroupHelpers::sumWellPhaseRates(true, + gr_rate_nupcol += WellGroupHelpers::sumWellPhaseRates(is_vrep, group, schedule(), this->nupcolWellState(), @@ -1210,9 +1212,9 @@ updateAndCommunicateGroupData(const int reportStepIdx, phaseIdx, /*isInjector*/ false); } - Scalar resv_wellstate = 0.0; + Scalar gr_rate = 0.0; for (int phaseIdx = 0; phaseIdx < np; ++phaseIdx) { - resv_wellstate += WellGroupHelpers::sumWellPhaseRates(true, + gr_rate += WellGroupHelpers::sumWellPhaseRates(is_vrep, group, schedule(), this->wellState(), @@ -1220,11 +1222,12 @@ updateAndCommunicateGroupData(const int reportStepIdx, phaseIdx, /*isInjector*/ false); } - if ( std::abs( (resv_nupcol - resv_wellstate) / (0.5*resv_nupcol + 0.5*resv_wellstate)) > tol_nupcol) { + if ( std::abs( (gr_rate_nupcol - gr_rate) / (0.5*gr_rate_nupcol + 0.5*gr_rate)) > tol_nupcol) { this->updateNupcolWGState(); + const std::string control_str = is_vrep? "VREP" : "REIN"; const std::string msg = fmt::format("Group prodution relative change larger than tolerance {} " - "at iteration {}. Update VREP for Group {} even if iteration is larger than {} given by NUPCOL." , - tol_nupcol, iterationIdx, gr_name, nupcol); + "at iteration {}. Update {} for Group {} even if iteration is larger than {} given by NUPCOL." , + tol_nupcol, iterationIdx, control_str, gr_name, nupcol); deferred_logger.info(msg); } }