My Project
Loading...
Searching...
No Matches
MULTREGTScanner.hpp
1/*
2 Copyright 2014--2023 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
20#ifndef OPM_PARSER_MULTREGTSCANNER_HPP
21#define OPM_PARSER_MULTREGTSCANNER_HPP
22
23#include <opm/input/eclipse/EclipseState/Grid/FaceDir.hpp>
24#include <opm/input/eclipse/EclipseState/Grid/GridDims.hpp>
25
26#include <array>
27#include <cstddef>
28#include <functional>
29#include <map>
30#include <string>
31#include <utility>
32#include <vector>
33
34namespace Opm {
35
36 class DeckRecord;
37 class DeckKeyword;
38 class FieldPropsManager;
39
40} // namespace Opm
41
42namespace Opm {
43
44 namespace MULTREGT {
45 enum class NNCBehaviourEnum
46 {
47 NNC = 1,
48 NONNC = 2,
49 ALL = 3,
50 NOAQUNNC = 4
51 };
52
53 std::string RegionNameFromDeckValue(const std::string& stringValue);
54 NNCBehaviourEnum NNCBehaviourFromString(const std::string& stringValue);
55 } // namespace MULTREGT
56
58 {
59 int src_value;
60 int target_value;
61 double trans_mult;
62 int directions;
63 MULTREGT::NNCBehaviourEnum nnc_behaviour;
64 std::string region_name;
65
66 bool operator==(const MULTREGTRecord& data) const
67 {
68 return (src_value == data.src_value)
69 && (target_value == data.target_value)
70 && (trans_mult == data.trans_mult)
71 && (directions == data.directions)
72 && (nnc_behaviour == data.nnc_behaviour)
73 && (region_name == data.region_name)
74 ;
75 }
76
77 template<class Serializer>
78 void serializeOp(Serializer& serializer)
79 {
80 serializer(src_value);
81 serializer(target_value);
82 serializer(trans_mult);
83 serializer(directions);
84 serializer(nnc_behaviour);
85 serializer(region_name);
86 }
87 };
88
90 {
91 public:
92 MULTREGTScanner() = default;
94 MULTREGTScanner(const GridDims& grid,
95 const FieldPropsManager* fp_arg,
96 const std::vector<const DeckKeyword*>& keywords);
97
98 static MULTREGTScanner serializationTestObject();
99
100 bool operator==(const MULTREGTScanner& data) const;
101 MULTREGTScanner& operator=(const MULTREGTScanner& data);
102
103 void applyNumericalAquifer(const std::vector<std::size_t>& aquifer_cells);
104
105 double getRegionMultiplier(std::size_t globalCellIdx1,
106 std::size_t globalCellIdx2,
107 FaceDir::DirEnum faceDir) const;
108
109 double getRegionMultiplierNNC(std::size_t globalCellIdx1,
110 std::size_t globalCellIdx2) const;
111
112 template <class Serializer>
113 void serializeOp(Serializer& serializer)
114 {
115 serializer(gridDims);
116
117 serializer(m_records);
118 serializer(m_records_same);
119 serializer(m_searchMap);
120
121 serializer(regions);
122 serializer(aquifer_cells);
123 }
124
125 private:
126
127 // For any key k in the map k.first <= k.second holds.
128 using MULTREGTSearchMap = std::map<
129 std::pair<int, int>,
130 std::vector<MULTREGTRecord>::size_type
131 >;
132
142 template<typename ApplyDecision, typename RegPairFound>
143 double applyMultiplierDifferentRegion(const std::array<MULTREGTSearchMap,2>& regMaps,
144 double multiplier,
145 std::size_t regionId1,
146 std::size_t regionId2,
147 const ApplyDecision& applyMultiplier,
148 const RegPairFound& regPairFound) const;
149
163 template<typename ApplyDecision, typename RegPairFound>
164 double applyMultiplierSameRegion(const std::array<MULTREGTSearchMap,2>& regMaps,
165 double multiplier,
166 std::size_t regionId1,
167 std::size_t regionId2,
168 const ApplyDecision& applyMultiplier,
169 const RegPairFound& regPairFound) const;
170 template<int index>
171 void fillSearchMap(const std::vector<MULTREGTRecord>& records);
172
173 GridDims gridDims{};
174 const FieldPropsManager* fp{nullptr};
175
176 // For any record stored index of source region is less than
177 // target region.
178 std::vector<MULTREGTRecord> m_records{};
185 std::vector<MULTREGTRecord> m_records_same{};
186 std::map<std::string, std::array<MULTREGTSearchMap,2>> m_searchMap{};
187 std::map<std::string, std::vector<int>> regions{};
188 std::vector<std::size_t> aquifer_cells{};
189
190 void addKeyword(const DeckKeyword& deckKeyword);
191
192 bool isAquNNC(std::size_t globalCellIdx1, std::size_t globalCellIdx2) const;
193 bool isAquCell(std::size_t globalCellIdx) const;
194 };
195
196} // namespace Opm
197
198#endif // OPM_PARSER_MULTREGTSCANNER_HPP
Definition DeckKeyword.hpp:36
Definition FieldPropsManager.hpp:42
Definition GridDims.hpp:31
Definition MULTREGTScanner.hpp:90
Class for (de-)serializing.
Definition Serializer.hpp:84
This class implements a small container which holds the transmissibility mulitpliers for all the face...
Definition Exceptions.hpp:30
Definition MULTREGTScanner.hpp:58