From 746eeec7fef754d14131872c257eedb23cc7d675 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20T=C3=B3th?= Date: Fri, 29 Nov 2024 10:20:30 +0100 Subject: [PATCH 1/6] Use transmissibilities as edge weights --- opm/grid/GraphOfGrid.cpp | 4 ++-- opm/grid/GraphOfGrid.hpp | 7 ++++--- opm/grid/GraphOfGridWrappers.cpp | 2 +- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/opm/grid/GraphOfGrid.cpp b/opm/grid/GraphOfGrid.cpp index 4daea16a9..0534868d9 100644 --- a/opm/grid/GraphOfGrid.cpp +++ b/opm/grid/GraphOfGrid.cpp @@ -29,7 +29,7 @@ namespace Opm{ template -void GraphOfGrid::createGraph () +void GraphOfGrid::createGraph (const double* transmissibilities) { const auto& rank = grid.comm().rank(); // load vertices (grid cells) into graph @@ -57,7 +57,7 @@ void GraphOfGrid::createGraph () { continue; } - WeightType weight = 1; // default edge weight + WeightType weight = transmissibilities ? transmissibilities[face] : 1; // default edge weight is 1 vertex.edges.try_emplace(otherCell,weight); } diff --git a/opm/grid/GraphOfGrid.hpp b/opm/grid/GraphOfGrid.hpp index 0a37116e5..447dfcaf0 100644 --- a/opm/grid/GraphOfGrid.hpp +++ b/opm/grid/GraphOfGrid.hpp @@ -52,10 +52,10 @@ class GraphOfGrid{ }; public: - explicit GraphOfGrid (const Grid& grid_) + explicit GraphOfGrid (const Grid& grid_, const double* transmissibilities=nullptr) : grid(grid_) { - createGraph(); + createGraph(transmissibilities); } const Grid& getGrid() const @@ -164,7 +164,8 @@ class GraphOfGrid{ private: /// \brief Create a graph representation of the grid - void createGraph (); // edge weight=1 + /// If transmissibilities are not supplied, edge weight=1 + void createGraph (const double* transmissibilities=nullptr); /// \brief Identify the well containing the cell with this global ID /// diff --git a/opm/grid/GraphOfGridWrappers.cpp b/opm/grid/GraphOfGridWrappers.cpp index bdd71b2fe..3b70b3ebc 100644 --- a/opm/grid/GraphOfGridWrappers.cpp +++ b/opm/grid/GraphOfGridWrappers.cpp @@ -591,7 +591,7 @@ zoltanPartitioningWithGraphOfGrid(const Dune::CpGrid& grid, // prepare graph and contract well cells // non-root processes have empty grid and no wells - GraphOfGrid gog(grid); + GraphOfGrid gog(grid,transmissibilities); assert(gog.size()==0 || !partitionIsEmpty); auto wellConnections=partitionIsEmpty ? Dune::cpgrid::WellConnections() : Dune::cpgrid::WellConnections(*wells,possibleFutureConnections,grid); From 22d71322849f5f2db2767593cd1a8a4c5e705960 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20T=C3=B3th?= Date: Fri, 29 Nov 2024 17:28:12 +0100 Subject: [PATCH 2/6] Feature: keep well away from the subdomain boundary --- opm/grid/GraphOfGrid.cpp | 25 +++++++++ opm/grid/GraphOfGrid.hpp | 14 +++++ tests/test_graphofgrid.cpp | 106 +++++++++++++++++++++++++++++++++++++ 3 files changed, 145 insertions(+) diff --git a/opm/grid/GraphOfGrid.cpp b/opm/grid/GraphOfGrid.cpp index 0534868d9..66836922d 100644 --- a/opm/grid/GraphOfGrid.cpp +++ b/opm/grid/GraphOfGrid.cpp @@ -185,5 +185,30 @@ void GraphOfGrid::addWell (const std::set& well, bool checkIntersecti } } +template +void GraphOfGrid::addWellBuffer () +{ + // mark all cells that will be added to wells (addding them one + // by one would require recursive checks for neighboring wells) + std::vector> buffer(wells.size()); + int i=0; + for (auto& w : wells) + { + buffer[i].insert(*w.begin()); // intersects with its well + for (const auto& v : edgeList(*w.begin())) + { + buffer[i].insert(v.first); + } + ++i; + } + + // intersecting wells and buffers will be merged + for (const auto& b : buffer) + { + addWell(b); + } +} + + template class GraphOfGrid; } // namespace Opm diff --git a/opm/grid/GraphOfGrid.hpp b/opm/grid/GraphOfGrid.hpp index 447dfcaf0..3701610dd 100644 --- a/opm/grid/GraphOfGrid.hpp +++ b/opm/grid/GraphOfGrid.hpp @@ -162,6 +162,20 @@ class GraphOfGrid{ return wells; } + /// \brief Contract a layer of verices around each wells into it + /// + /// Representing a well by one node guarantees that the well won't + /// be split over several processes. Giving the well an extra layer + /// of cells distances that well from the subdomain boundary. + void addWellBuffer (); + void addWellBuffer (int layers) + { + for (int i=0; i dims{5,1,1}; + std::array size{1.,1.,1.}; + grid.createCartesian(dims,size); + Opm::GraphOfGrid gog(grid); + if (grid.size(0)==0) + return; + + std::set well{0,1}; + gog.addWell(well); + + // buffers of negative or zero size are ignored + gog.addWellBuffer(0); + BOOST_REQUIRE(gog.size()==4); + gog.addWellBuffer(-4); + BOOST_REQUIRE(gog.size()==4); + + gog.addWellBuffer(); // no arg is 1 layer + BOOST_REQUIRE(gog.size()==3); + gog.addWellBuffer(2); + BOOST_REQUIRE(gog.size()==1); +} + +BOOST_AUTO_TEST_CASE(NeighboringWellsWithBuffers) +{ + Dune::CpGrid grid; + std::array dims{6,1,1}; + std::array size{1.,1.,1.}; + grid.createCartesian(dims,size); + Opm::GraphOfGrid gog(grid); + if (grid.size(0)==0) + return; + + std::set well0{0,1}; + std::set well1{2,3}; + gog.addWell(well0); + gog.addWell(well1); + BOOST_REQUIRE(gog.size()==4); + gog.addWellBuffer(); + BOOST_REQUIRE(gog.size()==2); + BOOST_REQUIRE(gog.getWells().size()==1); + BOOST_REQUIRE(*gog.getWells().begin()==(std::set{0,1,2,3,4})); +} + +BOOST_AUTO_TEST_CASE(WellsWithIntersectingBuffers) +{ + Dune::CpGrid grid; + std::array dims{6,1,1}; + std::array size{1.,1.,1.}; + grid.createCartesian(dims,size); + Opm::GraphOfGrid gog(grid); + if (grid.size(0)==0) + return; + + std::set well0{0,1}; + std::set well1{3,4}; + gog.addWell(well0); + gog.addWell(well1); + BOOST_REQUIRE(gog.size()==4); + gog.addWellBuffer(); + BOOST_REQUIRE(gog.size()==1); + BOOST_REQUIRE(gog.getWells().size()==1); + BOOST_REQUIRE(*gog.getWells().begin()==(std::set{0,1,2,3,4,5})); +} + +BOOST_AUTO_TEST_CASE(WellsWithIntersectingBuffers2) +{ + Dune::CpGrid grid; + std::array dims{6,4,1}; + std::array size{1.,1.,1.}; + grid.createCartesian(dims,size); + Opm::GraphOfGrid gog(grid); + if (grid.size(0)==0) + return; + + std::set well0{0,1}; + std::set well1{5,11}; + std::set well2{3,8,9,14}; + std::set well3{18,22}; + gog.addWell(well0); + gog.addWell(well1); + gog.addWell(well2); + gog.addWell(well3); + BOOST_REQUIRE(gog.size()==18); + gog.addWellBuffer(); + BOOST_REQUIRE(gog.size()==2); + const auto& wells = gog.getWells(); + BOOST_REQUIRE(wells.size()==2); + for (const auto& w : wells) + { + if (*w.begin()==0) + { + BOOST_REQUIRE(w==(std::set{0,1,2,3,4,5,6,7,8,9,10,11,13,14,15,17,20})); + } + else + { + BOOST_REQUIRE(w==(std::set{12,16,18,19,21,22,23})); + } + } + // adding one layer contracts everything into one vertex, another layer does nothing + gog.addWellBuffer(2); + BOOST_REQUIRE(gog.size()==1); +} + namespace { // create Wells, we only use well name and cell locations auto createConnection (int i, int j, int k) From 23bc01f4631b6348c4dfa5a893a6a0e8953c56e8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20T=C3=B3th?= Date: Mon, 2 Dec 2024 10:37:11 +0100 Subject: [PATCH 3/6] Add empty cornercases to the test. --- tests/test_graphofgrid.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tests/test_graphofgrid.cpp b/tests/test_graphofgrid.cpp index 3c3d0572d..6a99433f5 100644 --- a/tests/test_graphofgrid.cpp +++ b/tests/test_graphofgrid.cpp @@ -351,6 +351,8 @@ BOOST_AUTO_TEST_CASE(WellWithBuffers) if (grid.size(0)==0) return; + gog.addWellBuffer(); // adding buffer to zero wells does nothing + BOOST_REQUIRE(gog.size()==5); std::set well{0,1}; gog.addWell(well); @@ -587,6 +589,11 @@ BOOST_AUTO_TEST_CASE(gIDtoRankCorrection) if (grid.size(0)==0) return; + // well needs at least 2 cells for vertex contraction + gog.addWell(std::set{}); + gog.addWell(std::set{1}); + BOOST_REQUIRE(gog.getWells().size()==0); + gog.addWell(std::set{0,1,2}); gog.addWell(std::set{5,8,11}); const auto& wells = gog.getWells(); From 31a5deedd575cecd6d67852eb4180830ae4f453a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20T=C3=B3th?= Date: Mon, 2 Dec 2024 10:46:23 +0100 Subject: [PATCH 4/6] Formatting: add space after comma --- opm/grid/GraphOfGrid.cpp | 16 ++++---- opm/grid/GraphOfGridWrappers.cpp | 64 ++++++++++++++++---------------- opm/grid/GraphOfGridWrappers.hpp | 6 +-- 3 files changed, 43 insertions(+), 43 deletions(-) diff --git a/opm/grid/GraphOfGrid.cpp b/opm/grid/GraphOfGrid.cpp index 66836922d..9113dc476 100644 --- a/opm/grid/GraphOfGrid.cpp +++ b/opm/grid/GraphOfGrid.cpp @@ -58,10 +58,10 @@ void GraphOfGrid::createGraph (const double* transmissibilities) continue; } WeightType weight = transmissibilities ? transmissibilities[face] : 1; // default edge weight is 1 - vertex.edges.try_emplace(otherCell,weight); + vertex.edges.try_emplace(otherCell, weight); } - graph.try_emplace(gID,vertex); + graph.try_emplace(gID, vertex); } } @@ -87,7 +87,7 @@ int GraphOfGrid::contractVertices (int gID1, int gID2) } if (gID2::contractVertices (int gID1, int gID2) v1e.insert(edge); // remap neighbor's edge graph[edge.first].edges.erase(gID2); - graph[edge.first].edges.emplace(gID1,edge.second); + graph[edge.first].edges.emplace(gID1, edge.second); } } else @@ -164,22 +164,22 @@ void GraphOfGrid::addWell (const std::set& well, bool checkIntersecti wID = *(w->begin()); } gID = *(w->begin()); - newWell.insert(w->begin(),w->end()); + newWell.insert(w->begin(), w->end()); wells.erase(w); break; // GraphOfGrid::wells are constructed to be disjoint, each gID has max 1 match } } - wID = contractVertices(wID,gID); + wID = contractVertices(wID, gID); assert(wID!=-1 && "Added well vertex was not found in the grid (or its wells)."); } - newWell.insert(well.begin(),well.end()); + newWell.insert(well.begin(), well.end()); wells.push_front(newWell); } else { for (int gID : well) { - wID = contractVertices(wID,gID); + wID = contractVertices(wID, gID); } wells.emplace_front(well); } diff --git a/opm/grid/GraphOfGridWrappers.cpp b/opm/grid/GraphOfGridWrappers.cpp index 3b70b3ebc..696faf22c 100644 --- a/opm/grid/GraphOfGridWrappers.cpp +++ b/opm/grid/GraphOfGridWrappers.cpp @@ -174,7 +174,7 @@ void addFutureConnectionWells(GraphOfGrid& gog, assert(gID!=-1); // well should be an active cell wellsgID.insert(gID); } - gog.addWell(wellsgID,checkWellIntersections); + gog.addWell(wellsgID, checkWellIntersections); } } @@ -184,7 +184,7 @@ void addWellConnections(GraphOfGrid& gog, { for (const auto& w : wells) { - gog.addWell(w,checkWellIntersections); + gog.addWell(w, checkWellIntersections); } } @@ -225,7 +225,7 @@ extendRootExportList(const GraphOfGrid& gog, using ExportList = std::vector>; // make a list of wells for easy identification. Contains ID, begin, end using iter = std::set::const_iterator; - std::unordered_map> wellMap; + std::unordered_map> wellMap; for (const auto& well : gog.getWells()) { if (gIDtoRank.size()>0) @@ -233,12 +233,12 @@ extendRootExportList(const GraphOfGrid& gog, auto wellID = *well.begin(); if (gIDtoRank[wellID]!=root) { - wellMap[wellID] = std::make_tuple(well.begin(),well.end(),well.size()); + wellMap[wellID] = std::make_tuple(well.begin(), well.end(), well.size()); } } else { - wellMap[*well.begin()] = std::make_tuple(well.begin(),well.end(),well.size()); + wellMap[*well.begin()] = std::make_tuple(well.begin(), well.end(), well.size()); } } @@ -253,7 +253,7 @@ extendRootExportList(const GraphOfGrid& gog, int rankToExport = std::get<1>(cellProperties); if (rankToExport!=root) { - const auto& [begin,end,wSize] = pWell->second; + const auto& [begin, end, wSize] = pWell->second; std::vector wellToExport; wellToExport.reserve(wSize); wellToExport.push_back(*begin); @@ -279,12 +279,12 @@ extendRootExportList(const GraphOfGrid& gog, } // add new cells to the exportList and sort it. It is assumed that exportList starts sorted. - std::sort(addToList.begin(),addToList.end()); + std::sort(addToList.begin(), addToList.end()); auto origSize = exportList.size(); auto totsize = origSize+addToList.size(); exportList.reserve(totsize); - exportList.insert(exportList.end(),addToList.begin(),addToList.end()); - std::inplace_merge(exportList.begin(),exportList.begin()+origSize,exportList.end()); + exportList.insert(exportList.end(), addToList.begin(), addToList.end()); + std::inplace_merge(exportList.begin(), exportList.begin()+origSize, exportList.end()); return exportedWells; } @@ -343,7 +343,7 @@ std::vector> communicateExportedWells( int wellSize = receivedData[index++]; assert(index+wellSize<=totsize); const auto dataBegin = receivedData.begin()+index; - result[i] = std::vector(dataBegin,dataBegin+wellSize); + result[i] = std::vector(dataBegin, dataBegin+wellSize); index+=wellSize; } } @@ -355,7 +355,7 @@ void extendImportList(std::vector>& importList, { using ImportList = std::vector>; // make a list of wells for easy identification - std::unordered_map wellMap; + std::unordered_map wellMap; for (std::size_t i=0; i1) @@ -392,12 +392,12 @@ void extendImportList(std::vector>& importList, } // add new cells to the importList and sort it. It is assumed that importList starts sorted. - std::sort(addToList.begin(),addToList.end()); + std::sort(addToList.begin(), addToList.end()); auto origSize = importList.size(); auto totsize = origSize+addToList.size(); importList.reserve(totsize); - importList.insert(importList.end(),addToList.begin(),addToList.end()); - std::inplace_merge(importList.begin(),importList.begin()+origSize,importList.end()); + importList.insert(importList.end(), addToList.begin(), addToList.end()); + std::inplace_merge(importList.begin(), importList.begin()+origSize, importList.end()); } } // end namespace Impl @@ -410,13 +410,13 @@ void extendExportAndImportLists(const GraphOfGrid& gog, const std::vector& gIDtoRank) { // extend root's export list and get sets of well cells for other ranks - auto expListToComm = Impl::extendRootExportList(gog,exportList,root,gIDtoRank); + auto expListToComm = Impl::extendRootExportList(gog, exportList, root, gIDtoRank); // obtain wells on this rank from root - auto extraWells = Impl::communicateExportedWells(expListToComm,cc,root); + auto extraWells = Impl::communicateExportedWells(expListToComm, cc, root); if (cc.rank()!=root) { - std::sort(importList.begin(),importList.end()); - Impl::extendImportList(importList,extraWells); + std::sort(importList.begin(), importList.end()); + Impl::extendImportList(importList, extraWells); } } #endif // HAVE_MPI @@ -434,7 +434,7 @@ std::vector getWellRanks(const std::vector& gIDtoRank, } #if HAVE_MPI -std::vector> +std::vector> wellsOnThisRank(const std::vector& wells, const std::vector& wellRanks, const Dune::cpgrid::CpGridDataTraits::Communication& cc, @@ -451,7 +451,7 @@ wellsOnThisRank(const std::vector& wells, template std::tuple, - std::vector>, + std::vector>, std::vector >, std::vector > > makeImportAndExportLists(const GraphOfGrid& gog, @@ -488,7 +488,7 @@ makeImportAndExportLists(const GraphOfGrid& gog, for ( int i=0; i < numImport; ++i ) { - myImportList.emplace_back(importGlobalGids[i], root, static_cast(AttributeSet::owner),-1); + myImportList.emplace_back(importGlobalGids[i], root, static_cast(AttributeSet::owner), -1); } assert(rank==root || numExport==0); if (rank==root) @@ -498,9 +498,9 @@ makeImportAndExportLists(const GraphOfGrid& gog, gIDtoRank[exportGlobalGids[i]] = exportToPart[i]; myExportList.emplace_back(exportGlobalGids[i], exportToPart[i], static_cast(AttributeSet::owner)); } - std::sort(myExportList.begin(),myExportList.end()); + std::sort(myExportList.begin(), myExportList.end()); // partitioner sees only one cell per well, modify remaining - extendGIDtoRank(gog,gIDtoRank,rank); + extendGIDtoRank(gog, gIDtoRank, rank); // Add cells that stay here to the lists. Somehow I could not persuade Zoltan to do this. // This also adds all well cells that were missing in the importGlobalIDs. @@ -517,11 +517,11 @@ makeImportAndExportLists(const GraphOfGrid& gog, } - std::vector> parallel_wells; + std::vector> parallel_wells; if( wells ) { // complete root's export and other's import list by adding remaining well cells - extendExportAndImportLists(gog,cc,root,myExportList,myImportList,gIDtoRank); + extendExportAndImportLists(gog, cc, root, myExportList, myImportList, gIDtoRank); auto wellRanks = getWellRanks(gIDtoRank, wellConnections); parallel_wells = wellsOnThisRank(*wells, wellRanks, cc, root); @@ -540,7 +540,7 @@ void setDefaultZoltanParameters(Zoltan_Struct* zz) Zoltan_Set_Param(zz, "NUM_GID_ENTRIES", "1"); Zoltan_Set_Param(zz, "NUM_LID_ENTRIES", "0"); Zoltan_Set_Param(zz, "RETURN_LISTS", "ALL"); - Zoltan_Set_Param(zz, "EDGE_WEIGHT_DIM","1"); + Zoltan_Set_Param(zz, "EDGE_WEIGHT_DIM", "1"); Zoltan_Set_Param(zz, "OBJ_WEIGHT_DIM", "1"); Zoltan_Set_Param(zz, "PHG_EDGE_SIZE_THRESHOLD", ".35"); /* 0-remove all, 1-remove none */ Zoltan_Set_Param(zz, "DEBUG_LEVEL", "0"); @@ -553,7 +553,7 @@ void setDefaultZoltanParameters(Zoltan_Struct* zz) } // anon namespace -std::tuple, std::vector>, +std::tuple, std::vector>, std::vector >, std::vector >, Dune::cpgrid::WellConnections> @@ -565,7 +565,7 @@ zoltanPartitioningWithGraphOfGrid(const Dune::CpGrid& grid, [[maybe_unused]] Dune::EdgeWeightMethod edgeWeightsMethod, int root, const double zoltanImbalanceTol, - const std::map& params) + const std::map& params) { int rc = ZOLTAN_OK - 1; float ver = 0; @@ -591,14 +591,14 @@ zoltanPartitioningWithGraphOfGrid(const Dune::CpGrid& grid, // prepare graph and contract well cells // non-root processes have empty grid and no wells - GraphOfGrid gog(grid,transmissibilities); + GraphOfGrid gog(grid, transmissibilities); assert(gog.size()==0 || !partitionIsEmpty); auto wellConnections=partitionIsEmpty ? Dune::cpgrid::WellConnections() - : Dune::cpgrid::WellConnections(*wells,possibleFutureConnections,grid); - addWellConnections(gog,wellConnections); + : Dune::cpgrid::WellConnections(*wells, possibleFutureConnections, grid); + addWellConnections(gog, wellConnections); // call partitioner - setGraphOfGridZoltanGraphFunctions(zz,gog,partitionIsEmpty); + setGraphOfGridZoltanGraphFunctions(zz, gog, partitionIsEmpty); rc = Zoltan_LB_Partition(zz, /* input (all remaining fields are output) */ &changes, /* 1 if partitioning was changed, 0 otherwise */ &numGidEntries, /* Number of integers used for a global ID */ diff --git a/opm/grid/GraphOfGridWrappers.hpp b/opm/grid/GraphOfGridWrappers.hpp index 9d1a24b57..c7613d018 100644 --- a/opm/grid/GraphOfGridWrappers.hpp +++ b/opm/grid/GraphOfGridWrappers.hpp @@ -209,7 +209,7 @@ std::vector getWellRanks(const std::vector& gIDtoRank, /// /// This function only gets the information from wellRanks into proper /// format to call computeParallelWells. -std::vector> +std::vector> wellsOnThisRank(const std::vector& wells, const std::vector& wellRanks, const Dune::cpgrid::CpGridDataTraits::Communication& cc, @@ -235,7 +235,7 @@ wellsOnThisRank(const std::vector& wells, /// myImportList vector of cells to be moved to this rank template std::tuple, - std::vector>, + std::vector>, std::vector >, std::vector > > makeImportAndExportLists(const GraphOfGrid& gog, @@ -255,7 +255,7 @@ makeImportAndExportLists(const GraphOfGrid& gog, /// GraphOfGrid represents a well by one vertex, so wells can not be /// spread over several processes. /// transmissiblities are currently not supported, but are queued -std::tuple, std::vector>, +std::tuple, std::vector>, std::vector >, std::vector >, Dune::cpgrid::WellConnections> From 3d3d493407da2f19bfa284063c4366bd768b476d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20T=C3=B3th?= Date: Mon, 2 Dec 2024 11:01:51 +0100 Subject: [PATCH 5/6] Rename function adding neighboring cells to wells --- opm/grid/GraphOfGrid.cpp | 2 +- opm/grid/GraphOfGrid.hpp | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/opm/grid/GraphOfGrid.cpp b/opm/grid/GraphOfGrid.cpp index 9113dc476..b8d9c452b 100644 --- a/opm/grid/GraphOfGrid.cpp +++ b/opm/grid/GraphOfGrid.cpp @@ -186,7 +186,7 @@ void GraphOfGrid::addWell (const std::set& well, bool checkIntersecti } template -void GraphOfGrid::addWellBuffer () +void GraphOfGrid::addNeighboringCellsToWells () { // mark all cells that will be added to wells (addding them one // by one would require recursive checks for neighboring wells) diff --git a/opm/grid/GraphOfGrid.hpp b/opm/grid/GraphOfGrid.hpp index 3701610dd..b6ca3f082 100644 --- a/opm/grid/GraphOfGrid.hpp +++ b/opm/grid/GraphOfGrid.hpp @@ -162,17 +162,17 @@ class GraphOfGrid{ return wells; } - /// \brief Contract a layer of verices around each wells into it + /// \brief Contract a layer of verices around each well into it /// /// Representing a well by one node guarantees that the well won't /// be split over several processes. Giving the well an extra layer /// of cells distances that well from the subdomain boundary. - void addWellBuffer (); - void addWellBuffer (int layers) + void addNeighboringCellsToWells (); + void addNeighboringCellsToWells (int layers) { for (int i=0; i Date: Mon, 2 Dec 2024 15:38:50 +0100 Subject: [PATCH 6/6] Bugfix: change renamed function in a test --- tests/test_graphofgrid.cpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/tests/test_graphofgrid.cpp b/tests/test_graphofgrid.cpp index 6a99433f5..c4883a208 100644 --- a/tests/test_graphofgrid.cpp +++ b/tests/test_graphofgrid.cpp @@ -351,20 +351,20 @@ BOOST_AUTO_TEST_CASE(WellWithBuffers) if (grid.size(0)==0) return; - gog.addWellBuffer(); // adding buffer to zero wells does nothing + gog.addNeighboringCellsToWells(); // adding buffer to zero wells does nothing BOOST_REQUIRE(gog.size()==5); std::set well{0,1}; gog.addWell(well); // buffers of negative or zero size are ignored - gog.addWellBuffer(0); + gog.addNeighboringCellsToWells(0); BOOST_REQUIRE(gog.size()==4); - gog.addWellBuffer(-4); + gog.addNeighboringCellsToWells(-4); BOOST_REQUIRE(gog.size()==4); - gog.addWellBuffer(); // no arg is 1 layer + gog.addNeighboringCellsToWells(); // no arg is 1 layer BOOST_REQUIRE(gog.size()==3); - gog.addWellBuffer(2); + gog.addNeighboringCellsToWells(2); BOOST_REQUIRE(gog.size()==1); } @@ -383,7 +383,7 @@ BOOST_AUTO_TEST_CASE(NeighboringWellsWithBuffers) gog.addWell(well0); gog.addWell(well1); BOOST_REQUIRE(gog.size()==4); - gog.addWellBuffer(); + gog.addNeighboringCellsToWells(); BOOST_REQUIRE(gog.size()==2); BOOST_REQUIRE(gog.getWells().size()==1); BOOST_REQUIRE(*gog.getWells().begin()==(std::set{0,1,2,3,4})); @@ -404,7 +404,7 @@ BOOST_AUTO_TEST_CASE(WellsWithIntersectingBuffers) gog.addWell(well0); gog.addWell(well1); BOOST_REQUIRE(gog.size()==4); - gog.addWellBuffer(); + gog.addNeighboringCellsToWells(); BOOST_REQUIRE(gog.size()==1); BOOST_REQUIRE(gog.getWells().size()==1); BOOST_REQUIRE(*gog.getWells().begin()==(std::set{0,1,2,3,4,5})); @@ -429,7 +429,7 @@ BOOST_AUTO_TEST_CASE(WellsWithIntersectingBuffers2) gog.addWell(well2); gog.addWell(well3); BOOST_REQUIRE(gog.size()==18); - gog.addWellBuffer(); + gog.addNeighboringCellsToWells(); BOOST_REQUIRE(gog.size()==2); const auto& wells = gog.getWells(); BOOST_REQUIRE(wells.size()==2); @@ -445,7 +445,7 @@ BOOST_AUTO_TEST_CASE(WellsWithIntersectingBuffers2) } } // adding one layer contracts everything into one vertex, another layer does nothing - gog.addWellBuffer(2); + gog.addNeighboringCellsToWells(2); BOOST_REQUIRE(gog.size()==1); }