BlackoilWellModelGeneric.hpp
Go to the documentation of this file.
1/*
2 Copyright 2016 SINTEF ICT, Applied Mathematics.
3 Copyright 2016 - 2017 Statoil ASA.
4 Copyright 2017 Dr. Blatt - HPC-Simulation-Software & Services
5 Copyright 2016 - 2018 IRIS AS
6
7 This file is part of the Open Porous Media project (OPM).
8
9 OPM is free software: you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation, either version 3 of the License, or
12 (at your option) any later version.
13
14 OPM is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
18
19 You should have received a copy of the GNU General Public License
20 along with OPM. If not, see <http://www.gnu.org/licenses/>.
21*/
22
23#ifndef OPM_BLACKOILWELLMODEL_GENERIC_HEADER_INCLUDED
24#define OPM_BLACKOILWELLMODEL_GENERIC_HEADER_INCLUDED
25
26#include <opm/output/data/GuideRateValue.hpp>
27
28#include <opm/input/eclipse/Schedule/Group/GuideRate.hpp>
29#include <opm/input/eclipse/Schedule/Well/PAvg.hpp>
30#include <opm/input/eclipse/Schedule/Well/PAvgCalculator.hpp>
31#include <opm/input/eclipse/Schedule/Well/PAvgCalculatorCollection.hpp>
32#include <opm/input/eclipse/Schedule/Well/WellTestState.hpp>
33
45
46#include <algorithm>
47#include <cstddef>
48#include <functional>
49#include <map>
50#include <memory>
51#include <optional>
52#include <string>
53#include <unordered_map>
54#include <unordered_set>
55#include <vector>
56
57
58namespace Opm {
59 class DeferredLogger;
60 class EclipseState;
61 template<class Scalar> class BlackoilWellModelGasLiftGeneric;
62 template<class Scalar> class GasLiftGroupInfo;
63 template<class Scalar> class GasLiftSingleWellGeneric;
64 template<class Scalar> class GasLiftWellState;
65 class Group;
66 class GuideRateConfig;
67 class RestartValue;
68 class Schedule;
69 struct SimulatorUpdate;
70 class SummaryConfig;
71 template<class Scalar> class VFPProperties;
72 template<class Scalar> class WellInterfaceGeneric;
73 template<class Scalar> class WellState;
74} // namespace Opm
75
76namespace Opm { namespace data {
77 struct GroupData;
78 struct GroupGuideRates;
79 class GroupAndNetworkValues;
80 struct NodeData;
81}} // namespace Opm::data
82
83namespace Opm::Parameters {
84
85struct EnableTerminalOutput { static constexpr bool value = true; };
86
87} // namespace Opm::Parameters
88
89namespace Opm {
90
92template<class Scalar>
94{
95public:
98 const SummaryState& summaryState,
99 const EclipseState& eclState,
100 const PhaseUsage& phase_usage,
102
103 virtual ~BlackoilWellModelGeneric() = default;
104 virtual int compressedIndexForInteriorLGR([[maybe_unused]] const std::string& lgr_tag,
105 [[maybe_unused]] const Connection& conn) const
106 {
107 throw std::runtime_error("compressedIndexForInteriorLGR not implemented");
108 }
109
110 int numLocalWells() const;
111 int numLocalWellsEnd() const;
113 int numPhases() const;
114
116 bool wellsActive() const;
117
119 bool hasLocalWell(const std::string& wname) const;
120
122 bool hasOpenLocalWell(const std::string& well_name) const;
123
125 bool networkActive() const;
126
127 // whether there exists any multisegment well open on this process
128 bool anyMSWellOpenLocal() const;
129
130 const std::vector<Well>& eclWells() const
131 { return wells_ecl_; }
132
133 bool terminalOutput() const
134 { return terminal_output_; }
135
136 const Well& getWellEcl(const std::string& well_name) const;
137 std::vector<Well> getLocalWells(const int timeStepIdx) const;
138 const Schedule& schedule() const { return schedule_; }
139 const PhaseUsage& phaseUsage() const { return phase_usage_; }
140 const GroupState<Scalar>& groupState() const { return this->active_wgstate_.group_state; }
141 std::vector<const WellInterfaceGeneric<Scalar>*> genericWells() const
142 { return {well_container_generic_.begin(), well_container_generic_.end()}; }
143
144 std::vector<WellInterfaceGeneric<Scalar>*> genericWells()
145 { return well_container_generic_; }
146
147 /*
148 Immutable version of the currently active wellstate.
149 */
151 {
152 return this->active_wgstate_.well_state;
153 }
154
155 /*
156 Mutable version of the currently active wellstate.
157 */
159 {
160 return this->active_wgstate_.well_state;
161 }
162
163 /*
164 Will return the currently active nupcolWellState; must update
165 the internal nupcol wellstate with updateNupcolWGState() first.
166 */
168 {
169 return this->nupcol_wgstate_.well_state;
170 }
171 GroupState<Scalar>& groupState() { return this->active_wgstate_.group_state; }
172
173 WellTestState& wellTestState() { return this->active_wgstate_.well_test_state; }
174
175 const WellTestState& wellTestState() const { return this->active_wgstate_.well_test_state; }
176
177 Scalar wellPI(const int well_index) const;
178 Scalar wellPI(const std::string& well_name) const;
179
180 void updateEclWells(const int timeStepIdx,
181 const SimulatorUpdate& sim_update,
182 const SummaryState& st);
183
184 void initFromRestartFile(const RestartValue& restartValues,
185 std::unique_ptr<WellTestState> wtestState,
186 const std::size_t numCells,
187 bool handle_ms_well,
188 bool enable_distributed_wells);
189
190 void prepareDeserialize(int report_step,
191 const std::size_t numCells,
192 bool handle_ms_well,
193 bool enable_distributed_wells);
194
195 /*
196 Will assign the internal member last_valid_well_state_ to the
197 current value of the this->active_well_state_. The state stored
198 with storeWellState() can then subsequently be recovered with the
199 resetWellState() method.
200 */
202 {
205 }
206
207 data::GroupAndNetworkValues groupAndNetworkData(const int reportStepIdx) const;
208
210 void updateNetworkActiveState(const int report_step);
211
215 bool needPreStepNetworkRebalance(const int report_step) const;
216
219 bool forceShutWellByName(const std::string& wellname,
220 const double simulation_time,
221 const bool dont_shut_grup_wells);
222
223 const std::vector<PerforationData<Scalar>>& perfData(const int well_idx) const
224 { return well_perf_data_[well_idx]; }
225
226 const Parallel::Communication& comm() const { return comm_; }
227
228 const EclipseState& eclipseState() const { return eclState_; }
229
230 const SummaryState& summaryState() const { return summaryState_; }
231
232 const GuideRate& guideRate() const { return guideRate_; }
233 GuideRate& guideRate() { return guideRate_; }
234
235 const std::map<std::string, double>& wellOpenTimes() const { return well_open_times_; }
236 const std::map<std::string, double>& wellCloseTimes() const { return well_close_times_; }
237 const WellGroupEvents& reportStepStartEvents() const { return report_step_start_events_; }
238
239 std::vector<int> getCellsForConnections(const Well& well) const;
240
241 bool reportStepStarts() const { return report_step_starts_; }
242
243 bool shouldBalanceNetwork(const int reportStepIndex,
244 const int iterationIdx) const;
245
246 void updateClosedWellsThisStep(const std::string& well_name) const
247 {
248 this->closed_this_step_.insert(well_name);
249 }
250 bool wasDynamicallyShutThisTimeStep(const std::string& well_name) const;
251
252 void logPrimaryVars() const;
253
254 template<class Serializer>
255 void serializeOp(Serializer& serializer)
256 {
257 serializer(initial_step_);
258 serializer(report_step_starts_);
259 serializer(last_run_wellpi_);
260 serializer(local_shut_wells_);
261 serializer(closed_this_step_);
262 serializer(guideRate_);
263 serializer(node_pressures_);
264 serializer(last_valid_node_pressures_);
265 serializer(prev_inj_multipliers_);
266 serializer(active_wgstate_);
267 serializer(last_valid_wgstate_);
268 serializer(nupcol_wgstate_);
269 serializer(switched_prod_groups_);
270 serializer(switched_inj_groups_);
271 serializer(closed_offending_wells_);
272 serializer(gen_gaslift_);
273 }
274
275 bool operator==(const BlackoilWellModelGeneric& rhs) const;
276
278 parallelWellInfo(const std::size_t idx) const
279 { return local_parallel_well_info_[idx].get(); }
280
281 bool isOwner(const std::string& wname) const
282 {
283 auto pwInfoPos = std::find_if(this->parallel_well_info_.begin(),
284 this->parallel_well_info_.end(),
285 [&wname](const auto& pwInfo)
286 { return pwInfo.name() == wname; });
287
288 return (pwInfoPos != this->parallel_well_info_.end())
289 && pwInfoPos->isOwner();
290 }
291
292 const ConnectionIndexMap& connectionIndexMap(const std::size_t idx)
293 { return conn_idx_map_[idx]; }
294
295protected:
296 /*
297 The dynamic state of the well model is maintained with an instance
298 of the WellState class. Currently we have
299 three different wellstate instances:
300
301 1. The currently active wellstate is in the active_well_state_
302 member. That is the state which is mutated by the simulator.
303
304 2. In the case timestep fails to converge and we must go back and
305 try again with a smaller timestep we need to recover the last
306 valid wellstate. This is maintained with the
307 last_valid_well_state_ member and the functions
308 commitWGState() and resetWellState().
309
310 3. For the NUPCOL functionality we should either use the
311 currently active wellstate or a wellstate frozen at max
312 nupcol iterations. This is handled with the member
313 nupcol_well_state_ and the updateNupcolWGState() function.
314 */
315
316 /*
317 Will return the last good wellstate. This is typcially used when
318 initializing a new report step where the Schedule object might
319 have introduced new wells. The wellstate returned by
320 prevWellState() must have been stored with the commitWGState()
321 function first.
322 */
324 {
325 return this->last_valid_wgstate_.well_state;
326 }
327
329 {
330 return this->last_valid_wgstate_;
331 }
332
333 /*
334 Will store a copy of the input argument well_state in the
335 last_valid_well_state_ member, that state can then be recovered
336 with a subsequent call to resetWellState().
337 */
339 {
340 this->last_valid_wgstate_ = std::move(wgstate);
341 }
342
343 /*
344 Will update the internal variable active_well_state_ to whatever
345 was stored in the last_valid_well_state_ member. This function
346 works in pair with commitWellState() which should be called first.
347 */
349 {
352 }
353
354 /*
355 Will store the current active wellstate in the nupcol_well_state_
356 member. This can then be subsequently retrieved with accessor
357 nupcolWellState().
358 */
360 {
361 this->nupcol_wgstate_ = this->active_wgstate_;
362 }
363
364 void reportGroupSwitching(DeferredLogger& local_deferredLogger) const;
365
368 std::vector<std::reference_wrapper<ParallelWellInfo<Scalar>>>
369 createLocalParallelWellInfo(const std::vector<Well>& wells);
370
373
374 bool wasDynamicallyShutThisTimeStep(const int well_index) const;
375
376 Scalar updateNetworkPressures(const int reportStepIdx,
377 const Scalar damping_factor,
378 const Scalar update_upper_bound);
379
380 void updateWsolvent(const Group& group,
381 const int reportStepIdx,
383 void setWsolvent(const Group& group,
384 const int reportStepIdx,
385 Scalar wsolvent);
386 virtual void calcResvCoeff(const int fipnum,
387 const int pvtreg,
388 const std::vector<Scalar>& production_rates,
389 std::vector<Scalar>& resv_coeff) = 0;
390 virtual void calcInjResvCoeff(const int fipnum,
391 const int pvtreg,
392 std::vector<Scalar>& resv_coeff) = 0;
393
400 void assignDynamicWellStatus(data::Wells& wsrpt,
401 const int reportStepIdx) const;
402
414 void assignShutConnections(data::Wells& wsrpt,
415 const int reportStepIndex) const;
416
417 void assignWellTargets(data::Wells& wsrpt) const;
418 void assignProductionWellTargets(const Well& well, data::WellControlLimits& limits) const;
419 void assignInjectionWellTargets(const Well& well, data::WellControlLimits& limits) const;
420
421 void assignGroupControl(const Group& group,
422 data::GroupData& gdata) const;
423 void assignGroupValues(const int reportStepIdx,
424 std::map<std::string, data::GroupData>& gvalues) const;
425 void assignNodeValues(std::map<std::string, data::NodeData>& nodevalues,
426 const int reportStepIdx) const;
427
428 void calculateEfficiencyFactors(const int reportStepIdx);
429
430 void checkGconsaleLimits(const Group& group,
431 WellState<Scalar>& well_state,
432 const int reportStepIdx,
433 DeferredLogger& deferred_logger);
434
435 void checkGEconLimits(const Group& group,
436 const double simulation_time,
437 const int report_step_idx,
438 DeferredLogger& deferred_logger);
439
440 bool checkGroupHigherConstraints(const Group& group,
441 DeferredLogger& deferred_logger,
442 const int reportStepIdx,
443 const int max_number_of_group_switch);
444
445 void updateAndCommunicateGroupData(const int reportStepIdx,
446 const int iterationIdx,
447 const Scalar tol_nupcol,
448 const bool update_wellgrouptarget, // we only want to update the wellgrouptarget after the groups have found their controls
449 DeferredLogger& deferred_logger);
450
452
454
455 virtual void computePotentials(const std::size_t widx,
456 const WellState<Scalar>& well_state_copy,
457 std::string& exc_msg,
458 ExceptionType::ExcEnum& exc_type,
459 DeferredLogger& deferred_logger) = 0;
460
461 // Calculating well potentials for each well
462 void updateWellPotentials(const int reportStepIdx,
463 const bool onlyAfterEvent,
464 const SummaryConfig& summaryConfig,
465 DeferredLogger& deferred_logger);
466
468
469 void updateInjMult(DeferredLogger& deferred_logger);
470 void updateInjFCMult(DeferredLogger& deferred_logger);
471
472 void updateFiltrationModelsPostStep(const double dt,
473 const std::size_t water_index,
474 DeferredLogger& deferred_logger);
475
477
478 // create the well container
479 virtual void createWellContainer(const int time_step) = 0;
480 virtual void initWellContainer(const int reportStepIdx) = 0;
481
482 virtual void calculateProductivityIndexValuesShutWells(const int reportStepIdx,
483 DeferredLogger& deferred_logger) = 0;
484 virtual void calculateProductivityIndexValues(DeferredLogger& deferred_logger) = 0;
485
486 void runWellPIScaling(const int reportStepIdx,
487 DeferredLogger& local_deferredLogger);
488
490 virtual int compressedIndexForInterior(int cartesian_cell_idx) const = 0;
491
492 std::vector<std::vector<int>> getMaxWellConnections() const;
493
494 std::vector<std::string> getWellsForTesting(const int timeStepIdx,
495 const double simulationTime);
496
497 using WellTracerRates = std::unordered_map<int, std::vector<WellTracerRate<Scalar>>>;
498 void assignWellTracerRates(data::Wells& wsrpt,
499 const WellTracerRates& wellTracerRates,
500 const unsigned reportStep) const;
501
502 using MswTracerRates = std::unordered_map<int, std::vector<MSWellTracerRate<Scalar>>>;
503 void assignMswTracerRates(data::Wells& wsrpt,
504 const MswTracerRates& mswTracerRates,
505 const unsigned reportStep) const;
506
507 void assignMassGasRate(data::Wells& wsrpt,
508 const Scalar gasDensity) const;
509
510 Schedule& schedule_;
511
512 const SummaryState& summaryState_;
513 const EclipseState& eclState_;
517
518
520 bool terminal_output_{false};
521 bool wells_active_{false};
522 bool network_active_{false};
525
526 std::optional<int> last_run_wellpi_{};
527
528 std::vector<Well> wells_ecl_;
529 std::vector<std::vector<PerforationData<Scalar>>> well_perf_data_;
530
531 // Times at which wells were opened (for WCYCLE)
532 std::map<std::string, double> well_open_times_;
533
534 // Times at which wells were shut (for WCYCLE)
535 std::map<std::string, double> well_close_times_;
536
537 std::vector<ConnectionIndexMap> conn_idx_map_{};
538 std::function<bool(const std::string&)> not_on_process_{};
539
540 // a vector of all the wells.
541 std::vector<WellInterfaceGeneric<Scalar>*> well_container_generic_{};
542
543 std::vector<int> local_shut_wells_{};
544
545 std::vector<ParallelWellInfo<Scalar>> parallel_well_info_;
546 std::vector<std::reference_wrapper<ParallelWellInfo<Scalar>>> local_parallel_well_info_;
547
548 std::vector<WellProdIndexCalculator<Scalar>> prod_index_calc_;
549
550 std::vector<int> pvt_region_idx_;
551
552 mutable std::unordered_set<std::string> closed_this_step_;
553
554 GuideRate guideRate_;
555 std::unique_ptr<VFPProperties<Scalar>> vfp_properties_{};
556
557 // Network pressures for output and initialization
558 std::map<std::string, Scalar> node_pressures_;
559 // Valid network pressures for output and initialization for safe restart after failed iterations
560 std::map<std::string, Scalar> last_valid_node_pressures_;
561
562 // previous injection multiplier, it is used in the injection multiplier calculation for WINJMULT keyword
563 std::unordered_map<std::string, std::vector<Scalar>> prev_inj_multipliers_;
564
565 // Handling for filter cake injection multipliers
566 std::unordered_map<std::string, WellFilterCake<Scalar>> filter_cake_;
567
568 /*
569 The various wellState members should be accessed and modified
570 through the accessor functions wellState(), prevWellState(),
571 commitWellState(), resetWellState(), nupcolWellState() and
572 updateNupcolWGState().
573 */
578
580
581 // Store maps of group name and new group controls for output
582 std::map<std::string, std::vector<Group::ProductionCMode>> switched_prod_groups_;
583 std::map<std::string, std::array<std::vector<Group::InjectionCMode>, 3>> switched_inj_groups_;
584 // Store map of group name and close offending well for output
585 std::map<std::string, std::pair<std::string, std::string>> closed_offending_wells_;
586
587private:
588 WellInterfaceGeneric<Scalar>* getGenWell(const std::string& well_name);
589
590 template <typename Iter, typename Body>
591 void wellUpdateLoop(Iter first, Iter last, const int timeStepIdx, Body&& body);
592
593 void updateEclWellsConstraints(const int timeStepIdx,
594 const SimulatorUpdate& sim_update,
595 const SummaryState& st);
596
597 void updateEclWellsCTFFromAction(const int timeStepIdx,
598 const SimulatorUpdate& sim_update);
599
615 template <typename LoopBody>
616 void loopOwnedWells(LoopBody&& loopBody) const;
617};
618
619} // namespace Opm
620
621#endif
Definition: BlackoilWellModelGasLift.hpp:41
Class for handling the blackoil well model.
Definition: BlackoilWellModelGeneric.hpp:94
std::unordered_map< std::string, WellFilterCake< Scalar > > filter_cake_
Definition: BlackoilWellModelGeneric.hpp:566
void updateNetworkActiveState(const int report_step)
Checks if network is active (at least one network well on prediction).
void updateNupcolWGState()
Definition: BlackoilWellModelGeneric.hpp:359
bool initial_step_
Definition: BlackoilWellModelGeneric.hpp:523
const Well & getWellEcl(const std::string &well_name) const
void assignNodeValues(std::map< std::string, data::NodeData > &nodevalues, const int reportStepIdx) const
const EclipseState & eclipseState() const
Definition: BlackoilWellModelGeneric.hpp:228
bool checkGroupHigherConstraints(const Group &group, DeferredLogger &deferred_logger, const int reportStepIdx, const int max_number_of_group_switch)
GuideRate guideRate_
Definition: BlackoilWellModelGeneric.hpp:554
const SummaryState & summaryState_
Definition: BlackoilWellModelGeneric.hpp:512
const GuideRate & guideRate() const
Definition: BlackoilWellModelGeneric.hpp:232
BlackoilWellModelGeneric(Schedule &schedule, BlackoilWellModelGasLiftGeneric< Scalar > &gaslift, const SummaryState &summaryState, const EclipseState &eclState, const PhaseUsage &phase_usage, const Parallel::Communication &comm)
bool reportStepStarts() const
Definition: BlackoilWellModelGeneric.hpp:241
virtual void calculateProductivityIndexValuesShutWells(const int reportStepIdx, DeferredLogger &deferred_logger)=0
void checkGconsaleLimits(const Group &group, WellState< Scalar > &well_state, const int reportStepIdx, DeferredLogger &deferred_logger)
bool hasLocalWell(const std::string &wname) const
Returns true if well is defined and has connections on current rank.
bool wellsActive() const
return true if wells are available in the reservoir
std::map< std::string, double > well_close_times_
Definition: BlackoilWellModelGeneric.hpp:535
void reportGroupSwitching(DeferredLogger &local_deferredLogger) const
bool report_step_starts_
Definition: BlackoilWellModelGeneric.hpp:524
bool hasOpenLocalWell(const std::string &well_name) const
Returns true if well is defined, open and has connections on current rank.
virtual void calcInjResvCoeff(const int fipnum, const int pvtreg, std::vector< Scalar > &resv_coeff)=0
GroupState< Scalar > & groupState()
Definition: BlackoilWellModelGeneric.hpp:171
std::unordered_map< int, std::vector< MSWellTracerRate< Scalar > > > MswTracerRates
Definition: BlackoilWellModelGeneric.hpp:502
virtual int compressedIndexForInteriorLGR(const std::string &lgr_tag, const Connection &conn) const
Definition: BlackoilWellModelGeneric.hpp:104
std::vector< std::vector< int > > getMaxWellConnections() const
bool wellStructureChangedDynamically_
Definition: BlackoilWellModelGeneric.hpp:579
bool networkActive() const
return true if network is active (at least one network well in prediction mode)
const Schedule & schedule() const
Definition: BlackoilWellModelGeneric.hpp:138
const WellGroupEvents & reportStepStartEvents() const
Definition: BlackoilWellModelGeneric.hpp:237
Schedule & schedule_
Definition: BlackoilWellModelGeneric.hpp:510
std::vector< std::reference_wrapper< ParallelWellInfo< Scalar > > > local_parallel_well_info_
Definition: BlackoilWellModelGeneric.hpp:546
std::map< std::string, Scalar > last_valid_node_pressures_
Definition: BlackoilWellModelGeneric.hpp:560
bool forceShutWellByName(const std::string &wellname, const double simulation_time, const bool dont_shut_grup_wells)
std::vector< Well > wells_ecl_
Definition: BlackoilWellModelGeneric.hpp:528
std::vector< ParallelWellInfo< Scalar > > parallel_well_info_
Definition: BlackoilWellModelGeneric.hpp:545
BlackoilWellModelWBP< Scalar > wbp_
Definition: BlackoilWellModelGeneric.hpp:516
void updateWellPotentials(const int reportStepIdx, const bool onlyAfterEvent, const SummaryConfig &summaryConfig, DeferredLogger &deferred_logger)
virtual void calcResvCoeff(const int fipnum, const int pvtreg, const std::vector< Scalar > &production_rates, std::vector< Scalar > &resv_coeff)=0
std::vector< WellInterfaceGeneric< Scalar > * > genericWells()
Definition: BlackoilWellModelGeneric.hpp:144
std::map< std::string, Scalar > node_pressures_
Definition: BlackoilWellModelGeneric.hpp:558
WellGroupEvents report_step_start_events_
Well group events at start of report step.
Definition: BlackoilWellModelGeneric.hpp:577
void assignDynamicWellStatus(data::Wells &wsrpt, const int reportStepIdx) const
void assignShutConnections(data::Wells &wsrpt, const int reportStepIndex) const
const WellTestState & wellTestState() const
Definition: BlackoilWellModelGeneric.hpp:175
void updateClosedWellsThisStep(const std::string &well_name) const
Definition: BlackoilWellModelGeneric.hpp:246
void assignGroupControl(const Group &group, data::GroupData &gdata) const
void assignInjectionWellTargets(const Well &well, data::WellControlLimits &limits) const
void prepareDeserialize(int report_step, const std::size_t numCells, bool handle_ms_well, bool enable_distributed_wells)
std::vector< WellProdIndexCalculator< Scalar > > prod_index_calc_
Definition: BlackoilWellModelGeneric.hpp:548
const ConnectionIndexMap & connectionIndexMap(const std::size_t idx)
Definition: BlackoilWellModelGeneric.hpp:292
void updateFiltrationModelsPostStep(const double dt, const std::size_t water_index, DeferredLogger &deferred_logger)
std::vector< int > local_shut_wells_
Definition: BlackoilWellModelGeneric.hpp:543
std::vector< int > pvt_region_idx_
Definition: BlackoilWellModelGeneric.hpp:550
void updateInjFCMult(DeferredLogger &deferred_logger)
virtual void createWellContainer(const int time_step)=0
void setWsolvent(const Group &group, const int reportStepIdx, Scalar wsolvent)
void assignWellTracerRates(data::Wells &wsrpt, const WellTracerRates &wellTracerRates, const unsigned reportStep) const
void updateEclWells(const int timeStepIdx, const SimulatorUpdate &sim_update, const SummaryState &st)
const WGState< Scalar > & prevWGState() const
Definition: BlackoilWellModelGeneric.hpp:328
std::vector< Well > getLocalWells(const int timeStepIdx) const
const std::vector< PerforationData< Scalar > > & perfData(const int well_idx) const
Definition: BlackoilWellModelGeneric.hpp:223
bool terminalOutput() const
Definition: BlackoilWellModelGeneric.hpp:133
std::unordered_set< std::string > closed_this_step_
Definition: BlackoilWellModelGeneric.hpp:552
data::GroupAndNetworkValues groupAndNetworkData(const int reportStepIdx) const
void initFromRestartFile(const RestartValue &restartValues, std::unique_ptr< WellTestState > wtestState, const std::size_t numCells, bool handle_ms_well, bool enable_distributed_wells)
virtual void initWellContainer(const int reportStepIdx)=0
bool wells_active_
Definition: BlackoilWellModelGeneric.hpp:521
bool shouldBalanceNetwork(const int reportStepIndex, const int iterationIdx) const
const WellState< Scalar > & wellState() const
Definition: BlackoilWellModelGeneric.hpp:150
std::map< std::string, std::pair< std::string, std::string > > closed_offending_wells_
Definition: BlackoilWellModelGeneric.hpp:585
void commitWGState(WGState< Scalar > wgstate)
Definition: BlackoilWellModelGeneric.hpp:338
void assignMswTracerRates(data::Wells &wsrpt, const MswTracerRates &mswTracerRates, const unsigned reportStep) const
void assignProductionWellTargets(const Well &well, data::WellControlLimits &limits) const
void commitWGState()
Definition: BlackoilWellModelGeneric.hpp:201
std::vector< std::reference_wrapper< ParallelWellInfo< Scalar > > > createLocalParallelWellInfo(const std::vector< Well > &wells)
Create the parallel well information.
std::vector< WellInterfaceGeneric< Scalar > * > well_container_generic_
Definition: BlackoilWellModelGeneric.hpp:541
bool needPreStepNetworkRebalance(const int report_step) const
void assignGroupValues(const int reportStepIdx, std::map< std::string, data::GroupData > &gvalues) const
std::optional< int > last_run_wellpi_
Definition: BlackoilWellModelGeneric.hpp:526
bool network_active_
Definition: BlackoilWellModelGeneric.hpp:522
const Parallel::Communication & comm() const
Definition: BlackoilWellModelGeneric.hpp:226
const WellState< Scalar > & prevWellState() const
Definition: BlackoilWellModelGeneric.hpp:323
const Parallel::Communication & comm_
Definition: BlackoilWellModelGeneric.hpp:514
WGState< Scalar > last_valid_wgstate_
Definition: BlackoilWellModelGeneric.hpp:575
bool wasDynamicallyShutThisTimeStep(const std::string &well_name) const
std::map< std::string, std::array< std::vector< Group::InjectionCMode >, 3 > > switched_inj_groups_
Definition: BlackoilWellModelGeneric.hpp:583
bool isOwner(const std::string &wname) const
Definition: BlackoilWellModelGeneric.hpp:281
std::map< std::string, double > well_open_times_
Definition: BlackoilWellModelGeneric.hpp:532
bool terminal_output_
Definition: BlackoilWellModelGeneric.hpp:520
WGState< Scalar > nupcol_wgstate_
Definition: BlackoilWellModelGeneric.hpp:576
std::vector< ConnectionIndexMap > conn_idx_map_
Definition: BlackoilWellModelGeneric.hpp:537
const GroupState< Scalar > & groupState() const
Definition: BlackoilWellModelGeneric.hpp:140
virtual void calculateProductivityIndexValues(DeferredLogger &deferred_logger)=0
std::vector< std::vector< PerforationData< Scalar > > > well_perf_data_
Definition: BlackoilWellModelGeneric.hpp:529
std::unordered_map< int, std::vector< WellTracerRate< Scalar > > > WellTracerRates
Definition: BlackoilWellModelGeneric.hpp:497
void updateFiltrationModelsPreStep(DeferredLogger &deferred_logger)
std::map< std::string, std::vector< Group::ProductionCMode > > switched_prod_groups_
Definition: BlackoilWellModelGeneric.hpp:582
void updateAndCommunicateGroupData(const int reportStepIdx, const int iterationIdx, const Scalar tol_nupcol, const bool update_wellgrouptarget, DeferredLogger &deferred_logger)
BlackoilWellModelGasLiftGeneric< Scalar > & gen_gaslift_
Definition: BlackoilWellModelGeneric.hpp:515
bool operator==(const BlackoilWellModelGeneric &rhs) const
WGState< Scalar > active_wgstate_
Definition: BlackoilWellModelGeneric.hpp:574
const std::map< std::string, double > & wellCloseTimes() const
Definition: BlackoilWellModelGeneric.hpp:236
WellState< Scalar > & wellState()
Definition: BlackoilWellModelGeneric.hpp:158
WellTestState & wellTestState()
Definition: BlackoilWellModelGeneric.hpp:173
std::vector< int > getCellsForConnections(const Well &well) const
const PhaseUsage & phaseUsage() const
Definition: BlackoilWellModelGeneric.hpp:139
void updateWsolvent(const Group &group, const int reportStepIdx, const WellState< Scalar > &wellState)
const ParallelWellInfo< Scalar > & parallelWellInfo(const std::size_t idx) const
Definition: BlackoilWellModelGeneric.hpp:278
GuideRate & guideRate()
Definition: BlackoilWellModelGeneric.hpp:233
virtual ~BlackoilWellModelGeneric()=default
void calculateEfficiencyFactors(const int reportStepIdx)
const std::vector< Well > & eclWells() const
Definition: BlackoilWellModelGeneric.hpp:130
virtual void computePotentials(const std::size_t widx, const WellState< Scalar > &well_state_copy, std::string &exc_msg, ExceptionType::ExcEnum &exc_type, DeferredLogger &deferred_logger)=0
const SummaryState & summaryState() const
Definition: BlackoilWellModelGeneric.hpp:230
void assignMassGasRate(data::Wells &wsrpt, const Scalar gasDensity) const
std::function< bool(const std::string &)> not_on_process_
Definition: BlackoilWellModelGeneric.hpp:538
Scalar wellPI(const std::string &well_name) const
std::unique_ptr< VFPProperties< Scalar > > vfp_properties_
Definition: BlackoilWellModelGeneric.hpp:555
std::unordered_map< std::string, std::vector< Scalar > > prev_inj_multipliers_
Definition: BlackoilWellModelGeneric.hpp:563
void serializeOp(Serializer &serializer)
Definition: BlackoilWellModelGeneric.hpp:255
Scalar updateNetworkPressures(const int reportStepIdx, const Scalar damping_factor, const Scalar update_upper_bound)
const EclipseState & eclState_
Definition: BlackoilWellModelGeneric.hpp:513
std::vector< const WellInterfaceGeneric< Scalar > * > genericWells() const
Definition: BlackoilWellModelGeneric.hpp:141
bool wasDynamicallyShutThisTimeStep(const int well_index) const
void assignWellTargets(data::Wells &wsrpt) const
void checkGEconLimits(const Group &group, const double simulation_time, const int report_step_idx, DeferredLogger &deferred_logger)
void runWellPIScaling(const int reportStepIdx, DeferredLogger &local_deferredLogger)
void resetWGState()
Definition: BlackoilWellModelGeneric.hpp:348
Scalar wellPI(const int well_index) const
PhaseUsage phase_usage_
Definition: BlackoilWellModelGeneric.hpp:519
const WellState< Scalar > & nupcolWellState() const
Definition: BlackoilWellModelGeneric.hpp:167
const std::map< std::string, double > & wellOpenTimes() const
Definition: BlackoilWellModelGeneric.hpp:235
void updateInjMult(DeferredLogger &deferred_logger)
std::vector< std::string > getWellsForTesting(const int timeStepIdx, const double simulationTime)
virtual int compressedIndexForInterior(int cartesian_cell_idx) const =0
get compressed index for interior cells (-1, otherwise
Class for handling the blackoil well model.
Definition: BlackoilWellModelWBP.hpp:42
Connection index mappings.
Definition: ConnectionIndexMap.hpp:33
Definition: DeferredLogger.hpp:57
Definition: GroupState.hpp:43
Class encapsulating some information about parallel wells.
Definition: ParallelWellInfo.hpp:195
Definition: WellInterfaceGeneric.hpp:53
Definition: WellState.hpp:65
ExcEnum
Definition: DeferredLogger.hpp:45
Dune::Communication< MPIComm > Communication
Definition: ParallelCommunication.hpp:30
Definition: blackoilnewtonmethodparams.hpp:31
Definition: blackoilboundaryratevector.hh:39
Definition: BlackoilWellModelGeneric.hpp:85
static constexpr bool value
Definition: BlackoilWellModelGeneric.hpp:85
Definition: BlackoilPhases.hpp:46
Definition: WGState.hpp:41