114 using GLiftOptWells =
typename BlackoilWellModelGeneric<Scalar>::GLiftOptWells;
115 using GLiftProdWells =
typename BlackoilWellModelGeneric<Scalar>::GLiftProdWells;
116 using GLiftWellStateMap =
117 typename BlackoilWellModelGeneric<Scalar>::GLiftWellStateMap;
118 using GLiftEclWells =
typename GasLiftGroupInfo<Scalar>::GLiftEclWells;
119 using GLiftSyncGroups =
typename GasLiftSingleWellGeneric<Scalar>::GLiftSyncGroups;
124 typedef typename BaseAuxiliaryModule<TypeTag>::NeighborSet NeighborSet;
126 static const int numEq = Indices::numEq;
127 static const int solventSaturationIdx = Indices::solventSaturationIdx;
135 typedef Dune::FieldVector<Scalar, numEq > VectorBlockType;
136 typedef Dune::BlockVector<VectorBlockType> BVector;
143 SurfaceToReservoirVoidage<FluidSystem, std::vector<int> >;
147 AverageRegionalPressure<FluidSystem, std::vector<int> >;
168 void linearize(SparseMatrixAdapter& jacobian, GlobalEqVector&
res)
override;
169 void linearizeDomain(
const Domain&
domain, SparseMatrixAdapter& jacobian, GlobalEqVector&
res);
173 recoverWellSolutionAndUpdateWellState(
deltaX);
176 void postSolveDomain(GlobalEqVector&
deltaX,
const Domain&
domain)
178 recoverWellSolutionAndUpdateWellStateDomain(
deltaX,
domain);
185 template <
class Restarter>
195 template <
class Restarter>
204 beginReportStep(simulator_.episodeIndex());
207 void beginTimeStep();
209 void beginIteration()
212 assemble(simulator_.model().newtonMethod().numIterations(),
213 simulator_.timeStepSize());
222 timeStepSucceeded(simulator_.time(), simulator_.timeStepSize());
230 void computeTotalRatesForDof(RateVector&
rate,
231 unsigned globalIdx)
const;
233 template <
class Context>
234 void computeTotalRatesForDof(RateVector&
rate,
240 using WellInterfacePtr = std::shared_ptr<WellInterface<TypeTag> >;
242 using BlackoilWellModelGeneric<Scalar>::initFromRestartFile;
246 this->simulator_.vanguard().transferWTestState(),
251 using BlackoilWellModelGeneric<Scalar>::prepareDeserialize;
252 void prepareDeserialize(
const int report_step)
254 prepareDeserialize(report_step, grid().size(0),
258 data::Wells wellData()
const
260 auto wsrpt = this->wellState()
261 .report(simulator_.vanguard().globalCell().data(),
262 [
this](
const int well_index) ->
bool
264 return this->wasDynamicallyShutThisTimeStep(well_index);
268 const auto&
tracerRates = this->simulator_.problem()
269 .tracerModel().getWellTracerRates();
271 .tracerModel().getWellFreeTracerRates();
273 .tracerModel().getWellSolTracerRates();
275 .tracerModel().getMswTracerRates();
283 BlackoilWellModelGuideRates(*
this)
284 .assignWellGuideRates(
wsrpt, this->reportStepIndex());
286 this->assignWellTargets(
wsrpt);
287 this->assignShutConnections(
wsrpt, this->reportStepIndex());
292 this->assignMassGasRate(
wsrpt, FluidSystem::referenceDensity(FluidSystem::gasPhaseIdx, 0));
297 data::WellBlockAveragePressures wellBlockAveragePressures()
const
299 return this->computeWellBlockAveragePressures();
303 void apply(
const BVector& x, BVector&
Ax)
const;
305 void applyDomain(
const BVector& x, BVector&
Ax,
const int domainIndex)
const;
307#if COMPILE_BDA_BRIDGE
313 void applyScaleAdd(
const Scalar alpha,
const BVector& x, BVector&
Ax)
const;
315 void applyScaleAddDomain(
const Scalar alpha,
const BVector& x, BVector&
Ax,
const int domainIndex)
const;
321 ConvergenceReport getDomainWellConvergence(
const Domain&
domain,
322 const std::vector<Scalar>&
B_avg,
325 const SimulatorReportSingle& lastReport()
const;
327 void addWellContributions(SparseMatrixAdapter& jacobian)
const;
330 void addReservoirSourceTerms(GlobalEqVector& residual,
331 std::vector<typename SparseMatrixAdapter::MatrixBlock*>&
diagMatAddress)
const;
334 void beginReportStep(
const int time_step);
345 void initPrimaryVariablesEvaluation()
const;
346 void initPrimaryVariablesEvaluationDomain(
const Domain&
domain)
const;
348 std::pair<bool, bool>
355 bool updateGroupControls(
const Group& group,
360 WellInterfacePtr getWell(
const std::string& well_name)
const;
361 bool hasWell(
const std::string& well_name)
const;
363 using PressureMatrix = Dune::BCRSMatrix<Opm::MatrixBlock<Scalar, 1, 1>>;
365 void addWellPressureEquations(PressureMatrix& jacobian,
const BVector& weights,
const bool use_well_weights)
const;
367 void addWellPressureEquationsDomain([[
maybe_unused]] PressureMatrix& jacobian,
373 void addWellPressureEquationsStruct(PressureMatrix& jacobian)
const;
380 return well_container_;
390 void logPrimaryVars()
const;
391 std::vector<Scalar> getPrimaryVarsDomain(
const Domain&
domain)
const;
392 void setPrimaryVarsDomain(
const Domain&
domain,
const std::vector<Scalar>&
vars);
394 void setupDomains(
const std::vector<Domain>&
domains);
400 std::vector<WellInterfacePtr> well_container_{};
402 std::vector<bool> is_cell_perforated_{};
407 void createWellContainer(
const int report_step)
override;
410 createWellPointer(
const int wellID,
411 const int report_step)
const;
413 template <
typename WellType>
414 std::unique_ptr<WellType>
415 createTypedWellPointer(
const int wellID,
418 WellInterfacePtr createWellForWellTest(
const std::string& well_name,
const int report_step, DeferredLogger&
deferred_logger)
const;
421 const ModelParameters param_;
422 std::size_t global_num_cells_{};
424 std::size_t local_num_cells_{};
426 std::vector<Scalar> depth_{};
427 bool alternative_well_rate_init_{};
428 std::map<std::string, Scalar> well_group_thp_calc_;
429 std::unique_ptr<RateConverterType> rateConverter_{};
430 std::map<std::string, std::unique_ptr<AverageRegionalPressureType>> regionalAveragePressureCalculator_{};
434 std::optional<typename std::vector<WellInterfacePtr>::size_type> openWellIdx_{};
435 std::size_t wbpCalcIdx_{};
438 std::vector<WBPCalcID> wbpCalcMap_{};
446 mutable BVector scaleAddRes_{};
448 std::vector<Scalar> B_avg_{};
451 std::map<std::string, int> well_domain_;
456 const Grid& grid()
const
457 {
return simulator_.
vanguard().grid(); }
459 const EquilGrid& equilGrid()
const
460 {
return simulator_.
vanguard().equilGrid(); }
462 const EclipseState& eclState()
const
463 {
return simulator_.
vanguard().eclState(); }
505 void endReportStep();
509 void recoverWellSolutionAndUpdateWellState(
const BVector& x);
513 void recoverWellSolutionAndUpdateWellStateDomain(
const BVector& x,
const Domain&
domain);
518 void initializeWBPCalculationService();
520 data::WellBlockAveragePressures
521 computeWellBlockAveragePressures()
const;
524 makeWellSourceEvaluatorFactory(
const std::vector<Well>::size_type
wellIdx)
const;
526 void registerOpenWellsForWBPCalculation();
528 void updateAverageFormationFactor();
530 void computePotentials(
const std::size_t
widx,
536 const std::vector<Scalar>& wellPerfEfficiencyFactors()
const;
539 void calculateProductivityIndexValues(DeferredLogger&
deferred_logger)
override;
544 int numComponents()
const;
546 int reportStepIndex()
const;
551 void prepareWellsBeforeAssembling(
const double dt, DeferredLogger&
deferred_logger);
554 void assembleWellEqWithoutIteration(
const double dt, DeferredLogger&
deferred_logger);
573 void extractLegacyCellPvtRegionIndex_();
575 void extractLegacyDepth_();
582 void calcResvCoeff(
const int fipnum,
584 const std::vector<Scalar>& production_rates,
587 void calcInjResvCoeff(
const int fipnum,
591 void computeWellTemperature();
604 mutable BVector x_local_;
605 mutable BVector Ax_local_;
606 mutable BVector res_local_;
607 mutable GlobalEqVector linearize_res_local_;
Representing a part of a grid, in a way suitable for performing local solves.
Definition SubDomain.hpp:62