Merge pull request #2175 from totto82/fixGRUPInit

fix issue when GRUP is used in WCONPROD and WCONINJE and NONE
This commit is contained in:
Atgeirr Flø Rasmussen 2019-12-04 12:31:37 +01:00 committed by GitHub
commit 8690a71aac
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 29 additions and 9 deletions

View File

@ -1998,8 +1998,12 @@ namespace Opm
return; return;
} }
if (!group.isInjectionGroup()) if (!group.isInjectionGroup() || currentGroupControl == Group::InjectionCMode::NONE) {
// use bhp as control eq and let the updateControl code find a valid control
const auto& controls = well.injectionControls(summaryState);
control_eq = getSegmentPressure(0) - controls.bhp_limit;
return; return;
}
const auto& groupcontrols = group.injectionControls(summaryState); const auto& groupcontrols = group.injectionControls(summaryState);
@ -2045,7 +2049,8 @@ namespace Opm
switch(currentGroupControl) { switch(currentGroupControl) {
case Group::InjectionCMode::NONE: case Group::InjectionCMode::NONE:
{ {
OPM_DEFLOG_THROW(std::runtime_error, "NONE group control not implemented for injectors" , deferred_logger); // The NONE case is handled earlier
assert(false);
break; break;
} }
case Group::InjectionCMode::RATE: case Group::InjectionCMode::RATE:
@ -2119,8 +2124,12 @@ namespace Opm
assembleGroupProductionControl(parent, well_state, schedule, summaryState, control_eq, efficiencyFactor, deferred_logger); assembleGroupProductionControl(parent, well_state, schedule, summaryState, control_eq, efficiencyFactor, deferred_logger);
return; return;
} }
if (!group.isProductionGroup()) if (!group.isProductionGroup() || currentGroupControl == Group::ProductionCMode::NONE) {
// use bhp as control eq and let the updateControl code find a vallied control
const auto& controls = well.productionControls(summaryState);
control_eq = getSegmentPressure(0) - controls.bhp_limit;
return; return;
}
const auto& groupcontrols = group.productionControls(summaryState); const auto& groupcontrols = group.productionControls(summaryState);
const std::vector<double>& groupTargetReductions = well_state.currentProductionGroupReductionRates(group.name()); const std::vector<double>& groupTargetReductions = well_state.currentProductionGroupReductionRates(group.name());
@ -2128,7 +2137,8 @@ namespace Opm
switch(currentGroupControl) { switch(currentGroupControl) {
case Group::ProductionCMode::NONE: case Group::ProductionCMode::NONE:
{ {
OPM_DEFLOG_THROW(std::runtime_error, "NONE group control not implemented for producers" , deferred_logger); // The NONE case is handled earlier
assert(false);
break; break;
} }
case Group::ProductionCMode::ORAT: case Group::ProductionCMode::ORAT:

View File

@ -984,8 +984,13 @@ namespace Opm
return; return;
} }
if (!group.isInjectionGroup()) if (!group.isInjectionGroup() || currentGroupControl == Group::InjectionCMode::NONE) {
// use bhp as control eq and let the updateControl code find a valid control
const auto& controls = well.injectionControls(summaryState);
control_eq = getBhp() - controls.bhp_limit;
return; return;
}
int phasePos; int phasePos;
Well::GuideRateTarget wellTarget; Well::GuideRateTarget wellTarget;
@ -1025,7 +1030,8 @@ namespace Opm
switch(currentGroupControl) { switch(currentGroupControl) {
case Group::InjectionCMode::NONE: case Group::InjectionCMode::NONE:
{ {
OPM_DEFLOG_THROW(std::runtime_error, "NONE group control not implemented for injectors" , deferred_logger); // The NONE case is handled earlier
assert(false);
break; break;
} }
case Group::InjectionCMode::RATE: case Group::InjectionCMode::RATE:
@ -1113,8 +1119,12 @@ namespace Opm
return; return;
} }
if (!group.isProductionGroup()) if (!group.isProductionGroup() || currentGroupControl == Group::ProductionCMode::NONE) {
// use bhp as control eq and let the updateControl code find a vallied control
const auto& controls = well.productionControls(summaryState);
control_eq = getBhp() - controls.bhp_limit;
return; return;
}
const auto& groupcontrols = group.productionControls(summaryState); const auto& groupcontrols = group.productionControls(summaryState);
@ -1123,8 +1133,8 @@ namespace Opm
switch(currentGroupControl) { switch(currentGroupControl) {
case Group::ProductionCMode::NONE: case Group::ProductionCMode::NONE:
{ {
OPM_DEFLOG_THROW(std::runtime_error, "NONE group control not implemented for producers" , deferred_logger); // The NONE case is handled earlier
break; assert(false);
} }
case Group::ProductionCMode::ORAT: case Group::ProductionCMode::ORAT:
{ {