23#ifndef OPM_STANDARDWELL_HEADER_INCLUDED
24#define OPM_STANDARDWELL_HEADER_INCLUDED
26#include <opm/simulators/timestepping/ConvergenceReport.hpp>
28#include <opm/simulators/wells/RatioCalculator.hpp>
29#include <opm/simulators/wells/VFPInjProperties.hpp>
30#include <opm/simulators/wells/VFPProdProperties.hpp>
31#include <opm/simulators/wells/WellInterface.hpp>
32#include <opm/simulators/wells/WellProdIndexCalculator.hpp>
33#include <opm/simulators/wells/ParallelWellInfo.hpp>
42#include <opm/material/densead/Evaluation.hpp>
43#include <opm/input/eclipse/Schedule/ScheduleTypes.hpp>
45#include <opm/simulators/wells/StandardWellEval.hpp>
47#include <dune/common/dynvector.hh>
48#include <dune/common/dynmatrix.hh>
56 template<
typename TypeTag>
59 GetPropType<TypeTag, Properties::Indices>>
71 using typename Base::IntensiveQuantities;
74 using typename Base::ModelParameters;
76 using typename Base::RateConverterType;
77 using typename Base::SparseMatrixAdapter;
81 using Base::has_solvent;
82 using Base::has_zFraction;
83 using Base::has_polymer;
84 using Base::has_polymermw;
86 using Base::has_brine;
87 using Base::has_energy;
88 using Base::has_bioeffects;
96 static constexpr int numWellConservationEq = Indices::numPhases + Indices::numSolvents;
98 static constexpr int numWellControlEq = 1;
101 static constexpr int numStaticWellEq = numWellConservationEq + numWellControlEq;
106 static constexpr int Bhp = numStaticWellEq - numWellControlEq;
108 using StdWellEval::WQTotal;
119 using Eval =
typename StdWellEval::Eval;
120 using EvalWell =
typename StdWellEval::EvalWell;
121 using BVectorWell =
typename StdWellEval::BVectorWell;
123 using IndexTraits =
typename FluidSystem::IndexTraitsType;
129 const ModelParameters& param,
131 const int pvtRegionIdx,
133 const int num_phases,
137 virtual void init(
const std::vector<Scalar>&
depth_arg,
139 const std::vector<Scalar>&
B_avg,
145 const std::vector<Scalar>&
B_avg,
150 virtual void apply(
const BVector& x, BVector&
Ax)
const override;
152 virtual void apply(BVector&
r)
const override;
164 std::vector<Scalar>& well_potentials,
167 void updatePrimaryVariables(
const Simulator& simulator,
171 void solveEqAndUpdateWellState(
const Simulator& simulator,
175 void calculateExplicitQuantities(
const Simulator& simulator,
179 void updateProductivityIndex(
const Simulator& simulator,
187 void addWellContributions(SparseMatrixAdapter& mat)
const override;
189 void addWellPressureEquations(PressureMatrix& mat,
191 const int pressureVarIndex,
196 bool iterateWellEqWithControl(
const Simulator& simulator,
205 bool iterateWellEqWithSwitching(
const Simulator& simulator,
216 Scalar computeWellRatesAndBhpWithThpAlqProd(
const Simulator&
ebos_simulator,
222 void computeWellRatesWithThpAlqProd(
const Simulator&
ebos_simulator,
228 std::optional<Scalar>
235 void updateIPRImplicit(
const Simulator& simulator,
245 using Base::vfp_properties_;
251 std::vector<Scalar> getPrimaryVars()
const override;
253 int setPrimaryVars(
typename std::vector<Scalar>::const_iterator it)
override;
259 void updateWellState(
const Simulator& simulator,
260 const BVectorWell&
dwells,
264 using WellConnectionProps =
typename StdWellEval::StdWellConnections::Properties;
269 computePropertiesForWellConnectionPressures(
const Simulator& simulator,
272 void computeWellConnectionDensitesPressures(
const Simulator& simulator,
274 const WellConnectionProps&
props,
277 void computeWellConnectionPressures(
const Simulator& simulator,
281 template<
class Value>
282 void computePerfRate(
const IntensiveQuantities& intQuants,
283 const std::vector<Value>&
mob,
285 const std::vector<Scalar>&
Tw,
288 std::vector<Value>&
cq_s,
292 template<
class Value>
293 void computePerfRate(
const std::vector<Value>&
mob,
294 const Value& pressure,
301 const std::vector<Scalar>&
Tw,
304 const Value& skin_pressure,
305 const std::vector<Value>&
cmix_s,
306 std::vector<Value>&
cq_s,
310 void computeWellRatesWithBhpIterations(
const Simulator&
ebosSimulator,
320 bool computeWellPotentialsImplicit(
const Simulator&
ebos_simulator,
322 std::vector<Scalar>& well_potentials,
327 Scalar getRefDensity()
const override;
330 template<
class Value>
331 void getMobility(
const Simulator& simulator,
333 std::vector<Value>&
mob,
336 void updateWaterMobilityWithPolymer(
const Simulator& simulator,
341 void updatePrimaryVariablesNewton(
const BVectorWell&
dwells,
345 void updateWellStateFromPrimaryVariables(
WellStateType& well_state,
349 void assembleWellEqWithoutIteration(
const Simulator& simulator,
357 void assembleWellEqWithoutIterationImpl(
const Simulator& simulator,
365 void calculateSinglePerf(
const Simulator& simulator,
368 std::vector<RateVector>& connectionRates,
369 std::vector<EvalWell>&
cq_s,
375 void checkOperabilityUnderBHPLimit(
const WellStateType& well_state,
376 const Simulator& simulator,
380 void checkOperabilityUnderTHPLimit(
const Simulator& simulator,
385 void updateIPR(
const Simulator& simulator,
390 bool allDrawDownWrongDirection(
const Simulator& simulator)
const;
397 bool openCrossFlowAvoidSingularity(
const Simulator& simulator)
const;
404 const EvalWell& water_velocity,
410 const EvalWell& water_velocity,
415 const EvalWell& water_velocity,
419 void handleInjectivityRate(
const Simulator& simulator,
421 std::vector<EvalWell>&
cq_s)
const;
424 void handleInjectivityEquations(
const Simulator& simulator,
430 void updateWaterThroughput(
const double dt,
434 void checkConvergenceExtraEqs(
const std::vector<Scalar>&
res,
438 void updateConnectionRatePolyMW(
const EvalWell&
cq_s_poly,
442 std::vector<RateVector>& connectionRates,
445 std::optional<Scalar>
447 const Simulator& simulator,
451 std::optional<Scalar>
452 computeBhpAtThpLimitInj(
const Simulator& simulator,
457 Eval connectionRateEnergy(
const std::vector<EvalWell>&
cq_s,
458 const IntensiveQuantities& intQuants,
462 Scalar cachedRefDensity{0};
467#include "StandardWell_impl.hpp"
Facility for converting component rates at surface conditions to phase (voidage) rates at reservoir c...
Contains the classes required to extend the black-oil model by bioeffects.
Contains the classes required to extend the black-oil model by brine.
Contains the classes required to extend the black-oil model by solvent component.
Contains the classes required to extend the black-oil model to include the effects of foam.
Contains the classes required to extend the black-oil model by polymer.
Contains the classes required to extend the black-oil model by solvents.
Contains the high level supplements required to extend the black oil model to include the effects of ...
Definition blackoilfoammodules.hh:58
Contains the high level supplements required to extend the black oil model by polymer.
Definition blackoilpolymermodules.hh:64
Represents the convergence status of the whole simulator, to make it possible to query and store the ...
Definition ConvergenceReport.hpp:38
Definition DeferredLogger.hpp:57
Definition GroupState.hpp:41
Class encapsulating some information about parallel wells.
Definition ParallelWellInfo.hpp:198
Definition StandardWellEval.hpp:46
Definition StandardWell.hpp:60
std::vector< Scalar > computeCurrentWellRates(const Simulator &ebosSimulator, DeferredLogger &deferred_logger) const override
Compute well rates based on current reservoir conditions and well variables.
Definition StandardWell_impl.hpp:2507
virtual void apply(const BVector &x, BVector &Ax) const override
Ax = Ax - C D^-1 B x.
Definition StandardWell_impl.hpp:1415
virtual ConvergenceReport getWellConvergence(const Simulator &simulator, const WellStateType &well_state, const std::vector< Scalar > &B_avg, DeferredLogger &deferred_logger, const bool relax_tolerance) const override
check whether the well equations get converged for this well
Definition StandardWell_impl.hpp:1186
void computeWellPotentials(const Simulator &simulator, const WellStateType &well_state, std::vector< Scalar > &well_potentials, DeferredLogger &deferred_logger) override
computing the well potentials for group control
Definition StandardWell_impl.hpp:1737
void recoverWellSolutionAndUpdateWellState(const Simulator &simulator, const BVector &x, WellStateType &well_state, DeferredLogger &deferred_logger) override
using the solution x to recover the solution xw for wells and applying xw to update Well State
Definition StandardWell_impl.hpp:1447
const std::string & name() const
Well name.
Definition WellInterfaceGeneric.cpp:168
Definition WellInterface.hpp:76
Collect per-connection static information to enable calculating connection-level or well-level produc...
Definition WellProdIndexCalculator.hpp:37
The state of a set of wells, tailored for use by the fully implicit blackoil simulator.
Definition WellState.hpp:66
This file contains a set of helper functions used by VFPProd / VFPInj.
Definition blackoilbioeffectsmodules.hh:43
constexpr auto getPropValue()
get the value data member of a property
Definition propertysystem.hh:240
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
Static data associated with a well perforation.
Definition PerforationData.hpp:30
Definition PerforationData.hpp:41