22 #ifndef OPM_MULTISEGMENTWELL_HEADER_INCLUDED 23 #define OPM_MULTISEGMENTWELL_HEADER_INCLUDED 27 #include <opm/simulators/wells/WellInterface.hpp> 28 #include <opm/simulators/wells/MultisegmentWellEval.hpp> 34 template<
typename TypeTag>
37 GetPropType<TypeTag, Properties::Indices>>
44 using typename Base::Simulator;
45 using typename Base::IntensiveQuantities;
46 using typename Base::FluidSystem;
47 using typename Base::IndexTraits;
48 using typename Base::ModelParameters;
49 using typename Base::MaterialLaw;
50 using typename Base::Indices;
51 using typename Base::RateConverterType;
52 using typename Base::SparseMatrixAdapter;
53 using typename Base::FluidState;
57 using Base::has_solvent;
58 using Base::has_polymer;
63 using typename Base::Scalar;
66 using typename Base::BVector;
67 using typename Base::Eval;
70 using typename MSWEval::EvalWell;
71 using typename MSWEval::BVectorWell;
73 using typename Base::PressureMatrix;
74 using FSInfo = std::tuple<Scalar,typename std::decay<decltype(std::declval<decltype(std::declval<const Simulator&>().model().intensiveQuantities(0, 0).fluidState())>().saltConcentration())>::type>;
79 const ModelParameters& param,
80 const RateConverterType& rate_converter,
81 const int pvtRegionIdx,
82 const int num_conservation_quantities,
84 const int index_of_well,
87 void init(
const std::vector<Scalar>& depth_arg,
88 const Scalar gravity_arg,
89 const std::vector<Scalar>& B_avg,
90 const bool changed_to_open_this_step)
override;
102 const std::vector<Scalar>& B_avg,
103 const bool relax_tolerance)
const override;
106 void apply(
const BVector& x, BVector& Ax)
const override;
108 void apply(BVector& r)
const override;
121 std::vector<Scalar>& well_potentials)
override;
125 void solveEqAndUpdateWellState(
const Simulator& simulator,
129 void calculateExplicitQuantities(
const Simulator& simulator,
132 void updateIPRImplicit(
const Simulator& simulator,
136 void updateProductivityIndex(
const Simulator& simulator,
141 Scalar connectionDensity(
const int globalConnIdx,
142 const int openConnIdx)
const override;
144 void addWellContributions(SparseMatrixAdapter& jacobian)
const override;
146 void addWellPressureEquations(PressureMatrix& mat,
148 const int pressureVarIndex,
149 const bool use_well_weights,
156 std::optional<Scalar>
157 computeBhpAtThpLimitProdWithAlq(
const Simulator& simulator,
159 const SummaryState& summary_state,
160 const Scalar alq_value,
161 bool iterate_if_no_solution)
const override;
163 std::vector<Scalar> getPrimaryVars()
const override;
165 int setPrimaryVars(
typename std::vector<Scalar>::const_iterator it)
override;
172 std::vector<std::vector<Scalar> > segment_fluid_initial_;
174 mutable int debug_cost_counter_ = 0;
177 void updateWellState(
const Simulator& simulator,
178 const BVectorWell& dwells,
181 const Scalar relaxation_factor = 1.0);
184 void computeInitialSegmentFluids(
const Simulator& simulator,
DeferredLogger& deferred_logger);
187 void computePerfCellPressDiffs(
const Simulator& simulator);
189 template<
class Value>
190 void computePerfRate(
const IntensiveQuantities& int_quants,
191 const std::vector<Value>& mob_perfcells,
192 const std::vector<Value>& Tw,
195 const Value& segment_pressure,
196 const bool& allow_cf,
197 std::vector<Value>& cq_s,
202 template<
class Value>
203 void computePerfRate(
const Value& pressure_cell,
206 const std::vector<Value>& b_perfcells,
207 const std::vector<Value>& mob_perfcells,
208 const std::vector<Value>& Tw,
210 const Value& segment_pressure,
211 const Value& segment_density,
212 const bool& allow_cf,
213 const std::vector<Value>& cmix_s,
214 std::vector<Value>& cq_s,
221 void computeSegmentFluidProperties(
const Simulator& simulator,
225 template<
class Value>
226 void getTransMult(Value& trans_mult,
227 const Simulator& simulator,
228 const int cell_indx)
const;
231 template<
class Value>
232 void getMobility(
const Simulator& simulator,
233 const int local_perf_index,
234 std::vector<Value>& mob,
237 void computeWellRatesAtBhpLimit(
const Simulator& simulator,
239 std::vector<Scalar>& well_flux)
const;
241 void computeWellRatesWithBhp(
const Simulator& simulator,
243 std::vector<Scalar>& well_flux,
246 void computeWellRatesWithBhpIterations(
const Simulator& simulator,
249 std::vector<Scalar>& well_flux)
const override;
253 const Simulator& simulator,
256 bool computeWellPotentialsImplicit(
const Simulator& simulator,
258 std::vector<Scalar>& well_potentials)
const;
260 Scalar getRefDensity()
const override;
262 bool iterateWellEqWithControl(
const Simulator& simulator,
264 const Well::InjectionControls& inj_controls,
265 const Well::ProductionControls& prod_controls,
269 bool iterateWellEqWithSwitching(
const Simulator& simulator,
271 const Well::InjectionControls& inj_controls,
272 const Well::ProductionControls& prod_controls,
275 const bool fixed_control,
276 const bool fixed_status,
277 const bool solving_with_zero_rate)
override;
279 void assembleWellEqWithoutIteration(
const Simulator& simulator,
282 const Well::InjectionControls& inj_controls,
283 const Well::ProductionControls& prod_controls,
285 const bool solving_with_zero_rate)
override;
287 void updateWaterThroughput(
const double dt,
WellStateType& well_state)
const override;
289 EvalWell getSegmentSurfaceVolume(
const Simulator& simulator,
298 bool openCrossFlowAvoidSingularity(
const Simulator& simulator)
const;
302 bool allDrawDownWrongDirection(
const Simulator& simulator)
const;
304 std::optional<Scalar>
306 const Simulator& ebos_simulator,
308 const SummaryState& summary_state)
const;
310 std::optional<Scalar>
311 computeBhpAtThpLimitInj(
const Simulator& ebos_simulator,
313 const SummaryState& summary_state)
const;
315 Scalar maxPerfPress(
const Simulator& simulator)
const override;
318 void checkOperabilityUnderBHPLimit(
const WellStateType& well_state,
319 const Simulator& ebos_simulator,
323 void checkOperabilityUnderTHPLimit(
const Simulator& ebos_simulator,
328 void updateIPR(
const Simulator& ebos_simulator,
331 FSInfo getFirstPerforationFluidStateInfo(
const Simulator& simulator)
const;
336 #include "MultisegmentWell_impl.hpp" 338 #endif // OPM_MULTISEGMENTWELL_HEADER_INCLUDED 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: MultisegmentWell_impl.hpp:202
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
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: MultisegmentWell_impl.hpp:296
Defines the common properties required by the porous medium multi-phase models.
This file contains a set of helper functions used by VFPProd / VFPInj.
Definition: blackoilbioeffectsmodules.hh:45
Definition: BlackoilWellModelConstraints.hpp:37
void scaleSegmentRatesAndPressure(WellStateType &well_state) const override
updating the segment pressure and rates based the current bhp and well rates
Definition: MultisegmentWell_impl.hpp:172
Definition: BlackoilWellModelGasLift.hpp:38
Definition: PerforationData.hpp:40
void apply(const BVector &x, BVector &Ax) const override
Ax = Ax - C D^-1 B x.
Definition: MultisegmentWell_impl.hpp:228
Definition: MultisegmentWellEval.hpp:46
Class encapsulating some information about parallel wells.
Definition: MSWellHelpers.hpp:34
std::vector< Scalar > computeCurrentWellRates(const Simulator &simulator, DeferredLogger &deferred_logger) const override
Compute well rates based on current reservoir conditions and well variables.
Definition: MultisegmentWell_impl.hpp:2277
Definition: DeferredLogger.hpp:56
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
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: MultisegmentWell_impl.hpp:263
void updateWellStateWithTarget(const Simulator &simulator, const GroupStateHelperType &groupStateHelper, WellStateType &well_state) const override
updating the well state based the current control mode
Definition: MultisegmentWell_impl.hpp:183
Represents the convergence status of the whole simulator, to make it possible to query and store the ...
Definition: ConvergenceReport.hpp:37
The state of a set of wells, tailored for use by the fully implicit blackoil simulator.
Definition: TemperatureModel.hpp:61
Definition: MultisegmentWell.hpp:35