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 using Communication = Dune::Communication<Dune::MPIHelper::MPICommunicator>;
62 static const int Water = BlackoilPhases::Aqua;
63 static const int Oil = BlackoilPhases::Liquid;
64 static const int Gas = BlackoilPhases::Vapour;
66 enum class Rate {oil, gas, water, liquid};
68 using GLiftEclWells = std::map<std::string,std::pair<const Well *,int>>;
70 GLiftEclWells& ecl_wells,
71 const Schedule& schedule,
72 const SummaryState& summary_state,
73 const int report_step_idx,
74 const int iteration_idx,
79 const Parallel::Communication& comm,
82 std::vector<std::pair<std::string,double>>& getWellGroups(
83 const std::string& well_name);
85 double alqRate(
const std::string& group_name);
86 double gasRate(
const std::string& group_name)
const;
87 double gasPotential(
const std::string& group_name)
const;
88 double waterPotential(
const std::string& group_name)
const;
89 double oilPotential(
const std::string& group_name)
const;
90 int getGroupIdx(
const std::string& group_name);
91 double getRate(Rate rate_type,
const std::string& group_name)
const;
92 double getPotential(Rate rate_type,
const std::string& group_name)
const;
93 std::tuple<double,double,double,double> getRates(
const int group_idx)
const;
94 std::optional<double> gasTarget(
const std::string& group_name)
const;
95 std::optional<double> getTarget(
96 Rate rate_type,
const std::string& group_name)
const;
97 const std::string& groupIdxToName(
int group_idx)
const;
98 bool hasAnyTarget(
const std::string& group_name)
const;
99 bool hasWell(
const std::string& well_name);
101 std::optional<double> liquidTarget(
const std::string& group_name)
const;
102 std::optional<double> maxAlq(
const std::string& group_name);
103 std::optional<double> maxTotalGasRate(
const std::string& group_name);
104 double oilRate(
const std::string& group_name)
const;
105 std::optional<double> oilTarget(
const std::string& group_name)
const;
106 static const std::string rateToString(Rate rate);
107 double waterRate(
const std::string& group_name)
const;
108 std::optional<double> waterTarget(
const std::string& group_name)
const;
109 void update(
const std::string& well_name,
110 double delta_oil,
double delta_gas,
double delta_water,
double delta_alq);
111 void updateRate(
int idx,
double oil_rate,
double gas_rate,
double water_rate,
double alq);
112 const Well2GroupMap& wellGroupMap() {
return well_group_map_; }
114 bool checkDoGasLiftOptimization_(
const std::string& well_name);
115 bool checkNewtonIterationIdxOk_(
const std::string& well_name);
116 void debugDisplayWellContribution_(
117 const std::string& gr_name,
const std::string& well_name,
119 double well_oil_rate,
double well_gas_rate,
double well_water_rate,
121 double oil_rate,
double gas_rate,
double water_rate,
124 void debugDisplayUpdatedGroupRates(
const std::string& name,
125 double oil_rate,
double gas_rate,
double water_rate,
double alq)
const;
126 void debugEndInitializeGroup(
const std::string& name)
const;
127 void debugStartInitializeGroup(
const std::string& name)
const;
128 void displayDebugMessage_(
const std::string& msg)
const override;
129 void displayDebugMessage_(
const std::string& msg,
const std::string& well_name);
130 std::tuple<double, double, double, double, double, double>
131 getProducerWellRates_(
const Well* well,
const int index);
132 std::tuple<double, double, double, double, double, double, double>
133 initializeGroupRatesRecursive_(
const Group &group);
134 void initializeWell2GroupMapRecursive_(
135 const Group& group, std::vector<std::string>& group_names,
136 std::vector<double>& group_efficiency,
double cur_efficiency);
137 void updateGroupIdxMap_(
const std::string& group_name);
142 GroupRates(
double oil_rate,
double gas_rate,
double water_rate,
double alq,
143 double oil_potential,
double gas_potential,
double water_potential,
144 std::optional<double> oil_target,
145 std::optional<double> gas_target,
146 std::optional<double> water_target,
147 std::optional<double> liquid_target,
148 std::optional<double> total_gas,
149 std::optional<double> max_alq
153 water_rate_{water_rate},
155 oil_potential_{oil_potential},
156 gas_potential_{gas_potential},
157 water_potential_{water_potential},
158 oil_target_{oil_target},
159 gas_target_{gas_target},
160 water_target_{water_target},
161 liquid_target_{liquid_target},
162 total_gas_{total_gas},
165 double alq()
const {
return alq_; }
166 void assign(
double oil_rate,
double gas_rate,
double water_rate,
double alq)
168 oil_rate_ = oil_rate;
169 gas_rate_ = gas_rate;
170 water_rate_ = water_rate;
173 double gasRate()
const {
return gas_rate_; }
174 double waterRate()
const {
return water_rate_; }
175 std::optional<double> gasTarget()
const {
return gas_target_; }
176 std::optional<double> waterTarget()
const {
return water_target_; }
177 std::optional<double> maxAlq()
const {
return max_alq_; }
178 std::optional<double> maxTotalGasRate()
const {
return total_gas_; }
179 double oilRate()
const {
return oil_rate_; }
180 std::optional<double> oilTarget()
const {
return oil_target_; }
181 std::optional<double> liquidTarget()
const {
return liquid_target_; }
182 double oilPotential()
const {
return oil_potential_; }
183 double gasPotential()
const {
return gas_potential_; }
184 double waterPotential()
const {
return water_potential_; }
186 void update(
double delta_oil,
double delta_gas,
double delta_water,
double delta_alq)
188 oil_rate_ += delta_oil;
189 gas_rate_ += delta_gas;
190 water_rate_ += delta_water;
200 double oil_potential_;
201 double gas_potential_;
202 double water_potential_;
203 std::optional<double> oil_target_;
204 std::optional<double> gas_target_;
205 std::optional<double> water_target_;
206 std::optional<double> liquid_target_;
207 std::optional<double> total_gas_;
208 std::optional<double> max_alq_;
211 GLiftEclWells &ecl_wells_;
212 const Schedule &schedule_;
213 const SummaryState &summary_state_;
214 const int report_step_idx_;
215 const int iteration_idx_;
217 const GasLiftOpt& glo_;
218 GroupRateMap group_rate_map_;
219 Well2GroupMap well_group_map_;
220 GroupIdxMap group_idx_;
221 int next_group_idx_ = 0;
223 bool optimize_only_thp_wells_ =
false;