68 double dx = 1.0,
double dy = 1.0,
double dz = 1.0,
73 const std::vector<double>& coord ,
74 const std::vector<double>& zcorn ,
75 const int * actnum =
nullptr);
82 static bool hasGDFILE(
const Deck& deck);
83 static bool hasRadialKeywords(
const Deck& deck);
84 static bool hasSpiderKeywords(
const Deck& deck);
85 static bool hasCylindricalKeywords(
const Deck& deck);
86 static bool hasCornerPointKeywords(
const Deck&);
87 static bool hasCartesianKeywords(
const Deck&);
88 size_t getNumActive( )
const;
89 bool allActive()
const;
91 size_t activeIndex(
size_t i,
size_t j,
size_t k)
const;
92 size_t activeIndex(
size_t globalIndex)
const;
94 size_t getActiveIndex(
size_t i,
size_t j,
size_t k)
const {
95 return activeIndex(i, j, k);
98 void save(
const std::string& filename,
bool formatted,
const std::vector<Opm::NNCdata>& nnc,
const Opm::UnitSystem& units)
const;
105 using GridDims::getGlobalIndex;
116 bool isPinchActive()
const;
117 double getPinchThresholdThickness()
const;
118 PinchMode getPinchOption()
const;
119 PinchMode getMultzOption()
const;
120 PinchMode getPinchGapMode()
const;
121 double getPinchMaxEmptyGap()
const;
123 MinpvMode getMinpvMode()
const;
124 const std::vector<double>& getMinpvVector( )
const;
140 std::vector<T> compressedVector(
const std::vector<T>& input_vector)
const {
141 if( input_vector.size() == this->getNumActive() ) {
145 if (input_vector.size() != getCartesianSize())
146 throw std::invalid_argument(
"Input vector must have full size");
149 std::vector<T> compressed_vector( this->getNumActive() );
152 for (
size_t i = 0; i < this->getNumActive(); ++i)
153 compressed_vector[i] = input_vector[ active_map[i] ];
155 return compressed_vector;
164 std::tuple<std::array<double, 3>,std::array<double, 3>,std::array<double, 3>>
166 std::array<double, 3> getCellCenter(
size_t i,
size_t j,
size_t k)
const;
167 std::array<double, 3> getCellCenter(
size_t globalIndex)
const;
168 std::array<double, 3> getCornerPos(
size_t i,
size_t j,
size_t k,
size_t corner_index)
const;
169 const std::vector<double>& activeVolume()
const;
170 double getCellVolume(
size_t globalIndex)
const;
171 double getCellVolume(
size_t i ,
size_t j ,
size_t k)
const;
172 double getCellThickness(
size_t globalIndex)
const;
173 double getCellThickness(
size_t i ,
size_t j ,
size_t k)
const;
174 std::array<double, 3> getCellDims(
size_t i,
size_t j,
size_t k)
const;
175 std::array<double, 3> getCellDims(
size_t globalIndex)
const;
176 bool cellActive(
size_t globalIndex )
const;
177 bool cellActive(
size_t i ,
size_t j,
size_t k )
const;
178 bool cellActiveAfterMINPV(
size_t i ,
size_t j ,
size_t k,
double cell_porv )
const;
180 std::array<double, 3> getCellDimensions(
size_t i,
size_t j,
size_t k)
const {
181 return getCellDims(i, j, k);
184 bool isCellActive(
size_t i,
size_t j,
size_t k)
const {
185 return cellActive(i, j, k);
196 double getCellDepth(
size_t i,
size_t j,
size_t k)
const;
197 double getCellDepth(
size_t globalIndex)
const;
200 const std::vector<double>& getCOORD()
const;
201 const std::vector<double>& getZCORN()
const;
202 const std::vector<int>& getACTNUM( )
const;
205 const std::map<size_t, std::array<int,2>>& getAquiferCellTabnums()
const;
215 size_t getZcornFixed() {
return zcorn_fixed; };
220 void resetACTNUM(
const std::vector<int>& actnum);
223 void setMINPVV(
const std::vector<double>& minpvv);
226 static bool hasDVDEPTHZKeywords(
const Deck&);
235 static bool hasEqualDVDEPTHZ(
const Deck&);
236 static bool allEqual(
const std::vector<double> &v);
239 std::vector<double> m_minpvVector;
240 MinpvMode m_minpvMode;
241 std::optional<double> m_pinch;
243 PinchMode m_pinchoutMode;
245 PinchMode m_multzMode;
247 PinchMode m_pinchGapMode;
248 double m_pinchMaxEmptyGap;
250 mutable std::optional<std::vector<double>> active_volume;
252 bool m_circle =
false;
254 size_t zcorn_fixed = 0;
255 bool m_useActnumFromGdfile =
false;
258 mutable std::optional<std::vector<double>> m_input_zcorn;
259 mutable std::optional<std::vector<double>> m_input_coord;
261 std::vector<double> m_zcorn;
262 std::vector<double> m_coord;
265 std::vector<int> m_actnum;
266 std::optional<MapAxes> m_mapaxes;
270 std::vector<int> m_active_to_global;
271 std::vector<int> m_global_to_active;
273 std::unordered_set<size_t> m_aquifer_cells;
275 std::map<size_t, double> m_aquifer_cell_depths;
276 std::map<size_t, std::array<int,2>> m_aquifer_cell_tabnums;
279 std::optional<std::vector<double>> m_thetav;
280 std::optional<std::vector<double>> m_rv;
282 void updateNumericalAquiferCells(
const Deck&);
283 double computeCellGeometricDepth(
size_t globalIndex)
const;
286 const std::string& fileName);
287 void resetACTNUM(
const int* actnum);
289 void initBinaryGrid(
const Deck& deck);
291 void initCornerPointGrid(
const std::vector<double>& coord ,
292 const std::vector<double>& zcorn ,
295 bool keywInputBeforeGdfile(
const Deck& deck,
const std::string& keyword)
const;
297 void initCylindricalGrid(
const Deck&);
298 void initSpiderwebGrid(
const Deck&);
299 void initSpiderwebOrCylindricalGrid(
const Deck&,
const bool);
300 void initCartesianGrid(
const Deck&);
301 void initDTOPSGrid(
const Deck&);
302 void initDVDEPTHZGrid(
const Deck&);
303 void initGrid(
const Deck&,
const int* actnum);
304 void initCornerPointGrid(
const Deck&);
305 void assertCornerPointKeywords(
const Deck&);
307 static bool hasDTOPSKeywords(
const Deck&);
308 static void assertVectorSize(
const std::vector<double>& vector,
size_t expectedSize,
const std::string& msg);
310 static std::vector<double> createTOPSVector(
const std::array<int, 3>& dims,
const std::vector<double>& DZ,
const Deck&);
311 static std::vector<double> createDVector(
const std::array<int, 3>& dims, std::size_t dim,
const std::string& DKey,
const std::string& DVKey,
const Deck&);
312 static void scatterDim(
const std::array<int, 3>& dims ,
size_t dim ,
const std::vector<double>& DV , std::vector<double>& D);
315 std::vector<double> makeCoordDxDyDzTops(
const std::vector<double>& dx,
const std::vector<double>& dy,
const std::vector<double>& dz,
const std::vector<double>& tops)
const;
316 std::vector<double> makeZcornDzTops(
const std::vector<double>& dz,
const std::vector<double>& tops)
const ;
317 std::vector<double> makeZcornDzvDepthz(
const std::vector<double>& dzv,
const std::vector<double>& depthz)
const;
318 std::vector<double> makeCoordDxvDyvDzvDepthz(
const std::vector<double>& dxv,
const std::vector<double>& dyv,
const std::vector<double>& dzv,
const std::vector<double>& depthz)
const;
320 void getCellCorners(
const std::array<int, 3>& ijk,
const std::array<int, 3>& dims, std::array<double,8>& X, std::array<double,8>& Y, std::array<double,8>& Z)
const;
321 void getCellCorners(
const std::size_t globalIndex,
322 std::array<double,8>& X,
323 std::array<double,8>& Y,
324 std::array<double,8>& Z)
const;