MultisegmentWell.hpp
Go to the documentation of this file.
1/*
2 Copyright 2017 SINTEF Digital, Mathematics and Cybernetics.
3 Copyright 2017 Statoil ASA.
4
5 This file is part of the Open Porous Media project (OPM).
6
7 OPM is free software: you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation, either version 3 of the License, or
10 (at your option) any later version.
11
12 OPM is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
16
17 You should have received a copy of the GNU General Public License
18 along with OPM. If not, see <http://www.gnu.org/licenses/>.
19*/
20
21
22#ifndef OPM_MULTISEGMENTWELL_HEADER_INCLUDED
23#define OPM_MULTISEGMENTWELL_HEADER_INCLUDED
24
26
27#include <opm/common/Exceptions.hpp>
30
31#include <limits>
32#include <string_view>
33
34namespace Opm {
35
36 class DeferredLogger;
37
38 template<typename TypeTag>
39 class MultisegmentWell : public WellInterface<TypeTag>
40 , public MultisegmentWellEval<GetPropType<TypeTag, Properties::FluidSystem>,
41 GetPropType<TypeTag, Properties::Indices>>
42 {
43 public:
47
48 using typename Base::Simulator;
49 using typename Base::IntensiveQuantities;
50 using typename Base::FluidSystem;
51 using typename Base::IndexTraits;
52 using typename Base::ModelParameters;
53 using typename Base::MaterialLaw;
54 using typename Base::Indices;
55 using typename Base::RateConverterType;
56 using typename Base::SparseMatrixAdapter;
57 using typename Base::FluidState;
58 using typename Base::WellStateType;
59 using typename Base::GroupStateHelperType;
60
63 using Base::has_energy;
64 using Base::has_brine;
65 using Base::Water;
66 using Base::Oil;
67 using Base::Gas;
68
69 using typename Base::Scalar;
70
71 // True when the composition switch primary variable is active, i.e. both oil and
72 // gas phases are present so that Rs/Rv are stored in the fluid state. Matches the
73 // fluid state's enableDissolution flag (see WellInterface::BlackOilFluidStateType).
74 static constexpr bool compositionSwitchEnabled =
75 Indices::compositionSwitchIdx != std::numeric_limits<unsigned>::max();
76
77 // True when the segment fluid state stores a temperature. This includes thermal modes
78 // without a fully implicit energy equation.
79 static constexpr bool enable_temperature =
80 Base::energyModuleType != EnergyModules::NoTemperature;
81
82 // Scales the well-side energy equation onto the mass-balance residual
83 // scale. Reuses the reservoir energy factor so both live on the same scale.
84 static constexpr Scalar energy_scaling_factor_ =
85 getPropValue<TypeTag, Properties::BlackOilEnergyScalingFactor>();
86
88 using typename Base::BVector;
89 using typename Base::Eval;
90
91 using typename MSWEval::Equations;
92 using typename MSWEval::EvalWell;
93 using typename MSWEval::BVectorWell;
94 using MSWEval::SPres;
95 using typename Base::PressureMatrix;
96 using FSInfo = typename Base::FSInfo;
97
98 using BMatrix = typename Base::BMatrix;
99 using CMatrix = typename Base::CMatrix;
100 using DMatrix = typename Base::DMatrix;
101 using WVector = typename Base::WVector;
102
103 // a fluid state to calculate the properties inside the wellbore for each segment
104 // it will be probably used for more things, but at the moment, it is for the enthalpy
105 // calculation in the wellbore.
106 template <typename ValueType>
108
109 // The segment fluid state type depends on the TypeTag, which MultisegmentWellSegments
110 // does not have. Extract the values it needs so its property calculations can stay in
111 // the .cpp file.
113
114 MultisegmentWell(const Well& well,
115 const ParallelWellInfo<Scalar>& pw_info,
116 const int time_step,
117 const ModelParameters& param,
118 const RateConverterType& rate_converter,
119 const int pvtRegionIdx,
120 const int num_conservation_quantities,
121 const int num_phases,
122 const int index_of_well,
123 const std::vector<PerforationData<Scalar>>& perf_data);
124
125 void init(const std::vector<Scalar>& depth_arg,
126 const Scalar gravity_arg,
127 const std::vector<Scalar>& B_avg,
128 const bool changed_to_open_this_step) override;
129
131 void updateWellStateWithTarget(const Simulator& simulator,
132 const GroupStateHelperType& groupStateHelper,
133 WellStateType& well_state) const override;
134
136 void scaleSegmentRatesAndPressure(WellStateType& well_state) const override;
137
140 const std::vector<Scalar>& B_avg,
141 const bool relax_tolerance) const override;
142
144 void apply(const BVector& x, BVector& Ax) const override;
146 void apply(BVector& r) const override;
147
151 const BVector& x,
152 const GroupStateHelperType& groupStateHelper,
153 WellStateType& well_state) override;
154
156 void computeWellPotentials(const Simulator& simulator,
157 const WellStateType& well_state,
158 const GroupStateHelperType& groupStateHelper,
159 std::vector<Scalar>& well_potentials) override;
160
161 void updatePrimaryVariables(const GroupStateHelperType& groupStateHelper) override;
162
163 void solveEqAndUpdateWellState(const Simulator& simulator,
164 const GroupStateHelperType& groupStateHelper,
165 WellStateType& well_state) override; // const?
166
167 void calculateExplicitQuantities(const Simulator& simulator,
168 const GroupStateHelperType& groupStateHelper) override; // should be const?
169
170 void updateIPRImplicit(const Simulator& simulator,
171 const GroupStateHelperType& groupStateHelper,
172 WellStateType& well_state) override;
173
174 void updateProductivityIndex(const Simulator& simulator,
175 const WellProdIndexCalculator<Scalar>& wellPICalc,
176 WellStateType& well_state,
177 DeferredLogger& deferred_logger) const override;
178
179 Scalar connectionDensity(const int globalConnIdx,
180 const int openConnIdx) const override;
181
182 void addWellContributions(SparseMatrixAdapter& jacobian) const override;
183
185 const BVector& x,
186 const int pressureVarIndex,
187 const bool use_well_weights,
188 const WellStateType& well_state) const override;
189
190 std::vector<Scalar>
191 computeCurrentWellRates(const Simulator& simulator,
192 DeferredLogger& deferred_logger) const override;
193
194 std::optional<Scalar>
196 const GroupStateHelperType& groupStateHelper,
197 const SummaryState& summary_state,
198 const Scalar alq_value,
199 bool iterate_if_no_solution) const override;
200
201 std::vector<Scalar> getPrimaryVars() const override;
202
203 int setPrimaryVars(typename std::vector<Scalar>::const_iterator it) override;
204 void addBCDMatrix(std::vector<typename Base::BMatrix>& b_matrices,
205 std::vector<typename Base::CMatrix>& c_matrices,
206 std::vector<typename Base::DMatrix>& d_matrices,
207 Opm::SparseTable<int>& wcells) const override
208 {
209 // System_cpr preconditioner is only supported when well DOF dimensions
210 // match between WellInterface and MultisegmentWellEval (standard 3-phase blackoil).
211 if constexpr (Base::numWellDofs == MSWEval::numWellDofs) {
212 MSWEval::addBCDMatrix(b_matrices, c_matrices, d_matrices, wcells);
213 } else {
214 OPM_THROW(std::runtime_error,
215 "system_cpr preconditioner with multisegment wells is only supported for standard "
216 "3-phase blackoil (Indices::numEq == 3). This model has different equation count.");
217 }
218 }
219
220 void getScaledWellFractions(std::vector<Scalar>& scaled_fractions,
221 DeferredLogger& deferred_logger) const override;
222
223 protected:
224 // regularize msw equation
226
227 // the initial amount of fluids in each segment under surface condition
228 std::vector<std::vector<Scalar> > segment_fluid_initial_;
229 // total energy inside the segments at the beginning of the time step
230 std::vector<Scalar> segment_initial_energy_;
231
232 // segment fluid state
233 std::vector<SegmentFluidState<EvalWell>> segment_fluid_state_;
234
235 // the values MultisegmentWellSegments needs from the segment fluid states, refilled
236 // from segment_fluid_state_ before the segment properties are computed
237 std::vector<SegmentPvt> segment_pvt_;
238
239 // fluid state under the wellhead condition, it is used to calculate the enthalpy
240 // under operation condition for energy injection
241 // because BHP will be involved, we use EvalWell type here
243
244 mutable int debug_cost_counter_ = 0;
245
246 // updating the well_state based on well solution dwells
247 void updateWellState(const Simulator& simulator,
248 const BVectorWell& dwells,
249 const GroupStateHelperType& groupStateHelper,
250 WellStateType& well_state,
251 const Scalar relaxation_factor = 1.0);
252
253 // Compute the initial segment inventory for well equations. Requires an up-to-date
254 // segment fluid state (see updateSegmentFluidState()).
255 void computeInitialSegmentInventory(DeferredLogger& deferred_logger);
256
257 // compute the pressure difference between the perforation and cell center
258 void computePerfCellPressDiffs(const Simulator& simulator);
259
260 template<class Value>
261 void computePerfRate(const IntensiveQuantities& int_quants,
262 const std::vector<Value>& mob_perfcells,
263 const std::vector<Value>& Tw,
264 const int seg,
265 const int perf,
266 const Value& segment_pressure,
267 const bool& allow_cf,
268 std::vector<Value>& cq_s,
269 Value& perf_press,
270 PerforationRates<Scalar>& perf_rates,
271 DeferredLogger& deferred_logger) const;
272
273 template<class Value>
274 void computePerfRate(const Value& pressure_cell,
275 const Value& rs,
276 const Value& rv,
277 const std::vector<Value>& b_perfcells,
278 const std::vector<Value>& mob_perfcells,
279 const std::vector<Value>& Tw,
280 const int perf,
281 const Value& segment_pressure,
282 const Value& segment_density,
283 const bool& allow_cf,
284 const std::vector<Value>& cmix_s,
285 std::vector<Value>& cq_s,
286 Value& perf_press,
287 PerforationRates<Scalar>& perf_rates,
288 DeferredLogger& deferred_logger) const;
289
290 // compute the fluid properties, such as densities, viscosities, and so on, in the segments
291 // They will be treated implicitly, so they need to be of Evaluation type
292 void computeSegmentFluidProperties(const Simulator& simulator,
293 DeferredLogger& deferred_logger);
294
295 // get the transmissibility multiplier for specific perforation
296 template<class Value>
297 void getTransMult(Value& trans_mult,
298 const Simulator& simulator,
299 const int cell_indx) const;
300
301 // get the mobility for specific perforation
302 template<class Value>
303 void getMobility(const Simulator& simulator,
304 const int local_perf_index,
305 std::vector<Value>& mob,
306 DeferredLogger& deferred_logger) const;
307
308 void computeWellRatesAtBhpLimit(const Simulator& simulator,
309 const GroupStateHelperType& groupStateHelper,
310 std::vector<Scalar>& well_flux) const;
311
312 void computeWellRatesWithBhp(const Simulator& simulator,
313 const Scalar& bhp,
314 std::vector<Scalar>& well_flux,
315 DeferredLogger& deferred_logger) const override;
316
317 void computeWellRatesWithBhpIterations(const Simulator& simulator,
318 const Scalar& bhp,
319 const GroupStateHelperType& groupStateHelper,
320 std::vector<Scalar>& well_flux) const override;
321
322 std::vector<Scalar>
324 const Simulator& simulator,
325 const GroupStateHelperType& groupStateHelper) const;
326
327 bool computeWellPotentialsImplicit(const Simulator& simulator,
328 const GroupStateHelperType& groupStateHelper,
329 std::vector<Scalar>& well_potentials) const;
330
331 Scalar getRefDensity() const override;
332
333 bool iterateWellEqWithControl(const Simulator& simulator,
334 const double dt,
335 const Well::InjectionControls& inj_controls,
336 const Well::ProductionControls& prod_controls,
337 const GroupStateHelperType& groupStateHelper,
338 WellStateType& well_state) override;
339
340 bool iterateWellEqWithSwitching(const Simulator& simulator,
341 const double dt,
342 const Well::InjectionControls& inj_controls,
343 const Well::ProductionControls& prod_controls,
344 const GroupStateHelperType& groupStateHelper,
345 WellStateType& well_state,
346 const bool fixed_control,
347 const bool fixed_status,
348 const bool solving_with_zero_rate) override;
349
350 void assembleWellEqWithoutIteration(const Simulator& simulator,
351 const GroupStateHelperType& groupStateHelper,
352 const double dt,
353 const Well::InjectionControls& inj_controls,
354 const Well::ProductionControls& prod_controls,
355 WellStateType& well_state,
356 const bool solving_with_zero_rate) override;
357
358 void updateWaterThroughput(const double dt, WellStateType& well_state) const override;
359
360 // Compute segment surface volume from the given volume ratio.
361 EvalWell getSegmentSurfaceVolume(const int seg_idx,
362 const EvalWell& volume_ratio) const;
363
364 // turn on crossflow to avoid singular well equations
365 // when the well is banned from cross-flow and the BHP is not properly initialized,
366 // we turn on crossflow to avoid singular well equations. It can result in wrong-signed
367 // well rates, it can cause problem for THP calculation
368 // TODO: looking for better alternative to avoid wrong-signed well rates
369 bool openCrossFlowAvoidSingularity(const Simulator& simulator) const;
370
371 // for a well, when all drawdown are in the wrong direction, then this well will not
372 // be able to produce/inject .
373 bool allDrawDownWrongDirection(const Simulator& simulator) const;
374
375 std::optional<Scalar>
376 computeBhpAtThpLimitProd(const WellStateType& well_state,
377 const Simulator& ebos_simulator,
378 const GroupStateHelperType& groupStateHelper,
379 const SummaryState& summary_state) const;
380
381 std::optional<Scalar>
382 computeBhpAtThpLimitInj(const Simulator& ebos_simulator,
383 const GroupStateHelperType& groupStateHelper,
384 const SummaryState& summary_state) const;
385
386 Scalar maxPerfPress(const Simulator& simulator) const override;
387
388 // check whether the well is operable under BHP limit with current reservoir condition
389 void checkOperabilityUnderBHPLimit(const WellStateType& well_state,
390 const Simulator& ebos_simulator,
391 DeferredLogger& deferred_logger) override;
392
393 // check whether the well is operable under THP limit with current reservoir condition
394 void checkOperabilityUnderTHPLimit(const Simulator& ebos_simulator,
395 const WellStateType& well_state,
396 const GroupStateHelperType& groupStateHelper) override;
397
398 // updating the inflow based on the current reservoir condition
399 void updateIPR(const Simulator& ebos_simulator,
400 DeferredLogger& deferred_logger) const override;
401
402 // this function can potentially be shared between multisegment wells and standard wells
403 template <typename ValueType = EvalWell>
405 createFluidState(const std::vector<ValueType>& fluid_composition,
406 const ValueType& pressure,
407 const ValueType& temperature,
408 const ValueType& saltConcentration,
409 DeferredLogger& deferred_logger) const;
410
412 createSegmentFluidState(int seg, const FSInfo& info, DeferredLogger& deferred_logger) const;
413
414 SegmentPvt segmentPvt(const SegmentFluidState<EvalWell>& fluid_state) const;
415
416 // assemble the energy equation contribution for a single perforation/connection
418 const std::vector<EvalWell>& cq_s,
419 const int seg,
420 const int local_perf_index,
421 DeferredLogger& deferred_logger);
422
423 void updateWellHeadCondition(const Simulator& simulator,
424 const Scalar first_perf_temperature,
425 const Scalar first_perf_salt_concentration,
426 DeferredLogger& deferred_logger);
427
428 void updateSegmentFluidState(const FSInfo& info, DeferredLogger& deferred_logger);
429
430 template <typename ValueType = EvalWell>
431 ValueType computeSegmentEnergy(int seg) const;
432
433 // Convert per-component surface volumetric rates to a phase reservoir
434 // volumetric rate, using @p fs (upwind) for the rs/rv coupling. If
435 // (1 - rs*rv) <= 0, falls back to rate / invB (drops the cross-terms but
436 // keeps @p fs's invB; Rs/Rv unchanged) and logs a @p context debug message.
437 // @p fs may be a wellbore SegmentFluidState (EvalWell) or a reservoir-cell
438 // fluid state (Eval, extended to EvalWell on the fly).
439 // @return the reservoir volumetric rate of @p phaseIdx.
440 template <typename FluidStateT>
441 EvalWell surfaceToReservoirRate(unsigned phaseIdx,
442 const FluidStateT& fs,
443 const std::vector<EvalWell>& surface_rates,
444 int seg,
445 std::string_view context,
446 DeferredLogger& deferred_logger) const;
447
448 // Compute the energy flux carried by fluid flowing from segment
449 // @p seg toward its outlet, using @p upwind_fs as the upwind
450 // fluid state. @p context is used in diagnostic messages.
451 // @return the energy flux as sum_phases(reservoir_rate * enthalpy * density).
453 int upwind_seg,
454 const SegmentFluidState<EvalWell>& upwind_fs,
455 std::string_view context,
456 DeferredLogger& deferred_logger) const;
457 };
458
459} // namespace Opm
460
462
463#endif // OPM_MULTISEGMENTWELL_HEADER_INCLUDED
Definition: ConvergenceReport.hpp:38
Definition: DeferredLogger.hpp:57
Definition: GroupStateHelper.hpp:56
Definition: MultisegmentWellEval.hpp:50
MultisegmentWellEquations< Scalar, IndexTraits, numWellEq, Indices::numEq > Equations
Definition: MultisegmentWellEval.hpp:64
void addBCDMatrix(std::vector< BMatrix > &b_matrices, std::vector< CMatrix > &c_matrices, std::vector< DMatrix > &d_matrices, Opm::SparseTable< int > &wcells) const
Definition: MultisegmentWell.hpp:42
bool computeWellPotentialsImplicit(const Simulator &simulator, const GroupStateHelperType &groupStateHelper, std::vector< Scalar > &well_potentials) const
Definition: MultisegmentWell_impl.hpp:536
bool iterateWellEqWithSwitching(const Simulator &simulator, const double dt, const Well::InjectionControls &inj_controls, const Well::ProductionControls &prod_controls, const GroupStateHelperType &groupStateHelper, WellStateType &well_state, const bool fixed_control, const bool fixed_status, const bool solving_with_zero_rate) override
Definition: MultisegmentWell_impl.hpp:1678
std::vector< Scalar > segment_initial_energy_
Definition: MultisegmentWell.hpp:230
SegmentFluidState< EvalWell > wellhead_fluid_state_
Definition: MultisegmentWell.hpp:242
void updateWellState(const Simulator &simulator, const BVectorWell &dwells, const GroupStateHelperType &groupStateHelper, WellStateType &well_state, const Scalar relaxation_factor=1.0)
Definition: MultisegmentWell_impl.hpp:723
void updateWaterThroughput(const double dt, WellStateType &well_state) const override
Definition: MultisegmentWell_impl.hpp:2178
void addWellPressureEquations(PressureMatrix &mat, const BVector &x, const int pressureVarIndex, const bool use_well_weights, const WellStateType &well_state) const override
Definition: MultisegmentWell_impl.hpp:904
void assembleWellEqWithoutIteration(const Simulator &simulator, const GroupStateHelperType &groupStateHelper, const double dt, const Well::InjectionControls &inj_controls, const Well::ProductionControls &prod_controls, WellStateType &well_state, const bool solving_with_zero_rate) override
Definition: MultisegmentWell_impl.hpp:1858
Scalar connectionDensity(const int globalConnIdx, const int openConnIdx) const override
Definition: MultisegmentWell_impl.hpp:869
void addWellContributions(SparseMatrixAdapter &jacobian) const override
Definition: MultisegmentWell_impl.hpp:891
void getTransMult(Value &trans_mult, const Simulator &simulator, const int cell_indx) const
Definition: MultisegmentWell_impl.hpp:1194
typename Base::FSInfo FSInfo
Definition: MultisegmentWell.hpp:96
EvalWell surfaceToReservoirRate(unsigned phaseIdx, const FluidStateT &fs, const std::vector< EvalWell > &surface_rates, int seg, std::string_view context, DeferredLogger &deferred_logger) const
Definition: MultisegmentWell_impl.hpp:2635
typename Base::BMatrix BMatrix
Definition: MultisegmentWell.hpp:98
typename Base::DMatrix DMatrix
Definition: MultisegmentWell.hpp:100
std::vector< Scalar > computeWellPotentialWithTHP(const WellStateType &well_state, const Simulator &simulator, const GroupStateHelperType &groupStateHelper) const
Definition: MultisegmentWell_impl.hpp:484
Scalar getRefDensity() const override
Definition: MultisegmentWell_impl.hpp:1254
EvalWell getSegmentSurfaceVolume(const int seg_idx, const EvalWell &volume_ratio) const
Definition: MultisegmentWell_impl.hpp:2189
EvalWell computeSegmentEnergyRate(int seg, int upwind_seg, const SegmentFluidState< EvalWell > &upwind_fs, std::string_view context, DeferredLogger &deferred_logger) const
Definition: MultisegmentWell_impl.hpp:2686
std::vector< SegmentFluidState< EvalWell > > segment_fluid_state_
Definition: MultisegmentWell.hpp:233
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
std::vector< Scalar > getPrimaryVars() const override
Definition: MultisegmentWell_impl.hpp:2404
typename Base::CMatrix CMatrix
Definition: MultisegmentWell.hpp:99
void computeWellRatesWithBhpIterations(const Simulator &simulator, const Scalar &bhp, const GroupStateHelperType &groupStateHelper, std::vector< Scalar > &well_flux) const override
Definition: MultisegmentWell_impl.hpp:408
void checkOperabilityUnderTHPLimit(const Simulator &ebos_simulator, const WellStateType &well_state, const GroupStateHelperType &groupStateHelper) override
Definition: MultisegmentWell_impl.hpp:1499
bool iterateWellEqWithControl(const Simulator &simulator, const double dt, const Well::InjectionControls &inj_controls, const Well::ProductionControls &prod_controls, const GroupStateHelperType &groupStateHelper, WellStateType &well_state) override
Definition: MultisegmentWell_impl.hpp:1552
ValueType computeSegmentEnergy(int seg) const
Definition: MultisegmentWell_impl.hpp:2830
std::vector< Scalar > computeCurrentWellRates(const Simulator &simulator, DeferredLogger &deferred_logger) const override
Definition: MultisegmentWell_impl.hpp:2358
void apply(const BVector &x, BVector &Ax) const override
Ax = Ax - C D^-1 B x.
Definition: MultisegmentWell_impl.hpp:228
MultisegmentWell(const Well &well, const ParallelWellInfo< Scalar > &pw_info, const int time_step, const ModelParameters &param, const RateConverterType &rate_converter, const int pvtRegionIdx, const int num_conservation_quantities, const int num_phases, const int index_of_well, const std::vector< PerforationData< Scalar > > &perf_data)
Definition: MultisegmentWell_impl.hpp:63
void checkOperabilityUnderBHPLimit(const WellStateType &well_state, const Simulator &ebos_simulator, DeferredLogger &deferred_logger) override
Definition: MultisegmentWell_impl.hpp:1262
void getMobility(const Simulator &simulator, const int local_perf_index, std::vector< Value > &mob, DeferredLogger &deferred_logger) const
Definition: MultisegmentWell_impl.hpp:1214
SegmentPvt segmentPvt(const SegmentFluidState< EvalWell > &fluid_state) const
Definition: MultisegmentWell_impl.hpp:1164
void recoverWellSolutionAndUpdateWellState(const Simulator &simulator, const BVector &x, const GroupStateHelperType &groupStateHelper, WellStateType &well_state) override
Definition: MultisegmentWell_impl.hpp:263
void assemblePerforationEnergyEq(const IntensiveQuantities &int_quants, const std::vector< EvalWell > &cq_s, const int seg, const int local_perf_index, DeferredLogger &deferred_logger)
Definition: MultisegmentWell_impl.hpp:2723
static constexpr Scalar energy_scaling_factor_
Definition: MultisegmentWell.hpp:84
bool openCrossFlowAvoidSingularity(const Simulator &simulator) const
Definition: MultisegmentWell_impl.hpp:2116
void computeSegmentFluidProperties(const Simulator &simulator, DeferredLogger &deferred_logger)
Definition: MultisegmentWell_impl.hpp:1146
int setPrimaryVars(typename std::vector< Scalar >::const_iterator it) override
Definition: MultisegmentWell_impl.hpp:2422
void computeWellRatesWithBhp(const Simulator &simulator, const Scalar &bhp, std::vector< Scalar > &well_flux, DeferredLogger &deferred_logger) const override
Definition: MultisegmentWell_impl.hpp:358
void updateSegmentFluidState(const FSInfo &info, DeferredLogger &deferred_logger)
Definition: MultisegmentWell_impl.hpp:2858
Base::template BlackOilFluidStateType< ValueType > SegmentFluidState
Definition: MultisegmentWell.hpp:107
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
bool allDrawDownWrongDirection(const Simulator &simulator) const
Definition: MultisegmentWell_impl.hpp:2125
int debug_cost_counter_
Definition: MultisegmentWell.hpp:244
void updateProductivityIndex(const Simulator &simulator, const WellProdIndexCalculator< Scalar > &wellPICalc, WellStateType &well_state, DeferredLogger &deferred_logger) const override
Definition: MultisegmentWell_impl.hpp:787
typename MultisegmentWellSegments< FluidSystem, Indices >::SegmentPvt SegmentPvt
Definition: MultisegmentWell.hpp:112
std::optional< Scalar > computeBhpAtThpLimitProd(const WellStateType &well_state, const Simulator &ebos_simulator, const GroupStateHelperType &groupStateHelper, const SummaryState &summary_state) const
Definition: MultisegmentWell_impl.hpp:2200
Scalar maxPerfPress(const Simulator &simulator) const override
Definition: MultisegmentWell_impl.hpp:2330
void computePerfRate(const IntensiveQuantities &int_quants, const std::vector< Value > &mob_perfcells, const std::vector< Value > &Tw, const int seg, const int perf, const Value &segment_pressure, const bool &allow_cf, std::vector< Value > &cq_s, Value &perf_press, PerforationRates< Scalar > &perf_rates, DeferredLogger &deferred_logger) const
Definition: MultisegmentWell_impl.hpp:1073
SegmentFluidState< EvalWell > createSegmentFluidState(int seg, const FSInfo &info, DeferredLogger &deferred_logger) const
Definition: MultisegmentWell_impl.hpp:2612
SegmentFluidState< ValueType > createFluidState(const std::vector< ValueType > &fluid_composition, const ValueType &pressure, const ValueType &temperature, const ValueType &saltConcentration, DeferredLogger &deferred_logger) const
Definition: MultisegmentWell_impl.hpp:2450
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
void calculateExplicitQuantities(const Simulator &simulator, const GroupStateHelperType &groupStateHelper) override
Definition: MultisegmentWell_impl.hpp:767
static constexpr bool compositionSwitchEnabled
Definition: MultisegmentWell.hpp:74
void computePerfCellPressDiffs(const Simulator &simulator)
Definition: MultisegmentWell_impl.hpp:643
void solveEqAndUpdateWellState(const Simulator &simulator, const GroupStateHelperType &groupStateHelper, WellStateType &well_state) override
Definition: MultisegmentWell_impl.hpp:613
void addBCDMatrix(std::vector< typename Base::BMatrix > &b_matrices, std::vector< typename Base::CMatrix > &c_matrices, std::vector< typename Base::DMatrix > &d_matrices, Opm::SparseTable< int > &wcells) const override
Definition: MultisegmentWell.hpp:204
void updateWellHeadCondition(const Simulator &simulator, const Scalar first_perf_temperature, const Scalar first_perf_salt_concentration, DeferredLogger &deferred_logger)
Definition: MultisegmentWell_impl.hpp:2778
std::optional< Scalar > computeBhpAtThpLimitInj(const Simulator &ebos_simulator, const GroupStateHelperType &groupStateHelper, const SummaryState &summary_state) const
Definition: MultisegmentWell_impl.hpp:2275
static constexpr bool enable_temperature
Definition: MultisegmentWell.hpp:79
void updateIPR(const Simulator &ebos_simulator, DeferredLogger &deferred_logger) const override
Definition: MultisegmentWell_impl.hpp:1328
void computeInitialSegmentInventory(DeferredLogger &deferred_logger)
Definition: MultisegmentWell_impl.hpp:700
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
void updatePrimaryVariables(const GroupStateHelperType &groupStateHelper) override
Definition: MultisegmentWell_impl.hpp:157
void updateIPRImplicit(const Simulator &simulator, const GroupStateHelperType &groupStateHelper, WellStateType &well_state) override
Definition: MultisegmentWell_impl.hpp:1429
void computeWellRatesAtBhpLimit(const Simulator &simulator, const GroupStateHelperType &groupStateHelper, std::vector< Scalar > &well_flux) const
Definition: MultisegmentWell_impl.hpp:342
typename Base::WVector WVector
Definition: MultisegmentWell.hpp:101
void init(const std::vector< Scalar > &depth_arg, const Scalar gravity_arg, const std::vector< Scalar > &B_avg, const bool changed_to_open_this_step) override
Definition: MultisegmentWell_impl.hpp:122
bool regularize_
Definition: MultisegmentWell.hpp:225
std::vector< std::vector< Scalar > > segment_fluid_initial_
Definition: MultisegmentWell.hpp:228
std::optional< Scalar > computeBhpAtThpLimitProdWithAlq(const Simulator &simulator, const GroupStateHelperType &groupStateHelper, const SummaryState &summary_state, const Scalar alq_value, bool iterate_if_no_solution) const override
Definition: MultisegmentWell_impl.hpp:2218
std::vector< SegmentPvt > segment_pvt_
Definition: MultisegmentWell.hpp:237
void getScaledWellFractions(std::vector< Scalar > &scaled_fractions, DeferredLogger &deferred_logger) const override
Definition: MultisegmentWell_impl.hpp:2439
Class encapsulating some information about parallel wells.
Definition: ParallelWellInfo.hpp:217
static constexpr int Oil
Definition: WellInterfaceFluidSystem.hpp:65
static constexpr int Water
Definition: WellInterfaceFluidSystem.hpp:64
static constexpr int Gas
Definition: WellInterfaceFluidSystem.hpp:66
int pvtRegionIdx() const
Definition: WellInterfaceGeneric.hpp:132
Definition: WellInterface.hpp:79
static constexpr bool has_brine
Definition: WellInterface.hpp:127
GetPropType< TypeTag, Properties::Simulator > Simulator
Definition: WellInterface.hpp:84
typename WellInterfaceFluidSystem< FluidSystem >::RateConverterType RateConverterType
Definition: WellInterface.hpp:110
Dune::BCRSMatrix< Opm::MatrixBlock< Scalar, 1, 1 > > PressureMatrix
Definition: WellInterface.hpp:100
BlackOilFluidState< ValueType, FluidSystem, energyModuleType !=EnergyModules::NoTemperature, energyModuleType==EnergyModules::FullyImplicitThermal, Indices::compositionSwitchIdx !=std::numeric_limits< unsigned >::max(), has_watVapor, has_brine, has_saltPrecip, has_disgas_in_water, has_solvent, Indices::numPhases > BlackOilFluidStateType
Definition: WellInterface.hpp:145
Dune::BCRSMatrix< Dune::FieldMatrix< Scalar, numResDofs, numWellDofs > > CMatrix
Definition: WellInterface.hpp:392
GetPropType< TypeTag, Properties::IntensiveQuantities > IntensiveQuantities
Definition: WellInterface.hpp:89
GetPropType< TypeTag, Properties::Scalar > Scalar
Definition: WellInterface.hpp:85
static constexpr int numWellDofs
Definition: WellInterface.hpp:390
GetPropType< TypeTag, Properties::MaterialLaw > MaterialLaw
Definition: WellInterface.hpp:90
typename FluidSystem::IndexTraitsType IndexTraits
Definition: WellInterface.hpp:87
Dune::BlockVector< VectorBlockType > BVector
Definition: WellInterface.hpp:99
FirstPerfCellConditions< Scalar > FSInfo
Temperature and salt concentration of the first perforated cell.
Definition: WellInterface.hpp:107
static constexpr bool has_polymer
Definition: WellInterface.hpp:120
typename Base::ModelParameters ModelParameters
Definition: WellInterface.hpp:116
GetPropType< TypeTag, Properties::FluidSystem > FluidSystem
Definition: WellInterface.hpp:86
static constexpr bool has_solvent
Definition: WellInterface.hpp:118
BlackOilFluidStateType< Eval > FluidState
Definition: WellInterface.hpp:148
Dune::BCRSMatrix< Dune::FieldMatrix< Scalar, numWellDofs, numWellDofs > > DMatrix
Definition: WellInterface.hpp:393
Dune::BlockVector< Dune::FieldVector< Scalar, numWellDofs > > WVector
Definition: WellInterface.hpp:394
typename Base::Eval Eval
Definition: WellInterface.hpp:98
WellState< Scalar, IndexTraits > WellStateType
Definition: WellInterface.hpp:102
static constexpr bool has_energy
Definition: WellInterface.hpp:122
GetPropType< TypeTag, Properties::Indices > Indices
Definition: WellInterface.hpp:88
GetPropType< TypeTag, Properties::SparseMatrixAdapter > SparseMatrixAdapter
Definition: WellInterface.hpp:91
GroupStateHelper< Scalar, IndexTraits > GroupStateHelperType
Definition: WellInterface.hpp:104
Dune::BCRSMatrix< Dune::FieldMatrix< Scalar, numWellDofs, numResDofs > > BMatrix
Definition: WellInterface.hpp:391
static constexpr EnergyModules energyModuleType
Definition: WellInterface.hpp:121
Definition: WellProdIndexCalculator.hpp:37
Definition: WellState.hpp:68
Defines the common properties required by the porous medium multi-phase models.
Definition: blackoilbioeffectsmodules.hh: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
The quantities taken from a segment fluid state.
Definition: MultisegmentWellSegments.hpp:64
Static data associated with a well perforation.
Definition: PerforationData.hpp:30
Definition: PerforationData.hpp:56