Skip to content

Commit 042aaa5

Browse files
committed
LGRs and Faults, computing intersection of segments approach
1 parent 8cb1da3 commit 042aaa5

11 files changed

Lines changed: 4467 additions & 1451 deletions

CMakeLists_files.cmake

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ list(APPEND MAIN_SOURCE_FILES
3737
opm/grid/cpgrid/GridHelpers.cpp
3838
opm/grid/cpgrid/Iterators.cpp
3939
opm/grid/cpgrid/Indexsets.cpp
40+
opm/grid/cpgrid/LgrFaultHelpers.cpp
4041
opm/grid/cpgrid/LgrHelpers.cpp
4142
opm/grid/cpgrid/LgrOutputHelpers.cpp
4243
opm/grid/cpgrid/NestedRefinementUtilities.cpp
@@ -112,14 +113,13 @@ list(APPEND TEST_SOURCE_FILES
112113
tests/cpgrid/lgr/addLgrs_in_allActiveCartesianGrid_test.cpp
113114
tests/cpgrid/lgr/addLgrsOnDistributedGrid_test.cpp
114115
tests/cpgrid/lgr/autoRefine_test.cpp
116+
tests/cpgrid/lgr/compute_new_vertices_of_overlapping_intersections_test.cpp
115117
tests/cpgrid/lgr/global_refine_test.cpp
116118
tests/cpgrid/lgr/id_entity_entityrep_test.cpp
117119
tests/cpgrid/lgr/level_and_grid_cartesianIndexMappers_test.cpp
118120
tests/cpgrid/lgr/lgrs_sharing_faces_test.cpp
119121
tests/cpgrid/lgr/logicalCartesianSize_and_refinement_test.cpp
120122
tests/cpgrid/lgr/nested_refinement_test.cpp
121-
tests/cpgrid/lgr/replace_lgr1_corner_idx_by_lgr2_corner_idx_test.cpp
122-
tests/cpgrid/lgr/replace_lgr1_face_idx_by_lgr2_face_idx_test.cpp
123123
)
124124

125125
if(USE_OPM_COMMON)
@@ -211,6 +211,7 @@ list(APPEND PUBLIC_HEADER_FILES
211211
opm/grid/cpgrid/Indexsets.hpp
212212
opm/grid/cpgrid/Intersection.hpp
213213
opm/grid/cpgrid/Iterators.hpp
214+
opm/grid/cpgrid/LgrFaultHelpers.hpp
214215
opm/grid/cpgrid/LgrHelpers.hpp
215216
opm/grid/cpgrid/LgrOutputHelpers.hpp
216217
opm/grid/cpgrid/ElementMarkHandle.hpp

opm/grid/cpgrid/CpGrid.cpp

Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2004,8 +2004,13 @@ bool CpGrid::refineAndUpdateGrid(bool throwOnFailure,
20042004
// In entry 'level cell index', we store 'leafview cell index', or -1 when the cell vanished.
20052005
preAdapt_level_to_leaf_cells_vec[preAdaptLevel].resize(data[preAdaptLevel]->size(0), -1);
20062006
}
2007+
2008+
std::vector<Opm::Lgr::CellRefinementBoundaryInfo> cellRefsBoundaryInfo(currentLeafData().size(0)); // if a cell has been refined, then
2009+
// its cell-refinement info is stored in gridCellRefinements[ element.index() ]
2010+
2011+
bool withoutFaults = true;
20072012
// Ignore marked aquifer cells/connections in globalRefine()/adapt(); throw in addLgrsUpdateLeafView()/autoRef().
2008-
Opm::Lgr::filterMarkedAquiferCellsAndConnections(*this, throwOnFailure);
2013+
Opm::Lgr::filterMarkedAquiferCellsAndConnections(*this, throwOnFailure);
20092014
Opm::Lgr::refineAndProvideMarkedRefinedRelations( *this,
20102015
/* Marked elements parameters */
20112016
markedElem_to_itsLgr,
@@ -2025,7 +2030,9 @@ bool CpGrid::refineAndUpdateGrid(bool throwOnFailure,
20252030
cell_count,
20262031
preAdapt_level_to_leaf_cells_vec,
20272032
/* Additional parameters */
2028-
cells_per_dim_vec);
2033+
cells_per_dim_vec,
2034+
cellRefsBoundaryInfo,
2035+
withoutFaults);
20292036

20302037
#if HAVE_MPI
20312038
auto global_markedElem_count = comm().sum(markedElem_count);
@@ -2095,7 +2102,9 @@ bool CpGrid::refineAndUpdateGrid(bool throwOnFailure,
20952102
assignRefinedLevel,
20962103
cornerInMarkedElemWithEquivRefinedCorner,
20972104
faceInMarkedElemAndRefinedFaces,
2098-
cells_per_dim_vec);
2105+
cells_per_dim_vec,
2106+
cellRefsBoundaryInfo,
2107+
withoutFaults);
20992108

21002109
// --- Adapted corners and PreAdapt corners relations ---
21012110
std::map<std::array<int,2>,int> elemLgrAndElemLgrCorner_to_adaptedCorner;
@@ -2114,7 +2123,9 @@ bool CpGrid::refineAndUpdateGrid(bool throwOnFailure,
21142123
cornerInMarkedElemWithEquivRefinedCorner,
21152124
vanishedRefinedCorner_to_itsLastAppearance,
21162125
faceInMarkedElemAndRefinedFaces,
2117-
cells_per_dim_vec);
2126+
cells_per_dim_vec,
2127+
cellRefsBoundaryInfo,
2128+
withoutFaults);
21182129

21192130
// FACES
21202131
// Stablish relationships between PreAdapt faces and refined or adapted ones ---
@@ -2131,22 +2142,21 @@ bool CpGrid::refineAndUpdateGrid(bool throwOnFailure,
21312142
markedElem_to_itsLgr,
21322143
assignRefinedLevel,
21332144
faceInMarkedElemAndRefinedFaces,
2134-
cells_per_dim_vec);
2145+
cellRefsBoundaryInfo);
21352146

21362147
// --- Adapted faces and PreAdapt faces relations ---
21372148
std::map< std::array<int,2>, int > elemLgrAndElemLgrFace_to_adaptedFace;
21382149
std::unordered_map< int, std::array<int,2> > adaptedFace_to_elemLgrAndElemLgrFace;
21392150
// Integer to count adapted faces (mixed between faces from pre-refined-leaf faces not involved in LGRs and new-born refined faces).
21402151
int face_count = 0;
21412152
Opm::Lgr::identifyLeafGridFaces(currentLeafData(),
2142-
preAdaptMaxLevel,
21432153
elemLgrAndElemLgrFace_to_adaptedFace,
21442154
adaptedFace_to_elemLgrAndElemLgrFace,
21452155
face_count,
21462156
markedElem_to_itsLgr,
21472157
assignRefinedLevel,
21482158
faceInMarkedElemAndRefinedFaces,
2149-
cells_per_dim_vec);
2159+
cellRefsBoundaryInfo);
21502160

21512161
// Set refined level grids geometries
21522162
// --- Refined corners ---
@@ -2183,11 +2193,10 @@ bool CpGrid::refineAndUpdateGrid(bool throwOnFailure,
21832193
elemLgrAndElemLgrCorner_to_refinedLevelAndRefinedCorner,
21842194
vanishedRefinedCorner_to_itsLastAppearance,
21852195
markedElem_to_itsLgr,
2186-
assignRefinedLevel,
21872196
preAdaptMaxLevel,
21882197
markedElemAndEquivRefinedCorn_to_corner,
21892198
cornerInMarkedElemWithEquivRefinedCorner,
2190-
cells_per_dim_vec);
2199+
cellRefsBoundaryInfo);
21912200

21922201
// Update leaf grid geometries
21932202
// --- Adapted corners ---
@@ -2226,11 +2235,9 @@ bool CpGrid::refineAndUpdateGrid(bool throwOnFailure,
22262235
elemLgrAndElemLgrCorner_to_adaptedCorner,
22272236
vanishedRefinedCorner_to_itsLastAppearance,
22282237
markedElem_to_itsLgr,
2229-
assignRefinedLevel,
22302238
markedElemAndEquivRefinedCorn_to_corner,
22312239
cornerInMarkedElemWithEquivRefinedCorner,
2232-
cells_per_dim_vec,
2233-
preAdaptMaxLevel);
2240+
cellRefsBoundaryInfo);
22342241

22352242
for (int level = 0; level < levels; ++level) {
22362243
const int refinedLevelGridIdx = level + preAdaptMaxLevel +1;

0 commit comments

Comments
 (0)