20 #ifndef OPM_GASLIFT_GROUP_INFO_HEADER_INCLUDED
21 #define OPM_GASLIFT_GROUP_INFO_HEADER_INCLUDED
23 #include <dune/common/version.hh>
24 #include <dune/common/parallel/mpihelper.hh>
26 #include <opm/core/props/BlackoilPhases.hpp>
27 #include <opm/models/utils/propertysystem.hh>
28 #include <opm/models/utils/parametersystem.hh>
29 #include <opm/parser/eclipse/EclipseState/Schedule/Schedule.hpp>
30 #include <opm/parser/eclipse/EclipseState/Schedule/Well/Well.hpp>
31 #include <opm/parser/eclipse/EclipseState/Schedule/Group/Group.hpp>
32 #include <opm/parser/eclipse/EclipseState/Schedule/GasLiftOpt.hpp>
33 #include <opm/parser/eclipse/EclipseState/Schedule/SummaryState.hpp>
34 #include <opm/simulators/wells/WellState.hpp>
35 #include <opm/simulators/utils/DeferredLogger.hpp>
41 #include <fmt/format.h>
54 std::map<std::string, std::vector<std::pair<std::string,double>>>;
56 std::map<std::string, GroupRates>;
57 using GroupIdxMap = std::map<std::string, int>;
58 #if DUNE_VERSION_NEWER(DUNE_COMMON, 2, 7)
59 using Communication = Dune::Communication<Dune::MPIHelper::MPICommunicator>;
61 using Communication = Dune::CollectiveCommunication<Dune::MPIHelper::MPICommunicator>;
66 static const int Water = BlackoilPhases::Aqua;
67 static const int Oil = BlackoilPhases::Liquid;
68 static const int Gas = BlackoilPhases::Vapour;
70 using GLiftEclWells = std::map<std::string,std::pair<const Well *,int>>;
72 GLiftEclWells& ecl_wells,
73 const Schedule& schedule,
74 const SummaryState& summary_state,
75 const int report_step_idx,
76 const int iteration_idx,
80 const Parallel::Communication& comm);
81 std::vector<std::pair<std::string,double>>& getWellGroups(
82 const std::string& well_name);
84 double alqRate(
const std::string& group_name);
85 double gasRate(
const std::string& group_name);
86 int getGroupIdx(
const std::string& group_name);
87 std::tuple<double,double,double> getRates(
int group_idx);
88 std::optional<double> gasTarget(
const std::string& group_name);
89 const std::string& groupIdxToName(
int group_idx);
90 bool hasWell(
const std::string& well_name);
92 std::optional<double> maxAlq(
const std::string& group_name);
93 double oilRate(
const std::string& group_name);
94 std::optional<double> oilTarget(
const std::string& group_name);
95 void update(
const std::string& well_name,
96 double delta_oil,
double delta_gas,
double delta_alq);
97 void updateRate(
int idx,
double oil_rate,
double gas_rate,
double alq);
98 const Well2GroupMap& wellGroupMap() {
return well_group_map_; }
100 bool checkDoGasLiftOptimization_(
const std::string& well_name);
101 bool checkNewtonIterationIdxOk_(
const std::string& well_name);
102 void displayDebugMessage_(
const std::string& msg);
103 void displayDebugMessage_(
const std::string& msg,
const std::string& well_name);
104 std::pair<double, double> getProducerWellRates_(
const int index);
105 std::tuple<double, double, double>
106 initializeGroupRatesRecursive_(
const Group &group);
107 void initializeWell2GroupMapRecursive_(
108 const Group& group, std::vector<std::string>& group_names,
109 std::vector<double>& group_efficiency,
double cur_efficiency);
110 void updateGroupIdxMap_(
const std::string& group_name);
115 GroupRates(
double oil_rate,
double gas_rate,
double alq,
116 std::optional<double> oil_target,
117 std::optional<double> gas_target,
118 std::optional<double> total_gas,
119 std::optional<double> max_alq
124 oil_target_{oil_target},
125 gas_target_{gas_target},
126 total_gas_{total_gas},
129 double alq()
const {
return alq_; }
130 void assign(
double oil_rate,
double gas_rate,
double alq)
132 oil_rate_ = oil_rate;
133 gas_rate_ = gas_rate;
136 double gasRate()
const {
return gas_rate_; }
137 std::optional<double> gasTarget()
const {
return gas_target_; }
138 std::optional<double> maxAlq()
const {
return max_alq_; }
139 double oilRate()
const {
return oil_rate_; }
140 std::optional<double> oilTarget()
const {
return oil_target_; }
141 void update(
double delta_oil,
double delta_gas,
double delta_alq)
143 oil_rate_ += delta_oil;
144 gas_rate_ += delta_gas;
151 std::optional<double> oil_target_;
152 std::optional<double> gas_target_;
153 std::optional<double> total_gas_;
154 std::optional<double> max_alq_;
157 GLiftEclWells &ecl_wells_;
158 const Schedule &schedule_;
159 const SummaryState &summary_state_;
160 const int report_step_idx_;
161 const int iteration_idx_;
165 const Parallel::Communication &comm_;
166 const GasLiftOpt& glo_;
167 GroupRateMap group_rate_map_;
168 Well2GroupMap well_group_map_;
170 GroupIdxMap group_idx_;
171 int next_group_idx_ = 0;
173 bool optimize_only_thp_wells_ =
false;
Definition: DeferredLogger.hpp:57
Definition: GasLiftGroupInfo.hpp:46
The state of a set of wells, tailored for use by the fully implicit blackoil simulator.
Definition: WellState.hpp:56
This file contains a set of helper functions used by VFPProd / VFPInj.
Definition: BlackoilPhases.hpp:26
Definition: BlackoilPhases.hpp:45