2021-05-20 07:20:27 -05:00
|
|
|
/*
|
|
|
|
Copyright 2020 Equinor ASA.
|
|
|
|
|
|
|
|
This file is part of the Open Porous Media project (OPM).
|
|
|
|
|
|
|
|
OPM is free software: you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation, either version 3 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
OPM is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with OPM. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef OPM_GASLIFT_SINGLE_WELL_GENERIC_HEADER_INCLUDED
|
|
|
|
#define OPM_GASLIFT_SINGLE_WELL_GENERIC_HEADER_INCLUDED
|
|
|
|
|
|
|
|
#include <opm/core/props/BlackoilPhases.hpp>
|
|
|
|
|
2023-01-18 04:56:21 -06:00
|
|
|
#include <opm/input/eclipse/Schedule/Well/WellProductionControls.hpp>
|
2021-05-27 01:31:49 -05:00
|
|
|
#include <opm/simulators/wells/GasLiftGroupInfo.hpp>
|
Improve debugging tools in gaslift code.
Introduces a gaslift debugging variable in ALQState in WellState. This
variable will persist between timesteps in contrast to when debugging
variables are defined in GasLiftSingleWell, GasLiftGroupState, or GasLiftStage2.
Currently only an integer variable debug_counter is added to ALQState,
which can be used as follows: First debugging is switched on globally
for BlackOilWellModel, GasLiftSingleWell, GasLiftGroupState, and
GasLiftStage2 by setting glift_debug to a true value in BlackOilWellModelGeneric.
Then, the following debugging code can be added to e.g. one of
GasLiftSingleWell, GasLiftGroupState, or GasLiftStage2 :
auto count = debugUpdateGlobalCounter_();
if (count == some_integer) {
displayDebugMessage_("stop here");
}
Here, the integer "some_integer" is determined typically by looking at
the debugging output of a previous run. This can be done since the
call to debugUpdateGlobalCounter_() will print out the current value
of the counter and then increment the counter by one. And it will be
easy to recognize these values in the debug ouput. If you find a place
in the output that looks suspect, just take a note of the counter
value in the output around that point and insert the value for
"some_integer", then after recompiling the code with the desired value
for "some_integer", it is now easy to set a breakpoint in GDB at the
line
displayDebugMessage_("stop here").
shown in the above snippet. This should improve the ability to quickly
to set a breakpoint in GDB around at a given time and point in the simulation.
2022-01-23 13:37:26 -06:00
|
|
|
#include <opm/simulators/wells/GasLiftCommon.hpp>
|
2021-05-20 07:20:27 -05:00
|
|
|
|
|
|
|
#include <optional>
|
2023-12-11 08:54:28 -06:00
|
|
|
#include <set>
|
|
|
|
#include <stdexcept>
|
2021-05-20 07:20:27 -05:00
|
|
|
#include <string>
|
|
|
|
#include <tuple>
|
|
|
|
#include <utility>
|
|
|
|
|
2024-02-20 01:24:50 -06:00
|
|
|
namespace Opm {
|
2021-05-20 07:20:27 -05:00
|
|
|
|
|
|
|
class DeferredLogger;
|
2023-01-09 06:54:30 -06:00
|
|
|
class GasLiftWell;
|
2024-02-19 08:46:29 -06:00
|
|
|
template<class Scalar> class GasLiftWellState;
|
2021-05-20 07:20:27 -05:00
|
|
|
class Schedule;
|
|
|
|
class SummaryState;
|
2024-02-19 07:34:38 -06:00
|
|
|
template<class Scalar> class WellInterfaceGeneric;
|
2024-02-17 11:13:46 -06:00
|
|
|
template<class Scalar> class WellState;
|
2024-02-17 11:13:46 -06:00
|
|
|
template<class Scalar> class GroupState;
|
2021-05-20 07:20:27 -05:00
|
|
|
|
2024-02-20 01:24:50 -06:00
|
|
|
template<class Scalar>
|
|
|
|
class GasLiftSingleWellGeneric : public GasLiftCommon<Scalar>
|
2021-05-20 07:20:27 -05:00
|
|
|
{
|
2021-05-24 04:24:14 -05:00
|
|
|
protected:
|
2022-02-17 02:15:56 -06:00
|
|
|
static constexpr int Water = BlackoilPhases::Aqua;
|
|
|
|
static constexpr int Oil = BlackoilPhases::Liquid;
|
|
|
|
static constexpr int Gas = BlackoilPhases::Vapour;
|
|
|
|
static constexpr int NUM_PHASES = 3;
|
2024-02-20 01:24:50 -06:00
|
|
|
static constexpr Scalar ALQ_EPSILON = 1e-8;
|
2021-05-20 07:20:27 -05:00
|
|
|
|
|
|
|
public:
|
2021-05-27 01:31:49 -05:00
|
|
|
using GLiftSyncGroups = std::set<int>;
|
2024-02-20 01:24:50 -06:00
|
|
|
using Rate = typename GasLiftGroupInfo<Scalar>::Rate;
|
|
|
|
using MessageType = typename GasLiftCommon<Scalar>::MessageType;
|
|
|
|
|
2021-05-20 07:20:27 -05:00
|
|
|
struct GradInfo
|
|
|
|
{
|
2024-02-20 01:24:50 -06:00
|
|
|
GradInfo() = default;
|
|
|
|
GradInfo(Scalar grad_,
|
|
|
|
Scalar new_oil_rate_,
|
|
|
|
bool oil_is_limited_,
|
|
|
|
Scalar new_gas_rate_,
|
|
|
|
bool gas_is_limited_,
|
|
|
|
Scalar new_water_rate_,
|
|
|
|
bool water_is_limited_,
|
|
|
|
Scalar alq_,
|
|
|
|
bool alq_is_limited_)
|
|
|
|
: grad{grad_}
|
|
|
|
, new_oil_rate{new_oil_rate_}
|
|
|
|
, oil_is_limited{oil_is_limited_}
|
|
|
|
, new_gas_rate{new_gas_rate_}
|
|
|
|
, gas_is_limited{gas_is_limited_}
|
|
|
|
, new_water_rate{new_water_rate_}
|
|
|
|
, water_is_limited{water_is_limited_}
|
|
|
|
, alq{alq_}
|
|
|
|
, alq_is_limited{alq_is_limited_}
|
|
|
|
{}
|
|
|
|
|
|
|
|
Scalar grad;
|
|
|
|
Scalar new_oil_rate;
|
2021-05-20 07:20:27 -05:00
|
|
|
bool oil_is_limited;
|
2024-02-20 01:24:50 -06:00
|
|
|
Scalar new_gas_rate;
|
2021-05-20 07:20:27 -05:00
|
|
|
bool gas_is_limited;
|
2024-02-20 01:24:50 -06:00
|
|
|
Scalar new_water_rate;
|
2022-02-08 08:46:08 -06:00
|
|
|
bool water_is_limited;
|
2024-02-20 01:24:50 -06:00
|
|
|
Scalar alq;
|
2021-05-20 07:20:27 -05:00
|
|
|
bool alq_is_limited;
|
|
|
|
};
|
|
|
|
|
|
|
|
virtual ~GasLiftSingleWellGeneric() = default;
|
|
|
|
|
|
|
|
const std::string& name() const { return well_name_; }
|
|
|
|
|
2024-02-20 01:24:50 -06:00
|
|
|
std::optional<GradInfo> calcIncOrDecGradient(Scalar oil_rate,
|
|
|
|
Scalar gas_rate,
|
|
|
|
Scalar water_rate,
|
|
|
|
Scalar alq,
|
2022-11-16 02:18:35 -06:00
|
|
|
const std::string& gr_name_dont_limit,
|
2023-03-02 01:23:15 -06:00
|
|
|
bool increase,
|
2024-02-20 01:24:50 -06:00
|
|
|
bool debug_output = true) const;
|
2021-05-20 07:20:27 -05:00
|
|
|
|
2024-02-20 01:24:50 -06:00
|
|
|
std::unique_ptr<GasLiftWellState<Scalar>> runOptimize(const int iteration_idx);
|
2021-05-20 07:20:27 -05:00
|
|
|
|
2024-02-19 07:34:38 -06:00
|
|
|
virtual const WellInterfaceGeneric<Scalar>& getWell() const = 0;
|
2021-05-24 16:56:14 -05:00
|
|
|
|
2021-05-20 07:20:27 -05:00
|
|
|
protected:
|
2024-02-20 01:24:50 -06:00
|
|
|
GasLiftSingleWellGeneric(DeferredLogger& deferred_logger,
|
|
|
|
WellState<Scalar>& well_state,
|
|
|
|
const GroupState<Scalar>& group_state,
|
|
|
|
const Well& ecl_well,
|
|
|
|
const SummaryState& summary_state,
|
|
|
|
GasLiftGroupInfo<Scalar>& group_info,
|
|
|
|
const PhaseUsage& phase_usage,
|
|
|
|
const Schedule& schedule,
|
|
|
|
const int report_step_idx,
|
|
|
|
GLiftSyncGroups& sync_groups,
|
|
|
|
const Parallel::Communication& comm,
|
|
|
|
bool glift_debug);
|
2021-05-20 07:20:27 -05:00
|
|
|
|
2022-01-25 15:05:46 -06:00
|
|
|
struct LimitedRates;
|
|
|
|
struct BasicRates
|
|
|
|
{
|
|
|
|
BasicRates(const BasicRates& rates) :
|
|
|
|
oil{rates.oil},
|
|
|
|
gas{rates.gas},
|
|
|
|
water{rates.water},
|
|
|
|
bhp_is_limited{rates.bhp_is_limited}
|
|
|
|
{}
|
2024-02-20 01:24:50 -06:00
|
|
|
|
|
|
|
BasicRates(Scalar oil_,
|
|
|
|
Scalar gas_,
|
|
|
|
Scalar water_,
|
|
|
|
bool bhp_is_limited_)
|
|
|
|
: oil{oil_}
|
|
|
|
, gas{gas_}
|
|
|
|
, water{water_}
|
|
|
|
, bhp_is_limited{bhp_is_limited_}
|
2022-01-25 15:05:46 -06:00
|
|
|
{}
|
2024-02-20 01:24:50 -06:00
|
|
|
|
|
|
|
BasicRates& operator=(const BasicRates& rates)
|
|
|
|
{
|
2022-01-25 15:05:46 -06:00
|
|
|
oil = rates.oil;
|
|
|
|
gas = rates.gas;
|
|
|
|
water = rates.water;
|
|
|
|
bhp_is_limited = rates.bhp_is_limited;
|
|
|
|
return *this;
|
|
|
|
}
|
2024-02-20 01:24:50 -06:00
|
|
|
|
2022-01-25 15:05:46 -06:00
|
|
|
// This copy constructor cannot be defined inline here since LimitedRates
|
|
|
|
// has not been defined yet (it is defined below). Instead it is defined in
|
|
|
|
// in the .cpp file
|
|
|
|
BasicRates(const LimitedRates& rates);
|
2024-02-20 01:24:50 -06:00
|
|
|
|
|
|
|
Scalar operator[](Rate rate_type) const
|
|
|
|
{
|
2022-01-25 15:05:46 -06:00
|
|
|
switch (rate_type) {
|
|
|
|
case Rate::oil:
|
|
|
|
return this->oil;
|
|
|
|
case Rate::gas:
|
|
|
|
return this->gas;
|
|
|
|
case Rate::water:
|
|
|
|
return this->water;
|
|
|
|
case Rate::liquid:
|
|
|
|
return this->oil + this->water;
|
|
|
|
default:
|
|
|
|
throw std::runtime_error("This should not happen");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-02-20 01:24:50 -06:00
|
|
|
Scalar oil, gas, water;
|
2022-01-25 15:05:46 -06:00
|
|
|
bool bhp_is_limited;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct LimitedRates : public BasicRates
|
|
|
|
{
|
|
|
|
enum class LimitType {well, group, none};
|
2024-02-20 01:24:50 -06:00
|
|
|
LimitedRates(Scalar oil_,
|
|
|
|
Scalar gas_,
|
|
|
|
Scalar water_,
|
|
|
|
bool oil_is_limited_,
|
|
|
|
bool gas_is_limited_,
|
|
|
|
bool water_is_limited_,
|
|
|
|
bool bhp_is_limited_,
|
|
|
|
std::optional<Rate> oil_limiting_target_,
|
|
|
|
std ::optional<Rate> water_limiting_target_)
|
|
|
|
: BasicRates(oil_, gas_, water_, bhp_is_limited_)
|
|
|
|
, oil_is_limited{oil_is_limited_}
|
|
|
|
, gas_is_limited{gas_is_limited_}
|
|
|
|
, water_is_limited{water_is_limited_}
|
|
|
|
, oil_limiting_target{oil_limiting_target_}
|
|
|
|
, water_limiting_target{water_limiting_target_}
|
2022-01-25 15:05:46 -06:00
|
|
|
{
|
|
|
|
set_initial_limit_type_();
|
|
|
|
}
|
|
|
|
|
2024-02-20 01:24:50 -06:00
|
|
|
LimitedRates(const BasicRates& rates,
|
|
|
|
bool oil_is_limited_,
|
|
|
|
bool gas_is_limited_,
|
|
|
|
bool water_is_limited_)
|
|
|
|
: BasicRates(rates)
|
|
|
|
, oil_is_limited{oil_is_limited_}
|
|
|
|
, gas_is_limited{gas_is_limited_}
|
|
|
|
, water_is_limited{water_is_limited_}
|
2022-01-25 15:05:46 -06:00
|
|
|
{
|
|
|
|
set_initial_limit_type_();
|
|
|
|
}
|
|
|
|
|
2024-02-20 01:24:50 -06:00
|
|
|
bool limited() const
|
|
|
|
{
|
2022-01-25 15:05:46 -06:00
|
|
|
return oil_is_limited || gas_is_limited || water_is_limited;
|
|
|
|
}
|
2024-02-20 01:24:50 -06:00
|
|
|
|
2022-01-25 15:05:46 -06:00
|
|
|
// For a given ALQ value, were the rates limited due to group targets
|
|
|
|
// or due to well targets?
|
|
|
|
LimitType limit_type;
|
|
|
|
bool oil_is_limited;
|
|
|
|
bool gas_is_limited;
|
|
|
|
bool water_is_limited;
|
|
|
|
std::optional<Rate> oil_limiting_target;
|
|
|
|
std::optional<Rate> water_limiting_target;
|
2024-02-20 01:24:50 -06:00
|
|
|
|
2022-01-25 15:05:46 -06:00
|
|
|
private:
|
2024-02-20 01:24:50 -06:00
|
|
|
void set_initial_limit_type_()
|
|
|
|
{
|
2022-01-25 15:05:46 -06:00
|
|
|
limit_type = limited() ? LimitType::well : LimitType::none;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2021-05-20 07:20:27 -05:00
|
|
|
struct OptimizeState
|
|
|
|
{
|
2024-02-20 01:24:50 -06:00
|
|
|
OptimizeState( GasLiftSingleWellGeneric& parent_, bool increase_ )
|
|
|
|
: parent{parent_}
|
|
|
|
, increase{increase_}
|
|
|
|
, it{0}
|
|
|
|
, stop_iteration{false}
|
|
|
|
, bhp{-1}
|
2021-05-20 07:20:27 -05:00
|
|
|
{}
|
|
|
|
|
|
|
|
GasLiftSingleWellGeneric& parent;
|
|
|
|
bool increase;
|
|
|
|
int it;
|
|
|
|
bool stop_iteration;
|
2024-02-20 01:24:50 -06:00
|
|
|
Scalar bhp;
|
|
|
|
|
|
|
|
std::pair<std::optional<Scalar>,bool> addOrSubtractAlqIncrement(Scalar alq);
|
|
|
|
Scalar calcEcoGradient(Scalar oil_rate,
|
|
|
|
Scalar new_oil_rate,
|
|
|
|
Scalar gas_rate,
|
|
|
|
Scalar new_gas_rate);
|
|
|
|
|
|
|
|
bool checkAlqOutsideLimits(Scalar alq, Scalar oil_rate);
|
|
|
|
bool checkEcoGradient(Scalar gradient);
|
|
|
|
bool checkOilRateExceedsTarget(Scalar oil_rate);
|
2022-01-25 15:05:46 -06:00
|
|
|
bool checkRatesViolated(const LimitedRates& rates) const;
|
2024-02-20 01:24:50 -06:00
|
|
|
|
|
|
|
void debugShowIterationInfo(Scalar alq);
|
|
|
|
|
|
|
|
Scalar getBhpWithLimit();
|
|
|
|
|
|
|
|
void warn_(const std::string& msg) { parent.displayWarning_(msg); }
|
2021-05-20 07:20:27 -05:00
|
|
|
};
|
2024-02-20 01:24:50 -06:00
|
|
|
|
|
|
|
bool checkGroupALQrateExceeded(Scalar delta_alq,
|
|
|
|
const std::string& gr_name_dont_limit = "") const;
|
|
|
|
bool checkGroupTotalRateExceeded(Scalar delta_alq,
|
|
|
|
Scalar delta_gas_rate) const;
|
|
|
|
|
|
|
|
std::pair<std::optional<Scalar>, bool>
|
|
|
|
addOrSubtractAlqIncrement_(Scalar alq, bool increase) const;
|
|
|
|
|
|
|
|
Scalar calcEcoGradient_(Scalar oil_rate, Scalar new_oil_rate,
|
|
|
|
Scalar gas_rate, Scalar new_gas_rate, bool increase) const;
|
|
|
|
|
|
|
|
bool checkALQequal_(Scalar alq1, Scalar alq2) const;
|
|
|
|
|
|
|
|
bool checkGroupTargetsViolated(const BasicRates& rates,
|
|
|
|
const BasicRates& new_rates) const;
|
|
|
|
bool checkInitialALQmodified_(Scalar alq, Scalar initial_alq) const;
|
|
|
|
|
2022-09-02 05:11:39 -05:00
|
|
|
virtual bool checkThpControl_() const = 0;
|
2024-02-20 01:24:50 -06:00
|
|
|
virtual std::optional<Scalar > computeBhpAtThpLimit_(Scalar alq,
|
|
|
|
bool debug_output = true) const = 0;
|
|
|
|
|
|
|
|
std::pair<std::optional<Scalar>,Scalar>
|
|
|
|
computeConvergedBhpAtThpLimitByMaybeIncreasingALQ_() const;
|
|
|
|
|
|
|
|
std::pair<std::optional<BasicRates>,Scalar>
|
|
|
|
computeInitialWellRates_() const;
|
|
|
|
|
|
|
|
std::optional<LimitedRates>
|
|
|
|
computeLimitedWellRatesWithALQ_(Scalar alq) const;
|
|
|
|
|
|
|
|
virtual BasicRates computeWellRates_(Scalar bhp,
|
|
|
|
bool bhp_is_limited,
|
|
|
|
bool debug_output = true) const = 0;
|
|
|
|
|
|
|
|
std::optional<BasicRates> computeWellRatesWithALQ_(Scalar alq) const;
|
|
|
|
|
|
|
|
void debugCheckNegativeGradient_(Scalar grad, Scalar alq, Scalar new_alq,
|
|
|
|
Scalar oil_rate, Scalar new_oil_rate,
|
|
|
|
Scalar gas_rate, Scalar new_gas_rate,
|
2021-11-04 07:12:05 -05:00
|
|
|
bool increase) const;
|
2024-02-20 01:24:50 -06:00
|
|
|
|
2022-02-01 05:55:04 -06:00
|
|
|
void debugPrintWellStateRates() const;
|
2021-05-20 07:20:27 -05:00
|
|
|
void debugShowAlqIncreaseDecreaseCounts_();
|
|
|
|
void debugShowBhpAlqTable_();
|
2022-01-25 15:05:46 -06:00
|
|
|
void debugShowLimitingTargets_(const LimitedRates& rates) const;
|
2022-02-07 04:28:35 -06:00
|
|
|
void debugShowProducerControlMode() const;
|
2024-02-20 01:24:50 -06:00
|
|
|
void debugShowStartIteration_(Scalar alq, bool increase, Scalar oil_rate);
|
2021-05-20 07:20:27 -05:00
|
|
|
void debugShowTargets_();
|
Improve debugging tools in gaslift code.
Introduces a gaslift debugging variable in ALQState in WellState. This
variable will persist between timesteps in contrast to when debugging
variables are defined in GasLiftSingleWell, GasLiftGroupState, or GasLiftStage2.
Currently only an integer variable debug_counter is added to ALQState,
which can be used as follows: First debugging is switched on globally
for BlackOilWellModel, GasLiftSingleWell, GasLiftGroupState, and
GasLiftStage2 by setting glift_debug to a true value in BlackOilWellModelGeneric.
Then, the following debugging code can be added to e.g. one of
GasLiftSingleWell, GasLiftGroupState, or GasLiftStage2 :
auto count = debugUpdateGlobalCounter_();
if (count == some_integer) {
displayDebugMessage_("stop here");
}
Here, the integer "some_integer" is determined typically by looking at
the debugging output of a previous run. This can be done since the
call to debugUpdateGlobalCounter_() will print out the current value
of the counter and then increment the counter by one. And it will be
easy to recognize these values in the debug ouput. If you find a place
in the output that looks suspect, just take a note of the counter
value in the output around that point and insert the value for
"some_integer", then after recompiling the code with the desired value
for "some_integer", it is now easy to set a breakpoint in GDB at the
line
displayDebugMessage_("stop here").
shown in the above snippet. This should improve the ability to quickly
to set a breakpoint in GDB around at a given time and point in the simulation.
2022-01-23 13:37:26 -06:00
|
|
|
void displayDebugMessage_(const std::string& msg) const override;
|
2021-05-20 07:20:27 -05:00
|
|
|
void displayWarning_(const std::string& warning);
|
2024-02-20 01:24:50 -06:00
|
|
|
|
|
|
|
std::pair<Scalar, bool> getBhpWithLimit_(Scalar bhp) const;
|
|
|
|
std::pair<Scalar, bool> getGasRateWithLimit_(const BasicRates& rates) const;
|
|
|
|
std::pair<Scalar, bool> getGasRateWithGroupLimit_(Scalar new_gas_rate,
|
|
|
|
Scalar gas_rate,
|
|
|
|
const std::string& gr_name_dont_limit) const;
|
|
|
|
|
|
|
|
std::pair<std::optional<LimitedRates>,Scalar >
|
|
|
|
getInitialRatesWithLimit_() const;
|
|
|
|
|
2022-01-25 15:05:46 -06:00
|
|
|
LimitedRates getLimitedRatesFromRates_(const BasicRates& rates) const;
|
2024-02-20 01:24:50 -06:00
|
|
|
|
|
|
|
std::tuple<Scalar,Scalar,bool,bool>
|
|
|
|
getLiquidRateWithGroupLimit_(const Scalar new_oil_rate,
|
|
|
|
const Scalar oil_rate,
|
|
|
|
const Scalar new_water_rate,
|
|
|
|
const Scalar water_rate,
|
|
|
|
const std::string& gr_name_dont_limit) const;
|
|
|
|
|
|
|
|
std::pair<Scalar, bool>
|
|
|
|
getOilRateWithGroupLimit_(Scalar new_oil_rate,
|
|
|
|
Scalar oil_rate,
|
|
|
|
const std::string& gr_name_dont_limit) const;
|
|
|
|
|
|
|
|
std::pair<Scalar, bool> getOilRateWithLimit_(const BasicRates& rates) const;
|
|
|
|
|
|
|
|
std::pair<Scalar, std::optional<Rate>>
|
|
|
|
getOilRateWithLimit2_(const BasicRates& rates) const;
|
|
|
|
|
|
|
|
Scalar getProductionTarget_(Rate rate) const;
|
|
|
|
Scalar getRate_(Rate rate_type, const BasicRates& rates) const;
|
|
|
|
|
|
|
|
std::pair<Scalar, std::optional<Rate>>
|
|
|
|
getRateWithLimit_(Rate rate_type, const BasicRates& rates) const;
|
|
|
|
|
|
|
|
std::tuple<Scalar, const std::string*, Scalar>
|
|
|
|
getRateWithGroupLimit_(Rate rate_type,
|
|
|
|
const Scalar new_rate,
|
|
|
|
const Scalar old_rate,
|
|
|
|
const std::string& gr_name_dont_limit) const;
|
|
|
|
|
|
|
|
std::pair<Scalar, bool>
|
|
|
|
getWaterRateWithGroupLimit_(Scalar new_water_rate,
|
|
|
|
Scalar water_rate,
|
|
|
|
const std::string& gr_name_dont_limit) const;
|
|
|
|
|
|
|
|
std::pair<Scalar, bool> getWaterRateWithLimit_(const BasicRates& rates) const;
|
|
|
|
|
|
|
|
std::pair<Scalar, std::optional<Rate>>
|
|
|
|
getWaterRateWithLimit2_(const BasicRates& rates) const;
|
|
|
|
|
2022-02-01 05:55:04 -06:00
|
|
|
BasicRates getWellStateRates_() const;
|
2021-12-19 17:29:06 -06:00
|
|
|
bool hasProductionControl_(Rate rate) const;
|
2024-02-20 01:24:50 -06:00
|
|
|
|
|
|
|
std::pair<LimitedRates, Scalar>
|
|
|
|
increaseALQtoPositiveOilRate_(Scalar alq,
|
|
|
|
const LimitedRates& orig_rates) const;
|
|
|
|
|
|
|
|
std::pair<LimitedRates, Scalar>
|
|
|
|
increaseALQtoMinALQ_(Scalar alq,
|
|
|
|
const LimitedRates& orig_rates) const;
|
|
|
|
|
|
|
|
void logSuccess_(Scalar alq,
|
2021-05-20 07:20:27 -05:00
|
|
|
const int iteration_idx);
|
2024-02-20 01:24:50 -06:00
|
|
|
|
|
|
|
std::pair<LimitedRates, Scalar>
|
|
|
|
maybeAdjustALQbeforeOptimizeLoop_(const LimitedRates& rates,
|
|
|
|
Scalar alq,
|
|
|
|
bool increase) const;
|
|
|
|
|
|
|
|
std::pair<LimitedRates, Scalar>
|
|
|
|
reduceALQtoGroupAlqLimits_(Scalar alq,
|
|
|
|
const LimitedRates& rates) const;
|
|
|
|
|
|
|
|
std::pair<LimitedRates, Scalar>
|
|
|
|
reduceALQtoGroupTarget(Scalar alq,
|
|
|
|
const LimitedRates& rates) const;
|
|
|
|
|
|
|
|
std::pair<LimitedRates, Scalar>
|
|
|
|
reduceALQtoWellTarget_(Scalar alq,
|
|
|
|
const LimitedRates& rates) const;
|
|
|
|
|
|
|
|
std::unique_ptr<GasLiftWellState<Scalar>> runOptimize1_();
|
|
|
|
std::unique_ptr<GasLiftWellState<Scalar>> runOptimize2_();
|
|
|
|
std::unique_ptr<GasLiftWellState<Scalar>> runOptimizeLoop_(bool increase);
|
|
|
|
|
2023-01-09 06:50:05 -06:00
|
|
|
void setAlqMinRate_(const GasLiftWell& well);
|
2024-02-20 01:24:50 -06:00
|
|
|
std::unique_ptr<GasLiftWellState<Scalar>> tryIncreaseLiftGas_();
|
|
|
|
std::unique_ptr<GasLiftWellState<Scalar>> tryDecreaseLiftGas_();
|
|
|
|
|
|
|
|
void updateGroupRates_(const LimitedRates& rates,
|
|
|
|
const LimitedRates& new_rates,
|
|
|
|
Scalar delta_alq) const;
|
|
|
|
|
|
|
|
LimitedRates
|
|
|
|
updateRatesToGroupLimits_(const BasicRates& rates,
|
|
|
|
const LimitedRates& new_rates,
|
|
|
|
const std::string& gr_name = "") const;
|
|
|
|
|
2023-01-09 06:50:05 -06:00
|
|
|
void updateWellStateAlqFixedValue_(const GasLiftWell& well);
|
|
|
|
bool useFixedAlq_(const GasLiftWell& well);
|
2024-02-20 01:24:50 -06:00
|
|
|
|
|
|
|
void debugInfoGroupRatesExceedTarget(Rate rate_type,
|
|
|
|
const std::string& gr_name,
|
|
|
|
Scalar rate,
|
|
|
|
Scalar target) const;
|
2021-05-20 07:20:27 -05:00
|
|
|
void warnMaxIterationsExceeded_();
|
|
|
|
|
|
|
|
const Well& ecl_well_;
|
|
|
|
const SummaryState& summary_state_;
|
2024-02-20 01:24:50 -06:00
|
|
|
GasLiftGroupInfo<Scalar>& group_info_;
|
2022-02-01 05:55:04 -06:00
|
|
|
const PhaseUsage& phase_usage_;
|
2021-05-27 01:31:49 -05:00
|
|
|
GLiftSyncGroups& sync_groups_;
|
2023-01-18 04:56:21 -06:00
|
|
|
const WellProductionControls controls_;
|
2021-05-20 07:20:27 -05:00
|
|
|
|
2024-02-20 01:24:50 -06:00
|
|
|
Scalar increment_;
|
|
|
|
Scalar max_alq_;
|
|
|
|
Scalar min_alq_;
|
|
|
|
Scalar orig_alq_;
|
2021-05-20 07:20:27 -05:00
|
|
|
|
2024-02-20 01:24:50 -06:00
|
|
|
Scalar alpha_w_;
|
|
|
|
Scalar alpha_g_;
|
|
|
|
Scalar eco_grad_;
|
2021-05-20 07:20:27 -05:00
|
|
|
|
|
|
|
int gas_pos_;
|
|
|
|
int oil_pos_;
|
|
|
|
int water_pos_;
|
|
|
|
|
|
|
|
int max_iterations_;
|
|
|
|
|
|
|
|
std::string well_name_;
|
|
|
|
|
2023-01-09 06:50:05 -06:00
|
|
|
const GasLiftWell* gl_well_;
|
2021-05-20 07:20:27 -05:00
|
|
|
|
|
|
|
bool optimize_;
|
|
|
|
bool debug_limit_increase_decrease_;
|
|
|
|
bool debug_abort_if_decrease_and_oil_is_limited_ = false;
|
|
|
|
bool debug_abort_if_increase_and_gas_is_limited_ = false;
|
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace Opm
|
|
|
|
|
|
|
|
#endif // OPM_GASLIFT_SINGLE_WELL_GENERIC_HEADER_INCLUDED
|