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