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#if HAVE_MPI
27#define RESERVOIR_COUPLING_ENABLED
28#endif
29#ifdef RESERVOIR_COUPLING_ENABLED
32#endif
33
34#include <dune/common/fmatrix.hh>
35#include <dune/istl/bcrsmatrix.hh>
36#include <dune/istl/matrixmatrix.hh>
37
38#include <opm/common/OpmLog/OpmLog.hpp>
39
40#include <opm/input/eclipse/Schedule/Group/Group.hpp>
41#include <opm/input/eclipse/Schedule/Group/GuideRate.hpp>
42#include <opm/input/eclipse/Schedule/Schedule.hpp>
43#include <opm/input/eclipse/Schedule/Well/WellTestState.hpp>
44
45#include <opm/material/densead/Math.hpp>
46
49
51
54
56
80
81#include <cstddef>
82#include <map>
83#include <memory>
84#include <string>
85#include <tuple>
86#include <vector>
87
88namespace Opm {
89
90template<class Scalar> class BlackoilWellModelNldd;
91template<class T> class SparseTable;
92
93#if COMPILE_GPU_BRIDGE
94template<class Scalar> class WellContributions;
95#endif
96
98 template<typename TypeTag>
99 class BlackoilWellModel : public WellConnectionAuxiliaryModule<TypeTag, BlackoilWellModel<TypeTag>>
100 , public BlackoilWellModelGeneric<GetPropType<TypeTag, Properties::Scalar>,
101 typename GetPropType<TypeTag, Properties::FluidSystem>::IndexTraitsType>
102 {
103 public:
104 // --------- Types ---------
116
118 using IndexTraits = typename FluidSystem::IndexTraitsType;
120
122
123 static const int numEq = Indices::numEq;
124 static const int solventSaturationIdx = Indices::solventSaturationIdx;
125 static constexpr bool has_solvent_ = getPropValue<TypeTag, Properties::EnableSolvent>();
126 static constexpr bool has_polymer_ = getPropValue<TypeTag, Properties::EnablePolymer>();
127 static constexpr bool has_energy_ = (getPropValue<TypeTag, Properties::EnergyModuleType>() == EnergyModules::FullyImplicitThermal);
128 static constexpr bool has_micp_ = Indices::enableMICP;
129
130 // TODO: where we should put these types, WellInterface or Well Model?
131 // or there is some other strategy, like TypeTag
132 using VectorBlockType = Dune::FieldVector<Scalar, numEq>;
133 using BVector = Dune::BlockVector<VectorBlockType>;
134
137
138 // For the conversion between the surface volume rate and reservoir voidage rate
139 using RateConverterType = RateConverter::
140 SurfaceToReservoirVoidage<FluidSystem, std::vector<int> >;
141
142 // For computing average pressured used by gpmaint
143 using AverageRegionalPressureType = RegionAverageCalculator::
144 AverageRegionalPressure<FluidSystem, std::vector<int> >;
145
147
148 void init();
149 void initWellContainer(const int reportStepIdx) override;
150
152 {
153 OPM_TIMEBLOCK(beginEpsiode);
154 beginReportStep(simulator_.episodeIndex());
155 }
156
157 void beginTimeStep();
158
160 {
161 OPM_TIMEBLOCK(beginIteration);
162 assemble(simulator_.model().newtonMethod().numIterations(),
163 simulator_.timeStepSize());
164 }
165
167 { }
168
170 {
171 OPM_TIMEBLOCK(endTimeStep);
172 timeStepSucceeded(simulator_.time(), simulator_.timeStepSize());
173 }
174
176 {
178 }
179
181 unsigned globalIdx) const;
182
183 template <class Context>
185 const Context& context,
186 unsigned spaceIdx,
187 unsigned timeIdx) const;
188
189
190 using WellInterfacePtr = std::unique_ptr<WellInterface<TypeTag>>;
191
193 void initFromRestartFile(const RestartValue& restartValues)
194 {
195 initFromRestartFile(restartValues,
196 this->simulator_.vanguard().transferWTestState(),
197 grid().size(0),
199 this->simulator_.vanguard().enableDistributedWells());
200 }
201
203 void prepareDeserialize(const int report_step)
204 {
205 prepareDeserialize(report_step, grid().size(0),
207 this->simulator_.vanguard().enableDistributedWells());
208 }
209
210 data::Wells wellData() const
211 {
212 auto wsrpt = this->wellState()
213 .report(this->simulator_.vanguard().globalCell().data(),
214 [this](const int well_index)
215 {
216 return this->wasDynamicallyShutThisTimeStep(well_index);
217 });
218
220 .assignWellGuideRates(wsrpt, this->reportStepIndex());
221
222 this->assignWellTracerRates(wsrpt);
223
224 if (const auto& rspec = eclState().runspec();
225 rspec.co2Storage() || rspec.h2Storage())
226 {
227 // The gas reference density (surface condition) is the
228 // same for all PVT regions in CO2STORE/H2STORE runs so,
229 // for simplicity, we use region zero (0) here.
230
231 this->assignMassGasRate(wsrpt, FluidSystem::referenceDensity(FluidSystem::gasPhaseIdx, 0));
232 }
233
234 this->assignWellTargets(wsrpt);
235
236 this->assignDynamicWellStatus(wsrpt);
237
238 // Assigning (a subset of the) property values in shut
239 // connections should be the last step of wellData().
240 this->assignShutConnections(wsrpt, this->reportStepIndex());
241
242 return wsrpt;
243 }
244
245 data::WellBlockAveragePressures wellBlockAveragePressures() const
246 {
248 }
249
250#if COMPILE_GPU_BRIDGE
251 // accumulate the contributions of all Wells in the WellContributions object
252 void getWellContributions(WellContributions<Scalar>& x) const;
253#endif
254
255 // Check if well equations is converged.
256 ConvergenceReport getWellConvergence(const std::vector<Scalar>& B_avg, const bool checkWellGroupControlsAndNetwork = false) const;
257
258 const SimulatorReportSingle& lastReport() const;
259
260 void addWellContributions(SparseMatrixAdapter& jacobian) const;
261
262 // add source from wells to the reservoir matrix
264 const std::vector<typename SparseMatrixAdapter::MatrixBlock*>& diagMatAddress) const;
265
266 // called at the beginning of a report step
267 void beginReportStep(const int time_step);
268
269 // it should be able to go to prepareTimeStep(), however, the updateWellControls()
270 // makes it a little more difficult. unless we introduce if (iterationIdx != 0) to avoid doing the above function
271 // twice at the beginning of the time step
274 void calculateExplicitQuantities(DeferredLogger& deferred_logger) const;
275 // some preparation work, mostly related to group control and RESV,
276 // at the beginning of each time step (Not report step)
277 void prepareTimeStep(DeferredLogger& deferred_logger);
278
279 bool
280 updateWellControls(DeferredLogger& deferred_logger);
281
282 std::tuple<bool, Scalar>
283 updateNetworks(const bool mandatory_network_balance, DeferredLogger& deferred_logger, const bool relax_network_tolerance = false);
284
285
286 void updateAndCommunicate(const int reportStepIdx,
287 const int iterationIdx,
288 DeferredLogger& deferred_logger);
289
290 bool updateGroupControls(const Group& group,
291 DeferredLogger& deferred_logger,
292 const int reportStepIdx,
293 const int iterationIdx);
294
295 const WellInterface<TypeTag>& getWell(const std::string& well_name) const;
296
297 using PressureMatrix = Dune::BCRSMatrix<Opm::MatrixBlock<Scalar, 1, 1>>;
298
300 const BVector& weights,
301 const bool use_well_weights) const;
304 const BVector& weights,
305 const bool use_well_weights,
306 const int domainIndex) const
307 {
308 if (!nldd_) {
309 OPM_THROW(std::logic_error, "Attempt to access NLDD data without a NLDD solver");
310 }
311 return nldd_->addWellPressureEquations(jacobian,
312 weights,
313 use_well_weights,
314 domainIndex);
315 }
316
318 const std::vector<WellInterfacePtr>& localNonshutWells() const
319 {
320 return well_container_;
321 }
322
324 {
325 if (!nldd_) {
326 OPM_THROW(std::logic_error, "Attempt to access NLDD data without a NLDD solver");
327 }
328 return nldd_->well_local_cells();
329 }
330
331 const std::map<std::string, int>& well_domain() const
332 {
333 if (!nldd_) {
334 OPM_THROW(std::logic_error, "Attempt to access NLDD data without a NLDD solver");
335 }
336
337 return nldd_->well_domain();
338 }
339
340 auto begin() const { return well_container_.begin(); }
341 auto end() const { return well_container_.end(); }
342 bool empty() const { return well_container_.empty(); }
343
346
349
350 int compressedIndexForInterior(int cartesian_cell_idx) const override
351 {
352 return simulator_.vanguard().compressedIndexForInterior(cartesian_cell_idx);
353 }
354
355 int compressedIndexForInteriorLGR(const std::string& lgr_tag, const Connection& conn) const override
356 {
357 return simulator_.vanguard().compressedIndexForInteriorLGR(lgr_tag, conn);
358 }
359
360 // using the solution x to recover the solution xw for wells and applying
361 // xw to update Well State
363
364 // using the solution x to recover the solution xw for wells and applying
365 // xw to update Well State
367 const int domainIdx);
368
369 const Grid& grid() const
370 { return simulator_.vanguard().grid(); }
371
372 const Simulator& simulator() const
373 { return simulator_; }
374
376 { nldd_ = mod; }
377
378#ifdef RESERVOIR_COUPLING_ENABLED
380 return *(this->simulator_.reservoirCouplingMaster());
381 }
383 return *(this->simulator_.reservoirCouplingSlave());
384 }
386 return this->simulator_.reservoirCouplingMaster() != nullptr;
387 }
389 return this->simulator_.reservoirCouplingSlave() != nullptr;
390 }
392 {
393 this->guide_rate_handler_.setReservoirCouplingMaster(master);
394 }
396 {
397 this->guide_rate_handler_.setReservoirCouplingSlave(slave);
398 }
399 #endif
400 protected:
402
403 // a vector of all the wells.
404 std::vector<WellInterfacePtr> well_container_{};
405
406 std::vector<bool> is_cell_perforated_{};
407
408 void initializeWellState(const int timeStepIdx);
409
410 // create the well container
411 void createWellContainer(const int report_step) override;
412
414 createWellPointer(const int wellID,
415 const int report_step) const;
416
417 template <typename WellType>
418 std::unique_ptr<WellType>
419 createTypedWellPointer(const int wellID,
420 const int time_step) const;
421
422 WellInterfacePtr createWellForWellTest(const std::string& well_name,
423 const int report_step,
424 DeferredLogger& deferred_logger) const;
425
427 std::size_t global_num_cells_{};
428 // the number of the cells in the local grid
429 std::size_t local_num_cells_{};
431 std::vector<Scalar> depth_{};
433 std::map<std::string, Scalar> well_group_thp_calc_;
434 std::unique_ptr<RateConverterType> rateConverter_{};
435 std::map<std::string, std::unique_ptr<AverageRegionalPressureType>> regionalAveragePressureCalculator_{};
436
439
440 // A flag to tell the convergence report whether we need to take another newton step
442
443 // Pre-step network solve at static reservoir conditions (group and well states might be updated)
444 void doPreStepNetworkRebalance(DeferredLogger& deferred_logger);
445
446 std::vector<Scalar> B_avg_{};
447
448 const EquilGrid& equilGrid() const
449 { return simulator_.vanguard().equilGrid(); }
450
451 const EclipseState& eclState() const
452 { return simulator_.vanguard().eclState(); }
453
454 // compute the well fluxes and assemble them in to the reservoir equations as source terms
455 // and in the well equations.
456 void assemble(const int iterationIdx,
457 const double dt);
458
459 // well controls and network pressures affect each other and are solved in an iterative manner.
460 // the function handles one iteration of updating well controls and network pressures.
461 // it is possible to decouple the update of well controls and network pressures further.
462 // the returned two booleans are {continue_due_to_network, well_group_control_changed}, respectively
463 std::tuple<bool, bool, Scalar> updateWellControlsAndNetworkIteration(const bool mandatory_network_balance,
464 const bool relax_network_tolerance,
465 const bool optimize_gas_lift,
466 const double dt,
467 DeferredLogger& local_deferredLogger);
468
469 bool updateWellControlsAndNetwork(const bool mandatory_network_balance,
470 const double dt,
471 DeferredLogger& local_deferredLogger);
472
473 bool computeWellGroupThp(const double dt, DeferredLogger& local_deferredLogger);
474
483 void initializeLocalWellStructure(const int reportStepIdx,
484 const bool enableWellPIScaling);
485
489 void initializeGroupStructure(const int reportStepIdx);
490
491 // called at the end of a time step
492 void timeStepSucceeded(const double simulationTime, const double dt);
493
494 // called at the end of a report step
495 void endReportStep();
496
497 // setting the well_solutions_ based on well_state.
498 void updatePrimaryVariables(DeferredLogger& deferred_logger);
499
501
502 void computePotentials(const std::size_t widx,
503 const WellState<Scalar, IndexTraits>& well_state_copy,
504 std::string& exc_msg,
505 ExceptionType::ExcEnum& exc_type,
506 DeferredLogger& deferred_logger) override;
507
508 const std::vector<Scalar>& wellPerfEfficiencyFactors() const;
509
510 void calculateProductivityIndexValuesShutWells(const int reportStepIdx, DeferredLogger& deferred_logger) override;
511 void calculateProductivityIndexValues(DeferredLogger& deferred_logger) override;
513 DeferredLogger& deferred_logger);
514
515 // The number of conservation quantities.
516 int numConservationQuantities() const;
517
518 int reportStepIndex() const;
519
520 void assembleWellEq(const double dt, DeferredLogger& deferred_logger);
521
522 void prepareWellsBeforeAssembling(const double dt, DeferredLogger& deferred_logger);
523
524 // TODO: finding a better naming
525 void assembleWellEqWithoutIteration(const double dt, DeferredLogger& deferred_logger);
526
528
529 void extractLegacyDepth_();
530
532 void updateWellTestState(const double simulationTime, WellTestState& wellTestState);
533
534 void wellTesting(const int timeStepIdx, const double simulationTime, DeferredLogger& deferred_logger);
535
536 void calcResvCoeff(const int fipnum,
537 const int pvtreg,
538 const std::vector<Scalar>& production_rates,
539 std::vector<Scalar>& resv_coeff) override;
540
541 void calcInjResvCoeff(const int fipnum,
542 const int pvtreg,
543 std::vector<Scalar>& resv_coeff) override;
544
546
547 private:
549 BlackoilWellModelNldd<TypeTag>* nldd_ = nullptr;
550
551 // These members are used to avoid reallocation in specific functions
552 // instead of using local variables.
553 // Their state is not relevant between function calls, so they can
554 // (and must) be mutable, as the functions using them are const.
555 mutable BVector x_local_;
556
557 // Store cell rates after assembling to avoid iterating all wells and connections for every element
558 std::map<int, RateVector> cellRates_;
559
560 void assignWellTracerRates(data::Wells& wsrpt) const;
561 };
562
563} // namespace Opm
564
566
567#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:95
BlackoilWellModelWBP< GetPropType< TypeTag, Properties::Scalar >, GetPropType< TypeTag, Properties::FluidSystem >::IndexTraitsType > wbp_
Definition: BlackoilWellModelGeneric.hpp:530
const WellState< GetPropType< TypeTag, Properties::Scalar >, GetPropType< TypeTag, Properties::FluidSystem >::IndexTraitsType > & wellState() const
Definition: BlackoilWellModelGeneric.hpp:152
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 model in a NLDD solver.
Definition: BlackoilWellModelNldd.hpp:80
Class for handling the blackoil well model.
Definition: BlackoilWellModel.hpp:102
void setReservoirCouplingSlave(ReservoirCouplingSlave *slave)
Definition: BlackoilWellModel.hpp:395
void initializeGroupStructure(const int reportStepIdx)
Definition: BlackoilWellModel_impl.hpp:292
bool network_needs_more_balancing_force_another_newton_iteration_
Definition: BlackoilWellModel.hpp:441
void endTimeStep()
Definition: BlackoilWellModel.hpp:169
void prepareTimeStep(DeferredLogger &deferred_logger)
Definition: BlackoilWellModel_impl.hpp:2177
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:1256
bool updateGroupControls(const Group &group, DeferredLogger &deferred_logger, const int reportStepIdx, const int iterationIdx)
Definition: BlackoilWellModel_impl.hpp:1957
WellInterfacePtr createWellPointer(const int wellID, const int report_step) const
Definition: BlackoilWellModel_impl.hpp:1022
GuideRateHandler< Scalar, IndexTraits > guide_rate_handler_
Definition: BlackoilWellModel.hpp:438
const EclipseState & eclState() const
Definition: BlackoilWellModel.hpp:451
void calcInjResvCoeff(const int fipnum, const int pvtreg, std::vector< Scalar > &resv_coeff) override
Definition: BlackoilWellModel_impl.hpp:2367
const std::vector< WellInterfacePtr > & localNonshutWells() const
Get list of local nonshut wells.
Definition: BlackoilWellModel.hpp:318
void prepareDeserialize(const int report_step)
Definition: BlackoilWellModel.hpp:203
void init()
Definition: BlackoilWellModel_impl.hpp:158
void setNlddAdapter(BlackoilWellModelNldd< TypeTag > *mod)
Definition: BlackoilWellModel.hpp:375
void calcResvCoeff(const int fipnum, const int pvtreg, const std::vector< Scalar > &production_rates, std::vector< Scalar > &resv_coeff) override
Definition: BlackoilWellModel_impl.hpp:2356
const Simulator & simulator() const
Definition: BlackoilWellModel.hpp:372
std::vector< Scalar > depth_
Definition: BlackoilWellModel.hpp:431
void updateAndCommunicate(const int reportStepIdx, const int iterationIdx, DeferredLogger &deferred_logger)
Definition: BlackoilWellModel_impl.hpp:1920
std::size_t global_num_cells_
Definition: BlackoilWellModel.hpp:427
std::map< std::string, Scalar > well_group_thp_calc_
Definition: BlackoilWellModel.hpp:433
void doPreStepNetworkRebalance(DeferredLogger &deferred_logger)
Definition: BlackoilWellModel_impl.hpp:1098
GetPropType< TypeTag, Properties::Scalar > Scalar
Definition: BlackoilWellModel.hpp:111
SimulatorReportSingle last_report_
Definition: BlackoilWellModel.hpp:437
static const int solventSaturationIdx
Definition: BlackoilWellModel.hpp:124
Scalar gravity_
Definition: BlackoilWellModel.hpp:430
void initWellContainer(const int reportStepIdx) override
Definition: BlackoilWellModel_impl.hpp:177
void beginReportStep(const int time_step)
Definition: BlackoilWellModel_impl.hpp:194
const WellInterface< TypeTag > & getWell(const std::string &well_name) const
Definition: BlackoilWellModel_impl.hpp:2327
GetPropType< TypeTag, Properties::FluidSystem > FluidSystem
Definition: BlackoilWellModel.hpp:107
void beginIteration()
Definition: BlackoilWellModel.hpp:159
bool isReservoirCouplingMaster() const
Definition: BlackoilWellModel.hpp:385
Dune::FieldVector< Scalar, numEq > VectorBlockType
Definition: BlackoilWellModel.hpp:132
void initFromRestartFile(const RestartValue &restartValues)
Definition: BlackoilWellModel.hpp:193
const ModelParameters param_
Definition: BlackoilWellModel.hpp:426
void beginEpisode()
Definition: BlackoilWellModel.hpp:151
GetPropType< TypeTag, Properties::ElementContext > ElementContext
Definition: BlackoilWellModel.hpp:108
GetPropType< TypeTag, Properties::Grid > Grid
Definition: BlackoilWellModel.hpp:105
GetPropType< TypeTag, Properties::EquilGrid > EquilGrid
Definition: BlackoilWellModel.hpp:106
int numConservationQuantities() const
Definition: BlackoilWellModel_impl.hpp:2299
void assembleWellEq(const double dt, DeferredLogger &deferred_logger)
Definition: BlackoilWellModel_impl.hpp:1509
const std::map< std::string, int > & well_domain() const
Definition: BlackoilWellModel.hpp:331
void setReservoirCouplingMaster(ReservoirCouplingMaster *master)
Definition: BlackoilWellModel.hpp:391
bool updateWellControls(DeferredLogger &deferred_logger)
Definition: BlackoilWellModel_impl.hpp:1782
void endIteration()
Definition: BlackoilWellModel.hpp:166
static constexpr bool has_polymer_
Definition: BlackoilWellModel.hpp:126
int reportStepIndex() const
Definition: BlackoilWellModel_impl.hpp:2344
void calculateProductivityIndexValues(DeferredLogger &deferred_logger) override
Definition: BlackoilWellModel_impl.hpp:2119
void extractLegacyDepth_()
Definition: BlackoilWellModel_impl.hpp:2315
void extractLegacyCellPvtRegionIndex_()
Definition: BlackoilWellModel_impl.hpp:2283
void recoverWellSolutionAndUpdateWellStateDomain(const BVector &x, const int domainIdx)
Definition: BlackoilWellModel_impl.hpp:1702
void updateAverageFormationFactor()
Definition: BlackoilWellModel_impl.hpp:2226
GetPropType< TypeTag, Properties::Simulator > Simulator
Definition: BlackoilWellModel.hpp:110
bool isReservoirCouplingSlave() const
Definition: BlackoilWellModel.hpp:388
void initializeWellState(const int timeStepIdx)
Definition: BlackoilWellModel_impl.hpp:748
void assemble(const int iterationIdx, const double dt)
Definition: BlackoilWellModel_impl.hpp:1128
const Grid & grid() const
Definition: BlackoilWellModel.hpp:369
void computeWellTemperature()
Definition: BlackoilWellModel_impl.hpp:2378
static const int numEq
Definition: BlackoilWellModel.hpp:123
void addWellPressureEquations(PressureMatrix &jacobian, const BVector &weights, const bool use_well_weights) const
Definition: BlackoilWellModel_impl.hpp:1602
const SimulatorReportSingle & lastReport() const
Definition: BlackoilWellModel_impl.hpp:624
bool updateWellControlsAndNetwork(const bool mandatory_network_balance, const double dt, DeferredLogger &local_deferredLogger)
Definition: BlackoilWellModel_impl.hpp:1197
void endEpisode()
Definition: BlackoilWellModel.hpp:175
GetPropType< TypeTag, Properties::SparseMatrixAdapter > SparseMatrixAdapter
Definition: BlackoilWellModel.hpp:114
void addWellContributions(SparseMatrixAdapter &jacobian) const
Definition: BlackoilWellModel_impl.hpp:1592
const EquilGrid & equilGrid() const
Definition: BlackoilWellModel.hpp:448
std::tuple< bool, Scalar > updateNetworks(const bool mandatory_network_balance, DeferredLogger &deferred_logger, const bool relax_network_tolerance=false)
Definition: BlackoilWellModel_impl.hpp:1863
WellInterfacePtr createWellForWellTest(const std::string &well_name, const int report_step, DeferredLogger &deferred_logger) const
Definition: BlackoilWellModel_impl.hpp:1073
GetPropType< TypeTag, Properties::Indices > Indices
Definition: BlackoilWellModel.hpp:109
int compressedIndexForInteriorLGR(const std::string &lgr_tag, const Connection &conn) const override
Definition: BlackoilWellModel.hpp:355
void assembleWellEqWithoutIteration(const double dt, DeferredLogger &deferred_logger)
Definition: BlackoilWellModel_impl.hpp:1535
std::vector< WellInterfacePtr > well_container_
Definition: BlackoilWellModel.hpp:404
static constexpr std::size_t pressureVarIndex
Definition: BlackoilWellModel.hpp:121
Dune::BCRSMatrix< Opm::MatrixBlock< Scalar, 1, 1 > > PressureMatrix
Definition: BlackoilWellModel.hpp:297
bool empty() const
Definition: BlackoilWellModel.hpp:342
void computeTotalRatesForDof(RateVector &rate, unsigned globalIdx) const
Definition: BlackoilWellModel_impl.hpp:711
bool addMatrixContributions() const
Definition: BlackoilWellModel.hpp:344
void beginTimeStep()
Definition: BlackoilWellModel_impl.hpp:328
std::vector< Scalar > B_avg_
Definition: BlackoilWellModel.hpp:446
const std::vector< Scalar > & wellPerfEfficiencyFactors() const
GetPropType< TypeTag, Properties::RateVector > RateVector
Definition: BlackoilWellModel.hpp:112
void calculateExplicitQuantities(DeferredLogger &deferred_logger) const
Definition: BlackoilWellModel_impl.hpp:1767
std::map< std::string, std::unique_ptr< AverageRegionalPressureType > > regionalAveragePressureCalculator_
Definition: BlackoilWellModel.hpp:435
void updatePrimaryVariables(DeferredLogger &deferred_logger)
Definition: BlackoilWellModel_impl.hpp:2274
bool computeWellGroupThp(const double dt, DeferredLogger &local_deferredLogger)
Definition: BlackoilWellModel_impl.hpp:1323
GetPropType< TypeTag, Properties::GlobalEqVector > GlobalEqVector
Definition: BlackoilWellModel.hpp:113
void initializeLocalWellStructure(const int reportStepIdx, const bool enableWellPIScaling)
Definition: BlackoilWellModel_impl.hpp:247
static constexpr bool has_solvent_
Definition: BlackoilWellModel.hpp:125
Dune::BlockVector< VectorBlockType > BVector
Definition: BlackoilWellModel.hpp:133
static constexpr bool has_micp_
Definition: BlackoilWellModel.hpp:128
std::unique_ptr< RateConverterType > rateConverter_
Definition: BlackoilWellModel.hpp:434
BlackoilWellModel(Simulator &simulator)
Definition: BlackoilWellModel_impl.hpp:73
const SparseTable< int > & well_local_cells() const
Definition: BlackoilWellModel.hpp:323
void wellTesting(const int timeStepIdx, const double simulationTime, DeferredLogger &deferred_logger)
Definition: BlackoilWellModel_impl.hpp:536
std::vector< bool > is_cell_perforated_
Definition: BlackoilWellModel.hpp:406
ConvergenceReport getWellConvergence(const std::vector< Scalar > &B_avg, const bool checkWellGroupControlsAndNetwork=false) const
Definition: BlackoilWellModel_impl.hpp:1715
int numStrictIterations() const
Definition: BlackoilWellModel.hpp:347
typename FluidSystem::IndexTraitsType IndexTraits
Definition: BlackoilWellModel.hpp:118
data::WellBlockAveragePressures wellBlockAveragePressures() const
Definition: BlackoilWellModel.hpp:245
auto begin() const
Definition: BlackoilWellModel.hpp:340
std::size_t local_num_cells_
Definition: BlackoilWellModel.hpp:429
auto end() const
Definition: BlackoilWellModel.hpp:341
bool alternative_well_rate_init_
Definition: BlackoilWellModel.hpp:432
void timeStepSucceeded(const double simulationTime, const double dt)
Definition: BlackoilWellModel_impl.hpp:634
std::unique_ptr< WellType > createTypedWellPointer(const int wellID, const int time_step) const
Definition: BlackoilWellModel_impl.hpp:1042
ReservoirCouplingMaster & reservoirCouplingMaster()
Definition: BlackoilWellModel.hpp:379
Simulator & simulator_
Definition: BlackoilWellModel.hpp:401
void createWellContainer(const int report_step) override
Definition: BlackoilWellModel_impl.hpp:791
std::unique_ptr< WellInterface< TypeTag > > WellInterfacePtr
Definition: BlackoilWellModel.hpp:190
data::Wells wellData() const
Definition: BlackoilWellModel.hpp:210
ReservoirCouplingSlave & reservoirCouplingSlave()
Definition: BlackoilWellModel.hpp:382
void updateWellTestState(const double simulationTime, WellTestState &wellTestState)
upate the wellTestState related to economic limits
Definition: BlackoilWellModel_impl.hpp:2002
void addWellPressureEquationsDomain(PressureMatrix &jacobian, const BVector &weights, const bool use_well_weights, const int domainIndex) const
Definition: BlackoilWellModel.hpp:303
void addReservoirSourceTerms(GlobalEqVector &residual, const std::vector< typename SparseMatrixAdapter::MatrixBlock * > &diagMatAddress) const
Definition: BlackoilWellModel_impl.hpp:1624
int compressedIndexForInterior(int cartesian_cell_idx) const override
get compressed index for interior cells (-1, otherwise
Definition: BlackoilWellModel.hpp:350
static constexpr bool has_energy_
Definition: BlackoilWellModel.hpp:127
void recoverWellSolutionAndUpdateWellState(const BVector &x)
Definition: BlackoilWellModel_impl.hpp:1677
void addWellPressureEquationsStruct(PressureMatrix &jacobian) const
Definition: BlackoilWellModel_impl.hpp:1654
void calculateProductivityIndexValuesShutWells(const int reportStepIdx, DeferredLogger &deferred_logger) override
Definition: BlackoilWellModel_impl.hpp:2133
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:2083
void endReportStep()
Definition: BlackoilWellModel_impl.hpp:607
void prepareWellsBeforeAssembling(const double dt, DeferredLogger &deferred_logger)
Definition: BlackoilWellModel_impl.hpp:1521
data::WellBlockAveragePressures computeWellBlockAveragePressures(const Scalar gravity) const
Definition: ConvergenceReport.hpp:38
Definition: DeferredLogger.hpp:57
Handles computation and reporting of guide rates for wells and groups.
Definition: GuideRateHandler.hpp:53
Definition: RateConverter.hpp:70
Definition: RegionAverageCalculator.hpp:60
Definition: ReservoirCouplingMaster.hpp:35
Definition: ReservoirCouplingSlave.hpp:35
Definition: BlackoilWellModel.hpp:91
Definition: WellConnectionAuxiliaryModule.hpp:39
Definition: WellContributions.hpp:51
Definition: WellGroupHelper.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:180
bool matrix_add_well_contributions_
Whether to add influences of wells between cells to the matrix and preconditioner matrix.
Definition: BlackoilModelParameters.hpp:286
bool use_multisegment_well_
Definition: BlackoilModelParameters.hpp:280
int strict_outer_iter_wells_
Newton iteration where wells are stricly convergent.
Definition: BlackoilModelParameters.hpp:236
A struct for returning timing data from a simulator to its caller.
Definition: SimulatorReport.hpp:34