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