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
46
47#include <algorithm>
48#include <cstddef>
49#include <functional>
50#include <map>
51#include <memory>
52#include <optional>
53#include <string>
54#include <unordered_map>
55#include <unordered_set>
56#include <vector>
57
58
59namespace Opm {
60 class DeferredLogger;
61 class EclipseState;
62 template<typename Scalar, typename IndexTraits> class BlackoilWellModelGasLiftGeneric;
63 template<typename Scalar, typename IndexTraits> class BlackoilWellModelNetworkGeneric;
64 template<typename Scalar, typename IndexTraits> class GasLiftGroupInfo;
65 template<typename Scalar, typename IndexTraits> class GasLiftSingleWellGeneric;
66 template<class Scalar> class GasLiftWellState;
67 class Group;
68 class GuideRateConfig;
69 class RestartValue;
70 class Schedule;
71 struct SimulatorUpdate;
72 class SummaryConfig;
73 template<typename Scalar, typename IndexTraits> class VFPProperties;
74 template<typename Scalar, typename IndexTraits> class WellInterfaceGeneric;
75 template<typename Scalar, typename IndexTraits> class WellState;
76} // namespace Opm
77
78namespace Opm { namespace data {
79 struct GroupData;
80 struct GroupGuideRates;
81 class GroupAndNetworkValues;
82 struct NodeData;
83}} // namespace Opm::data
84
85namespace Opm::Parameters {
86
87struct EnableTerminalOutput { static constexpr bool value = true; };
88
89} // namespace Opm::Parameters
90
91namespace Opm {
92
94template<typename Scalar, typename IndexTraits>
96{
98public:
102 const SummaryState& summaryState,
103 const EclipseState& eclState,
104 const PhaseUsageInfo<IndexTraits>& phase_usage,
106
107 virtual ~BlackoilWellModelGeneric() = default;
108 virtual int compressedIndexForInteriorLGR([[maybe_unused]] const std::string& lgr_tag,
109 [[maybe_unused]] const Connection& conn) const
110 {
111 throw std::runtime_error("compressedIndexForInteriorLGR not implemented");
112 }
113
114 int numLocalWells() const;
115 int numLocalWellsEnd() const;
117 int numPhases() const;
118
120 bool wellsActive() const;
121
123 bool hasLocalWell(const std::string& wname) const;
124
126 bool hasOpenLocalWell(const std::string& well_name) const;
127
128 // whether there exists any multisegment well open on this process
129 bool anyMSWellOpenLocal() const;
130
131 const std::vector<Well>& eclWells() const
132 { return wells_ecl_; }
133
134 bool terminalOutput() const
135 { return terminal_output_; }
136
137 const Well& getWellEcl(const std::string& well_name) const;
138 std::vector<Well> getLocalWells(const int timeStepIdx) const;
139 const Schedule& schedule() const { return schedule_; }
141 const GroupState<Scalar>& groupState() const { return this->active_wgstate_.group_state; }
142 std::vector<const WellInterfaceGeneric<Scalar, IndexTraits>*> genericWells() const
143 { return {well_container_generic_.begin(), well_container_generic_.end()}; }
144
145 std::vector<WellInterfaceGeneric<Scalar, IndexTraits>*> genericWells()
146 { return well_container_generic_; }
147
148 /*
149 Immutable version of the currently active wellstate.
150 */
152 {
153 return this->active_wgstate_.well_state;
154 }
155
156 /*
157 Mutable version of the currently active wellstate.
158 */
160 {
161 return this->active_wgstate_.well_state;
162 }
163
164 /*
165 Will return the currently active nupcolWellState; must update
166 the internal nupcol wellstate with updateNupcolWGState() first.
167
168 Both const and non-const accessors are provided. The non-const
169 accessor is required for the WellStateGuard pattern and pushWellState()
170 in WellGroupHelper, which temporarily switches WellGroupHelper to use this state.
171 */
173 {
174 return this->nupcol_wgstate_.well_state;
175 }
177 {
178 return this->nupcol_wgstate_.well_state;
179 }
180 GroupState<Scalar>& groupState() { return this->active_wgstate_.group_state; }
181
182 WellTestState& wellTestState() { return this->active_wgstate_.well_test_state; }
183
184 const WellTestState& wellTestState() const { return this->active_wgstate_.well_test_state; }
185
186 Scalar wellPI(const int well_index) const;
187 Scalar wellPI(const std::string& well_name) const;
188
189 void updateEclWells(const int timeStepIdx,
190 const SimulatorUpdate& sim_update,
191 const SummaryState& st);
192
193 void initFromRestartFile(const RestartValue& restartValues,
194 std::unique_ptr<WellTestState> wtestState,
195 const std::size_t numCells,
196 bool handle_ms_well,
197 bool enable_distributed_wells);
198
199 void prepareDeserialize(int report_step,
200 const std::size_t numCells,
201 bool handle_ms_well,
202 bool enable_distributed_wells);
203
204 /*
205 Will assign the internal member last_valid_well_state_ to the
206 current value of the this->active_well_state_. The state stored
207 with storeWellState() can then subsequently be recovered with the
208 resetWellState() method.
209 */
211
212 data::GroupAndNetworkValues groupAndNetworkData(const int reportStepIdx) const;
213
216 bool forceShutWellByName(const std::string& wellname,
217 const double simulation_time,
218 const bool dont_shut_grup_wells);
219
220 const std::vector<PerforationData<Scalar>>& perfData(const int well_idx) const
221 { return well_perf_data_[well_idx]; }
222
223 const Parallel::Communication& comm() const { return comm_; }
224
225 const EclipseState& eclipseState() const { return eclState_; }
226
227 const SummaryState& summaryState() const { return summaryState_; }
228
229 const GuideRate& guideRate() const { return guideRate_; }
230 GuideRate& guideRate() { return guideRate_; }
231
232 const std::map<std::string, double>& wellOpenTimes() const { return well_open_times_; }
233 const std::map<std::string, double>& wellCloseTimes() const { return well_close_times_; }
234 const WellGroupEvents& reportStepStartEvents() const { return report_step_start_events_; }
235
236 std::vector<int> getCellsForConnections(const Well& well) const;
237
238 bool reportStepStarts() const { return report_step_starts_; }
239
240 void updateClosedWellsThisStep(const std::string& well_name) const
241 {
242 this->closed_this_step_.insert(well_name);
243 }
244 bool wasDynamicallyShutThisTimeStep(const std::string& well_name) const;
245
246 void logPrimaryVars() const;
247
248 template<class Serializer>
249 void serializeOp(Serializer& serializer)
250 {
251 serializer(initial_step_);
252 serializer(report_step_starts_);
253 serializer(last_run_wellpi_);
254 serializer(local_shut_wells_);
255 serializer(closed_this_step_);
256 serializer(guideRate_);
257 serializer(genNetwork_);
258 serializer(prev_inj_multipliers_);
259 serializer(active_wgstate_);
260 serializer(last_valid_wgstate_);
261 serializer(nupcol_wgstate_);
262 serializer(switched_prod_groups_);
263 serializer(switched_inj_groups_);
264 serializer(closed_offending_wells_);
265 serializer(gen_gaslift_);
266 }
267
268 bool operator==(const BlackoilWellModelGeneric& rhs) const;
269
271 parallelWellInfo(const std::size_t idx) const
272 { return local_parallel_well_info_[idx].get(); }
273
274 bool isOwner(const std::string& wname) const
275 {
276 return this->parallelWellSatisfies
277 (wname, [](const auto& pwInfo) { return pwInfo.isOwner(); });
278 }
279
280 bool hasLocalCells(const std::string& wname) const
281 {
282 return this->parallelWellSatisfies
283 (wname, [](const auto& pwInfo) { return pwInfo.hasLocalCells(); });
284 }
285
286 const ConnectionIndexMap& connectionIndexMap(const std::size_t idx)
287 { return conn_idx_map_[idx]; }
288
291 std::pair<int, int> getGroupFipnumAndPvtreg() const;
292
293 virtual void calcResvCoeff(const int fipnum,
294 const int pvtreg,
295 const std::vector<Scalar>& production_rates,
296 std::vector<Scalar>& resv_coeff) const = 0;
297 virtual void calcInjResvCoeff(const int fipnum,
298 const int pvtreg,
299 std::vector<Scalar>& resv_coeff) const = 0;
300
302 {
303 return *vfp_properties_;
304 }
305
306 void updateAndCommunicateGroupData(const int reportStepIdx,
307 const int iterationIdx,
308 const Scalar tol_nupcol,
309 // we only want to update the wellgroup target
310 // after the groups have found their controls
311 const bool update_wellgrouptarget,
312 DeferredLogger& deferred_logger);
313
314 const EclipseState& eclState() const
315 { return eclState_; }
316
317protected:
318 /*
319 The dynamic state of the well model is maintained with an instance
320 of the WellState class. Currently we have
321 three different wellstate instances:
322
323 1. The currently active wellstate is in the active_well_state_
324 member. That is the state which is mutated by the simulator.
325
326 2. In the case timestep fails to converge and we must go back and
327 try again with a smaller timestep we need to recover the last
328 valid wellstate. This is maintained with the
329 last_valid_well_state_ member and the functions
330 commitWGState() and resetWellState().
331
332 3. For the NUPCOL functionality we should either use the
333 currently active wellstate or a wellstate frozen at max
334 nupcol iterations. This is handled with the member
335 nupcol_well_state_ and the updateNupcolWGState() function.
336 */
337
338 /*
339 Will return the last good wellstate. This is typcially used when
340 initializing a new report step where the Schedule object might
341 have introduced new wells. The wellstate returned by
342 prevWellState() must have been stored with the commitWGState()
343 function first.
344 */
346 {
347 return this->last_valid_wgstate_.well_state;
348 }
349
351 {
352 return this->last_valid_wgstate_;
353 }
354
355 /*
356 Will store a copy of the input argument well_state in the
357 last_valid_well_state_ member, that state can then be recovered
358 with a subsequent call to resetWellState().
359 */
361 {
362 this->last_valid_wgstate_ = std::move(wgstate);
363 }
364
365 /*
366 Will update the internal variable active_well_state_ to whatever
367 was stored in the last_valid_well_state_ member. This function
368 works in pair with commitWellState() which should be called first.
369 */
371 {
373 this->genNetwork_.resetState();
374 // Update helper pointers to reference the restored active state
375 this->group_state_helper_.updateState(this->wellState(), this->groupState());
376 }
377
378 /*
379 Will store the current active wellstate in the nupcol_well_state_
380 member. This can then be subsequently retrieved with accessor
381 nupcolWellState().
382 */
384 {
385 this->nupcol_wgstate_ = this->active_wgstate_;
386 }
387
388 void reportGroupSwitching(DeferredLogger& local_deferredLogger) const;
389
392 std::vector<std::reference_wrapper<ParallelWellInfo<Scalar>>>
393 createLocalParallelWellInfo(const std::vector<Well>& wells);
394
397
398 bool wasDynamicallyShutThisTimeStep(const int well_index) const;
399
400 void updateWsolvent(const Group& group,
401 const int reportStepIdx,
403 void setWsolvent(const Group& group,
404 const int reportStepIdx,
405 Scalar wsolvent);
406
411 void assignDynamicWellStatus(data::Wells& wsrpt) const;
412
424 void assignShutConnections(data::Wells& wsrpt,
425 const int reportStepIndex) const;
426
427 void assignWellTargets(data::Wells& wsrpt) const;
428 void assignProductionWellTargets(const Well& well, data::WellControlLimits& limits) const;
429 void assignInjectionWellTargets(const Well& well, data::WellControlLimits& limits) const;
430
431 void assignGroupControl(const Group& group,
432 data::GroupData& gdata) const;
433 void assignGroupValues(const int reportStepIdx,
434 std::map<std::string, data::GroupData>& gvalues) const;
435
436 void calculateEfficiencyFactors(const int reportStepIdx);
437
438 void checkGconsaleLimits(const Group& group,
440 const int reportStepIdx,
441 DeferredLogger& deferred_logger);
442
443 void checkGEconLimits(const Group& group,
444 const double simulation_time,
445 const int report_step_idx,
446 DeferredLogger& deferred_logger);
447
448 bool checkGroupHigherConstraints(const Group& group,
449 DeferredLogger& deferred_logger,
450 const int reportStepIdx,
451 const int max_number_of_group_switch,
452 const bool update_group_switching_log);
453
455
457
458 virtual void computePotentials(const std::size_t widx,
459 const WellState<Scalar, IndexTraits>& well_state_copy,
460 std::string& exc_msg,
461 ExceptionType::ExcEnum& exc_type,
462 DeferredLogger& deferred_logger) = 0;
463
464 // Calculating well potentials for each well
465 void updateWellPotentials(const int reportStepIdx,
466 const bool onlyAfterEvent,
467 const SummaryConfig& summaryConfig,
468 DeferredLogger& deferred_logger);
469
471
472 void updateInjMult(DeferredLogger& deferred_logger);
473 void updateInjFCMult(DeferredLogger& deferred_logger);
474
475 void updateFiltrationModelsPostStep(const double dt,
476 const std::size_t water_index,
477 DeferredLogger& deferred_logger);
478
480
481 // create the well container
482 virtual void createWellContainer(const int time_step) = 0;
483 virtual void initWellContainer(const int reportStepIdx) = 0;
484
485 virtual void calculateProductivityIndexValuesShutWells(const int reportStepIdx,
486 DeferredLogger& deferred_logger) = 0;
487 virtual void calculateProductivityIndexValues(DeferredLogger& deferred_logger) = 0;
488
489 void runWellPIScaling(const int reportStepIdx,
490 DeferredLogger& local_deferredLogger);
491
493 virtual int compressedIndexForInterior(int cartesian_cell_idx) const = 0;
494
495 std::vector<std::vector<int>> getMaxWellConnections() const;
496
497 std::vector<std::string> getWellsForTesting(const int timeStepIdx,
498 const double simulationTime);
499
500 using WellTracerRates = std::unordered_map<int, std::vector<WellTracerRate<Scalar>>>;
501 void assignWellTracerRates(data::Wells& wsrpt,
502 const WellTracerRates& wellTracerRates,
503 const unsigned reportStep) const;
504
505 using MswTracerRates = std::unordered_map<int, std::vector<MSWellTracerRate<Scalar>>>;
506 void assignMswTracerRates(data::Wells& wsrpt,
507 const MswTracerRates& mswTracerRates,
508 const unsigned reportStep) const;
509
510 void assignMassGasRate(data::Wells& wsrpt,
511 const Scalar gasDensity) const;
512
513 Schedule& schedule_;
514
515 const SummaryState& summaryState_;
516 const EclipseState& eclState_;
520
522 bool terminal_output_{false};
523 bool wells_active_{false};
526
527 std::optional<int> last_run_wellpi_{};
528
529 std::vector<Well> wells_ecl_;
530 std::vector<std::vector<PerforationData<Scalar>>> well_perf_data_;
531
532 // Times at which wells were opened (for WCYCLE)
533 std::map<std::string, double> well_open_times_;
534
535 // Times at which wells were shut (for WCYCLE)
536 std::map<std::string, double> well_close_times_;
537
538 std::vector<ConnectionIndexMap> conn_idx_map_{};
539 std::function<bool(const std::string&)> not_on_process_{};
540
541 // a vector of all the wells.
542 std::vector<WellInterfaceGeneric<Scalar, IndexTraits>*> well_container_generic_{};
543
544 std::vector<int> local_shut_wells_{};
545
546 std::vector<ParallelWellInfo<Scalar>> parallel_well_info_;
547 std::vector<std::reference_wrapper<ParallelWellInfo<Scalar>>> local_parallel_well_info_;
548
549 std::vector<WellProdIndexCalculator<Scalar>> prod_index_calc_;
550
551 std::vector<int> pvt_region_idx_;
552
553 mutable std::unordered_set<std::string> closed_this_step_;
554
555 GuideRate guideRate_;
556 std::unique_ptr<VFPProperties<Scalar, IndexTraits>> vfp_properties_{};
557
558 // previous injection multiplier, it is used in the injection multiplier calculation for WINJMULT keyword
559 std::unordered_map<std::string, std::vector<Scalar>> prev_inj_multipliers_;
560
561 // Handling for filter cake injection multipliers
562 std::unordered_map<std::string, WellFilterCake<Scalar, IndexTraits>> filter_cake_;
563
564 /*
565 The various wellState members should be accessed and modified
566 through the accessor functions wellState(), prevWellState(),
567 commitWellState(), resetWellState(), nupcolWellState() and
568 updateNupcolWGState().
569 */
575
577
578 // Store maps of group name and new group controls for output
579 std::map<std::string, std::vector<Group::ProductionCMode>> switched_prod_groups_;
580 std::map<std::string, std::array<std::vector<Group::InjectionCMode>, 3>> switched_inj_groups_;
581 // Store map of group name and close offending well for output
582 std::map<std::string, std::pair<std::string, std::string>> closed_offending_wells_;
583
585
586private:
587 WellInterfaceGeneric<Scalar, IndexTraits>* getGenWell(const std::string& well_name);
588
589 template <typename Iter, typename Body>
590 void wellUpdateLoop(Iter first, Iter last, const int timeStepIdx, Body&& body);
591
592 void updateEclWellsConstraints(const int timeStepIdx,
593 const SimulatorUpdate& sim_update,
594 const SummaryState& st);
595
596 void updateEclWellsCTFFromAction(const int timeStepIdx,
597 const SimulatorUpdate& sim_update);
598
612 template <typename Predicate>
613 bool parallelWellSatisfies(const std::string& wname, Predicate&& p) const
614 {
615 auto pwInfoPos = std::find_if(this->parallel_well_info_.begin(),
616 this->parallel_well_info_.end(),
617 [&wname](const auto& pwInfo)
618 { return pwInfo.name() == wname; });
619
620 return (pwInfoPos != this->parallel_well_info_.end())
621 && p(*pwInfoPos);
622 }
623
639 template <typename LoopBody>
640 void loopOwnedWells(LoopBody&& loopBody) const;
641};
642
643} // namespace Opm
644
645#endif
Definition: BlackoilWellModelGasLift.hpp:42
Class for handling the blackoil well model.
Definition: BlackoilWellModelGeneric.hpp:96
std::map< std::string, std::vector< Group::ProductionCMode > > switched_prod_groups_
Definition: BlackoilWellModelGeneric.hpp:579
void updateAndCommunicateGroupData(const int reportStepIdx, const int iterationIdx, const Scalar tol_nupcol, const bool update_wellgrouptarget, DeferredLogger &deferred_logger)
GroupStateHelperType & groupStateHelper()
Definition: BlackoilWellModelGeneric.hpp:289
const EclipseState & eclState_
Definition: BlackoilWellModelGeneric.hpp:516
const PhaseUsageInfo< IndexTraits > & phaseUsage() const
Definition: BlackoilWellModelGeneric.hpp:140
const WGState< Scalar, IndexTraits > & prevWGState() const
Definition: BlackoilWellModelGeneric.hpp:350
std::vector< Well > getLocalWells(const int timeStepIdx) const
const ConnectionIndexMap & connectionIndexMap(const std::size_t idx)
Definition: BlackoilWellModelGeneric.hpp:286
WellState< Scalar, IndexTraits > & nupcolWellState()
Definition: BlackoilWellModelGeneric.hpp:176
const GroupState< Scalar > & groupState() const
Definition: BlackoilWellModelGeneric.hpp:141
const PhaseUsageInfo< IndexTraits > & phase_usage_info_
Definition: BlackoilWellModelGeneric.hpp:521
void assignDynamicWellStatus(data::Wells &wsrpt) const
GroupStateHelperType group_state_helper_
Definition: BlackoilWellModelGeneric.hpp:573
void serializeOp(Serializer &serializer)
Definition: BlackoilWellModelGeneric.hpp:249
bool reportStepStarts() const
Definition: BlackoilWellModelGeneric.hpp:238
bool operator==(const BlackoilWellModelGeneric &rhs) const
WGState< Scalar, IndexTraits > last_valid_wgstate_
Definition: BlackoilWellModelGeneric.hpp:571
const Parallel::Communication & comm() const
Definition: BlackoilWellModelGeneric.hpp:223
virtual int compressedIndexForInteriorLGR(const std::string &lgr_tag, const Connection &conn) const
Definition: BlackoilWellModelGeneric.hpp:108
GuideRate guideRate_
Definition: BlackoilWellModelGeneric.hpp:555
virtual int compressedIndexForInterior(int cartesian_cell_idx) const =0
get compressed index for interior cells (-1, otherwise
std::vector< WellInterfaceGeneric< Scalar, IndexTraits > * > well_container_generic_
Definition: BlackoilWellModelGeneric.hpp:542
WellGroupEvents report_step_start_events_
Well group events at start of report step.
Definition: BlackoilWellModelGeneric.hpp:574
void resetWGState()
Definition: BlackoilWellModelGeneric.hpp:370
void assignWellTargets(data::Wells &wsrpt) const
WGState< Scalar, IndexTraits > active_wgstate_
Definition: BlackoilWellModelGeneric.hpp:570
Scalar wellPI(const int well_index) const
virtual ~BlackoilWellModelGeneric()=default
std::vector< Well > wells_ecl_
Definition: BlackoilWellModelGeneric.hpp:529
bool hasLocalWell(const std::string &wname) const
Returns true if well is defined and has connections on current rank.
void assignInjectionWellTargets(const Well &well, data::WellControlLimits &limits) const
const ParallelWellInfo< Scalar > & parallelWellInfo(const std::size_t idx) const
Definition: BlackoilWellModelGeneric.hpp:271
BlackoilWellModelWBP< Scalar, IndexTraits > wbp_
Definition: BlackoilWellModelGeneric.hpp:519
const WellGroupEvents & reportStepStartEvents() const
Definition: BlackoilWellModelGeneric.hpp:234
std::vector< const WellInterfaceGeneric< Scalar, IndexTraits > * > genericWells() const
Definition: BlackoilWellModelGeneric.hpp:142
const std::map< std::string, double > & wellCloseTimes() const
Definition: BlackoilWellModelGeneric.hpp:233
const std::vector< Well > & eclWells() const
Definition: BlackoilWellModelGeneric.hpp:131
void updateNupcolWGState()
Definition: BlackoilWellModelGeneric.hpp:383
void updateFiltrationModelsPostStep(const double dt, const std::size_t water_index, DeferredLogger &deferred_logger)
const EclipseState & eclipseState() const
Definition: BlackoilWellModelGeneric.hpp:225
bool wells_active_
Definition: BlackoilWellModelGeneric.hpp:523
WGState< Scalar, IndexTraits > nupcol_wgstate_
Definition: BlackoilWellModelGeneric.hpp:572
std::unordered_map< int, std::vector< MSWellTracerRate< Scalar > > > MswTracerRates
Definition: BlackoilWellModelGeneric.hpp:505
std::unique_ptr< VFPProperties< Scalar, IndexTraits > > vfp_properties_
Definition: BlackoilWellModelGeneric.hpp:556
bool report_step_starts_
Definition: BlackoilWellModelGeneric.hpp:525
std::vector< std::reference_wrapper< ParallelWellInfo< Scalar > > > local_parallel_well_info_
Definition: BlackoilWellModelGeneric.hpp:547
const Well & getWellEcl(const std::string &well_name) const
const Parallel::Communication & comm_
Definition: BlackoilWellModelGeneric.hpp:517
std::vector< WellInterfaceGeneric< Scalar, IndexTraits > * > genericWells()
Definition: BlackoilWellModelGeneric.hpp:145
std::vector< int > getCellsForConnections(const Well &well) const
void updateWsolvent(const Group &group, const int reportStepIdx, const WellState< Scalar, IndexTraits > &wellState)
std::unordered_map< int, std::vector< WellTracerRate< Scalar > > > WellTracerRates
Definition: BlackoilWellModelGeneric.hpp:500
WellTestState & wellTestState()
Definition: BlackoilWellModelGeneric.hpp:182
bool wellStructureChangedDynamically_
Definition: BlackoilWellModelGeneric.hpp:576
std::vector< std::vector< PerforationData< Scalar > > > well_perf_data_
Definition: BlackoilWellModelGeneric.hpp:530
const GroupStateHelperType & groupStateHelper() const
Definition: BlackoilWellModelGeneric.hpp:290
bool wellsActive() const
return true if wells are available in the reservoir
bool forceShutWellByName(const std::string &wellname, const double simulation_time, const bool dont_shut_grup_wells)
bool terminal_output_
Definition: BlackoilWellModelGeneric.hpp:522
const WellTestState & wellTestState() const
Definition: BlackoilWellModelGeneric.hpp:184
void reportGroupSwitching(DeferredLogger &local_deferredLogger) const
std::unordered_map< std::string, WellFilterCake< Scalar, IndexTraits > > filter_cake_
Definition: BlackoilWellModelGeneric.hpp:562
std::map< std::string, double > well_close_times_
Definition: BlackoilWellModelGeneric.hpp:536
virtual void calculateProductivityIndexValues(DeferredLogger &deferred_logger)=0
void checkGconsaleLimits(const Group &group, WellState< Scalar, IndexTraits > &well_state, const int reportStepIdx, DeferredLogger &deferred_logger)
void commitWGState(WGState< Scalar, IndexTraits > wgstate)
Definition: BlackoilWellModelGeneric.hpp:360
data::GroupAndNetworkValues groupAndNetworkData(const int reportStepIdx) const
void assignShutConnections(data::Wells &wsrpt, const int reportStepIndex) const
std::vector< int > pvt_region_idx_
Definition: BlackoilWellModelGeneric.hpp:551
void setWsolvent(const Group &group, const int reportStepIdx, Scalar wsolvent)
virtual void createWellContainer(const int time_step)=0
std::function< bool(const std::string &)> not_on_process_
Definition: BlackoilWellModelGeneric.hpp:539
const SummaryState & summaryState() const
Definition: BlackoilWellModelGeneric.hpp:227
bool wasDynamicallyShutThisTimeStep(const std::string &well_name) const
virtual void calculateProductivityIndexValuesShutWells(const int reportStepIdx, DeferredLogger &deferred_logger)=0
const GuideRate & guideRate() const
Definition: BlackoilWellModelGeneric.hpp:229
bool checkGroupHigherConstraints(const Group &group, DeferredLogger &deferred_logger, const int reportStepIdx, const int max_number_of_group_switch, const bool update_group_switching_log)
std::optional< int > last_run_wellpi_
Definition: BlackoilWellModelGeneric.hpp:527
const SummaryState & summaryState_
Definition: BlackoilWellModelGeneric.hpp:515
std::map< std::string, std::array< std::vector< Group::InjectionCMode >, 3 > > switched_inj_groups_
Definition: BlackoilWellModelGeneric.hpp:580
std::map< std::string, std::pair< std::string, std::string > > closed_offending_wells_
Definition: BlackoilWellModelGeneric.hpp:582
void updateClosedWellsThisStep(const std::string &well_name) const
Definition: BlackoilWellModelGeneric.hpp:240
const WellState< Scalar, IndexTraits > & wellState() const
Definition: BlackoilWellModelGeneric.hpp:151
std::vector< int > local_shut_wells_
Definition: BlackoilWellModelGeneric.hpp:544
void updateFiltrationModelsPreStep(DeferredLogger &deferred_logger)
void calculateEfficiencyFactors(const int reportStepIdx)
bool hasLocalCells(const std::string &wname) const
Definition: BlackoilWellModelGeneric.hpp:280
void assignMswTracerRates(data::Wells &wsrpt, const MswTracerRates &mswTracerRates, const unsigned reportStep) const
void updateInjFCMult(DeferredLogger &deferred_logger)
std::vector< ParallelWellInfo< Scalar > > parallel_well_info_
Definition: BlackoilWellModelGeneric.hpp:546
void assignProductionWellTargets(const Well &well, data::WellControlLimits &limits) const
void checkGEconLimits(const Group &group, const double simulation_time, const int report_step_idx, DeferredLogger &deferred_logger)
void assignGroupValues(const int reportStepIdx, std::map< std::string, data::GroupData > &gvalues) const
const Schedule & schedule() const
Definition: BlackoilWellModelGeneric.hpp:139
WellState< Scalar, IndexTraits > & wellState()
Definition: BlackoilWellModelGeneric.hpp:159
BlackoilWellModelNetworkGeneric< Scalar, IndexTraits > & genNetwork_
Definition: BlackoilWellModelGeneric.hpp:584
BlackoilWellModelGeneric(Schedule &schedule, BlackoilWellModelGasLiftGeneric< Scalar, IndexTraits > &gaslift, BlackoilWellModelNetworkGeneric< Scalar, IndexTraits > &network, const SummaryState &summaryState, const EclipseState &eclState, const PhaseUsageInfo< IndexTraits > &phase_usage, const Parallel::Communication &comm)
virtual void calcResvCoeff(const int fipnum, const int pvtreg, const std::vector< Scalar > &production_rates, std::vector< Scalar > &resv_coeff) const =0
void assignGroupControl(const Group &group, data::GroupData &gdata) const
void assignMassGasRate(data::Wells &wsrpt, const Scalar gasDensity) const
bool hasOpenLocalWell(const std::string &well_name) const
Returns true if well is defined, open and has connections on current rank.
GuideRate & guideRate()
Definition: BlackoilWellModelGeneric.hpp:230
const EclipseState & eclState() const
Definition: BlackoilWellModelGeneric.hpp:314
BlackoilWellModelGasLiftGeneric< Scalar, IndexTraits > & gen_gaslift_
Definition: BlackoilWellModelGeneric.hpp:518
const std::map< std::string, double > & wellOpenTimes() const
Definition: BlackoilWellModelGeneric.hpp:232
void initFromRestartFile(const RestartValue &restartValues, std::unique_ptr< WellTestState > wtestState, const std::size_t numCells, bool handle_ms_well, bool enable_distributed_wells)
const WellState< Scalar, IndexTraits > & prevWellState() const
Definition: BlackoilWellModelGeneric.hpp:345
virtual void computePotentials(const std::size_t widx, const WellState< Scalar, IndexTraits > &well_state_copy, std::string &exc_msg, ExceptionType::ExcEnum &exc_type, DeferredLogger &deferred_logger)=0
virtual void calcInjResvCoeff(const int fipnum, const int pvtreg, std::vector< Scalar > &resv_coeff) const =0
const VFPProperties< Scalar, IndexTraits > & getVFPProperties() const
Definition: BlackoilWellModelGeneric.hpp:301
std::vector< std::vector< int > > getMaxWellConnections() const
void assignWellTracerRates(data::Wells &wsrpt, const WellTracerRates &wellTracerRates, const unsigned reportStep) const
std::vector< std::string > getWellsForTesting(const int timeStepIdx, const double simulationTime)
void updateEclWells(const int timeStepIdx, const SimulatorUpdate &sim_update, const SummaryState &st)
void updateInjMult(DeferredLogger &deferred_logger)
bool initial_step_
Definition: BlackoilWellModelGeneric.hpp:524
bool terminalOutput() const
Definition: BlackoilWellModelGeneric.hpp:134
void prepareDeserialize(int report_step, const std::size_t numCells, bool handle_ms_well, bool enable_distributed_wells)
GroupState< Scalar > & groupState()
Definition: BlackoilWellModelGeneric.hpp:180
bool wasDynamicallyShutThisTimeStep(const int well_index) const
const std::vector< PerforationData< Scalar > > & perfData(const int well_idx) const
Definition: BlackoilWellModelGeneric.hpp:220
std::vector< std::reference_wrapper< ParallelWellInfo< Scalar > > > createLocalParallelWellInfo(const std::vector< Well > &wells)
Create the parallel well information.
std::unordered_map< std::string, std::vector< Scalar > > prev_inj_multipliers_
Definition: BlackoilWellModelGeneric.hpp:559
Schedule & schedule_
Definition: BlackoilWellModelGeneric.hpp:513
const WellState< Scalar, IndexTraits > & nupcolWellState() const
Definition: BlackoilWellModelGeneric.hpp:172
std::vector< ConnectionIndexMap > conn_idx_map_
Definition: BlackoilWellModelGeneric.hpp:538
virtual void initWellContainer(const int reportStepIdx)=0
Scalar wellPI(const std::string &well_name) const
std::pair< int, int > getGroupFipnumAndPvtreg() const
void updateWellPotentials(const int reportStepIdx, const bool onlyAfterEvent, const SummaryConfig &summaryConfig, DeferredLogger &deferred_logger)
std::map< std::string, double > well_open_times_
Definition: BlackoilWellModelGeneric.hpp:533
std::unordered_set< std::string > closed_this_step_
Definition: BlackoilWellModelGeneric.hpp:553
bool isOwner(const std::string &wname) const
Definition: BlackoilWellModelGeneric.hpp:274
void runWellPIScaling(const int reportStepIdx, DeferredLogger &local_deferredLogger)
std::vector< WellProdIndexCalculator< Scalar > > prod_index_calc_
Definition: BlackoilWellModelGeneric.hpp:549
Class for handling the blackoil well network model.
Definition: BlackoilWellModelNetworkGeneric.hpp:49
Class for handling the blackoil well model.
Definition: BlackoilWellModelWBP.hpp:42
Connection index mappings.
Definition: ConnectionIndexMap.hpp:33
Definition: DeferredLogger.hpp:57
Definition: GroupStateHelper.hpp:53
void updateState(WellState< Scalar, IndexTraits > &well_state, GroupState< Scalar > &group_state)
Definition: GroupState.hpp:41
Class encapsulating some information about parallel wells.
Definition: ParallelWellInfo.hpp:198
Definition: GasLiftGroupInfo.hpp:37
Definition: VFPProperties.hpp:40
Definition: WellInterfaceGeneric.hpp:53
Definition: WellState.hpp:66
ExcEnum
Definition: DeferredLogger.hpp:45
Dune::Communication< MPIComm > Communication
Definition: ParallelCommunication.hpp:30
Definition: blackoilnewtonmethodparams.hpp:31
Definition: blackoilbioeffectsmodules.hh:43
Definition: BlackoilWellModelGeneric.hpp:87
static constexpr bool value
Definition: BlackoilWellModelGeneric.hpp:87
Definition: WGState.hpp:39