WellTestState.hpp
Go to the documentation of this file.
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_STATE_H
20#define WELLTEST_STATE_H
21
22#include <cstddef>
23#include <string>
24#include <vector>
25
28
29namespace Opm {
30
32public:
33 /*
34 This class implements a small mutable state object which keeps track of
35 which wells have been automatically closed by the simulator, and by
36 checking with the WTEST configuration object the class can return a list
37 (well_name,reason) pairs for wells which should be checked as candiates
38 for opening.
39 */
40
41
42
43 struct WTestWell {
46 // the well can be re-opened if the well testing is successful. We only test when it is closed.
47 bool closed;
48 // it can be the time of last test,
49 // or the time that the well is closed if not test has not been performed after
50 double last_test;
52 // if there is a WTEST setup for well testing,
53 // it will be the report step that WTEST is specified.
54 // if no, it is -1, which indicates we do not know the associated WTEST yet,
55 // or there is not associated WTEST request
57 };
58
59
63 double last_test;
65 };
66
67 /*
68 The simulator has decided to close a particular well; we then add it here
69 as a closed well with a particualar reason.
70 */
71 void closeWell(const std::string& well_name, WellTestConfig::Reason reason, double sim_time);
72
73 /*
74 The simulator has decided to close a particular completion in a well; we then add it here
75 as a closed completions
76 */
77 void addClosedCompletion(const std::string& well_name, int complnum, double sim_time);
78
79 /*
80 The update will consult the WellTestConfig object and return a list of
81 wells which should be checked for possible reopening; observe that the
82 update method will update the internal state of the object by counting up
83 the openiing attempts, and also set the time for the last attempt to open.
84 */
85 std::vector<std::pair<std::string, WellTestConfig::Reason>> updateWells(const WellTestConfig& config,
86 const std::vector<Well>& wells_ecl,
87 double sim_time);
88
89 /*
90 The update will consult the WellTestConfig object and return a list of
91 completions which should be checked for possible reopening; observe that the
92 update method will update the internal state of the object by counting up
93 the openiing attempts, and also set the time for the last attempt to open.
94 */
95 std::vector<std::pair<std::string, int>> updateCompletion(const WellTestConfig& config, double sim_time);
96
97 /*
98 If the simulator decides that a constraint is no longer met the dropCompletion()
99 method should be called to indicate that this reason for keeping the well
100 closed is no longer active.
101 */
102 void dropCompletion(const std::string& well_name, int complnum);
103
104 bool hasWellClosed(const std::string& well_name, WellTestConfig::Reason reason) const;
105
106 /* whether there is a well with the well_name closed in the WellTestState,
107 * no matter what is the closing cause */
108 bool hasWellClosed(const std::string& well_name) const;
109
110 void openWell(const std::string& well_name, WellTestConfig::Reason reason);
111
112 /* open the well no matter what is the closing cause.
113 * it is used when WELOPEN or WCON* keyword request to open the well */
114 void openWell(const std::string& well_name);
115
116
117 bool hasCompletion(const std::string& well_name, const int complnum) const;
118
119 size_t sizeWells() const;
120 size_t sizeCompletions() const;
121
122 /*
123 Return the last tested time for the well, or throw if no such well.
124 */
125 double lastTestTime(const std::string& well_name) const;
126
127private:
128 std::vector<WTestWell> wells;
129 std::vector<ClosedCompletion> completions;
130
131
132 WTestWell* getWell(const std::string& well_name, WellTestConfig::Reason reason);
133
134 void updateForNewWTEST(const WellTestConfig& config);
135};
136
137
138}
139
140#endif
141
const char *const string
Definition: cJSON.h:170
Definition: WellTestConfig.hpp:29
Reason
Definition: WellTestConfig.hpp:31
Definition: WellTestState.hpp:31
std::vector< std::pair< std::string, WellTestConfig::Reason > > updateWells(const WellTestConfig &config, const std::vector< Well > &wells_ecl, double sim_time)
void openWell(const std::string &well_name)
bool hasWellClosed(const std::string &well_name) const
bool hasCompletion(const std::string &well_name, const int complnum) const
void dropCompletion(const std::string &well_name, int complnum)
void openWell(const std::string &well_name, WellTestConfig::Reason reason)
size_t sizeWells() const
double lastTestTime(const std::string &well_name) const
size_t sizeCompletions() const
std::vector< std::pair< std::string, int > > updateCompletion(const WellTestConfig &config, double sim_time)
bool hasWellClosed(const std::string &well_name, WellTestConfig::Reason reason) const
void addClosedCompletion(const std::string &well_name, int complnum, double sim_time)
void closeWell(const std::string &well_name, WellTestConfig::Reason reason, double sim_time)
Definition: A.hpp:4
Definition: WellTestState.hpp:60
int num_attempt
Definition: WellTestState.hpp:64
int complnum
Definition: WellTestState.hpp:62
std::string wellName
Definition: WellTestState.hpp:61
double last_test
Definition: WellTestState.hpp:63
Definition: WellTestState.hpp:43
std::string name
Definition: WellTestState.hpp:44
double last_test
Definition: WellTestState.hpp:50
bool closed
Definition: WellTestState.hpp:47
int wtest_report_step
Definition: WellTestState.hpp:56
WellTestConfig::Reason reason
Definition: WellTestState.hpp:45
int num_attempt
Definition: WellTestState.hpp:51