From 2c8497031405c51750784d13a27e39cbdffaffb9 Mon Sep 17 00:00:00 2001 From: Tor Harald Sandve Date: Mon, 25 Nov 2019 10:10:27 +0100 Subject: [PATCH 1/4] honor group event --- opm/simulators/wells/WellGroupHelpers.hpp | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/opm/simulators/wells/WellGroupHelpers.hpp b/opm/simulators/wells/WellGroupHelpers.hpp index 7ad1e832d..67fa0fee5 100644 --- a/opm/simulators/wells/WellGroupHelpers.hpp +++ b/opm/simulators/wells/WellGroupHelpers.hpp @@ -35,21 +35,22 @@ namespace Opm { setCmodeGroup( schedule.getGroup(groupName, reportStepIdx), schedule, summaryState, reportStepIdx, wellState); } + // use NONE as default control if (!wellState.hasInjectionGroupControl(group.name())) { - // use NONE as default control wellState.setCurrentInjectionGroupControl(group.name(), Group::InjectionCMode::NONE); - if (group.isInjectionGroup()) { - const auto controls = group.injectionControls(summaryState); - wellState.setCurrentInjectionGroupControl(group.name(), controls.cmode); - } } if (!wellState.hasProductionGroupControl(group.name())) { - // use NONE as default control wellState.setCurrentProductionGroupControl(group.name(), Group::ProductionCMode::NONE); - if (group.isProductionGroup()) { - const auto controls = group.productionControls(summaryState); - wellState.setCurrentProductionGroupControl(group.name(), controls.cmode); - } + } + + if (group.isInjectionGroup() && schedule.hasGroupEvent(group.name(), ScheduleEvents::GROUP_INJECTION_UPDATE, reportStepIdx)) { + const auto controls = group.injectionControls(summaryState); + wellState.setCurrentInjectionGroupControl(group.name(), controls.cmode); + } + + if (group.isProductionGroup() && schedule.hasGroupEvent(group.name(), ScheduleEvents::GROUP_PRODUCTION_UPDATE, reportStepIdx)) { + const auto controls = group.productionControls(summaryState); + wellState.setCurrentProductionGroupControl(group.name(), controls.cmode); } } From 49b5883ff71c951489b9761f887bdf1a99d02399 Mon Sep 17 00:00:00 2001 From: Tor Harald Sandve Date: Mon, 25 Nov 2019 10:11:36 +0100 Subject: [PATCH 2/4] Clean-up output message for group --- opm/simulators/wells/BlackoilWellModel_impl.hpp | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/opm/simulators/wells/BlackoilWellModel_impl.hpp b/opm/simulators/wells/BlackoilWellModel_impl.hpp index 861bc328b..48df301bd 100644 --- a/opm/simulators/wells/BlackoilWellModel_impl.hpp +++ b/opm/simulators/wells/BlackoilWellModel_impl.hpp @@ -1806,14 +1806,11 @@ namespace Opm { std::ostringstream ss; - if (oldControl != newControl) { - const std::string from = Group::ProductionCMode2String(oldControl); - ss << "Group " << group.name() << " exceeding " - << from << " limit \n"; - } switch(exceed_action) { case Group::ExceedAction::NONE: { - OPM_DEFLOG_THROW(std::runtime_error, "Group " + group.name() + "GroupProductionExceedLimit NONE not implemented", deferred_logger); + if (oldControl != newControl && oldControl != Group::ProductionCMode::NONE) { + ss << "Group production exceed limit is NONE for group " + group.name() + ". Nothing happens"; + } break; } case Group::ExceedAction::CON: { From cab2f4b41fbee45319dc703cbff2935d84012680 Mon Sep 17 00:00:00 2001 From: Tor Harald Sandve Date: Wed, 27 Nov 2019 08:59:29 +0100 Subject: [PATCH 3/4] use common WellGroupEvent map --- opm/simulators/wells/BlackoilWellModel_impl.hpp | 2 +- opm/simulators/wells/StandardWell_impl.hpp | 2 +- opm/simulators/wells/WellGroupHelpers.hpp | 4 ++-- opm/simulators/wells/WellStateFullyImplicitBlackoil.hpp | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/opm/simulators/wells/BlackoilWellModel_impl.hpp b/opm/simulators/wells/BlackoilWellModel_impl.hpp index 48df301bd..987d735e7 100644 --- a/opm/simulators/wells/BlackoilWellModel_impl.hpp +++ b/opm/simulators/wells/BlackoilWellModel_impl.hpp @@ -276,7 +276,7 @@ namespace Opm { + ScheduleEvents::INJECTION_UPDATE + ScheduleEvents::NEW_WELL; - if(!schedule().hasWellEvent(well.name(), effective_events_mask, timeStepIdx)) + if(!schedule().hasWellGroupEvent(well_name, effective_events_mask, timeStepIdx)) continue; if (well.isProducer()) { diff --git a/opm/simulators/wells/StandardWell_impl.hpp b/opm/simulators/wells/StandardWell_impl.hpp index d7fb3d92f..6c168a627 100644 --- a/opm/simulators/wells/StandardWell_impl.hpp +++ b/opm/simulators/wells/StandardWell_impl.hpp @@ -707,7 +707,7 @@ namespace Opm const auto& fs = intQuants.fluidState(); Eval perf_pressure = getPerfCellPressure(fs); const double drawdown = well_state.perfPress()[first_perf_ + perf] - perf_pressure.value(); - const bool new_well = schedule.hasWellEvent(name(), ScheduleEvents::NEW_WELL, current_step_); + const bool new_well = schedule.hasWellGroupEvent(name(), ScheduleEvents::NEW_WELL, current_step_); double productivity_index = cq_s[compIdx].value() / drawdown; scaleProductivityIndex(perf, productivity_index, new_well, deferred_logger); well_state.productivityIndex()[np*index_of_well_ + p] += productivity_index; diff --git a/opm/simulators/wells/WellGroupHelpers.hpp b/opm/simulators/wells/WellGroupHelpers.hpp index 67fa0fee5..32e525d77 100644 --- a/opm/simulators/wells/WellGroupHelpers.hpp +++ b/opm/simulators/wells/WellGroupHelpers.hpp @@ -43,12 +43,12 @@ namespace Opm { wellState.setCurrentProductionGroupControl(group.name(), Group::ProductionCMode::NONE); } - if (group.isInjectionGroup() && schedule.hasGroupEvent(group.name(), ScheduleEvents::GROUP_INJECTION_UPDATE, reportStepIdx)) { + if (group.isInjectionGroup() && schedule.hasWellGroupEvent(group.name(), ScheduleEvents::GROUP_INJECTION_UPDATE, reportStepIdx)) { const auto controls = group.injectionControls(summaryState); wellState.setCurrentInjectionGroupControl(group.name(), controls.cmode); } - if (group.isProductionGroup() && schedule.hasGroupEvent(group.name(), ScheduleEvents::GROUP_PRODUCTION_UPDATE, reportStepIdx)) { + if (group.isProductionGroup() && schedule.hasWellGroupEvent(group.name(), ScheduleEvents::GROUP_PRODUCTION_UPDATE, reportStepIdx)) { const auto controls = group.productionControls(summaryState); wellState.setCurrentProductionGroupControl(group.name(), controls.cmode); } diff --git a/opm/simulators/wells/WellStateFullyImplicitBlackoil.hpp b/opm/simulators/wells/WellStateFullyImplicitBlackoil.hpp index 687e1e42b..727f3d73a 100644 --- a/opm/simulators/wells/WellStateFullyImplicitBlackoil.hpp +++ b/opm/simulators/wells/WellStateFullyImplicitBlackoil.hpp @@ -109,7 +109,7 @@ namespace Opm + ScheduleEvents::INJECTION_UPDATE; for (int w = 0; w < nw; ++w) { effective_events_occurred_[w] - = schedule.hasWellEvent(wells_ecl[w].name(), effective_events_mask, report_step); + = schedule.hasWellGroupEvent(wells_ecl[w].name(), effective_events_mask, report_step); } } // end of if (!well_ecl.empty() ) From 853a726bb2d595c6aff9a2fc36982fd32b7a540c Mon Sep 17 00:00:00 2001 From: Tor Harald Sandve Date: Wed, 27 Nov 2019 14:56:10 +0100 Subject: [PATCH 4/4] fix after rebase --- opm/simulators/wells/BlackoilWellModel_impl.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/opm/simulators/wells/BlackoilWellModel_impl.hpp b/opm/simulators/wells/BlackoilWellModel_impl.hpp index 987d735e7..643cdc165 100644 --- a/opm/simulators/wells/BlackoilWellModel_impl.hpp +++ b/opm/simulators/wells/BlackoilWellModel_impl.hpp @@ -276,7 +276,7 @@ namespace Opm { + ScheduleEvents::INJECTION_UPDATE + ScheduleEvents::NEW_WELL; - if(!schedule().hasWellGroupEvent(well_name, effective_events_mask, timeStepIdx)) + if(!schedule().hasWellGroupEvent(well.name(), effective_events_mask, timeStepIdx)) continue; if (well.isProducer()) {