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