My Project
Loading...
Searching...
No Matches
WellInjectionControls.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 WELL_INJECTION_CONTROLS_HPP
22#define WELL_INJECTION_CONTROLS_HPP
23
24#include <opm/input/eclipse/Schedule/ScheduleTypes.hpp>
25#include <opm/input/eclipse/Schedule/Well/WellEnums.hpp>
26
27#include <cmath>
28
29namespace Opm {
30
32public:
33 explicit WellInjectionControls(int controls_arg) :
34 controls(controls_arg)
35 {}
36
37 bool hasControl(WellInjectorCMode cmode_arg) const
38 {
39 return (this->controls & static_cast<int>(cmode_arg)) != 0;
40 }
41
42 void skipControl(WellInjectorCMode cmode_arg) {
43 auto int_arg = static_cast<int>(cmode_arg);
44 if ((this->controls & int_arg) != 0)
45 this->controls -= int_arg;
46 }
47
48 void addControl(WellInjectorCMode cmode_arg) {
49 auto int_arg = static_cast<int>(cmode_arg);
50 if ((this->controls & int_arg) == 0)
51 this->controls += int_arg;
52 }
53
54 void clearControls(){
55 this->controls = 0;
56 }
57
58 bool anyZeroRateConstraint() const {
59 auto is_zero = [](const double x)
60 {
61 return std::isfinite(x) && !std::isnormal(x);
62 };
63
64 if (this->hasControl(WellInjectorCMode::RATE) && is_zero(this->surface_rate) ) {
65 return true;
66 }
67
68 if (this->hasControl(WellInjectorCMode::RESV) && is_zero(this->reservoir_rate) ) {
69 return true;
70 }
71
72 return false;
73 }
74
75 double bhp_limit;
76 double thp_limit;
77
78 InjectorType injector_type;
79 WellInjectorCMode cmode = WellInjectorCMode::CMODE_UNDEFINED;
80 double surface_rate;
81 double reservoir_rate;
82 int vfp_table_number;
83 bool prediction_mode;
84 double rs_rv_inj;
85
86private:
87 int controls;
88};
89
90}
91
92#endif
This class implements a small container which holds the transmissibility mulitpliers for all the face...
Definition Exceptions.hpp:30
Definition WellInjectionControls.hpp:31