My Project
Loading...
Searching...
No Matches
WellTestConfig.hpp
1/*
2 Copyright 2018 Statoil 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#ifndef WELLTEST_CONFIG_H
20#define WELLTEST_CONFIG_H
21
22#include <cstddef>
23#include <string>
24#include <unordered_map>
25
26
27namespace Opm {
28
29namespace RestartIO {
30struct RstState;
31}
32
33namespace WTest {
34/*
35 Different numerical values are used in the restart file to enumarate the
36 possible WTEST modes and the actual reason a well has been closed.
37*/
38
39namespace EclConfigReason {
40constexpr int PHYSICAL = 2;
41constexpr int ECONOMIC = 3;
42constexpr int GCON = 5;
43constexpr int THPLimit = 7;
44constexpr int CONNECTION = 11;
45}
46
47namespace EclCloseReason {
48constexpr int PHYSICAL = 3;
49constexpr int ECONOMIC = 5;
50constexpr int GCON = 6;
51constexpr int THPLimit = 9;
52}
53
54enum class Reason {
55 PHYSICAL = 1,
56 ECONOMIC = 2,
57 GROUP = 4,
58 THP_DESIGN=8,
59 COMPLETION=16,
60};
61
62}
63
65
66public:
67 using Reason = WTest::Reason;
68 struct WTESTWell {
69 std::string name;
70 int reasons;
71 double test_interval;
72 int num_test;
73 double startup_time;
74 // the related WTEST keywords is entered and will begin
75 // taking effects since this report step
76 int begin_report_step;
77
78 bool operator==(const WTESTWell& data) const {
79 return name == data.name &&
80 reasons == data.reasons &&
81 test_interval == data.test_interval &&
82 num_test == data.num_test &&
83 startup_time == data.startup_time &&
84 begin_report_step == data.begin_report_step;
85 }
86
87 WTESTWell() = default;
88 WTESTWell(const std::string& name, int reasons, double test_interval, int num_test, double startup_time, int begin_report_step);
89 bool test_well(int num_attempt, double elapsed) const;
90
91 static int inverse_ecl_reasons(int ecl_reasons);
92 static WTESTWell serializationTestObject();
93 int ecl_reasons() const;
94
95 template<class Serializer>
96 void serializeOp(Serializer& serializer)
97 {
98 serializer(name);
99 serializer(reasons);
100 serializer(test_interval);
101 serializer(num_test);
102 serializer(startup_time);
103 serializer(begin_report_step);
104 }
105 };
106
107 static WellTestConfig serializationTestObject();
108
109 WellTestConfig() = default;
110 WellTestConfig(const RestartIO::RstState& rst_state, int report_step);
111 void add_well(const std::string& well, int reasons, double test_interval,
112 int num_test, double startup_time, int current_step);
113 void add_well(const std::string& well, const std::string& reasons, double test_interval,
114 int num_test, double startup_time, int current_step);
115 void drop_well(const std::string& well);
116 bool has(const std::string& well) const;
117 bool has(const std::string& well, Reason reason) const;
118 const WTESTWell& get(const std::string& well) const;
119
120 static std::string reasonToString(const Reason reason);
121 bool empty() const;
122
123 bool operator==(const WellTestConfig& data) const;
124
125 template<class Serializer>
126 void serializeOp(Serializer& serializer)
127 {
128 serializer(wells);
129 }
130
131private:
132 std::unordered_map<std::string, WTESTWell> wells;
133};
134}
135
136#endif
137
Class for (de-)serializing.
Definition Serializer.hpp:84
Definition WellTestConfig.hpp:64
This class implements a small container which holds the transmissibility mulitpliers for all the face...
Definition Exceptions.hpp:30
Definition state.hpp:54
Definition WellTestConfig.hpp:68