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<typename Scalar, typename IndexTraits> class BlackoilWellModelGasLiftGeneric;
62 template<typename Scalar, typename IndexTraits> class GasLiftGroupInfo;
63 template<typename Scalar, typename IndexTraits> 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<typename Scalar, typename IndexTraits> class VFPProperties;
72 template<typename Scalar, typename IndexTraits> class WellGroupHelpers;
73 template<typename Scalar, typename IndexTraits> class WellInterfaceGeneric;
74 template<typename Scalar, typename IndexTraits> class WellState;
75} // namespace Opm
76
77namespace Opm { namespace data {
78 struct GroupData;
79 struct GroupGuideRates;
80 class GroupAndNetworkValues;
81 struct NodeData;
82}} // namespace Opm::data
83
84namespace Opm::Parameters {
85
86struct EnableTerminalOutput { static constexpr bool value = true; };
87
88} // namespace Opm::Parameters
89
90namespace Opm {
91
93template<typename Scalar, typename IndexTraits>
95{
97public:
100 const SummaryState& summaryState,
101 const EclipseState& eclState,
102 const PhaseUsageInfo<IndexTraits>& phase_usage,
104
105 virtual ~BlackoilWellModelGeneric() = default;
106 virtual int compressedIndexForInteriorLGR([[maybe_unused]] const std::string& lgr_tag,
107 [[maybe_unused]] const Connection& conn) const
108 {
109 throw std::runtime_error("compressedIndexForInteriorLGR not implemented");
110 }
111
112 int numLocalWells() const;
113 int numLocalWellsEnd() const;
115 int numPhases() const;
116
118 bool wellsActive() const;
119
121 bool hasLocalWell(const std::string& wname) const;
122
124 bool hasOpenLocalWell(const std::string& well_name) const;
125
127 bool networkActive() const;
128
129 // whether there exists any multisegment well open on this process
130 bool anyMSWellOpenLocal() const;
131
132 const std::vector<Well>& eclWells() const
133 { return wells_ecl_; }
134
135 bool terminalOutput() const
136 { return terminal_output_; }
137
138 const Well& getWellEcl(const std::string& well_name) const;
139 std::vector<Well> getLocalWells(const int timeStepIdx) const;
140 const Schedule& schedule() const { return schedule_; }
142 const GroupState<Scalar>& groupState() const { return this->active_wgstate_.group_state; }
143 std::vector<const WellInterfaceGeneric<Scalar, IndexTraits>*> genericWells() const
144 { return {well_container_generic_.begin(), well_container_generic_.end()}; }
145
146 std::vector<WellInterfaceGeneric<Scalar, IndexTraits>*> genericWells()
147 { return well_container_generic_; }
148
149 /*
150 Immutable version of the currently active wellstate.
151 */
153 {
154 return this->active_wgstate_.well_state;
155 }
156
157 /*
158 Mutable version of the currently active wellstate.
159 */
161 {
162 return this->active_wgstate_.well_state;
163 }
164
165 /*
166 Will return the currently active nupcolWellState; must update
167 the internal nupcol wellstate with updateNupcolWGState() first.
168 */
170 {
171 return this->nupcol_wgstate_.well_state;
172 }
173 GroupState<Scalar>& groupState() { return this->active_wgstate_.group_state; }
174
175 WellTestState& wellTestState() { return this->active_wgstate_.well_test_state; }
176
177 const WellTestState& wellTestState() const { return this->active_wgstate_.well_test_state; }
178
179 Scalar wellPI(const int well_index) const;
180 Scalar wellPI(const std::string& well_name) const;
181
182 void updateEclWells(const int timeStepIdx,
183 const SimulatorUpdate& sim_update,
184 const SummaryState& st);
185
186 void initFromRestartFile(const RestartValue& restartValues,
187 std::unique_ptr<WellTestState> wtestState,
188 const std::size_t numCells,
189 bool handle_ms_well,
190 bool enable_distributed_wells);
191
192 void prepareDeserialize(int report_step,
193 const std::size_t numCells,
194 bool handle_ms_well,
195 bool enable_distributed_wells);
196
197 /*
198 Will assign the internal member last_valid_well_state_ to the
199 current value of the this->active_well_state_. The state stored
200 with storeWellState() can then subsequently be recovered with the
201 resetWellState() method.
202 */
204 {
207 }
208
209 data::GroupAndNetworkValues groupAndNetworkData(const int reportStepIdx) const;
210
212 void updateNetworkActiveState(const int report_step);
213
217 bool needPreStepNetworkRebalance(const int report_step) const;
218
221 bool forceShutWellByName(const std::string& wellname,
222 const double simulation_time,
223 const bool dont_shut_grup_wells);
224
225 const std::vector<PerforationData<Scalar>>& perfData(const int well_idx) const
226 { return well_perf_data_[well_idx]; }
227
228 const Parallel::Communication& comm() const { return comm_; }
229
230 const EclipseState& eclipseState() const { return eclState_; }
231
232 const SummaryState& summaryState() const { return summaryState_; }
233
234 const GuideRate& guideRate() const { return guideRate_; }
235 GuideRate& guideRate() { return guideRate_; }
236
237 const std::map<std::string, double>& wellOpenTimes() const { return well_open_times_; }
238 const std::map<std::string, double>& wellCloseTimes() const { return well_close_times_; }
239 const WellGroupEvents& reportStepStartEvents() const { return report_step_start_events_; }
240
241 std::vector<int> getCellsForConnections(const Well& well) const;
242
243 bool reportStepStarts() const { return report_step_starts_; }
244
245 bool shouldBalanceNetwork(const int reportStepIndex,
246 const int iterationIdx) const;
247
248 void updateClosedWellsThisStep(const std::string& well_name) const
249 {
250 this->closed_this_step_.insert(well_name);
251 }
252 bool wasDynamicallyShutThisTimeStep(const std::string& well_name) const;
253
254 void logPrimaryVars() const;
255
256 template<class Serializer>
257 void serializeOp(Serializer& serializer)
258 {
259 serializer(initial_step_);
260 serializer(report_step_starts_);
261 serializer(last_run_wellpi_);
262 serializer(local_shut_wells_);
263 serializer(closed_this_step_);
264 serializer(guideRate_);
265 serializer(node_pressures_);
266 serializer(last_valid_node_pressures_);
267 serializer(prev_inj_multipliers_);
268 serializer(active_wgstate_);
269 serializer(last_valid_wgstate_);
270 serializer(nupcol_wgstate_);
271 serializer(switched_prod_groups_);
272 serializer(switched_inj_groups_);
273 serializer(closed_offending_wells_);
274 serializer(gen_gaslift_);
275 }
276
277 bool operator==(const BlackoilWellModelGeneric& rhs) const;
278
280 parallelWellInfo(const std::size_t idx) const
281 { return local_parallel_well_info_[idx].get(); }
282
283 bool isOwner(const std::string& wname) const
284 {
285 return this->parallelWellSatisfies
286 (wname, [](const auto& pwInfo) { return pwInfo.isOwner(); });
287 }
288
289 bool hasLocalCells(const std::string& wname) const
290 {
291 return this->parallelWellSatisfies
292 (wname, [](const auto& pwInfo) { return pwInfo.hasLocalCells(); });
293 }
294
295 const ConnectionIndexMap& connectionIndexMap(const std::size_t idx)
296 { return conn_idx_map_[idx]; }
297
298protected:
299 /*
300 The dynamic state of the well model is maintained with an instance
301 of the WellState class. Currently we have
302 three different wellstate instances:
303
304 1. The currently active wellstate is in the active_well_state_
305 member. That is the state which is mutated by the simulator.
306
307 2. In the case timestep fails to converge and we must go back and
308 try again with a smaller timestep we need to recover the last
309 valid wellstate. This is maintained with the
310 last_valid_well_state_ member and the functions
311 commitWGState() and resetWellState().
312
313 3. For the NUPCOL functionality we should either use the
314 currently active wellstate or a wellstate frozen at max
315 nupcol iterations. This is handled with the member
316 nupcol_well_state_ and the updateNupcolWGState() function.
317 */
318
319 /*
320 Will return the last good wellstate. This is typcially used when
321 initializing a new report step where the Schedule object might
322 have introduced new wells. The wellstate returned by
323 prevWellState() must have been stored with the commitWGState()
324 function first.
325 */
327 {
328 return this->last_valid_wgstate_.well_state;
329 }
330
332 {
333 return this->last_valid_wgstate_;
334 }
335
336 /*
337 Will store a copy of the input argument well_state in the
338 last_valid_well_state_ member, that state can then be recovered
339 with a subsequent call to resetWellState().
340 */
342 {
343 this->last_valid_wgstate_ = std::move(wgstate);
344 }
345
346 /*
347 Will update the internal variable active_well_state_ to whatever
348 was stored in the last_valid_well_state_ member. This function
349 works in pair with commitWellState() which should be called first.
350 */
352 {
355 }
356
357 /*
358 Will store the current active wellstate in the nupcol_well_state_
359 member. This can then be subsequently retrieved with accessor
360 nupcolWellState().
361 */
363 {
364 this->nupcol_wgstate_ = this->active_wgstate_;
365 }
366
367 void reportGroupSwitching(DeferredLogger& local_deferredLogger) const;
368
371 std::vector<std::reference_wrapper<ParallelWellInfo<Scalar>>>
372 createLocalParallelWellInfo(const std::vector<Well>& wells);
373
376
377 bool wasDynamicallyShutThisTimeStep(const int well_index) const;
378
379 Scalar updateNetworkPressures(const int reportStepIdx,
380 const Scalar damping_factor,
381 const Scalar update_upper_bound);
382
383 void updateWsolvent(const Group& group,
384 const int reportStepIdx,
386 void setWsolvent(const Group& group,
387 const int reportStepIdx,
388 Scalar wsolvent);
389 virtual void calcResvCoeff(const int fipnum,
390 const int pvtreg,
391 const std::vector<Scalar>& production_rates,
392 std::vector<Scalar>& resv_coeff) = 0;
393 virtual void calcInjResvCoeff(const int fipnum,
394 const int pvtreg,
395 std::vector<Scalar>& resv_coeff) = 0;
396
401 void assignDynamicWellStatus(data::Wells& wsrpt) 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,
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 const bool update_group_switching_log);
445
446 void updateAndCommunicateGroupData(const int reportStepIdx,
447 const int iterationIdx,
448 const Scalar tol_nupcol,
449 const bool update_wellgrouptarget, // we only want to update the wellgrouptarget after the groups have found their controls
450 DeferredLogger& deferred_logger);
451
453
455
456 virtual void computePotentials(const std::size_t widx,
457 const WellState<Scalar, IndexTraits>& well_state_copy,
458 std::string& exc_msg,
459 ExceptionType::ExcEnum& exc_type,
460 DeferredLogger& deferred_logger) = 0;
461
462 // Calculating well potentials for each well
463 void updateWellPotentials(const int reportStepIdx,
464 const bool onlyAfterEvent,
465 const SummaryConfig& summaryConfig,
466 DeferredLogger& deferred_logger);
467
469
470 void updateInjMult(DeferredLogger& deferred_logger);
471 void updateInjFCMult(DeferredLogger& deferred_logger);
472
473 void updateFiltrationModelsPostStep(const double dt,
474 const std::size_t water_index,
475 DeferredLogger& deferred_logger);
476
478
479 // create the well container
480 virtual void createWellContainer(const int time_step) = 0;
481 virtual void initWellContainer(const int reportStepIdx) = 0;
482
483 virtual void calculateProductivityIndexValuesShutWells(const int reportStepIdx,
484 DeferredLogger& deferred_logger) = 0;
485 virtual void calculateProductivityIndexValues(DeferredLogger& deferred_logger) = 0;
486
487 void runWellPIScaling(const int reportStepIdx,
488 DeferredLogger& local_deferredLogger);
489
491 virtual int compressedIndexForInterior(int cartesian_cell_idx) const = 0;
492
493 std::vector<std::vector<int>> getMaxWellConnections() const;
494
495 std::vector<std::string> getWellsForTesting(const int timeStepIdx,
496 const double simulationTime);
497
498 using WellTracerRates = std::unordered_map<int, std::vector<WellTracerRate<Scalar>>>;
499 void assignWellTracerRates(data::Wells& wsrpt,
500 const WellTracerRates& wellTracerRates,
501 const unsigned reportStep) const;
502
503 using MswTracerRates = std::unordered_map<int, std::vector<MSWellTracerRate<Scalar>>>;
504 void assignMswTracerRates(data::Wells& wsrpt,
505 const MswTracerRates& mswTracerRates,
506 const unsigned reportStep) const;
507
508 void assignMassGasRate(data::Wells& wsrpt,
509 const Scalar gasDensity) const;
510
511 Schedule& schedule_;
512
513 const SummaryState& summaryState_;
514 const EclipseState& eclState_;
518
519
521 bool terminal_output_{false};
522 bool wells_active_{false};
523 bool network_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 // Network pressures for output and initialization
559 std::map<std::string, Scalar> node_pressures_;
560 // Valid network pressures for output and initialization for safe restart after failed iterations
561 std::map<std::string, Scalar> last_valid_node_pressures_;
562
563 // previous injection multiplier, it is used in the injection multiplier calculation for WINJMULT keyword
564 std::unordered_map<std::string, std::vector<Scalar>> prev_inj_multipliers_;
565
566 // Handling for filter cake injection multipliers
567 std::unordered_map<std::string, WellFilterCake<Scalar, IndexTraits>> filter_cake_;
568
569 /*
570 The various wellState members should be accessed and modified
571 through the accessor functions wellState(), prevWellState(),
572 commitWellState(), resetWellState(), nupcolWellState() and
573 updateNupcolWGState().
574 */
579
581
582 // Store maps of group name and new group controls for output
583 std::map<std::string, std::vector<Group::ProductionCMode>> switched_prod_groups_;
584 std::map<std::string, std::array<std::vector<Group::InjectionCMode>, 3>> switched_inj_groups_;
585 // Store map of group name and close offending well for output
586 std::map<std::string, std::pair<std::string, std::string>> closed_offending_wells_;
587
588private:
589 WellInterfaceGeneric<Scalar, IndexTraits>* getGenWell(const std::string& well_name);
590
591 template <typename Iter, typename Body>
592 void wellUpdateLoop(Iter first, Iter last, const int timeStepIdx, Body&& body);
593
594 void updateEclWellsConstraints(const int timeStepIdx,
595 const SimulatorUpdate& sim_update,
596 const SummaryState& st);
597
598 void updateEclWellsCTFFromAction(const int timeStepIdx,
599 const SimulatorUpdate& sim_update);
600
614 template <typename Predicate>
615 bool parallelWellSatisfies(const std::string& wname, Predicate&& p) const
616 {
617 auto pwInfoPos = std::find_if(this->parallel_well_info_.begin(),
618 this->parallel_well_info_.end(),
619 [&wname](const auto& pwInfo)
620 { return pwInfo.name() == wname; });
621
622 return (pwInfoPos != this->parallel_well_info_.end())
623 && p(*pwInfoPos);
624 }
625
641 template <typename LoopBody>
642 void loopOwnedWells(LoopBody&& loopBody) const;
643};
644
645} // namespace Opm
646
647#endif
Definition: BlackoilWellModelGasLift.hpp:42
Class for handling the blackoil well model.
Definition: BlackoilWellModelGeneric.hpp:95
void commitWGState()
Definition: BlackoilWellModelGeneric.hpp:203
std::map< std::string, std::vector< Group::ProductionCMode > > switched_prod_groups_
Definition: BlackoilWellModelGeneric.hpp:583
void updateAndCommunicateGroupData(const int reportStepIdx, const int iterationIdx, const Scalar tol_nupcol, const bool update_wellgrouptarget, DeferredLogger &deferred_logger)
const EclipseState & eclState_
Definition: BlackoilWellModelGeneric.hpp:514
const PhaseUsageInfo< IndexTraits > & phaseUsage() const
Definition: BlackoilWellModelGeneric.hpp:141
const WGState< Scalar, IndexTraits > & prevWGState() const
Definition: BlackoilWellModelGeneric.hpp:331
BlackoilWellModelGeneric(Schedule &schedule, BlackoilWellModelGasLiftGeneric< Scalar, IndexTraits > &gaslift, const SummaryState &summaryState, const EclipseState &eclState, const PhaseUsageInfo< IndexTraits > &phase_usage, const Parallel::Communication &comm)
std::vector< Well > getLocalWells(const int timeStepIdx) const
const ConnectionIndexMap & connectionIndexMap(const std::size_t idx)
Definition: BlackoilWellModelGeneric.hpp:295
const GroupState< Scalar > & groupState() const
Definition: BlackoilWellModelGeneric.hpp:142
const PhaseUsageInfo< IndexTraits > & phase_usage_info_
Definition: BlackoilWellModelGeneric.hpp:520
void assignDynamicWellStatus(data::Wells &wsrpt) const
void serializeOp(Serializer &serializer)
Definition: BlackoilWellModelGeneric.hpp:257
bool reportStepStarts() const
Definition: BlackoilWellModelGeneric.hpp:243
bool operator==(const BlackoilWellModelGeneric &rhs) const
WGState< Scalar, IndexTraits > last_valid_wgstate_
Definition: BlackoilWellModelGeneric.hpp:576
const Parallel::Communication & comm() const
Definition: BlackoilWellModelGeneric.hpp:228
virtual int compressedIndexForInteriorLGR(const std::string &lgr_tag, const Connection &conn) const
Definition: BlackoilWellModelGeneric.hpp:106
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:578
void resetWGState()
Definition: BlackoilWellModelGeneric.hpp:351
void assignWellTargets(data::Wells &wsrpt) const
virtual void calcResvCoeff(const int fipnum, const int pvtreg, const std::vector< Scalar > &production_rates, std::vector< Scalar > &resv_coeff)=0
WGState< Scalar, IndexTraits > active_wgstate_
Definition: BlackoilWellModelGeneric.hpp:575
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:280
BlackoilWellModelWBP< Scalar, IndexTraits > wbp_
Definition: BlackoilWellModelGeneric.hpp:517
const WellGroupEvents & reportStepStartEvents() const
Definition: BlackoilWellModelGeneric.hpp:239
std::vector< const WellInterfaceGeneric< Scalar, IndexTraits > * > genericWells() const
Definition: BlackoilWellModelGeneric.hpp:143
const std::map< std::string, double > & wellCloseTimes() const
Definition: BlackoilWellModelGeneric.hpp:238
const std::vector< Well > & eclWells() const
Definition: BlackoilWellModelGeneric.hpp:132
void updateNupcolWGState()
Definition: BlackoilWellModelGeneric.hpp:362
void updateFiltrationModelsPostStep(const double dt, const std::size_t water_index, DeferredLogger &deferred_logger)
const EclipseState & eclipseState() const
Definition: BlackoilWellModelGeneric.hpp:230
bool wells_active_
Definition: BlackoilWellModelGeneric.hpp:522
WGState< Scalar, IndexTraits > nupcol_wgstate_
Definition: BlackoilWellModelGeneric.hpp:577
std::unordered_map< int, std::vector< MSWellTracerRate< Scalar > > > MswTracerRates
Definition: BlackoilWellModelGeneric.hpp:503
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:515
std::vector< WellInterfaceGeneric< Scalar, IndexTraits > * > genericWells()
Definition: BlackoilWellModelGeneric.hpp:146
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:498
WellTestState & wellTestState()
Definition: BlackoilWellModelGeneric.hpp:175
bool wellStructureChangedDynamically_
Definition: BlackoilWellModelGeneric.hpp:580
std::vector< std::vector< PerforationData< Scalar > > > well_perf_data_
Definition: BlackoilWellModelGeneric.hpp:530
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:521
const WellTestState & wellTestState() const
Definition: BlackoilWellModelGeneric.hpp:177
void reportGroupSwitching(DeferredLogger &local_deferredLogger) const
std::unordered_map< std::string, WellFilterCake< Scalar, IndexTraits > > filter_cake_
Definition: BlackoilWellModelGeneric.hpp:567
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:341
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:232
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:234
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:513
std::map< std::string, std::array< std::vector< Group::InjectionCMode >, 3 > > switched_inj_groups_
Definition: BlackoilWellModelGeneric.hpp:584
std::map< std::string, std::pair< std::string, std::string > > closed_offending_wells_
Definition: BlackoilWellModelGeneric.hpp:586
void updateClosedWellsThisStep(const std::string &well_name) const
Definition: BlackoilWellModelGeneric.hpp:248
const WellState< Scalar, IndexTraits > & wellState() const
Definition: BlackoilWellModelGeneric.hpp:152
std::vector< int > local_shut_wells_
Definition: BlackoilWellModelGeneric.hpp:544
void updateFiltrationModelsPreStep(DeferredLogger &deferred_logger)
void calculateEfficiencyFactors(const int reportStepIdx)
bool network_active_
Definition: BlackoilWellModelGeneric.hpp:523
virtual void calcInjResvCoeff(const int fipnum, const int pvtreg, std::vector< Scalar > &resv_coeff)=0
bool hasLocalCells(const std::string &wname) const
Definition: BlackoilWellModelGeneric.hpp:289
void assignMswTracerRates(data::Wells &wsrpt, const MswTracerRates &mswTracerRates, const unsigned reportStep) const
void updateInjFCMult(DeferredLogger &deferred_logger)
std::map< std::string, Scalar > node_pressures_
Definition: BlackoilWellModelGeneric.hpp:559
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:140
bool networkActive() const
return true if network is active (at least one network well in prediction mode)
Scalar updateNetworkPressures(const int reportStepIdx, const Scalar damping_factor, const Scalar update_upper_bound)
WellState< Scalar, IndexTraits > & wellState()
Definition: BlackoilWellModelGeneric.hpp:160
void assignNodeValues(std::map< std::string, data::NodeData > &nodevalues, const int reportStepIdx) const
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:235
BlackoilWellModelGasLiftGeneric< Scalar, IndexTraits > & gen_gaslift_
Definition: BlackoilWellModelGeneric.hpp:516
const std::map< std::string, double > & wellOpenTimes() const
Definition: BlackoilWellModelGeneric.hpp:237
void initFromRestartFile(const RestartValue &restartValues, std::unique_ptr< WellTestState > wtestState, const std::size_t numCells, bool handle_ms_well, bool enable_distributed_wells)
bool shouldBalanceNetwork(const int reportStepIndex, const int iterationIdx) const
const WellState< Scalar, IndexTraits > & prevWellState() const
Definition: BlackoilWellModelGeneric.hpp:326
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
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 needPreStepNetworkRebalance(const int report_step) const
void updateNetworkActiveState(const int report_step)
Checks if network is active (at least one network well on prediction).
bool terminalOutput() const
Definition: BlackoilWellModelGeneric.hpp:135
void prepareDeserialize(int report_step, const std::size_t numCells, bool handle_ms_well, bool enable_distributed_wells)
GroupState< Scalar > & groupState()
Definition: BlackoilWellModelGeneric.hpp:173
bool wasDynamicallyShutThisTimeStep(const int well_index) const
const std::vector< PerforationData< Scalar > > & perfData(const int well_idx) const
Definition: BlackoilWellModelGeneric.hpp:225
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:564
Schedule & schedule_
Definition: BlackoilWellModelGeneric.hpp:511
const WellState< Scalar, IndexTraits > & nupcolWellState() const
Definition: BlackoilWellModelGeneric.hpp:169
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::map< std::string, Scalar > last_valid_node_pressures_
Definition: BlackoilWellModelGeneric.hpp:561
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:283
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 model.
Definition: BlackoilWellModelWBP.hpp:42
Connection index mappings.
Definition: ConnectionIndexMap.hpp:33
Definition: DeferredLogger.hpp:57
Definition: GroupState.hpp:41
Class encapsulating some information about parallel wells.
Definition: ParallelWellInfo.hpp:198
Definition: GasLiftGroupInfo.hpp:37
Definition: WellGroupHelpers.hpp:51
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: blackoilboundaryratevector.hh:39
Definition: BlackoilWellModelGeneric.hpp:86
static constexpr bool value
Definition: BlackoilWellModelGeneric.hpp:86
Definition: WGState.hpp:39