keep current injection and production control

This commit is contained in:
Tor Harald Sandve 2019-11-06 10:38:56 +01:00
parent 008eb17693
commit 04701580d8
2 changed files with 22 additions and 13 deletions

View File

@ -35,17 +35,21 @@ namespace Opm {
setCmodeGroup( schedule.getGroup2(groupName, reportStepIdx), schedule, summaryState, reportStepIdx, wellState);
}
// use FLD as default control
wellState.setCurrentInjectionGroupControl(group.name(), Group2::InjectionCMode::FLD);
wellState.setCurrentProductionGroupControl(group.name(), Group2::ProductionCMode::FLD);
if (group.isInjectionGroup()) {
const auto controls = group.injectionControls(summaryState);
wellState.setCurrentInjectionGroupControl(group.name(), controls.cmode);
if (!wellState.hasInjectionGroupControl(group.name())) {
// use NONE as default control
wellState.setCurrentInjectionGroupControl(group.name(), Group2::InjectionCMode::NONE);
if (group.isInjectionGroup()) {
const auto controls = group.injectionControls(summaryState);
wellState.setCurrentInjectionGroupControl(group.name(), controls.cmode);
}
}
if (group.isProductionGroup()) {
const auto controls = group.productionControls(summaryState);
wellState.setCurrentProductionGroupControl(group.name(), controls.cmode);
if (!wellState.hasProductionGroupControl(group.name())) {
// use NONE as default control
wellState.setCurrentProductionGroupControl(group.name(), Group2::ProductionCMode::NONE);
if (group.isProductionGroup()) {
const auto controls = group.productionControls(summaryState);
wellState.setCurrentProductionGroupControl(group.name(), controls.cmode);
}
}
}

View File

@ -160,9 +160,6 @@ namespace Opm
current_injection_controls_.resize(nw);
current_production_controls_.resize(nw);
current_injection_group_controls_.clear();
current_production_group_controls_.clear();
perfRateSolvent_.clear();
perfRateSolvent_.resize(nperf, 0.0);
@ -326,6 +323,14 @@ namespace Opm
std::vector<Well2::ProducerCMode>& currentProductionControls() { return current_production_controls_; }
const std::vector<Well2::ProducerCMode>& currentProductionControls() const { return current_production_controls_; }
bool hasProductionGroupControl(const std::string& groupName) {
return current_production_group_controls_.count(groupName) > 0;
}
bool hasInjectionGroupControl(const std::string& groupName) {
return current_injection_group_controls_.count(groupName) > 0;
}
/// One current control per group.
void setCurrentProductionGroupControl(const std::string& groupName, const Group2::ProductionCMode& groupControl ) {
current_production_group_controls_[groupName] = groupControl;