some cleanup

This commit is contained in:
Tor Harald Sandve committed 2022-09-13 08:33:51 +02:00
1 parent d2fc8a3d5e
commit 7571215f44
2 files changed
+15 -14

No files matched your search

@@ -1219,7 +1219,7 @@ checkGroupHigherConstraints(const Group& group,
auto currentControl = this->groupState().injection_control(group.name(), phase);
if (currentControl != Group::InjectionCMode::FLD && group.injectionGroupControlAvailable(phase)) {
const Group& parentGroup = schedule().getGroup(group.parent(), reportStepIdx);
const std::pair<bool, double> changed_this = WellGroupHelpers::checkGroupConstraintsInj(
const auto [is_changed, scaling_factor] = WellGroupHelpers::checkGroupConstraintsInj(
group.name(),
group.parent(),
parentGroup,
@@ -1235,10 +1235,10 @@ checkGroupHigherConstraints(const Group& group,
summaryState_,
resv_coeff_inj,
deferred_logger);
if (changed_this.first) {
if (is_changed) {
switched_inj_groups_.insert({ {group.name(), phase}, Group::InjectionCMode2String(Group::InjectionCMode::FLD)});
actionOnBrokenConstraints(group, Group::InjectionCMode::FLD, phase, deferred_logger);
WellGroupHelpers::updateWellRatesFromGroupTargetScale(changed_this.second, group, schedule(), reportStepIdx, /* isInjector */ true, this->groupState(), this->wellState());
WellGroupHelpers::updateWellRatesFromGroupTargetScale(scaling_factor, group, schedule(), reportStepIdx, /* isInjector */ true, this->groupState(), this->wellState());
changed = true;
}
}
@@ -1258,7 +1258,7 @@ checkGroupHigherConstraints(const Group& group,
const Group::ProductionCMode& currentControl = this->groupState().production_control(group.name());
if (currentControl != Group::ProductionCMode::FLD && group.productionGroupControlAvailable()) {
const Group& parentGroup = schedule().getGroup(group.parent(), reportStepIdx);
const std::pair<bool, double> changed_this = WellGroupHelpers::checkGroupConstraintsProd(
const auto [is_changed, scaling_factor] = WellGroupHelpers::checkGroupConstraintsProd(
group.name(),
group.parent(),
parentGroup,
@@ -1273,11 +1273,11 @@ checkGroupHigherConstraints(const Group& group,
summaryState_,
resv_coeff,
deferred_logger);
if (changed_this.first) {
if (is_changed) {
switched_prod_groups_.insert({group.name(), Group::ProductionCMode2String(Group::ProductionCMode::FLD)});
const auto exceed_action = group.productionControls(summaryState_).exceed_action;
actionOnBrokenConstraints(group, exceed_action, Group::ProductionCMode::FLD, deferred_logger);
WellGroupHelpers::updateWellRatesFromGroupTargetScale(changed_this.second, group, schedule(), reportStepIdx, /* isInjector */ false, this->groupState(), this->wellState());
WellGroupHelpers::updateWellRatesFromGroupTargetScale(scaling_factor, group, schedule(), reportStepIdx, /* isInjector */ false, this->groupState(), this->wellState());
changed = true;
}
}
@@ -468,26 +468,27 @@ namespace Opm {
if (terminal_output_) {
for (const auto& [name, to] : switched_prod_groups_) {
std::string msg = " Production Group " + name
+ " control mode changed from ";
const Group::ProductionCMode& oldControl = this->prevWGState().group_state.production_control(name);
std::string from = Group::ProductionCMode2String(oldControl);
msg += from;
msg += " to " + to;
if (to != from) {
std::string msg = " Production Group " + name
+ " control mode changed from ";
msg += from;
msg += " to " + to;
local_deferredLogger.info(msg);
}
}
for (const auto& [key, to] : switched_inj_groups_) {
const std::string& name = key.first;
const Opm::Phase& phase = key.second;
std::string msg = " Injection Group " + name
+ " control mode changed from ";
const Group::InjectionCMode& oldControl = this->prevWGState().group_state.injection_control(name, phase);
std::string from = Group::InjectionCMode2String(oldControl);
msg += from;
msg += " to " + to;
if (to != from) {
std::string msg = " Injection Group " + name
+ " control mode changed from ";
msg += from;
msg += " to " + to;
local_deferredLogger.info(msg);
}
}