From ae553787ba156beb72c6671fb77fa33eb22980f0 Mon Sep 17 00:00:00 2001 From: Paul Date: Fri, 14 Jul 2023 11:20:03 +0200 Subject: [PATCH] Use struct for collecting group limit actions --- .../wells/BlackoilWellModelConstraints.cpp | 18 ++++++------------ .../wells/BlackoilWellModelConstraints.hpp | 5 +---- .../wells/BlackoilWellModelGeneric.cpp | 7 ++----- 3 files changed, 9 insertions(+), 21 deletions(-) diff --git a/opm/simulators/wells/BlackoilWellModelConstraints.cpp b/opm/simulators/wells/BlackoilWellModelConstraints.cpp index ad2a060f2..6a88e9813 100644 --- a/opm/simulators/wells/BlackoilWellModelConstraints.cpp +++ b/opm/simulators/wells/BlackoilWellModelConstraints.cpp @@ -402,10 +402,7 @@ actionOnBrokenConstraints(const Group& group, void BlackoilWellModelConstraints:: actionOnBrokenConstraints(const Group& group, - const Group::ExceedAction& exceed_action, - const Group::ExceedAction& water_exceed_action, - const Group::ExceedAction& gas_exceed_action, - const Group::ExceedAction& liquid_exceed_action, + const Group::GroupLimitAction group_limit_action, const Group::ProductionCMode& newControl, GroupState& group_state, DeferredLogger& deferred_logger) const @@ -413,12 +410,12 @@ actionOnBrokenConstraints(const Group& group, const Group::ProductionCMode oldControl = wellModel_.groupState().production_control(group.name()); std::string ss; - switch(exceed_action) { + switch(group_limit_action.allRates) { case Group::ExceedAction::NONE: { if (oldControl != newControl && oldControl != Group::ProductionCMode::NONE) { - if ((water_exceed_action == Group::ExceedAction::RATE && newControl == Group::ProductionCMode::WRAT) || - (gas_exceed_action == Group::ExceedAction::RATE && newControl == Group::ProductionCMode::GRAT) || - (liquid_exceed_action == Group::ExceedAction::RATE && newControl == Group::ProductionCMode::LRAT)) { + if ((group_limit_action.water == Group::ExceedAction::RATE && newControl == Group::ProductionCMode::WRAT) || + (group_limit_action.gas == Group::ExceedAction::RATE && newControl == Group::ProductionCMode::GRAT) || + (group_limit_action.liquid == Group::ExceedAction::RATE && newControl == Group::ProductionCMode::LRAT)) { group_state.production_control(group.name(), newControl); ss = fmt::format("Switching production control mode for group {} from {} to {}", group.name(), @@ -515,10 +512,7 @@ updateGroupIndividualControl(const Group& group, Group::ProductionCMode2String(changed_this.first)); this->actionOnBrokenConstraints(group, - controls.exceed_action, - controls.water_exceed_action, - controls.gas_exceed_action, - controls.liquid_exceed_action, + controls.group_limit_action, changed_this.first, group_state, deferred_logger); WellGroupHelpers::updateWellRatesFromGroupTargetScale(changed_this.second, diff --git a/opm/simulators/wells/BlackoilWellModelConstraints.hpp b/opm/simulators/wells/BlackoilWellModelConstraints.hpp index 0c65c820e..ced16501d 100644 --- a/opm/simulators/wells/BlackoilWellModelConstraints.hpp +++ b/opm/simulators/wells/BlackoilWellModelConstraints.hpp @@ -61,10 +61,7 @@ public: //! \brief Execute action on broken constraint for a production well group. void actionOnBrokenConstraints(const Group& group, - const Group::ExceedAction& exceed_action, - const Group::ExceedAction& water_exceed_action, - const Group::ExceedAction& gas_exceed_action, - const Group::ExceedAction& liquid_exceed_action, + const Group::GroupLimitAction group_limit_action, const Group::ProductionCMode& newControl, GroupState& group_state, DeferredLogger& deferred_logger) const; diff --git a/opm/simulators/wells/BlackoilWellModelGeneric.cpp b/opm/simulators/wells/BlackoilWellModelGeneric.cpp index 17efd0e5a..d5d6fd0d7 100644 --- a/opm/simulators/wells/BlackoilWellModelGeneric.cpp +++ b/opm/simulators/wells/BlackoilWellModelGeneric.cpp @@ -572,12 +572,9 @@ checkGroupHigherConstraints(const Group& group, deferred_logger); if (is_changed) { switched_prod_groups_.insert_or_assign(group.name(), Group::ProductionCMode2String(Group::ProductionCMode::FLD)); - const auto exceed_action = group.productionControls(summaryState_).exceed_action; - const auto water_exceed_action = group.productionControls(summaryState_).water_exceed_action; - const auto gas_exceed_action = group.productionControls(summaryState_).gas_exceed_action; - const auto liquid_exceed_action = group.productionControls(summaryState_).liquid_exceed_action; + const auto group_limit_action = group.productionControls(summaryState_).group_limit_action; BlackoilWellModelConstraints(*this). - actionOnBrokenConstraints(group, exceed_action, water_exceed_action, gas_exceed_action, liquid_exceed_action, + actionOnBrokenConstraints(group, group_limit_action, Group::ProductionCMode::FLD, this->groupState(), deferred_logger);