WIAS-PDELib / ExtendableGrids.jl

MIT License
21 stars 11 forks source link

weird entries in PartitionCells and PartitionEdges #57

Closed chmerdon closed 2 months ago

chmerdon commented 3 months ago

The grid

grid = uniform_refine(grid_unitsquare(Triangle2D), 4)
grid = partition(grid, RecursiveMetisPartitioning(npart=20))

produces these PartitionCells

grid[PartitionCells] = Int32[1, 23, 54, 79, 96, 111, 139, 160, 185, 204, 222, 246, 265, 284, 310, 319, 341, 358, 374, 396, 424, 426, 430, 431, 432, 436, 450, 463, 465, 466, 466, 477, 480, 497, 516, 527, 545, 558, 571, 578, 588, 1025]

This indicates that the partition starting with cell 465 is empty, and the next partition even has -1 cells.

Also, grid[PartitionEdges] looks weird, but it seems this becomes correct, when edges = true is used in the partition call.

j-fu commented 2 months ago

Well partition size is assumed to be the length of the corresponding range returned by partition_cells:

partition_cells(gpart,29)=465:465
partition_cells(gpart,30)=466:465

we have

length(465:465)=1
length(466:465)=0

I am not completely sure how in this case an empty partition could occur but I do assume that empty partitions are correct. In fact, when partitioning nodes, in some cases I have to join two node partitions and then make one of them empty.

Generally for this algorithm, the grid is too coarse.

Sure the docs need some more information...

j-fu commented 2 months ago

As for the edge partitioning: without edges=true, a trivial partitioning of the edges is created such that all edges belong to partition 1 and all others are empty.

Also will add this to the docs.

Do we need an istrivial check for a partitioning ?