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 bool contract_d_diagonal,
189 const WellStateType& well_state) const override;
190
191 std::vector<Scalar>
192 computeCurrentWellRates(const Simulator& simulator,
193 DeferredLogger& deferred_logger) const override;
194
195 std::optional<Scalar>
197 const GroupStateHelperType& groupStateHelper,
198 const SummaryState& summary_state,
199 const Scalar alq_value,
200 bool iterate_if_no_solution) const override;
201
202 std::vector<Scalar> getPrimaryVars() const override;
203
204 int setPrimaryVars(typename std::vector<Scalar>::const_iterator it) override;
205 void addBCDMatrix(std::vector<typename Base::BMatrix>& b_matrices,
206 std::vector<typename Base::CMatrix>& c_matrices,
207 std::vector<typename Base::DMatrix>& d_matrices,
208 Opm::SparseTable<int>& wcells) const override
209 {
210 // System_cpr preconditioner is only supported when well DOF dimensions
211 // match between WellInterface and MultisegmentWellEval (standard 3-phase blackoil).
212 if constexpr (Base::numWellDofs == MSWEval::numWellDofs) {
213 MSWEval::addBCDMatrix(b_matrices, c_matrices, d_matrices, wcells);
214 } else {
215 OPM_THROW(std::runtime_error,
216 "system_cpr preconditioner with multisegment wells is only supported for standard "
217 "3-phase blackoil (Indices::numEq == 3). This model has different equation count.");
218 }
219 }
220
221 void getScaledWellFractions(std::vector<Scalar>& scaled_fractions,
222 DeferredLogger& deferred_logger) const override;
223
224 protected:
225 // regularize msw equation
227
228 // the initial amount of fluids in each segment under surface condition
229 std::vector<std::vector<Scalar> > segment_fluid_initial_;
230 // total energy inside the segments at the beginning of the time step
231 std::vector<Scalar> segment_initial_energy_;
232
233 // segment fluid state
234 std::vector<SegmentFluidState<EvalWell>> segment_fluid_state_;
235
236 // the values MultisegmentWellSegments needs from the segment fluid states, refilled
237 // from segment_fluid_state_ before the segment properties are computed
238 std::vector<SegmentPvt> segment_pvt_;
239
240 // fluid state under the wellhead condition, it is used to calculate the enthalpy
241 // under operation condition for energy injection
242 // because BHP will be involved, we use EvalWell type here
244
245 mutable int debug_cost_counter_ = 0;
246
247 // updating the well_state based on well solution dwells
248 void updateWellState(const Simulator& simulator,
249 const BVectorWell& dwells,
250 const GroupStateHelperType& groupStateHelper,
251 WellStateType& well_state,
252 const Scalar relaxation_factor = 1.0);
253
254 // Compute the initial segment inventory for well equations. Requires an up-to-date
255 // segment fluid state (see updateSegmentFluidState()).
256 void computeInitialSegmentInventory(DeferredLogger& deferred_logger);
257
258 // compute the pressure difference between the perforation and cell center
259 void computePerfCellPressDiffs(const Simulator& simulator);
260
261 template<class Value>
262 void computePerfRate(const IntensiveQuantities& int_quants,
263 const std::vector<Value>& mob_perfcells,
264 const std::vector<Value>& Tw,
265 const int seg,
266 const int perf,
267 const Value& segment_pressure,
268 const bool& allow_cf,
269 std::vector<Value>& cq_s,
270 Value& perf_press,
271 PerforationRates<Scalar>& perf_rates,
272 DeferredLogger& deferred_logger) const;
273
274 template<class Value>
275 void computePerfRate(const Value& pressure_cell,
276 const Value& rs,
277 const Value& rv,
278 const std::vector<Value>& b_perfcells,
279 const std::vector<Value>& mob_perfcells,
280 const std::vector<Value>& Tw,
281 const int perf,
282 const Value& segment_pressure,
283 const Value& segment_density,
284 const bool& allow_cf,
285 const std::vector<Value>& cmix_s,
286 std::vector<Value>& cq_s,
287 Value& perf_press,
288 PerforationRates<Scalar>& perf_rates,
289 DeferredLogger& deferred_logger) const;
290
291 // compute the fluid properties, such as densities, viscosities, and so on, in the segments
292 // They will be treated implicitly, so they need to be of Evaluation type
293 void computeSegmentFluidProperties(const Simulator& simulator,
294 DeferredLogger& deferred_logger);
295
296 // get the transmissibility multiplier for specific perforation
297 template<class Value>
298 void getTransMult(Value& trans_mult,
299 const Simulator& simulator,
300 const int cell_indx) const;
301
302 // get the mobility for specific perforation
303 template<class Value>
304 void getMobility(const Simulator& simulator,
305 const int local_perf_index,
306 std::vector<Value>& mob,
307 DeferredLogger& deferred_logger) const;
308
309 void computeWellRatesAtBhpLimit(const Simulator& simulator,
310 const GroupStateHelperType& groupStateHelper,
311 std::vector<Scalar>& well_flux) const;
312
313 void computeWellRatesWithBhp(const Simulator& simulator,
314 const Scalar& bhp,
315 std::vector<Scalar>& well_flux,
316 DeferredLogger& deferred_logger) const override;
317
318 void computeWellRatesWithBhpIterations(const Simulator& simulator,
319 const Scalar& bhp,
320 const GroupStateHelperType& groupStateHelper,
321 std::vector<Scalar>& well_flux) const override;
322
323 std::vector<Scalar>
325 const Simulator& simulator,
326 const GroupStateHelperType& groupStateHelper) const;
327
328 bool computeWellPotentialsImplicit(const Simulator& simulator,
329 const GroupStateHelperType& groupStateHelper,
330 std::vector<Scalar>& well_potentials) const;
331
332 Scalar getRefDensity() const override;
333
334 bool iterateWellEqWithControl(const Simulator& simulator,
335 const double dt,
336 const Well::InjectionControls& inj_controls,
337 const Well::ProductionControls& prod_controls,
338 const GroupStateHelperType& groupStateHelper,
339 WellStateType& well_state) override;
340
341 bool iterateWellEqWithSwitching(const Simulator& simulator,
342 const double dt,
343 const Well::InjectionControls& inj_controls,
344 const Well::ProductionControls& prod_controls,
345 const GroupStateHelperType& groupStateHelper,
346 WellStateType& well_state,
347 const bool fixed_control,
348 const bool fixed_status,
349 const bool solving_with_zero_rate) override;
350
351 void assembleWellEqWithoutIteration(const Simulator& simulator,
352 const GroupStateHelperType& groupStateHelper,
353 const double dt,
354 const Well::InjectionControls& inj_controls,
355 const Well::ProductionControls& prod_controls,
356 WellStateType& well_state,
357 const bool solving_with_zero_rate) override;
358
359 void updateWaterThroughput(const double dt, WellStateType& well_state) const override;
360
361 // Compute segment surface volume from the given volume ratio.
362 EvalWell getSegmentSurfaceVolume(const int seg_idx,
363 const EvalWell& volume_ratio) const;
364
365 // turn on crossflow to avoid singular well equations
366 // when the well is banned from cross-flow and the BHP is not properly initialized,
367 // we turn on crossflow to avoid singular well equations. It can result in wrong-signed
368 // well rates, it can cause problem for THP calculation
369 // TODO: looking for better alternative to avoid wrong-signed well rates
370 bool openCrossFlowAvoidSingularity(const Simulator& simulator) const;
371
372 // for a well, when all drawdown are in the wrong direction, then this well will not
373 // be able to produce/inject .
374 bool allDrawDownWrongDirection(const Simulator& simulator) const;
375
376 std::optional<Scalar>
377 computeBhpAtThpLimitProd(const WellStateType& well_state,
378 const Simulator& ebos_simulator,
379 const GroupStateHelperType& groupStateHelper,
380 const SummaryState& summary_state) const;
381
382 std::optional<Scalar>
383 computeBhpAtThpLimitInj(const Simulator& ebos_simulator,
384 const GroupStateHelperType& groupStateHelper,
385 const SummaryState& summary_state) const;
386
387 Scalar maxPerfPress(const Simulator& simulator) const override;
388
389 // check whether the well is operable under BHP limit with current reservoir condition
390 void checkOperabilityUnderBHPLimit(const WellStateType& well_state,
391 const Simulator& ebos_simulator,
392 DeferredLogger& deferred_logger) override;
393
394 // check whether the well is operable under THP limit with current reservoir condition
395 void checkOperabilityUnderTHPLimit(const Simulator& ebos_simulator,
396 const WellStateType& well_state,
397 const GroupStateHelperType& groupStateHelper) override;
398
399 // updating the inflow based on the current reservoir condition
400 void updateIPR(const Simulator& ebos_simulator,
401 DeferredLogger& deferred_logger) const override;
402
403 // this function can potentially be shared between multisegment wells and standard wells
404 template <typename ValueType = EvalWell>
406 createFluidState(const std::vector<ValueType>& fluid_composition,
407 const ValueType& pressure,
408 const ValueType& temperature,
409 const ValueType& saltConcentration,
410 DeferredLogger& deferred_logger) const;
411
413 createSegmentFluidState(int seg, const FSInfo& info, DeferredLogger& deferred_logger) const;
414
415 SegmentPvt segmentPvt(const SegmentFluidState<EvalWell>& fluid_state) const;
416
417 // assemble the energy equation contribution for a single perforation/connection
419 const std::vector<EvalWell>& cq_s,
420 const int seg,
421 const int local_perf_index,
422 DeferredLogger& deferred_logger);
423
424 void updateWellHeadCondition(const Simulator& simulator,
425 const Scalar first_perf_temperature,
426 const Scalar first_perf_salt_concentration,
427 DeferredLogger& deferred_logger);
428
429 void updateSegmentFluidState(const FSInfo& info, DeferredLogger& deferred_logger);
430
431 template <typename ValueType = EvalWell>
432 ValueType computeSegmentEnergy(int seg) const;
433
434 // Convert per-component surface volumetric rates to a phase reservoir
435 // volumetric rate, using @p fs (upwind) for the rs/rv coupling. If
436 // (1 - rs*rv) <= 0, falls back to rate / invB (drops the cross-terms but
437 // keeps @p fs's invB; Rs/Rv unchanged) and logs a @p context debug message.
438 // @p fs may be a wellbore SegmentFluidState (EvalWell) or a reservoir-cell
439 // fluid state (Eval, extended to EvalWell on the fly).
440 // @return the reservoir volumetric rate of @p phaseIdx.
441 template <typename FluidStateT>
442 EvalWell surfaceToReservoirRate(unsigned phaseIdx,
443 const FluidStateT& fs,
444 const std::vector<EvalWell>& surface_rates,
445 int seg,
446 std::string_view context,
447 DeferredLogger& deferred_logger) const;
448
449 // Compute the energy flux carried by fluid flowing from segment
450 // @p seg toward its outlet, using @p upwind_fs as the upwind
451 // fluid state. @p context is used in diagnostic messages.
452 // @return the energy flux as sum_phases(reservoir_rate * enthalpy * density).
454 int upwind_seg,
455 const SegmentFluidState<EvalWell>& upwind_fs,
456 std::string_view context,
457 DeferredLogger& deferred_logger) const;
458 };
459
460} // namespace Opm
461
463
464#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:540
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:1692
std::vector< Scalar > segment_initial_energy_
Definition: MultisegmentWell.hpp:231
SegmentFluidState< EvalWell > wellhead_fluid_state_
Definition: MultisegmentWell.hpp:243
void updateWellState(const Simulator &simulator, const BVectorWell &dwells, const GroupStateHelperType &groupStateHelper, WellStateType &well_state, const Scalar relaxation_factor=1.0)
Definition: MultisegmentWell_impl.hpp:731
void updateWaterThroughput(const double dt, WellStateType &well_state) const override
Definition: MultisegmentWell_impl.hpp:2191
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:1877
Scalar connectionDensity(const int globalConnIdx, const int openConnIdx) const override
Definition: MultisegmentWell_impl.hpp:877
void addWellContributions(SparseMatrixAdapter &jacobian) const override
Definition: MultisegmentWell_impl.hpp:899
void getTransMult(Value &trans_mult, const Simulator &simulator, const int cell_indx) const
Definition: MultisegmentWell_impl.hpp:1204
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:2648
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:488
Scalar getRefDensity() const override
Definition: MultisegmentWell_impl.hpp:1264
EvalWell getSegmentSurfaceVolume(const int seg_idx, const EvalWell &volume_ratio) const
Definition: MultisegmentWell_impl.hpp:2202
EvalWell computeSegmentEnergyRate(int seg, int upwind_seg, const SegmentFluidState< EvalWell > &upwind_fs, std::string_view context, DeferredLogger &deferred_logger) const
Definition: MultisegmentWell_impl.hpp:2699
std::vector< SegmentFluidState< EvalWell > > segment_fluid_state_
Definition: MultisegmentWell.hpp:234
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:2417
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:412
void checkOperabilityUnderTHPLimit(const Simulator &ebos_simulator, const WellStateType &well_state, const GroupStateHelperType &groupStateHelper) override
Definition: MultisegmentWell_impl.hpp:1509
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:1562
ValueType computeSegmentEnergy(int seg) const
Definition: MultisegmentWell_impl.hpp:2844
std::vector< Scalar > computeCurrentWellRates(const Simulator &simulator, DeferredLogger &deferred_logger) const override
Definition: MultisegmentWell_impl.hpp:2371
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:1272
void getMobility(const Simulator &simulator, const int local_perf_index, std::vector< Value > &mob, DeferredLogger &deferred_logger) const
Definition: MultisegmentWell_impl.hpp:1224
SegmentPvt segmentPvt(const SegmentFluidState< EvalWell > &fluid_state) const
Definition: MultisegmentWell_impl.hpp:1174
void recoverWellSolutionAndUpdateWellState(const Simulator &simulator, const BVector &x, const GroupStateHelperType &groupStateHelper, WellStateType &well_state) override
Definition: MultisegmentWell_impl.hpp:263
void addWellPressureEquations(PressureMatrix &mat, const BVector &x, const int pressureVarIndex, const bool use_well_weights, const bool contract_d_diagonal, const WellStateType &well_state) const override
Definition: MultisegmentWell_impl.hpp:912
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:2736
static constexpr Scalar energy_scaling_factor_
Definition: MultisegmentWell.hpp:84
bool openCrossFlowAvoidSingularity(const Simulator &simulator) const
Definition: MultisegmentWell_impl.hpp:2129
void computeSegmentFluidProperties(const Simulator &simulator, DeferredLogger &deferred_logger)
Definition: MultisegmentWell_impl.hpp:1156
int setPrimaryVars(typename std::vector< Scalar >::const_iterator it) override
Definition: MultisegmentWell_impl.hpp:2435
void computeWellRatesWithBhp(const Simulator &simulator, const Scalar &bhp, std::vector< Scalar > &well_flux, DeferredLogger &deferred_logger) const override
Definition: MultisegmentWell_impl.hpp:362
void updateSegmentFluidState(const FSInfo &info, DeferredLogger &deferred_logger)
Definition: MultisegmentWell_impl.hpp:2872
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:2138
int debug_cost_counter_
Definition: MultisegmentWell.hpp:245
void updateProductivityIndex(const Simulator &simulator, const WellProdIndexCalculator< Scalar > &wellPICalc, WellStateType &well_state, DeferredLogger &deferred_logger) const override
Definition: MultisegmentWell_impl.hpp:795
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:2213
Scalar maxPerfPress(const Simulator &simulator) const override
Definition: MultisegmentWell_impl.hpp:2343
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:1083
SegmentFluidState< EvalWell > createSegmentFluidState(int seg, const FSInfo &info, DeferredLogger &deferred_logger) const
Definition: MultisegmentWell_impl.hpp:2625
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:2463
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:775
static constexpr bool compositionSwitchEnabled
Definition: MultisegmentWell.hpp:74
void computePerfCellPressDiffs(const Simulator &simulator)
Definition: MultisegmentWell_impl.hpp:651
void solveEqAndUpdateWellState(const Simulator &simulator, const GroupStateHelperType &groupStateHelper, WellStateType &well_state) override
Definition: MultisegmentWell_impl.hpp:617
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:205
void updateWellHeadCondition(const Simulator &simulator, const Scalar first_perf_temperature, const Scalar first_perf_salt_concentration, DeferredLogger &deferred_logger)
Definition: MultisegmentWell_impl.hpp:2792
std::optional< Scalar > computeBhpAtThpLimitInj(const Simulator &ebos_simulator, const GroupStateHelperType &groupStateHelper, const SummaryState &summary_state) const
Definition: MultisegmentWell_impl.hpp:2288
static constexpr bool enable_temperature
Definition: MultisegmentWell.hpp:79
void updateIPR(const Simulator &ebos_simulator, DeferredLogger &deferred_logger) const override
Definition: MultisegmentWell_impl.hpp:1338
void computeInitialSegmentInventory(DeferredLogger &deferred_logger)
Definition: MultisegmentWell_impl.hpp:708
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:1439
void computeWellRatesAtBhpLimit(const Simulator &simulator, const GroupStateHelperType &groupStateHelper, std::vector< Scalar > &well_flux) const
Definition: MultisegmentWell_impl.hpp:346
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:226
std::vector< std::vector< Scalar > > segment_fluid_initial_
Definition: MultisegmentWell.hpp:229
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:2231
std::vector< SegmentPvt > segment_pvt_
Definition: MultisegmentWell.hpp:238
void getScaledWellFractions(std::vector< Scalar > &scaled_fractions, DeferredLogger &deferred_logger) const override
Definition: MultisegmentWell_impl.hpp:2452
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:136
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:425
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:423
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:426
Dune::BlockVector< Dune::FieldVector< Scalar, numWellDofs > > WVector
Definition: WellInterface.hpp:427
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:424
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:72