From 9e648960540c1bd02c0a161cda8d667864cc457d Mon Sep 17 00:00:00 2001 From: Tor Harald Sandve Date: Thu, 21 Nov 2019 09:58:32 +0100 Subject: [PATCH 1/2] fix issue when GRUP is used in WCONPROD and WCONINJE and NONE group control Use a bhp control when a well is controlled by a unvalied group control --- .../wells/MultisegmentWell_impl.hpp | 18 +++++++++++++---- opm/simulators/wells/StandardWell_impl.hpp | 20 ++++++++++++++----- 2 files changed, 29 insertions(+), 9 deletions(-) diff --git a/opm/simulators/wells/MultisegmentWell_impl.hpp b/opm/simulators/wells/MultisegmentWell_impl.hpp index 27360f9fe..7939a747b 100644 --- a/opm/simulators/wells/MultisegmentWell_impl.hpp +++ b/opm/simulators/wells/MultisegmentWell_impl.hpp @@ -1998,8 +1998,12 @@ namespace Opm return; } - if (!group.isInjectionGroup()) + if (!group.isInjectionGroup() || currentGroupControl == Group::InjectionCMode::NONE) { + // use bhp as control eq and let the updateControl code find a vallied control + const auto& controls = well.injectionControls(summaryState); + control_eq = getSegmentPressure(0) - controls.bhp_limit; return; + } const auto& groupcontrols = group.injectionControls(summaryState); @@ -2045,7 +2049,8 @@ namespace Opm switch(currentGroupControl) { case Group::InjectionCMode::NONE: { - OPM_DEFLOG_THROW(std::runtime_error, "NONE group control not implemented for injectors" , deferred_logger); + // The NONE case is handled earlier + assert(false); break; } case Group::InjectionCMode::RATE: @@ -2119,8 +2124,12 @@ namespace Opm assembleGroupProductionControl(parent, well_state, schedule, summaryState, control_eq, efficiencyFactor, deferred_logger); return; } - if (!group.isProductionGroup()) + if (!group.isProductionGroup() || currentGroupControl == Group::ProductionCMode::NONE) { + // use bhp as control eq and let the updateControl code find a vallied control + const auto& controls = well.productionControls(summaryState); + control_eq = getSegmentPressure(0) - controls.bhp_limit; return; + } const auto& groupcontrols = group.productionControls(summaryState); const std::vector& groupTargetReductions = well_state.currentProductionGroupReductionRates(group.name()); @@ -2128,7 +2137,8 @@ namespace Opm switch(currentGroupControl) { case Group::ProductionCMode::NONE: { - OPM_DEFLOG_THROW(std::runtime_error, "NONE group control not implemented for producers" , deferred_logger); + // The NONE case is handled earlier + assert(false); break; } case Group::ProductionCMode::ORAT: diff --git a/opm/simulators/wells/StandardWell_impl.hpp b/opm/simulators/wells/StandardWell_impl.hpp index 6c168a627..2f7e6789b 100644 --- a/opm/simulators/wells/StandardWell_impl.hpp +++ b/opm/simulators/wells/StandardWell_impl.hpp @@ -984,8 +984,13 @@ namespace Opm return; } - if (!group.isInjectionGroup()) + if (!group.isInjectionGroup() || currentGroupControl == Group::InjectionCMode::NONE) { + // use bhp as control eq and let the updateControl code find a vallied control + const auto& controls = well.injectionControls(summaryState); + control_eq = getBhp() - controls.bhp_limit; return; + } + int phasePos; Well::GuideRateTarget wellTarget; @@ -1025,7 +1030,8 @@ namespace Opm switch(currentGroupControl) { case Group::InjectionCMode::NONE: { - OPM_DEFLOG_THROW(std::runtime_error, "NONE group control not implemented for injectors" , deferred_logger); + // The NONE case is handled earlier + assert(false); break; } case Group::InjectionCMode::RATE: @@ -1113,8 +1119,12 @@ namespace Opm return; } - if (!group.isProductionGroup()) + if (!group.isProductionGroup() || currentGroupControl == Group::ProductionCMode::NONE) { + // use bhp as control eq and let the updateControl code find a vallied control + const auto& controls = well.productionControls(summaryState); + control_eq = getBhp() - controls.bhp_limit; return; + } const auto& groupcontrols = group.productionControls(summaryState); @@ -1123,8 +1133,8 @@ namespace Opm switch(currentGroupControl) { case Group::ProductionCMode::NONE: { - OPM_DEFLOG_THROW(std::runtime_error, "NONE group control not implemented for producers" , deferred_logger); - break; + // The NONE case is handled earlier + assert(false); } case Group::ProductionCMode::ORAT: { From c930ac9858ac8aa002e9a1506a07627caed28950 Mon Sep 17 00:00:00 2001 From: Tor Harald Sandve Date: Wed, 4 Dec 2019 11:39:26 +0100 Subject: [PATCH 2/2] fix spelling --- opm/simulators/wells/MultisegmentWell_impl.hpp | 2 +- opm/simulators/wells/StandardWell_impl.hpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/opm/simulators/wells/MultisegmentWell_impl.hpp b/opm/simulators/wells/MultisegmentWell_impl.hpp index 7939a747b..4e391b237 100644 --- a/opm/simulators/wells/MultisegmentWell_impl.hpp +++ b/opm/simulators/wells/MultisegmentWell_impl.hpp @@ -1999,7 +1999,7 @@ namespace Opm } if (!group.isInjectionGroup() || currentGroupControl == Group::InjectionCMode::NONE) { - // use bhp as control eq and let the updateControl code find a vallied control + // use bhp as control eq and let the updateControl code find a valid control const auto& controls = well.injectionControls(summaryState); control_eq = getSegmentPressure(0) - controls.bhp_limit; return; diff --git a/opm/simulators/wells/StandardWell_impl.hpp b/opm/simulators/wells/StandardWell_impl.hpp index 2f7e6789b..4db5fda57 100644 --- a/opm/simulators/wells/StandardWell_impl.hpp +++ b/opm/simulators/wells/StandardWell_impl.hpp @@ -985,7 +985,7 @@ namespace Opm } if (!group.isInjectionGroup() || currentGroupControl == Group::InjectionCMode::NONE) { - // use bhp as control eq and let the updateControl code find a vallied control + // use bhp as control eq and let the updateControl code find a valid control const auto& controls = well.injectionControls(summaryState); control_eq = getBhp() - controls.bhp_limit; return;