opm-common
GuideRateModel.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 GUIDE_RATE_MODEL_HPP
21 #define GUIDE_RATE_MODEL_HPP
22 
23 #include <opm/input/eclipse/Deck/UDAValue.hpp>
24 #include <opm/input/eclipse/Schedule/Group/Group.hpp>
25 
26 namespace Opm {
27 
28 enum class WellGuideRateTarget : std::uint8_t;
29 
31 public:
32 
33  enum class Target : std::uint8_t {
34  OIL = 0,
35  LIQ = 1,
36  GAS = 2,
37  WAT = 3,
38  RES = 4,
39  COMB = 5,
40  NONE = 6
41  };
42 
43  static Target TargetFromString(const std::string& s);
44  static Target TargetFromRestart(const int nominated_phase);
45 
46  GuideRateModel(double time_interval_arg,
47  Target target_arg,
48  double A_arg,
49  double B_arg,
50  double C_arg,
51  double D_arg,
52  double E_arg,
53  double F_arg,
54  bool allow_increase_arg,
55  double damping_factor_arg,
56  bool use_free_gas_arg);
57  GuideRateModel() = default;
58 
59  static bool rst_valid(double time_interval,
60  double A,
61  double B,
62  double C,
63  double D,
64  double E,
65  double F,
66  double damping_factor);
67 
68 
69  static GuideRateModel serializationTestObject();
70 
71  double eval(const std::string& wgId, double oil_pot, double gas_pot, double wat_pot) const;
72  bool updateLINCOM(const UDAValue& alpha, const UDAValue& beta, const UDAValue& gamma) const;
73  double update_delay() const;
74  bool allow_increase() const;
75  double damping_factor() const;
76  bool operator==(const GuideRateModel& other) const;
77  bool operator!=(const GuideRateModel& other) const;
78  Target target() const;
79  double getA() const;
80  double getB() const;
81  double getC() const;
82  double getD() const;
83  double getE() const;
84  double getF() const;
85 
86  static Target convert_target(WellGuideRateTarget well_target);
87  static Target convert_target(Group::GuideRateProdTarget group_target);
88  static Target convert_target(Phase injection_phase);
89  static double pot(Target target, double oil_pot, double gas_pot, double wat_pot);
90 
91  template<class Serializer>
92  void serializeOp(Serializer& serializer)
93  {
94  serializer(time_interval);
95  serializer(m_target),
96  serializer(A);
97  serializer(B);
98  serializer(C);
99  serializer(D);
100  serializer(E);
101  serializer(F);
102  serializer(allow_increase_);
103  serializer(damping_factor_);
104  serializer(use_free_gas);
105  serializer(default_model);
106  serializer(alpha);
107  serializer(beta);
108  serializer(gamma);
109  }
110 
111 private:
112  double pot(double oil_pot, double gas_pot, double wat_pot) const;
113  /*
114  Unfortunately the default values will give a GuideRateModel which can not
115  be evaluated, due to a division by zero problem.
116  */
117  double time_interval = 0;
118  Target m_target = Target::NONE;
119  double A = 0;
120  double B = 0;
121  double C = 0;
122  double D = 0;
123  double E = 0;
124  double F = 0;
125  bool allow_increase_ = true;
126  double damping_factor_ = 1.0;
127  bool use_free_gas = false;
128  bool default_model = true;
129  UDAValue alpha;
130  UDAValue beta;
131  UDAValue gamma;
132 };
133 
134 }
135 
136 #endif
Definition: GuideRateModel.hpp:30
Definition: UDAValue.hpp:31
This class implements a small container which holds the transmissibility mulitpliers for all the face...
Definition: Exceptions.hpp:30
Class for (de-)serializing.
Definition: Serializer.hpp:94
bool operator!=(const SummaryConfigNode &lhs, const SummaryConfigNode &rhs)
Inequality operator for SummaryConfigNode objects.
Definition: SummaryConfig.hpp:256