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
24#ifndef OPM_BLACKOILWELLMODEL_HEADER_INCLUDED
25#define OPM_BLACKOILWELLMODEL_HEADER_INCLUDED
26
27#include <opm/common/OpmLog/OpmLog.hpp>
28
29#include <cstddef>
30#include <map>
31#include <memory>
32#include <optional>
33#include <string>
34#include <vector>
35
36#include <opm/input/eclipse/Schedule/Group/Group.hpp>
37#include <opm/input/eclipse/Schedule/Group/GuideRate.hpp>
38#include <opm/input/eclipse/Schedule/Schedule.hpp>
39#include <opm/input/eclipse/Schedule/Well/WellTestState.hpp>
40
42
46
48
69
72
73#include <dune/common/fmatrix.hh>
74#include <dune/istl/bcrsmatrix.hh>
75#include <dune/istl/matrixmatrix.hh>
76
77#include <opm/material/densead/Math.hpp>
78
80
81namespace Opm::Parameters {
82
83struct EnableTerminalOutput { static constexpr bool value = true; };
84
85} // namespace Opm::Parameters
86
87namespace Opm {
88
89#if COMPILE_BDA_BRIDGE
90template<class Scalar> class WellContributions;
91#endif
92
94 template<typename TypeTag>
95 class BlackoilWellModel : public BaseAuxiliaryModule<TypeTag>
96 , public BlackoilWellModelGeneric<GetPropType<TypeTag,
97 Properties::Scalar>>
98 {
99 public:
100 // --------- Types ---------
118
120
123
124 static const int numEq = Indices::numEq;
125 static const int solventSaturationIdx = Indices::solventSaturationIdx;
126 static constexpr bool has_solvent_ = getPropValue<TypeTag, Properties::EnableSolvent>();
127 static constexpr bool has_polymer_ = getPropValue<TypeTag, Properties::EnablePolymer>();
128 static constexpr bool has_energy_ = getPropValue<TypeTag, Properties::EnableEnergy>();
129 static constexpr bool has_micp_ = getPropValue<TypeTag, Properties::EnableMICP>();
130
131 // TODO: where we should put these types, WellInterface or Well Model?
132 // or there is some other strategy, like TypeTag
133 typedef Dune::FieldVector<Scalar, numEq > VectorBlockType;
134 typedef Dune::BlockVector<VectorBlockType> BVector;
135
138
139 // For the conversion between the surface volume rate and resrevoir voidage rate
140 using RateConverterType = RateConverter::
141 SurfaceToReservoirVoidage<FluidSystem, std::vector<int> >;
142
143 // For computing average pressured used by gpmaint
144 using AverageRegionalPressureType = RegionAverageCalculator::
145 AverageRegionalPressure<FluidSystem, std::vector<int> >;
146
148
149 BlackoilWellModel(Simulator& simulator);
150
151 void init();
152 void initWellContainer(const int reportStepIdx) override;
153
155 // <eWoms auxiliary module stuff>
157 unsigned numDofs() const override
158 // No extra dofs are inserted for wells. (we use a Schur complement.)
159 { return 0; }
160
161 void addNeighbors(std::vector<NeighborSet>& neighbors) const override;
162
163 void applyInitial() override
164 {}
165
166 void linearize(SparseMatrixAdapter& jacobian, GlobalEqVector& res) override;
167 void linearizeDomain(const Domain& domain, SparseMatrixAdapter& jacobian, GlobalEqVector& res);
168
169 void postSolve(GlobalEqVector& deltaX) override
170 {
172 }
173
174 void postSolveDomain(GlobalEqVector& deltaX, const Domain& domain)
175 {
177 }
178
180 // </ eWoms auxiliary module stuff>
182
183 template <class Restarter>
184 void deserialize(Restarter& /* res */)
185 {
186 // TODO (?)
187 }
188
193 template <class Restarter>
194 void serialize(Restarter& /* res*/)
195 {
196 // TODO (?)
197 }
198
200 {
201 OPM_TIMEBLOCK(beginEpsiode);
202 beginReportStep(simulator_.episodeIndex());
203 }
204
205 void beginTimeStep();
206
208 {
209 OPM_TIMEBLOCK(beginIteration);
210 assemble(simulator_.model().newtonMethod().numIterations(),
211 simulator_.timeStepSize());
212 }
213
215 { }
216
218 {
219 OPM_TIMEBLOCK(endTimeStep);
220 timeStepSucceeded(simulator_.time(), simulator_.timeStepSize());
221 }
222
224 {
226 }
227
229 unsigned globalIdx) const;
230
231 template <class Context>
233 const Context& context,
234 unsigned spaceIdx,
235 unsigned timeIdx) const;
236
237
238 using WellInterfacePtr = std::shared_ptr<WellInterface<TypeTag> >;
239
241 void initFromRestartFile(const RestartValue& restartValues)
242 {
243 initFromRestartFile(restartValues,
244 this->simulator_.vanguard().transferWTestState(),
245 grid().size(0),
247 }
248
250 void prepareDeserialize(const int report_step)
251 {
252 prepareDeserialize(report_step, grid().size(0),
254 }
255
256 data::Wells wellData() const
257 {
258 auto wsrpt = this->wellState()
259 .report(simulator_.vanguard().globalCell().data(),
260 [this](const int well_index) -> bool
261 {
262 return this->wasDynamicallyShutThisTimeStep(well_index);
263 });
264
265 {
266 const auto& tracerRates = this->simulator_.problem()
267 .tracerModel().getWellTracerRates();
268 const auto& freeTracerRates = simulator_.problem()
269 .tracerModel().getWellFreeTracerRates();
270 const auto& solTracerRates = simulator_.problem()
271 .tracerModel().getWellSolTracerRates();
272 const auto& mswTracerRates = simulator_.problem()
273 .tracerModel().getMswTracerRates();
274
275 this->assignWellTracerRates(wsrpt, tracerRates);
276 this->assignWellTracerRates(wsrpt, freeTracerRates);
277 this->assignWellTracerRates(wsrpt, solTracerRates);
278 this->assignMswTracerRates(wsrpt, mswTracerRates);
279 }
280
282 .assignWellGuideRates(wsrpt, this->reportStepIndex());
283
284 this->assignWellTargets(wsrpt);
285 this->assignShutConnections(wsrpt, this->reportStepIndex());
286 // only used to compute gas injection mass rates for CO2STORE runs
287 // The gas reference density is thus the same for all pvt regions
288 // We therefore for simplicity use 0 here
289 if (eclState().runspec().co2Storage()) {
290 this->assignMassGasRate(wsrpt, FluidSystem::referenceDensity(FluidSystem::gasPhaseIdx, 0));
291 }
292 return wsrpt;
293 }
294
295 data::WellBlockAveragePressures wellBlockAveragePressures() const
296 {
298 }
299
300 // subtract Binv(D)rw from r;
301 void apply( BVector& r) const;
302
303 // subtract B*inv(D)*C * x from A*x
304 void apply(const BVector& x, BVector& Ax) const;
305
306#if COMPILE_BDA_BRIDGE
307 // accumulate the contributions of all Wells in the WellContributions object
308 void getWellContributions(WellContributions<Scalar>& x) const;
309#endif
310
311 // apply well model with scaling of alpha
312 void applyScaleAdd(const Scalar alpha, const BVector& x, BVector& Ax) const;
313
314 // Check if well equations is converged.
315 ConvergenceReport getWellConvergence(const std::vector<Scalar>& B_avg, const bool checkWellGroupControls = false) const;
316
317 // Check if well equations are converged locally.
319 const std::vector<Scalar>& B_avg,
320 DeferredLogger& local_deferredLogger) const;
321
322 const SimulatorReportSingle& lastReport() const;
323
324 void addWellContributions(SparseMatrixAdapter& jacobian) const;
325
326 // add source from wells to the reservoir matrix
328 std::vector<typename SparseMatrixAdapter::MatrixBlock*>& diagMatAddress) const;
329
330 // called at the beginning of a report step
331 void beginReportStep(const int time_step);
332
333 // it should be able to go to prepareTimeStep(), however, the updateWellControls() and initPrimaryVariablesEvaluation()
334 // makes it a little more difficult. unless we introduce if (iterationIdx != 0) to avoid doing the above functions
335 // twice at the beginning of the time step
338 void calculateExplicitQuantities(DeferredLogger& deferred_logger) const;
339 // some preparation work, mostly related to group control and RESV,
340 // at the beginning of each time step (Not report step)
341 void prepareTimeStep(DeferredLogger& deferred_logger);
343 void initPrimaryVariablesEvaluationDomain(const Domain& domain) const;
344
345 std::pair<bool, bool>
346 updateWellControls(const bool mandatory_network_balance, DeferredLogger& deferred_logger, const bool relax_network_tolerance = false);
347
348 void updateAndCommunicate(const int reportStepIdx,
349 const int iterationIdx,
350 DeferredLogger& deferred_logger);
351
352 bool updateGroupControls(const Group& group,
353 DeferredLogger& deferred_logger,
354 const int reportStepIdx,
355 const int iterationIdx);
356
357 WellInterfacePtr getWell(const std::string& well_name) const;
358 bool hasWell(const std::string& well_name) const;
359
360 using PressureMatrix = Dune::BCRSMatrix<Opm::MatrixBlock<Scalar, 1, 1>>;
361
362 void addWellPressureEquations(PressureMatrix& jacobian, const BVector& weights,const bool use_well_weights) const;
363
365
366 void initGliftEclWellMap(GLiftEclWells &ecl_well_map);
367
369 const std::vector<WellInterfacePtr>& localNonshutWells() const
370 {
371 return well_container_;
372 }
373
374 // prototype for assemble function for ASPIN solveLocal()
375 // will try to merge back to assemble() when done prototyping
376 void assembleDomain(const int iterationIdx,
377 const double dt,
378 const Domain& domain);
379 void updateWellControlsDomain(DeferredLogger& deferred_logger, const Domain& domain);
380
381 void logPrimaryVars() const;
382 std::vector<Scalar> getPrimaryVarsDomain(const Domain& domain) const;
383 void setPrimaryVarsDomain(const Domain& domain, const std::vector<Scalar>& vars);
384
385 void setupDomains(const std::vector<Domain>& domains);
386
387 protected:
389
390 // a vector of all the wells.
391 std::vector<WellInterfacePtr> well_container_{};
392
393 std::vector<bool> is_cell_perforated_{};
394
395 void initializeWellState(const int timeStepIdx);
396
397 // create the well container
398 void createWellContainer(const int report_step) override;
399
401 createWellPointer(const int wellID,
402 const int report_step) const;
403
404 template <typename WellType>
405 std::unique_ptr<WellType>
406 createTypedWellPointer(const int wellID,
407 const int time_step) const;
408
409 WellInterfacePtr createWellForWellTest(const std::string& well_name, const int report_step, DeferredLogger& deferred_logger) const;
410
411
413 std::size_t global_num_cells_{};
414 // the number of the cells in the local grid
415 std::size_t local_num_cells_{};
417 std::vector<Scalar> depth_{};
419 std::map<std::string, Scalar> well_group_thp_calc_;
420 std::unique_ptr<RateConverterType> rateConverter_{};
421 std::map<std::string, std::unique_ptr<AverageRegionalPressureType>> regionalAveragePressureCalculator_{};
422
424 {
425 std::optional<typename std::vector<WellInterfacePtr>::size_type> openWellIdx_{};
426 std::size_t wbpCalcIdx_{};
427 };
428
429 std::vector<WBPCalcID> wbpCalcMap_{};
430
432
433 // Pre-step network solve at static reservoir conditions (group and well states might be updated)
434 void doPreStepNetworkRebalance(DeferredLogger& deferred_logger);
435
436 // used to better efficiency of calcuation
438
439 std::vector<Scalar> B_avg_{};
440
441 // Keep track of the domain of each well, if using subdomains.
442 std::map<std::string, int> well_domain_;
443
444 const Grid& grid() const
445 { return simulator_.vanguard().grid(); }
446
447 const EquilGrid& equilGrid() const
448 { return simulator_.vanguard().equilGrid(); }
449
450 const EclipseState& eclState() const
451 { return simulator_.vanguard().eclState(); }
452
453 // compute the well fluxes and assemble them in to the reservoir equations as source terms
454 // and in the well equations.
455 void assemble(const int iterationIdx,
456 const double dt);
457
458 // well controls and network pressures affect each other and are solved in an iterative manner.
459 // the function handles one iteration of updating well controls and network pressures.
460 // it is possible to decouple the update of well controls and network pressures further.
461 // the returned two booleans are {continue_due_to_network, well_group_control_changed}, respectively
462 std::pair<bool, bool> updateWellControlsAndNetworkIteration(const bool mandatory_network_balance,
463 const bool relax_network_tolerance,
464 const double dt,
465 DeferredLogger& local_deferredLogger);
466
467 bool updateWellControlsAndNetwork(const bool mandatory_network_balance,
468 const double dt,
469 DeferredLogger& local_deferredLogger);
470
471 void computeWellGroupThp(const double dt, DeferredLogger& local_deferredLogger);
472
481 void initializeLocalWellStructure(const int reportStepIdx,
482 const bool enableWellPIScaling);
483
487 void initializeGroupStructure(const int reportStepIdx);
488
489 // called at the end of a time step
490 void timeStepSucceeded(const double simulationTime, const double dt);
491
492 // called at the end of a report step
493 void endReportStep();
494
495 // using the solution x to recover the solution xw for wells and applying
496 // xw to update Well State
498
499 // using the solution x to recover the solution xw for wells and applying
500 // xw to update Well State
501 void recoverWellSolutionAndUpdateWellStateDomain(const BVector& x, const Domain& domain);
502
503 // setting the well_solutions_ based on well_state.
504 void updatePrimaryVariables(DeferredLogger& deferred_logger);
505
507
508 data::WellBlockAveragePressures
510
512 makeWellSourceEvaluatorFactory(const std::vector<Well>::size_type wellIdx) const;
513
515
517
518 void computePotentials(const std::size_t widx,
519 const WellState<Scalar>& well_state_copy,
520 std::string& exc_msg,
521 ExceptionType::ExcEnum& exc_type,
522 DeferredLogger& deferred_logger) override;
523
524 const std::vector<Scalar>& wellPerfEfficiencyFactors() const;
525
526 void calculateProductivityIndexValuesShutWells(const int reportStepIdx, DeferredLogger& deferred_logger) override;
527 void calculateProductivityIndexValues(DeferredLogger& deferred_logger) override;
529 DeferredLogger& deferred_logger);
530
531 // The number of components in the model.
532 int numComponents() const;
533
534 int reportStepIndex() const;
535
536 void assembleWellEq(const double dt, DeferredLogger& deferred_logger);
537 void assembleWellEqDomain(const double dt, const Domain& domain, DeferredLogger& deferred_logger);
538
539 void prepareWellsBeforeAssembling(const double dt, DeferredLogger& deferred_logger);
540
541 // TODO: finding a better naming
542 void assembleWellEqWithoutIteration(const double dt, DeferredLogger& deferred_logger);
543
544 bool maybeDoGasLiftOptimize(DeferredLogger& deferred_logger);
545
546 void gasLiftOptimizationStage1(DeferredLogger& deferred_logger,
547 GLiftProdWells& prod_wells,
548 GLiftOptWells& glift_wells,
549 GasLiftGroupInfo<Scalar>& group_info,
550 GLiftWellStateMap& state_map);
551
552 // cannot be const since it accesses the non-const WellState
554 DeferredLogger& deferred_logger,
555 GLiftProdWells& prod_wells,
556 GLiftOptWells& glift_wells,
557 GasLiftGroupInfo<Scalar>& group_info,
558 GLiftWellStateMap& state_map,
559 GLiftSyncGroups& groups_to_sync);
560
562
563 void extractLegacyDepth_();
564
566 void updateWellTestState(const double& simulationTime, WellTestState& wellTestState) const;
567
568 void wellTesting(const int timeStepIdx, const double simulationTime, DeferredLogger& deferred_logger);
569
570 void calcResvCoeff(const int fipnum,
571 const int pvtreg,
572 const std::vector<Scalar>& production_rates,
573 std::vector<Scalar>& resv_coeff) override;
574
575 void calcInjResvCoeff(const int fipnum,
576 const int pvtreg,
577 std::vector<Scalar>& resv_coeff) override;
578
580
581 int compressedIndexForInterior(int cartesian_cell_idx) const override {
582 return simulator_.vanguard().compressedIndexForInterior(cartesian_cell_idx);
583 }
584
585 private:
586 BlackoilWellModel(Simulator& simulator, const PhaseUsage& pu);
587 };
588
589
590} // namespace Opm
591
592#ifndef OPM_BLACKOILWELLMODEL_IMPL_HEADER_INCLUDED
594#endif
595
596#endif
Base class for specifying auxiliary equations.
Definition: baseauxiliarymodule.hh:56
std::set< unsigned > NeighborSet
Definition: baseauxiliarymodule.hh:63
Contains the high level supplements required to extend the black oil model by MICP.
Definition: blackoilmicpmodules.hh:49
Contains the high level supplements required to extend the black oil model by polymer.
Definition: blackoilpolymermodules.hh:54
Class for handling the blackoil well model.
Definition: BlackoilWellModelGeneric.hpp:83
std::map< std::string, const WellInterfaceGeneric< Scalar > * > GLiftProdWells
Definition: BlackoilWellModelGeneric.hpp:87
void assignWellTracerRates(data::Wells &wsrpt, const WellTracerRates &wellTracerRates) const
void assignShutConnections(data::Wells &wsrpt, const int reportStepIndex) const
const WellState< GetPropType< TypeTag, Properties::Scalar > > & wellState() const
Definition: BlackoilWellModelGeneric.hpp:124
void assignMassGasRate(data::Wells &wsrpt, const GetPropType< TypeTag, Properties::Scalar > &gasDensity) const
std::map< std::string, std::unique_ptr< GasLiftSingleWellGeneric< Scalar > > > GLiftOptWells
Definition: BlackoilWellModelGeneric.hpp:86
std::map< std::string, std::unique_ptr< GasLiftWellState< Scalar > > > GLiftWellStateMap
Definition: BlackoilWellModelGeneric.hpp:88
WellTestState & wellTestState()
Definition: BlackoilWellModelGeneric.hpp:147
void assignMswTracerRates(data::Wells &wsrpt, const MswTracerRates &mswTracerRates) const
Class for handling the guide rates in the blackoil well model.
Definition: BlackoilWellModelGuideRates.hpp:46
void assignWellGuideRates(data::Wells &wsrpt, const int reportStepIdx) const
Assign well guide rates.
Class for handling the blackoil well model.
Definition: BlackoilWellModel.hpp:98
void initializeGroupStructure(const int reportStepIdx)
Definition: BlackoilWellModel_impl.hpp:371
void apply(BVector &r) const
Definition: BlackoilWellModel_impl.hpp:1713
void endTimeStep()
Definition: BlackoilWellModel.hpp:217
SubDomain< Grid > Domain
Definition: BlackoilWellModel.hpp:147
void prepareTimeStep(DeferredLogger &deferred_logger)
Definition: BlackoilWellModel_impl.hpp:2509
bool updateGroupControls(const Group &group, DeferredLogger &deferred_logger, const int reportStepIdx, const int iterationIdx)
Definition: BlackoilWellModel_impl.hpp:2337
void serialize(Restarter &)
This method writes the complete state of the well to the harddisk.
Definition: BlackoilWellModel.hpp:194
BlackOilMICPModule< TypeTag > MICPModule
Definition: BlackoilWellModel.hpp:137
WellInterfacePtr createWellPointer(const int wellID, const int report_step) const
Definition: BlackoilWellModel_impl.hpp:1013
const EclipseState & eclState() const
Definition: BlackoilWellModel.hpp:450
WellInterfacePtr getWell(const std::string &well_name) const
Definition: BlackoilWellModel_impl.hpp:2658
void calcInjResvCoeff(const int fipnum, const int pvtreg, std::vector< Scalar > &resv_coeff) override
Definition: BlackoilWellModel_impl.hpp:2713
BlackOilPolymerModule< TypeTag > PolymerModule
Definition: BlackoilWellModel.hpp:136
const std::vector< WellInterfacePtr > & localNonshutWells() const
Get list of local nonshut wells.
Definition: BlackoilWellModel.hpp:369
void prepareDeserialize(const int report_step)
Definition: BlackoilWellModel.hpp:250
void init()
Definition: BlackoilWellModel_impl.hpp:154
typename BlackoilWellModelGeneric< Scalar >::GLiftProdWells GLiftProdWells
Definition: BlackoilWellModel.hpp:113
void calcResvCoeff(const int fipnum, const int pvtreg, const std::vector< Scalar > &production_rates, std::vector< Scalar > &resv_coeff) override
Definition: BlackoilWellModel_impl.hpp:2702
std::vector< Scalar > depth_
Definition: BlackoilWellModel.hpp:417
void updateAndCommunicate(const int reportStepIdx, const int iterationIdx, DeferredLogger &deferred_logger)
Definition: BlackoilWellModel_impl.hpp:2315
std::size_t global_num_cells_
Definition: BlackoilWellModel.hpp:413
std::map< std::string, Scalar > well_group_thp_calc_
Definition: BlackoilWellModel.hpp:419
void doPreStepNetworkRebalance(DeferredLogger &deferred_logger)
Definition: BlackoilWellModel_impl.hpp:1091
GetPropType< TypeTag, Properties::Scalar > Scalar
Definition: BlackoilWellModel.hpp:107
SimulatorReportSingle last_report_
Definition: BlackoilWellModel.hpp:431
void postSolveDomain(GlobalEqVector &deltaX, const Domain &domain)
Definition: BlackoilWellModel.hpp:174
std::vector< Scalar > getPrimaryVarsDomain(const Domain &domain) const
Definition: BlackoilWellModel_impl.hpp:2805
static const int solventSaturationIdx
Definition: BlackoilWellModel.hpp:125
std::vector< WBPCalcID > wbpCalcMap_
Definition: BlackoilWellModel.hpp:429
Scalar gravity_
Definition: BlackoilWellModel.hpp:416
typename GasLiftGroupInfo< Scalar >::GLiftEclWells GLiftEclWells
Definition: BlackoilWellModel.hpp:116
void initWellContainer(const int reportStepIdx) override
Definition: BlackoilWellModel_impl.hpp:173
void addReservoirSourceTerms(GlobalEqVector &residual, std::vector< typename SparseMatrixAdapter::MatrixBlock * > &diagMatAddress) const
Definition: BlackoilWellModel_impl.hpp:1820
void beginReportStep(const int time_step)
Definition: BlackoilWellModel_impl.hpp:274
typename WellInterface< TypeTag >::GasLiftSingleWell GasLiftSingleWell
Definition: BlackoilWellModel.hpp:111
GetPropType< TypeTag, Properties::FluidSystem > FluidSystem
Definition: BlackoilWellModel.hpp:103
void beginIteration()
Definition: BlackoilWellModel.hpp:207
void assembleWellEqDomain(const double dt, const Domain &domain, DeferredLogger &deferred_logger)
Definition: BlackoilWellModel_impl.hpp:1670
BVector scaleAddRes_
Definition: BlackoilWellModel.hpp:437
void applyScaleAdd(const Scalar alpha, const BVector &x, BVector &Ax) const
Definition: BlackoilWellModel_impl.hpp:1774
void initFromRestartFile(const RestartValue &restartValues)
Definition: BlackoilWellModel.hpp:241
const ModelParameters param_
Definition: BlackoilWellModel.hpp:412
void beginEpisode()
Definition: BlackoilWellModel.hpp:199
GetPropType< TypeTag, Properties::ElementContext > ElementContext
Definition: BlackoilWellModel.hpp:104
GetPropType< TypeTag, Properties::Grid > Grid
Definition: BlackoilWellModel.hpp:101
void updateWellControlsDomain(DeferredLogger &deferred_logger, const Domain &domain)
Definition: BlackoilWellModel_impl.hpp:2146
GetPropType< TypeTag, Properties::EquilGrid > EquilGrid
Definition: BlackoilWellModel.hpp:102
void assembleWellEq(const double dt, DeferredLogger &deferred_logger)
Definition: BlackoilWellModel_impl.hpp:1659
void postSolve(GlobalEqVector &deltaX) override
This method is called after the linear solver has been called but before the solution is updated for ...
Definition: BlackoilWellModel.hpp:169
void gasLiftOptimizationStage1SingleWell(WellInterface< TypeTag > *well, DeferredLogger &deferred_logger, GLiftProdWells &prod_wells, GLiftOptWells &glift_wells, GasLiftGroupInfo< Scalar > &group_info, GLiftWellStateMap &state_map, GLiftSyncGroups &groups_to_sync)
Definition: BlackoilWellModel_impl.hpp:1619
void linearizeDomain(const Domain &domain, SparseMatrixAdapter &jacobian, GlobalEqVector &res)
Definition: BlackoilWellModel_impl.hpp:251
BaseAuxiliaryModule< TypeTag >::NeighborSet NeighborSet
Definition: BlackoilWellModel.hpp:122
void endIteration()
Definition: BlackoilWellModel.hpp:214
static constexpr bool has_polymer_
Definition: BlackoilWellModel.hpp:127
int reportStepIndex() const
Definition: BlackoilWellModel_impl.hpp:2690
void calculateProductivityIndexValues(DeferredLogger &deferred_logger) override
Definition: BlackoilWellModel_impl.hpp:2450
void extractLegacyDepth_()
Definition: BlackoilWellModel_impl.hpp:2646
void extractLegacyCellPvtRegionIndex_()
Definition: BlackoilWellModel_impl.hpp:2613
void updateAverageFormationFactor()
Definition: BlackoilWellModel_impl.hpp:2555
GetPropType< TypeTag, Properties::Simulator > Simulator
Definition: BlackoilWellModel.hpp:106
void initializeWellState(const int timeStepIdx)
Definition: BlackoilWellModel_impl.hpp:829
void assemble(const int iterationIdx, const double dt)
Definition: BlackoilWellModel_impl.hpp:1129
const Grid & grid() const
Definition: BlackoilWellModel.hpp:444
void computeWellTemperature()
Definition: BlackoilWellModel_impl.hpp:2724
static const int numEq
Definition: BlackoilWellModel.hpp:124
void addWellPressureEquations(PressureMatrix &jacobian, const BVector &weights, const bool use_well_weights) const
Definition: BlackoilWellModel_impl.hpp:1804
void logPrimaryVars() const
Definition: BlackoilWellModel_impl.hpp:2786
const SimulatorReportSingle & lastReport() const
Definition: BlackoilWellModel_impl.hpp:680
bool updateWellControlsAndNetwork(const bool mandatory_network_balance, const double dt, DeferredLogger &local_deferredLogger)
Definition: BlackoilWellModel_impl.hpp:1189
void endEpisode()
Definition: BlackoilWellModel.hpp:223
GetPropType< TypeTag, Properties::SparseMatrixAdapter > SparseMatrixAdapter
Definition: BlackoilWellModel.hpp:110
void addWellContributions(SparseMatrixAdapter &jacobian) const
Definition: BlackoilWellModel_impl.hpp:1794
const EquilGrid & equilGrid() const
Definition: BlackoilWellModel.hpp:447
WellInterfacePtr createWellForWellTest(const std::string &well_name, const int report_step, DeferredLogger &deferred_logger) const
Definition: BlackoilWellModel_impl.hpp:1064
std::map< std::string, int > well_domain_
Definition: BlackoilWellModel.hpp:442
void deserialize(Restarter &)
Definition: BlackoilWellModel.hpp:184
GetPropType< TypeTag, Properties::Indices > Indices
Definition: BlackoilWellModel.hpp:105
typename BlackoilWellModelGeneric< Scalar >::GLiftOptWells GLiftOptWells
Definition: BlackoilWellModel.hpp:112
void computePotentials(const std::size_t widx, const WellState< Scalar > &well_state_copy, std::string &exc_msg, ExceptionType::ExcEnum &exc_type, DeferredLogger &deferred_logger) override
Definition: BlackoilWellModel_impl.hpp:2415
std::pair< bool, bool > updateWellControls(const bool mandatory_network_balance, DeferredLogger &deferred_logger, const bool relax_network_tolerance=false)
Definition: BlackoilWellModel_impl.hpp:2055
void recoverWellSolutionAndUpdateWellStateDomain(const BVector &x, const Domain &domain)
Definition: BlackoilWellModel_impl.hpp:1891
void applyInitial() override
Set the initial condition of the auxiliary module in the solution vector.
Definition: BlackoilWellModel.hpp:163
typename GasLiftSingleWellGeneric< Scalar >::GLiftSyncGroups GLiftSyncGroups
Definition: BlackoilWellModel.hpp:117
void assembleDomain(const int iterationIdx, const double dt, const Domain &domain)
Definition: BlackoilWellModel_impl.hpp:1413
bool hasWell(const std::string &well_name) const
Definition: BlackoilWellModel_impl.hpp:2675
ParallelWBPCalculation< Scalar >::EvaluatorFactory makeWellSourceEvaluatorFactory(const std::vector< Well >::size_type wellIdx) const
Definition: BlackoilWellModel_impl.hpp:2243
void assembleWellEqWithoutIteration(const double dt, DeferredLogger &deferred_logger)
Definition: BlackoilWellModel_impl.hpp:1694
data::WellBlockAveragePressures computeWellBlockAveragePressures() const
Definition: BlackoilWellModel_impl.hpp:2197
std::vector< WellInterfacePtr > well_container_
Definition: BlackoilWellModel.hpp:391
static constexpr std::size_t pressureVarIndex
Definition: BlackoilWellModel.hpp:121
void initPrimaryVariablesEvaluation() const
Definition: BlackoilWellModel_impl.hpp:1915
Dune::BCRSMatrix< Opm::MatrixBlock< Scalar, 1, 1 > > PressureMatrix
Definition: BlackoilWellModel.hpp:360
void computeTotalRatesForDof(RateVector &rate, unsigned globalIdx) const
Definition: BlackoilWellModel_impl.hpp:792
void beginTimeStep()
Definition: BlackoilWellModel_impl.hpp:413
unsigned numDofs() const override
Returns the number of additional degrees of freedom required for the auxiliary module.
Definition: BlackoilWellModel.hpp:157
std::vector< Scalar > B_avg_
Definition: BlackoilWellModel.hpp:439
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:2040
std::map< std::string, std::unique_ptr< AverageRegionalPressureType > > regionalAveragePressureCalculator_
Definition: BlackoilWellModel.hpp:421
Dune::FieldVector< Scalar, numEq > VectorBlockType
Definition: BlackoilWellModel.hpp:133
void updatePrimaryVariables(DeferredLogger &deferred_logger)
Definition: BlackoilWellModel_impl.hpp:2604
GetPropType< TypeTag, Properties::GlobalEqVector > GlobalEqVector
Definition: BlackoilWellModel.hpp:109
void initializeLocalWellStructure(const int reportStepIdx, const bool enableWellPIScaling)
Definition: BlackoilWellModel_impl.hpp:326
static constexpr bool has_solvent_
Definition: BlackoilWellModel.hpp:126
std::pair< bool, bool > updateWellControlsAndNetworkIteration(const bool mandatory_network_balance, const bool relax_network_tolerance, const double dt, DeferredLogger &local_deferredLogger)
Definition: BlackoilWellModel_impl.hpp:1225
void addNeighbors(std::vector< NeighborSet > &neighbors) const override
Specify the additional neighboring correlations caused by the auxiliary module.
Definition: BlackoilWellModel_impl.hpp:189
static constexpr bool has_micp_
Definition: BlackoilWellModel.hpp:129
std::unique_ptr< RateConverterType > rateConverter_
Definition: BlackoilWellModel.hpp:420
BlackoilWellModel(Simulator &simulator)
Definition: BlackoilWellModel_impl.hpp:146
void wellTesting(const int timeStepIdx, const double simulationTime, DeferredLogger &deferred_logger)
Definition: BlackoilWellModel_impl.hpp:613
std::vector< bool > is_cell_perforated_
Definition: BlackoilWellModel.hpp:393
ConvergenceReport getWellConvergence(const std::vector< Scalar > &B_avg, const bool checkWellGroupControls=false) const
Definition: BlackoilWellModel_impl.hpp:1988
void registerOpenWellsForWBPCalculation()
Definition: BlackoilWellModel_impl.hpp:2294
void linearize(SparseMatrixAdapter &jacobian, GlobalEqVector &res) override
Linearize the auxiliary equation.
Definition: BlackoilWellModel_impl.hpp:230
data::WellBlockAveragePressures wellBlockAveragePressures() const
Definition: BlackoilWellModel.hpp:295
std::size_t local_num_cells_
Definition: BlackoilWellModel.hpp:415
void initGliftEclWellMap(GLiftEclWells &ecl_well_map)
Definition: BlackoilWellModel_impl.hpp:1647
void gasLiftOptimizationStage1(DeferredLogger &deferred_logger, GLiftProdWells &prod_wells, GLiftOptWells &glift_wells, GasLiftGroupInfo< Scalar > &group_info, GLiftWellStateMap &state_map)
Definition: BlackoilWellModel_impl.hpp:1511
bool alternative_well_rate_init_
Definition: BlackoilWellModel.hpp:418
void timeStepSucceeded(const double simulationTime, const double dt)
Definition: BlackoilWellModel_impl.hpp:690
std::unique_ptr< WellType > createTypedWellPointer(const int wellID, const int time_step) const
Definition: BlackoilWellModel_impl.hpp:1033
void setPrimaryVarsDomain(const Domain &domain, const std::vector< Scalar > &vars)
Definition: BlackoilWellModel_impl.hpp:2822
Simulator & simulator_
Definition: BlackoilWellModel.hpp:388
std::shared_ptr< WellInterface< TypeTag > > WellInterfacePtr
Definition: BlackoilWellModel.hpp:238
void createWellContainer(const int report_step) override
Definition: BlackoilWellModel_impl.hpp:872
Dune::BlockVector< VectorBlockType > BVector
Definition: BlackoilWellModel.hpp:134
bool maybeDoGasLiftOptimize(DeferredLogger &deferred_logger)
Definition: BlackoilWellModel_impl.hpp:1453
data::Wells wellData() const
Definition: BlackoilWellModel.hpp:256
void computeWellGroupThp(const double dt, DeferredLogger &local_deferredLogger)
Definition: BlackoilWellModel_impl.hpp:1278
void updateWellTestState(const double &simulationTime, WellTestState &wellTestState) const
upate the wellTestState related to economic limits
Definition: BlackoilWellModel_impl.hpp:2375
ConvergenceReport getDomainWellConvergence(const Domain &domain, const std::vector< Scalar > &B_avg, DeferredLogger &local_deferredLogger) const
Definition: BlackoilWellModel_impl.hpp:1943
void initializeWBPCalculationService()
Definition: BlackoilWellModel_impl.hpp:2169
int compressedIndexForInterior(int cartesian_cell_idx) const override
get compressed index for interior cells (-1, otherwise
Definition: BlackoilWellModel.hpp:581
void initPrimaryVariablesEvaluationDomain(const Domain &domain) const
Definition: BlackoilWellModel_impl.hpp:1926
static constexpr bool has_energy_
Definition: BlackoilWellModel.hpp:128
void recoverWellSolutionAndUpdateWellState(const BVector &x)
Definition: BlackoilWellModel_impl.hpp:1873
void setupDomains(const std::vector< Domain > &domains)
Definition: BlackoilWellModel_impl.hpp:2839
void addWellPressureEquationsStruct(PressureMatrix &jacobian) const
Definition: BlackoilWellModel_impl.hpp:1850
void calculateProductivityIndexValuesShutWells(const int reportStepIdx, DeferredLogger &deferred_logger) override
Definition: BlackoilWellModel_impl.hpp:2464
void endReportStep()
Definition: BlackoilWellModel_impl.hpp:663
void prepareWellsBeforeAssembling(const double dt, DeferredLogger &deferred_logger)
Definition: BlackoilWellModel_impl.hpp:1683
typename BlackoilWellModelGeneric< Scalar >::GLiftWellStateMap GLiftWellStateMap
Definition: BlackoilWellModel.hpp:115
int numComponents() const
Definition: BlackoilWellModel_impl.hpp:2629
Definition: ConvergenceReport.hpp:38
Definition: DeferredLogger.hpp:57
Definition: GasLiftGroupInfo.hpp:46
std::map< std::string, std::pair< const Well *, int > > GLiftEclWells
Definition: GasLiftGroupInfo.hpp:70
std::set< int > GLiftSyncGroups
Definition: GasLiftSingleWellGeneric.hpp:59
Definition: GasLiftSingleWell.hpp:36
std::function< Evaluator()> EvaluatorFactory
Definition: ParallelWBPCalculation.hpp:63
Definition: RateConverter.hpp:71
Definition: RegionAverageCalculator.hpp:60
Manages the initializing and running of time dependent problems.
Definition: simulator.hh:92
Definition: WellContributions.hpp:53
Definition: WellInterface.hpp:73
Definition: WellState.hpp:62
data::Wells report(const int *globalCellIdxMap, const std::function< bool(const int)> &wasDynamicallyClosed) const
ExcEnum
Definition: DeferredLogger.hpp:45
Definition: blackoilnewtonmethodparams.hpp:31
Definition: blackoilboundaryratevector.hh:37
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:235
Solver parameters for the BlackoilModel.
Definition: BlackoilModelParameters.hpp:147
bool use_multisegment_well_
Definition: BlackoilModelParameters.hpp:238
Definition: BlackoilWellModel.hpp:424
std::optional< typename std::vector< WellInterfacePtr >::size_type > openWellIdx_
Definition: BlackoilWellModel.hpp:425
std::size_t wbpCalcIdx_
Definition: BlackoilWellModel.hpp:426
Definition: BlackoilWellModel.hpp:83
static constexpr bool value
Definition: BlackoilWellModel.hpp:83
Definition: BlackoilPhases.hpp:46
A struct for returning timing data from a simulator to its caller.
Definition: SimulatorReport.hpp:34
Definition: SubDomain.hpp:62