24#ifndef OPM_WELLINTERFACE_GENERIC_HEADER_INCLUDED
25#define OPM_WELLINTERFACE_GENERIC_HEADER_INCLUDED
27#include <opm/input/eclipse/Schedule/Well/Well.hpp>
28#include <opm/simulators/flow/BlackoilModelParameters.hpp>
40template<
class Scalar>
class ParallelWellInfo;
41template<
class Scalar>
struct PerforationData;
59 const ModelParameters& param,
60 const int pvtRegionIdx,
61 const int num_components,
63 const int index_of_well,
70 const std::string&
name()
const;
79 const std::vector<int>&
cells()
const {
return well_cells_; }
84 void adaptRatesForVFP(std::vector<Scalar>& rates)
const;
86 const Well& wellEcl()
const;
94 bool isOperableAndSolvable()
const;
95 bool useVfpExplicit ()
const;
96 bool thpLimitViolatedButNotSwitched()
const;
98 void initCompletions();
99 void closeCompletions(
const WellTestState& wellTestState);
104 void setGuideRate(
const GuideRate* guide_rate_arg);
105 void setWellEfficiencyFactor(
const Scalar efficiency_factor);
106 void setRepRadiusPerfLength();
107 void setWsolvent(
const Scalar wsolvent);
108 void setDynamicThpLimit(
const Scalar thp_limit);
109 std::optional<Scalar> getDynamicThpLimit()
const;
110 void setDynamicThpLimit(
const std::optional<Scalar> thp_limit);
111 void updatePerforatedCell(std::vector<bool>& is_cell_perforated);
116 void stopWell() { this->wellStatus_ = Well::Status::STOP; }
117 void openWell() { this->wellStatus_ = Well::Status::OPEN; }
119 bool wellIsStopped()
const {
return this->wellStatus_ == Well::Status::STOP; }
121 int currentStep()
const {
return this->current_step_; }
123 int pvtRegionIdx()
const {
return pvtRegionIdx_; }
125 const GuideRate* guideRate()
const {
return guide_rate_; }
127 int numComponents()
const {
return num_components_; }
129 int numPhases()
const {
return number_of_phases_; }
131 int numPerfs()
const {
return number_of_perforations_; }
133 Scalar refDepth()
const {
return ref_depth_; }
135 Scalar gravity()
const {
return gravity_; }
137 const VFPProperties<Scalar>* vfpProperties()
const {
return vfp_properties_; }
139 const ParallelWellInfo<Scalar>& parallelWellInfo()
const {
return parallel_well_info_; }
141 const std::vector<Scalar>& perfDepth()
const {
return perf_depth_; }
143 std::vector<Scalar>& perfDepth() {
return perf_depth_; }
145 const std::vector<Scalar>& wellIndex()
const {
return well_index_; }
147 const std::map<int,std::vector<int>>& getCompletions()
const {
return completions_; }
149 Scalar getTHPConstraint(
const SummaryState& summaryState)
const;
150 Scalar getALQ(
const WellState<Scalar>& well_state)
const;
151 Scalar wsolvent()
const;
152 Scalar rsRvInj()
const;
155 void initInjMult(
const std::vector<Scalar>& max_inj_mult);
158 void updateInjMult(std::vector<Scalar>& inj_multipliers,
159 DeferredLogger& deferred_logger)
const;
163 Scalar getInjMult(
const int perf,
const Scalar bhp,
const Scalar perf_pres, DeferredLogger& dlogger)
const;
166 bool isVFPActive(DeferredLogger& deferred_logger)
const;
168 void reportWellSwitching(
const SingleWellState<Scalar>& ws,
169 DeferredLogger& deferred_logger)
const;
171 bool changedToOpenThisStep()
const {
return this->changed_to_open_this_step_; }
173 void updateWellTestState(
const SingleWellState<Scalar>& ws,
174 const double& simulationTime,
175 const bool& writeMessageToOPMLog,
176 const bool zero_group_target,
177 WellTestState& wellTestState,
178 DeferredLogger& deferred_logger)
const;
180 bool isPressureControlled(
const WellState<Scalar>& well_state)
const;
182 Scalar wellEfficiencyFactor()
const {
return well_efficiency_factor_; }
187 inj_fc_multiplier_ = inj_fc_multiplier;
190 void resetWellOperability();
193 bool getAllowCrossFlow()
const;
195 Scalar wmicrobes_()
const;
196 Scalar wfoam_()
const;
197 Scalar woxygen_()
const;
198 Scalar wpolymer_()
const;
199 Scalar wsalt_()
const;
200 Scalar wurea_()
const;
202 int polymerTable_()
const;
203 int polymerInjTable_()
const;
204 int polymerWaterTable_()
const;
206 bool wellUnderZeroRateTargetIndividual(
const SummaryState& summary_state,
212 computeWellPotentials(std::vector<Scalar>& well_potentials,
215 void checkNegativeWellPotentials(std::vector<Scalar>& well_potentials,
216 const bool checkOperability,
219 void prepareForPotentialCalculations(
const SummaryState& summary_state,
221 Well::InjectionControls& inj_controls,
222 Well::ProductionControls& prod_controls)
const;
224 void resetDampening() {
225 std::fill(this->inj_multiplier_damp_factor_.begin(), this->inj_multiplier_damp_factor_.end(), 1.0);
231 bool isOperableAndSolvable()
const
233 if (!operable_under_only_bhp_limit || !solvable || has_negative_potentials) {
236 return ( (isOperableUnderBHPLimit() || isOperableUnderTHPLimit()) );
240 bool isOperableUnderBHPLimit()
const
242 return operable_under_only_bhp_limit && obey_thp_limit_under_bhp_limit;
245 bool isOperableUnderTHPLimit()
const
247 return can_obtain_bhp_with_thp_limit && obey_bhp_limit_with_thp_limit;
250 void resetOperability()
252 operable_under_only_bhp_limit =
true;
253 obey_thp_limit_under_bhp_limit =
true;
254 can_obtain_bhp_with_thp_limit =
true;
255 obey_bhp_limit_with_thp_limit =
true;
261 bool operable_under_only_bhp_limit =
true;
264 bool obey_thp_limit_under_bhp_limit =
true;
266 bool can_obtain_bhp_with_thp_limit =
true;
268 bool obey_bhp_limit_with_thp_limit =
true;
270 bool solvable =
true;
272 bool has_negative_potentials =
false;
274 mutable bool thp_limit_violated_but_not_switched =
false;
276 bool use_vfpexplicit =
false;
284 const int current_step_;
289 const int pvtRegionIdx_;
291 const int num_components_;
294 int number_of_phases_;
299 const std::vector<PerforationData<Scalar>>* perf_data_;
305 mutable std::vector<Scalar> ipr_a_;
306 mutable std::vector<Scalar> ipr_b_;
309 std::vector<int> well_cells_;
312 std::vector<Scalar> well_index_;
315 int number_of_perforations_;
318 std::vector<Scalar> perf_depth_;
321 std::vector<Scalar> perf_rep_radius_;
324 std::vector<Scalar> perf_length_;
327 std::vector<Scalar> bore_diameters_;
344 std::map<int, std::vector<int>> completions_;
350 std::vector<int> saturation_table_number_;
352 Well::Status wellStatus_;
358 std::optional<Scalar> dynamic_thp_limit_;
361 mutable std::vector<Scalar> inj_multiplier_;
365 std::vector<Scalar> prev_inj_multiplier_;
368 mutable std::vector<Scalar> inj_multiplier_previter_;
370 mutable std::vector<Scalar> inj_multiplier_damp_factor_;
373 std::vector<Scalar> inj_fc_multiplier_;
375 Scalar well_efficiency_factor_;
377 const GuideRate* guide_rate_;
379 std::vector<std::string> well_control_log_;
381 bool changed_to_open_this_step_ =
true;
Definition DeferredLogger.hpp:57
Class encapsulating some information about parallel wells.
Definition WGState.hpp:31
Definition WellTest.hpp:35
A thin wrapper class that holds one VFPProdProperties and one VFPInjProperties object.
Definition WellInterfaceGeneric.hpp:44
Definition WellTest.hpp:37
const std::string & name() const
Well name.
Definition WellInterfaceGeneric.cpp:157
void updateFilterCakeMultipliers(const std::vector< Scalar > &inj_fc_multiplier)
Update filter cake multipliers.
Definition WellInterfaceGeneric.hpp:185
bool isInjector() const
True if the well is an injector.
Definition WellInterfaceGeneric.cpp:163
bool wellHasTHPConstraints(const SummaryState &summaryState) const
Returns true if the well has one or more THP limits/constraints.
Definition WellInterfaceGeneric.cpp:312
const std::vector< int > & cells() const
Well cells.
Definition WellInterfaceGeneric.hpp:79
bool isProducer() const
True if the well is a producer.
Definition WellInterfaceGeneric.cpp:169
const std::vector< PerforationData< Scalar > > & perforationData() const
Get the perforations of the well.
Definition WellInterfaceGeneric.cpp:150
int indexOfWell() const
Index of well in the wells struct and wellState.
Definition WellInterfaceGeneric.cpp:175
bool underPredictionMode() const
Returns true if the well is currently in prediction mode (i.e. not history mode).
Definition WellInterfaceGeneric.cpp:359
The state of a set of wells, tailored for use by the fully implicit blackoil simulator.
Definition WellState.hpp:62
This file contains a set of helper functions used by VFPProd / VFPInj.
Definition blackoilboundaryratevector.hh:37
Solver parameters for the BlackoilModel.
Definition BlackoilModelParameters.hpp:162
Static data associated with a well perforation.
Definition WellState.hpp:54
Definition BlackoilPhases.hpp:46
Definition WellInterfaceGeneric.hpp:230