75 double dx = 1.0,
double dy = 1.0,
double dz = 1.0,
80 const std::vector<double>& coord ,
81 const std::vector<double>& zcorn ,
82 const int * actnum =
nullptr);
90 static bool hasGDFILE(
const Deck& deck);
91 static bool hasRadialKeywords(
const Deck& deck);
92 static bool hasSpiderKeywords(
const Deck& deck);
93 static bool hasCylindricalKeywords(
const Deck& deck);
94 static bool hasCornerPointKeywords(
const Deck&);
95 static bool hasCartesianKeywords(
const Deck&);
96 size_t getNumActive( )
const;
97 bool allActive()
const;
99 size_t activeIndex(
size_t i,
size_t j,
size_t k)
const;
100 size_t activeIndex(
size_t globalIndex)
const;
102 size_t getTotalActiveLGR()
const;
103 size_t getActiveIndexLGR(
const std::string& label,
size_t i,
size_t j,
size_t k)
const;
104 size_t getActiveIndexLGR(
const std::string& label,
size_t localIndex)
const;
106 size_t activeIndexLGR(
const std::string& label,
size_t i,
size_t j,
size_t k)
const;
107 size_t activeIndexLGR(
const std::string& label,
size_t localIndex)
const;
109 size_t getActiveIndex(
size_t i,
size_t j,
size_t k)
const {
110 return activeIndex(i, j, k);
113 size_t getActiveIndex(
size_t globalIndex)
const {
114 return activeIndex(globalIndex);
117 std::vector<std::string> get_all_lgr_labels()
const
119 return {this->all_lgr_labels.begin() + 1, this->all_lgr_labels.end()};
122 const std::vector<std::string>& get_all_labels()
const
124 return this->all_lgr_labels;
127 std::string get_lgr_tag()
const {
128 return this->lgr_label;
131 std::vector<GridDims> get_lgr_children_gridim()
const;
134 void assertIndexLGR(
size_t localIndex)
const;
136 void assertLabelLGR(
const std::string& label)
const;
138 void save(
const std::string& filename,
bool formatted,
const std::vector<Opm::NNCdata>& nnc,
const Opm::UnitSystem& units)
const;
145 void init_children_host_cells(
bool logical =
true);
146 void init_children_host_cells_logical(
void);
147 void init_children_host_cells_geometrical(
void);
149 using GridDims::getGlobalIndex;
159 bool isPinchActive()
const;
160 double getPinchThresholdThickness()
const;
161 PinchMode getPinchOption()
const;
162 PinchMode getMultzOption()
const;
163 PinchMode getPinchGapMode()
const;
164 double getPinchMaxEmptyGap()
const;
165 MinpvMode getMinpvMode()
const;
166 const std::vector<double>& getMinpvVector( )
const;
182 std::vector<T> compressedVector(
const std::vector<T>& input_vector)
const {
183 if( input_vector.size() == this->getNumActive() ) {
187 if (input_vector.size() != getCartesianSize())
188 throw std::invalid_argument(
"Input vector must have full size");
191 std::vector<T> compressed_vector( this->getNumActive() );
194 for (
size_t i = 0; i < this->getNumActive(); ++i)
195 compressed_vector[i] = input_vector[ active_map[i] ];
197 return compressed_vector;
209 std::tuple<std::array<double, 3>,std::array<double, 3>,std::array<double, 3>>
211 std::array<double, 3> getCellCenter(
size_t i,
size_t j,
size_t k)
const;
212 std::array<double, 3> getCellCenter(
size_t globalIndex)
const;
213 std::array<double, 3> getCornerPos(
size_t i,
size_t j,
size_t k,
size_t corner_index)
const;
214 const std::vector<double>& activeVolume()
const;
215 double getCellVolume(
size_t globalIndex)
const;
216 double getCellVolume(
size_t i ,
size_t j ,
size_t k)
const;
217 double getCellThickness(
size_t globalIndex)
const;
218 double getCellThickness(
size_t i ,
size_t j ,
size_t k)
const;
219 std::array<double, 3> getCellDims(
size_t i,
size_t j,
size_t k)
const;
220 std::array<double, 3> getCellDims(
size_t globalIndex)
const;
221 bool cellActive(
size_t globalIndex )
const;
222 bool cellActive(
size_t i ,
size_t j,
size_t k )
const;
223 bool cellActiveAfterMINPV(
size_t i ,
size_t j ,
size_t k,
double cell_porv )
const;
224 bool is_lgr()
const {
return lgr_grid;};
225 std::array<double, 3> getCellDimensions(
size_t i,
size_t j,
size_t k)
const {
226 return getCellDims(i, j, k);
231 const std::string& lgr_tag)
const;
232 double getCellDepthLGR(
size_t i,
size_t j,
size_t k,
const std::string& lgr_tag)
const;
235 bool isCellActive(
size_t i,
size_t j,
size_t k)
const {
236 return cellActive(i, j, k);
247 double getCellDepth(
size_t i,
size_t j,
size_t k)
const;
248 double getCellDepth(
size_t globalIndex)
const;
251 const std::vector<double>& getCOORD()
const;
252 const std::vector<double>& getZCORN()
const;
253 const std::vector<int>& getACTNUM( )
const;
255 const std::optional<MapAxes>& getMapAxes()
const;
257 const std::map<size_t, std::array<int,2>>& getAquiferCellTabnums()
const;
267 size_t getZcornFixed() {
return zcorn_fixed; };
272 void resetACTNUM(
const std::vector<int>& actnum);
275 void setMINPVV(
const std::vector<double>& minpvv);
278 static bool hasDVDEPTHZKeywords(
const Deck&);
287 static bool hasEqualDVDEPTHZ(
const Deck&);
288 static bool allEqual(
const std::vector<double> &v);
290 const EclipseGridLGR& getLGRCell(
const std::string& lgr_tag)
const;
291 int getLGR_global_father(std::size_t global_index,
const std::string& lgr_tag)
const;
293 std::vector<EclipseGridLGR> lgr_children_cells;
301 virtual void set_lgr_refinement(
const std::string& lgr_tag,
const std::vector<double>& coords,
const std::vector<double>& zcorn);
304 std::size_t lgr_global_counter = 0;
305 std::string lgr_label =
"GLOBAL";
307 int lgr_level_father = 0;
308 std::vector<std::string> lgr_children_labels;
309 std::vector<std::size_t> lgr_active_index;
310 std::vector<std::size_t> lgr_level_active_map;
311 std::vector<std::string> all_lgr_labels;
312 std::map<std::vector<std::size_t>, std::size_t> num_lgr_children_cells;
313 std::vector<double> m_zcorn;
314 std::vector<double> m_coord;
315 std::vector<int> m_actnum;
316 std::vector<std::size_t> m_print_order_lgr_cells;
318 mutable std::optional<std::vector<double>> m_input_zcorn;
319 mutable std::optional<std::vector<double>> m_input_coord;
322 std::vector<double> m_minpvVector;
323 MinpvMode m_minpvMode;
324 std::optional<double> m_pinch;
327 PinchMode m_pinchoutMode;
329 PinchMode m_multzMode;
331 PinchMode m_pinchGapMode;
332 double m_pinchMaxEmptyGap;
333 bool lgr_grid =
false;
334 mutable std::optional<std::vector<double>> active_volume;
336 bool m_circle =
false;
337 size_t zcorn_fixed = 0;
338 bool m_useActnumFromGdfile =
false;
340 std::optional<MapAxes> m_mapaxes;
344 std::vector<int> m_active_to_global;
345 std::vector<int> m_global_to_active;
347 std::unordered_set<size_t> m_aquifer_cells;
349 std::map<size_t, double> m_aquifer_cell_depths;
350 std::map<size_t, std::array<int,2>> m_aquifer_cell_tabnums;
353 std::optional<std::vector<double>> m_thetav;
354 std::optional<std::vector<double>> m_rv;
355 void parseGlobalReferenceToChildren(
void);
356 int initializeLGRObjectIndices(
int);
357 void initializeLGRTreeIndices(
void);
358 void propagateParentIndicesToLGRChildren(
int);
359 void updateNumericalAquiferCells(
const Deck&);
360 double computeCellGeometricDepth(
size_t globalIndex)
const;
363 const std::string& fileName);
364 void resetACTNUM(
const int* actnum);
366 void initBinaryGrid(
const Deck& deck);
368 void initCornerPointGrid(
const std::vector<double>& coord ,
369 const std::vector<double>& zcorn ,
372 bool keywInputBeforeGdfile(
const Deck& deck,
const std::string& keyword)
const;
374 void initCylindricalGrid(
const Deck&);
375 void initSpiderwebGrid(
const Deck&);
376 void initSpiderwebOrCylindricalGrid(
const Deck&,
const bool);
377 void initCartesianGrid(
const Deck&);
378 void initDTOPSGrid(
const Deck&);
379 void initDVDEPTHZGrid(
const Deck&);
380 void initGrid(
const Deck&,
const int* actnum);
381 void initCornerPointGrid(
const Deck&);
382 void assertCornerPointKeywords(
const Deck&);
384 static bool hasDTOPSKeywords(
const Deck&);
385 static void assertVectorSize(
const std::vector<double>& vector,
size_t expectedSize,
const std::string& msg);
387 static std::vector<double> createTOPSVector(
const std::array<int, 3>& dims,
const std::vector<double>& DZ,
const Deck&);
388 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&);
389 static void scatterDim(
const std::array<int, 3>& dims ,
size_t dim ,
const std::vector<double>& DV , std::vector<double>& D);
392 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;
393 std::vector<double> makeZcornDzTops(
const std::vector<double>& dz,
const std::vector<double>& tops)
const ;
394 std::vector<double> makeZcornDzvDepthz(
const std::vector<double>& dzv,
const std::vector<double>& depthz)
const;
395 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;
397 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;
398 void getCellCorners(
const std::size_t globalIndex,
399 std::array<double,8>& X,
400 std::array<double,8>& Y,
401 std::array<double,8>& Z)
const;
402 std::array<int,3> getCellSubdivisionRatioLGR(
const std::string& lgr_tag,
403 std::array<int,3> acum = {1,1,1})
const;
412 using vec_size_t = std::vector<std::size_t>;
415 const std::string& father_label_,
419 const vec_size_t& father_lgr_index,
420 const std::array<int, 3>& low_fatherIJK_,
421 const std::array<int, 3>& up_fatherIJK_);
422 const vec_size_t& getFatherGlobalID()
const;
425 void set_lgr_global_counter(std::size_t counter)
427 lgr_global_counter = counter;
429 const vec_size_t& get_father_global()
const
431 return father_global;
433 std::optional<std::reference_wrapper<EclipseGridLGR>>
434 get_child_LGR_cell(
const std::string& lgr_tag)
const;
435 std::vector<int> save_hostnum(
void)
const;
436 int get_hostnum(std::size_t global_index)
const {
return(m_hostnum[global_index]);};
437 void get_label_child_to_top_father(std::vector<std::reference_wrapper<const std::string>>& list)
const;
438 void get_global_index_child_to_top_father(std::vector<std::size_t> & list,
439 std::size_t i, std::size_t j, std::size_t k)
const;
440 void get_global_index_child_to_top_father(std::vector<std::size_t> & list, std::size_t global_ind)
const;
442 void set_hostnum(
const std::vector<int>&);
443 const std::array<int,3>& get_low_fatherIJK()
const{
444 return low_fatherIJK;
446 const std::string& get_father_label()
const{
450 const std::array<int,3>& get_up_fatherIJK()
const{
463 const std::vector<double>& coord,
464 const std::vector<double>& zcorn)
override;
469 void init_father_global();
470 std::string father_label;
472 vec_size_t father_global;
473 std::array<int, 3> low_fatherIJK {};
474 std::array<int, 3> up_fatherIJK {};
475 std::vector<int> m_hostnum;