diff --git a/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoRefineDriver.C b/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoRefineDriver.C index 82bfa13522..12b3e8b2bf 100644 --- a/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoRefineDriver.C +++ b/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoRefineDriver.C @@ -1047,7 +1047,12 @@ void Foam::autoRefineDriver::splitAndMergeBaffles } // Remove any now dangling parts - meshRefiner_.splitMeshRegions(refineParams.keepPoints()[0]); + meshRefiner_.splitMeshRegions + ( + globalToMasterPatch_, + globalToSlavePatch_, + refineParams.keepPoints()[0] + ); if (debug) { diff --git a/src/mesh/autoMesh/autoHexMesh/meshRefinement/meshRefinement.C b/src/mesh/autoMesh/autoHexMesh/meshRefinement/meshRefinement.C index 22f2d7e3db..a3629c8e13 100644 --- a/src/mesh/autoMesh/autoHexMesh/meshRefinement/meshRefinement.C +++ b/src/mesh/autoMesh/autoHexMesh/meshRefinement/meshRefinement.C @@ -131,7 +131,7 @@ void Foam::meshRefinement::calcNeighbourData // Other cell more refined. Adjust normal distance d *= 0.5; } - neiLevel[bFaceI] = cellLevel[ownLevel]; + neiLevel[bFaceI] = faceLevel; // Calculate other cell centre by extrapolation neiCc[bFaceI] = faceCentres[i] + d*fn; bFaceI++; @@ -1901,8 +1901,6 @@ void Foam::meshRefinement::selectSeparatedCoupledFaces(boolList& selected) const forAll(patches, patchI) { - const polyPatch& pp = patches[patchI]; - // Check all coupled. Avoid using .coupled() so we also pick up AMI. if (isA(patches[patchI])) { @@ -1913,9 +1911,9 @@ void Foam::meshRefinement::selectSeparatedCoupledFaces(boolList& selected) const if (cpp.separated() || !cpp.parallel()) { - forAll(pp, i) + forAll(cpp, i) { - selected[pp.start()+i] = true; + selected[cpp.start()+i] = true; } } } @@ -1925,6 +1923,8 @@ void Foam::meshRefinement::selectSeparatedCoupledFaces(boolList& selected) const Foam::autoPtr Foam::meshRefinement::splitMeshRegions ( + const labelList& globalToMasterPatch, + const labelList& globalToSlavePatch, const point& keepPoint ) { @@ -1933,7 +1933,11 @@ Foam::autoPtr Foam::meshRefinement::splitMeshRegions // Determine connected regions. regionSplit is the labelList with the // region per cell. - regionSplit cellRegion(mesh_); + + boolList blockedFace(mesh_.nFaces(), false); + selectSeparatedCoupledFaces(blockedFace); + + regionSplit cellRegion(mesh_, blockedFace); label regionI = -1; @@ -1985,22 +1989,39 @@ Foam::autoPtr Foam::meshRefinement::splitMeshRegions removeCells cellRemover(mesh_); labelList exposedFaces(cellRemover.getExposedFaces(cellsToRemove)); + labelList exposedPatch; - if (exposedFaces.size()) + label nExposedFaces = returnReduce(exposedFaces.size(), sumOp