From 7302c37b7828552fbae8ade13a6633d32b30552e Mon Sep 17 00:00:00 2001 From: Paul Date: Wed, 12 Jul 2023 20:44:10 +0200 Subject: [PATCH 1/3] Enable items, 11, 12 and 13 of GCONPROD --- .../utils/PartiallySupportedFlowKeywords.cpp | 6 +++--- .../wells/BlackoilWellModelConstraints.cpp | 21 +++++++++++++++++-- .../wells/BlackoilWellModelConstraints.hpp | 3 +++ .../wells/BlackoilWellModelGeneric.cpp | 5 ++++- 4 files changed, 29 insertions(+), 6 deletions(-) diff --git a/opm/simulators/utils/PartiallySupportedFlowKeywords.cpp b/opm/simulators/utils/PartiallySupportedFlowKeywords.cpp index 40f727772..ec78b9733 100644 --- a/opm/simulators/utils/PartiallySupportedFlowKeywords.cpp +++ b/opm/simulators/utils/PartiallySupportedFlowKeywords.cpp @@ -98,9 +98,9 @@ partiallySupported() { {2,{true, allow_values {"NONE", "FLD", "ORAT", "WRAT", "GRAT", "LRAT", "RESV"}, "GCONPROD(TARGET): valid option should be NONE/FLD/ORAT/WRAT/GRAT/LRAT or RESV"}}, // CONTROL_MODE {7,{true, allow_values {"NONE", "RATE"}, "GCONPROD(ACTION): Only NONE and RATE is supported"}}, - {11,{true, allow_values {"NONE"}, "GCONPROD(ACTWAT): water violation procedure not implemented, item should be defaulted"}}, // WATER_EXCEED_PROCEDURE - {12,{true, allow_values {"NONE"}, "GCONPROD(ACTGAS): gas violation procedure not implemented, item should be defaulted"}}, // GAS_EXCEED_PROCEDURE - {13,{true, allow_values {"NONE"}, "GCONPROD(ACTLIQ): liquid violation procedure not implemented, item should be defaulted"}}, // LIQUID_EXCEED_PROCEDURE + {11,{true, allow_values {"NONE", "RATE"}, "GCONPROD(ACTWAT): Only NONE and RATE is supported"}}, // WATER_EXCEED_PROCEDURE + {12,{true, allow_values {"NONE", "RATE"}, "GCONPROD(ACTGAS): Only NONE and RATE is supported"}}, // GAS_EXCEED_PROCEDURE + {13,{true, allow_values {"NONE", "RATE"}, "GCONPROD(ACTLIQ): Only NONE and RATE is supported"}}, // LIQUID_EXCEED_PROCEDURE {21,{true, allow_values {"NONE"}, "GCONPROD(COMBPROC): linearly combined procedure is not used and should be defaulted (1*)"}}, // LIN_TARGET_EXCEED_PROCEDURE }, }, diff --git a/opm/simulators/wells/BlackoilWellModelConstraints.cpp b/opm/simulators/wells/BlackoilWellModelConstraints.cpp index 0909d83f5..75e0b22a7 100644 --- a/opm/simulators/wells/BlackoilWellModelConstraints.cpp +++ b/opm/simulators/wells/BlackoilWellModelConstraints.cpp @@ -403,6 +403,9 @@ 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::ProductionCMode& newControl, GroupState& group_state, DeferredLogger& deferred_logger) const @@ -412,9 +415,20 @@ actionOnBrokenConstraints(const Group& group, std::string ss; switch(exceed_action) { case Group::ExceedAction::NONE: { + // phase specific exceed actions need to be considered if (oldControl != newControl && oldControl != Group::ProductionCMode::NONE) { - ss = fmt::format("Group production exceed action is NONE for group {}. Nothing happens.", - group.name()); + 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)) { + group_state.production_control(group.name(), newControl); + ss = fmt::format("Switching production control mode for group {} from {} to {}", + group.name(), + Group::ProductionCMode2String(oldControl), + Group::ProductionCMode2String(newControl)); + } + else { + ss = fmt::format("Group production exceed action is NONE for group {}. Nothing happens.", group.name()); + } } break; } @@ -501,6 +515,9 @@ updateGroupIndividualControl(const Group& group, this->actionOnBrokenConstraints(group, controls.exceed_action, + controls.water_exceed_action, + controls.gas_exceed_action, + controls.liquid_exceed_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 f84948fc0..0c65c820e 100644 --- a/opm/simulators/wells/BlackoilWellModelConstraints.hpp +++ b/opm/simulators/wells/BlackoilWellModelConstraints.hpp @@ -62,6 +62,9 @@ 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::ProductionCMode& newControl, GroupState& group_state, DeferredLogger& deferred_logger) const; diff --git a/opm/simulators/wells/BlackoilWellModelGeneric.cpp b/opm/simulators/wells/BlackoilWellModelGeneric.cpp index faf22ca47..17efd0e5a 100644 --- a/opm/simulators/wells/BlackoilWellModelGeneric.cpp +++ b/opm/simulators/wells/BlackoilWellModelGeneric.cpp @@ -573,8 +573,11 @@ checkGroupHigherConstraints(const Group& group, 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; BlackoilWellModelConstraints(*this). - actionOnBrokenConstraints(group, exceed_action, + actionOnBrokenConstraints(group, exceed_action, water_exceed_action, gas_exceed_action, liquid_exceed_action, Group::ProductionCMode::FLD, this->groupState(), deferred_logger); From 1796b3343b55e87b684f1b603b76887f5528532d Mon Sep 17 00:00:00 2001 From: Paul Date: Thu, 13 Jul 2023 13:15:54 +0200 Subject: [PATCH 2/3] improved messages text --- opm/simulators/utils/PartiallySupportedFlowKeywords.cpp | 8 ++++---- opm/simulators/wells/BlackoilWellModelConstraints.cpp | 5 +++-- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/opm/simulators/utils/PartiallySupportedFlowKeywords.cpp b/opm/simulators/utils/PartiallySupportedFlowKeywords.cpp index ec78b9733..32b954f88 100644 --- a/opm/simulators/utils/PartiallySupportedFlowKeywords.cpp +++ b/opm/simulators/utils/PartiallySupportedFlowKeywords.cpp @@ -97,10 +97,10 @@ partiallySupported() "GCONPROD", { {2,{true, allow_values {"NONE", "FLD", "ORAT", "WRAT", "GRAT", "LRAT", "RESV"}, "GCONPROD(TARGET): valid option should be NONE/FLD/ORAT/WRAT/GRAT/LRAT or RESV"}}, // CONTROL_MODE - {7,{true, allow_values {"NONE", "RATE"}, "GCONPROD(ACTION): Only NONE and RATE is supported"}}, - {11,{true, allow_values {"NONE", "RATE"}, "GCONPROD(ACTWAT): Only NONE and RATE is supported"}}, // WATER_EXCEED_PROCEDURE - {12,{true, allow_values {"NONE", "RATE"}, "GCONPROD(ACTGAS): Only NONE and RATE is supported"}}, // GAS_EXCEED_PROCEDURE - {13,{true, allow_values {"NONE", "RATE"}, "GCONPROD(ACTLIQ): Only NONE and RATE is supported"}}, // LIQUID_EXCEED_PROCEDURE + {7,{true, allow_values {"NONE", "RATE"}, "GCONPROD(ACTION): Only NONE and RATE are supported"}}, + {11,{true, allow_values {"NONE", "RATE"}, "GCONPROD(ACTWAT): Only NONE and RATE are supported"}}, // WATER_EXCEED_PROCEDURE + {12,{true, allow_values {"NONE", "RATE"}, "GCONPROD(ACTGAS): Only NONE and RATE are supported"}}, // GAS_EXCEED_PROCEDURE + {13,{true, allow_values {"NONE", "RATE"}, "GCONPROD(ACTLIQ): Only NONE and RATE are supported"}}, // LIQUID_EXCEED_PROCEDURE {21,{true, allow_values {"NONE"}, "GCONPROD(COMBPROC): linearly combined procedure is not used and should be defaulted (1*)"}}, // LIN_TARGET_EXCEED_PROCEDURE }, }, diff --git a/opm/simulators/wells/BlackoilWellModelConstraints.cpp b/opm/simulators/wells/BlackoilWellModelConstraints.cpp index 75e0b22a7..ad2a060f2 100644 --- a/opm/simulators/wells/BlackoilWellModelConstraints.cpp +++ b/opm/simulators/wells/BlackoilWellModelConstraints.cpp @@ -415,7 +415,6 @@ actionOnBrokenConstraints(const Group& group, std::string ss; switch(exceed_action) { case Group::ExceedAction::NONE: { - // phase specific exceed actions need to be considered 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) || @@ -427,7 +426,9 @@ actionOnBrokenConstraints(const Group& group, Group::ProductionCMode2String(newControl)); } else { - ss = fmt::format("Group production exceed action is NONE for group {}. Nothing happens.", group.name()); + ss = fmt::format("Procedure on exceeding {} limit is NONE for group {}. Nothing is done.", + Group::ProductionCMode2String(oldControl), + group.name()); } } break; From ae553787ba156beb72c6671fb77fa33eb22980f0 Mon Sep 17 00:00:00 2001 From: Paul Date: Fri, 14 Jul 2023 11:20:03 +0200 Subject: [PATCH 3/3] 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);