opm-common
Well.hpp
1 /*
2  Copyright 2019 Equinor ASA.
3 
4  This file is part of the Open Porous Media project (OPM).
5 
6  OPM is free software: you can redistribute it and/or modify
7  it under the terms of the GNU General Public License as published by
8  the Free Software Foundation, either version 3 of the License, or
9  (at your option) any later version.
10 
11  OPM is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  GNU General Public License for more details.
15 
16  You should have received a copy of the GNU General Public License
17  along with OPM. If not, see <http://www.gnu.org/licenses/>.
18 */
19 
20 #ifndef WELL2_HPP
21 #define WELL2_HPP
22 
23 #include <opm/input/eclipse/Deck/UDAValue.hpp>
24 #include <opm/input/eclipse/EclipseState/Phase.hpp>
25 #include <opm/input/eclipse/Schedule/ScheduleTypes.hpp>
26 #include <opm/input/eclipse/Schedule/VFPProdTable.hpp>
27 #include <opm/input/eclipse/Schedule/Well/Connection.hpp>
28 #include <opm/input/eclipse/Schedule/Well/PAvg.hpp>
29 #include <opm/input/eclipse/Schedule/Well/WellEnums.hpp>
30 #include <opm/input/eclipse/Schedule/Well/WellInjectionControls.hpp>
31 #include <opm/input/eclipse/Schedule/Well/WellProductionControls.hpp>
32 #include <opm/input/eclipse/Schedule/Well/WINJMULT.hpp>
33 #include <opm/input/eclipse/Units/UnitSystem.hpp>
34 
35 #include <cstddef>
36 #include <iosfwd>
37 #include <map>
38 #include <memory>
39 #include <optional>
40 #include <string>
41 #include <utility>
42 #include <vector>
43 
44 namespace Opm {
45 
46 class ActiveGridCells;
47 class AutoICD;
48 class DeckKeyword;
49 class DeckRecord;
50 class ErrorGuard;
51 class EclipseGrid;
52 class KeywordLocation;
53 class ParseContext;
54 class Phases;
55 class ScheduleGrid;
56 class SICD;
57 class SummaryState;
58 class UDQActive;
59 class UDQConfig;
60 class Valve;
61 class TracerConfig;
62 class WellConnections;
63 struct WellBrineProperties;
64 class WellEconProductionLimits;
65 struct WellFoamProperties;
66 struct WellMICPProperties;
67 struct WellPolymerProperties;
68 class WellSegments;
69 class WellTracerProperties;
70 class WVFPEXP;
71 class WVFPDP;
72 class WDFAC;
73 
74 namespace RestartIO {
75 struct RstWell;
76 }
77 
78 class Well {
79 public:
80  using Status = WellStatus;
81 
82  /*
83  * The mode for the keyword WINJMULT. It can have four different values: WREV, CREV, CIRR and NONE.
84  */
85  using InjMultMode = InjMult::InjMultMode;
86 
87  /*
88  The elements in this enum are used as bitmasks to keep track
89  of which controls are present, i.e. the 2^n structure must
90  be intact.
91  */
92  using InjectorCMode = WellInjectorCMode;
93 
94  /*
95  The properties are initialized with the CMODE_UNDEFINED
96  value, but the undefined value is never assigned apart from
97  that; and it is not part of the string conversion routines.
98  */
99  using ProducerCMode = WellProducerCMode;
100 
101  using WELTARGCMode = WellWELTARGCMode;
102 
103  using GuideRateTarget = WellGuideRateTarget;
104 
105  using GasInflowEquation = WellGasInflowEquation;
106 
107  void flag_lgr_well();
108  void set_lgr_well_tag(const std::string& lgr_tag_name);
109  void setInsertIndexLGR(const std::size_t index);
110  void setInsertIndexAllLGR(const std::size_t index);
111 
112  std::size_t seqIndexLGR() const { return insert_index_lgr; }
113  std::size_t seqIndexAllLGR() const { return insert_index_all_lgr; }
114 
115  bool is_lgr_well() const;
116  std::optional<std::string> get_lgr_well_tag() const;
117  struct WellGuideRate {
118  bool available;
119  double guide_rate;
120  GuideRateTarget guide_phase;
121  double scale_factor;
122 
123  static WellGuideRate serializationTestObject()
124  {
125  WellGuideRate result;
126  result.available = true;
127  result.guide_rate = 1.0;
128  result.guide_phase = GuideRateTarget::COMB;
129  result.scale_factor = 2.0;
130 
131  return result;
132  }
133 
134  bool operator==(const WellGuideRate& data) const {
135  return available == data.available &&
136  guide_rate == data.guide_rate &&
137  guide_phase == data.guide_phase &&
138  scale_factor == data.scale_factor;
139  }
140 
141  template<class Serializer>
142  void serializeOp(Serializer& serializer)
143  {
144  serializer(available);
145  serializer(guide_rate);
146  serializer(guide_phase);
147  serializer(scale_factor);
148  }
149  };
150 
152 
154  std::string name;
155  UDAValue surfaceInjectionRate;
156  UDAValue reservoirInjectionRate;
157  UDAValue BHPTarget;
158  UDAValue THPTarget;
159 
160  double bhp_hist_limit = 0.0;
161  double thp_hist_limit = 0.0;
162 
163  double BHPH;
164  double THPH;
165  int VFPTableNumber;
166  bool predictionMode;
167  int injectionControls;
168  InjectorType injectorType;
169  InjectorCMode controlMode;
170 
171  double rsRvInj;
172 
173  // injection stream compostion for compositional simulation
174  std::optional<std::vector<double>> gas_inj_composition{};
175 
176  bool operator==(const WellInjectionProperties& other) const;
177  bool operator!=(const WellInjectionProperties& other) const;
178 
180  WellInjectionProperties(const UnitSystem& units, const std::string& wname);
181 
182  static WellInjectionProperties serializationTestObject();
183 
184  void handleWELTARG(WELTARGCMode cmode, const UDAValue& new_arg, double SIFactorP);
185 
192  void handleWCONINJE(const DeckRecord& record,
193  const double bhp_def,
194  bool availableForGroupControl,
195  const std::string& well_name,
196  const KeywordLocation& location);
197 
205  void handleWCONINJH(const DeckRecord& record,
206  const int vfp_table_nr,
207  const double bhp_def,
208  const bool is_producer,
209  const std::string& well_name,
210  const KeywordLocation& loc);
211 
212  bool hasInjectionControl(InjectorCMode controlModeArg) const {
213  if (injectionControls & static_cast<int>(controlModeArg))
214  return true;
215  else
216  return false;
217  }
218 
219  void dropInjectionControl(InjectorCMode controlModeArg) {
220  auto int_arg = static_cast<int>(controlModeArg);
221  if ((injectionControls & int_arg) != 0)
222  injectionControls -= int_arg;
223  }
224 
225  void addInjectionControl(InjectorCMode controlModeArg) {
226  auto int_arg = static_cast<int>(controlModeArg);
227  if ((injectionControls & int_arg) == 0)
228  injectionControls += int_arg;
229  }
230 
231  void clearControls();
232 
233  void resetDefaultHistoricalBHPLimit();
234  void resetBHPLimit();
235  void setBHPLimit(const double limit);
236  InjectionControls controls(const UnitSystem& unit_system, const SummaryState& st, double udq_default) const;
237  bool updateUDQActive(const UDQConfig& udq_config, UDQActive& active) const;
238  bool updateUDQActive(const UDQConfig& udq_config, const WELTARGCMode cmode, UDQActive& active) const;
239  void update_uda(const UDQConfig& udq_config, UDQActive& udq_active, UDAControl control, const UDAValue& value);
240  void handleWTMULT(Well::WELTARGCMode cmode, double factor);
241 
242  void setGasInjComposition(const std::vector<double>& composition);
243  const std::vector<double>& gasInjComposition() const;
244 
245  template<class Serializer>
246  void serializeOp(Serializer& serializer)
247  {
248  serializer(name);
249  serializer(surfaceInjectionRate);
250  serializer(reservoirInjectionRate);
251  serializer(BHPTarget);
252  serializer(THPTarget);
253  serializer(bhp_hist_limit);
254  serializer(thp_hist_limit);
255  serializer(BHPH);
256  serializer(THPH);
257  serializer(VFPTableNumber);
258  serializer(predictionMode);
259  serializer(injectionControls);
260  serializer(injectorType);
261  serializer(controlMode);
262  serializer(rsRvInj);
263  serializer(gas_inj_composition);
264  }
265  };
266 
268 
270  public:
271  // the rates serve as limits under prediction mode
272  // while they are observed rates under historical mode
273  std::string name;
274  UDAValue OilRate;
275  UDAValue WaterRate;
276  UDAValue GasRate;
277  UDAValue LiquidRate;
278  UDAValue ResVRate;
279  UDAValue BHPTarget;
280  UDAValue THPTarget;
281  UDAValue ALQValue;
282 
283  // BHP and THP limit
284  double bhp_hist_limit = 0.0;
285  double thp_hist_limit = 0.0;
286  bool bhp_hist_limit_defaulted = true; // Tracks whether value was defaulted or not
287 
288  // historical BHP and THP under historical mode
289  double BHPH = 0.0;
290  double THPH = 0.0;
291  int VFPTableNumber = 0;
292  bool predictionMode = false;
293  ProducerCMode controlMode = ProducerCMode::CMODE_UNDEFINED;
294  ProducerCMode whistctl_cmode = ProducerCMode::CMODE_UNDEFINED;
295 
296  bool operator==(const WellProductionProperties& other) const;
297  bool operator!=(const WellProductionProperties& other) const;
298 
300  WellProductionProperties(const UnitSystem& units, const std::string& name_arg);
301 
302  static WellProductionProperties serializationTestObject();
303 
304  bool hasProductionControl(ProducerCMode controlModeArg) const {
305  return (m_productionControls & static_cast<int>(controlModeArg)) != 0;
306  }
307 
308  void dropProductionControl(ProducerCMode controlModeArg) {
309  if (hasProductionControl(controlModeArg))
310  m_productionControls -= static_cast<int>(controlModeArg);
311  }
312 
313  void addProductionControl(ProducerCMode controlModeArg) {
314  if (! hasProductionControl(controlModeArg))
315  m_productionControls += static_cast<int>(controlModeArg);
316  }
317 
318  // this is used to check whether the specified control mode is an effective history matching production mode
319  static bool effectiveHistoryProductionControl(ProducerCMode cmode);
320 
330  void handleWCONPROD(const std::optional<VFPProdTable::ALQ_TYPE>& alq_type,
331  const int vfp_table_nr,
332  const double bhp_def,
333  const UnitSystem& unit_system,
334  const std::string& well,
335  const Phases& phases,
336  const DeckRecord& record,
337  const KeywordLocation& location);
338 
345  void handleWCONHIST(const std::optional<VFPProdTable::ALQ_TYPE>& alq_type,
346  const int vfp_table_nr,
347  const double bhp_def,
348  const UnitSystem& unit_system,
349  const DeckRecord& record);
350  void handleWELTARG( WELTARGCMode cmode, const UDAValue& new_arg, double SiFactorP);
351  void resetDefaultBHPLimit();
352  void clearControls();
353  ProductionControls controls(const SummaryState& st, double udq_default) const;
354  bool updateUDQActive(const UDQConfig& udq_config, UDQActive& active) const;
355  bool updateUDQActive(const UDQConfig& udq_config, const WELTARGCMode cmode, UDQActive& active) const;
356  void update_uda(const UDQConfig& udq_config, UDQActive& udq_active, UDAControl control, const UDAValue& value);
357 
358  void setBHPLimit(const double limit);
359  int productionControls() const { return this->m_productionControls; }
360  void handleWTMULT(Well::WELTARGCMode cmode, double factor);
361 
362  template<class Serializer>
363  void serializeOp(Serializer& serializer)
364  {
365  serializer(name);
366  serializer(OilRate);
367  serializer(WaterRate);
368  serializer(GasRate);
369  serializer(LiquidRate);
370  serializer(ResVRate);
371  serializer(BHPTarget);
372  serializer(THPTarget);
373  serializer(ALQValue);
374  serializer(bhp_hist_limit);
375  serializer(thp_hist_limit);
376  serializer(BHPH);
377  serializer(THPH);
378  serializer(VFPTableNumber);
379  serializer(predictionMode);
380  serializer(controlMode);
381  serializer(whistctl_cmode);
382  serializer(m_productionControls);
383  }
384 
385  private:
386  int m_productionControls = 0;
387  void init_rates( const DeckRecord& record );
388 
389  void init_history(const DeckRecord& record);
390  void init_vfp(const std::optional<VFPProdTable::ALQ_TYPE>& alq_type, const int vfp_table_nr, const UnitSystem& unit_system, const DeckRecord& record);
391 
392  explicit WellProductionProperties(const DeckRecord& record);
393 
394  double getBHPLimit() const;
395  };
396 
397  static int eclipseControlMode(const Well::InjectorCMode imode,
398  const InjectorType itype);
399 
400  static int eclipseControlMode(const Well::ProducerCMode pmode);
401 
402  static int eclipseControlMode(const Well& well,
403  const SummaryState& st);
404 
405  Well() = default;
406  Well(const std::string& wname,
407  const std::string& gname,
408  std::size_t init_step,
409  std::size_t insert_index,
410  int headI,
411  int headJ,
412  const std::optional<double>& ref_depth,
413  const WellType& wtype_arg,
414  ProducerCMode whistctl_cmode,
415  Connection::Order ordering,
416  const UnitSystem& unit_system,
417  double udq_undefined,
418  double dr,
419  bool allow_xflow,
420  bool auto_shutin,
421  int pvt_table,
422  GasInflowEquation inflow_eq,
423  bool temp_option = false);
424 
425  Well(const RestartIO::RstWell& rst_well,
426  int report_step,
427  int rst_whistctl_cmode,
428  const TracerConfig& tracer_config,
429  const UnitSystem& unit_system,
430  double udq_undefined,
431  const std::optional<VFPProdTable::ALQ_TYPE>& alq_type);
432 
433  static Well serializationTestObject();
434 
435  bool isMultiSegment() const;
436  bool isAvailableForGroupControl() const;
437  double getGuideRate() const;
438  GuideRateTarget getGuideRatePhase() const;
439  GuideRateTarget getRawGuideRatePhase() const;
440  double getGuideRateScalingFactor() const;
441 
442  bool hasBeenDefined(std::size_t timeStep) const;
443  std::size_t firstTimeStep() const;
444  const WellType& wellType() const;
445  bool predictionMode() const;
446  bool isProducer() const;
447  bool isInjector() const;
448  InjectorCMode injection_cmode() const;
449  ProducerCMode production_cmode() const;
450  InjectorType injectorType() const;
451  std::size_t seqIndex() const;
452  bool getAutomaticShutIn() const;
453  bool getAllowCrossFlow() const;
454  const std::string& name() const;
455  const std::vector<std::string>& wListNames() const;
456  int getHeadI() const;
457  int getHeadJ() const;
458  double getWPaveRefDepth() const;
459  bool hasRefDepth() const;
460  double getRefDepth() const;
461  double getDrainageRadius() const;
462  double getEfficiencyFactor(bool network = false) const;
463  double getSolventFraction() const;
464  Status getStatus() const;
465  const std::string& groupName() const;
466  Phase getPreferredPhase() const;
467  InjMultMode getInjMultMode() const;
468  const InjMult& getWellInjMult() const;
469  bool aciveWellInjMult() const;
470 
471  bool hasConnections() const;
472  std::vector<const Connection *> getConnections(int completion) const;
473  const WellConnections& getConnections() const;
474  WellConnections& getConnections();
475  const WellSegments& getSegments() const;
476  int maxSegmentID() const;
477  int maxBranchID() const;
478 
479  const WellProductionProperties& getProductionProperties() const;
480  const WellInjectionProperties& getInjectionProperties() const;
481  const WellEconProductionLimits& getEconLimits() const;
482  const WellFoamProperties& getFoamProperties() const;
483  const WellPolymerProperties& getPolymerProperties() const;
484  const WellMICPProperties& getMICPProperties() const;
485  const WellBrineProperties& getBrineProperties() const;
486  const WellTracerProperties& getSpeciesProperties() const;
487  const WellTracerProperties& getTracerProperties() const;
488  const WVFPDP& getWVFPDP() const;
489  const WVFPEXP& getWVFPEXP() const;
490  const WDFAC& getWDFAC() const;
491 
492  /* The rate of a given phase under the following assumptions:
493  * * Returns zero if production is requested for an injector (and vice
494  * versa)
495  * * If this is an injector and something else than the
496  * requested phase is injected, returns 0, i.e.
497  * water_injector.injection_rate( gas ) == 0
498  * * Mixed injection is not supported and always returns 0.
499  */
500  double production_rate( const SummaryState& st, Phase phase) const;
501  double injection_rate( const SummaryState& st, Phase phase) const;
502  static bool wellNameInWellNamePattern(const std::string& wellName, const std::string& wellNamePattern);
503 
504  /*
505  The getCompletions() function will return a map:
506 
507  {
508  1 : [Connection, Connection],
509  2 : [Connection, Connection, Connecton],
510  3 : [Connection],
511  4 : [Connection]
512  }
513 
514  The integer ID's correspond to the COMPLETION id given by the COMPLUMP
515  keyword.
516  */
517  std::map<int, std::vector<Connection>> getCompletions() const;
518  /*
519  For hasCompletion(int completion) and getConnections(int completion) the
520  completion argument is an integer ID used to denote a collection of
521  connections. The integer ID is assigned with the COMPLUMP keyword.
522  */
523  bool hasCompletion(int completion) const;
524  bool updatePrediction(bool prediction_mode);
525  bool updateAutoShutin(bool auto_shutin);
526  bool updateCrossFlow(bool allow_cross_flow);
527  bool updatePVTTable(std::optional<int> pvt_table);
528  bool updateHead(std::optional<int> I, std::optional<int> J);
529  void updateRefDepth();
530  bool updateRefDepth(std::optional<double> ref_dpeth);
531  bool updateDrainageRadius(std::optional<double> drainage_radius);
532  void updateSegments(std::shared_ptr<WellSegments> segments_arg);
533  bool updateConnections(std::shared_ptr<WellConnections> connections, bool force);
534  bool updateConnections(std::shared_ptr<WellConnections> connections, const ScheduleGrid& grid);
535  bool updateStatus(Status status);
536  bool updateGroup(const std::string& group);
537  bool updateWellGuideRate(bool available, double guide_rate, GuideRateTarget guide_phase, double scale_factor);
538  bool updateWellGuideRate(double guide_rate);
539  bool updateAvailableForGroupControl(bool available);
540  bool updateEfficiencyFactor(double efficiency_factor, bool use_efficiency_in_network);
541 
542  bool updateSolventFraction(double solvent_fraction);
543  bool updateSpecies(std::shared_ptr<WellTracerProperties> species_properties);
544  bool updateTracer(std::shared_ptr<WellTracerProperties> tracer_properties);
545  bool updateFoamProperties(std::shared_ptr<WellFoamProperties> foam_properties);
546  bool updatePolymerProperties(std::shared_ptr<WellPolymerProperties> polymer_properties);
547  bool updateMICPProperties(std::shared_ptr<WellMICPProperties> micp_properties);
548  bool updateBrineProperties(std::shared_ptr<WellBrineProperties> brine_properties);
549  bool updateEconLimits(std::shared_ptr<WellEconProductionLimits> econ_limits);
550  bool updateProduction(std::shared_ptr<WellProductionProperties> production);
551  bool updateInjection(std::shared_ptr<WellInjectionProperties> injection);
552  bool updateWellProductivityIndex();
553 
554  bool updateWSEGAICD(const std::vector<std::pair<int, AutoICD>>& aicd_pairs,
555  const KeywordLocation& location,
556  const ParseContext& parseContext,
557  ErrorGuard& errors);
558 
559  bool updateWSEGSICD(const std::vector<std::pair<int, SICD>>& sicd_pairs,
560  const KeywordLocation& location,
561  const ParseContext& parseContext,
562  ErrorGuard& errors);
563 
564  bool updateWSEGVALV(const std::vector<std::pair<int, Valve>>& valve_pairs,
565  const KeywordLocation& location,
566  const ParseContext& parseContext,
567  ErrorGuard& errors);
568 
569  bool updateICDFlowScalingFactors();
570  bool updateWPAVE(const PAvg& pavg);
571 
572 
573  void updateWPaveRefDepth(double ref_depth);
574  bool updateWVFPDP(std::shared_ptr<WVFPDP> wvfpdp);
575  bool updateWVFPEXP(std::shared_ptr<WVFPEXP> wvfpexp);
576  bool updateWDFAC(std::shared_ptr<WDFAC> wdfac);
577 
578  bool handleWELSEGS(const DeckKeyword& keyword);
579  bool handleCOMPSEGS(const DeckKeyword& keyword, const ScheduleGrid& grid, const ParseContext& parseContext, ErrorGuard& errors);
580  bool handleWELOPENConnections(const DeckRecord& record, Connection::State status);
581  bool handleCSKIN(const DeckRecord& record, const KeywordLocation& location);
582  bool handleCOMPLUMP(const DeckRecord& record);
583  bool handleWPIMULT(const DeckRecord& record);
584  bool handleWINJCLN(const DeckRecord& record, const KeywordLocation& location);
585  bool handleWINJDAM(const DeckRecord& record, const KeywordLocation& location);
586  bool handleWINJMULT(const DeckRecord& record, const KeywordLocation& location);
587  void setFilterConc(const UDAValue& conc);
588  double evalFilterConc(const SummaryState& summary_sate) const;
589  bool applyGlobalWPIMULT(double scale_factor);
590  void addWellSegmentsFromLengthsAndDepths(const std::vector<std::pair<double, double>>& lengths_and_depths, double diameter, const KeywordLocation& location);
591 
592  ProductionControls productionControls(const SummaryState& st) const;
593  InjectionControls injectionControls(const SummaryState& st) const;
594  int vfp_table_number() const;
595  int pvt_table_number() const;
596  int fip_region_number() const;
597  GasInflowEquation gas_inflow_equation() const;
598  bool segmented_density_calculation() const { return true; }
599  double alq_value(const SummaryState& st) const;
600  double inj_temperature() const;
601  bool hasInjTemperature() const;
602  void setWellInjTemperature(const double temp);
603  bool hasInjected( ) const;
604  bool hasProduced( ) const;
605  bool updateHasInjected( );
606  bool updateHasProduced();
607  bool cmp_structure(const Well& other) const;
608  bool operator==(const Well& data) const;
609  bool hasSameConnectionsPointers(const Well& other) const;
610  void setInsertIndex(std::size_t index);
611  double convertDeckPI(double deckPI) const;
612  void applyWellProdIndexScaling(const double scalingFactor,
613  std::vector<bool>& scalingApplicable);
614  const PAvg& pavg() const;
615 
617  void updateUnitSystem(const UnitSystem* usys) { unit_system = usys; }
618 
619  template<class Serializer>
620  void serializeOp(Serializer& serializer)
621  {
622  serializer(wname);
623  serializer(group_name);
624  serializer(init_step);
625  serializer(insert_index);
626  serializer(insert_index_lgr);
627  serializer(insert_index_all_lgr);
628  serializer(headI);
629  serializer(headJ);
630  serializer(ref_depth);
631  serializer(wpave_ref_depth);
632  serializer(udq_undefined);
633  serializer(status);
634  serializer(drainage_radius);
635  serializer(allow_cross_flow);
636  serializer(automatic_shutin);
637  serializer(pvt_table);
638  serializer(gas_inflow);
639  serializer(wtype);
640  serializer(ref_type);
641  serializer(lgr_tag);
642  serializer(guide_rate);
643  serializer(efficiency_factor);
644  serializer(use_efficiency_in_network);
645  serializer(solvent_fraction);
646  serializer(has_produced);
647  serializer(has_injected);
648  serializer(prediction_mode);
649  serializer(derive_refdepth_from_conns_);
650  serializer(econ_limits);
651  serializer(foam_properties);
652  serializer(polymer_properties);
653  serializer(micp_properties);
654  serializer(brine_properties);
655  serializer(species_properties);
656  serializer(tracer_properties);
657  serializer(connections);
658  serializer(production);
659  serializer(injection);
660  serializer(segments);
661  serializer(wvfpdp);
662  serializer(wdfac);
663  serializer(wvfpexp);
664  serializer(m_pavg);
665  serializer(well_inj_temperature);
666  serializer(default_well_inj_temperature);
667  serializer(inj_mult_mode);
668  serializer(well_inj_mult);
669  serializer(m_filter_concentration);
670  }
671 
672 private:
673  enum class WellRefinementType {
674  STANDARD,
675  LGR,
676  MIXED,
677  };
678  void switchToInjector();
679  void switchToProducer();
680 
681  GuideRateTarget preferredPhaseAsGuideRatePhase() const;
682 
683  std::string wname{};
684  std::string group_name{};
685 
686  std::size_t init_step{};
687  std::size_t insert_index{};
688  // counts wells in a single LGR
689  std::size_t insert_index_lgr{0};
690  // counts wells in all LGRs combined
691  std::size_t insert_index_all_lgr{0};
692  int headI{};
693  int headJ{};
694  std::optional<double> ref_depth{};
695  std::optional<double> wpave_ref_depth{};
696  double drainage_radius{};
697  bool allow_cross_flow{false};
698  bool automatic_shutin{false};
699  int pvt_table{};
700 
701 
702  // Will NOT be loaded/assigned from restart file
703  GasInflowEquation gas_inflow = GasInflowEquation::STD;
704 
705  const UnitSystem* unit_system{nullptr};
706  double udq_undefined{};
707  WellType wtype{};
708  WellRefinementType ref_type{WellRefinementType::STANDARD};
709  std::string lgr_tag{};
710  WellGuideRate guide_rate{};
711  double efficiency_factor{};
712  bool use_efficiency_in_network{};
713  double solvent_fraction{};
714  bool has_produced = false;
715  bool has_injected = false;
716  bool prediction_mode = true;
717  bool derive_refdepth_from_conns_ { true };
718 
719  std::shared_ptr<WellEconProductionLimits> econ_limits{};
720  std::shared_ptr<WellFoamProperties> foam_properties{};
721  std::shared_ptr<WellPolymerProperties> polymer_properties{};
722  std::shared_ptr<WellMICPProperties> micp_properties{};
723  std::shared_ptr<WellBrineProperties> brine_properties{};
724  std::shared_ptr<WellTracerProperties> species_properties{}; // NOTE: well tracer facilities used for geochemistry
725  std::shared_ptr<WellTracerProperties> tracer_properties{};
726 
727  // The WellConnections object cannot be const because of WELPI and the
728  // filterConnections method
729  std::shared_ptr<WellConnections> connections{};
730 
731  std::shared_ptr<WellProductionProperties> production{};
732  std::shared_ptr<WellInjectionProperties> injection{};
733  std::shared_ptr<WellSegments> segments{};
734  std::shared_ptr<WVFPDP> wvfpdp{};
735  std::shared_ptr<WVFPEXP> wvfpexp{};
736  std::shared_ptr<WDFAC> wdfac{};
737 
738  Status status{Status::AUTO};
739  PAvg m_pavg{};
740  std::optional<double> well_inj_temperature{};
741  std::optional<double> default_well_inj_temperature{std::nullopt};
742  InjMultMode inj_mult_mode = InjMultMode::NONE;
743  std::optional<InjMult> well_inj_mult{};
744  UDAValue m_filter_concentration{};
745 };
746 
747 std::ostream& operator<<( std::ostream&, const Well::WellInjectionProperties& );
748 std::ostream& operator<<( std::ostream&, const Well::WellProductionProperties& );
749 
750 }
751 #endif
Collection of all user-defined quantities in the current simulation run.
Definition: UDQConfig.hpp:68
Definition: Well.hpp:153
void handleWCONINJH(const DeckRecord &record, const int vfp_table_nr, const double bhp_def, const bool is_producer, const std::string &well_name, const KeywordLocation &loc)
Handle a WCONINJH keyword.
Definition: WellInjectionProperties.cpp:201
void handleWCONPROD(const std::optional< VFPProdTable::ALQ_TYPE > &alq_type, const int vfp_table_nr, const double bhp_def, const UnitSystem &unit_system, const std::string &well, const Phases &phases, const DeckRecord &record, const KeywordLocation &location)
Handle WCONPROD keyword.
Definition: WellProductionProperties.cpp:171
Definition: WellFoamProperties.hpp:28
Definition: Well.hpp:269
Definition: KeywordLocation.hpp:27
Definition: UDAValue.hpp:31
Definition: WDFAC.hpp:39
Definition: WellPolymerProperties.hpp:28
Definition: WellSegments.hpp:55
Definition: Well.hpp:78
This class implements a small container which holds the transmissibility mulitpliers for all the face...
Definition: Exceptions.hpp:30
Collection of intersected cells and associate properties for all simulation grids, i.e., the main grid and all LGRs in the simulation run.
Definition: ScheduleGrid.hpp:49
void handleWCONINJE(const DeckRecord &record, const double bhp_def, bool availableForGroupControl, const std::string &well_name, const KeywordLocation &location)
Handle a WCONINJE keyword.
Definition: WellInjectionProperties.cpp:91
Definition: WellTracerProperties.hpp:34
Definition: Well.hpp:117
Definition: WVFPEXP.hpp:33
Internalised representation of all UDAs in a simulation run.
Definition: UDQActive.hpp:49
Definition: WellBrineProperties.hpp:28
Definition: WellProductionControls.hpp:31
Definition: TracerConfig.hpp:33
Definition: WellInjectionControls.hpp:31
Definition: well.hpp:42
void updateUnitSystem(const UnitSystem *usys)
Used by schedule deserialization.
Definition: Well.hpp:617
Definition: WellMICPProperties.hpp:28
Definition: UnitSystem.hpp:34
Definition: SummaryState.hpp:72
Control parser behaviour in failure conditions.
Definition: ParseContext.hpp:114
Definition: WellEconProductionLimits.hpp:33
Definition: WellConnections.hpp:48
void handleWCONHIST(const std::optional< VFPProdTable::ALQ_TYPE > &alq_type, const int vfp_table_nr, const double bhp_def, const UnitSystem &unit_system, const DeckRecord &record)
Handle WCONHIST keyword.
Definition: WellProductionProperties.cpp:280
Definition: PAvg.hpp:29
Definition: ScheduleTypes.hpp:39
Definition: DeckRecord.hpp:32
Definition: WINJMULT.hpp:30
Definition: WVFPDP.hpp:33
Class for (de-)serializing.
Definition: Serializer.hpp:94
Definition: DeckKeyword.hpp:36
Definition: Runspec.hpp:45
Definition: ErrorGuard.hpp:30