Skip to content

Commit 9389d88

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

11 files changed

Lines changed: 4480 additions & 603 deletions

CMakeLists_files.cmake

Lines changed: 3 additions & 0 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,6 +113,7 @@ 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
@@ -211,6 +213,7 @@ list(APPEND PUBLIC_HEADER_FILES
211213
opm/grid/cpgrid/Indexsets.hpp
212214
opm/grid/cpgrid/Intersection.hpp
213215
opm/grid/cpgrid/Iterators.hpp
216+
opm/grid/cpgrid/LgrFaultHelpers.hpp
214217
opm/grid/cpgrid/LgrHelpers.hpp
215218
opm/grid/cpgrid/LgrOutputHelpers.hpp
216219
opm/grid/cpgrid/ElementMarkHandle.hpp

opm/grid/cpgrid/CpGrid.cpp

Lines changed: 30 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2004,8 +2004,15 @@ 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> cellRefinements(currentLeafData().size(0)); // if a cell has been refined, then
2009+
// its cell-refinement info is stored in gridCellRefinements[ element.index() ]
2010+
2011+
std::vector<Opm::Lgr::BoundaryInfo> boundaryInfoCellRefs(currentLeafData().size(0)); // if a cell has been refined, then
2012+
2013+
bool withoutFaults = true;
20072014
// Ignore marked aquifer cells/connections in globalRefine()/adapt(); throw in addLgrsUpdateLeafView()/autoRef().
2008-
Opm::Lgr::filterMarkedAquiferCellsAndConnections(*this, throwOnFailure);
2015+
Opm::Lgr::filterMarkedAquiferCellsAndConnections(*this, throwOnFailure);
20092016
Opm::Lgr::refineAndProvideMarkedRefinedRelations( *this,
20102017
/* Marked elements parameters */
20112018
markedElem_to_itsLgr,
@@ -2025,7 +2032,10 @@ bool CpGrid::refineAndUpdateGrid(bool throwOnFailure,
20252032
cell_count,
20262033
preAdapt_level_to_leaf_cells_vec,
20272034
/* Additional parameters */
2028-
cells_per_dim_vec);
2035+
cells_per_dim_vec,
2036+
cellRefinements,
2037+
boundaryInfoCellRefs,
2038+
withoutFaults);
20292039

20302040
#if HAVE_MPI
20312041
auto global_markedElem_count = comm().sum(markedElem_count);
@@ -2095,7 +2105,10 @@ bool CpGrid::refineAndUpdateGrid(bool throwOnFailure,
20952105
assignRefinedLevel,
20962106
cornerInMarkedElemWithEquivRefinedCorner,
20972107
faceInMarkedElemAndRefinedFaces,
2098-
cells_per_dim_vec);
2108+
cells_per_dim_vec,
2109+
cellRefinements,
2110+
boundaryInfoCellRefs,
2111+
withoutFaults);
20992112

21002113
// --- Adapted corners and PreAdapt corners relations ---
21012114
std::map<std::array<int,2>,int> elemLgrAndElemLgrCorner_to_adaptedCorner;
@@ -2114,7 +2127,10 @@ bool CpGrid::refineAndUpdateGrid(bool throwOnFailure,
21142127
cornerInMarkedElemWithEquivRefinedCorner,
21152128
vanishedRefinedCorner_to_itsLastAppearance,
21162129
faceInMarkedElemAndRefinedFaces,
2117-
cells_per_dim_vec);
2130+
cells_per_dim_vec,
2131+
cellRefinements,
2132+
boundaryInfoCellRefs,
2133+
withoutFaults);
21182134

21192135
// FACES
21202136
// Stablish relationships between PreAdapt faces and refined or adapted ones ---
@@ -2131,22 +2147,21 @@ bool CpGrid::refineAndUpdateGrid(bool throwOnFailure,
21312147
markedElem_to_itsLgr,
21322148
assignRefinedLevel,
21332149
faceInMarkedElemAndRefinedFaces,
2134-
cells_per_dim_vec);
2150+
cellRefinements);
21352151

21362152
// --- Adapted faces and PreAdapt faces relations ---
21372153
std::map< std::array<int,2>, int > elemLgrAndElemLgrFace_to_adaptedFace;
21382154
std::unordered_map< int, std::array<int,2> > adaptedFace_to_elemLgrAndElemLgrFace;
21392155
// Integer to count adapted faces (mixed between faces from pre-refined-leaf faces not involved in LGRs and new-born refined faces).
21402156
int face_count = 0;
21412157
Opm::Lgr::identifyLeafGridFaces(currentLeafData(),
2142-
preAdaptMaxLevel,
21432158
elemLgrAndElemLgrFace_to_adaptedFace,
21442159
adaptedFace_to_elemLgrAndElemLgrFace,
21452160
face_count,
21462161
markedElem_to_itsLgr,
21472162
assignRefinedLevel,
21482163
faceInMarkedElemAndRefinedFaces,
2149-
cells_per_dim_vec);
2164+
cellRefinements);
21502165

21512166
// Set refined level grids geometries
21522167
// --- Refined corners ---
@@ -2187,7 +2202,9 @@ bool CpGrid::refineAndUpdateGrid(bool throwOnFailure,
21872202
preAdaptMaxLevel,
21882203
markedElemAndEquivRefinedCorn_to_corner,
21892204
cornerInMarkedElemWithEquivRefinedCorner,
2190-
cells_per_dim_vec);
2205+
cells_per_dim_vec,
2206+
cellRefinements,
2207+
withoutFaults);
21912208

21922209
// Update leaf grid geometries
21932210
// --- Adapted corners ---
@@ -2211,7 +2228,8 @@ bool CpGrid::refineAndUpdateGrid(bool throwOnFailure,
22112228
markedElemAndEquivRefinedCorn_to_corner,
22122229
cornerInMarkedElemWithEquivRefinedCorner,
22132230
cells_per_dim_vec,
2214-
preAdaptMaxLevel);
2231+
preAdaptMaxLevel,
2232+
cellRefinements);
22152233
// --- Adapted cells ---
22162234
Opm::Lgr::populateLeafGridCells(currentLeafData(),
22172235
adapted_cells,
@@ -2230,7 +2248,9 @@ bool CpGrid::refineAndUpdateGrid(bool throwOnFailure,
22302248
markedElemAndEquivRefinedCorn_to_corner,
22312249
cornerInMarkedElemWithEquivRefinedCorner,
22322250
cells_per_dim_vec,
2233-
preAdaptMaxLevel);
2251+
preAdaptMaxLevel,
2252+
cellRefinements,
2253+
withoutFaults);
22342254

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

0 commit comments

Comments
 (0)