diff --git a/src/mesh/autoMesh/autoHexMesh/meshRefinement/meshRefinementMerge.C b/src/mesh/autoMesh/autoHexMesh/meshRefinement/meshRefinementMerge.C index dc16bd760f..6cc8d7c7bb 100644 --- a/src/mesh/autoMesh/autoHexMesh/meshRefinement/meshRefinementMerge.C +++ b/src/mesh/autoMesh/autoHexMesh/meshRefinement/meshRefinementMerge.C @@ -277,7 +277,11 @@ Foam::label Foam::meshRefinement::mergePatchFacesUndo } } - // Get all sets of faces that can be merged + // Get all sets of faces that can be merged. Since only faces on the same + // patch get merged there is no risk of e.g. patchID faces getting merged + // with original patches (or even processor patches). There is a risk + // though of original patchfaces getting merged if they make a small + // angle. Would be pretty weird starting mesh though. labelListList allFaceSets ( faceCombiner.getMergeSets @@ -352,27 +356,20 @@ Foam::label Foam::meshRefinement::mergePatchFacesUndo // Get the kept faces that need to be recalculated. // Merging two boundary faces might shift the cell centre // (unless the faces are absolutely planar) - labelHashSet retestFaces(6*allFaceSets.size()); + labelHashSet retestFaces(2*allFaceSets.size()); forAll(allFaceSets, setI) { label oldMasterI = allFaceSets[setI][0]; - - label faceI = map().reverseFaceMap()[oldMasterI]; - - // faceI is always uncoupled boundary face - const cell& cFaces = mesh_.cells()[mesh_.faceOwner()[faceI]]; - - forAll(cFaces, i) - { - retestFaces.insert(cFaces[i]); - } + retestFaces.insert(map().reverseFaceMap()[oldMasterI]); } - updateMesh(map, retestFaces.toc()); + updateMesh(map, growFaceCellFace(retestFaces)); if (debug) { // Check sync + Pout<< "Checking sync after initial merging " << nFaceSets + << " faces." << endl; checkData(); Pout<< "Writing initial merged-faces mesh to time " @@ -555,26 +552,18 @@ Foam::label Foam::meshRefinement::mergePatchFacesUndo // Get the kept faces that need to be recalculated. // Merging two boundary faces might shift the cell centre // (unless the faces are absolutely planar) - labelHashSet retestFaces(6*restoredFaces.size()); + labelHashSet retestFaces(2*restoredFaces.size()); - forAll(restoredFaces, setI) + forAllConstIter(Map