My Project
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 
21 #ifndef WELL2_HPP
22 #define WELL2_HPP
23 
24 #include <cstddef>
25 #include <iosfwd>
26 #include <map>
27 #include <memory>
28 #include <optional>
29 #include <string>
30 #include <utility>
31 #include <vector>
32 
33 #include <stddef.h>
34 
35 #include <opm/input/eclipse/Deck/UDAValue.hpp>
36 #include <opm/input/eclipse/EclipseState/Runspec.hpp>
37 #include <opm/input/eclipse/Schedule/Well/WellConnections.hpp>
38 #include <opm/input/eclipse/Schedule/MSW/WellSegments.hpp>
39 #include <opm/input/eclipse/Schedule/ScheduleTypes.hpp>
40 #include <opm/input/eclipse/Schedule/Well/PAvg.hpp>
41 #include <opm/input/eclipse/Schedule/Well/PAvgCalculator.hpp>
42 #include <opm/input/eclipse/Schedule/Well/ProductionControls.hpp>
43 #include <opm/input/eclipse/Schedule/Well/InjectionControls.hpp>
44 #include <opm/input/eclipse/Schedule/Well/WellFoamProperties.hpp>
45 #include <opm/input/eclipse/Schedule/Well/WellBrineProperties.hpp>
46 #include <opm/input/eclipse/Schedule/Well/WellTracerProperties.hpp>
47 #include <opm/input/eclipse/Schedule/Well/WellPolymerProperties.hpp>
48 #include <opm/input/eclipse/Schedule/Well/WellMICPProperties.hpp>
49 #include <opm/input/eclipse/Schedule/Well/WellEconProductionLimits.hpp>
50 #include <opm/input/eclipse/Schedule/Well/WVFPEXP.hpp>
51 #include <opm/input/eclipse/Schedule/VFPProdTable.hpp>
52 #include <opm/input/eclipse/Units/Units.hpp>
53 #include <opm/input/eclipse/Units/UnitSystem.hpp>
54 
55 #include <opm/common/utility/ActiveGridCells.hpp>
56 
57 namespace Opm {
58 
59 class ActiveGridCells;
60 class AutoICD;
61 class DeckKeyword;
62 class DeckRecord;
63 class ErrorGuard;
64 class EclipseGrid;
65 class ParseContext;
66 class ScheduleGrid;
67 class SICD;
68 class SummaryState;
69 class UDQActive;
70 class UDQConfig;
71 class TracerConfig;
72 
73 namespace RestartIO {
74 struct RstWell;
75 }
76 
77 
78 class Well {
79 public:
80 
81  enum class Status {
82  OPEN = 1,
83  STOP = 2,
84  SHUT = 3,
85  AUTO = 4
86  };
87  static std::string Status2String(Status enumValue);
88  static Status StatusFromString(const std::string& stringValue);
89 
90 
91 
92  /*
93  The elements in this enum are used as bitmasks to keep track
94  of which controls are present, i.e. the 2^n structure must
95  be intact.
96  */
97  enum class InjectorCMode : int{
98  RATE = 1 ,
99  RESV = 2 ,
100  BHP = 4 ,
101  THP = 8 ,
102  GRUP = 16 ,
103  CMODE_UNDEFINED = 512
104  };
105  static const std::string InjectorCMode2String( InjectorCMode enumValue );
106  static InjectorCMode InjectorCModeFromString( const std::string& stringValue );
107 
108 
109  /*
110  The items BHP, THP and GRUP only apply in prediction mode:
111  WCONPROD. The elements in this enum are used as bitmasks to
112  keep track of which controls are present, i.e. the 2^n
113  structure must be intact.The NONE item is only used in WHISTCTL
114  to cancel its effect.
115 
116  The properties are initialized with the CMODE_UNDEFINED
117  value, but the undefined value is never assigned apart from
118  that; and it is not part of the string conversion routines.
119  */
120  enum class ProducerCMode : int {
121  NONE = 0,
122  ORAT = 1,
123  WRAT = 2,
124  GRAT = 4,
125  LRAT = 8,
126  CRAT = 16,
127  RESV = 32,
128  BHP = 64,
129  THP = 128,
130  GRUP = 256,
131  CMODE_UNDEFINED = 1024
132  };
133  static const std::string ProducerCMode2String( ProducerCMode enumValue );
134  static ProducerCMode ProducerCModeFromString( const std::string& stringValue );
135 
136 
137 
138  enum class WELTARGCMode {
139  ORAT = 1,
140  WRAT = 2,
141  GRAT = 3,
142  LRAT = 4,
143  CRAT = 5, // Not supported
144  RESV = 6,
145  BHP = 7,
146  THP = 8,
147  VFP = 9,
148  LIFT = 10, // Not supported
149  GUID = 11
150  };
151 
152  static WELTARGCMode WELTARGCModeFromString(const std::string& stringValue);
153 
154 
155  enum class GuideRateTarget {
156  OIL = 0,
157  WAT = 1,
158  GAS = 2,
159  LIQ = 3,
160  COMB = 4,
161  WGA = 5,
162  CVAL = 6,
163  RAT = 7,
164  RES = 8,
165  UNDEFINED = 9
166  };
167  static const std::string GuideRateTarget2String( GuideRateTarget enumValue );
168  static GuideRateTarget GuideRateTargetFromString( const std::string& stringValue );
169 
170 
171  enum class GasInflowEquation {
172  STD = 0,
173  R_G = 1,
174  P_P = 2,
175  GPP = 3
176  };
177  static const std::string GasInflowEquation2String(GasInflowEquation enumValue);
178  static GasInflowEquation GasInflowEquationFromString(const std::string& stringValue);
179 
180 
181 
182  struct WellGuideRate {
183  bool available;
184  double guide_rate;
185  GuideRateTarget guide_phase;
186  double scale_factor;
187 
188  static WellGuideRate serializationTestObject()
189  {
190  WellGuideRate result;
191  result.available = true;
192  result.guide_rate = 1.0;
193  result.guide_phase = GuideRateTarget::COMB;
194  result.scale_factor = 2.0;
195 
196  return result;
197  }
198 
199  bool operator==(const WellGuideRate& data) const {
200  return available == data.available &&
201  guide_rate == data.guide_rate &&
202  guide_phase == data.guide_phase &&
203  scale_factor == data.scale_factor;
204  }
205 
206  template<class Serializer>
207  void serializeOp(Serializer& serializer)
208  {
209  serializer(available);
210  serializer(guide_rate);
211  serializer(guide_phase);
212  serializer(scale_factor);
213  }
214  };
215 
216 
218  public:
219  InjectionControls(int controls_arg) :
220  controls(controls_arg)
221  {}
222 
223  double bhp_limit;
224  double thp_limit;
225 
226 
227  InjectorType injector_type;
228  InjectorCMode cmode = InjectorCMode::CMODE_UNDEFINED;
229  double surface_rate;
230  double reservoir_rate;
231  double temperature;
232  int vfp_table_number;
233  bool prediction_mode;
234  double rs_rv_inj;
235 
236  bool hasControl(InjectorCMode cmode_arg) const {
237  return (this->controls & static_cast<int>(cmode_arg)) != 0;
238  }
239 
240  private:
241  int controls;
242  };
243 
244 
245 
247  std::string name;
248  UDAValue surfaceInjectionRate;
249  UDAValue reservoirInjectionRate;
250  UDAValue BHPTarget;
251  UDAValue THPTarget;
252 
253  double bhp_hist_limit = 0.0;
254  double thp_hist_limit = 0.0;
255 
256  double temperature;
257  double BHPH;
258  double THPH;
259  int VFPTableNumber;
260  bool predictionMode;
261  int injectionControls;
262  InjectorType injectorType;
263  InjectorCMode controlMode;
264 
265  double rsRvInj;
266 
267  bool operator==(const WellInjectionProperties& other) const;
268  bool operator!=(const WellInjectionProperties& other) const;
269 
271  WellInjectionProperties(const UnitSystem& units, const std::string& wname);
272 
273  static WellInjectionProperties serializationTestObject();
274 
275  void handleWELTARG(WELTARGCMode cmode, const UDAValue& new_arg, double SIFactorP);
276  void handleWCONINJE(const DeckRecord& record, bool availableForGroupControl, const std::string& well_name);
277  void handleWCONINJH(const DeckRecord& record, bool is_producer, const std::string& well_name);
278  bool hasInjectionControl(InjectorCMode controlModeArg) const {
279  if (injectionControls & static_cast<int>(controlModeArg))
280  return true;
281  else
282  return false;
283  }
284 
285  void dropInjectionControl(InjectorCMode controlModeArg) {
286  auto int_arg = static_cast<int>(controlModeArg);
287  if ((injectionControls & int_arg) != 0)
288  injectionControls -= int_arg;
289  }
290 
291  void addInjectionControl(InjectorCMode controlModeArg) {
292  auto int_arg = static_cast<int>(controlModeArg);
293  if ((injectionControls & int_arg) == 0)
294  injectionControls += int_arg;
295  }
296 
297  void clearControls();
298 
299  void resetDefaultHistoricalBHPLimit();
300  void resetBHPLimit();
301  void setBHPLimit(const double limit);
302  InjectionControls controls(const UnitSystem& unit_system, const SummaryState& st, double udq_default) const;
303  bool updateUDQActive(const UDQConfig& udq_config, UDQActive& active) const;
304  bool updateUDQActive(const UDQConfig& udq_config, const WELTARGCMode cmode, UDQActive& active) const;
305  void update_uda(const UDQConfig& udq_config, UDQActive& udq_active, UDAControl control, const UDAValue& value);
306  void handleWTMULT(Well::WELTARGCMode cmode, double factor);
307 
308  template<class Serializer>
309  void serializeOp(Serializer& serializer)
310  {
311  serializer(name);
312  serializer(surfaceInjectionRate);
313  serializer(reservoirInjectionRate);
314  serializer(BHPTarget);
315  serializer(THPTarget);
316  serializer(bhp_hist_limit);
317  serializer(thp_hist_limit);
318  serializer(temperature);
319  serializer(BHPH);
320  serializer(THPH);
321  serializer(VFPTableNumber);
322  serializer(predictionMode);
323  serializer(injectionControls);
324  serializer(injectorType);
325  serializer(controlMode);
326  serializer(rsRvInj);
327  }
328  };
329 
331  public:
332  ProductionControls(int controls_arg) :
333  controls(controls_arg)
334  {
335  }
336 
337  ProducerCMode cmode = ProducerCMode::NONE;
338  double oil_rate{0};
339  double water_rate{0};
340  double gas_rate{0};
341  double liquid_rate{0};
342  double resv_rate{0};
343  double bhp_history{0};
344  double thp_history{0};
345  double bhp_limit{0};
346  double thp_limit{0};
347  double alq_value{0};
348  int vfp_table_number{0};
349  bool prediction_mode{0};
350 
351  bool hasControl(ProducerCMode cmode_arg) const {
352  return (this->controls & static_cast<int>(cmode_arg)) != 0;
353  }
354 
355  bool operator==(const ProductionControls& other) const {
356  return this->cmode == other.cmode &&
357  this->oil_rate == other.oil_rate &&
358  this->water_rate == other.water_rate &&
359  this->gas_rate == other.gas_rate &&
360  this->liquid_rate == other.liquid_rate &&
361  this->resv_rate == other.resv_rate &&
362  this->bhp_history == other.bhp_history &&
363  this->thp_history == other.thp_history &&
364  this->bhp_limit == other.bhp_limit &&
365  this->thp_limit == other.thp_limit &&
366  this->alq_value == other.alq_value &&
367  this->vfp_table_number == other.vfp_table_number &&
368  this->prediction_mode == other.prediction_mode;
369  }
370 
371 
372  private:
373  int controls;
374  };
375 
376 
378  public:
379  // the rates serve as limits under prediction mode
380  // while they are observed rates under historical mode
381  std::string name;
382  UDAValue OilRate;
383  UDAValue WaterRate;
384  UDAValue GasRate;
385  UDAValue LiquidRate;
386  UDAValue ResVRate;
387  UDAValue BHPTarget;
388  UDAValue THPTarget;
389  UDAValue ALQValue;
390 
391  // BHP and THP limit
392  double bhp_hist_limit = 0.0;
393  double thp_hist_limit = 0.0;
394 
395  // historical BHP and THP under historical mode
396  double BHPH = 0.0;
397  double THPH = 0.0;
398  int VFPTableNumber = 0;
399  bool predictionMode = false;
400  ProducerCMode controlMode = ProducerCMode::CMODE_UNDEFINED;
401  ProducerCMode whistctl_cmode = ProducerCMode::CMODE_UNDEFINED;
402 
403  bool operator==(const WellProductionProperties& other) const;
404  bool operator!=(const WellProductionProperties& other) const;
405 
407  WellProductionProperties(const UnitSystem& units, const std::string& name_arg);
408 
409  static WellProductionProperties serializationTestObject();
410 
411  bool hasProductionControl(ProducerCMode controlModeArg) const {
412  return (m_productionControls & static_cast<int>(controlModeArg)) != 0;
413  }
414 
415  void dropProductionControl(ProducerCMode controlModeArg) {
416  if (hasProductionControl(controlModeArg))
417  m_productionControls -= static_cast<int>(controlModeArg);
418  }
419 
420  void addProductionControl(ProducerCMode controlModeArg) {
421  if (! hasProductionControl(controlModeArg))
422  m_productionControls += static_cast<int>(controlModeArg);
423  }
424 
425  // this is used to check whether the specified control mode is an effective history matching production mode
426  static bool effectiveHistoryProductionControl(ProducerCMode cmode);
427  void handleWCONPROD( const std::optional<VFPProdTable::ALQ_TYPE>& alq_type, const UnitSystem& unit_system, const std::string& well, const DeckRecord& record);
428  void handleWCONHIST( const std::optional<VFPProdTable::ALQ_TYPE>& alq_type, const UnitSystem& unit_system, const DeckRecord& record);
429  void handleWELTARG( WELTARGCMode cmode, const UDAValue& new_arg, double SiFactorP);
430  void resetDefaultBHPLimit();
431  void clearControls();
432  ProductionControls controls(const SummaryState& st, double udq_default) const;
433  bool updateUDQActive(const UDQConfig& udq_config, UDQActive& active) const;
434  bool updateUDQActive(const UDQConfig& udq_config, const WELTARGCMode cmode, UDQActive& active) const;
435  void update_uda(const UDQConfig& udq_config, UDQActive& udq_active, UDAControl control, const UDAValue& value);
436 
437  void setBHPLimit(const double limit);
438  int productionControls() const { return this->m_productionControls; }
439  void handleWTMULT(Well::WELTARGCMode cmode, double factor);
440 
441  template<class Serializer>
442  void serializeOp(Serializer& serializer)
443  {
444  serializer(name);
445  serializer(OilRate);
446  serializer(WaterRate);
447  serializer(GasRate);
448  serializer(LiquidRate);
449  serializer(ResVRate);
450  serializer(BHPTarget);
451  serializer(THPTarget);
452  serializer(ALQValue);
453  serializer(bhp_hist_limit);
454  serializer(thp_hist_limit);
455  serializer(BHPH);
456  serializer(THPH);
457  serializer(VFPTableNumber);
458  serializer(predictionMode);
459  serializer(controlMode);
460  serializer(whistctl_cmode);
461  serializer(m_productionControls);
462  }
463 
464  private:
465  int m_productionControls = 0;
466  void init_rates( const DeckRecord& record );
467 
468  void init_history(const DeckRecord& record);
469  void init_vfp(const std::optional<VFPProdTable::ALQ_TYPE>& alq_type, const UnitSystem& unit_system, const DeckRecord& record);
470 
471  WellProductionProperties(const DeckRecord& record);
472 
473  double getBHPLimit() const;
474  };
475 
476  static int eclipseControlMode(const Well::InjectorCMode imode,
477  const InjectorType itype);
478 
479  static int eclipseControlMode(const Well::ProducerCMode pmode);
480 
481  static int eclipseControlMode(const Well& well,
482  const SummaryState& st);
483 
484 
485  Well() = default;
486  Well(const std::string& wname,
487  const std::string& gname,
488  std::size_t init_step,
489  std::size_t insert_index,
490  int headI,
491  int headJ,
492  const std::optional<double>& ref_depth,
493  const WellType& wtype_arg,
494  ProducerCMode whistctl_cmode,
495  Connection::Order ordering,
496  const UnitSystem& unit_system,
497  double udq_undefined,
498  double dr,
499  bool allow_xflow,
500  bool auto_shutin,
501  int pvt_table,
502  GasInflowEquation inflow_eq);
503 
504  Well(const RestartIO::RstWell& rst_well,
505  int report_step,
506  const TracerConfig& tracer_config,
507  const UnitSystem& unit_system,
508  double udq_undefined);
509 
510  static Well serializationTestObject();
511 
512  bool isMultiSegment() const;
513  bool isAvailableForGroupControl() const;
514  double getGuideRate() const;
515  GuideRateTarget getGuideRatePhase() const;
516  GuideRateTarget getRawGuideRatePhase() const;
517  double getGuideRateScalingFactor() const;
518 
519  bool hasBeenDefined(size_t timeStep) const;
520  std::size_t firstTimeStep() const;
521  const WellType& wellType() const;
522  bool predictionMode() const;
523  bool canOpen() const;
524  bool isProducer() const;
525  bool isInjector() const;
526  InjectorCMode injection_cmode() const;
527  ProducerCMode production_cmode() const;
528  InjectorType injectorType() const;
529  size_t seqIndex() const;
530  bool getAutomaticShutIn() const;
531  bool getAllowCrossFlow() const;
532  const std::string& name() const;
533  const std::vector<std::string>& wListNames() const;
534  int getHeadI() const;
535  int getHeadJ() const;
536  double getWPaveRefDepth() const;
537  bool hasRefDepth() const;
538  double getRefDepth() const;
539  double getDrainageRadius() const;
540  double getEfficiencyFactor() const;
541  double getSolventFraction() const;
542  Status getStatus() const;
543  const std::string& groupName() const;
544  Phase getPreferredPhase() const;
545 
546  const std::vector<const Connection *> getConnections(int completion) const;
547  const WellConnections& getConnections() const;
548  const WellSegments& getSegments() const;
549 
550  const WellProductionProperties& getProductionProperties() const;
551  const WellInjectionProperties& getInjectionProperties() const;
552  const WellEconProductionLimits& getEconLimits() const;
553  const WellFoamProperties& getFoamProperties() const;
554  const WellPolymerProperties& getPolymerProperties() const;
555  const WellMICPProperties& getMICPProperties() const;
556  const WellBrineProperties& getBrineProperties() const;
557  const WellTracerProperties& getTracerProperties() const;
558  const WVFPEXP& getWVFPEXP() const;
559  /* The rate of a given phase under the following assumptions:
560  * * Returns zero if production is requested for an injector (and vice
561  * versa)
562  * * If this is an injector and something else than the
563  * requested phase is injected, returns 0, i.e.
564  * water_injector.injection_rate( gas ) == 0
565  * * Mixed injection is not supported and always returns 0.
566  */
567  double production_rate( const SummaryState& st, Phase phase) const;
568  double injection_rate( const SummaryState& st, Phase phase) const;
569  static bool wellNameInWellNamePattern(const std::string& wellName, const std::string& wellNamePattern);
570 
571  /*
572  The getCompletions() function will return a map:
573 
574  {
575  1 : [Connection, Connection],
576  2 : [Connection, Connection, Connecton],
577  3 : [Connection],
578  4 : [Connection]
579  }
580 
581  The integer ID's correspond to the COMPLETION id given by the COMPLUMP
582  keyword.
583  */
584  std::map<int, std::vector<Connection>> getCompletions() const;
585  /*
586  For hasCompletion(int completion) and getConnections(int completion) the
587  completion argument is an integer ID used to denote a collection of
588  connections. The integer ID is assigned with the COMPLUMP keyword.
589  */
590  bool hasCompletion(int completion) const;
591  bool updatePrediction(bool prediction_mode);
592  bool updateAutoShutin(bool auto_shutin);
593  bool updateCrossFlow(bool allow_cross_flow);
594  bool updatePVTTable(int pvt_table);
595  bool updateHead(int I, int J);
596  void updateRefDepth();
597  bool updateRefDepth(const std::optional<double>& ref_dpeth);
598  bool updateDrainageRadius(double drainage_radius);
599  void updateSegments(std::shared_ptr<WellSegments> segments_arg);
600  bool updateConnections(std::shared_ptr<WellConnections> connections, bool force);
601  bool updateConnections(std::shared_ptr<WellConnections> connections, const ScheduleGrid& grid);
602  bool updateStatus(Status status);
603  bool updateGroup(const std::string& group);
604  bool updateWellGuideRate(bool available, double guide_rate, GuideRateTarget guide_phase, double scale_factor);
605  bool updateWellGuideRate(double guide_rate);
606  bool updateEfficiencyFactor(double efficiency_factor);
607  bool updateSolventFraction(double solvent_fraction);
608  bool updateTracer(std::shared_ptr<WellTracerProperties> tracer_properties);
609  bool updateFoamProperties(std::shared_ptr<WellFoamProperties> foam_properties);
610  bool updatePolymerProperties(std::shared_ptr<WellPolymerProperties> polymer_properties);
611  bool updateMICPProperties(std::shared_ptr<WellMICPProperties> micp_properties);
612  bool updateBrineProperties(std::shared_ptr<WellBrineProperties> brine_properties);
613  bool updateEconLimits(std::shared_ptr<WellEconProductionLimits> econ_limits);
614  bool updateProduction(std::shared_ptr<WellProductionProperties> production);
615  bool updateInjection(std::shared_ptr<WellInjectionProperties> injection);
616  bool updateWellProductivityIndex();
617  bool updateWSEGSICD(const std::vector<std::pair<int, SICD> >& sicd_pairs);
618  bool updateWSEGVALV(const std::vector<std::pair<int, Valve> >& valve_pairs);
619  bool updateWSEGAICD(const std::vector<std::pair<int, AutoICD> >& aicd_pairs, const KeywordLocation& location);
620  bool updateWPAVE(const PAvg& pavg);
621  void updateWPaveRefDepth(double ref_depth);
622  bool updateWVFPEXP(std::shared_ptr<WVFPEXP> wvfpexp);
623 
624  bool handleWELSEGS(const DeckKeyword& keyword);
625  bool handleCOMPSEGS(const DeckKeyword& keyword, const ScheduleGrid& grid, const ParseContext& parseContext, ErrorGuard& errors);
626  bool handleWELOPENConnections(const DeckRecord& record, Connection::State status);
627  bool handleCOMPLUMP(const DeckRecord& record);
628  bool handleWPIMULT(const DeckRecord& record);
629  bool applyGlobalWPIMULT(double scale_factor);
630 
631  void filterConnections(const ActiveGridCells& grid);
632  ProductionControls productionControls(const SummaryState& st) const;
633  InjectionControls injectionControls(const SummaryState& st) const;
634  int vfp_table_number() const;
635  int pvt_table_number() const;
636  int fip_region_number() const;
637  GasInflowEquation gas_inflow_equation() const;
638  bool segmented_density_calculation() const { return true; }
639  double alq_value() const;
640  double temperature() const;
641  bool hasInjected( ) const;
642  bool hasProduced( ) const;
643  bool updateHasInjected( );
644  bool updateHasProduced();
645  bool cmp_structure(const Well& other) const;
646  bool operator==(const Well& data) const;
647  bool hasSameConnectionsPointers(const Well& other) const;
648  void setInsertIndex(std::size_t index);
649  double convertDeckPI(double deckPI) const;
650  void applyWellProdIndexScaling(const double scalingFactor,
651  std::vector<bool>& scalingApplicable);
652  const PAvg& pavg() const;
653  PAvgCalculator pavg_calculator(const EclipseGrid& grid, const std::vector<double>& porv) const;
654 
655  template<class Serializer>
656  void serializeOp(Serializer& serializer)
657  {
658  serializer(wname);
659  serializer(group_name);
660  serializer(init_step);
661  serializer(insert_index);
662  serializer(headI);
663  serializer(headJ);
664  serializer(ref_depth);
665  serializer(wpave_ref_depth);
666  serializer(unit_system);
667  serializer(udq_undefined);
668  serializer(status);
669  serializer(drainage_radius);
670  serializer(allow_cross_flow);
671  serializer(automatic_shutin);
672  serializer(pvt_table);
673  serializer(gas_inflow);
674  serializer(wtype);
675  serializer(guide_rate);
676  serializer(efficiency_factor);
677  serializer(solvent_fraction);
678  serializer(has_produced);
679  serializer(has_injected);
680  serializer(prediction_mode);
681  serializer(econ_limits);
682  serializer(foam_properties);
683  serializer(polymer_properties);
684  serializer(micp_properties);
685  serializer(brine_properties);
686  serializer(tracer_properties);
687  serializer(connections);
688  serializer(production);
689  serializer(injection);
690  serializer(segments);
691  serializer(wvfpexp);
692  serializer(m_pavg);
693  }
694 
695 private:
696  void switchToInjector();
697  void switchToProducer();
698 
699  GuideRateTarget preferredPhaseAsGuideRatePhase() const;
700 
701  std::string wname;
702  std::string group_name;
703  std::size_t init_step;
704  std::size_t insert_index;
705  int headI;
706  int headJ;
707  std::optional<double> ref_depth;
708  std::optional<double> wpave_ref_depth;
709  double drainage_radius;
710  bool allow_cross_flow;
711  bool automatic_shutin;
712  int pvt_table;
713  GasInflowEquation gas_inflow = GasInflowEquation::STD; // Will NOT be loaded/assigned from restart file
714  UnitSystem unit_system;
715  double udq_undefined;
716  WellType wtype;
717  WellGuideRate guide_rate;
718  double efficiency_factor;
719  double solvent_fraction;
720  bool has_produced = false;
721  bool has_injected = false;
722  bool prediction_mode = true;
723 
724  std::shared_ptr<WellEconProductionLimits> econ_limits;
725  std::shared_ptr<WellFoamProperties> foam_properties;
726  std::shared_ptr<WellPolymerProperties> polymer_properties;
727  std::shared_ptr<WellMICPProperties> micp_properties;
728  std::shared_ptr<WellBrineProperties> brine_properties;
729  std::shared_ptr<WellTracerProperties> tracer_properties;
730  std::shared_ptr<WellConnections> connections; // The WellConnections object cannot be const because of WELPI and the filterConnections method
731  std::shared_ptr<WellProductionProperties> production;
732  std::shared_ptr<WellInjectionProperties> injection;
733  std::shared_ptr<WellSegments> segments;
734  std::shared_ptr<WVFPEXP> wvfpexp;
735  Status status;
736  PAvg m_pavg;
737 };
738 
739 std::ostream& operator<<( std::ostream&, const Well::WellInjectionProperties& );
740 std::ostream& operator<<( std::ostream&, const Well::WellProductionProperties& );
741 
742 
743 std::ostream& operator<<(std::ostream& os, const Well::Status& st);
744 std::ostream& operator<<(std::ostream& os, const Well::ProducerCMode& cm);
745 std::ostream& operator<<(std::ostream& os, const Well::InjectorCMode& cm);
746 
747 }
748 #endif
Simple class capturing active cells of a grid.
Definition: ActiveGridCells.hpp:36
Definition: DeckKeyword.hpp:36
Definition: DeckRecord.hpp:32
About cell information and dimension: The actual grid information is held in a pointer to an ERT ecl_...
Definition: EclipseGrid.hpp:54
Definition: ErrorGuard.hpp:29
Definition: KeywordLocation.hpp:27
Definition: PAvgCalculator.hpp:37
Definition: PAvg.hpp:28
Definition: ParseContext.hpp:88
Definition: ScheduleGrid.hpp:29
Class for (de-)serializing.
Definition: Serializer.hpp:75
Definition: SummaryState.hpp:69
Definition: TracerConfig.hpp:31
Definition: UDAValue.hpp:32
Definition: UDQActive.hpp:43
Definition: UDQConfig.hpp:51
Definition: UnitSystem.hpp:33
Definition: WVFPEXP.hpp:34
Definition: WellConnections.hpp:44
Definition: WellEconProductionLimits.hpp:33
Definition: WellSegments.hpp:41
Definition: WellTracerProperties.hpp:28
Definition: ScheduleTypes.hpp:38
Definition: Well.hpp:377
Definition: Well.hpp:78
This class implements a small container which holds the transmissibility mulitpliers for all the face...
Definition: Exceptions.hpp:29
Definition: well.hpp:43
Definition: WellBrineProperties.hpp:29
Definition: WellFoamProperties.hpp:29
Definition: WellMICPProperties.hpp:29
Definition: WellPolymerProperties.hpp:28
Definition: Well.hpp:217
Definition: Well.hpp:330
Definition: Well.hpp:182
Definition: Well.hpp:246