Change condition under which stage 2 is done.

It only makes sense to try to optimize the distribution of lift gas if
the amount of lift gas is constrained either by the maximum allowed
gaslift or total gas or the group is under individual control.
This commit is contained in:
Håkon Hægland 2022-10-20 12:58:42 +02:00 committed by Tor Harald Sandve
parent 686a6a969d
commit 43244c2132
11 changed files with 28 additions and 9 deletions

View File

@ -1053,6 +1053,7 @@ gasLiftOptimizationStage2(DeferredLogger& deferred_logger,
summaryState_,
deferred_logger,
this->wellState(),
this->groupState(),
prod_wells,
glift_wells,
glift_well_state_map,

View File

@ -986,6 +986,7 @@ namespace Opm {
phase_usage_,
deferred_logger,
this->wellState(),
this->groupState(),
ebosSimulator_.vanguard().grid().comm(),
this->glift_debug
};

View File

@ -25,11 +25,13 @@ namespace Opm {
GasLiftCommon::
GasLiftCommon(
WellState &well_state,
const GroupState &group_state,
DeferredLogger &deferred_logger,
const Parallel::Communication& comm,
bool glift_debug
) :
well_state_{well_state},
group_state_{group_state},
deferred_logger_{deferred_logger},
comm_{comm},
debug{glift_debug}

View File

@ -22,6 +22,7 @@
#include <opm/simulators/utils/DeferredLogger.hpp>
#include <opm/simulators/wells/WellState.hpp>
#include <opm/simulators/wells/GroupState.hpp>
#include <string>
#include <fmt/format.h>
@ -36,6 +37,7 @@ public:
protected:
GasLiftCommon(
WellState &well_state,
const GroupState &group_state,
DeferredLogger &deferred_logger,
const Parallel::Communication& comm,
bool debug
@ -51,6 +53,7 @@ protected:
MessageType msg_type = MessageType::INFO) const;
WellState &well_state_;
const GroupState& group_state_;
DeferredLogger &deferred_logger_;
const Parallel::Communication& comm_;
bool debug;

View File

@ -32,10 +32,11 @@ GasLiftGroupInfo(
const PhaseUsage &phase_usage,
DeferredLogger &deferred_logger,
WellState &well_state,
const GroupState &group_state,
const Communication &comm,
bool glift_debug
) :
GasLiftCommon(well_state, deferred_logger, comm, glift_debug)
GasLiftCommon(well_state, group_state, deferred_logger, comm, glift_debug)
, ecl_wells_{ecl_wells}
, schedule_{schedule}
, summary_state_{summary_state}

View File

@ -33,6 +33,7 @@
#include <opm/input/eclipse/Schedule/SummaryState.hpp>
#include <opm/simulators/wells/GasLiftCommon.hpp>
#include <opm/simulators/wells/WellState.hpp>
#include <opm/simulators/wells/GroupState.hpp>
#include <opm/simulators/utils/DeferredLogger.hpp>
#include <algorithm>
@ -81,6 +82,7 @@ public:
const PhaseUsage& phase_usage,
DeferredLogger& deferred_logger,
WellState& well_state,
const GroupState& group_state,
const Parallel::Communication& comm,
bool glift_debug
);

View File

@ -49,8 +49,7 @@ GasLiftSingleWellGeneric::GasLiftSingleWellGeneric(DeferredLogger& deferred_logg
GLiftSyncGroups& sync_groups,
const Parallel::Communication& comm,
bool glift_debug)
: GasLiftCommon(well_state, deferred_logger, comm, glift_debug)
, group_state_ {group_state}
: GasLiftCommon(well_state, group_state, deferred_logger, comm, glift_debug)
, ecl_well_ {ecl_well}
, summary_state_ {summary_state}
, group_info_ {group_info}

View File

@ -29,6 +29,7 @@
#include <opm/input/eclipse/Schedule/Well/Well.hpp>
#include <opm/simulators/wells/GasLiftGroupInfo.hpp>
#include <opm/simulators/wells/GasLiftCommon.hpp>
#include <opm/simulators/wells/GroupState.hpp>
#include <functional>
#include <optional>
@ -329,7 +330,6 @@ protected:
Rate rate_type, const std::string& gr_name, double rate, double target) const;
void warnMaxIterationsExceeded_();
const GroupState& group_state_;
const Well& ecl_well_;
const SummaryState& summary_state_;
GasLiftGroupInfo& group_info_;

View File

@ -44,12 +44,13 @@ GasLiftStage2::GasLiftStage2(
const SummaryState& summary_state,
DeferredLogger &deferred_logger,
WellState &well_state,
const GroupState &group_state,
GLiftProdWells &prod_wells,
GLiftOptWells &glift_wells,
GLiftWellStateMap &state_map,
bool glift_debug
) :
GasLiftCommon(well_state, deferred_logger, comm, glift_debug)
GasLiftCommon(well_state, group_state, deferred_logger, comm, glift_debug)
, prod_wells_{prod_wells}
, stage1_wells_{glift_wells}
, well_state_map_{state_map}
@ -545,10 +546,16 @@ optimizeGroup_(const Group &group)
{
const auto max_glift = getGroupMaxALQ_(group);
const auto max_total_gas = getGroupMaxTotalGas_(group);
if (group.has_control(Group::ProductionCMode::ORAT) || group.has_control(Group::ProductionCMode::LRAT)
|| max_glift || max_total_gas)
const auto& group_name = group.name();
const auto prod_control = this->group_state_.production_control(group_name);
//if (group.has_control(Group::ProductionCMode::ORAT) || group.has_control(Group::ProductionCMode::LRAT)
// || max_glift || max_total_gas)
// NOTE: it only makes sense to try to optimize the distribution of the gaslift if the amount
// of gaslift is constrained either by the maximum allowed gaslift or total gas
// or the group is under individual control
if ((prod_control != Group::ProductionCMode::NONE) && (prod_control != Group::ProductionCMode::FLD))
{
displayDebugMessage_("optimizing", group.name());
displayDebugMessage_("optimizing", group_name);
auto wells = getGroupGliftWells_(group);
std::vector<GradPair> inc_grads;
std::vector<GradPair> dec_grads;
@ -556,7 +563,7 @@ optimizeGroup_(const Group &group)
removeSurplusALQ_(group, inc_grads, dec_grads);
}
else {
displayDebugMessage_("skipping", group.name());
displayDebugMessage_("skipping", group_name);
}
}

View File

@ -22,6 +22,7 @@
#include <opm/core/props/BlackoilPhases.hpp>
#include <opm/simulators/wells/GasLiftSingleWellGeneric.hpp>
#include <opm/simulators/wells/GroupState.hpp>
#include <dune/common/version.hh>
#include <dune/common/parallel/mpihelper.hh>
@ -66,6 +67,7 @@ public:
const SummaryState& summary_state,
DeferredLogger& deferred_logger,
WellState& well_state,
const GroupState& group_state,
GLiftProdWells& prod_wells,
GLiftOptWells& glift_wells,
GLiftWellStateMap& state_map,

View File

@ -181,6 +181,7 @@ BOOST_AUTO_TEST_CASE(G1)
well_model.phaseUsage(),
deferred_logger,
well_state,
group_state,
comm,
/*glift_debug=*/false
};