diff --git a/src/dynamicMesh/dynamicMesh/polyMeshModifiers/polyhedralRefinement/polyhedralRefinement.C b/src/dynamicMesh/dynamicMesh/polyMeshModifiers/polyhedralRefinement/polyhedralRefinement.C index 42e9d83dc..fd68a8353 100644 --- a/src/dynamicMesh/dynamicMesh/polyMeshModifiers/polyhedralRefinement/polyhedralRefinement.C +++ b/src/dynamicMesh/dynamicMesh/polyMeshModifiers/polyhedralRefinement/polyhedralRefinement.C @@ -2930,15 +2930,19 @@ Foam::label Foam::polyhedralRefinement::faceConsistentRefinement const label curOwnLevel = cellsToRefine[own] ? cellLevel_[own] + 1 : cellLevel_[own]; - if (neiLevel[i] > (curOwnLevel + 1)) + // Note: we are using more stringent 1:1 consistency across coupled + // boundaries in order to simplify handling of edge based consistency + // checks for parallel runs + if (neiLevel[i] > curOwnLevel) { - // Neighbour level is higher than owner level + 1, owner must be + // Neighbour level is higher than owner level, owner must be // marked for refinement cellsToRefine[own] = true; ++nAddCells; } + // Note: other possibility (that owner level is higher than neighbour - // level + 1) is taken into account on the other side automatically + // level) is taken into account on the other side automatically } // Return number of added cells @@ -2946,7 +2950,7 @@ Foam::label Foam::polyhedralRefinement::faceConsistentRefinement } -Foam::label Foam::polyhedralRefinement::pointConsistentRefinement +Foam::label Foam::polyhedralRefinement::edgeConsistentRefinement ( boolList& cellsToRefine ) const @@ -2954,92 +2958,75 @@ Foam::label Foam::polyhedralRefinement::pointConsistentRefinement // Count number of cells that will be added label nAddCells = 0; - // Maximum surrounding cell refinement level for each point - labelList maxRefLevel(mesh_.nPoints(), 0); + // Algorithm: loop over all edges and visit all unique cell pairs sharing + // this particular edge. Then, ensure 2:1 edge consistency by marking + // cell with lower level for refinement - // Get point cells - const labelListList& meshPointCells = mesh_.pointCells(); + // Get edge cells + const labelListList& meshEdgeCells = mesh_.edgeCells(); - // Loop through all points and collect maximum point level for each point - forAll (maxRefLevel, pointI) + // Loop through all mesh edges + forAll (meshEdgeCells, edgeI) { - // Get the cells for this point - const labelList& curCells = meshPointCells[pointI]; + // Get current edge cells + const labelList& curEdgeCells = meshEdgeCells[edgeI]; - // Get reference to maximum pooint level for this point - label& curMaxPointLevel = maxRefLevel[pointI]; - - // Find maximum refinement level for this point - forAll (curCells, i) + // Loop through all edge cells + forAll (curEdgeCells, i) { - // Get cell index and "future" cell level - const label& curCellI = curCells[i]; - const label curCellLevel = - cellsToRefine[curCellI] - ? cellLevel_[curCellI] + 1 - : cellLevel_[curCellI]; + // Get first cell index + const label& cellI = curEdgeCells[i]; - // Update maximum point level if the curCellLevel is higher - curMaxPointLevel = max(curMaxPointLevel, curCellLevel); - } - } - - // Sync maximum refinement level across coupled boundaries - syncTools::syncPointList - ( - mesh_, - maxRefLevel, - maxEqOp