Restore Groups' Active Constraints on Restart

First step towards better restarts of models with group control.
This commit is contained in:
Bård Skaflestad 2020-08-28 08:41:48 +02:00
parent bdc34a7580
commit 6220cdf613
2 changed files with 23 additions and 1 deletions

View File

@ -414,6 +414,7 @@ namespace Opm {
// convert well data from opm-common to well state from opm-core // convert well data from opm-common to well state from opm-core
void wellsToState( const data::Wells& wells, void wellsToState( const data::Wells& wells,
const data::GroupValues& groupValues,
const PhaseUsage& phases, const PhaseUsage& phases,
const bool handle_ms_well, const bool handle_ms_well,
WellStateFullyImplicitBlackoil& state ) const; WellStateFullyImplicitBlackoil& state ) const;

View File

@ -547,7 +547,7 @@ namespace Opm {
const size_t numCells = Opm::UgGridHelpers::numCells(grid()); const size_t numCells = Opm::UgGridHelpers::numCells(grid());
const bool handle_ms_well = (param_.use_multisegment_well_ && anyMSWellOpenLocal()); const bool handle_ms_well = (param_.use_multisegment_well_ && anyMSWellOpenLocal());
well_state_.resize(wells_ecl_, schedule(), handle_ms_well, numCells, phaseUsage, well_perf_data_, summaryState, globalNumWells); // Resize for restart step well_state_.resize(wells_ecl_, schedule(), handle_ms_well, numCells, phaseUsage, well_perf_data_, summaryState, globalNumWells); // Resize for restart step
wellsToState(restartValues.wells, phaseUsage, handle_ms_well, well_state_); wellsToState(restartValues.wells, restartValues.groups, phaseUsage, handle_ms_well, well_state_);
} }
previous_well_state_ = well_state_; previous_well_state_ = well_state_;
@ -1599,10 +1599,13 @@ namespace Opm {
void void
BlackoilWellModel<TypeTag>:: BlackoilWellModel<TypeTag>::
wellsToState( const data::Wells& wells, wellsToState( const data::Wells& wells,
const data::GroupValues& groupValues,
const PhaseUsage& phases, const PhaseUsage& phases,
const bool handle_ms_well, const bool handle_ms_well,
WellStateFullyImplicitBlackoil& state) const WellStateFullyImplicitBlackoil& state) const
{ {
using GPMode = Group::ProductionCMode;
using GIMode = Group::InjectionCMode;
using rt = data::Rates::opt; using rt = data::Rates::opt;
const auto np = phases.num_phases; const auto np = phases.num_phases;
@ -1692,6 +1695,24 @@ namespace Opm {
} }
} }
} }
for (const auto& [group, value] : groupValues) {
const auto cpc = value.currentControl.currentProdConstraint;
const auto cgi = value.currentControl.currentGasInjectionConstraint;
const auto cwi = value.currentControl.currentWaterInjectionConstraint;
if (cpc != GPMode::NONE) {
state.setCurrentProductionGroupControl(group, cpc);
}
if (cgi != GIMode::NONE) {
state.setCurrentInjectionGroupControl(Phase::GAS, group, cgi);
}
if (cwi != GIMode::NONE) {
state.setCurrentInjectionGroupControl(Phase::WATER, group, cwi);
}
}
} }