63 const int pvtRegionIdx,
74 const std::string&
name()
const;
83 const std::vector<int>&
cells()
const {
return well_cells_; }
88 void adaptRatesForVFP(std::vector<Scalar>& rates)
const;
90 const Well& wellEcl()
const;
98 bool isOperableAndSolvable()
const;
99 bool useVfpExplicit ()
const;
100 bool thpLimitViolatedButNotSwitched()
const;
102 void initCompletions();
106 void setPrevSurfaceRates(WellStateType& well_state,
110 void setRepRadiusPerfLength();
111 void setWsolvent(
const Scalar wsolvent);
112 void setDynamicThpLimit(
const Scalar
thp_limit);
113 std::optional<Scalar> getDynamicThpLimit()
const;
114 void setDynamicThpLimit(
const std::optional<Scalar>
thp_limit);
120 void stopWell() { this->wellStatus_ = Well::Status::STOP; }
121 void openWell() { this->wellStatus_ = Well::Status::OPEN; }
122 Well::Status wellStatus() {
return this->wellStatus_;}
124 bool wellIsStopped()
const {
return this->wellStatus_ == Well::Status::STOP; }
126 int currentStep()
const {
return this->current_step_; }
128 int pvtRegionIdx()
const {
return pvtRegionIdx_; }
130 const GuideRate* guideRate()
const {
return guide_rate_; }
132 int numConservationQuantities()
const {
return num_conservation_quantities_; }
134 int numPhases()
const {
return number_of_phases_; }
136 int numLocalPerfs()
const {
return number_of_local_perforations_; }
138 Scalar refDepth()
const {
return ref_depth_; }
140 Scalar gravity()
const {
return gravity_; }
146 const std::vector<Scalar>& perfDepth()
const {
return perf_depth_; }
148 std::vector<Scalar>& perfDepth() {
return perf_depth_; }
150 const std::vector<Scalar>& wellIndex()
const {
return well_index_; }
152 const std::map<int,std::vector<int>>& getCompletions()
const {
return completions_; }
154 Scalar getTHPConstraint(
const SummaryState& summaryState)
const;
155 Scalar getALQ(
const WellStateType& well_state)
const;
156 Scalar wsolvent()
const;
157 Scalar rsRvInj()
const;
160 void initInjMult(
const std::vector<Scalar>&
max_inj_mult);
176 bool changedToOpenThisStep()
const {
return this->changed_to_open_this_step_; }
185 bool isPressureControlled(
const WellStateType& well_state)
const;
187 Scalar wellEfficiencyFactor()
const {
return well_efficiency_factor_; }
195 void resetWellOperability();
197 virtual std::vector<Scalar> getPrimaryVars()
const
202 virtual int setPrimaryVars(
typename std::vector<Scalar>::const_iterator)
210 void addPerforations(
const std::vector<RuntimePerforation>&
perfs);
213 bool getAllowCrossFlow()
const;
215 Scalar wmicrobes_()
const;
216 Scalar wfoam_()
const;
217 Scalar woxygen_()
const;
218 Scalar wpolymer_()
const;
219 Scalar wsalt_()
const;
220 Scalar wurea_()
const;
222 int polymerTable_()
const;
223 int polymerInjTable_()
const;
224 int polymerWaterTable_()
const;
232 computeWellPotentials(std::vector<Scalar>& well_potentials,
233 const WellStateType& well_state);
235 void checkNegativeWellPotentials(std::vector<Scalar>& well_potentials,
241 WellStateType& well_state,
245 void resetDampening() {
246 std::fill(this->inj_multiplier_damp_factor_.begin(),
this->inj_multiplier_damp_factor_.end(), 1.0);
252 bool isOperableAndSolvable()
const
254 if (!operable_under_only_bhp_limit || !solvable || has_negative_potentials) {
257 return ( (isOperableUnderBHPLimit() || isOperableUnderTHPLimit()) );
261 bool isOperableUnderBHPLimit()
const
263 return operable_under_only_bhp_limit && obey_thp_limit_under_bhp_limit;
266 bool isOperableUnderTHPLimit()
const
268 return can_obtain_bhp_with_thp_limit && obey_bhp_limit_with_thp_limit;
271 void resetOperability()
273 operable_under_only_bhp_limit =
true;
274 obey_thp_limit_under_bhp_limit =
true;
275 can_obtain_bhp_with_thp_limit =
true;
276 obey_bhp_limit_with_thp_limit =
true;
282 bool operable_under_only_bhp_limit =
true;
285 bool obey_thp_limit_under_bhp_limit =
true;
287 bool can_obtain_bhp_with_thp_limit =
true;
289 bool obey_bhp_limit_with_thp_limit =
true;
291 bool solvable =
true;
293 bool has_negative_potentials =
false;
295 mutable bool thp_limit_violated_but_not_switched =
false;
297 bool use_vfpexplicit =
false;
305 const int current_step_;
310 const int pvtRegionIdx_;
312 const int num_conservation_quantities_;
315 int number_of_phases_;
322 const std::vector<PerforationData<Scalar>>* perf_data_;
328 mutable std::vector<Scalar> ipr_a_;
329 mutable std::vector<Scalar> ipr_b_;
332 std::vector<int> well_cells_;
335 std::vector<Scalar> well_index_;
338 int number_of_local_perforations_;
341 std::vector<Scalar> perf_depth_;
344 std::vector<Scalar> perf_rep_radius_;
347 std::vector<Scalar> perf_length_;
350 std::vector<Scalar> bore_diameters_;
367 std::map<int, std::vector<int>> completions_;
373 std::vector<int> saturation_table_number_;
375 Well::Status wellStatus_;
379 std::optional<Scalar> dynamic_thp_limit_;
382 mutable std::vector<Scalar> inj_multiplier_;
386 std::vector<Scalar> prev_inj_multiplier_;
389 mutable std::vector<Scalar> inj_multiplier_previter_;
391 mutable std::vector<Scalar> inj_multiplier_damp_factor_;
394 std::vector<Scalar> inj_fc_multiplier_;
396 Scalar well_efficiency_factor_;
400 std::vector<std::string> well_control_log_;
402 bool changed_to_open_this_step_ =
true;