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
41#include <opm/models/discretization/common/baseauxiliarymodule.hh>
42
46
47#include <opm/simulators/linalg/matrixblock.hh>
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::Properties {
82
83template<class TypeTag, class MyTypeTag>
85 using type = UndefinedProperty;
86};
87
88} // namespace Opm::Properties
89
90namespace Opm {
91
92#if COMPILE_BDA_BRIDGE
94#endif
95
97 template<typename TypeTag>
98 class BlackoilWellModel : public BaseAuxiliaryModule<TypeTag>
99 , public BlackoilWellModelGeneric<GetPropType<TypeTag,
100 Properties::Scalar>>
101 {
102 public:
103 // --------- Types ---------
105
106 using Grid = GetPropType<TypeTag, Properties::Grid>;
107 using EquilGrid = GetPropType<TypeTag, Properties::EquilGrid>;
108 using FluidSystem = GetPropType<TypeTag, Properties::FluidSystem>;
109 using ElementContext = GetPropType<TypeTag, Properties::ElementContext>;
110 using Indices = GetPropType<TypeTag, Properties::Indices>;
111 using Simulator = GetPropType<TypeTag, Properties::Simulator>;
112 using Scalar = GetPropType<TypeTag, Properties::Scalar>;
113 using RateVector = GetPropType<TypeTag, Properties::RateVector>;
114 using GlobalEqVector = GetPropType<TypeTag, Properties::GlobalEqVector>;
115 using SparseMatrixAdapter = GetPropType<TypeTag, Properties::SparseMatrixAdapter>;
123 constexpr static std::size_t pressureVarIndex = GetPropType<TypeTag, Properties::Indices>::pressureSwitchIdx;
124 typedef typename BaseAuxiliaryModule<TypeTag>::NeighborSet NeighborSet;
125
126 static const int numEq = Indices::numEq;
127 static const int solventSaturationIdx = Indices::solventSaturationIdx;
128 static constexpr bool has_solvent_ = getPropValue<TypeTag, Properties::EnableSolvent>();
129 static constexpr bool has_polymer_ = getPropValue<TypeTag, Properties::EnablePolymer>();
130 static constexpr bool has_energy_ = getPropValue<TypeTag, Properties::EnableEnergy>();
131 static constexpr bool has_micp_ = getPropValue<TypeTag, Properties::EnableMICP>();
132
133 // TODO: where we should put these types, WellInterface or Well Model?
134 // or there is some other strategy, like TypeTag
135 typedef Dune::FieldVector<Scalar, numEq > VectorBlockType;
136 typedef Dune::BlockVector<VectorBlockType> BVector;
137
138 typedef BlackOilPolymerModule<TypeTag> PolymerModule;
139 typedef BlackOilMICPModule<TypeTag> MICPModule;
140
141 // For the conversion between the surface volume rate and resrevoir voidage rate
142 using RateConverterType = RateConverter::
143 SurfaceToReservoirVoidage<FluidSystem, std::vector<int> >;
144
145 // For computing average pressured used by gpmaint
146 using AverageRegionalPressureType = RegionAverageCalculator::
147 AverageRegionalPressure<FluidSystem, std::vector<int> >;
148
150
151 BlackoilWellModel(Simulator& simulator);
152
153 void init();
154 void initWellContainer(const int reportStepIdx) override;
155
157 // <eWoms auxiliary module stuff>
159 unsigned numDofs() const override
160 // No extra dofs are inserted for wells. (we use a Schur complement.)
161 { return 0; }
162
163 void addNeighbors(std::vector<NeighborSet>& neighbors) const override;
164
165 void applyInitial() override
166 {}
167
168 void linearize(SparseMatrixAdapter& jacobian, GlobalEqVector& res) override;
169 void linearizeDomain(const Domain& domain, SparseMatrixAdapter& jacobian, GlobalEqVector& res);
170
171 void postSolve(GlobalEqVector& deltaX) override
172 {
174 }
175
176 void postSolveDomain(GlobalEqVector& deltaX, const Domain& domain)
177 {
179 }
180
182 // </ eWoms auxiliary module stuff>
184
185 template <class Restarter>
186 void deserialize(Restarter& /* res */)
187 {
188 // TODO (?)
189 }
190
195 template <class Restarter>
196 void serialize(Restarter& /* res*/)
197 {
198 // TODO (?)
199 }
200
202 {
203 OPM_TIMEBLOCK(beginEpsiode);
204 beginReportStep(simulator_.episodeIndex());
205 }
206
207 void beginTimeStep();
208
210 {
211 OPM_TIMEBLOCK(beginIteration);
212 assemble(simulator_.model().newtonMethod().numIterations(),
213 simulator_.timeStepSize());
214 }
215
217 { }
218
220 {
221 OPM_TIMEBLOCK(endTimeStep);
222 timeStepSucceeded(simulator_.time(), simulator_.timeStepSize());
223 }
224
226 {
228 }
229
231 unsigned globalIdx) const;
232
233 template <class Context>
235 const Context& context,
236 unsigned spaceIdx,
237 unsigned timeIdx) const;
238
239
240 using WellInterfacePtr = std::shared_ptr<WellInterface<TypeTag> >;
241
243 void initFromRestartFile(const RestartValue& restartValues)
244 {
245 initFromRestartFile(restartValues,
246 this->simulator_.vanguard().transferWTestState(),
247 grid().size(0),
249 }
250
252 void prepareDeserialize(const int report_step)
253 {
254 prepareDeserialize(report_step, grid().size(0),
256 }
257
258 data::Wells wellData() const
259 {
260 auto wsrpt = this->wellState()
261 .report(simulator_.vanguard().globalCell().data(),
262 [this](const int well_index) -> bool
263 {
264 return this->wasDynamicallyShutThisTimeStep(well_index);
265 });
266
267 const auto& tracerRates = simulator_.problem().tracerModel().getWellTracerRates();
268 this->assignWellTracerRates(wsrpt, tracerRates);
269
270
271 BlackoilWellModelGuideRates(*this).assignWellGuideRates(wsrpt, this->reportStepIndex());
272 this->assignShutConnections(wsrpt, this->reportStepIndex());
273
274 return wsrpt;
275 }
276
277 data::WellBlockAveragePressures wellBlockAveragePressures() const
278 {
280 }
281
282 // subtract Binv(D)rw from r;
283 void apply( BVector& r) const;
284
285 // subtract B*inv(D)*C * x from A*x
286 void apply(const BVector& x, BVector& Ax) const;
287
288#if COMPILE_BDA_BRIDGE
289 // accumulate the contributions of all Wells in the WellContributions object
290 void getWellContributions(WellContributions& x) const;
291#endif
292
293 // apply well model with scaling of alpha
294 void applyScaleAdd(const Scalar alpha, const BVector& x, BVector& Ax) const;
295
296 // Check if well equations is converged.
297 ConvergenceReport getWellConvergence(const std::vector<Scalar>& B_avg, const bool checkWellGroupControls = false) const;
298
299 // Check if well equations are converged locally.
301 const std::vector<Scalar>& B_avg,
302 DeferredLogger& local_deferredLogger) const;
303
304 const SimulatorReportSingle& lastReport() const;
305
306 void addWellContributions(SparseMatrixAdapter& jacobian) const;
307
308 // add source from wells to the reservoir matrix
310 std::vector<typename SparseMatrixAdapter::MatrixBlock*>& diagMatAddress) const;
311
312 // called at the beginning of a report step
313 void beginReportStep(const int time_step);
314
315 // it should be able to go to prepareTimeStep(), however, the updateWellControls() and initPrimaryVariablesEvaluation()
316 // makes it a little more difficult. unless we introduce if (iterationIdx != 0) to avoid doing the above functions
317 // twice at the beginning of the time step
320 void calculateExplicitQuantities(DeferredLogger& deferred_logger) const;
321 // some preparation work, mostly related to group control and RESV,
322 // at the beginning of each time step (Not report step)
323 void prepareTimeStep(DeferredLogger& deferred_logger);
325 void initPrimaryVariablesEvaluationDomain(const Domain& domain) const;
326
327 std::pair<bool, bool>
328 updateWellControls(const bool mandatory_network_balance, DeferredLogger& deferred_logger, const bool relax_network_tolerance = false);
329
330 void updateAndCommunicate(const int reportStepIdx,
331 const int iterationIdx,
332 DeferredLogger& deferred_logger);
333
334 bool updateGroupControls(const Group& group,
335 DeferredLogger& deferred_logger,
336 const int reportStepIdx,
337 const int iterationIdx);
338
339 WellInterfacePtr getWell(const std::string& well_name) const;
340 bool hasWell(const std::string& well_name) const;
341
342 using PressureMatrix = Dune::BCRSMatrix<Opm::MatrixBlock<Scalar, 1, 1>>;
343
344 void addWellPressureEquations(PressureMatrix& jacobian, const BVector& weights,const bool use_well_weights) const;
345
347
348 void initGliftEclWellMap(GLiftEclWells &ecl_well_map);
349
351 const std::vector<WellInterfacePtr>& localNonshutWells() const
352 {
353 return well_container_;
354 }
355
356 // prototype for assemble function for ASPIN solveLocal()
357 // will try to merge back to assemble() when done prototyping
358 void assembleDomain(const int iterationIdx,
359 const double dt,
360 const Domain& domain);
361 void updateWellControlsDomain(DeferredLogger& deferred_logger, const Domain& domain);
362
363 void logPrimaryVars() const;
364 std::vector<Scalar> getPrimaryVarsDomain(const Domain& domain) const;
365 void setPrimaryVarsDomain(const Domain& domain, const std::vector<Scalar>& vars);
366
367 void setupDomains(const std::vector<Domain>& domains);
368
369 protected:
371
372 // a vector of all the wells.
373 std::vector<WellInterfacePtr> well_container_{};
374
375 std::vector<bool> is_cell_perforated_{};
376
377 void initializeWellState(const int timeStepIdx);
378
379 // create the well container
380 void createWellContainer(const int report_step) override;
381
383 createWellPointer(const int wellID,
384 const int report_step) const;
385
386 template <typename WellType>
387 std::unique_ptr<WellType>
388 createTypedWellPointer(const int wellID,
389 const int time_step) const;
390
391 WellInterfacePtr createWellForWellTest(const std::string& well_name, const int report_step, DeferredLogger& deferred_logger) const;
392
393
395 std::size_t global_num_cells_{};
396 // the number of the cells in the local grid
397 std::size_t local_num_cells_{};
399 std::vector<Scalar> depth_{};
401
402 std::unique_ptr<RateConverterType> rateConverter_{};
403 std::map<std::string, std::unique_ptr<AverageRegionalPressureType>> regionalAveragePressureCalculator_{};
404
406 {
407 std::optional<typename std::vector<WellInterfacePtr>::size_type> openWellIdx_{};
408 std::size_t wbpCalcIdx_{};
409 };
410
411 std::vector<WBPCalcID> wbpCalcMap_{};
412
414
415 // Pre-step network solve at static reservoir conditions (group and well states might be updated)
416 void doPreStepNetworkRebalance(DeferredLogger& deferred_logger);
417
418 // used to better efficiency of calcuation
420
421 std::vector<Scalar> B_avg_{};
422
423 // Keep track of the domain of each well, if using subdomains.
424 std::map<std::string, int> well_domain_;
425
426 const Grid& grid() const
427 { return simulator_.vanguard().grid(); }
428
429 const EquilGrid& equilGrid() const
430 { return simulator_.vanguard().equilGrid(); }
431
432 const EclipseState& eclState() const
433 { return simulator_.vanguard().eclState(); }
434
435 // compute the well fluxes and assemble them in to the reservoir equations as source terms
436 // and in the well equations.
437 void assemble(const int iterationIdx,
438 const double dt);
439
440 // well controls and network pressures affect each other and are solved in an iterative manner.
441 // the function handles one iteration of updating well controls and network pressures.
442 // it is possible to decouple the update of well controls and network pressures further.
443 // the returned two booleans are {continue_due_to_network, well_group_control_changed}, respectively
444 std::pair<bool, bool> updateWellControlsAndNetworkIteration(const bool mandatory_network_balance,
445 const bool relax_network_tolerance,
446 const double dt,
447 DeferredLogger& local_deferredLogger);
448
449 bool updateWellControlsAndNetwork(const bool mandatory_network_balance,
450 const double dt,
451 DeferredLogger& local_deferredLogger);
452
461 void initializeLocalWellStructure(const int reportStepIdx,
462 const bool enableWellPIScaling);
463
467 void initializeGroupStructure(const int reportStepIdx);
468
469 // called at the end of a time step
470 void timeStepSucceeded(const double simulationTime, const double dt);
471
472 // called at the end of a report step
473 void endReportStep();
474
475 // using the solution x to recover the solution xw for wells and applying
476 // xw to update Well State
478
479 // using the solution x to recover the solution xw for wells and applying
480 // xw to update Well State
481 void recoverWellSolutionAndUpdateWellStateDomain(const BVector& x, const Domain& domain);
482
483 // setting the well_solutions_ based on well_state.
484 void updatePrimaryVariables(DeferredLogger& deferred_logger);
485
487
488 data::WellBlockAveragePressures
490
492 makeWellSourceEvaluatorFactory(const std::vector<Well>::size_type wellIdx) const;
493
495
497
498 void computePotentials(const std::size_t widx,
499 const WellState<Scalar>& well_state_copy,
500 std::string& exc_msg,
501 ExceptionType::ExcEnum& exc_type,
502 DeferredLogger& deferred_logger) override;
503
504 const std::vector<Scalar>& wellPerfEfficiencyFactors() const;
505
506 void calculateProductivityIndexValuesShutWells(const int reportStepIdx, DeferredLogger& deferred_logger) override;
507 void calculateProductivityIndexValues(DeferredLogger& deferred_logger) override;
509 DeferredLogger& deferred_logger);
510
511 // The number of components in the model.
512 int numComponents() const;
513
514 int reportStepIndex() const;
515
516 void assembleWellEq(const double dt, DeferredLogger& deferred_logger);
517 void assembleWellEqDomain(const double dt, const Domain& domain, DeferredLogger& deferred_logger);
518
519 void prepareWellsBeforeAssembling(const double dt, DeferredLogger& deferred_logger);
520
521 // TODO: finding a better naming
522 void assembleWellEqWithoutIteration(const double dt, DeferredLogger& deferred_logger);
523
524 bool maybeDoGasLiftOptimize(DeferredLogger& deferred_logger);
525
526 void gasLiftOptimizationStage1(DeferredLogger& deferred_logger,
527 GLiftProdWells &prod_wells, GLiftOptWells &glift_wells,
528 GasLiftGroupInfo &group_info, GLiftWellStateMap &state_map);
529
530 // cannot be const since it accesses the non-const WellState
532 DeferredLogger& deferred_logger,
533 GLiftProdWells &prod_wells, GLiftOptWells &glift_wells,
534 GasLiftGroupInfo &group_info, GLiftWellStateMap &state_map,
535 GLiftSyncGroups& groups_to_sync);
536
538
539 void extractLegacyDepth_();
540
542 void updateWellTestState(const double& simulationTime, WellTestState& wellTestState) const;
543
544 void wellTesting(const int timeStepIdx, const double simulationTime, DeferredLogger& deferred_logger);
545
546 void calcRates(const int fipnum,
547 const int pvtreg,
548 const std::vector<Scalar>& production_rates,
549 std::vector<Scalar>& resv_coeff) override;
550
551 void calcInjRates(const int fipnum,
552 const int pvtreg,
553 std::vector<Scalar>& resv_coeff) override;
554
556
557 int compressedIndexForInterior(int cartesian_cell_idx) const override {
558 return simulator_.vanguard().compressedIndexForInterior(cartesian_cell_idx);
559 }
560
561 private:
562 BlackoilWellModel(Simulator& simulator, const PhaseUsage& pu);
563 };
564
565
566} // namespace Opm
567
568#ifndef OPM_BLACKOILWELLMODEL_IMPL_HEADER_INCLUDED
570#endif
571
572#endif
Class for handling the blackoil well model.
Definition: BlackoilWellModelGeneric.hpp:83
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
std::map< std::string, const WellInterfaceGeneric * > GLiftProdWells
Definition: BlackoilWellModelGeneric.hpp:87
WellTestState & wellTestState()
Definition: BlackoilWellModelGeneric.hpp:147
std::map< std::string, std::unique_ptr< GasLiftSingleWellGeneric > > GLiftOptWells
Definition: BlackoilWellModelGeneric.hpp:86
std::map< std::string, std::unique_ptr< GasLiftWellState > > GLiftWellStateMap
Definition: BlackoilWellModelGeneric.hpp:88
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:101
ParallelWBPCalculation::EvaluatorFactory makeWellSourceEvaluatorFactory(const std::vector< Well >::size_type wellIdx) const
Definition: BlackoilWellModel_impl.hpp:2074
void initializeGroupStructure(const int reportStepIdx)
Definition: BlackoilWellModel_impl.hpp:345
void apply(BVector &r) const
Definition: BlackoilWellModel_impl.hpp:1543
void endTimeStep()
Definition: BlackoilWellModel.hpp:219
SubDomain< Grid > Domain
Definition: BlackoilWellModel.hpp:149
void prepareTimeStep(DeferredLogger &deferred_logger)
Definition: BlackoilWellModel_impl.hpp:2339
bool updateGroupControls(const Group &group, DeferredLogger &deferred_logger, const int reportStepIdx, const int iterationIdx)
Definition: BlackoilWellModel_impl.hpp:2168
void serialize(Restarter &)
This method writes the complete state of the well to the harddisk.
Definition: BlackoilWellModel.hpp:196
BlackOilMICPModule< TypeTag > MICPModule
Definition: BlackoilWellModel.hpp:139
void calcRates(const int fipnum, const int pvtreg, const std::vector< Scalar > &production_rates, std::vector< Scalar > &resv_coeff) override
Definition: BlackoilWellModel_impl.hpp:2534
WellInterfacePtr createWellPointer(const int wellID, const int report_step) const
Definition: BlackoilWellModel_impl.hpp:982
const EclipseState & eclState() const
Definition: BlackoilWellModel.hpp:432
WellInterfacePtr getWell(const std::string &well_name) const
Definition: BlackoilWellModel_impl.hpp:2490
BlackOilPolymerModule< TypeTag > PolymerModule
Definition: BlackoilWellModel.hpp:138
const std::vector< WellInterfacePtr > & localNonshutWells() const
Get list of local nonshut wells.
Definition: BlackoilWellModel.hpp:351
void prepareDeserialize(const int report_step)
Definition: BlackoilWellModel.hpp:252
void init()
Definition: BlackoilWellModel_impl.hpp:145
typename BlackoilWellModelGeneric< Scalar >::GLiftProdWells GLiftProdWells
Definition: BlackoilWellModel.hpp:118
std::vector< Scalar > depth_
Definition: BlackoilWellModel.hpp:399
void updateAndCommunicate(const int reportStepIdx, const int iterationIdx, DeferredLogger &deferred_logger)
Definition: BlackoilWellModel_impl.hpp:2146
std::size_t global_num_cells_
Definition: BlackoilWellModel.hpp:395
typename GasLiftSingleWellGeneric::GLiftSyncGroups GLiftSyncGroups
Definition: BlackoilWellModel.hpp:122
void doPreStepNetworkRebalance(DeferredLogger &deferred_logger)
Definition: BlackoilWellModel_impl.hpp:1060
GetPropType< TypeTag, Properties::Scalar > Scalar
Definition: BlackoilWellModel.hpp:112
SimulatorReportSingle last_report_
Definition: BlackoilWellModel.hpp:413
void postSolveDomain(GlobalEqVector &deltaX, const Domain &domain)
Definition: BlackoilWellModel.hpp:176
std::vector< Scalar > getPrimaryVarsDomain(const Domain &domain) const
Definition: BlackoilWellModel_impl.hpp:2632
static const int solventSaturationIdx
Definition: BlackoilWellModel.hpp:127
std::vector< WBPCalcID > wbpCalcMap_
Definition: BlackoilWellModel.hpp:411
Scalar gravity_
Definition: BlackoilWellModel.hpp:398
void initWellContainer(const int reportStepIdx) override
Definition: BlackoilWellModel_impl.hpp:164
void addReservoirSourceTerms(GlobalEqVector &residual, std::vector< typename SparseMatrixAdapter::MatrixBlock * > &diagMatAddress) const
Definition: BlackoilWellModel_impl.hpp:1650
void beginReportStep(const int time_step)
Definition: BlackoilWellModel_impl.hpp:248
typename WellInterface< TypeTag >::GasLiftSingleWell GasLiftSingleWell
Definition: BlackoilWellModel.hpp:116
GetPropType< TypeTag, Properties::FluidSystem > FluidSystem
Definition: BlackoilWellModel.hpp:108
void beginIteration()
Definition: BlackoilWellModel.hpp:209
void assembleWellEqDomain(const double dt, const Domain &domain, DeferredLogger &deferred_logger)
Definition: BlackoilWellModel_impl.hpp:1500
BVector scaleAddRes_
Definition: BlackoilWellModel.hpp:419
void applyScaleAdd(const Scalar alpha, const BVector &x, BVector &Ax) const
Definition: BlackoilWellModel_impl.hpp:1604
void initFromRestartFile(const RestartValue &restartValues)
Definition: BlackoilWellModel.hpp:243
const ModelParameters param_
Definition: BlackoilWellModel.hpp:394
void gasLiftOptimizationStage1SingleWell(WellInterface< TypeTag > *well, DeferredLogger &deferred_logger, GLiftProdWells &prod_wells, GLiftOptWells &glift_wells, GasLiftGroupInfo &group_info, GLiftWellStateMap &state_map, GLiftSyncGroups &groups_to_sync)
Definition: BlackoilWellModel_impl.hpp:1451
void beginEpisode()
Definition: BlackoilWellModel.hpp:201
GetPropType< TypeTag, Properties::ElementContext > ElementContext
Definition: BlackoilWellModel.hpp:109
GetPropType< TypeTag, Properties::Grid > Grid
Definition: BlackoilWellModel.hpp:106
void updateWellControlsDomain(DeferredLogger &deferred_logger, const Domain &domain)
Definition: BlackoilWellModel_impl.hpp:1977
GetPropType< TypeTag, Properties::EquilGrid > EquilGrid
Definition: BlackoilWellModel.hpp:107
void assembleWellEq(const double dt, DeferredLogger &deferred_logger)
Definition: BlackoilWellModel_impl.hpp:1489
void postSolve(GlobalEqVector &deltaX) override
Definition: BlackoilWellModel.hpp:171
void linearizeDomain(const Domain &domain, SparseMatrixAdapter &jacobian, GlobalEqVector &res)
Definition: BlackoilWellModel_impl.hpp:225
BaseAuxiliaryModule< TypeTag >::NeighborSet NeighborSet
Definition: BlackoilWellModel.hpp:124
void endIteration()
Definition: BlackoilWellModel.hpp:216
static constexpr bool has_polymer_
Definition: BlackoilWellModel.hpp:129
int reportStepIndex() const
Definition: BlackoilWellModel_impl.hpp:2522
void calculateProductivityIndexValues(DeferredLogger &deferred_logger) override
Definition: BlackoilWellModel_impl.hpp:2280
void extractLegacyDepth_()
Definition: BlackoilWellModel_impl.hpp:2478
void extractLegacyCellPvtRegionIndex_()
Definition: BlackoilWellModel_impl.hpp:2445
void updateAverageFormationFactor()
Definition: BlackoilWellModel_impl.hpp:2386
GetPropType< TypeTag, Properties::Simulator > Simulator
Definition: BlackoilWellModel.hpp:111
void calcInjRates(const int fipnum, const int pvtreg, std::vector< Scalar > &resv_coeff) override
Definition: BlackoilWellModel_impl.hpp:2545
void initializeWellState(const int timeStepIdx)
Definition: BlackoilWellModel_impl.hpp:803
void assemble(const int iterationIdx, const double dt)
Definition: BlackoilWellModel_impl.hpp:1099
const Grid & grid() const
Definition: BlackoilWellModel.hpp:426
void computeWellTemperature()
Definition: BlackoilWellModel_impl.hpp:2556
static const int numEq
Definition: BlackoilWellModel.hpp:126
void addWellPressureEquations(PressureMatrix &jacobian, const BVector &weights, const bool use_well_weights) const
Definition: BlackoilWellModel_impl.hpp:1634
void logPrimaryVars() const
Definition: BlackoilWellModel_impl.hpp:2613
const SimulatorReportSingle & lastReport() const
Definition: BlackoilWellModel_impl.hpp:654
bool updateWellControlsAndNetwork(const bool mandatory_network_balance, const double dt, DeferredLogger &local_deferredLogger)
Definition: BlackoilWellModel_impl.hpp:1159
void endEpisode()
Definition: BlackoilWellModel.hpp:225
GetPropType< TypeTag, Properties::SparseMatrixAdapter > SparseMatrixAdapter
Definition: BlackoilWellModel.hpp:115
void addWellContributions(SparseMatrixAdapter &jacobian) const
Definition: BlackoilWellModel_impl.hpp:1624
const EquilGrid & equilGrid() const
Definition: BlackoilWellModel.hpp:429
WellInterfacePtr createWellForWellTest(const std::string &well_name, const int report_step, DeferredLogger &deferred_logger) const
Definition: BlackoilWellModel_impl.hpp:1033
std::map< std::string, int > well_domain_
Definition: BlackoilWellModel.hpp:424
void deserialize(Restarter &)
Definition: BlackoilWellModel.hpp:186
GetPropType< TypeTag, Properties::Indices > Indices
Definition: BlackoilWellModel.hpp:110
typename BlackoilWellModelGeneric< Scalar >::GLiftOptWells GLiftOptWells
Definition: BlackoilWellModel.hpp:117
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:2245
std::pair< bool, bool > updateWellControls(const bool mandatory_network_balance, DeferredLogger &deferred_logger, const bool relax_network_tolerance=false)
Definition: BlackoilWellModel_impl.hpp:1889
void recoverWellSolutionAndUpdateWellStateDomain(const BVector &x, const Domain &domain)
Definition: BlackoilWellModel_impl.hpp:1722
void applyInitial() override
Definition: BlackoilWellModel.hpp:165
void assembleDomain(const int iterationIdx, const double dt, const Domain &domain)
Definition: BlackoilWellModel_impl.hpp:1247
bool hasWell(const std::string &well_name) const
Definition: BlackoilWellModel_impl.hpp:2507
void assembleWellEqWithoutIteration(const double dt, DeferredLogger &deferred_logger)
Definition: BlackoilWellModel_impl.hpp:1524
data::WellBlockAveragePressures computeWellBlockAveragePressures() const
Definition: BlackoilWellModel_impl.hpp:2028
std::vector< WellInterfacePtr > well_container_
Definition: BlackoilWellModel.hpp:373
static constexpr std::size_t pressureVarIndex
Definition: BlackoilWellModel.hpp:123
typename GasLiftGroupInfo::GLiftEclWells GLiftEclWells
Definition: BlackoilWellModel.hpp:121
void initPrimaryVariablesEvaluation() const
Definition: BlackoilWellModel_impl.hpp:1747
Dune::BCRSMatrix< Opm::MatrixBlock< Scalar, 1, 1 > > PressureMatrix
Definition: BlackoilWellModel.hpp:342
void computeTotalRatesForDof(RateVector &rate, unsigned globalIdx) const
Definition: BlackoilWellModel_impl.hpp:766
void beginTimeStep()
Definition: BlackoilWellModel_impl.hpp:387
unsigned numDofs() const override
Definition: BlackoilWellModel.hpp:159
std::vector< Scalar > B_avg_
Definition: BlackoilWellModel.hpp:421
const std::vector< Scalar > & wellPerfEfficiencyFactors() const
GetPropType< TypeTag, Properties::RateVector > RateVector
Definition: BlackoilWellModel.hpp:113
void calculateExplicitQuantities(DeferredLogger &deferred_logger) const
Definition: BlackoilWellModel_impl.hpp:1874
std::map< std::string, std::unique_ptr< AverageRegionalPressureType > > regionalAveragePressureCalculator_
Definition: BlackoilWellModel.hpp:403
Dune::FieldVector< Scalar, numEq > VectorBlockType
Definition: BlackoilWellModel.hpp:135
void updatePrimaryVariables(DeferredLogger &deferred_logger)
Definition: BlackoilWellModel_impl.hpp:2435
GetPropType< TypeTag, Properties::GlobalEqVector > GlobalEqVector
Definition: BlackoilWellModel.hpp:114
void initializeLocalWellStructure(const int reportStepIdx, const bool enableWellPIScaling)
Definition: BlackoilWellModel_impl.hpp:300
static constexpr bool has_solvent_
Definition: BlackoilWellModel.hpp:128
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:1195
void addNeighbors(std::vector< NeighborSet > &neighbors) const override
Definition: BlackoilWellModel_impl.hpp:180
static constexpr bool has_micp_
Definition: BlackoilWellModel.hpp:131
std::unique_ptr< RateConverterType > rateConverter_
Definition: BlackoilWellModel.hpp:402
BlackoilWellModel(Simulator &simulator)
Definition: BlackoilWellModel_impl.hpp:137
void wellTesting(const int timeStepIdx, const double simulationTime, DeferredLogger &deferred_logger)
Definition: BlackoilWellModel_impl.hpp:587
std::vector< bool > is_cell_perforated_
Definition: BlackoilWellModel.hpp:375
ConvergenceReport getWellConvergence(const std::vector< Scalar > &B_avg, const bool checkWellGroupControls=false) const
Definition: BlackoilWellModel_impl.hpp:1821
void registerOpenWellsForWBPCalculation()
Definition: BlackoilWellModel_impl.hpp:2125
void linearize(SparseMatrixAdapter &jacobian, GlobalEqVector &res) override
Definition: BlackoilWellModel_impl.hpp:204
data::WellBlockAveragePressures wellBlockAveragePressures() const
Definition: BlackoilWellModel.hpp:277
std::size_t local_num_cells_
Definition: BlackoilWellModel.hpp:397
void initGliftEclWellMap(GLiftEclWells &ecl_well_map)
Definition: BlackoilWellModel_impl.hpp:1477
void gasLiftOptimizationStage1(DeferredLogger &deferred_logger, GLiftProdWells &prod_wells, GLiftOptWells &glift_wells, GasLiftGroupInfo &group_info, GLiftWellStateMap &state_map)
Definition: BlackoilWellModel_impl.hpp:1345
bool alternative_well_rate_init_
Definition: BlackoilWellModel.hpp:400
void timeStepSucceeded(const double simulationTime, const double dt)
Definition: BlackoilWellModel_impl.hpp:664
std::unique_ptr< WellType > createTypedWellPointer(const int wellID, const int time_step) const
Definition: BlackoilWellModel_impl.hpp:1002
void setPrimaryVarsDomain(const Domain &domain, const std::vector< Scalar > &vars)
Definition: BlackoilWellModel_impl.hpp:2649
Simulator & simulator_
Definition: BlackoilWellModel.hpp:370
std::shared_ptr< WellInterface< TypeTag > > WellInterfacePtr
Definition: BlackoilWellModel.hpp:240
void createWellContainer(const int report_step) override
Definition: BlackoilWellModel_impl.hpp:841
Dune::BlockVector< VectorBlockType > BVector
Definition: BlackoilWellModel.hpp:136
bool maybeDoGasLiftOptimize(DeferredLogger &deferred_logger)
Definition: BlackoilWellModel_impl.hpp:1287
data::Wells wellData() const
Definition: BlackoilWellModel.hpp:258
void updateWellTestState(const double &simulationTime, WellTestState &wellTestState) const
upate the wellTestState related to economic limits
Definition: BlackoilWellModel_impl.hpp:2206
ConvergenceReport getDomainWellConvergence(const Domain &domain, const std::vector< Scalar > &B_avg, DeferredLogger &local_deferredLogger) const
Definition: BlackoilWellModel_impl.hpp:1775
void initializeWBPCalculationService()
Definition: BlackoilWellModel_impl.hpp:2000
int compressedIndexForInterior(int cartesian_cell_idx) const override
get compressed index for interior cells (-1, otherwise
Definition: BlackoilWellModel.hpp:557
void initPrimaryVariablesEvaluationDomain(const Domain &domain) const
Definition: BlackoilWellModel_impl.hpp:1758
static constexpr bool has_energy_
Definition: BlackoilWellModel.hpp:130
void recoverWellSolutionAndUpdateWellState(const BVector &x)
Definition: BlackoilWellModel_impl.hpp:1703
void setupDomains(const std::vector< Domain > &domains)
Definition: BlackoilWellModel_impl.hpp:2666
void addWellPressureEquationsStruct(PressureMatrix &jacobian) const
Definition: BlackoilWellModel_impl.hpp:1680
void calculateProductivityIndexValuesShutWells(const int reportStepIdx, DeferredLogger &deferred_logger) override
Definition: BlackoilWellModel_impl.hpp:2294
void endReportStep()
Definition: BlackoilWellModel_impl.hpp:637
void prepareWellsBeforeAssembling(const double dt, DeferredLogger &deferred_logger)
Definition: BlackoilWellModel_impl.hpp:1513
typename BlackoilWellModelGeneric< Scalar >::GLiftWellStateMap GLiftWellStateMap
Definition: BlackoilWellModel.hpp:120
int numComponents() const
Definition: BlackoilWellModel_impl.hpp:2461
Definition: ConvergenceReport.hpp:38
Definition: DeferredLogger.hpp:57
Definition: GasLiftGroupInfo.hpp:45
std::map< std::string, std::pair< const Well *, int > > GLiftEclWells
Definition: GasLiftGroupInfo.hpp:68
std::set< int > GLiftSyncGroups
Definition: GasLiftSingleWellGeneric.hpp:58
Definition: GasLiftSingleWell.hpp:38
std::function< Evaluator()> EvaluatorFactory
Definition: ParallelWBPCalculation.hpp:62
Definition: RateConverter.hpp:70
Definition: RegionAverageCalculator.hpp:65
Definition: WellContributions.hpp:52
Definition: WellInterface.hpp:75
Definition: WellState.hpp:62
data::Wells report(const int *globalCellIdxMap, const std::function< bool(const int)> &wasDynamicallyClosed) const
ExcEnum
Definition: DeferredLogger.hpp:45
Definition: AluGridVanguard.hpp:57
Definition: BlackoilPhases.hpp:27
Solver parameters for the BlackoilModel.
Definition: BlackoilModelParameters.hpp:484
bool use_multisegment_well_
Definition: BlackoilModelParameters.hpp:570
Definition: BlackoilWellModel.hpp:406
std::optional< typename std::vector< WellInterfacePtr >::size_type > openWellIdx_
Definition: BlackoilWellModel.hpp:407
std::size_t wbpCalcIdx_
Definition: BlackoilWellModel.hpp:408
Definition: BlackoilPhases.hpp:46
Definition: BlackoilWellModel.hpp:84
UndefinedProperty type
Definition: BlackoilWellModel.hpp:85
A struct for returning timing data from a simulator to its caller.
Definition: SimulatorReport.hpp:34
Definition: SubDomain.hpp:62