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>>
70 using typename Base::Simulator;
71 using typename Base::IntensiveQuantities;
72 using typename Base::FluidSystem;
73 using typename Base::MaterialLaw;
74 using typename Base::ModelParameters;
75 using typename Base::Indices;
76 using typename Base::RateConverterType;
77 using typename Base::SparseMatrixAdapter;
78 using typename Base::FluidState;
79 using typename Base::RateVector;
82 using Base::has_solvent;
83 using Base::has_zFraction;
84 using Base::has_polymer;
85 using Base::has_polymermw;
87 using Base::has_brine;
88 using Base::has_energy;
89 using Base::has_bioeffects;
94 using typename Base::PressureMatrix;
97 static constexpr
int numWellConservationEq = Indices::numPhases + Indices::numSolvents;
99 static constexpr
int numWellControlEq = 1;
102 static constexpr
int numStaticWellEq = numWellConservationEq + numWellControlEq;
107 static constexpr
int Bhp = numStaticWellEq - numWellControlEq;
109 using StdWellEval::WQTotal;
111 using typename Base::Scalar;
118 using typename Base::BVector;
120 using Eval =
typename StdWellEval::Eval;
121 using EvalWell =
typename StdWellEval::EvalWell;
122 using BVectorWell =
typename StdWellEval::BVectorWell;
124 using IndexTraits =
typename FluidSystem::IndexTraitsType;
130 const ModelParameters& param,
131 const RateConverterType& rate_converter,
132 const int pvtRegionIdx,
133 const int num_conservation_quantities,
134 const int num_phases,
135 const int index_of_well,
138 virtual void init(
const std::vector<Scalar>& depth_arg,
139 const Scalar gravity_arg,
140 const std::vector<Scalar>& B_avg,
141 const bool changed_to_open_this_step)
override;
145 const std::vector<Scalar>& B_avg,
146 const bool relax_tolerance)
const override;
149 virtual void apply(
const BVector& x, BVector& Ax)
const override;
151 virtual void apply(BVector& r)
const override;
164 std::vector<Scalar>& well_potentials)
override;
168 void solveEqAndUpdateWellState(
const Simulator& simulator,
172 void calculateExplicitQuantities(
const Simulator& simulator,
175 void updateProductivityIndex(
const Simulator& simulator,
180 Scalar connectionDensity(
const int globalConnIdx,
181 const int openConnIdx)
const override;
183 void addWellContributions(SparseMatrixAdapter& mat)
const override;
185 void addWellPressureEquations(PressureMatrix& mat,
187 const int pressureVarIndex,
188 const bool use_well_weights,
192 bool iterateWellEqWithControl(
const Simulator& simulator,
194 const Well::InjectionControls& inj_controls,
195 const Well::ProductionControls& prod_controls,
200 bool iterateWellEqWithSwitching(
const Simulator& simulator,
202 const Well::InjectionControls& inj_controls,
203 const Well::ProductionControls& prod_controls,
206 const bool fixed_control,
207 const bool fixed_status,
208 const bool solving_with_zero_rate)
override;
211 Scalar computeWellRatesAndBhpWithThpAlqProd(
const Simulator& ebos_simulator,
213 const SummaryState &summary_state,
214 std::vector<Scalar>& potentials,
217 void computeWellRatesWithThpAlqProd(
const Simulator& ebos_simulator,
219 const SummaryState& summary_state,
220 std::vector<Scalar>& potentials,
223 std::optional<Scalar>
224 computeBhpAtThpLimitProdWithAlq(
const Simulator& ebos_simulator,
226 const SummaryState& summary_state,
227 const Scalar alq_value,
228 bool iterate_if_no_solution)
const override;
230 void updateIPRImplicit(
const Simulator& simulator,
234 void computeWellRatesWithBhp(
const Simulator& ebosSimulator,
236 std::vector<Scalar>& well_flux,
239 Scalar maxPerfPress(
const Simulator& simulator)
const override;
242 using Base::vfp_properties_;
248 std::vector<Scalar> getPrimaryVars()
const override;
250 int setPrimaryVars(
typename std::vector<Scalar>::const_iterator it)
override;
256 void updateWellState(
const Simulator& simulator,
257 const BVectorWell& dwells,
261 using WellConnectionProps =
typename StdWellEval::StdWellConnections::Properties;
266 computePropertiesForWellConnectionPressures(
const Simulator& simulator,
269 void computeWellConnectionDensitesPressures(
const Simulator& simulator,
271 const WellConnectionProps& props);
273 void computeWellConnectionPressures(
const Simulator& simulator,
276 template<
class Value>
277 void computePerfRate(
const IntensiveQuantities& intQuants,
278 const std::vector<Value>& mob,
280 const std::vector<Value>& Tw,
283 std::vector<Value>& cq_s,
287 template<
class Value>
288 void computePerfRate(
const std::vector<Value>& mob,
289 const Value& pressure,
295 std::vector<Value>& b_perfcells_dense,
296 const std::vector<Value>& Tw,
299 const Value& skin_pressure,
300 const std::vector<Value>& cmix_s,
301 std::vector<Value>& cq_s,
305 void computeWellRatesWithBhpIterations(
const Simulator& ebosSimulator,
308 std::vector<Scalar>& well_flux)
const override;
311 computeWellPotentialWithTHP(
const Simulator& ebosSimulator,
315 bool computeWellPotentialsImplicit(
const Simulator& ebos_simulator,
317 std::vector<Scalar>& well_potentials)
const;
321 Scalar getRefDensity()
const override;
324 template<
class Value>
325 void getTransMult(Value& trans_mult,
326 const Simulator& simulator,
327 const int cell_indx)
const;
330 template<
class Value>
331 void getMobility(
const Simulator& simulator,
333 std::vector<Value>& mob,
336 void updateWaterMobilityWithPolymer(
const Simulator& simulator,
338 std::vector<EvalWell>& mob_water,
341 void updatePrimaryVariablesNewton(
const BVectorWell& dwells,
342 const bool stop_or_zero_rate_target,
345 void updateWellStateFromPrimaryVariables(
WellStateType& well_state,
346 const SummaryState& summary_state,
349 void assembleWellEqWithoutIteration(
const Simulator& simulator,
352 const Well::InjectionControls& inj_controls,
353 const Well::ProductionControls& prod_controls,
355 const bool solving_with_zero_rate)
override;
357 void assembleWellEqWithoutIterationImpl(
const Simulator& simulator,
360 const Well::InjectionControls& inj_controls,
361 const Well::ProductionControls& prod_controls,
363 const bool solving_with_zero_rate);
365 void calculateSinglePerf(
const Simulator& simulator,
368 std::vector<RateVector>& connectionRates,
369 std::vector<EvalWell>& cq_s,
370 EvalWell& water_flux_s,
371 EvalWell& cq_s_zfrac_effective,
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;
403 EvalWell pskin(
const Scalar throughput,
404 const EvalWell& water_velocity,
405 const EvalWell& poly_inj_conc,
409 EvalWell pskinwater(
const Scalar throughput,
410 const EvalWell& water_velocity,
414 EvalWell wpolymermw(
const Scalar throughput,
415 const EvalWell& water_velocity,
419 void handleInjectivityRate(
const Simulator& simulator,
421 std::vector<EvalWell>& cq_s)
const;
424 void handleInjectivityEquations(
const Simulator& simulator,
427 const EvalWell& water_flux_s,
430 void updateWaterThroughput(
const double dt,
434 void checkConvergenceExtraEqs(
const std::vector<Scalar>& res,
438 void updateConnectionRatePolyMW(
const EvalWell& cq_s_poly,
439 const IntensiveQuantities& int_quants,
442 std::vector<RateVector>& connectionRates,
445 std::optional<Scalar>
447 const Simulator& simulator,
449 const SummaryState& summary_state)
const;
451 std::optional<Scalar>
452 computeBhpAtThpLimitInj(
const Simulator& simulator,
454 const SummaryState& summary_state)
const;
457 Eval connectionRateEnergy(
const std::vector<EvalWell>& cq_s,
458 const IntensiveQuantities& intQuants,
462 Scalar cachedRefDensity{0};
467 #include "StandardWell_impl.hpp" 469 #endif // OPM_STANDARDWELL_HEADER_INCLUDED Contains the classes required to extend the black-oil model to include the effects of foam...
Definition: StandardWellEval.hpp:45
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
Contains the high level supplements required to extend the black oil model to include the effects of ...
Definition: blackoilfoammodules.hh:59
Contains the classes required to extend the black-oil model by solvent component. ...
virtual ConvergenceReport getWellConvergence(const GroupStateHelperType &groupStateHelper, const std::vector< Scalar > &B_avg, const bool relax_tolerance) const override
check whether the well equations get converged for this well
Definition: StandardWell_impl.hpp:1226
Contains the classes required to extend the black-oil model by solvents.
Definition: StandardWell.hpp:57
This file contains a set of helper functions used by VFPProd / VFPInj.
Definition: blackoilbioeffectsmodules.hh:45
Definition: BlackoilWellModelConstraints.hpp:37
Facility for converting component rates at surface conditions to phase (voidage) rates at reservoir c...
void recoverWellSolutionAndUpdateWellState(const Simulator &simulator, const BVector &x, const GroupStateHelperType &groupStateHelper, WellStateType &well_state) override
using the solution x to recover the solution xw for wells and applying xw to update Well State ...
Definition: StandardWell_impl.hpp:1485
Definition: BlackoilWellModelGasLift.hpp:38
Definition: PerforationData.hpp:40
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:2586
Class encapsulating some information about parallel wells.
Definition: MSWellHelpers.hpp:34
Definition: DeferredLogger.hpp:56
Contains the classes required to extend the black-oil model by brine.
Collect per-connection static information to enable calculating connection-level or well-level produc...
Definition: WellProdIndexCalculator.hpp:36
Static data associated with a well perforation.
Definition: BlackoilWellModelRestart.hpp:41
Represents the convergence status of the whole simulator, to make it possible to query and store the ...
Definition: ConvergenceReport.hpp:37
virtual void apply(const BVector &x, BVector &Ax) const override
Ax = Ax - C D^-1 B x.
Definition: StandardWell_impl.hpp:1453
const std::string & name() const
Well name.
Definition: WellInterfaceGeneric.cpp:167
void computeWellPotentials(const Simulator &simulator, const WellStateType &well_state, const GroupStateHelperType &groupStateHelper, std::vector< Scalar > &well_potentials) override
computing the well potentials for group control
Definition: StandardWell_impl.hpp:1796
Contains the classes required to extend the black-oil model by bioeffects.
Contains the classes required to extend the black-oil model by polymer.
Contains the high level supplements required to extend the black oil model by polymer.
Definition: blackoilpolymermodules.hh:64
The state of a set of wells, tailored for use by the fully implicit blackoil simulator.
Definition: TemperatureModel.hpp:61