From c1b892b682e592013103ae3bce9998616f227952 Mon Sep 17 00:00:00 2001 From: Halvor M Nilsen Date: Mon, 18 Nov 2024 13:10:10 +0100 Subject: [PATCH] Changes for more resonable partitioning: - option to not remove anything from partitioning graph - added possibility for setting overlap - changed export list: need testing in particular in parallel (if it is intended to work there) --- opm/grid/CpGrid.hpp | 4 ++-- opm/grid/common/GridPartitioning.cpp | 3 ++- opm/grid/common/ZoltanPartition.cpp | 2 +- opm/grid/cpgrid/CpGrid.cpp | 4 ++-- 4 files changed, 7 insertions(+), 6 deletions(-) diff --git a/opm/grid/CpGrid.hpp b/opm/grid/CpGrid.hpp index 8b599395d..a899dec77 100644 --- a/opm/grid/CpGrid.hpp +++ b/opm/grid/CpGrid.hpp @@ -1219,10 +1219,10 @@ namespace Dune /// \param overlapLayers The number of layers of cells of the overlap region (default: 1). /// \param partitionMethod The method used to partition the grid, one of Dune::PartitionMethod /// \warning May only be called once. - bool loadBalance(int overlapLayers=1, int partitionMethod = Dune::PartitionMethod::zoltan, double imbalanceTol = 1.1) + bool loadBalance(int overlapLayers=1, int partitionMethod = Dune::PartitionMethod::zoltan, double imbalanceTol = 1.1, bool addCorners = true) { using std::get; - return get<0>(scatterGrid(defaultTransEdgeWgt, false, nullptr, {}, false, nullptr, true, overlapLayers, partitionMethod, imbalanceTol)); + return get<0>(scatterGrid(defaultTransEdgeWgt, false, nullptr, {}, false, nullptr, addCorners, overlapLayers, partitionMethod, imbalanceTol)); } // loadbalance is not part of the grid interface therefore we skip it. diff --git a/opm/grid/common/GridPartitioning.cpp b/opm/grid/common/GridPartitioning.cpp index b3943d799..f3b607601 100644 --- a/opm/grid/common/GridPartitioning.cpp +++ b/opm/grid/common/GridPartitioning.cpp @@ -391,7 +391,8 @@ void addOverlapLayer(const CpGrid& grid, int index, const CpGrid::Codim<0>::Enti { // Note: multiple adds for same process are possible exportList.emplace_back(nb_index, owner, AttributeSet::copy); - exportList.emplace_back(index, cell_part[nb_index], AttributeSet::copy); + // not need or check if + //exportList.emplace_back(index, cell_part[nb_index], AttributeSet::copy); if ( recursion_deps>0 ) { // Add another layer diff --git a/opm/grid/common/ZoltanPartition.cpp b/opm/grid/common/ZoltanPartition.cpp index 2903c1141..708213873 100644 --- a/opm/grid/common/ZoltanPartition.cpp +++ b/opm/grid/common/ZoltanPartition.cpp @@ -286,7 +286,7 @@ void setDefaultZoltanParameters(Zoltan_Struct* zz) { Zoltan_Set_Param(zz, "CHECK_GRAPH", "2"); Zoltan_Set_Param(zz,"EDGE_WEIGHT_DIM","0"); Zoltan_Set_Param(zz, "OBJ_WEIGHT_DIM", "0"); - Zoltan_Set_Param(zz, "PHG_EDGE_SIZE_THRESHOLD", ".35"); /* 0-remove all, 1-remove none */ + Zoltan_Set_Param(zz, "PHG_EDGE_SIZE_THRESHOLD", "1"); /* 0-remove all, 1-remove none */ } diff --git a/opm/grid/cpgrid/CpGrid.cpp b/opm/grid/cpgrid/CpGrid.cpp index d7c035f31..521112ef0 100644 --- a/opm/grid/cpgrid/CpGrid.cpp +++ b/opm/grid/cpgrid/CpGrid.cpp @@ -225,7 +225,7 @@ CpGrid::scatterGrid(EdgeWeightMethod method, // Silence any unused argument warnings that could occur with various configurations. static_cast(wells); static_cast(transmissibilities); - static_cast(overlapLayers); + //static_cast(overlapLayers); static_cast(method); static_cast(imbalanceTol); @@ -373,7 +373,7 @@ CpGrid::scatterGrid(EdgeWeightMethod method, // first create the overlap auto noImportedOwner = addOverlapLayer(*this, computedCellPart, exportList, importList, cc, addCornerCells, - transmissibilities); + transmissibilities, overlapLayers); // importList contains all the indices that will be here. auto compareImport = [](const std::tuple& t1, const std::tuple&t2)