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
27
28#include <dune/common/fmatrix.hh>
29#include <dune/istl/bcrsmatrix.hh>
30#include <dune/istl/matrixmatrix.hh>
31
32#include <opm/common/OpmLog/OpmLog.hpp>
33
34#include <opm/input/eclipse/Schedule/Group/Group.hpp>
35#include <opm/input/eclipse/Schedule/Group/GuideRate.hpp>
36#include <opm/input/eclipse/Schedule/Schedule.hpp>
37#include <opm/input/eclipse/Schedule/Well/WellTestState.hpp>
38
39#include <opm/material/densead/Math.hpp>
40
43
45
48
50
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
127 // TODO: where we should put these types, WellInterface or Well Model?
128 // or there is some other strategy, like TypeTag
129 using VectorBlockType = Dune::FieldVector<Scalar, numEq>;
130 using BVector = Dune::BlockVector<VectorBlockType>;
131
134
135 // For the conversion between the surface volume rate and reservoir voidage rate
136 using RateConverterType = RateConverter::
137 SurfaceToReservoirVoidage<FluidSystem, std::vector<int> >;
138
139 // For computing average pressured used by gpmaint
140 using AverageRegionalPressureType = RegionAverageCalculator::
141 AverageRegionalPressure<FluidSystem, std::vector<int> >;
142
144
145 void init();
146 void initWellContainer(const int reportStepIdx) override;
147
149 {
150 OPM_TIMEBLOCK(beginEpsiode);
151 beginReportStep(simulator_.episodeIndex());
152 }
153
154 void beginTimeStep();
155
157 {
158 OPM_TIMEBLOCK(beginIteration);
159 assemble(simulator_.model().newtonMethod().numIterations(),
160 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),
196 this->simulator_.vanguard().enableDistributedWells());
197 }
198
200 void prepareDeserialize(const int report_step)
201 {
202 prepareDeserialize(report_step, grid().size(0),
204 this->simulator_.vanguard().enableDistributedWells());
205 }
206
207 data::Wells wellData() const
208 {
209 auto wsrpt = this->wellState()
210 .report(this->simulator_.vanguard().globalCell().data(),
211 [this](const int well_index)
212 {
213 return this->wasDynamicallyShutThisTimeStep(well_index);
214 });
215
217 .assignWellGuideRates(wsrpt, this->reportStepIndex());
218
219 this->assignWellTracerRates(wsrpt);
220
221 if (const auto& rspec = eclState().runspec();
222 rspec.co2Storage() || rspec.h2Storage())
223 {
224 // The gas reference density (surface condition) is the
225 // same for all PVT regions in CO2STORE/H2STORE runs so,
226 // for simplicity, we use region zero (0) here.
227
228 this->assignMassGasRate(wsrpt, FluidSystem::referenceDensity(FluidSystem::gasPhaseIdx, 0));
229 }
230
231 this->assignWellTargets(wsrpt);
232
233 this->assignDynamicWellStatus(wsrpt);
234
235 // Assigning (a subset of the) property values in shut
236 // connections should be the last step of wellData().
237 this->assignShutConnections(wsrpt, this->reportStepIndex());
238
239 return wsrpt;
240 }
241
242 data::WellBlockAveragePressures wellBlockAveragePressures() const
243 {
245 }
246
247#if COMPILE_GPU_BRIDGE
248 // accumulate the contributions of all Wells in the WellContributions object
249 void getWellContributions(WellContributions<Scalar>& x) const;
250#endif
251
252 // Check if well equations is converged.
253 ConvergenceReport getWellConvergence(const std::vector<Scalar>& B_avg, const bool checkWellGroupControlsAndNetwork = false) const;
254
255 const SimulatorReportSingle& lastReport() const;
256
257 void addWellContributions(SparseMatrixAdapter& jacobian) const;
258
259 // add source from wells to the reservoir matrix
261 const std::vector<typename SparseMatrixAdapter::MatrixBlock*>& diagMatAddress) const;
262
263 // called at the beginning of a report step
264 void beginReportStep(const int time_step);
265
266 // it should be able to go to prepareTimeStep(), however, the updateWellControls()
267 // makes it a little more difficult. unless we introduce if (iterationIdx != 0) to avoid doing the above function
268 // twice at the beginning of the time step
271 void calculateExplicitQuantities(DeferredLogger& deferred_logger) const;
272 // some preparation work, mostly related to group control and RESV,
273 // at the beginning of each time step (Not report step)
274 void prepareTimeStep(DeferredLogger& deferred_logger);
275
276 bool
277 updateWellControls(DeferredLogger& deferred_logger);
278
279 void updateAndCommunicate(const int reportStepIdx,
280 const int iterationIdx,
281 DeferredLogger& deferred_logger);
282
283 bool updateGroupControls(const Group& group,
284 DeferredLogger& deferred_logger,
285 const int reportStepIdx,
286 const int iterationIdx);
287
288 const WellInterface<TypeTag>& getWell(const std::string& well_name) const;
289
290 using PressureMatrix = Dune::BCRSMatrix<Opm::MatrixBlock<Scalar, 1, 1>>;
291
293 const BVector& weights,
294 const bool use_well_weights) const;
297 const BVector& weights,
298 const bool use_well_weights,
299 const int domainIndex) const
300 {
301 if (!nldd_) {
302 OPM_THROW(std::logic_error, "Attempt to access NLDD data without a NLDD solver");
303 }
304 return nldd_->addWellPressureEquations(jacobian,
305 weights,
306 use_well_weights,
307 domainIndex);
308 }
309
311 const std::vector<WellInterfacePtr>& localNonshutWells() const
312 {
313 return well_container_;
314 }
315
317 {
318 if (!nldd_) {
319 OPM_THROW(std::logic_error, "Attempt to access NLDD data without a NLDD solver");
320 }
321 return nldd_->well_local_cells();
322 }
323
324 const std::map<std::string, int>& well_domain() const
325 {
326 if (!nldd_) {
327 OPM_THROW(std::logic_error, "Attempt to access NLDD data without a NLDD solver");
328 }
329
330 return nldd_->well_domain();
331 }
332
333 auto begin() const { return well_container_.begin(); }
334 auto end() const { return well_container_.end(); }
335 bool empty() const { return well_container_.empty(); }
336
339
342
343 int compressedIndexForInterior(int cartesian_cell_idx) const override
344 {
345 return simulator_.vanguard().compressedIndexForInterior(cartesian_cell_idx);
346 }
347
348 int compressedIndexForInteriorLGR(const std::string& lgr_tag, const Connection& conn) const override
349 {
350 return simulator_.vanguard().compressedIndexForInteriorLGR(lgr_tag, conn);
351 }
352
353 // using the solution x to recover the solution xw for wells and applying
354 // xw to update Well State
356
357 // using the solution x to recover the solution xw for wells and applying
358 // xw to update Well State
360 const int domainIdx);
361 // Update cellRates_ with contributions from all wells
362 void updateCellRates();
363
364 // Update cellRates_ with contributions from wells in a specific domain
365 void updateCellRatesForDomain(int domainIndex,
366 const std::map<std::string, int>& well_domain_map);
367
368 const Grid& grid() const
369 { return simulator_.vanguard().grid(); }
370
371 const Simulator& simulator() const
372 { return simulator_; }
373
375 { nldd_ = mod; }
376
377 // === Reservoir Coupling ===
378
382
384 bool isReservoirCouplingMaster() const { return rescoup_.isMaster(); }
385
387 bool isReservoirCouplingSlave() const { return rescoup_.isSlave(); }
388
392 return rescoup_.master();
393 }
394
398 return rescoup_.slave();
399 }
400
401#ifdef RESERVOIR_COUPLING_ENABLED
402 void setReservoirCouplingMaster(ReservoirCouplingMaster<Scalar>* master)
403 {
404 rescoup_.setMaster(master);
405 this->guide_rate_handler_.setReservoirCouplingMaster(master);
406 this->groupStateHelper().setReservoirCouplingMaster(master);
407 }
408 void setReservoirCouplingSlave(ReservoirCouplingSlave<Scalar>* slave)
409 {
410 rescoup_.setSlave(slave);
411 this->guide_rate_handler_.setReservoirCouplingSlave(slave);
412 this->groupStateHelper().setReservoirCouplingSlave(slave);
413 }
414
416 void sendSlaveGroupDataToMaster();
417
419 void receiveSlaveGroupData();
420
429 std::optional<ReservoirCoupling::ScopedLoggerGuard>
430 setupRescoupScopedLogger(DeferredLogger& local_logger);
431
432#endif
433
434 bool updateWellControlsAndNetwork(const bool mandatory_network_balance,
435 const double dt,
436 DeferredLogger& local_deferredLogger);
437
438 // TODO: finding a better naming
439 void assembleWellEqWithoutIteration(const double dt, DeferredLogger& deferred_logger);
440
441 const std::vector<Scalar>& B_avg() const
442 { return B_avg_; }
443
444 const ModelParameters& param() const
445 { return param_; }
446
447 protected:
449
450 // a vector of all the wells.
451 std::vector<WellInterfacePtr> well_container_{};
452
453 std::vector<bool> is_cell_perforated_{};
454
455 void initializeWellState(const int timeStepIdx);
456
457 // create the well container
458 void createWellContainer(const int report_step) override;
459
461 createWellPointer(const int wellID,
462 const int report_step) const;
463
464 template <typename WellType>
465 std::unique_ptr<WellType>
466 createTypedWellPointer(const int wellID,
467 const int time_step) const;
468
469 WellInterfacePtr createWellForWellTest(const std::string& well_name,
470 const int report_step,
471 DeferredLogger& deferred_logger) const;
472
474 std::size_t global_num_cells_{};
475 // the number of the cells in the local grid
476 std::size_t local_num_cells_{};
478 std::vector<Scalar> depth_{};
480 std::unique_ptr<RateConverterType> rateConverter_{};
481 std::map<std::string, std::unique_ptr<AverageRegionalPressureType>> regionalAveragePressureCalculator_{};
482
486
487 // A flag to tell the convergence report whether we need to take another newton step
489
490 std::vector<Scalar> B_avg_{};
491
492 const EquilGrid& equilGrid() const
493 { return simulator_.vanguard().equilGrid(); }
494
495 const EclipseState& eclState() const
496 { return simulator_.vanguard().eclState(); }
497
498 // compute the well fluxes and assemble them in to the reservoir equations as source terms
499 // and in the well equations.
500 void assemble(const int iterationIdx,
501 const double dt);
502
503 // well controls and network pressures affect each other and are solved in an iterative manner.
504 // the function handles one iteration of updating well controls and network pressures.
505 // it is possible to decouple the update of well controls and network pressures further.
506 // the returned two booleans are {continue_due_to_network, well_group_control_changed}, respectively
507 std::tuple<bool, bool, Scalar> updateWellControlsAndNetworkIteration(const bool mandatory_network_balance,
508 const bool relax_network_tolerance,
509 const bool optimize_gas_lift,
510 const double dt,
511 DeferredLogger& local_deferredLogger);
512
521 void initializeLocalWellStructure(const int reportStepIdx,
522 const bool enableWellPIScaling);
523
527 void initializeGroupStructure(const int reportStepIdx);
528
529 // called at the end of a time step
530 void timeStepSucceeded(const double simulationTime, const double dt);
531
532 // called at the end of a report step
533 void endReportStep();
534
535 // setting the well_solutions_ based on well_state.
536 void updatePrimaryVariables(DeferredLogger& deferred_logger);
537
539
540 void computePotentials(const std::size_t widx,
541 const WellState<Scalar, IndexTraits>& well_state_copy,
542 std::string& exc_msg,
543 ExceptionType::ExcEnum& exc_type,
544 DeferredLogger& deferred_logger) override;
545
546 const std::vector<Scalar>& wellPerfEfficiencyFactors() const;
547
548 void calculateProductivityIndexValuesShutWells(const int reportStepIdx, DeferredLogger& deferred_logger) override;
549 void calculateProductivityIndexValues(DeferredLogger& deferred_logger) override;
551 DeferredLogger& deferred_logger);
552
553 // The number of conservation quantities.
554 int numConservationQuantities() const;
555
556 int reportStepIndex() const;
557
558 void assembleWellEq(const double dt, DeferredLogger& deferred_logger);
559
560 void prepareWellsBeforeAssembling(const double dt, DeferredLogger& deferred_logger);
561
563
564 void extractLegacyDepth_();
565
567 void updateWellTestState(const double simulationTime, WellTestState& wellTestState);
568
569 void wellTesting(const int timeStepIdx, const double simulationTime, DeferredLogger& deferred_logger);
570
571 void calcResvCoeff(const int fipnum,
572 const int pvtreg,
573 const std::vector<Scalar>& production_rates,
574 std::vector<Scalar>& resv_coeff) override;
575
576 void calcInjResvCoeff(const int fipnum,
577 const int pvtreg,
578 std::vector<Scalar>& resv_coeff) override;
579
581
582 private:
585 BlackoilWellModelNldd<TypeTag>* nldd_ = nullptr;
586
587 // These members are used to avoid reallocation in specific functions
588 // instead of using local variables.
589 // Their state is not relevant between function calls, so they can
590 // (and must) be mutable, as the functions using them are const.
591 mutable BVector x_local_;
592
593 // Store cell rates after assembling to avoid iterating all wells and connections for every element
594 std::map<int, RateVector> cellRates_;
595
596 void assignWellTracerRates(data::Wells& wsrpt) const;
597 };
598
599} // namespace Opm
600
602
603#endif // OPM_BLACKOILWELLMODEL_HEADER_INCLUDED
Contains the high level supplements required to extend the black oil model by bioeffects.
Definition: blackoilbioeffectsmodules.hh:93
Contains the high level supplements required to extend the black oil model by polymer.
Definition: blackoilpolymermodules.hh:64
Class for handling the gaslift in the blackoil well model.
Definition: BlackoilWellModelGasLift.hpp:96
Class for handling the blackoil well model.
Definition: BlackoilWellModelGeneric.hpp:96
BlackoilWellModelWBP< GetPropType< TypeTag, Properties::Scalar >, GetPropType< TypeTag, Properties::FluidSystem >::IndexTraitsType > wbp_
Definition: BlackoilWellModelGeneric.hpp:517
const WellState< GetPropType< TypeTag, Properties::Scalar >, GetPropType< TypeTag, Properties::FluidSystem >::IndexTraitsType > & wellState() const
Definition: BlackoilWellModelGeneric.hpp:151
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:380
void initializeGroupStructure(const int reportStepIdx)
Definition: BlackoilWellModel_impl.hpp:295
bool network_needs_more_balancing_force_another_newton_iteration_
Definition: BlackoilWellModel.hpp:488
ReservoirCouplingMaster< Scalar > & reservoirCouplingMaster()
Get reference to reservoir coupling master.
Definition: BlackoilWellModel.hpp:391
void endTimeStep()
Definition: BlackoilWellModel.hpp:166
void prepareTimeStep(DeferredLogger &deferred_logger)
Definition: BlackoilWellModel_impl.hpp:1962
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:1259
bool updateGroupControls(const Group &group, DeferredLogger &deferred_logger, const int reportStepIdx, const int iterationIdx)
Definition: BlackoilWellModel_impl.hpp:1742
WellInterfacePtr createWellPointer(const int wellID, const int report_step) const
Definition: BlackoilWellModel_impl.hpp:1057
GuideRateHandler< Scalar, IndexTraits > guide_rate_handler_
Definition: BlackoilWellModel.hpp:484
const EclipseState & eclState() const
Definition: BlackoilWellModel.hpp:495
void calcInjResvCoeff(const int fipnum, const int pvtreg, std::vector< Scalar > &resv_coeff) override
Definition: BlackoilWellModel_impl.hpp:2155
const std::vector< WellInterfacePtr > & localNonshutWells() const
Get list of local nonshut wells.
Definition: BlackoilWellModel.hpp:311
void prepareDeserialize(const int report_step)
Definition: BlackoilWellModel.hpp:200
void init()
Definition: BlackoilWellModel_impl.hpp:161
void setNlddAdapter(BlackoilWellModelNldd< TypeTag > *mod)
Definition: BlackoilWellModel.hpp:374
void calcResvCoeff(const int fipnum, const int pvtreg, const std::vector< Scalar > &production_rates, std::vector< Scalar > &resv_coeff) override
Definition: BlackoilWellModel_impl.hpp:2144
const Simulator & simulator() const
Definition: BlackoilWellModel.hpp:371
std::vector< Scalar > depth_
Definition: BlackoilWellModel.hpp:478
static constexpr EnergyModules energyModuleType_
Definition: BlackoilWellModel.hpp:123
void updateAndCommunicate(const int reportStepIdx, const int iterationIdx, DeferredLogger &deferred_logger)
Definition: BlackoilWellModel_impl.hpp:1705
std::size_t global_num_cells_
Definition: BlackoilWellModel.hpp:474
GetPropType< TypeTag, Properties::Scalar > Scalar
Definition: BlackoilWellModel.hpp:107
const std::vector< Scalar > & B_avg() const
Definition: BlackoilWellModel.hpp:441
SimulatorReportSingle last_report_
Definition: BlackoilWellModel.hpp:483
static const int solventSaturationIdx
Definition: BlackoilWellModel.hpp:120
Scalar gravity_
Definition: BlackoilWellModel.hpp:477
void initWellContainer(const int reportStepIdx) override
Definition: BlackoilWellModel_impl.hpp:180
void beginReportStep(const int time_step)
Definition: BlackoilWellModel_impl.hpp:197
const WellInterface< TypeTag > & getWell(const std::string &well_name) const
Definition: BlackoilWellModel_impl.hpp:2115
GetPropType< TypeTag, Properties::FluidSystem > FluidSystem
Definition: BlackoilWellModel.hpp:103
void beginIteration()
Definition: BlackoilWellModel.hpp:156
bool isReservoirCouplingMaster() const
Check if this process is a reservoir coupling master.
Definition: BlackoilWellModel.hpp:384
Dune::FieldVector< Scalar, numEq > VectorBlockType
Definition: BlackoilWellModel.hpp:129
void initFromRestartFile(const RestartValue &restartValues)
Definition: BlackoilWellModel.hpp:190
const ModelParameters param_
Definition: BlackoilWellModel.hpp:473
void beginEpisode()
Definition: BlackoilWellModel.hpp:148
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:2087
void assembleWellEq(const double dt, DeferredLogger &deferred_logger)
Definition: BlackoilWellModel_impl.hpp:1323
const std::map< std::string, int > & well_domain() const
Definition: BlackoilWellModel.hpp:324
bool updateWellControls(DeferredLogger &deferred_logger)
Definition: BlackoilWellModel_impl.hpp:1624
void endIteration()
Definition: BlackoilWellModel.hpp:163
static constexpr bool has_polymer_
Definition: BlackoilWellModel.hpp:122
int reportStepIndex() const
Definition: BlackoilWellModel_impl.hpp:2132
void calculateProductivityIndexValues(DeferredLogger &deferred_logger) override
Definition: BlackoilWellModel_impl.hpp:1904
void extractLegacyDepth_()
Definition: BlackoilWellModel_impl.hpp:2103
void extractLegacyCellPvtRegionIndex_()
Definition: BlackoilWellModel_impl.hpp:2071
void recoverWellSolutionAndUpdateWellStateDomain(const BVector &x, const int domainIdx)
Definition: BlackoilWellModel_impl.hpp:1544
void updateAverageFormationFactor()
Definition: BlackoilWellModel_impl.hpp:2014
GetPropType< TypeTag, Properties::Simulator > Simulator
Definition: BlackoilWellModel.hpp:106
bool isReservoirCouplingSlave() const
Check if this process is a reservoir coupling slave.
Definition: BlackoilWellModel.hpp:387
void initializeWellState(const int timeStepIdx)
Definition: BlackoilWellModel_impl.hpp:798
void assemble(const int iterationIdx, const double dt)
Definition: BlackoilWellModel_impl.hpp:1133
const Grid & grid() const
Definition: BlackoilWellModel.hpp:368
const ReservoirCoupling::Proxy< Scalar > & rescoup() const
Definition: BlackoilWellModel.hpp:381
void computeWellTemperature()
Definition: BlackoilWellModel_impl.hpp:2166
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:1444
const SimulatorReportSingle & lastReport() const
Definition: BlackoilWellModel_impl.hpp:674
bool updateWellControlsAndNetwork(const bool mandatory_network_balance, const double dt, DeferredLogger &local_deferredLogger)
Definition: BlackoilWellModel_impl.hpp:1200
void endEpisode()
Definition: BlackoilWellModel.hpp:172
GetPropType< TypeTag, Properties::SparseMatrixAdapter > SparseMatrixAdapter
Definition: BlackoilWellModel.hpp:110
void addWellContributions(SparseMatrixAdapter &jacobian) const
Definition: BlackoilWellModel_impl.hpp:1434
const EquilGrid & equilGrid() const
Definition: BlackoilWellModel.hpp:492
WellInterfacePtr createWellForWellTest(const std::string &well_name, const int report_step, DeferredLogger &deferred_logger) const
Definition: BlackoilWellModel_impl.hpp:1108
GetPropType< TypeTag, Properties::Indices > Indices
Definition: BlackoilWellModel.hpp:105
int compressedIndexForInteriorLGR(const std::string &lgr_tag, const Connection &conn) const override
Definition: BlackoilWellModel.hpp:348
void assembleWellEqWithoutIteration(const double dt, DeferredLogger &deferred_logger)
Definition: BlackoilWellModel_impl.hpp:1349
std::vector< WellInterfacePtr > well_container_
Definition: BlackoilWellModel.hpp:451
static constexpr std::size_t pressureVarIndex
Definition: BlackoilWellModel.hpp:117
Dune::BCRSMatrix< Opm::MatrixBlock< Scalar, 1, 1 > > PressureMatrix
Definition: BlackoilWellModel.hpp:290
bool empty() const
Definition: BlackoilWellModel.hpp:335
void computeTotalRatesForDof(RateVector &rate, unsigned globalIdx) const
Definition: BlackoilWellModel_impl.hpp:761
bool addMatrixContributions() const
Definition: BlackoilWellModel.hpp:337
void beginTimeStep()
Definition: BlackoilWellModel_impl.hpp:331
std::vector< Scalar > B_avg_
Definition: BlackoilWellModel.hpp:490
const std::vector< Scalar > & wellPerfEfficiencyFactors() const
GetPropType< TypeTag, Properties::RateVector > RateVector
Definition: BlackoilWellModel.hpp:108
void calculateExplicitQuantities(DeferredLogger &deferred_logger) const
Definition: BlackoilWellModel_impl.hpp:1609
std::map< std::string, std::unique_ptr< AverageRegionalPressureType > > regionalAveragePressureCalculator_
Definition: BlackoilWellModel.hpp:481
void updatePrimaryVariables(DeferredLogger &deferred_logger)
Definition: BlackoilWellModel_impl.hpp:2062
GetPropType< TypeTag, Properties::GlobalEqVector > GlobalEqVector
Definition: BlackoilWellModel.hpp:109
void initializeLocalWellStructure(const int reportStepIdx, const bool enableWellPIScaling)
Definition: BlackoilWellModel_impl.hpp:250
static constexpr bool has_solvent_
Definition: BlackoilWellModel.hpp:121
Dune::BlockVector< VectorBlockType > BVector
Definition: BlackoilWellModel.hpp:130
static constexpr bool has_micp_
Definition: BlackoilWellModel.hpp:125
std::unique_ptr< RateConverterType > rateConverter_
Definition: BlackoilWellModel.hpp:480
BlackoilWellModel(Simulator &simulator)
Definition: BlackoilWellModel_impl.hpp:74
const SparseTable< int > & well_local_cells() const
Definition: BlackoilWellModel.hpp:316
void wellTesting(const int timeStepIdx, const double simulationTime, DeferredLogger &deferred_logger)
Definition: BlackoilWellModel_impl.hpp:594
std::vector< bool > is_cell_perforated_
Definition: BlackoilWellModel.hpp:453
ConvergenceReport getWellConvergence(const std::vector< Scalar > &B_avg, const bool checkWellGroupControlsAndNetwork=false) const
Definition: BlackoilWellModel_impl.hpp:1557
int numStrictIterations() const
Definition: BlackoilWellModel.hpp:340
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:1381
data::WellBlockAveragePressures wellBlockAveragePressures() const
Definition: BlackoilWellModel.hpp:242
void updateCellRates()
Definition: BlackoilWellModel_impl.hpp:1369
auto begin() const
Definition: BlackoilWellModel.hpp:333
std::size_t local_num_cells_
Definition: BlackoilWellModel.hpp:476
auto end() const
Definition: BlackoilWellModel.hpp:334
bool alternative_well_rate_init_
Definition: BlackoilWellModel.hpp:479
void timeStepSucceeded(const double simulationTime, const double dt)
Definition: BlackoilWellModel_impl.hpp:684
std::unique_ptr< WellType > createTypedWellPointer(const int wellID, const int time_step) const
Definition: BlackoilWellModel_impl.hpp:1077
Simulator & simulator_
Definition: BlackoilWellModel.hpp:448
ReservoirCoupling::Proxy< Scalar > rescoup_
Definition: BlackoilWellModel.hpp:485
void createWellContainer(const int report_step) override
Definition: BlackoilWellModel_impl.hpp:841
std::unique_ptr< WellInterface< TypeTag > > WellInterfacePtr
Definition: BlackoilWellModel.hpp:187
ReservoirCouplingSlave< Scalar > & reservoirCouplingSlave()
Get reference to reservoir coupling slave.
Definition: BlackoilWellModel.hpp:397
data::Wells wellData() const
Definition: BlackoilWellModel.hpp:207
const ModelParameters & param() const
Definition: BlackoilWellModel.hpp:444
void updateWellTestState(const double simulationTime, WellTestState &wellTestState)
upate the wellTestState related to economic limits
Definition: BlackoilWellModel_impl.hpp:1787
void addWellPressureEquationsDomain(PressureMatrix &jacobian, const BVector &weights, const bool use_well_weights, const int domainIndex) const
Definition: BlackoilWellModel.hpp:296
void addReservoirSourceTerms(GlobalEqVector &residual, const std::vector< typename SparseMatrixAdapter::MatrixBlock * > &diagMatAddress) const
Definition: BlackoilWellModel_impl.hpp:1466
int compressedIndexForInterior(int cartesian_cell_idx) const override
get compressed index for interior cells (-1, otherwise
Definition: BlackoilWellModel.hpp:343
static constexpr bool has_energy_
Definition: BlackoilWellModel.hpp:124
void recoverWellSolutionAndUpdateWellState(const BVector &x)
Definition: BlackoilWellModel_impl.hpp:1519
void addWellPressureEquationsStruct(PressureMatrix &jacobian) const
Definition: BlackoilWellModel_impl.hpp:1496
void calculateProductivityIndexValuesShutWells(const int reportStepIdx, DeferredLogger &deferred_logger) override
Definition: BlackoilWellModel_impl.hpp:1918
void computePotentials(const std::size_t widx, const WellState< Scalar, IndexTraits > &well_state_copy, std::string &exc_msg, ExceptionType::ExcEnum &exc_type, DeferredLogger &deferred_logger) override
Definition: BlackoilWellModel_impl.hpp:1868
void endReportStep()
Definition: BlackoilWellModel_impl.hpp:657
void prepareWellsBeforeAssembling(const double dt, DeferredLogger &deferred_logger)
Definition: BlackoilWellModel_impl.hpp:1335
data::WellBlockAveragePressures computeWellBlockAveragePressures(const Scalar gravity) const
Definition: ConvergenceReport.hpp:38
Definition: DeferredLogger.hpp:57
Definition: GroupStateHelper.hpp:53
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:53
Definition: ReservoirCouplingMaster.hpp:38
Definition: ReservoirCouplingSlave.hpp:40
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
ExcEnum
Definition: DeferredLogger.hpp:45
Definition: blackoilbioeffectsmodules.hh:43
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:182
bool matrix_add_well_contributions_
Whether to add influences of wells between cells to the matrix and preconditioner matrix.
Definition: BlackoilModelParameters.hpp:288
bool use_multisegment_well_
Definition: BlackoilModelParameters.hpp:282
int strict_outer_iter_wells_
Newton iteration where wells are stricly convergent.
Definition: BlackoilModelParameters.hpp:238
A struct for returning timing data from a simulator to its caller.
Definition: SimulatorReport.hpp:34