opm-common
ScheduleGrid.hpp
1 /*
2  Copyright 2021 Equinor 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 SCHEDULE_GRID
20 #define SCHEDULE_GRID
21 
22 #include <opm/input/eclipse/Schedule/CompletedCells.hpp>
23 
24 #include <cstddef>
25 #include <functional>
26 #include <optional>
27 #include <string>
28 #include <unordered_map>
29 #include <vector>
30 
31 namespace Opm {
32 
33 class EclipseGrid;
34 class FieldPropsManager;
35 class NumericalAquifers;
36 struct NumericalAquiferCell;
37 
38 } // namespace Opm
39 
40 namespace Opm {
41 
50 {
51 public:
60  explicit ScheduleGrid(CompletedCells& completed_cells);
61 
77  ScheduleGrid(CompletedCells& completed_cells,
78  std::vector<CompletedCells>& completed_cells_lgr,
79  const std::unordered_map<std::string, std::size_t>& label_to_index_);
80 
94  ScheduleGrid(const EclipseGrid& ecl_grid,
95  const FieldPropsManager& fpm,
96  CompletedCells& completed_cells);
97 
118  ScheduleGrid(const EclipseGrid& ecl_grid,
119  const FieldPropsManager& fpm,
120  CompletedCells& completed_cells,
121  std::vector<CompletedCells>& completed_cells_lgr,
122  const std::unordered_map<std::string, std::size_t>& label_to_index_);
123 
131  void include_numerical_aquifers(const NumericalAquifers& num_aquifers);
132 
145  const CompletedCells::Cell&
146  get_cell(std::size_t i, std::size_t j, std::size_t k) const;
147 
165  const CompletedCells::Cell&
166  get_cell(std::size_t i, std::size_t j, std::size_t k, const std::optional<std::string>& tag) const;
167 
172  const EclipseGrid* get_grid() const;
173 
181  int get_lgr_grid_number(const std::optional<std::string>& lgr_label) const;
182 
183 private:
185  const EclipseGrid* grid{nullptr};
186 
188  const FieldPropsManager* fp{nullptr};
189 
193  std::reference_wrapper<CompletedCells> cells;
194 
198  std::reference_wrapper<std::vector<CompletedCells>> cells_lgr;
199 
203  std::reference_wrapper<const std::unordered_map<std::string, std::size_t>> label_to_index;
204 
208  std::unordered_map<std::size_t, const NumericalAquiferCell*> num_aqu_cells{};
209 
226  const CompletedCells::Cell&
227  get_cell_lgr(std::size_t i, std::size_t j, std::size_t k, const std::string& tag) const;
228 
236  void populate_props_from_main_grid(CompletedCells::Cell& cell) const;
237 
245  void populate_props_from_main_grid_cell(CompletedCells::Cell& cell) const;
246 
257  void populate_props_from_num_aquifer(const NumericalAquiferCell& numAquCell,
258  CompletedCells::Cell& cell) const;
259 
266  void populate_props_lgr(const std::string& tag,
267  CompletedCells::Cell& cell) const;
268 
277  const NumericalAquiferCell*
278  get_num_aqu_cell(const std::size_t global_index) const;
279 };
280 
281 } // namespace Opm
282 
283 #endif // SCHEDULE_GRID
Definition: NumericalAquiferCell.hpp:31
const CompletedCells::Cell & get_cell(std::size_t i, std::size_t j, std::size_t k) const
Retrieve particular intersected cell in main grid.
Definition: ScheduleGrid.cpp:97
Sparse collection of cells, and their properties, intersected by one or more well connections...
Definition: CompletedCells.hpp:35
void include_numerical_aquifers(const NumericalAquifers &num_aquifers)
Make collection aware of numerical aquifers.
Definition: ScheduleGrid.cpp:91
Definition: FieldPropsManager.hpp:42
About cell information and dimension: The actual grid information is held in a pointer to an ERT ecl_...
Definition: EclipseGrid.hpp:62
This class implements a small container which holds the transmissibility mulitpliers for all the face...
Definition: Exceptions.hpp:30
Collection of intersected cells and associate properties for all simulation grids, i.e., the main grid and all LGRs in the simulation run.
Definition: ScheduleGrid.hpp:49
const EclipseGrid * get_grid() const
Retrieve underlying grid object.
Definition: ScheduleGrid.cpp:129
Identification and associate properties of cell intersected by one or more well connections.
Definition: CompletedCells.hpp:40
ScheduleGrid(CompletedCells &completed_cells)
Constructor.
Definition: ScheduleGrid.cpp:55
Definition: NumericalAquifers.hpp:38
int get_lgr_grid_number(const std::optional< std::string > &lgr_label) const
Translate LGR name into a numeric grid index.
Definition: ScheduleGrid.cpp:134