From 4a1b2ef4870fdae6dcc75364eb2335993c6c0797 Mon Sep 17 00:00:00 2001 From: Kai Bao Date: Tue, 25 Nov 2025 15:20:06 +0100 Subject: [PATCH 1/2] not helpful to have included in OR operation when it is false --- opm/simulators/wells/GroupStateHelper.cpp | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/opm/simulators/wells/GroupStateHelper.cpp b/opm/simulators/wells/GroupStateHelper.cpp index 0c9015f98e..87d7e79518 100644 --- a/opm/simulators/wells/GroupStateHelper.cpp +++ b/opm/simulators/wells/GroupStateHelper.cpp @@ -1724,12 +1724,10 @@ GroupStateHelper::updateGroupControlledWellsRecursive_( bool included = false; if (is_production_group) { const auto ctrl = this->groupState().production_control(child_group); - included - = included || (ctrl == Group::ProductionCMode::FLD) || (ctrl == Group::ProductionCMode::NONE); + included = (ctrl == Group::ProductionCMode::FLD || ctrl == Group::ProductionCMode::NONE); } else { const auto ctrl = this->groupState().injection_control(child_group, injection_phase); - included - = included || (ctrl == Group::InjectionCMode::FLD) || (ctrl == Group::InjectionCMode::NONE); + included = (ctrl == Group::InjectionCMode::FLD || ctrl == Group::InjectionCMode::NONE); } if (included) { @@ -1744,14 +1742,14 @@ GroupStateHelper::updateGroupControlledWellsRecursive_( bool included = false; const Well& well = this->schedule_.getWell(child_well, this->report_step_); if (is_production_group && well.isProducer()) { - included = included || this->wellState().isProductionGrup(child_well) || group.as_choke(); + included = (this->wellState().isProductionGrup(child_well) || group.as_choke()); } else if (!is_production_group && !well.isProducer()) { const auto& well_controls = well.injectionControls(this->summary_state_); auto injectorType = well_controls.injector_type; if ((injection_phase == Phase::WATER && injectorType == InjectorType::WATER) || (injection_phase == Phase::OIL && injectorType == InjectorType::OIL) || (injection_phase == Phase::GAS && injectorType == InjectorType::GAS)) { - included = included || this->wellState().isInjectionGrup(child_well); + included = this->wellState().isInjectionGrup(child_well); } } const auto ctrl1 = this->groupState().production_control(group.name()); From 746b7d44bfa74be45d958032534c19f57fad4a52 Mon Sep 17 00:00:00 2001 From: Kai Bao Date: Tue, 25 Nov 2025 15:27:29 +0100 Subject: [PATCH 2/2] making the commented argument name reflect the function declaration --- opm/simulators/wells/GroupStateHelper.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/opm/simulators/wells/GroupStateHelper.cpp b/opm/simulators/wells/GroupStateHelper.cpp index 87d7e79518..93f0b77c4f 100644 --- a/opm/simulators/wells/GroupStateHelper.cpp +++ b/opm/simulators/wells/GroupStateHelper.cpp @@ -144,7 +144,7 @@ GroupStateHelper::checkGroupConstraintsInj(const std::strin this->report_step_, &this->guide_rate_, tcalc.guideTargetMode(), - /*is_production_group=*/false, + /*is_producer=*/false, injection_phase}; auto local_fraction_lambda = [&](const std::string& child) { return fcalc.localFraction(child, name); }; @@ -317,7 +317,7 @@ GroupStateHelper::checkGroupConstraintsProd(const std::stri this->report_step_, &this->guide_rate_, tcalc.guideTargetMode(), - /*is_production_group=*/true, + /*is_producer=*/true, /*injection_phase=*/Phase::OIL}; auto local_fraction_lambda = [&](const std::string& child) { return fcalc.localFraction(child, name); }; @@ -385,8 +385,8 @@ GroupStateHelper::checkGroupConstraintsProd(const std::stri for (std::size_t ii = 1; ii < num_ancestors; ++ii) { const int num_gr_ctrl = this->groupControlledWells(chain[ii], /*always_included_child=*/"", - /*is_producer=*/true, - /*injection_phase_not_used=*/Phase::OIL); + /*is_production_group=*/true, + /*injection_phase=*/Phase::OIL/*not used*/); if (this->guide_rate_.has(chain[ii]) && num_gr_ctrl > 0) { local_reduction_level = ii; } @@ -707,7 +707,7 @@ GroupStateHelper::getWellGroupTargetInjector(const std::str this->report_step_, &this->guide_rate_, tcalc.guideTargetMode(), - /*is_production_group=*/false, + /*is_producer=*/false, injection_phase}; auto local_fraction_lambda = [&](const std::string& child, const std::string& always_incluced_name) { @@ -1875,7 +1875,7 @@ GroupStateHelper::updateGroupTargetReductionRecursive_( = this->groupControlledWells(sub_group.name(), /*always_included_child=*/"", !is_injector, - /*injection_phase_not_used=*/Phase::OIL); + /*injection_phase=*/Phase::OIL); if (individual_control || num_group_controlled_wells == 0) { for (int phase = 0; phase < np; phase++) { group_target_reduction[phase]