56 const int pvtRegionIdx,
57 const int num_components,
59 const int index_of_well,
60 const std::vector<PerforationData>& perf_data);
66 const std::string&
name()
const;
75 const std::vector<int>&
cells()
const {
return well_cells_; }
80 void adaptRatesForVFP(std::vector<double>& rates)
const;
82 const Well& wellEcl()
const;
90 bool isOperableAndSolvable()
const;
91 bool useVfpExplicit ()
const;
92 bool thpLimitViolatedButNotSwitched()
const;
94 void initCompletions();
95 void closeCompletions(
const WellTestState& wellTestState);
97 void setVFPProperties(
const VFPProperties* vfp_properties_arg);
98 void setPrevSurfaceRates(
WellState& well_state,
const WellState& prev_well_state)
const;
99 void setGuideRate(
const GuideRate* guide_rate_arg);
100 void setWellEfficiencyFactor(
const double efficiency_factor);
101 void setRepRadiusPerfLength();
102 void setWsolvent(
const double wsolvent);
103 void setDynamicThpLimit(
const double thp_limit);
104 std::optional<double> getDynamicThpLimit()
const;
105 void updatePerforatedCell(std::vector<bool>& is_cell_perforated);
111 this->wellStatus_ = Well::Status::STOP;
115 this->wellStatus_ = Well::Status::OPEN;
118 bool wellIsStopped()
const {
119 return this->wellStatus_ == Well::Status::STOP;
122 int currentStep()
const {
123 return this->current_step_;
126 int pvtRegionIdx()
const {
127 return pvtRegionIdx_;
130 const GuideRate* guideRate()
const {
134 int numComponents()
const {
135 return num_components_;
138 int numPhases()
const {
139 return number_of_phases_;
142 int numPerfs()
const {
143 return number_of_perforations_;
146 double refDepth()
const {
150 double gravity()
const {
154 const VFPProperties* vfpProperties()
const {
155 return vfp_properties_;
158 const ParallelWellInfo& parallelWellInfo()
const {
159 return parallel_well_info_;
162 const std::vector<double>& perfDepth()
const {
166 std::vector<double>& perfDepth() {
170 const std::vector<double>& wellIndex()
const {
174 const std::map<int,std::vector<int>>& getCompletions()
const {
178 double getTHPConstraint(
const SummaryState& summaryState)
const;
179 double getALQ(
const WellState& well_state)
const;
180 double wsolvent()
const;
181 double rsRvInj()
const;
184 void initInjMult(
const std::vector<double>& max_inj_mult);
187 void updateInjMult(std::vector<double>& inj_multipliers, DeferredLogger& deferred_logger)
const;
191 double getInjMult(
const int perf,
const double bhp,
const double perf_pres)
const;
194 bool isVFPActive(DeferredLogger& deferred_logger)
const;
196 void reportWellSwitching(
const SingleWellState& ws, DeferredLogger& deferred_logger)
const;
198 bool changedToOpenThisStep()
const {
199 return this->changed_to_open_this_step_;
202 void updateWellTestState(
const SingleWellState& ws,
203 const double& simulationTime,
204 const bool& writeMessageToOPMLog,
205 WellTestState& wellTestState,
206 DeferredLogger& deferred_logger)
const;
208 bool isPressureControlled(
const WellState& well_state)
const;
210 bool stopppedOrZeroRateTarget(
const SummaryState& summary_state,
211 const WellState& well_state)
const;
213 double wellEfficiencyFactor()
const
214 {
return well_efficiency_factor_; }
219 inj_fc_multiplier_ = inj_fc_multiplier;
222 void resetWellOperability();
225 bool getAllowCrossFlow()
const;
227 double wmicrobes_()
const;
228 double wfoam_()
const;
229 double woxygen_()
const;
230 double wpolymer_()
const;
231 double wsalt_()
const;
232 double wurea_()
const;
234 int polymerTable_()
const;
235 int polymerInjTable_()
const;
236 int polymerWaterTable_()
const;
238 bool wellUnderZeroRateTarget(
const SummaryState& summary_state,
242 computeWellPotentials(std::vector<double>& well_potentials,
245 void checkNegativeWellPotentials(std::vector<double>& well_potentials,
246 const bool checkOperability,
249 void prepareForPotentialCalculations(
const SummaryState& summary_state,
251 Well::InjectionControls& inj_controls,
252 Well::ProductionControls& prod_controls)
const;
256 bool isOperableAndSolvable()
const {
257 if (!operable_under_only_bhp_limit || !solvable || has_negative_potentials) {
260 return ( (isOperableUnderBHPLimit() || isOperableUnderTHPLimit()) );
264 bool isOperableUnderBHPLimit()
const {
265 return operable_under_only_bhp_limit && obey_thp_limit_under_bhp_limit;
268 bool isOperableUnderTHPLimit()
const {
269 return can_obtain_bhp_with_thp_limit && obey_bhp_limit_with_thp_limit;
272 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_;
309 const int pvtRegionIdx_;
311 const int num_components_;
314 int number_of_phases_;
319 const std::vector<PerforationData>* perf_data_;
325 mutable std::vector<double> ipr_a_;
326 mutable std::vector<double> ipr_b_;
329 std::vector<int> well_cells_;
332 std::vector<double> well_index_;
335 int number_of_perforations_;
338 std::vector<double> perf_depth_;
341 std::vector<double> perf_rep_radius_;
344 std::vector<double> perf_length_;
347 std::vector<double> bore_diameters_;
364 std::map<int, std::vector<int>> completions_;
370 std::vector<int> saturation_table_number_;
372 Well::Status wellStatus_;
378 std::optional<double> dynamic_thp_limit_;
381 mutable std::vector<double> inj_multiplier_;
385 std::vector<double> prev_inj_multiplier_;
388 std::vector<double> inj_fc_multiplier_;
390 double well_efficiency_factor_;
392 const GuideRate* guide_rate_;
394 std::vector< std::string> well_control_log_;
396 bool changed_to_open_this_step_ =
true;