DynamicListEconLimited.hpp
Go to the documentation of this file.
1/*
2 Copyright 2016 SINTEF ICT, Applied Mathematics.
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 OPM_DYNAMICLISTECONLIMITED_HPP
20#define OPM_DYNAMICLISTECONLIMITED_HPP
21
22#include <vector>
23#include <string>
24#include <map>
25
26#include <cassert>
27
28namespace Opm
29{
30
33 {
34 public:
35
37 }
38
39 bool wellShutEconLimited(const std::string& well_name) const {
40 return std::find(m_shut_wells.begin(), m_shut_wells.end(), well_name) != m_shut_wells.end();
41 }
42
43 void addShutWell(const std::string& well_name) {
44 assert( !wellShutEconLimited(well_name) );
45 assert( !wellStoppedEconLimited(well_name) );
46
47 m_shut_wells.push_back(well_name);
48 }
49
50 bool wellStoppedEconLimited(const std::string& well_name) const {
51 return std::find(m_stopped_wells.begin(), m_stopped_wells.end(), well_name) != m_stopped_wells.end();
52 }
53
54 void addStoppedWell(const std::string& well_name) {
55 assert( !wellShutEconLimited(well_name) );
56 assert( !wellStoppedEconLimited(well_name) );
57
58 m_stopped_wells.push_back(well_name);
59 }
60
61
62 // TODO: maybe completion better here
63 bool anyConnectionClosedForWell(const std::string& well_name) const {
64 return (m_cells_closed_connections.find(well_name) != m_cells_closed_connections.end());
65 }
66
67 const std::vector<int>& getClosedConnectionsForWell(const std::string& well_name) const {
68 return (m_cells_closed_connections.find(well_name)->second);
69 }
70
71 void addClosedConnectionsForWell(const std::string& well_name,
72 const int cell_closed_connection) {
73 if (!anyConnectionClosedForWell(well_name)) {
74 // first time adding a connection for the well
75 std::vector<int> vector_cells = {cell_closed_connection};
76 m_cells_closed_connections[well_name] = vector_cells;
77 } else {
78 std::vector<int>& closed_connections = m_cells_closed_connections.find(well_name)->second;
79 closed_connections.push_back(cell_closed_connection);
80 }
81 }
82
83 private:
84 std::vector <std::string> m_shut_wells;
85 std::vector <std::string> m_stopped_wells;
86 // using grid cell number to indicate the location of the connections
87 std::map<std::string, std::vector<int>> m_cells_closed_connections;
88 };
89
90} // namespace Opm
91#endif /* OPM_DYNAMICLISTECONLIMITED_HPP */
92
to handle the wells and connections violating economic limits.
Definition: DynamicListEconLimited.hpp:33
bool wellStoppedEconLimited(const std::string &well_name) const
Definition: DynamicListEconLimited.hpp:50
const std::vector< int > & getClosedConnectionsForWell(const std::string &well_name) const
Definition: DynamicListEconLimited.hpp:67
bool wellShutEconLimited(const std::string &well_name) const
Definition: DynamicListEconLimited.hpp:39
void addShutWell(const std::string &well_name)
Definition: DynamicListEconLimited.hpp:43
bool anyConnectionClosedForWell(const std::string &well_name) const
Definition: DynamicListEconLimited.hpp:63
void addClosedConnectionsForWell(const std::string &well_name, const int cell_closed_connection)
Definition: DynamicListEconLimited.hpp:71
void addStoppedWell(const std::string &well_name)
Definition: DynamicListEconLimited.hpp:54
DynamicListEconLimited()
Definition: DynamicListEconLimited.hpp:36
Definition: AnisotropicEikonal.hpp:44