WellInterfaceGeneric.hpp
Go to the documentation of this file.
1/*
2 Copyright 2017 SINTEF Digital, Mathematics and Cybernetics.
3 Copyright 2017 Statoil ASA.
4 Copyright 2017 IRIS
5 Copyright 2019 Norce
6
7 This file is part of the Open Porous Media project (OPM).
8
9 OPM is free software: you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation, either version 3 of the License, or
12 (at your option) any later version.
13
14 OPM is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
18
19 You should have received a copy of the GNU General Public License
20 along with OPM. If not, see <http://www.gnu.org/licenses/>.
21*/
22
23
24#ifndef OPM_WELLINTERFACE_GENERIC_HEADER_INCLUDED
25#define OPM_WELLINTERFACE_GENERIC_HEADER_INCLUDED
26
27#include <dune/common/timer.hh>
28
29#include <opm/common/utility/TimeService.hpp>
30#include <opm/input/eclipse/Schedule/Well/Well.hpp>
34
35#include <array>
36#include <map>
37#include <memory>
38#include <optional>
39#include <string>
40#include <vector>
41
42namespace Opm
43{
44
45class DeferredLogger;
46class GuideRate;
47class UnitSystem;
48template<class Scalar> class ParallelWellInfo;
49template<class Scalar> struct PerforationData;
50class SummaryState;
51template<typename Scalar, typename IndexTraits> class VFPProperties;
52class WellTestState;
53template<typename Scalar, typename IndexTraits> class WellState;
54template<typename Scalar, typename IndexTraits> class SingleWellState;
55class Group;
56class Schedule;
57template<typename IndexTraits> class PhaseUsageInfo;
58
59template<typename Scalar, typename IndexTraits>
61public:
63
65
66 WellInterfaceGeneric(const Well& well,
67 const ParallelWellInfo<Scalar>& parallel_well_info,
68 const int time_step,
69 const ModelParameters& param,
70 const int pvtRegionIdx,
71 const int num_conservation_quantities,
72 const int num_phases,
73 const int index_of_well,
74 const PhaseUsageInfo<IndexTraits>& phase_usage,
75 const std::vector<PerforationData<Scalar>>& perf_data);
76
77 virtual ~WellInterfaceGeneric() = default;
78
80 const std::vector<PerforationData<Scalar>>& perforationData() const;
81
83 const std::string& name() const;
84
86 bool isInjector() const;
87
89 bool isProducer() const;
90
92 const std::vector<int>& cells() const { return well_cells_; }
93
95 int indexOfWell() const;
96
97 void adaptRatesForVFP(std::vector<Scalar>& rates) const;
98
99 const Well& wellEcl() const;
100 Well& wellEcl();
102
105
106 // whether the well is operable
108 bool useVfpExplicit () const;
110
112 void closeCompletions(const WellTestState& wellTestState);
113
116 const WellStateType& prev_well_state) const;
117 void setGuideRate(const GuideRate* guide_rate_arg);
118 void setWellEfficiencyFactor(const Scalar efficiency_factor);
120 void setWsolvent(const Scalar wsolvent);
121 void setDynamicThpLimit(const Scalar thp_limit);
122 std::optional<Scalar> getDynamicThpLimit() const;
123 void setDynamicThpLimit(const std::optional<Scalar> thp_limit);
124 void updatePerforatedCell(std::vector<bool>& is_cell_perforated);
125
127 bool wellHasTHPConstraints(const SummaryState& summaryState) const;
128
129 void stopWell() { this->wellStatus_ = Well::Status::STOP; }
130 void openWell() { this->wellStatus_ = Well::Status::OPEN; }
131 Well::Status wellStatus() { return this->wellStatus_;}
132
133 bool wellIsStopped() const { return this->wellStatus_ == Well::Status::STOP; }
134
135 int currentStep() const { return this->current_step_; }
136
137 int pvtRegionIdx() const { return pvtRegionIdx_; }
138
139 const GuideRate* guideRate() const { return guide_rate_; }
140
142
143 int numPhases() const { return number_of_phases_; }
144
146
147 Scalar refDepth() const { return ref_depth_; }
148
149 Scalar gravity() const { return gravity_; }
150
152
154
155 const std::vector<Scalar>& perfDepth() const { return perf_depth_; }
156
157 std::vector<Scalar>& perfDepth() { return perf_depth_; }
158
159 const std::vector<Scalar>& wellIndex() const { return well_index_; }
160
165 std::vector<Scalar>& wellIndex() { return well_index_; }
166
167 const std::map<int,std::vector<int>>& getCompletions() const { return completions_; }
168
169 Scalar getTHPConstraint(const SummaryState& summaryState) const;
170 Scalar getALQ(const WellStateType& well_state) const;
171 Scalar wsolvent() const;
172 Scalar rsRvInj() const;
173
174 // at the beginning of the time step, we check what inj_multiplier from the previous running
175 void initInjMult(const std::vector<Scalar>& max_inj_mult);
176
177 // update the InjMult information at the end of the time step, so it can be used for later.
178 void updateInjMult(std::vector<Scalar>& inj_multipliers,
179 DeferredLogger& deferred_logger) const;
180
181 // Note:: for multisegment wells, bhp is actually segment pressure in practice based on observation
182 // it might change in the future
183 Scalar getInjMult(const int local_perf_index, const Scalar bhp, const Scalar perf_pres, DeferredLogger& dlogger) const;
184
185 // whether a well is specified with a non-zero and valid VFP table number
186 bool isVFPActive(DeferredLogger& deferred_logger) const;
187
189 DeferredLogger& deferred_logger) const;
190
192
195 void setLogAllControlSwitches(const bool value) { this->log_all_control_switches_ = value; }
196
213 const double& simulationTime,
214 const bool& writeMessageToOPMLog,
215 const bool during_well_test,
216 const bool zero_group_target,
217 WellTestState& wellTestState,
218 const UnitSystem& unit_system,
219 const time_point start_time,
220 DeferredLogger& deferred_logger,
221 std::string* closure_reason = nullptr) const;
222
223 bool isPressureControlled(const WellStateType& well_state) const;
224
229 static void applyWeldrawRateLimit(const Well& well_ecl,
230 const std::optional<Scalar>& weldraw_max_rate,
231 Well::ProductionControls& controls);
232
238 Well::ProductionControls
239 productionControlsWithWeldraw(const SummaryState& summary_state,
241
243
245 void updateFilterCakeMultipliers(const std::vector<Scalar>& inj_fc_multiplier)
246 {
247 inj_fc_multiplier_ = inj_fc_multiplier;
248 }
249
251
252 virtual std::vector<Scalar> getPrimaryVars() const
253 {
254 return {};
255 }
256
257 virtual int setPrimaryVars(typename std::vector<Scalar>::const_iterator)
258 {
259 return 0;
260 }
261
262 virtual Scalar connectionDensity(const int globalConnIdx,
263 const int openConnIdx) const = 0;
264
268 virtual Scalar totalReservoirVoidageRate(const std::vector<Scalar>& surface_rates) const = 0;
269
270 void addPerforations(const std::vector<RuntimePerforation>& perfs);
271
277 void addFracturePerforations(const std::vector<RuntimePerforation>& perfs);
278
281 const std::vector<WellIndexFracture>& wellIndexFracture() const
282 { return well_index_fracture_; }
283
289 {
290 double solve_time{0.0};
292 double assemble_time{0.0};
293 double linear_solve_time{0.0};
294 unsigned int iterations{0};
295 unsigned int potential_iterations{0};
296 };
297
298 const WellSolveStats& solveStats() const { return *solve_stats_; }
300
301protected:
307 {
308 public:
309 WellSolveScope(const WellInterfaceGeneric& well, const int& iterations)
310 : well_(well), iterations_(iterations)
311 {
312 well_.in_well_solve_ = true;
313 timer_.start();
314 }
316 {
317 well_.in_well_solve_ = false;
318 auto& stats = *well_.solve_stats_;
319 if (well_.computing_well_potentials_) {
320 stats.potential_solve_time += timer_.stop();
321 stats.potential_iterations += iterations_;
322 } else {
323 stats.solve_time += timer_.stop();
324 stats.iterations += iterations_;
325 }
326 }
327 private:
328 const WellInterfaceGeneric& well_;
329 const int& iterations_;
330 Dune::Timer timer_{};
331 };
332
336 {
337 public:
338 SolvePartTimer(const WellInterfaceGeneric& well, double& target)
339 : well_(well), target_(target)
340 {
341 timer_.start();
342 }
344 {
345 if (well_.in_well_solve_) {
346 target_ += timer_.stop();
347 }
348 }
349 private:
350 const WellInterfaceGeneric& well_;
351 double& target_;
352 Dune::Timer timer_{};
353 };
354
357 {
358 public:
360 : well_(well), previous_(well.computing_well_potentials_)
361 {
362 well_.computing_well_potentials_ = true;
363 }
365 {
366 well_.computing_well_potentials_ = previous_;
367 }
368 private:
369 const WellInterfaceGeneric& well_;
370 bool previous_;
371 };
372
373 WellSolveScope solveScope(const int& iterations) const
374 { return WellSolveScope(*this, iterations); }
375
377 { return SolvePartTimer(*this, solve_stats_->assemble_time); }
378
380 { return SolvePartTimer(*this, solve_stats_->linear_solve_time); }
381
383 { return PotentialCalculationScope(*this); }
384
385 bool getAllowCrossFlow() const;
386
387 Scalar wmicrobes_() const;
388 Scalar wfoam_() const;
389 Scalar woxygen_() const;
390 Scalar wpolymer_() const;
391 Scalar wsalt_() const;
392 Scalar wurea_() const;
393
394 int polymerTable_() const;
395 int polymerInjTable_() const;
397
398 bool wellUnderZeroRateTargetIndividual(const SummaryState& summary_state,
399 const WellState<Scalar, IndexTraits>& well_state) const;
400
402
407 std::array<bool, 3>
409
410 std::pair<bool,bool>
411 computeWellPotentials(std::vector<Scalar>& well_potentials,
412 const WellStateType& well_state);
413
414 void checkNegativeWellPotentials(std::vector<Scalar>& well_potentials,
415 const bool checkOperability,
416 DeferredLogger& deferred_logger);
417
418 // Remove all other controls than THP and BHP
419 void onlyKeepBHPandTHPcontrols(const SummaryState& summary_state,
420 WellStateType& well_state,
421 Well::InjectionControls& inj_controls,
422 Well::ProductionControls& prod_controls) const;
423
425 {
426 std::ranges::fill(this->inj_multiplier_damp_factor_, 1.0);
427 }
428
430 const std::vector<Scalar>& scaled_well_fractions,
431 DeferredLogger& deferred_logger) const;
432
433 // definition of the struct OperabilityStatus
435 {
437 {
439 return false;
440 }
441
443 }
444
446 {
448 }
449
451 {
453 }
454
456 {
461 }
462
463 // whether the well can be operated under bhp limit
464 // without considering other limits.
465 // if it is false, then the well is not operable for sure.
467 // if the well can be operated under bhp limit, will it obey(not violate)
468 // the thp limit when operated under bhp limit
470 // whether the well operate under the thp limit only
472 // whether the well obey bhp limit when operated under thp limit
474 // the well is solveable
475 bool solvable = true;
476 // the well have non positive potentials
478 //thp limit violated but not switched
480
481 bool use_vfpexplicit = false;
482 };
483
485
487
489 const int current_step_;
491
492 // The pvt region of the well. We assume
493 // We assume a well to not penetrate more than one pvt region.
494 const int pvtRegionIdx_;
495
496 // TODO: with energy conservation joins, we probably should change this to be num_mass_conservation_quantities_
497 // or something like that. Energy term calculate somehow differently from the mass term
499
500 // number of phases
502
503 // the index of well in Wells struct
505
507
508 const std::vector<PerforationData<Scalar>>* perf_data_;
509
510 // the vectors used to describe the inflow performance relationship (IPR)
511 // Q = IPR_A - BHP * IPR_B
512 // TODO: it minght need to go to WellInterface, let us implement it in StandardWell first
513 // it is only updated and used for producers for now
514 mutable std::vector<Scalar> ipr_a_;
515 mutable std::vector<Scalar> ipr_b_;
516
517 // cell index for each well perforation
518 std::vector<int> well_cells_;
519
520 // well index for each perforation
521 std::vector<Scalar> well_index_;
522
523 // fracture contribution to the well index per perforation; empty when no
524 // fracture model has registered contributions (see addFracturePerforations)
525 std::vector<WellIndexFracture> well_index_fracture_;
526
527 // number of the perforations for this well on this process
529
530 // depth for each perforation
531 std::vector<Scalar> perf_depth_;
532
533 // representative radius of the perforations, used in shear calculation
534 std::vector<Scalar> perf_rep_radius_;
535
536 // length of the perforations, use in shear calculation
537 std::vector<Scalar> perf_length_;
538
539 // well bore diameter
540 std::vector<Scalar> bore_diameters_;
541
542 /*
543 * completions_ contains the mapping from completion id to connection indices
544 * {
545 * 2 : [ConnectionIndex, ConnectionIndex],
546 * 1 : [ConnectionIndex, ConnectionIndex, ConnectionIndex],
547 * 5 : [ConnectionIndex],
548 * 7 : [ConnectionIndex]
549 * ...
550 * }
551 * The integer IDs correspond to the COMPLETION id given by the COMPLUMP keyword.
552 * When there is no COMPLUMP keyword used, a default completion number will be assigned
553 * based on the order of the declaration of the connections.
554 * Since the connections not OPEN is not included in the Wells, so they will not be considered
555 * in this mapping relation.
556 */
557 std::map<int, std::vector<int>> completions_;
558
559 // reference depth for the BHP
561
562 // saturation table nubmer for each well perforation
563 std::vector<int> saturation_table_number_;
564
565 Well::Status wellStatus_;
566
567 Scalar gravity_;
568 Scalar wsolvent_;
569 std::optional<Scalar> dynamic_thp_limit_;
570
571 // recording the multiplier calculate from the keyword WINJMULT during the time step
572 mutable std::vector<Scalar> inj_multiplier_;
573
574 // the injection multiplier from the previous running, it is mostly used for CIRR mode
575 // which intends to keep the fracturing open
576 std::vector<Scalar> prev_inj_multiplier_;
577
578 // WINJMULT multipliers for previous iteration (used for oscillation detection)
579 mutable std::vector<Scalar> inj_multiplier_previter_;
580 // WINJMULT dampening factors (used in case of oscillations)
581 mutable std::vector<Scalar> inj_multiplier_damp_factor_;
582
583 // the multiplier due to injection filtration cake
584 std::vector<Scalar> inj_fc_multiplier_;
585
588 const GuideRate* guide_rate_;
589
590 std::vector<std::string> well_control_log_;
591
592 // Count every control switch of the well towards max_number_of_well_switches_,
593 // also before NUPCOL iterations. Set for a reservoir coupling slave's wells while
594 // the master exchanges network pressures with the slave, see
595 // BlackoilWellModelRescoup::receiveMasterGroupNodePressuresFromMaster().
597
599
600 // statistics for standalone well solves; shared so that well copies used
601 // during e.g. potential calculations contribute to the same statistics
602 std::shared_ptr<WellSolveStats> solve_stats_ = std::make_shared<WellSolveStats>();
603 // true while a well potential calculation is in progress
604 mutable bool computing_well_potentials_ = false;
605 // true while a standalone well solve is in progress
606 mutable bool in_well_solve_ = false;
607};
608
609}
610
611#endif // OPM_WELLINTERFACE_GENERIC_HEADER_INCLUDED
Definition: DeferredLogger.hpp:57
Class encapsulating some information about parallel wells.
Definition: ParallelWellInfo.hpp:217
Definition: GasLiftGroupInfo.hpp:40
Definition: SingleWellState.hpp:44
Definition: VFPProperties.hpp:40
RAII helper marking that a well potential calculation is in progress.
Definition: WellInterfaceGeneric.hpp:357
~PotentialCalculationScope()
Definition: WellInterfaceGeneric.hpp:364
PotentialCalculationScope(const WellInterfaceGeneric &well)
Definition: WellInterfaceGeneric.hpp:359
Definition: WellInterfaceGeneric.hpp:336
SolvePartTimer(const WellInterfaceGeneric &well, double &target)
Definition: WellInterfaceGeneric.hpp:338
~SolvePartTimer()
Definition: WellInterfaceGeneric.hpp:343
Definition: WellInterfaceGeneric.hpp:307
WellSolveScope(const WellInterfaceGeneric &well, const int &iterations)
Definition: WellInterfaceGeneric.hpp:309
~WellSolveScope()
Definition: WellInterfaceGeneric.hpp:315
Definition: WellInterfaceGeneric.hpp:60
int pvtRegionIdx() const
Definition: WellInterfaceGeneric.hpp:137
WellInterfaceGeneric(const Well &well, const ParallelWellInfo< Scalar > &parallel_well_info, const int time_step, const ModelParameters &param, const int pvtRegionIdx, const int num_conservation_quantities, const int num_phases, const int index_of_well, const PhaseUsageInfo< IndexTraits > &phase_usage, const std::vector< PerforationData< Scalar > > &perf_data)
void updateGroupTargetFallbackFlag(WellState< Scalar, IndexTraits > &well_state, const std::vector< Scalar > &scaled_well_fractions, DeferredLogger &deferred_logger) const
const std::map< int, std::vector< int > > & getCompletions() const
Definition: WellInterfaceGeneric.hpp:167
const int num_conservation_quantities_
Definition: WellInterfaceGeneric.hpp:498
bool isVFPActive(DeferredLogger &deferred_logger) const
const WellSolveStats & solveStats() const
Definition: WellInterfaceGeneric.hpp:298
void openWell()
Definition: WellInterfaceGeneric.hpp:130
std::vector< int > saturation_table_number_
Definition: WellInterfaceGeneric.hpp:563
bool isOperableAndSolvable() const
void addFracturePerforations(const std::vector< RuntimePerforation > &perfs)
std::vector< int > well_cells_
Definition: WellInterfaceGeneric.hpp:518
void updatePerforatedCell(std::vector< bool > &is_cell_perforated)
int index_of_well_
Definition: WellInterfaceGeneric.hpp:504
std::optional< Scalar > dynamic_thp_limit_
Definition: WellInterfaceGeneric.hpp:569
std::vector< Scalar > perf_depth_
Definition: WellInterfaceGeneric.hpp:531
int numPhases() const
Definition: WellInterfaceGeneric.hpp:143
virtual Scalar totalReservoirVoidageRate(const std::vector< Scalar > &surface_rates) const =0
The total reservoir voidage rate for the given surface phase rates (or potentials),...
Scalar gravity() const
Definition: WellInterfaceGeneric.hpp:149
const GuideRate * guideRate() const
Definition: WellInterfaceGeneric.hpp:139
std::vector< Scalar > prev_inj_multiplier_
Definition: WellInterfaceGeneric.hpp:576
Well::Status wellStatus()
Definition: WellInterfaceGeneric.hpp:131
int polymerWaterTable_() const
int number_of_phases_
Definition: WellInterfaceGeneric.hpp:501
void setWsolvent(const Scalar wsolvent)
std::vector< Scalar > & perfDepth()
Definition: WellInterfaceGeneric.hpp:157
const PhaseUsageInfo< IndexTraits > & phase_usage_
Definition: WellInterfaceGeneric.hpp:506
Scalar wpolymer_() const
bool in_well_solve_
Definition: WellInterfaceGeneric.hpp:606
void updateWellTestState(const SingleWellState< Scalar, IndexTraits > &ws, const double &simulationTime, const bool &writeMessageToOPMLog, const bool during_well_test, const bool zero_group_target, WellTestState &wellTestState, const UnitSystem &unit_system, const time_point start_time, DeferredLogger &deferred_logger, std::string *closure_reason=nullptr) const
const int current_step_
Definition: WellInterfaceGeneric.hpp:489
std::vector< Scalar > ipr_a_
Definition: WellInterfaceGeneric.hpp:514
Well well_ecl_
Definition: WellInterfaceGeneric.hpp:486
const std::vector< Scalar > & perfDepth() const
Definition: WellInterfaceGeneric.hpp:155
bool wellUnderGroupControl(const SingleWellState< Scalar, IndexTraits > &ws) const
const Well & wellEcl() const
const ParallelWellInfo< Scalar > & parallel_well_info_
Definition: WellInterfaceGeneric.hpp:488
Scalar wmicrobes_() const
const PhaseUsageInfo< IndexTraits > & phaseUsage() const
void resetSolveStats() const
Definition: WellInterfaceGeneric.hpp:299
std::vector< Scalar > ipr_b_
Definition: WellInterfaceGeneric.hpp:515
const int pvtRegionIdx_
Definition: WellInterfaceGeneric.hpp:494
std::vector< Scalar > inj_multiplier_damp_factor_
Definition: WellInterfaceGeneric.hpp:581
bool underPredictionMode() const
Returns true if the well is currently in prediction mode (i.e. not history mode).
const GuideRate * guide_rate_
Definition: WellInterfaceGeneric.hpp:588
OperabilityStatus operability_status_
Definition: WellInterfaceGeneric.hpp:484
bool wellUnderZeroRateTargetIndividual(const SummaryState &summary_state, const WellState< Scalar, IndexTraits > &well_state) const
Well::Status wellStatus_
Definition: WellInterfaceGeneric.hpp:565
int numLocalPerfs() const
Definition: WellInterfaceGeneric.hpp:145
Scalar getTHPConstraint(const SummaryState &summaryState) const
bool isPressureControlled(const WellStateType &well_state) const
void setDynamicThpLimit(const Scalar thp_limit)
void updateInjMult(std::vector< Scalar > &inj_multipliers, DeferredLogger &deferred_logger) const
void updateFilterCakeMultipliers(const std::vector< Scalar > &inj_fc_multiplier)
Update filter cake multipliers.
Definition: WellInterfaceGeneric.hpp:245
Scalar well_efficiency_factor_
Definition: WellInterfaceGeneric.hpp:586
void closeCompletions(const WellTestState &wellTestState)
bool isProducer() const
True if the well is a producer.
void checkNegativeWellPotentials(std::vector< Scalar > &well_potentials, const bool checkOperability, DeferredLogger &deferred_logger)
void setPrevSurfaceRates(WellStateType &well_state, const WellStateType &prev_well_state) const
void addPerforations(const std::vector< RuntimePerforation > &perfs)
std::vector< Scalar > inj_multiplier_previter_
Definition: WellInterfaceGeneric.hpp:579
std::vector< Scalar > inj_fc_multiplier_
Definition: WellInterfaceGeneric.hpp:584
const std::vector< WellIndexFracture > & wellIndexFracture() const
Definition: WellInterfaceGeneric.hpp:281
virtual Scalar connectionDensity(const int globalConnIdx, const int openConnIdx) const =0
Scalar getInjMult(const int local_perf_index, const Scalar bhp, const Scalar perf_pres, DeferredLogger &dlogger) const
void adaptRatesForVFP(std::vector< Scalar > &rates) const
void onlyKeepBHPandTHPcontrols(const SummaryState &summary_state, WellStateType &well_state, Well::InjectionControls &inj_controls, Well::ProductionControls &prod_controls) const
bool changedToOpenThisStep() const
Definition: WellInterfaceGeneric.hpp:191
void setGuideRate(const GuideRate *guide_rate_arg)
WellSolveScope solveScope(const int &iterations) const
Definition: WellInterfaceGeneric.hpp:373
const std::vector< PerforationData< Scalar > > * perf_data_
Definition: WellInterfaceGeneric.hpp:508
bool isInjector() const
True if the well is an injector.
int numConservationQuantities() const
Definition: WellInterfaceGeneric.hpp:141
std::shared_ptr< WellSolveStats > solve_stats_
Definition: WellInterfaceGeneric.hpp:602
const VFPProperties< Scalar, IndexTraits > * vfpProperties() const
Definition: WellInterfaceGeneric.hpp:151
Scalar refDepth() const
Definition: WellInterfaceGeneric.hpp:147
std::vector< Scalar > & wellIndex()
Mutable per-perforation well indices (connection transmissibility factors). Adjoint hook: the dJ/dper...
Definition: WellInterfaceGeneric.hpp:165
Scalar getALQ(const WellStateType &well_state) const
void stopWell()
Definition: WellInterfaceGeneric.hpp:129
Scalar wellEfficiencyFactor() const
Definition: WellInterfaceGeneric.hpp:242
SolvePartTimer solveLinearSolveTimer() const
Definition: WellInterfaceGeneric.hpp:379
Well::ProductionControls productionControlsWithWeldraw(const SummaryState &summary_state, const SingleWellState< Scalar, IndexTraits > &ws) const
std::vector< std::string > well_control_log_
Definition: WellInterfaceGeneric.hpp:590
void resetDampening()
Definition: WellInterfaceGeneric.hpp:424
int indexOfWell() const
Index of well in the wells struct and wellState.
std::vector< WellIndexFracture > well_index_fracture_
Definition: WellInterfaceGeneric.hpp:525
virtual std::vector< Scalar > getPrimaryVars() const
Definition: WellInterfaceGeneric.hpp:252
const std::vector< PerforationData< Scalar > > & perforationData() const
Get the perforations of the well.
std::vector< Scalar > perf_length_
Definition: WellInterfaceGeneric.hpp:537
const std::vector< int > & cells() const
Well cells.
Definition: WellInterfaceGeneric.hpp:92
int number_of_local_perforations_
Definition: WellInterfaceGeneric.hpp:528
std::vector< Scalar > well_index_
Definition: WellInterfaceGeneric.hpp:521
virtual int setPrimaryVars(typename std::vector< Scalar >::const_iterator)
Definition: WellInterfaceGeneric.hpp:257
void setVFPProperties(const VFPProperties< Scalar, IndexTraits > *vfp_properties_arg)
const std::string & name() const
Well name.
const ModelParameters & param_
Definition: WellInterfaceGeneric.hpp:490
std::pair< bool, bool > computeWellPotentials(std::vector< Scalar > &well_potentials, const WellStateType &well_state)
bool log_all_control_switches_
Definition: WellInterfaceGeneric.hpp:596
bool computing_well_potentials_
Definition: WellInterfaceGeneric.hpp:604
SolvePartTimer solveAssembleTimer() const
Definition: WellInterfaceGeneric.hpp:376
std::array< bool, 3 > rateControlledPhases(const SingleWellState< Scalar, IndexTraits > &ws) const
Phases whose surface rate is targeted by the current production control.
bool changed_to_open_this_step_
Definition: WellInterfaceGeneric.hpp:598
static void applyWeldrawRateLimit(const Well &well_ecl, const std::optional< Scalar > &weldraw_max_rate, Well::ProductionControls &controls)
void setWellEfficiencyFactor(const Scalar efficiency_factor)
PotentialCalculationScope potentialCalculationScope() const
Definition: WellInterfaceGeneric.hpp:382
const VFPProperties< Scalar, IndexTraits > * vfp_properties_
Definition: WellInterfaceGeneric.hpp:587
virtual ~WellInterfaceGeneric()=default
void initInjMult(const std::vector< Scalar > &max_inj_mult)
Scalar wsolvent_
Definition: WellInterfaceGeneric.hpp:568
std::map< int, std::vector< int > > completions_
Definition: WellInterfaceGeneric.hpp:557
void setDynamicThpLimit(const std::optional< Scalar > thp_limit)
std::vector< Scalar > perf_rep_radius_
Definition: WellInterfaceGeneric.hpp:534
void reportWellSwitching(const SingleWellState< Scalar, IndexTraits > &ws, DeferredLogger &deferred_logger) const
std::optional< Scalar > getDynamicThpLimit() const
const std::vector< Scalar > & wellIndex() const
Definition: WellInterfaceGeneric.hpp:159
Scalar gravity_
Definition: WellInterfaceGeneric.hpp:567
bool wellHasTHPConstraints(const SummaryState &summaryState) const
Returns true if the well has one or more THP limits/constraints.
std::vector< Scalar > bore_diameters_
Definition: WellInterfaceGeneric.hpp:540
bool wellIsStopped() const
Definition: WellInterfaceGeneric.hpp:133
Scalar ref_depth_
Definition: WellInterfaceGeneric.hpp:560
bool thpLimitViolatedButNotSwitched() const
bool getAllowCrossFlow() const
std::vector< Scalar > inj_multiplier_
Definition: WellInterfaceGeneric.hpp:572
int currentStep() const
Definition: WellInterfaceGeneric.hpp:135
void setLogAllControlSwitches(const bool value)
Definition: WellInterfaceGeneric.hpp:195
const ParallelWellInfo< Scalar > & parallelWellInfo() const
Definition: WellInterfaceGeneric.hpp:153
Definition: WellState.hpp:68
Definition: blackoilbioeffectsmodules.hh:45
Solver parameters for the NonlinearSystemBlackOilReservoir.
Definition: BlackoilModelParameters.hpp:208
Static data associated with a well perforation.
Definition: PerforationData.hpp:30
Definition: WellInterfaceGeneric.hpp:435
void resetOperability()
Definition: WellInterfaceGeneric.hpp:455
bool thp_limit_violated_but_not_switched
Definition: WellInterfaceGeneric.hpp:479
bool can_obtain_bhp_with_thp_limit
Definition: WellInterfaceGeneric.hpp:471
bool has_negative_potentials
Definition: WellInterfaceGeneric.hpp:477
bool isOperableUnderTHPLimit() const
Definition: WellInterfaceGeneric.hpp:450
bool obey_bhp_limit_with_thp_limit
Definition: WellInterfaceGeneric.hpp:473
bool solvable
Definition: WellInterfaceGeneric.hpp:475
bool operable_under_only_bhp_limit
Definition: WellInterfaceGeneric.hpp:466
bool use_vfpexplicit
Definition: WellInterfaceGeneric.hpp:481
bool isOperableUnderBHPLimit() const
Definition: WellInterfaceGeneric.hpp:445
bool obey_thp_limit_under_bhp_limit
Definition: WellInterfaceGeneric.hpp:469
bool isOperableAndSolvable() const
Definition: WellInterfaceGeneric.hpp:436
Definition: WellInterfaceGeneric.hpp:289
unsigned int iterations
well iterations in normal solves
Definition: WellInterfaceGeneric.hpp:294
double potential_solve_time
time used by well potential solves
Definition: WellInterfaceGeneric.hpp:291
double assemble_time
assembly time in the well solves
Definition: WellInterfaceGeneric.hpp:292
double solve_time
time used by normal well solves
Definition: WellInterfaceGeneric.hpp:290
double linear_solve_time
linear solve time in the well solves
Definition: WellInterfaceGeneric.hpp:293
unsigned int potential_iterations
well iterations in potential solves
Definition: WellInterfaceGeneric.hpp:295