24#ifndef OPM_WELLINTERFACE_GENERIC_HEADER_INCLUDED
25#define OPM_WELLINTERFACE_GENERIC_HEADER_INCLUDED
27#include <opm/input/eclipse/Schedule/Well/Well.hpp>
39class ParallelWellInfo;
40struct PerforationData;
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;
89 bool isOperableAndSolvable()
const;
90 bool useVfpExplicit ()
const;
91 bool thpLimitViolatedButNotSwitched()
const;
93 void initCompletions();
94 void closeCompletions(
const WellTestState& wellTestState);
96 void setVFPProperties(
const VFPProperties* vfp_properties_arg);
97 void setGuideRate(
const GuideRate* guide_rate_arg);
98 void setWellEfficiencyFactor(
const double efficiency_factor);
99 void setRepRadiusPerfLength();
100 void setWsolvent(
const double wsolvent);
101 void setDynamicThpLimit(
const double thp_limit);
102 std::optional<double> getDynamicThpLimit()
const;
103 void updatePerforatedCell(std::vector<bool>& is_cell_perforated);
109 this->wellStatus_ = Well::Status::STOP;
113 this->wellStatus_ = Well::Status::OPEN;
116 bool wellIsStopped()
const {
117 return this->wellStatus_ == Well::Status::STOP;
120 int currentStep()
const {
121 return this->current_step_;
124 int pvtRegionIdx()
const {
125 return pvtRegionIdx_;
128 const GuideRate* guideRate()
const {
132 int numComponents()
const {
133 return num_components_;
136 int numPhases()
const {
137 return number_of_phases_;
140 int numPerfs()
const {
141 return number_of_perforations_;
144 double refDepth()
const {
148 double gravity()
const {
152 const VFPProperties* vfpProperties()
const {
153 return vfp_properties_;
156 const ParallelWellInfo& parallelWellInfo()
const {
157 return parallel_well_info_;
160 const std::vector<double>& perfDepth()
const {
164 std::vector<double>& perfDepth() {
168 const std::vector<double>& wellIndex()
const {
172 const std::map<int,std::vector<int>>& getCompletions()
const {
176 double getTHPConstraint(
const SummaryState& summaryState)
const;
177 double getALQ(
const WellState& well_state)
const;
178 double wsolvent()
const;
179 double rsRvInj()
const;
182 bool isVFPActive(DeferredLogger& deferred_logger)
const;
184 void reportWellSwitching(
const SingleWellState& ws, DeferredLogger& deferred_logger)
const;
186 bool changedToOpenThisStep()
const {
187 return this->changed_to_open_this_step_;
190 void updateWellTestState(
const SingleWellState& ws,
191 const double& simulationTime,
192 const bool& writeMessageToOPMLog,
193 WellTestState& wellTestState,
194 DeferredLogger& deferred_logger)
const;
196 bool isPressureControlled(
const WellState& well_state)
const;
198 bool stopppedOrZeroRateTarget(
const SummaryState& summary_state,
199 const WellState& well_state)
const;
201 bool getAllowCrossFlow()
const;
203 double wmicrobes_()
const;
204 double wfoam_()
const;
205 double woxygen_()
const;
206 double wpolymer_()
const;
207 double wsalt_()
const;
208 double wurea_()
const;
210 int polymerTable_()
const;
211 int polymerInjTable_()
const;
212 int polymerWaterTable_()
const;
214 bool wellUnderZeroRateTarget(
const SummaryState& summary_state,
215 const WellState& well_state)
const;
219 bool isOperableAndSolvable()
const {
220 if (!operable_under_only_bhp_limit || !solvable || has_negative_potentials) {
223 return ( (isOperableUnderBHPLimit() || isOperableUnderTHPLimit()) );
227 bool isOperableUnderBHPLimit()
const {
228 return operable_under_only_bhp_limit && obey_thp_limit_under_bhp_limit;
231 bool isOperableUnderTHPLimit()
const {
232 return can_obtain_bhp_with_thp_limit && obey_bhp_limit_with_thp_limit;
235 void resetOperability() {
236 operable_under_only_bhp_limit =
true;
237 obey_thp_limit_under_bhp_limit =
true;
238 can_obtain_bhp_with_thp_limit =
true;
239 obey_bhp_limit_with_thp_limit =
true;
245 bool operable_under_only_bhp_limit =
true;
248 bool obey_thp_limit_under_bhp_limit =
true;
250 bool can_obtain_bhp_with_thp_limit =
true;
252 bool obey_bhp_limit_with_thp_limit =
true;
254 bool solvable =
true;
256 bool has_negative_potentials =
false;
258 mutable bool thp_limit_violated_but_not_switched =
false;
260 bool use_vfpexplicit =
false;
268 const int current_step_;
272 const int pvtRegionIdx_;
274 const int num_components_;
277 int number_of_phases_;
282 const std::vector<PerforationData>* perf_data_;
288 mutable std::vector<double> ipr_a_;
289 mutable std::vector<double> ipr_b_;
292 std::vector<int> well_cells_;
295 std::vector<double> well_index_;
298 int number_of_perforations_;
301 std::vector<double> perf_depth_;
304 std::vector<double> perf_rep_radius_;
307 std::vector<double> perf_length_;
310 std::vector<double> bore_diameters_;
327 std::map<int, std::vector<int>> completions_;
333 std::vector<int> saturation_table_number_;
335 Well::Status wellStatus_;
341 std::optional<double> dynamic_thp_limit_;
343 double well_efficiency_factor_;
345 const GuideRate* guide_rate_;
347 std::vector< std::string> well_control_log_;
349 bool changed_to_open_this_step_ =
true;
Class encapsulating some information about parallel wells.
Definition: ParallelWellInfo.hpp:184
A thin wrapper class that holds one VFPProdProperties and one VFPInjProperties object.
Definition: VFPProperties.hpp:39
Definition: WellInterfaceGeneric.hpp:51
bool wellHasTHPConstraints(const SummaryState &summaryState) const
Returns true if the well has one or more THP limits/constraints.
Definition: WellInterfaceGeneric.cpp:193
const std::vector< int > & cells() const
Well cells.
Definition: WellInterfaceGeneric.hpp:75
int indexOfWell() const
Index of well in the wells struct and wellState.
Definition: WellInterfaceGeneric.cpp:161
const std::string & name() const
Well name.
Definition: WellInterfaceGeneric.cpp:146
bool underPredictionMode() const
Returns true if the well is currently in prediction mode (i.e. not history mode).
Definition: WellInterfaceGeneric.cpp:228
bool isProducer() const
True if the well is a producer.
Definition: WellInterfaceGeneric.cpp:156
bool isInjector() const
True if the well is an injector.
Definition: WellInterfaceGeneric.cpp:151
const std::vector< PerforationData > & perforationData() const
Get the perforations of the well.
Definition: WellInterfaceGeneric.cpp:141
This file contains a set of helper functions used by VFPProd / VFPInj.
Definition: BlackoilPhases.hpp:27
Definition: BlackoilPhases.hpp:46
Definition: WellInterfaceGeneric.hpp:218