avoid oscilation between ORAT and LRAT when they are equal

This commit is contained in:
Tor Harald Sandve 2022-09-28 15:18:23 +02:00
parent eb0a516ff0
commit d21921073b
2 changed files with 21 additions and 2 deletions

View File

@ -996,7 +996,17 @@ checkGroupProductionConstraints(const Group& group,
// sum over all nodes
current_rate = comm_.sum(current_rate);
if (controls.liquid_target < current_rate ) {
bool skip = false;
if (controls.liquid_target == controls.oil_target) {
double current_water_rate = WellGroupHelpers::sumWellSurfaceRates(group, schedule(), well_state, reportStepIdx, phase_usage_.phase_pos[BlackoilPhases::Aqua], false);
current_water_rate = comm_.sum(current_water_rate);
if (std::abs(current_water_rate) < 1e-12) {
skip = true;
deferred_logger.debug("LRAT_ORAT_GROUP", "GROUP " + group.name() + " The LRAT target is equal the ORAT target and the water rate is zero, skip checking LRAT");
}
}
if (!skip && controls.liquid_target < current_rate ) {
double scale = 1.0;
if (current_rate > 1e-12)
scale = controls.liquid_target / current_rate;

View File

@ -118,7 +118,16 @@ activeProductionConstraint(const SingleWellState& ws,
if (controls.hasControl(Well::ProducerCMode::LRAT) && currentControl != Well::ProducerCMode::LRAT) {
double current_rate = -ws.surface_rates[pu.phase_pos[BlackoilPhases::Liquid]];
current_rate -= ws.surface_rates[pu.phase_pos[BlackoilPhases::Aqua]];
if (controls.liquid_rate < current_rate)
bool skip = false;
if (controls.liquid_rate == controls.oil_rate) {
const double current_water_rate = ws.surface_rates[pu.phase_pos[BlackoilPhases::Aqua]];
if (std::abs(current_water_rate) < 1e-12) {
skip = true;
deferred_logger.debug("LRAT_ORAT_WELL", "Well " + this->name() + " The LRAT target is equal the ORAT target and the water rate is zero, skip checking LRAT");
}
}
if (!skip && controls.liquid_rate < current_rate)
return Well::ProducerCMode::LRAT;
}