WellsManager.hpp
Go to the documentation of this file.
1/*
2 Copyright 2012 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
20#ifndef OPM_WELLSMANAGER_HEADER_INCLUDED
21#define OPM_WELLSMANAGER_HEADER_INCLUDED
22
23#include <unordered_set>
24
25#include <opm/parser/eclipse/EclipseState/EclipseState.hpp>
26
30#include <opm/parser/eclipse/EclipseState/Schedule/GroupTree.hpp>
31
32#include <opm/core/utility/CompressedPropertyAccess.hpp>
33
34struct Wells;
35struct UnstructuredGrid;
36
37
38namespace Opm
39{
40
41 class Schedule;
42
43 struct WellData
44 {
47 // WellControlType control;
48 // double target;
50 // Opm::InjectionSpecification::InjectorType injected_phase;
52 };
53
54
55 struct PerfData
56 {
57 int cell;
58 double well_index;
60 };
66 {
67 public:
70
76 explicit WellsManager(struct Wells* W);
77
86 template<class F2C, class FC>
87 WellsManager(const Opm::EclipseState& eclipseState,
88 const Opm::Schedule& schedule,
89 const size_t timeStep,
90 int num_cells,
91 const int* global_cell,
92 const int* cart_dims,
93 int dimensions,
94 const F2C& f2c,
95 FC begin_face_centroids,
96 const DynamicListEconLimited& list_econ_limited,
97 bool is_parallel_run=false,
98 const std::unordered_set<std::string>& deactivated_wells = std::unordered_set<std::string> ());
99
100 WellsManager(const Opm::EclipseState& eclipseState,
101 const Opm::Schedule& schedule,
102 const size_t timeStep,
103 const UnstructuredGrid& grid);
106
108 bool empty() const;
109
113 const Wells* c_wells() const;
114
118
139 bool conditionsMet(const std::vector<double>& well_bhp,
140 const std::vector<double>& well_reservoirrates_phase,
141 const std::vector<double>& well_surfacerates_phase);
142
152 void applyExplicitReinjectionControls(const std::vector<double>& well_reservoirrates_phase,
153 const std::vector<double>& well_surfacerates_phase);
154
155
156 private:
157 template<class C2F, class FC>
158 void init(const Opm::EclipseState& eclipseState,
159 const Opm::Schedule& schedule,
160 const size_t timeStep,
161 int num_cells,
162 const int* global_cell,
163 const int* cart_dims,
164 int dimensions,
165 const C2F& cell_to_faces,
166 FC begin_face_centroids,
167 const DynamicListEconLimited& list_econ_limited,
168 const std::unordered_set<std::string>& deactivated_wells);
169 // Disable copying and assignment.
170 WellsManager(const WellsManager& other);
171 WellsManager& operator=(const WellsManager& other);
172 static void setupCompressedToCartesian(const int* global_cell, int number_of_cells, std::map<int,int>& cartesian_to_compressed );
173 void setupWellControls(std::vector<const Well*>& wells, size_t timeStep,
174 std::vector<std::string>& well_names, const PhaseUsage& phaseUsage,
175 const std::vector<int>& wells_on_proc,
176 const DynamicListEconLimited& list_econ_limited);
177
178 template<class C2F, class FC, class NTG>
179 void createWellsFromSpecs( std::vector<const Well*>& wells, size_t timeStep,
180 const C2F& cell_to_faces,
181 const int* cart_dims,
182 FC begin_face_centroids,
183 int dimensions,
184 std::vector<double>& dz,
185 std::vector<std::string>& well_names,
186 std::vector<WellData>& well_data,
187 std::map<std::string, int> & well_names_to_index,
188 const PhaseUsage& phaseUsage,
189 const std::map<int,int>& cartesian_to_compressed,
190 const double* permeability,
191 const NTG& ntg,
192 std::vector<int>& wells_on_proc,
193 const std::unordered_set<std::string>& deactivated_wells,
194 const DynamicListEconLimited& list_econ_limited);
195
196 void setupGuideRates(std::vector<const Well*>& wells, const size_t timeStep, std::vector<WellData>& well_data, std::map<std::string, int>& well_names_to_index);
197
198 // Data
199 Wells* w_;
200 WellCollection well_collection_;
201 // Whether this is a parallel simulation
202 bool is_parallel_run_;
203 };
204
205} // namespace Opm
206
207#include "WellsManager_impl.hpp"
208#endif // OPM_WELLSMANAGER_HEADER_INCLUDED
to handle the wells and connections violating economic limits.
Definition: DynamicListEconLimited.hpp:33
Definition: WellCollection.hpp:36
Definition: WellsManager.hpp:66
WellsManager(const Opm::EclipseState &eclipseState, const Opm::Schedule &schedule, const size_t timeStep, int num_cells, const int *global_cell, const int *cart_dims, int dimensions, const F2C &f2c, FC begin_face_centroids, const DynamicListEconLimited &list_econ_limited, bool is_parallel_run=false, const std::unordered_set< std::string > &deactivated_wells=std::unordered_set< std::string >())
const WellCollection & wellCollection() const
Access the well group hierarchy.
bool empty() const
Does the "deck" define any wells?
void applyExplicitReinjectionControls(const std::vector< double > &well_reservoirrates_phase, const std::vector< double > &well_surfacerates_phase)
bool conditionsMet(const std::vector< double > &well_bhp, const std::vector< double > &well_reservoirrates_phase, const std::vector< double > &well_surfacerates_phase)
const Wells * c_wells() const
WellsManager(struct Wells *W)
~WellsManager()
Destructor.
WellsManager(const Opm::EclipseState &eclipseState, const Opm::Schedule &schedule, const size_t timeStep, const UnstructuredGrid &grid)
WellsManager()
Default constructor – no wells.
WellCollection & wellCollection()
Definition: AnisotropicEikonal.hpp:44
Definition: WellsManager.hpp:56
int cell
Definition: WellsManager.hpp:57
double well_index
Definition: WellsManager.hpp:58
int satnumid
Definition: WellsManager.hpp:59
Definition: BlackoilPhases.hpp:44
Definition: WellsManager.hpp:44
int welspecsline
Definition: WellsManager.hpp:51
WellType type
Definition: WellsManager.hpp:45
double reference_bhp_depth
Definition: WellsManager.hpp:49
bool allowCrossFlow
Definition: WellsManager.hpp:46
Definition: wells.h:51
WellType
Definition: wells.h:41