Use SingleWellState for production and injection control

This commit is contained in:
Joakim Hove
2021-08-04 12:03:36 +02:00
parent c381459804
commit 581f571c9d
14 changed files with 69 additions and 75 deletions

View File

@@ -257,8 +257,9 @@ namespace Opm
// If the well is pressure controlled the potential equals the rate.
bool thp_controlled_well = false;
bool bhp_controlled_well = false;
const auto& ws = well_state.well(this->index_of_well_);
if (this->isInjector()) {
const Well::InjectorCMode& current = well_state.currentInjectionControl(index_of_well_);
const Well::InjectorCMode& current = ws.injection_cmode;
if (current == Well::InjectorCMode::THP) {
thp_controlled_well = true;
}
@@ -266,7 +267,7 @@ namespace Opm
bhp_controlled_well = true;
}
} else {
const Well::ProducerCMode& current = well_state.currentProductionControl(index_of_well_);
const Well::ProducerCMode& current = ws.production_cmode;
if (current == Well::ProducerCMode::THP) {
thp_controlled_well = true;
}
@@ -354,10 +355,10 @@ namespace Opm
// Set current control to bhp, and bhp value in state, modify bhp limit in control object.
if (well_copy.well_ecl_.isInjector()) {
inj_controls.bhp_limit = bhp;
well_state_copy.currentInjectionControl(index_of_well_, Well::InjectorCMode::BHP);
ws.injection_cmode = Well::InjectorCMode::BHP;
} else {
prod_controls.bhp_limit = bhp;
well_state_copy.currentProductionControl(index_of_well_, Well::ProducerCMode::BHP);
ws.production_cmode = Well::ProducerCMode::BHP;
}
ws.bhp = bhp;
well_copy.scaleSegmentPressuresWithBhp(well_state_copy);