BlackoilWellModel.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_HEADER_INCLUDED
24#define OPM_BLACKOILWELLMODEL_HEADER_INCLUDED
25
26#include <dune/common/fmatrix.hh>
27
28#include <dune/istl/bcrsmatrix.hh>
29#include <dune/istl/matrixmatrix.hh>
30
31#include <opm/common/OpmLog/OpmLog.hpp>
32
33#include <opm/input/eclipse/Schedule/Group/Group.hpp>
34#include <opm/input/eclipse/Schedule/Group/GuideRate.hpp>
35#include <opm/input/eclipse/Schedule/Schedule.hpp>
36#include <opm/input/eclipse/Schedule/Well/WellTestState.hpp>
37
38#include <opm/material/densead/Math.hpp>
39
42
44
47
49
75
76#include <cstddef>
77#include <map>
78#include <memory>
79#include <optional>
80#include <string>
81#include <tuple>
82#include <vector>
83
84namespace Opm {
85
86template<class Scalar> class BlackoilWellModelNldd;
87template<class T, template <typename, typename...> class Storage> class SparseTable;
88
89#if COMPILE_GPU_BRIDGE
90template<class Scalar> class WellContributions;
91#endif
92
94 template<typename TypeTag>
95 class BlackoilWellModel : public WellConnectionAuxiliaryModule<TypeTag, BlackoilWellModel<TypeTag>>
96 , public BlackoilWellModelGeneric<GetPropType<TypeTag, Properties::Scalar>,
97 typename GetPropType<TypeTag, Properties::FluidSystem>::IndexTraitsType>
98 {
99 public:
100 // --------- Types ---------
112
114 using IndexTraits = typename FluidSystem::IndexTraitsType;
116
118
119 static const int numEq = Indices::numEq;
120 static const int solventSaturationIdx = Indices::solventSaturationIdx;
121 static constexpr bool has_solvent_ = getPropValue<TypeTag, Properties::EnableSolvent>();
122 static constexpr bool has_polymer_ = getPropValue<TypeTag, Properties::EnablePolymer>();
123 static constexpr EnergyModules energyModuleType_ = getPropValue<TypeTag, Properties::EnergyModuleType>();
124 static constexpr bool has_energy_ = (energyModuleType_ == EnergyModules::FullyImplicitThermal);
125 static constexpr bool has_micp_ = Indices::enableMICP;
126 static constexpr bool has_geochem_ = getPropValue<TypeTag, Properties::EnableGeochemistry>();
127
128 // TODO: where we should put these types, WellInterface or Well Model?
129 // or there is some other strategy, like TypeTag
130 using VectorBlockType = Dune::FieldVector<Scalar, numEq>;
131 using BVector = Dune::BlockVector<VectorBlockType>;
132
135
136 // For the conversion between the surface volume rate and reservoir voidage rate
137 using RateConverterType = RateConverter::
138 SurfaceToReservoirVoidage<FluidSystem, std::vector<int> >;
139
140 // For computing average pressured used by gpmaint
141 using AverageRegionalPressureType = RegionAverageCalculator::
142 AverageRegionalPressure<FluidSystem, std::vector<int> >;
143
145
146 void init();
147 void initWellContainer(const int reportStepIdx) override;
148
150 {
151 OPM_TIMEBLOCK(beginEpsiode);
152 beginReportStep(simulator_.episodeIndex());
153 }
154
155 void beginTimeStep();
156
158 {
159 OPM_TIMEBLOCK(beginIteration);
160 assemble(simulator_.timeStepSize());
161 }
162
164 { }
165
167 {
168 OPM_TIMEBLOCK(endTimeStep);
169 timeStepSucceeded(simulator_.time(), simulator_.timeStepSize());
170 }
171
173 {
175 }
176
178 unsigned globalIdx) const;
179
180 template <class Context>
182 const Context& context,
183 unsigned spaceIdx,
184 unsigned timeIdx) const;
185
186
187 using WellInterfacePtr = std::unique_ptr<WellInterface<TypeTag>>;
188
190 void initFromRestartFile(const RestartValue& restartValues)
191 {
192 initFromRestartFile(restartValues,
193 this->simulator_.vanguard().transferWTestState(),
194 grid().size(0),
195 this->simulator_.vanguard().enableDistributedWells());
196 }
197
199 void prepareDeserialize(const int report_step)
200 {
201 prepareDeserialize(report_step, grid().size(0),
202 this->simulator_.vanguard().enableDistributedWells());
203 }
204
205 data::Wells wellData() const
206 {
207 auto wsrpt = this->wellState()
208 .report(this->simulator_.vanguard().globalCell().data(),
209 [this](const int well_index)
210 { return this->wasDynamicallyShutThisTimeStep(well_index); },
211 this->rsConstInfo());
212
214 .assignWellGuideRates(wsrpt, this->reportStepIndex());
215
216 this->assignWellTracerRates(wsrpt);
217
218 if constexpr (has_geochem_) {
219 this->assignWellSpeciesRates(wsrpt);
220 }
221
222 if (const auto& rspec = eclState().runspec();
223 rspec.co2Storage() || rspec.h2Storage())
224 {
225 // The gas reference density (surface condition) is the
226 // same for all PVT regions in CO2STORE/H2STORE runs so,
227 // for simplicity, we use region zero (0) here.
228
229 this->assignMassGasRate(wsrpt, FluidSystem::referenceDensity(FluidSystem::gasPhaseIdx, 0));
230 }
231
232 this->assignWellTargets(wsrpt);
233
234 this->assignDynamicWellStatus(wsrpt);
235
236 // Assigning (a subset of the) property values in shut
237 // connections should be the last step of wellData().
238 this->assignShutConnections(wsrpt, this->reportStepIndex());
239
240 return wsrpt;
241 }
242
243 data::WellBlockAveragePressures wellBlockAveragePressures() const
244 {
246 }
247
248#if COMPILE_GPU_BRIDGE
249 // accumulate the contributions of all Wells in the WellContributions object
250 void getWellContributions(WellContributions<Scalar>& x) const;
251#endif
252
253 // Check if well equations is converged.
254 ConvergenceReport getWellConvergence(const std::vector<Scalar>& B_avg, const bool checkWellGroupControlsAndNetwork = false) const;
255
256 const SimulatorReportSingle& lastReport() const;
257
258 void addWellContributions(SparseMatrixAdapter& jacobian) const;
259
260 // add source from wells to the reservoir matrix
262 const std::vector<typename SparseMatrixAdapter::MatrixBlock*>& diagMatAddress) const;
263
264 // called at the beginning of a report step
265 void beginReportStep(const int time_step);
266
270 void calculateExplicitQuantities() const;
271
274 void prepareTimeStep(DeferredLogger& deferred_logger);
275
276 bool
277 updateWellControls(DeferredLogger& deferred_logger);
278
279 void updateAndCommunicate(const int reportStepIdx);
280
281 bool updateGroupControls(const Group& group,
282 DeferredLogger& deferred_logger,
283 const int reportStepIdx);
284
285 const WellInterface<TypeTag>& getWell(const std::string& well_name) const;
286
287 using PressureMatrix = Dune::BCRSMatrix<Opm::MatrixBlock<Scalar, 1, 1>>;
288
290 const BVector& weights,
291 const bool use_well_weights) const;
294 const BVector& weights,
295 const bool use_well_weights,
296 const int domainIndex) const
297 {
298 if (!nldd_) {
299 OPM_THROW(std::logic_error, "Attempt to access NLDD data without a NLDD solver");
300 }
301 return nldd_->addWellPressureEquations(jacobian,
302 weights,
303 use_well_weights,
304 domainIndex);
305 }
306
308 const std::vector<WellInterfacePtr>& localNonshutWells() const
309 {
310 return well_container_;
311 }
312
314 {
315 if (!nldd_) {
316 OPM_THROW(std::logic_error, "Attempt to access NLDD data without a NLDD solver");
317 }
318 return nldd_->well_local_cells();
319 }
320
321 const std::map<std::string, int>& well_domain() const
322 {
323 if (!nldd_) {
324 OPM_THROW(std::logic_error, "Attempt to access NLDD data without a NLDD solver");
325 }
326
327 return nldd_->well_domain();
328 }
329
330 auto begin() const { return well_container_.begin(); }
331 auto end() const { return well_container_.end(); }
332 bool empty() const { return well_container_.empty(); }
333
336
339
340 int compressedIndexForInterior(int cartesian_cell_idx) const override
341 {
342 return simulator_.vanguard().compressedIndexForInterior(cartesian_cell_idx);
343 }
344
345 int compressedIndexForInteriorLGR(const std::string& lgr_tag, const Connection& conn) const override
346 {
347 return simulator_.vanguard().compressedIndexForInteriorLGR(lgr_tag, conn);
348 }
349
350 // using the solution x to recover the solution xw for wells and applying
351 // xw to update Well State
353
354 // using the solution x to recover the solution xw for wells and applying
355 // xw to update Well State
357 const int domainIdx);
358 // Update cellRates_ with contributions from all wells
359 void updateCellRates();
360
361 // Update cellRates_ with contributions from wells in a specific domain
362 void updateCellRatesForDomain(int domainIndex,
363 const std::map<std::string, int>& well_domain_map);
364
365 const Grid& grid() const
366 { return simulator_.vanguard().grid(); }
367
368 const Simulator& simulator() const
369 { return simulator_; }
370
372 { nldd_ = mod; }
373
374 // === Reservoir Coupling ===
375
379
387 void updateGuideRates(const int report_step_idx,
388 const double sim_time)
389 {
390 this->guide_rate_handler_.updateGuideRates(
391 report_step_idx, sim_time, this->wellState(), this->groupState()
392 );
393 }
394
396 bool isReservoirCouplingMaster() const { return rescoup_.isMaster(); }
397
399 bool isReservoirCouplingSlave() const { return rescoup_.isSlave(); }
400
406 bool isReservoirCouplingMasterGroup(const std::string& group_name) const {
407 return rescoup_.isMasterGroup(group_name);
408 }
409
413 return rescoup_.master();
414 }
415
419 return rescoup_.slave();
420 }
421
422#ifdef RESERVOIR_COUPLING_ENABLED
423 void setReservoirCouplingMaster(ReservoirCouplingMaster<Scalar>* master)
424 {
425 rescoup_.setMaster(master);
426 this->guide_rate_handler_.setReservoirCouplingMaster(master);
427 this->groupStateHelper().setReservoirCouplingMaster(master);
428 }
429 void setReservoirCouplingSlave(ReservoirCouplingSlave<Scalar>* slave)
430 {
431 rescoup_.setSlave(slave);
432 this->guide_rate_handler_.setReservoirCouplingSlave(slave);
433 this->groupStateHelper().setReservoirCouplingSlave(slave);
434 }
435
437 void sendSlaveGroupDataToMaster();
438
440 void receiveSlaveGroupData();
441
442 void receiveGroupConstraintsFromMaster();
443 void sendMasterGroupConstraintsToSlaves();
444 void rescoupSyncSummaryData();
445
454 std::optional<ReservoirCoupling::ScopedLoggerGuard>
455 setupRescoupScopedLogger(DeferredLogger& local_logger);
456#endif
457
458 bool updateWellControlsAndNetwork(const bool mandatory_network_balance,
459 const double dt,
460 DeferredLogger& local_deferredLogger);
461
462 // TODO: finding a better naming
463 void assembleWellEqWithoutIteration(const double dt);
464
465 const std::vector<Scalar>& B_avg() const
466 { return B_avg_; }
467
468 const ModelParameters& param() const
469 { return param_; }
470
471
472 template<class FluidState, class SingleWellState>
473 static Scalar computeTemperatureWeightFactor(const int perf_index, const int np, const FluidState& fs, const SingleWellState& ws)
474 {
475 const auto& perf_phase_rate = ws.perf_data.phase_rates;
476 // we only have one temperature pr cell any phaseIdx will do
477 Scalar cellTemperatures = fs.temperature(/*phaseIdx*/0).value();
478 Scalar weight_factor = 0.0;
479 for (unsigned phaseIdx = 0; phaseIdx < FluidSystem::numPhases; ++phaseIdx) {
480 if (!FluidSystem::phaseIsActive(phaseIdx)) {
481 continue;
482 }
483 Scalar cellInternalEnergy = fs.enthalpy(phaseIdx).value() -
484 fs.pressure(phaseIdx).value() / fs.density(phaseIdx).value();
485 Scalar cellBinv = fs.invB(phaseIdx).value();
486 Scalar cellDensity = fs.density(phaseIdx).value();
487 Scalar perfPhaseRate = perf_phase_rate[perf_index*np + phaseIdx];
488 weight_factor += cellDensity * (perfPhaseRate / cellBinv) * (cellInternalEnergy / cellTemperatures);
489 }
490 return (std::abs(weight_factor) + 1e-13);
491 }
492
493 protected:
495
496 // a vector of all the wells.
497 std::vector<WellInterfacePtr> well_container_{};
498
499 std::vector<bool> is_cell_perforated_{};
500
501 void initializeWellState(const int timeStepIdx);
502
503 // create the well container
504 void createWellContainer(const int report_step) override;
505
507 createWellPointer(const int wellID,
508 const int report_step) const;
509
510 template <typename WellType>
511 std::unique_ptr<WellType>
512 createTypedWellPointer(const int wellID,
513 const int time_step) const;
514
515 WellInterfacePtr createWellForWellTest(const std::string& well_name,
516 const int report_step,
517 DeferredLogger& deferred_logger) const;
518
520 std::size_t global_num_cells_{};
521 // the number of the cells in the local grid
522 std::size_t local_num_cells_{};
524 std::vector<Scalar> depth_{};
526 std::unique_ptr<RateConverterType> rateConverter_{};
527 std::map<std::string, std::unique_ptr<AverageRegionalPressureType>> regionalAveragePressureCalculator_{};
528
532
533 // A flag to tell the convergence report whether we need to take another newton step
535
536 std::vector<Scalar> B_avg_{};
537
538 const EquilGrid& equilGrid() const
539 { return simulator_.vanguard().equilGrid(); }
540
541 const EclipseState& eclState() const
542 { return simulator_.vanguard().eclState(); }
543
544 // compute the well fluxes and assemble them in to the reservoir equations as source terms
545 // and in the well equations.
546 void assemble(const double dt);
547
548 // well controls and network pressures affect each other and are solved in an iterative manner.
549 // the function handles one iteration of updating well controls and network pressures.
550 // it is possible to decouple the update of well controls and network pressures further.
551 // the returned two booleans are {continue_due_to_network, well_group_control_changed}, respectively
552 std::tuple<bool, bool, Scalar> updateWellControlsAndNetworkIteration(const bool mandatory_network_balance,
553 const bool relax_network_tolerance,
554 const bool optimize_gas_lift,
555 const double dt,
556 DeferredLogger& local_deferredLogger);
557
566 void initializeLocalWellStructure(const int reportStepIdx,
567 const bool enableWellPIScaling);
568
572 void initializeGroupStructure(const int reportStepIdx);
573
574 // called at the end of a time step
575 void timeStepSucceeded(const double simulationTime, const double dt);
576
577 // called at the end of a report step
578 void endReportStep();
579
580 // setting the well_solutions_ based on well_state.
582
584
585 void computePotentials(const std::size_t widx,
586 const WellState<Scalar, IndexTraits>& well_state_copy,
587 std::string& exc_msg,
588 ExceptionType::ExcEnum& exc_type) override;
589
590 const std::vector<Scalar>& wellPerfEfficiencyFactors() const;
591
592 void calculateProductivityIndexValuesShutWells(const int reportStepIdx, DeferredLogger& deferred_logger) override;
593 void calculateProductivityIndexValues(DeferredLogger& deferred_logger) override;
595 DeferredLogger& deferred_logger);
596
597 // The number of conservation quantities.
598 int numConservationQuantities() const;
599
600 int reportStepIndex() const;
601
602 void assembleWellEq(const double dt);
603
604 void prepareWellsBeforeAssembling(const double dt);
605
607
608 void extractLegacyDepth_();
609
611 void updateWellTestState(const double simulationTime, WellTestState& wellTestState);
612
613 void wellTesting(const int timeStepIdx, const double simulationTime, DeferredLogger& deferred_logger);
614
615 void calcResvCoeff(const int fipnum,
616 const int pvtreg,
617 const std::vector<Scalar>& production_rates,
618 std::vector<Scalar>& resv_coeff) const override;
619
620 void calcInjResvCoeff(const int fipnum,
621 const int pvtreg,
622 std::vector<Scalar>& resv_coeff) const override;
623
625
626 private:
629 BlackoilWellModelNldd<TypeTag>* nldd_ = nullptr;
630
631 // These members are used to avoid reallocation in specific functions
632 // instead of using local variables.
633 // Their state is not relevant between function calls, so they can
634 // (and must) be mutable, as the functions using them are const.
635 mutable BVector x_local_;
636
637 // Store cell rates after assembling to avoid iterating all wells and connections for every element
638 std::map<int, RateVector> cellRates_;
639
640 void assignWellTracerRates(data::Wells& wsrpt) const;
641 void assignWellSpeciesRates(data::Wells& wsrpt) const;
642
643 [[nodiscard]] auto rsConstInfo() const
644 -> typename WellState<Scalar,IndexTraits>::RsConstInfo;
645 };
646
647} // namespace Opm
648
649#include "BlackoilWellModel_impl.hpp"
650
651#endif // OPM_BLACKOILWELLMODEL_HEADER_INCLUDED
Contains the high level supplements required to extend the black oil model by bioeffects.
Definition: blackoilbioeffectsmodules.hh:95
Contains the high level supplements required to extend the black oil model by polymer.
Definition: blackoilpolymermodules.hh:65
Class for handling the gaslift in the blackoil well model.
Definition: BlackoilWellModelGasLift.hpp:96
Class for handling the blackoil well model.
Definition: BlackoilWellModelGeneric.hpp:98
const GroupState< GetPropType< TypeTag, Properties::Scalar > > & groupState() const
Definition: BlackoilWellModelGeneric.hpp:143
BlackoilWellModelWBP< GetPropType< TypeTag, Properties::Scalar >, GetPropType< TypeTag, Properties::FluidSystem >::IndexTraitsType > wbp_
Definition: BlackoilWellModelGeneric.hpp:516
const WellState< GetPropType< TypeTag, Properties::Scalar >, GetPropType< TypeTag, Properties::FluidSystem >::IndexTraitsType > & wellState() const
Definition: BlackoilWellModelGeneric.hpp:153
void assignMassGasRate(data::Wells &wsrpt, const GetPropType< TypeTag, Properties::Scalar > gasDensity) const
Class for handling the guide rates in the blackoil well model.
Definition: BlackoilWellModelGuideRates.hpp:47
void assignWellGuideRates(data::Wells &wsrpt, const int reportStepIdx) const
Assign well guide rates.
Class for handling the blackoil well network model.
Definition: BlackoilWellModelNetwork.hpp:47
Class for handling the blackoil well model in a NLDD solver.
Definition: BlackoilWellModelNldd.hpp:80
Class for handling the blackoil well model.
Definition: BlackoilWellModel.hpp:98
ReservoirCoupling::Proxy< Scalar > & rescoup()
Get the reservoir coupling proxy.
Definition: BlackoilWellModel.hpp:377
void initializeGroupStructure(const int reportStepIdx)
Definition: BlackoilWellModel_impl.hpp:297
bool network_needs_more_balancing_force_another_newton_iteration_
Definition: BlackoilWellModel.hpp:534
void calcResvCoeff(const int fipnum, const int pvtreg, const std::vector< Scalar > &production_rates, std::vector< Scalar > &resv_coeff) const override
Definition: BlackoilWellModel_impl.hpp:2212
ReservoirCouplingMaster< Scalar > & reservoirCouplingMaster()
Get reference to reservoir coupling master.
Definition: BlackoilWellModel.hpp:412
void endTimeStep()
Definition: BlackoilWellModel.hpp:166
void prepareTimeStep(DeferredLogger &deferred_logger)
Definition: BlackoilWellModel_impl.hpp:2031
std::tuple< bool, bool, Scalar > updateWellControlsAndNetworkIteration(const bool mandatory_network_balance, const bool relax_network_tolerance, const bool optimize_gas_lift, const double dt, DeferredLogger &local_deferredLogger)
Definition: BlackoilWellModel_impl.hpp:1338
WellInterfacePtr createWellPointer(const int wellID, const int report_step) const
Definition: BlackoilWellModel_impl.hpp:1134
GuideRateHandler< Scalar, IndexTraits > guide_rate_handler_
Definition: BlackoilWellModel.hpp:530
const EclipseState & eclState() const
Definition: BlackoilWellModel.hpp:541
void prepareWellsBeforeAssembling(const double dt)
Definition: BlackoilWellModel_impl.hpp:1414
const std::vector< WellInterfacePtr > & localNonshutWells() const
Get list of local nonshut wells.
Definition: BlackoilWellModel.hpp:308
void prepareDeserialize(const int report_step)
Definition: BlackoilWellModel.hpp:199
void init()
Definition: BlackoilWellModel_impl.hpp:166
void setNlddAdapter(BlackoilWellModelNldd< TypeTag > *mod)
Definition: BlackoilWellModel.hpp:371
const Simulator & simulator() const
Definition: BlackoilWellModel.hpp:368
std::vector< Scalar > depth_
Definition: BlackoilWellModel.hpp:524
static constexpr bool has_geochem_
Definition: BlackoilWellModel.hpp:126
static constexpr EnergyModules energyModuleType_
Definition: BlackoilWellModel.hpp:123
std::size_t global_num_cells_
Definition: BlackoilWellModel.hpp:520
GetPropType< TypeTag, Properties::Scalar > Scalar
Definition: BlackoilWellModel.hpp:107
const std::vector< Scalar > & B_avg() const
Definition: BlackoilWellModel.hpp:465
SimulatorReportSingle last_report_
Definition: BlackoilWellModel.hpp:529
static const int solventSaturationIdx
Definition: BlackoilWellModel.hpp:120
Scalar gravity_
Definition: BlackoilWellModel.hpp:523
void initWellContainer(const int reportStepIdx) override
Definition: BlackoilWellModel_impl.hpp:185
void beginReportStep(const int time_step)
Definition: BlackoilWellModel_impl.hpp:202
const WellInterface< TypeTag > & getWell(const std::string &well_name) const
Definition: BlackoilWellModel_impl.hpp:2184
GetPropType< TypeTag, Properties::FluidSystem > FluidSystem
Definition: BlackoilWellModel.hpp:103
void beginIteration()
Definition: BlackoilWellModel.hpp:157
bool isReservoirCouplingMaster() const
Check if this process is a reservoir coupling master.
Definition: BlackoilWellModel.hpp:396
Dune::FieldVector< Scalar, numEq > VectorBlockType
Definition: BlackoilWellModel.hpp:130
void initFromRestartFile(const RestartValue &restartValues)
Definition: BlackoilWellModel.hpp:190
const ModelParameters param_
Definition: BlackoilWellModel.hpp:519
void beginEpisode()
Definition: BlackoilWellModel.hpp:149
GetPropType< TypeTag, Properties::ElementContext > ElementContext
Definition: BlackoilWellModel.hpp:104
GetPropType< TypeTag, Properties::Grid > Grid
Definition: BlackoilWellModel.hpp:101
GetPropType< TypeTag, Properties::EquilGrid > EquilGrid
Definition: BlackoilWellModel.hpp:102
int numConservationQuantities() const
Definition: BlackoilWellModel_impl.hpp:2156
const std::map< std::string, int > & well_domain() const
Definition: BlackoilWellModel.hpp:321
bool updateWellControls(DeferredLogger &deferred_logger)
Definition: BlackoilWellModel_impl.hpp:1701
void endIteration()
Definition: BlackoilWellModel.hpp:163
static constexpr bool has_polymer_
Definition: BlackoilWellModel.hpp:122
int reportStepIndex() const
Definition: BlackoilWellModel_impl.hpp:2200
void calculateProductivityIndexValues(DeferredLogger &deferred_logger) override
Definition: BlackoilWellModel_impl.hpp:1973
void extractLegacyDepth_()
Definition: BlackoilWellModel_impl.hpp:2172
void extractLegacyCellPvtRegionIndex_()
Definition: BlackoilWellModel_impl.hpp:2140
void recoverWellSolutionAndUpdateWellStateDomain(const BVector &x, const int domainIdx)
Definition: BlackoilWellModel_impl.hpp:1622
void updateAverageFormationFactor()
Definition: BlackoilWellModel_impl.hpp:2083
GetPropType< TypeTag, Properties::Simulator > Simulator
Definition: BlackoilWellModel.hpp:106
bool isReservoirCouplingSlave() const
Check if this process is a reservoir coupling slave.
Definition: BlackoilWellModel.hpp:399
void initializeWellState(const int timeStepIdx)
Definition: BlackoilWellModel_impl.hpp:882
const Grid & grid() const
Definition: BlackoilWellModel.hpp:365
void updatePrimaryVariables()
Definition: BlackoilWellModel_impl.hpp:2131
const ReservoirCoupling::Proxy< Scalar > & rescoup() const
Definition: BlackoilWellModel.hpp:378
void computeWellTemperature()
Definition: BlackoilWellModel_impl.hpp:2234
static const int numEq
Definition: BlackoilWellModel.hpp:119
void addWellPressureEquations(PressureMatrix &jacobian, const BVector &weights, const bool use_well_weights) const
Definition: BlackoilWellModel_impl.hpp:1523
const SimulatorReportSingle & lastReport() const
Definition: BlackoilWellModel_impl.hpp:758
bool updateWellControlsAndNetwork(const bool mandatory_network_balance, const double dt, DeferredLogger &local_deferredLogger)
Definition: BlackoilWellModel_impl.hpp:1279
void endEpisode()
Definition: BlackoilWellModel.hpp:172
GetPropType< TypeTag, Properties::SparseMatrixAdapter > SparseMatrixAdapter
Definition: BlackoilWellModel.hpp:110
void addWellContributions(SparseMatrixAdapter &jacobian) const
Definition: BlackoilWellModel_impl.hpp:1513
const EquilGrid & equilGrid() const
Definition: BlackoilWellModel.hpp:538
void assembleWellEq(const double dt)
Definition: BlackoilWellModel_impl.hpp:1402
WellInterfacePtr createWellForWellTest(const std::string &well_name, const int report_step, DeferredLogger &deferred_logger) const
Definition: BlackoilWellModel_impl.hpp:1185
GetPropType< TypeTag, Properties::Indices > Indices
Definition: BlackoilWellModel.hpp:105
int compressedIndexForInteriorLGR(const std::string &lgr_tag, const Connection &conn) const override
Definition: BlackoilWellModel.hpp:345
void calculateExplicitQuantities() const
Definition: BlackoilWellModel_impl.hpp:1686
std::vector< WellInterfacePtr > well_container_
Definition: BlackoilWellModel.hpp:497
static constexpr std::size_t pressureVarIndex
Definition: BlackoilWellModel.hpp:117
void updateAndCommunicate(const int reportStepIdx)
Definition: BlackoilWellModel_impl.hpp:1781
Dune::BCRSMatrix< Opm::MatrixBlock< Scalar, 1, 1 > > PressureMatrix
Definition: BlackoilWellModel.hpp:287
bool empty() const
Definition: BlackoilWellModel.hpp:332
void computeTotalRatesForDof(RateVector &rate, unsigned globalIdx) const
Definition: BlackoilWellModel_impl.hpp:845
bool addMatrixContributions() const
Definition: BlackoilWellModel.hpp:334
void beginTimeStep()
Definition: BlackoilWellModel_impl.hpp:329
std::vector< Scalar > B_avg_
Definition: BlackoilWellModel.hpp:536
const std::vector< Scalar > & wellPerfEfficiencyFactors() const
GetPropType< TypeTag, Properties::RateVector > RateVector
Definition: BlackoilWellModel.hpp:108
bool updateGroupControls(const Group &group, DeferredLogger &deferred_logger, const int reportStepIdx)
Definition: BlackoilWellModel_impl.hpp:1813
std::map< std::string, std::unique_ptr< AverageRegionalPressureType > > regionalAveragePressureCalculator_
Definition: BlackoilWellModel.hpp:527
void calcInjResvCoeff(const int fipnum, const int pvtreg, std::vector< Scalar > &resv_coeff) const override
Definition: BlackoilWellModel_impl.hpp:2223
static Scalar computeTemperatureWeightFactor(const int perf_index, const int np, const FluidState &fs, const SingleWellState &ws)
Definition: BlackoilWellModel.hpp:473
GetPropType< TypeTag, Properties::GlobalEqVector > GlobalEqVector
Definition: BlackoilWellModel.hpp:109
void initializeLocalWellStructure(const int reportStepIdx, const bool enableWellPIScaling)
Definition: BlackoilWellModel_impl.hpp:251
static constexpr bool has_solvent_
Definition: BlackoilWellModel.hpp:121
Dune::BlockVector< VectorBlockType > BVector
Definition: BlackoilWellModel.hpp:131
static constexpr bool has_micp_
Definition: BlackoilWellModel.hpp:125
std::unique_ptr< RateConverterType > rateConverter_
Definition: BlackoilWellModel.hpp:526
BlackoilWellModel(Simulator &simulator)
Definition: BlackoilWellModel_impl.hpp:79
const SparseTable< int > & well_local_cells() const
Definition: BlackoilWellModel.hpp:313
void wellTesting(const int timeStepIdx, const double simulationTime, DeferredLogger &deferred_logger)
Definition: BlackoilWellModel_impl.hpp:681
std::vector< bool > is_cell_perforated_
Definition: BlackoilWellModel.hpp:499
ConvergenceReport getWellConvergence(const std::vector< Scalar > &B_avg, const bool checkWellGroupControlsAndNetwork=false) const
Definition: BlackoilWellModel_impl.hpp:1635
int numStrictIterations() const
Definition: BlackoilWellModel.hpp:337
typename FluidSystem::IndexTraitsType IndexTraits
Definition: BlackoilWellModel.hpp:114
void updateCellRatesForDomain(int domainIndex, const std::map< std::string, int > &well_domain_map)
Definition: BlackoilWellModel_impl.hpp:1460
data::WellBlockAveragePressures wellBlockAveragePressures() const
Definition: BlackoilWellModel.hpp:243
void assembleWellEqWithoutIteration(const double dt)
Definition: BlackoilWellModel_impl.hpp:1428
void updateCellRates()
Definition: BlackoilWellModel_impl.hpp:1448
void assemble(const double dt)
Definition: BlackoilWellModel_impl.hpp:1210
auto begin() const
Definition: BlackoilWellModel.hpp:330
std::size_t local_num_cells_
Definition: BlackoilWellModel.hpp:522
auto end() const
Definition: BlackoilWellModel.hpp:331
bool alternative_well_rate_init_
Definition: BlackoilWellModel.hpp:525
void timeStepSucceeded(const double simulationTime, const double dt)
Definition: BlackoilWellModel_impl.hpp:768
std::unique_ptr< WellType > createTypedWellPointer(const int wellID, const int time_step) const
Definition: BlackoilWellModel_impl.hpp:1154
void computePotentials(const std::size_t widx, const WellState< Scalar, IndexTraits > &well_state_copy, std::string &exc_msg, ExceptionType::ExcEnum &exc_type) override
Definition: BlackoilWellModel_impl.hpp:1938
Simulator & simulator_
Definition: BlackoilWellModel.hpp:494
void updateGuideRates(const int report_step_idx, const double sim_time)
Update guide rates for all wells and groups.
Definition: BlackoilWellModel.hpp:387
ReservoirCoupling::Proxy< Scalar > rescoup_
Definition: BlackoilWellModel.hpp:531
void createWellContainer(const int report_step) override
Definition: BlackoilWellModel_impl.hpp:925
std::unique_ptr< WellInterface< TypeTag > > WellInterfacePtr
Definition: BlackoilWellModel.hpp:187
ReservoirCouplingSlave< Scalar > & reservoirCouplingSlave()
Get reference to reservoir coupling slave.
Definition: BlackoilWellModel.hpp:418
data::Wells wellData() const
Definition: BlackoilWellModel.hpp:205
const ModelParameters & param() const
Definition: BlackoilWellModel.hpp:468
void updateWellTestState(const double simulationTime, WellTestState &wellTestState)
upate the wellTestState related to economic limits
Definition: BlackoilWellModel_impl.hpp:1867
void addWellPressureEquationsDomain(PressureMatrix &jacobian, const BVector &weights, const bool use_well_weights, const int domainIndex) const
Definition: BlackoilWellModel.hpp:293
bool isReservoirCouplingMasterGroup(const std::string &group_name) const
Check if a group is a reservoir coupling master group.
Definition: BlackoilWellModel.hpp:406
void addReservoirSourceTerms(GlobalEqVector &residual, const std::vector< typename SparseMatrixAdapter::MatrixBlock * > &diagMatAddress) const
Definition: BlackoilWellModel_impl.hpp:1545
int compressedIndexForInterior(int cartesian_cell_idx) const override
get compressed index for interior cells (-1, otherwise
Definition: BlackoilWellModel.hpp:340
static constexpr bool has_energy_
Definition: BlackoilWellModel.hpp:124
void recoverWellSolutionAndUpdateWellState(const BVector &x)
Definition: BlackoilWellModel_impl.hpp:1598
void addWellPressureEquationsStruct(PressureMatrix &jacobian) const
Definition: BlackoilWellModel_impl.hpp:1575
void calculateProductivityIndexValuesShutWells(const int reportStepIdx, DeferredLogger &deferred_logger) override
Definition: BlackoilWellModel_impl.hpp:1987
void endReportStep()
Definition: BlackoilWellModel_impl.hpp:741
data::WellBlockAveragePressures computeWellBlockAveragePressures(const Scalar gravity) const
Definition: ConvergenceReport.hpp:38
Definition: DeferredLogger.hpp:57
Definition: GroupStateHelper.hpp:56
Handles computation and reporting of guide rates for wells and groups.
Definition: GuideRateHandler.hpp:46
Definition: RateConverter.hpp:70
Definition: RegionAverageCalculator.hpp:60
Thin proxy for reservoir coupling master/slave pointers.
Definition: RescoupProxy.hpp:54
Definition: ReservoirCouplingMaster.hpp:38
Definition: ReservoirCouplingSlave.hpp:40
Definition: SingleWellState.hpp:44
PerfData< Scalar > perf_data
Definition: SingleWellState.hpp:156
Definition: BlackoilWellModel.hpp:87
Definition: WellConnectionAuxiliaryModule.hpp:39
Definition: WellContributions.hpp:51
Definition: WellInterface.hpp:77
Definition: WellState.hpp:66
data::Wells report(const int *globalCellIdxMap, const std::function< bool(const int)> &wasDynamicallyClosed, const RsConstInfo &rsConst=RsConstInfo{}) const
ExcEnum
Definition: DeferredLogger.hpp:45
Definition: blackoilbioeffectsmodules.hh:45
typename Properties::Detail::GetPropImpl< TypeTag, Property >::type::type GetPropType
get the type alias defined in the property (equivalent to old macro GET_PROP_TYPE(....
Definition: propertysystem.hh:233
Solver parameters for the BlackoilModel.
Definition: BlackoilModelParameters.hpp:196
bool matrix_add_well_contributions_
Whether to add influences of wells between cells to the matrix and preconditioner matrix.
Definition: BlackoilModelParameters.hpp:310
int strict_outer_iter_wells_
Newton iteration where wells are stricly convergent.
Definition: BlackoilModelParameters.hpp:260
A struct for returning timing data from a simulator to its caller.
Definition: SimulatorReport.hpp:34