76 using GLiftOptWells = std::map<std::string, std::unique_ptr<GasLiftSingleWellGeneric>>;
77 using GLiftProdWells = std::map<std::string, const WellInterfaceGeneric*>;
78 using GLiftWellStateMap = std::map<std::string, std::unique_ptr<GasLiftWellState>>;
82 const EclipseState& eclState,
84 const Parallel::Communication& comm);
88 int numLocalWells()
const;
89 int numPhases()
const;
93 bool hasWell(
const std::string&
wname)
const;
96 bool anyMSWellOpenLocal()
const;
98 const Well& getWellEcl(
const std::string& well_name)
const;
99 std::vector<Well> getLocalWells(
const int timeStepIdx)
const;
100 const Schedule& schedule()
const {
return schedule_; }
101 const PhaseUsage& phaseUsage()
const {
return phase_usage_; }
102 const GroupState& groupState()
const {
return this->active_wgstate_.group_state; }
103 std::vector<const WellInterfaceGeneric*> genericWells()
const
104 {
return {well_container_generic_.begin(), well_container_generic_.end()}; }
111 return this->active_wgstate_.well_state;
119 return this->active_wgstate_.well_state;
122 GroupState& groupState() {
return this->active_wgstate_.group_state; }
124 WellTestState& wellTestState() {
return this->active_wgstate_.well_test_state; }
126 const WellTestState& wellTestState()
const {
return this->active_wgstate_.well_test_state; }
129 double wellPI(
const int well_index)
const;
130 double wellPI(
const std::string& well_name)
const;
133 const std::unordered_set<std::string>& wells,
141 void prepareDeserialize(
int report_step,
153 this->last_valid_wgstate_ = this->active_wgstate_;
156 data::GroupAndNetworkValues groupAndNetworkData(
const int reportStepIdx)
const;
166 const std::vector<PerforationData>& perfData(
const int well_idx)
const
167 {
return well_perf_data_[
well_idx]; }
169 const Parallel::Communication& comm()
const {
return comm_; }
171 const SummaryState& summaryState()
const {
return summaryState_; }
173 const GuideRate& guideRate()
const {
return guideRate_; }
175 bool reportStepStarts()
const {
return report_step_starts_; }
177 bool shouldBalanceNetwork(
const int reportStepIndex,
180 bool shouldIterateNetwork(
const int reportStepIndex,
184 template<
class Serializer>
204 return this->initial_step_ == rhs.initial_step_ &&
205 this->report_step_starts_ == rhs.report_step_starts_ &&
206 this->last_run_wellpi_ == rhs.last_run_wellpi_ &&
207 this->local_shut_wells_ == rhs.local_shut_wells_ &&
208 this->closed_this_step_ == rhs.closed_this_step_ &&
209 this->node_pressures_ == rhs.node_pressures_ &&
210 this->active_wgstate_ == rhs.active_wgstate_ &&
211 this->last_valid_wgstate_ == rhs.last_valid_wgstate_ &&
212 this->nupcol_wgstate_ == rhs.nupcol_wgstate_ &&
213 this->last_glift_opt_time_ == rhs.last_glift_opt_time_ &&
214 this->switched_prod_groups_ == rhs.switched_prod_groups_ &&
215 this->switched_inj_groups_ == rhs.switched_inj_groups_;
250 return this->last_valid_wgstate_.well_state;
253 const WGState& prevWGState()
const
255 return this->last_valid_wgstate_;
263 return this->nupcol_wgstate_.well_state;
273 this->last_valid_wgstate_ = std::move(
wgstate);
283 this->active_wgstate_ = this->last_valid_wgstate_;
291 void updateNupcolWGState()
293 this->nupcol_wgstate_ = this->active_wgstate_;
300 void initializeWellProdIndCalculators();
301 void initializeWellPerfData();
303 bool wasDynamicallyShutThisTimeStep(
const int well_index)
const;
305 std::pair<bool, double> updateNetworkPressures(
const int reportStepIdx);
307 void updateWsolvent(
const Group& group,
310 void setWsolvent(
const Group& group,
313 virtual void calcRates(
const int fipnum,
315 const std::vector<double>& production_rates,
317 virtual void calcInjRates(
const int fipnum,
321 void assignShutConnections(data::Wells&
wsrpt,
322 const int reportStepIndex)
const;
323 void assignGroupControl(
const Group& group,
324 data::GroupData&
gdata)
const;
326 std::map<std::string, data::GroupData>&
gvalues)
const;
327 void assignNodeValues(std::map<std::string, data::NodeData>&
nodevalues)
const;
331 void checkGconsaleLimits(
const Group& group,
336 bool checkGroupHigherConstraints(
const Group& group,
343 void inferLocalShutWells();
345 void setRepRadiusPerfLength();
347 void gliftDebug(
const std::string&
msg,
356 GLiftWellStateMap&
map,
359 virtual void computePotentials(
const std::size_t
widx,
372 virtual void createWellContainer(
const int time_step) = 0;
375 virtual void calculateProductivityIndexValuesShutWells(
const int reportStepIdx,
385 std::vector<int> getCellsForConnections(
const Well& well)
const;
387 std::vector<std::string> getWellsForTesting(
const int timeStepIdx,
392 const EclipseState& eclState_;
393 const Parallel::Communication& comm_;
396 bool terminal_output_{
false};
397 bool wells_active_{
false};
398 bool initial_step_{};
399 bool report_step_starts_{};
401 std::optional<int> last_run_wellpi_{};
403 std::vector<Well> wells_ecl_;
404 std::vector<std::vector<PerforationData>> well_perf_data_;
405 std::function<bool(
const Well&)> not_on_process_{};
408 std::vector<WellInterfaceGeneric*> well_container_generic_{};
410 std::vector<int> local_shut_wells_{};
412 std::vector<ParallelWellInfo> parallel_well_info_;
413 std::vector<std::reference_wrapper<ParallelWellInfo>> local_parallel_well_info_;
415 std::vector<WellProdIndexCalculator> prod_index_calc_;
417 std::vector<int> pvt_region_idx_;
419 mutable std::unordered_set<std::string> closed_this_step_;
421 GuideRate guideRate_;
422 std::unique_ptr<VFPProperties> vfp_properties_{};
423 std::map<std::string, double> node_pressures_;
431 WGState active_wgstate_;
432 WGState last_valid_wgstate_;
433 WGState nupcol_wgstate_;
435 bool glift_debug =
false;
437 double last_glift_opt_time_ = -1.0;
439 std::map<std::string, std::string> switched_prod_groups_;
440 std::map<std::pair<std::string, Opm::Phase>, std::string> switched_inj_groups_;
444 WellInterfaceGeneric* getGenWell(
const std::string& well_name);