Merge pull request #5026 from totto82/fix_gpmaint2

Bugfix sign of gpmaint prod
This commit is contained in:
Bård Skaflestad 2023-11-28 11:16:03 +01:00 committed by GitHub
commit 5fe1eafb34
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 1 deletions

View File

@ -712,11 +712,13 @@ namespace WellGroupHelpers
double current_rate = 0.0; double current_rate = 0.0;
const auto& pu = well_state.phaseUsage(); const auto& pu = well_state.phaseUsage();
bool injection = true; bool injection = true;
double sign = 1.0;
switch (gpm->flow_target()) { switch (gpm->flow_target()) {
case GPMaint::FlowTarget::RESV_PROD: case GPMaint::FlowTarget::RESV_PROD:
{ {
current_rate = -group_state.injection_vrep_rate(group.name()); current_rate = -group_state.injection_vrep_rate(group.name());
injection = false; injection = false;
sign = -1.0;
break; break;
} }
case GPMaint::FlowTarget::RESV_OINJ: case GPMaint::FlowTarget::RESV_OINJ:
@ -768,7 +770,7 @@ namespace WellGroupHelpers
// (i.e. error > 0) and higher for producers. // (i.e. error > 0) and higher for producers.
bool activate = (injection && error > 0) || (!injection && error < 0); bool activate = (injection && error > 0) || (!injection && error < 0);
double rate = activate? gpm->rate(gpmaint_state, current_rate, error, dt) : 0.0; double rate = activate? gpm->rate(gpmaint_state, current_rate, error, dt) : 0.0;
group_state.update_gpmaint_target(group.name(), rate); group_state.update_gpmaint_target(group.name(), std::max(0.0, sign * rate));
} }

View File

@ -499,6 +499,13 @@ add_test_compareECLFiles(CASENAME waghyst2
REL_TOL ${rel_tol} REL_TOL ${rel_tol}
DIR waghystr) DIR waghystr)
add_test_compareECLFiles(CASENAME gpmaint11
FILENAME GPMAINT-11
SIMULATOR flow
ABS_TOL ${abs_tol}
REL_TOL ${rel_tol}
DIR gpmaint)
set(_pinch_cases set(_pinch_cases
T1A_GAP T1A_NOGAP T1A_NOPINCH T1A_GAP T1A_NOGAP T1A_NOPINCH
T1A1_NOGAP T1A1_NOGAP