From a13afaaa943cd621bd13c5291aec76a79fc0f72a Mon Sep 17 00:00:00 2001 From: Antonella Ritorto Date: Mon, 18 Aug 2025 10:34:14 +0200 Subject: [PATCH 1/5] Add test case, read from deck autoref --- tests/cpgrid/lgr/autoRefine_test.cpp | 73 ++++++++++++++++++++++++++++ 1 file changed, 73 insertions(+) diff --git a/tests/cpgrid/lgr/autoRefine_test.cpp b/tests/cpgrid/lgr/autoRefine_test.cpp index a99e7ef87..3d6ca14f9 100644 --- a/tests/cpgrid/lgr/autoRefine_test.cpp +++ b/tests/cpgrid/lgr/autoRefine_test.cpp @@ -21,6 +21,14 @@ #define BOOST_TEST_MODULE AutoRefineTests #include +#include +#include +#include +#include +#include +#include +#include + #include #include @@ -89,3 +97,68 @@ BOOST_AUTO_TEST_CASE(autoRefine) /* lgr_name_vec = */ lgrNames, /* gridHasBeenGlobalRefined = */ true); } + +BOOST_AUTO_TEST_CASE(readAutoref) { + + const std::string deck_string = R"( +RUNSPEC +AUTOREF +3 3 1 0. / +DIMENS + 10 10 3 / +GRID +DX +300*1 / +DY +300*1 / +DZ +300*1 / +TOPS +100*1 / +PORO +300*0.15 / +)"; + + Opm::Parser parser; + Opm::Deck deck = parser.parseString(deck_string); + + const auto& autoref_keyword = deck["AUTOREF"][0]; + + Opm::AutoRefManager autoRefManager{}; + + Opm::readKeywordAutoRef(autoref_keyword.getRecord(0), autoRefManager); + const auto autoRef = autoRefManager.getAutoRef(); + + BOOST_CHECK_EQUAL( autoRef.NX(), 3); + BOOST_CHECK_EQUAL( autoRef.NY(), 3); + BOOST_CHECK_EQUAL( autoRef.NZ(), 1); + BOOST_CHECK_EQUAL( autoRef.OPTION_TRANS_MULT(), 0.); + + Opm::EclipseState ecl_state(deck); + Opm::EclipseGrid ecl_grid = ecl_state.getInputGrid(); + + Dune::CpGrid grid; + grid.processEclipseFormat(&ecl_grid, &ecl_state, false, false, false); + + if (grid.comm().size()>1) { // distribute level zero grid, in parallel + grid.loadBalance(); + } + + // nxnynz represents the refinement factors in x-,y-,and z-direction. + grid.autoRefine(/* nxnynz = */ { autoRef.NX(), autoRef.NY(), autoRef.NZ()}); + + // Extract the refined level grids name, excluding level zero grid name ("GLOBAL"). + // Note: in this case there is only one refined level grid, storing the global + // refinement. + std::vector lgrNames(grid.maxLevel()); + for (const auto& [name, level] : grid.getLgrNameToLevel()) { + if (level==0) { // skip level zero grid name for the checks + continue; + } + lgrNames[level-1] = name; // Shift the index since level zero has been removed. + } + Opm::checkGridWithLgrs(grid, + /* cells_per_dim_vec = */ {{autoRef.NX(), autoRef.NY(), autoRef.NZ()}}, + /* lgr_name_vec = */ lgrNames, + /* gridHasBeenGlobalRefined = */ true); +} From 179398c1ce2e39b4e3ed0e8628229c83e3981483 Mon Sep 17 00:00:00 2001 From: Antonella Ritorto Date: Mon, 18 Aug 2025 10:44:30 +0200 Subject: [PATCH 2/5] Reduce duplication across cases --- tests/cpgrid/lgr/autoRefine_test.cpp | 51 +++++++++++++--------------- 1 file changed, 23 insertions(+), 28 deletions(-) diff --git a/tests/cpgrid/lgr/autoRefine_test.cpp b/tests/cpgrid/lgr/autoRefine_test.cpp index 3d6ca14f9..18337a3f2 100644 --- a/tests/cpgrid/lgr/autoRefine_test.cpp +++ b/tests/cpgrid/lgr/autoRefine_test.cpp @@ -32,6 +32,7 @@ #include #include +#include #include #include @@ -48,6 +49,26 @@ struct Fixture BOOST_GLOBAL_FIXTURE(Fixture); +void checkGridAfterAutoRefinement(const Dune::CpGrid& grid, + const std::array& nxnynz) +{ + // Extract the refined level grids name, excluding level zero grid name ("GLOBAL"). + // Note: in this case there is only one refined level grid, storing the global + // refinement. + std::vector lgrNames(grid.maxLevel()); + for (const auto& [name, level] : grid.getLgrNameToLevel()) { + if (level==0) { // skip level zero grid name for the checks + continue; + } + lgrNames[level-1] = name; // Shift the index since level zero has been removed. + } + Opm::checkGridWithLgrs(grid, + /* cells_per_dim_vec = */ {nxnynz}, + /* lgr_name_vec = */ lgrNames, + /* gridHasBeenGlobalRefined = */ true); +} + + BOOST_AUTO_TEST_CASE(evenRefinementFactorThrows) { Dune::CpGrid grid; @@ -82,20 +103,7 @@ BOOST_AUTO_TEST_CASE(autoRefine) // nxnynz represents the refinement factors in x-,y-,and z-direction. grid.autoRefine(/* nxnynz = */ {3,5,7}); - // Extract the refined level grids name, excluding level zero grid name ("GLOBAL"). - // Note: in this case there is only one refined level grid, storing the global - // refinement. - std::vector lgrNames(grid.maxLevel()); - for (const auto& [name, level] : grid.getLgrNameToLevel()) { - if (level==0) { // skip level zero grid name for the checks - continue; - } - lgrNames[level-1] = name; // Shift the index since level zero has been removed. - } - Opm::checkGridWithLgrs(grid, - /* cells_per_dim_vec = */ {{3,5,7}}, - /* lgr_name_vec = */ lgrNames, - /* gridHasBeenGlobalRefined = */ true); + checkGridAfterAutoRefinement(grid, {3,5,7}); } BOOST_AUTO_TEST_CASE(readAutoref) { @@ -147,18 +155,5 @@ PORO // nxnynz represents the refinement factors in x-,y-,and z-direction. grid.autoRefine(/* nxnynz = */ { autoRef.NX(), autoRef.NY(), autoRef.NZ()}); - // Extract the refined level grids name, excluding level zero grid name ("GLOBAL"). - // Note: in this case there is only one refined level grid, storing the global - // refinement. - std::vector lgrNames(grid.maxLevel()); - for (const auto& [name, level] : grid.getLgrNameToLevel()) { - if (level==0) { // skip level zero grid name for the checks - continue; - } - lgrNames[level-1] = name; // Shift the index since level zero has been removed. - } - Opm::checkGridWithLgrs(grid, - /* cells_per_dim_vec = */ {{autoRef.NX(), autoRef.NY(), autoRef.NZ()}}, - /* lgr_name_vec = */ lgrNames, - /* gridHasBeenGlobalRefined = */ true); + checkGridAfterAutoRefinement(grid, {autoRef.NX(), autoRef.NY(), autoRef.NZ()}); } From 15221d4170a950efc26e90cf92e9cc6b1a75fc1d Mon Sep 17 00:00:00 2001 From: Antonella Ritorto Date: Mon, 18 Aug 2025 14:56:29 +0200 Subject: [PATCH 3/5] Refactor globalRefine to take into account previous AutoRefinement, add a test case in serial --- opm/grid/cpgrid/CpGrid.cpp | 25 +++--- tests/cpgrid/lgr/autoRefine_test.cpp | 121 ++++++++++++++++++++++++++- 2 files changed, 130 insertions(+), 16 deletions(-) diff --git a/opm/grid/cpgrid/CpGrid.cpp b/opm/grid/cpgrid/CpGrid.cpp index 70b0743f3..9aae5d300 100644 --- a/opm/grid/cpgrid/CpGrid.cpp +++ b/opm/grid/cpgrid/CpGrid.cpp @@ -1027,18 +1027,19 @@ void CpGrid::globalRefine (int refCount) if (refCount < 0) { OPM_THROW(std::logic_error, "Invalid argument. Provide a nonnegative integer for global refinement."); } - // Throw if the grid has been already partially refined, i.e., there exist coarse cells with more than 6 faces. - // This is the case when a coarse cell has not been marked for refinement, but at least one of its neighboring cells - // got refined. Therefore, the coarse face that they share got replaced by refined-faces. In this case, we do not - // support yet global refinement. - if(this->maxLevel()) { - bool isOnlyGlobalRefined = true; - for (int level = 0; level < this->maxLevel(); ++level) { - // When the grid has been refined only via global refinement, i.e., each cell has been refined into 2x2x2 children cells, - // then the quotient between the total amount of two consecutive refined level grids is equal to 8 = 2x2x2. - isOnlyGlobalRefined = isOnlyGlobalRefined && ( (currentData()[level+1]->size(0)) / (currentData()[level]->size(0)) == 8 ); - } - if (!isOnlyGlobalRefined) { + + // Throw if partial refinement is detected (there exists at least one coarse cell with >6 faces). + if(this->maxLevel()) { // In particular, maxLevel()>=1 + // Detect whether the grid has been globally refined before (via globalRefine(...) + // or autoRefine(...)) by comparing the logicalCartesianSize() of the level-0 + // grid and the leaf grid. + // + // For strict local refinement, these sizes are identical. Global refinement + // results in a difference in at least one direction (x, y, or z). + bool sameNX = currentData().back()->logicalCartesianSize()[0] == currentData().front()->logicalCartesianSize()[0]; + bool sameNY = currentData().back()->logicalCartesianSize()[1] == currentData().front()->logicalCartesianSize()[1]; + bool sameNZ = currentData().back()->logicalCartesianSize()[2] == currentData().front()->logicalCartesianSize()[2]; + if (sameNX && sameNY && sameNZ) { OPM_THROW(std::logic_error, "Global refinement of a mixed grid with coarse and refined cells is not supported yet."); } } diff --git a/tests/cpgrid/lgr/autoRefine_test.cpp b/tests/cpgrid/lgr/autoRefine_test.cpp index 18337a3f2..aa6a8391a 100644 --- a/tests/cpgrid/lgr/autoRefine_test.cpp +++ b/tests/cpgrid/lgr/autoRefine_test.cpp @@ -69,7 +69,7 @@ void checkGridAfterAutoRefinement(const Dune::CpGrid& grid, } -BOOST_AUTO_TEST_CASE(evenRefinementFactorThrows) +BOOST_AUTO_TEST_CASE(evenRefinementFactorThrows, *boost::unit_test::disabled()) { Dune::CpGrid grid; grid.createCartesian(/* grid_dim = */ {4,3,3}, /* cell_sizes = */ {1.0, 1.0, 1.0}); @@ -80,7 +80,7 @@ BOOST_AUTO_TEST_CASE(evenRefinementFactorThrows) BOOST_CHECK_THROW(grid.autoRefine(/* nxnynz = */ {3,5,4}), std::invalid_argument); } -BOOST_AUTO_TEST_CASE(nonPositiveRefinementFactorThrows) +BOOST_AUTO_TEST_CASE(nonPositiveRefinementFactorThrows, *boost::unit_test::disabled()) { Dune::CpGrid grid; grid.createCartesian(/* grid_dim = */ {4,3,3}, /* cell_sizes = */ {1.0, 1.0, 1.0}); @@ -91,7 +91,7 @@ BOOST_AUTO_TEST_CASE(nonPositiveRefinementFactorThrows) BOOST_CHECK_THROW(grid.autoRefine(/* nxnynz = */ {3,5,-3}), std::invalid_argument); } -BOOST_AUTO_TEST_CASE(autoRefine) +BOOST_AUTO_TEST_CASE(autoRefine, *boost::unit_test::disabled()) { Dune::CpGrid grid; grid.createCartesian(/* grid_dim = */ {4,3,3}, /* cell_sizes = */ {1.0, 1.0, 1.0}); @@ -106,7 +106,8 @@ BOOST_AUTO_TEST_CASE(autoRefine) checkGridAfterAutoRefinement(grid, {3,5,7}); } -BOOST_AUTO_TEST_CASE(readAutoref) { +BOOST_AUTO_TEST_CASE(readAutoref, *boost::unit_test::disabled()) +{ const std::string deck_string = R"( RUNSPEC @@ -157,3 +158,115 @@ PORO checkGridAfterAutoRefinement(grid, {autoRef.NX(), autoRef.NY(), autoRef.NZ()}); } + +BOOST_AUTO_TEST_CASE(firstAutoRefineSecondGlobalRefine_serial) { + + const std::string deck_string = R"( +RUNSPEC +AUTOREF +3 3 1 0. / +DIMENS +4 3 3 / +GRID +DX +36*1 / +DY +36*1 / +DZ +36*1 / +TOPS +36*1 / +PORO +36*0.15 / +)"; + + Opm::Parser parser; + Opm::Deck deck = parser.parseString(deck_string); + + const auto& autoref_keyword = deck["AUTOREF"][0]; + + Opm::AutoRefManager autoRefManager{}; + + Opm::readKeywordAutoRef(autoref_keyword.getRecord(0), autoRefManager); + const auto autoRef = autoRefManager.getAutoRef(); + + BOOST_CHECK_EQUAL( autoRef.NX(), 3); + BOOST_CHECK_EQUAL( autoRef.NY(), 3); + BOOST_CHECK_EQUAL( autoRef.NZ(), 1); + BOOST_CHECK_EQUAL( autoRef.OPTION_TRANS_MULT(), 0.); + + Opm::EclipseState ecl_state(deck); + Opm::EclipseGrid ecl_grid = ecl_state.getInputGrid(); + + Dune::CpGrid grid; + grid.processEclipseFormat(&ecl_grid, &ecl_state, false, false, false); + + if (grid.comm().size() == 1 ) { // serial + + // nxnynz represents the refinement factors in x-,y-,and z-direction. + grid.autoRefine(/* nxnynz = */ { autoRef.NX(), autoRef.NY(), autoRef.NZ()}); + + checkGridAfterAutoRefinement(grid, {autoRef.NX(), autoRef.NY(), autoRef.NZ()}); + + grid.globalRefine(2); + } +} + + +BOOST_AUTO_TEST_CASE(firstAutoRefineSecondAdapt_serial) { + + const std::string deck_string = R"( +RUNSPEC +AUTOREF +3 3 1 0. / +DIMENS +4 3 3 / +GRID +DX +36*1 / +DY +36*1 / +DZ +36*1 / +TOPS +36*1 / +PORO +36*0.15 / +)"; + + Opm::Parser parser; + Opm::Deck deck = parser.parseString(deck_string); + + const auto& autoref_keyword = deck["AUTOREF"][0]; + + Opm::AutoRefManager autoRefManager{}; + + Opm::readKeywordAutoRef(autoref_keyword.getRecord(0), autoRefManager); + const auto autoRef = autoRefManager.getAutoRef(); + + BOOST_CHECK_EQUAL( autoRef.NX(), 3); + BOOST_CHECK_EQUAL( autoRef.NY(), 3); + BOOST_CHECK_EQUAL( autoRef.NZ(), 1); + BOOST_CHECK_EQUAL( autoRef.OPTION_TRANS_MULT(), 0.); + + Opm::EclipseState ecl_state(deck); + Opm::EclipseGrid ecl_grid = ecl_state.getInputGrid(); + + Dune::CpGrid grid; + grid.processEclipseFormat(&ecl_grid, &ecl_state, false, false, false); + + if (grid.comm().size() == 1 ) { // serial + + // nxnynz represents the refinement factors in x-,y-,and z-direction. + grid.autoRefine(/* nxnynz = */ { autoRef.NX(), autoRef.NY(), autoRef.NZ()}); + + checkGridAfterAutoRefinement(grid, {autoRef.NX(), autoRef.NY(), autoRef.NZ()}); + + for (const auto& element : Dune::elements(grid.leafGridView())) { + grid.mark(1, element); + } + grid.preAdapt(); + grid.adapt(); + grid.postAdapt(); + } +} From 9a717132b87077e5d94c6ea733aa5dfabaa1b62d Mon Sep 17 00:00:00 2001 From: Antonella Ritorto Date: Thu, 21 Aug 2025 13:39:16 +0200 Subject: [PATCH 4/5] Re-enable tests that were disabled during debugging --- tests/cpgrid/lgr/autoRefine_test.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/cpgrid/lgr/autoRefine_test.cpp b/tests/cpgrid/lgr/autoRefine_test.cpp index aa6a8391a..c591b69ea 100644 --- a/tests/cpgrid/lgr/autoRefine_test.cpp +++ b/tests/cpgrid/lgr/autoRefine_test.cpp @@ -69,7 +69,7 @@ void checkGridAfterAutoRefinement(const Dune::CpGrid& grid, } -BOOST_AUTO_TEST_CASE(evenRefinementFactorThrows, *boost::unit_test::disabled()) +BOOST_AUTO_TEST_CASE(evenRefinementFactorThrows) { Dune::CpGrid grid; grid.createCartesian(/* grid_dim = */ {4,3,3}, /* cell_sizes = */ {1.0, 1.0, 1.0}); @@ -80,7 +80,7 @@ BOOST_AUTO_TEST_CASE(evenRefinementFactorThrows, *boost::unit_test::disabled()) BOOST_CHECK_THROW(grid.autoRefine(/* nxnynz = */ {3,5,4}), std::invalid_argument); } -BOOST_AUTO_TEST_CASE(nonPositiveRefinementFactorThrows, *boost::unit_test::disabled()) +BOOST_AUTO_TEST_CASE(nonPositiveRefinementFactorThrows) { Dune::CpGrid grid; grid.createCartesian(/* grid_dim = */ {4,3,3}, /* cell_sizes = */ {1.0, 1.0, 1.0}); @@ -91,7 +91,7 @@ BOOST_AUTO_TEST_CASE(nonPositiveRefinementFactorThrows, *boost::unit_test::disab BOOST_CHECK_THROW(grid.autoRefine(/* nxnynz = */ {3,5,-3}), std::invalid_argument); } -BOOST_AUTO_TEST_CASE(autoRefine, *boost::unit_test::disabled()) +BOOST_AUTO_TEST_CASE(autoRefine) { Dune::CpGrid grid; grid.createCartesian(/* grid_dim = */ {4,3,3}, /* cell_sizes = */ {1.0, 1.0, 1.0}); @@ -106,7 +106,7 @@ BOOST_AUTO_TEST_CASE(autoRefine, *boost::unit_test::disabled()) checkGridAfterAutoRefinement(grid, {3,5,7}); } -BOOST_AUTO_TEST_CASE(readAutoref, *boost::unit_test::disabled()) +BOOST_AUTO_TEST_CASE(readAutoref) { const std::string deck_string = R"( From ab3e86095b8d3d55f57553a8ff2bf4fe9ee97940 Mon Sep 17 00:00:00 2001 From: Antonella Ritorto Date: Thu, 21 Aug 2025 13:57:52 +0200 Subject: [PATCH 5/5] Reduce dupication via checkReadFromDeckValues --- tests/cpgrid/lgr/autoRefine_test.cpp | 71 +++++++++++++--------------- 1 file changed, 32 insertions(+), 39 deletions(-) diff --git a/tests/cpgrid/lgr/autoRefine_test.cpp b/tests/cpgrid/lgr/autoRefine_test.cpp index c591b69ea..b29e2c675 100644 --- a/tests/cpgrid/lgr/autoRefine_test.cpp +++ b/tests/cpgrid/lgr/autoRefine_test.cpp @@ -49,6 +49,23 @@ struct Fixture BOOST_GLOBAL_FIXTURE(Fixture); +void checkReadFromDeckValues(const Opm::Deck& deck, + const std::array& expected_nxnynz, + double expected_option) +{ + const auto& autoref_keyword = deck["AUTOREF"][0]; + + Opm::AutoRefManager autoRefManager{}; + + Opm::readKeywordAutoRef(autoref_keyword.getRecord(0), autoRefManager); + const auto autoRef = autoRefManager.getAutoRef(); + + BOOST_CHECK_EQUAL( autoRef.NX(), expected_nxnynz[0]); + BOOST_CHECK_EQUAL( autoRef.NY(), expected_nxnynz[1]); + BOOST_CHECK_EQUAL( autoRef.NZ(), expected_nxnynz[2]); + BOOST_CHECK_EQUAL( autoRef.OPTION_TRANS_MULT(), expected_option); +} + void checkGridAfterAutoRefinement(const Dune::CpGrid& grid, const std::array& nxnynz) { @@ -131,17 +148,9 @@ PORO Opm::Parser parser; Opm::Deck deck = parser.parseString(deck_string); - const auto& autoref_keyword = deck["AUTOREF"][0]; - - Opm::AutoRefManager autoRefManager{}; - - Opm::readKeywordAutoRef(autoref_keyword.getRecord(0), autoRefManager); - const auto autoRef = autoRefManager.getAutoRef(); - - BOOST_CHECK_EQUAL( autoRef.NX(), 3); - BOOST_CHECK_EQUAL( autoRef.NY(), 3); - BOOST_CHECK_EQUAL( autoRef.NZ(), 1); - BOOST_CHECK_EQUAL( autoRef.OPTION_TRANS_MULT(), 0.); + checkReadFromDeckValues(deck, + {3,3,1}, // expected_nxnynz + 0.); // expected_option_trans_mult Opm::EclipseState ecl_state(deck); Opm::EclipseGrid ecl_grid = ecl_state.getInputGrid(); @@ -154,9 +163,9 @@ PORO } // nxnynz represents the refinement factors in x-,y-,and z-direction. - grid.autoRefine(/* nxnynz = */ { autoRef.NX(), autoRef.NY(), autoRef.NZ()}); + grid.autoRefine(/* nxnynz = */ {3,3,1}); - checkGridAfterAutoRefinement(grid, {autoRef.NX(), autoRef.NY(), autoRef.NZ()}); + checkGridAfterAutoRefinement(grid, /* nxnynz = */ {3,3,1}); } BOOST_AUTO_TEST_CASE(firstAutoRefineSecondGlobalRefine_serial) { @@ -183,17 +192,9 @@ PORO Opm::Parser parser; Opm::Deck deck = parser.parseString(deck_string); - const auto& autoref_keyword = deck["AUTOREF"][0]; - - Opm::AutoRefManager autoRefManager{}; - - Opm::readKeywordAutoRef(autoref_keyword.getRecord(0), autoRefManager); - const auto autoRef = autoRefManager.getAutoRef(); - - BOOST_CHECK_EQUAL( autoRef.NX(), 3); - BOOST_CHECK_EQUAL( autoRef.NY(), 3); - BOOST_CHECK_EQUAL( autoRef.NZ(), 1); - BOOST_CHECK_EQUAL( autoRef.OPTION_TRANS_MULT(), 0.); + checkReadFromDeckValues(deck, + {3,3,1}, // expected_nxnynz + 0.); // expected_option_trans_mult Opm::EclipseState ecl_state(deck); Opm::EclipseGrid ecl_grid = ecl_state.getInputGrid(); @@ -204,9 +205,9 @@ PORO if (grid.comm().size() == 1 ) { // serial // nxnynz represents the refinement factors in x-,y-,and z-direction. - grid.autoRefine(/* nxnynz = */ { autoRef.NX(), autoRef.NY(), autoRef.NZ()}); + grid.autoRefine(/* nxnynz = */ {3,3,1}); - checkGridAfterAutoRefinement(grid, {autoRef.NX(), autoRef.NY(), autoRef.NZ()}); + checkGridAfterAutoRefinement(grid, /* nxnynz = */ {3,3,1}); grid.globalRefine(2); } @@ -237,17 +238,9 @@ PORO Opm::Parser parser; Opm::Deck deck = parser.parseString(deck_string); - const auto& autoref_keyword = deck["AUTOREF"][0]; - - Opm::AutoRefManager autoRefManager{}; - - Opm::readKeywordAutoRef(autoref_keyword.getRecord(0), autoRefManager); - const auto autoRef = autoRefManager.getAutoRef(); - - BOOST_CHECK_EQUAL( autoRef.NX(), 3); - BOOST_CHECK_EQUAL( autoRef.NY(), 3); - BOOST_CHECK_EQUAL( autoRef.NZ(), 1); - BOOST_CHECK_EQUAL( autoRef.OPTION_TRANS_MULT(), 0.); + checkReadFromDeckValues(deck, + {3,3,1}, // expected_nxnynz + 0.); // expected_option_trans_mult Opm::EclipseState ecl_state(deck); Opm::EclipseGrid ecl_grid = ecl_state.getInputGrid(); @@ -258,9 +251,9 @@ PORO if (grid.comm().size() == 1 ) { // serial // nxnynz represents the refinement factors in x-,y-,and z-direction. - grid.autoRefine(/* nxnynz = */ { autoRef.NX(), autoRef.NY(), autoRef.NZ()}); + grid.autoRefine(/* nxnynz = */ {3,3,1}); - checkGridAfterAutoRefinement(grid, {autoRef.NX(), autoRef.NY(), autoRef.NZ()}); + checkGridAfterAutoRefinement(grid, /* nxnynz = */ {3,3,1}); for (const auto& element : Dune::elements(grid.leafGridView())) { grid.mark(1, element);