Check group limits in gas lift stage 1.

Check group limits in gas lift stage 1 to avoid adding too much ALQ which must
anyway later be removed in stage 2. This should make the optimization
more efficient for small ALQ increment values. Also adds MPI support.
This commit is contained in:
Håkon Hægland
2021-05-27 08:31:49 +02:00
parent 969fc20154
commit fbb24e2a5a
18 changed files with 1586 additions and 608 deletions

View File

@@ -20,10 +20,14 @@
#ifndef OPM_GASLIFT_SINGLE_WELL_GENERIC_HEADER_INCLUDED
#define OPM_GASLIFT_SINGLE_WELL_GENERIC_HEADER_INCLUDED
#include <dune/common/version.hh>
#include <dune/common/parallel/mpihelper.hh>
#include <opm/core/props/BlackoilPhases.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/GasLiftOpt.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/Well/Well.hpp>
#include <opm/simulators/wells/GasLiftGroupInfo.hpp>
#include <functional>
#include <optional>
@@ -51,6 +55,7 @@ protected:
static constexpr double ALQ_EPSILON = 1e-8;
public:
using GLiftSyncGroups = std::set<int>;
struct GradInfo
{
GradInfo() { }
@@ -86,12 +91,16 @@ public:
virtual const WellInterfaceGeneric& getStdWell() const = 0;
protected:
GasLiftSingleWellGeneric(DeferredLogger &deferred_logger,
WellState &well_state,
const Well& ecl_well,
const SummaryState& summary_state,
const Schedule& schedule,
const int report_step_idx);
GasLiftSingleWellGeneric(
DeferredLogger &deferred_logger,
WellState &well_state,
const Well& ecl_well,
const SummaryState& summary_state,
GasLiftGroupInfo &group_info,
const Schedule& schedule,
const int report_step_idx,
GLiftSyncGroups &sync_groups
);
struct OptimizeState
{
@@ -114,6 +123,8 @@ protected:
double gas_rate, double new_gas_rate);
bool checkAlqOutsideLimits(double alq, double oil_rate);
bool checkEcoGradient(double gradient);
bool checkGroupALQrateExceeded(double delta_alq);
bool checkGroupTargetsViolated(double delta_oil, double delta_gas);
bool checkNegativeOilRate(double oil_rate);
bool checkOilRateExceedsTarget(double oil_rate);
bool checkRate(double rate, double limit, const std::string &rate_str) const;
@@ -121,6 +132,7 @@ protected:
bool computeBhpAtThpLimit(double alq);
void debugShowIterationInfo(double alq);
double getBhpWithLimit();
void updateGroupRates(double delta_oil, double delta_gas, double delta_alq);
void warn_(std::string msg) {parent.displayWarning_(msg);}
};
@@ -183,15 +195,13 @@ protected:
void logSuccess_(double alq,
const int iteration_idx);
std::tuple<double,double,double,bool,bool>
maybeAdjustALQbeforeOptimizeLoop_(
bool increase, double alq, double oil_rate, double gas_rate,
bool oil_is_limited, bool gas_is_limited, std::vector<double> &potentials);
std::tuple<double,double,bool,bool,double>
reduceALQtoOilTarget_(double alq,
double oil_rate,
double gas_rate,
bool oil_is_limited,
bool gas_is_limited,
std::vector<double>& potentials);
reduceALQtoOilTarget_(double alq, double oil_rate, double gas_rate,
bool oil_is_limited, bool gas_is_limited, std::vector<double> &potentials);
std::unique_ptr<GasLiftWellState> runOptimize1_();
std::unique_ptr<GasLiftWellState> runOptimize2_();
@@ -212,7 +222,8 @@ protected:
WellState& well_state_;
const Well& ecl_well_;
const SummaryState& summary_state_;
GasLiftGroupInfo& group_info_;
GLiftSyncGroups& sync_groups_;
const Well::ProductionControls controls_;
double increment_;