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 NONE = 1;
41constexpr int PHYSICAL = 2;
42constexpr int ECONOMIC = 3;
43constexpr int GCON = 5;
44constexpr int THPLimit = 7;
45constexpr int CONNECTION = 11;
46}
47
48namespace EclCloseReason {
49constexpr int NONE = 1; // May be written to UNRST during history
50constexpr int PHYSICAL = 3;
51constexpr int ECONOMIC = 5;
52constexpr int GCON = 6;
53constexpr int THPLimit = 9;
54}
55
56enum class Reason {
57 NONE = 0,
58 PHYSICAL = 1,
59 ECONOMIC = 2,
60 GROUP = 4,
61 THP_DESIGN=8,
62 COMPLETION=16,
63};
64
65}
66
68
69public:
70 using Reason = WTest::Reason;
71 struct WTESTWell {
72 std::string name{};
73 int reasons{};
74 double test_interval{};
75 int num_test{};
76 double startup_time{};
77 // the related WTEST keywords is entered and will begin
78 // taking effects since this report step
79 int begin_report_step{};
80
81 bool operator==(const WTESTWell& data) const {
82 return name == data.name &&
83 reasons == data.reasons &&
84 test_interval == data.test_interval &&
85 num_test == data.num_test &&
86 startup_time == data.startup_time &&
87 begin_report_step == data.begin_report_step;
88 }
89
90 WTESTWell() = default;
91 WTESTWell(const std::string& name, int reasons, double test_interval, int num_test, double startup_time, int begin_report_step);
92 bool test_well(int num_attempt, double elapsed) const;
93
94 static int inverse_ecl_reasons(int ecl_reasons);
95 static WTESTWell serializationTestObject();
96 int ecl_reasons() const;
97
98 template<class Serializer>
99 void serializeOp(Serializer& serializer)
100 {
101 serializer(name);
102 serializer(reasons);
103 serializer(test_interval);
104 serializer(num_test);
105 serializer(startup_time);
106 serializer(begin_report_step);
107 }
108 };
109
110 static WellTestConfig serializationTestObject();
111
112 WellTestConfig() = default;
113 WellTestConfig(const RestartIO::RstState& rst_state, int report_step);
114 void add_well(const std::string& well, int reasons, double test_interval,
115 int num_test, double startup_time, int current_step);
116 void add_well(const std::string& well, const std::string& reasons, double test_interval,
117 int num_test, double startup_time, int current_step);
118 void drop_well(const std::string& well);
119 bool has(const std::string& well) const;
120 bool has(const std::string& well, Reason reason) const;
121 const WTESTWell& get(const std::string& well) const;
122
123 static std::string reasonToString(const Reason reason);
124 bool empty() const;
125
126 bool operator==(const WellTestConfig& data) const;
127
128 template<class Serializer>
129 void serializeOp(Serializer& serializer)
130 {
131 serializer(wells);
132 }
133
134private:
135 std::unordered_map<std::string, WTESTWell> wells;
136};
137}
138
139#endif
140
Class for (de-)serializing.
Definition Serializer.hpp:91
Definition WellTestConfig.hpp:67
This class implements a small container which holds the transmissibility mulitpliers for all the face...
Definition Exceptions.hpp:30
Definition state.hpp:55
Definition WellTestConfig.hpp:71