My Project
GlobalWellInfo.hpp
1/*
2 Copyright 2021 Equinor
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#ifndef OPM_GLOBAL_WELL_INFO_HEADER_INCLUDED
21#define OPM_GLOBAL_WELL_INFO_HEADER_INCLUDED
22
23#include <cstddef>
24#include <map>
25#include <string>
26#include <vector>
27
28#include <opm/input/eclipse/Schedule/Well/Well.hpp>
29
30namespace Opm {
31
32class Schedule;
33class Well;
34
35
36/*
37 The context of the GlobalWellInfo class is the situation where the wells are
38 distributed among different processors. Most well processing only considers
39 the wells defined on the local process, but in some cases we need global
40 information about all the wells. This class maintains the following:
41
42 - Mapping between global well index and well name.
43
44 - Mapping between local well index and global index (only used internally in
45 class).
46
47 - Functionality to query well whether it is currently injecting or producing
48 under group control.
49*/
50
51
53public:
54
55
56 /*
57 Will sum the m_in_injecting_group and m_in_producing_group vectors across
58 all processes, so that all processes can query for an arbitrary well.
59 */
60 template <typename Comm>
61 void communicate(const Comm& comm) {
62 auto size = this->m_in_injecting_group.size();
63 comm.sum( this->m_in_injecting_group.data(), size);
64 comm.sum( this->m_in_producing_group.data(), size);
65 }
66
67
68
69 GlobalWellInfo(const Schedule& sched, std::size_t report_step, const std::vector<Well>& local_wells);
70 bool in_producing_group(const std::string& wname) const;
71 bool in_injecting_group(const std::string& wname) const;
72 std::size_t well_index(const std::string& wname) const;
73 const std::string& well_name(std::size_t well_index) const;
74 void update_injector(std::size_t well_index, Well::Status well_status, Well::InjectorCMode injection_cmode);
75 void update_producer(std::size_t well_index, Well::Status well_status, Well::ProducerCMode production_cmode);
76 void clear();
77
78private:
79 std::vector<std::size_t> local_map; // local_index -> global_index
80
81 std::map<std::string, std::size_t> name_map; // string -> global_index
82 std::vector<int> m_in_injecting_group; // global_index -> int/bool
83 std::vector<int> m_in_producing_group; // global_index -> int/bool
84};
85
86
87}
88
89#endif
90
Definition: GlobalWellInfo.hpp:52
This file contains a set of helper functions used by VFPProd / VFPInj.
Definition: BlackoilPhases.hpp:27