85 using GLiftOptWells = std::map<std::string, std::unique_ptr<GasLiftSingleWellGeneric>>;
86 using GLiftProdWells = std::map<std::string, const WellInterfaceGeneric*>;
87 using GLiftWellStateMap = std::map<std::string, std::unique_ptr<GasLiftWellState>>;
91 const EclipseState& eclState,
93 const Parallel::Communication& comm);
97 int numLocalWells()
const;
98 int numLocalWellsEnd()
const;
99 int numLocalNonshutWells()
const;
100 int numPhases()
const;
104 bool hasWell(
const std::string&
wname)
const;
107 bool anyMSWellOpenLocal()
const;
109 const Well& getWellEcl(
const std::string& well_name)
const;
110 std::vector<Well> getLocalWells(
const int timeStepIdx)
const;
111 const Schedule& schedule()
const {
return schedule_; }
112 const PhaseUsage& phaseUsage()
const {
return phase_usage_; }
113 const GroupState& groupState()
const {
return this->active_wgstate_.group_state; }
114 std::vector<const WellInterfaceGeneric*> genericWells()
const
115 {
return {well_container_generic_.begin(), well_container_generic_.end()}; }
122 return this->active_wgstate_.well_state;
130 return this->active_wgstate_.well_state;
133 GroupState& groupState() {
return this->active_wgstate_.group_state; }
135 WellTestState& wellTestState() {
return this->active_wgstate_.well_test_state; }
137 const WellTestState& wellTestState()
const {
return this->active_wgstate_.well_test_state; }
140 double wellPI(
const int well_index)
const;
141 double wellPI(
const std::string& well_name)
const;
144 const std::unordered_set<std::string>& wells,
152 void prepareDeserialize(
int report_step,
164 this->last_valid_wgstate_ = this->active_wgstate_;
167 data::GroupAndNetworkValues groupAndNetworkData(
const int reportStepIdx)
const;
180 const std::vector<PerforationData>& perfData(
const int well_idx)
const
181 {
return well_perf_data_[
well_idx]; }
183 const Parallel::Communication& comm()
const {
return comm_; }
185 const EclipseState& eclipseState()
const {
return eclState_; }
187 const SummaryState& summaryState()
const {
return summaryState_; }
189 const GuideRate& guideRate()
const {
return guideRate_; }
191 bool reportStepStarts()
const {
return report_step_starts_; }
193 bool shouldBalanceNetwork(
const int reportStepIndex,
196 void updateClosedWellsThisStep(
const std::string& well_name)
const {
197 this->closed_this_step_.insert(well_name);
200 template<
class Serializer>
221 return this->initial_step_ == rhs.initial_step_ &&
222 this->report_step_starts_ == rhs.report_step_starts_ &&
223 this->last_run_wellpi_ == rhs.last_run_wellpi_ &&
224 this->local_shut_wells_ == rhs.local_shut_wells_ &&
225 this->closed_this_step_ == rhs.closed_this_step_ &&
226 this->node_pressures_ == rhs.node_pressures_ &&
227 this->prev_inj_multipliers_ == rhs.prev_inj_multipliers_ &&
228 this->active_wgstate_ == rhs.active_wgstate_ &&
229 this->last_valid_wgstate_ == rhs.last_valid_wgstate_ &&
230 this->nupcol_wgstate_ == rhs.nupcol_wgstate_ &&
231 this->last_glift_opt_time_ == rhs.last_glift_opt_time_ &&
232 this->switched_prod_groups_ == rhs.switched_prod_groups_ &&
233 this->switched_inj_groups_ == rhs.switched_inj_groups_;
268 return this->last_valid_wgstate_.well_state;
271 const WGState& prevWGState()
const
273 return this->last_valid_wgstate_;
281 return this->nupcol_wgstate_.well_state;
291 this->last_valid_wgstate_ = std::move(
wgstate);
301 this->active_wgstate_ = this->last_valid_wgstate_;
309 void updateNupcolWGState()
311 this->nupcol_wgstate_ = this->active_wgstate_;
318 void initializeWellProdIndCalculators();
319 void initializeWellPerfData();
321 bool wasDynamicallyShutThisTimeStep(
const int well_index)
const;
325 void updateWsolvent(
const Group& group,
328 void setWsolvent(
const Group& group,
331 virtual void calcRates(
const int fipnum,
333 const std::vector<double>& production_rates,
335 virtual void calcInjRates(
const int fipnum,
339 void assignShutConnections(data::Wells&
wsrpt,
340 const int reportStepIndex)
const;
341 void assignGroupControl(
const Group& group,
342 data::GroupData&
gdata)
const;
344 std::map<std::string, data::GroupData>&
gvalues)
const;
345 void assignNodeValues(std::map<std::string, data::NodeData>&
nodevalues)
const;
349 void checkGconsaleLimits(
const Group& group,
354 void checkGEconLimits(
const Group& group,
359 bool checkGroupHigherConstraints(
const Group& group,
366 void inferLocalShutWells();
368 void setRepRadiusPerfLength();
370 void gliftDebug(
const std::string&
msg,
379 GLiftWellStateMap&
map,
382 virtual void computePotentials(
const std::size_t
widx,
400 void updateFiltrationParticleVolume(
const double dt,
const std::size_t
water_index);
403 virtual void createWellContainer(
const int time_step) = 0;
406 virtual void calculateProductivityIndexValuesShutWells(
const int reportStepIdx,
416 std::vector<int> getCellsForConnections(
const Well& well)
const;
417 std::vector<std::vector<int>> getMaxWellConnections()
const;
419 std::vector<std::string> getWellsForTesting(
const int timeStepIdx,
422 using WellTracerRates = std::map<std::pair<std::string, std::string>,
double>;
423 void assignWellTracerRates(data::Wells&
wsrpt,
428 const EclipseState& eclState_;
429 const Parallel::Communication& comm_;
432 bool terminal_output_{
false};
433 bool wells_active_{
false};
434 bool initial_step_{};
435 bool report_step_starts_{};
437 std::optional<int> last_run_wellpi_{};
439 std::vector<Well> wells_ecl_;
440 std::vector<std::vector<PerforationData>> well_perf_data_;
468 static_cast<int>(this->global_.size());
470 this->global_.push_back(
connIdx);
473 ? this->num_open_conns_++
484 const std::vector<int>&
local()
const
515 std::vector<int> local_{};
519 std::vector<int> global_{};
522 std::vector<int> open_{};
525 int num_open_conns_{0};
528 std::vector<ConnectionIndexMap> conn_idx_map_{};
529 std::function<bool(
const Well&)> not_on_process_{};
532 std::vector<WellInterfaceGeneric*> well_container_generic_{};
534 std::vector<int> local_shut_wells_{};
536 std::vector<ParallelWellInfo> parallel_well_info_;
537 std::vector<std::reference_wrapper<ParallelWellInfo>> local_parallel_well_info_;
539 std::vector<WellProdIndexCalculator> prod_index_calc_;
540 mutable ParallelWBPCalculation wbpCalculationService_;
542 std::vector<int> pvt_region_idx_;
544 mutable std::unordered_set<std::string> closed_this_step_;
546 GuideRate guideRate_;
547 std::unique_ptr<VFPProperties> vfp_properties_{};
548 std::map<std::string, double> node_pressures_;
551 std::unordered_map<std::string, std::vector<double>> prev_inj_multipliers_;
554 std::unordered_map<std::string, WellFilterCake> filter_cake_;
562 WGState active_wgstate_;
563 WGState last_valid_wgstate_;
564 WGState nupcol_wgstate_;
566 bool glift_debug =
false;
568 double last_glift_opt_time_ = -1.0;
570 std::map<std::string, std::string> switched_prod_groups_;
571 std::map<std::pair<std::string, Opm::Phase>, std::string> switched_inj_groups_;
574 WellInterfaceGeneric* getGenWell(
const std::string& well_name);