mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
Fix removeSurplus alq
Add water rate target limit Add the gradient to the checkXXXTarget so that surplus alq is removed until it would go below the target. I.e. the group still want to produce it target
This commit is contained in:
parent
cd09c130b3
commit
1a09608263
@ -750,8 +750,9 @@ GasLiftSingleWellGeneric::getRateWithGroupLimit_(Rate rate_type, const double ne
|
||||
double gr_target, new_gr_rate, efficiency;
|
||||
const std::string* group_name = nullptr;
|
||||
for (const auto& [group_name_temp, efficiency_temp] : pairs) {
|
||||
if (gr_name_no_check == group_name_temp)
|
||||
if (gr_name_no_check == group_name_temp) {
|
||||
continue;
|
||||
}
|
||||
|
||||
auto gr_target_opt = this->group_info_.getTarget(rate_type, group_name_temp);
|
||||
if (gr_target_opt) {
|
||||
@ -1251,6 +1252,7 @@ GasLiftSingleWellGeneric::runOptimizeLoop_(bool increase)
|
||||
cur_alq,
|
||||
alq_is_limited,
|
||||
new_rates.water,
|
||||
new_rates.water_is_limited,
|
||||
increase_opt);
|
||||
return ret_value;
|
||||
}
|
||||
|
@ -115,18 +115,19 @@ addOrRemoveALQincrement_(GradMap &grad_map, const std::string& well_name, bool a
|
||||
}
|
||||
state.update(gi.new_oil_rate, gi.oil_is_limited,
|
||||
gi.new_gas_rate, gi.gas_is_limited,
|
||||
gi.alq, gi.alq_is_limited, gi.new_water_rate, add);
|
||||
this->well_state_.setALQ(well_name, gi.alq);
|
||||
const auto& pu = this->well_state_.phaseUsage();
|
||||
std::vector<double> well_pot(pu.num_phases, 0.0);
|
||||
if(pu.phase_used[BlackoilPhases::PhaseIndex::Liquid])
|
||||
well_pot[pu.phase_pos[BlackoilPhases::PhaseIndex::Liquid]] = gi.new_oil_rate;
|
||||
if(pu.phase_used[BlackoilPhases::PhaseIndex::Aqua])
|
||||
well_pot[pu.phase_pos[BlackoilPhases::PhaseIndex::Aqua]] = gi.new_water_rate;
|
||||
if(pu.phase_used[BlackoilPhases::PhaseIndex::Vapour])
|
||||
well_pot[pu.phase_pos[BlackoilPhases::PhaseIndex::Vapour]] = gi.new_gas_rate;
|
||||
gi.alq, gi.alq_is_limited, gi.new_water_rate, gi.water_is_limited, add);
|
||||
|
||||
this->well_state_[well_name].well_potentials = well_pot;
|
||||
this->well_state_.setALQ(well_name, gi.alq);
|
||||
const auto& pu = this->well_state_.phaseUsage();
|
||||
std::vector<double> well_pot(pu.num_phases, 0.0);
|
||||
if(pu.phase_used[BlackoilPhases::PhaseIndex::Liquid])
|
||||
well_pot[pu.phase_pos[BlackoilPhases::PhaseIndex::Liquid]] = gi.new_oil_rate;
|
||||
if(pu.phase_used[BlackoilPhases::PhaseIndex::Aqua])
|
||||
well_pot[pu.phase_pos[BlackoilPhases::PhaseIndex::Aqua]] = gi.new_water_rate;
|
||||
if(pu.phase_used[BlackoilPhases::PhaseIndex::Vapour])
|
||||
well_pot[pu.phase_pos[BlackoilPhases::PhaseIndex::Vapour]] = gi.new_gas_rate;
|
||||
|
||||
this->well_state_[well_name].well_potentials = well_pot;
|
||||
}
|
||||
|
||||
std::optional<GasLiftStage2::GradInfo>
|
||||
@ -192,7 +193,7 @@ checkRateAlreadyLimited_(GasLiftWellState &state, bool increase)
|
||||
if (increase) do_check = true;
|
||||
}
|
||||
if (do_check) {
|
||||
if (state.gasIsLimited() || state.oilIsLimited() || state.alqIsLimited()) {
|
||||
if (state.gasIsLimited() || state.oilIsLimited() || state.alqIsLimited() || state.waterIsLimited()) {
|
||||
const std::string msg = fmt::format(
|
||||
"{} gradient : skipping since {} was limited in previous step",
|
||||
(increase ? "incremental" : "decremental"),
|
||||
@ -757,7 +758,7 @@ removeSurplusALQ_(const Group &group,
|
||||
displayDebugMessage_(msg);
|
||||
}
|
||||
SurplusState state {*this, group, oil_rate, gas_rate, water_rate, alq,
|
||||
min_eco_grad, controls.oil_target, controls.gas_target,
|
||||
min_eco_grad, controls.oil_target, controls.gas_target, controls.water_target,
|
||||
controls.liquid_target, max_glift };
|
||||
|
||||
while (!stop_iteration) {
|
||||
@ -768,8 +769,8 @@ removeSurplusALQ_(const Group &group,
|
||||
const auto well_name = dec_grad_itr->first;
|
||||
auto eco_grad = dec_grad_itr->second;
|
||||
bool remove = false;
|
||||
if (state.checkOilTarget() || state.checkGasTarget()
|
||||
|| state.checkLiquidTarget() || state.checkALQlimit())
|
||||
if (state.checkOilTarget(eco_grad) || state.checkGasTarget(eco_grad)
|
||||
|| state.checkLiquidTarget(eco_grad) || state.checkWaterTarget(eco_grad) || state.checkALQlimit())
|
||||
{
|
||||
remove = true;
|
||||
}
|
||||
@ -1085,10 +1086,10 @@ checkEcoGradient(const std::string &well_name, double eco_grad)
|
||||
|
||||
bool
|
||||
GasLiftStage2::SurplusState::
|
||||
checkGasTarget()
|
||||
checkGasTarget(double eco_grad)
|
||||
{
|
||||
if (this->group.has_control(Group::ProductionCMode::GRAT)) {
|
||||
if (this->gas_target < this->gas_rate ) {
|
||||
if (this->gas_target < (this->gas_rate - eco_grad) ) {
|
||||
if (this->parent.debug) {
|
||||
const std::string msg = fmt::format("group: {} : "
|
||||
"gas rate {} is greater than gas target {}", this->group.name(),
|
||||
@ -1102,11 +1103,11 @@ checkGasTarget()
|
||||
}
|
||||
bool
|
||||
GasLiftStage2::SurplusState::
|
||||
checkLiquidTarget()
|
||||
checkLiquidTarget(double eco_grad)
|
||||
{
|
||||
if (this->group.has_control(Group::ProductionCMode::LRAT)) {
|
||||
auto liquid_rate = this->oil_rate + this->water_rate;
|
||||
if (this->liquid_target < liquid_rate ) {
|
||||
if (this->liquid_target < (liquid_rate - eco_grad) ) {
|
||||
if (this->parent.debug) {
|
||||
const std::string msg = fmt::format("group: {} : "
|
||||
"liquid rate {} is greater than liquid target {}", this->group.name(),
|
||||
@ -1121,10 +1122,10 @@ checkLiquidTarget()
|
||||
|
||||
bool
|
||||
GasLiftStage2::SurplusState::
|
||||
checkOilTarget()
|
||||
checkOilTarget(double eco_grad)
|
||||
{
|
||||
if (this->group.has_control(Group::ProductionCMode::ORAT)) {
|
||||
if (this->oil_target < this->oil_rate ) {
|
||||
if (this->oil_target < (this->oil_rate - eco_grad) ) {
|
||||
if (this->parent.debug) {
|
||||
const std::string msg = fmt::format("group: {} : "
|
||||
"oil rate {} is greater than oil target {}", this->group.name(),
|
||||
@ -1137,6 +1138,24 @@ checkOilTarget()
|
||||
return false;
|
||||
}
|
||||
|
||||
bool
|
||||
GasLiftStage2::SurplusState::
|
||||
checkWaterTarget(double eco_grad)
|
||||
{
|
||||
if (this->group.has_control(Group::ProductionCMode::WRAT)) {
|
||||
if (this->water_target < (this->water_rate - eco_grad) ) {
|
||||
if (this->parent.debug) {
|
||||
const std::string msg = fmt::format("group: {} : "
|
||||
"water rate {} is greater than oil target {}", this->group.name(),
|
||||
this->water_rate, this->water_target);
|
||||
this->parent.displayDebugMessage_(msg);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void
|
||||
GasLiftStage2::SurplusState::
|
||||
updateRates(const std::string &well_name)
|
||||
|
@ -173,7 +173,7 @@ protected:
|
||||
SurplusState( GasLiftStage2& parent_, const Group& group_,
|
||||
double oil_rate_, double gas_rate_, double water_rate_, double alq_,
|
||||
double min_eco_grad_,
|
||||
double oil_target_, double gas_target_, double liquid_target_,
|
||||
double oil_target_, double gas_target_, double water_target_, double liquid_target_,
|
||||
std::optional<double> max_glift_) :
|
||||
parent{parent_},
|
||||
group{group_},
|
||||
@ -184,6 +184,7 @@ protected:
|
||||
min_eco_grad{min_eco_grad_},
|
||||
oil_target{oil_target_},
|
||||
gas_target{gas_target_},
|
||||
water_target(water_target_),
|
||||
liquid_target{liquid_target_},
|
||||
max_glift{max_glift_},
|
||||
it{0}
|
||||
@ -197,6 +198,7 @@ protected:
|
||||
const double min_eco_grad;
|
||||
const double oil_target;
|
||||
const double gas_target;
|
||||
const double water_target;
|
||||
const double liquid_target;
|
||||
std::optional<double> max_glift;
|
||||
int it;
|
||||
@ -205,9 +207,10 @@ protected:
|
||||
GradMap &grad_map, const std::string& well_name, bool add);
|
||||
bool checkALQlimit();
|
||||
bool checkEcoGradient(const std::string& well_name, double eco_grad);
|
||||
bool checkGasTarget();
|
||||
bool checkLiquidTarget();
|
||||
bool checkOilTarget();
|
||||
bool checkGasTarget(double eco_grad);
|
||||
bool checkLiquidTarget(double eco_grad);
|
||||
bool checkOilTarget(double eco_grad);
|
||||
bool checkWaterTarget(double eco_grad);
|
||||
void updateRates(const std::string& name);
|
||||
};
|
||||
};
|
||||
|
@ -31,7 +31,7 @@ namespace Opm
|
||||
//GasLiftWellState() { }
|
||||
GasLiftWellState(double oil_rate, bool oil_is_limited,
|
||||
double gas_rate, bool gas_is_limited,
|
||||
double alq, bool alq_is_limited, double water_rate, std::optional<bool> increase) :
|
||||
double alq, bool alq_is_limited, double water_rate, bool water_is_limited, std::optional<bool> increase) :
|
||||
oil_rate_{oil_rate},
|
||||
oil_is_limited_{oil_is_limited},
|
||||
gas_rate_{gas_rate},
|
||||
@ -39,6 +39,7 @@ namespace Opm
|
||||
alq_{alq},
|
||||
alq_is_limited_{alq_is_limited},
|
||||
water_rate_{water_rate},
|
||||
water_is_limited_{water_is_limited},
|
||||
increase_{increase}
|
||||
{}
|
||||
double alq() const { return alq_; }
|
||||
@ -51,9 +52,11 @@ namespace Opm
|
||||
bool oilIsLimited() const { return oil_is_limited_; }
|
||||
double oilRate() const { return oil_rate_; }
|
||||
double waterRate() const { return water_rate_; }
|
||||
bool waterIsLimited() const { return water_is_limited_; }
|
||||
void update(double oil_rate, bool oil_is_limited,
|
||||
double gas_rate, bool gas_is_limited,
|
||||
double alq, bool alq_is_limited, double water_rate,
|
||||
double water_is_limited,
|
||||
bool increase)
|
||||
{
|
||||
oil_rate_ = oil_rate;
|
||||
@ -63,6 +66,7 @@ namespace Opm
|
||||
alq_ = alq;
|
||||
alq_is_limited_ = alq_is_limited;
|
||||
water_rate_ = water_rate;
|
||||
water_is_limited_ = water_is_limited;
|
||||
increase_ = increase;
|
||||
}
|
||||
private:
|
||||
@ -73,6 +77,7 @@ namespace Opm
|
||||
double alq_;
|
||||
bool alq_is_limited_;
|
||||
double water_rate_;
|
||||
bool water_is_limited_;
|
||||
std::optional<bool> increase_;
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user