diff --git a/src/dynamicMesh/layerAdditionRemoval/addCellLayer.C b/src/dynamicMesh/layerAdditionRemoval/addCellLayer.C index 4ca30ced377a494757fe73b4e955910c3efeca99..2c6eb27b362e40754ea701c63d82a6653fa5e597 100644 --- a/src/dynamicMesh/layerAdditionRemoval/addCellLayer.C +++ b/src/dynamicMesh/layerAdditionRemoval/addCellLayer.C @@ -6,6 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2016 OpenFOAM Foundation + Copyright (C) 2021 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -423,19 +424,21 @@ void Foam::layerAdditionRemoval::addCellLayer label patchID = -1; label zoneID = -1; + label extrudeFaceID = -1; - forAll(curFaces, facei) + forAll(curFaces, curFacei) { - const label cf = curFaces[facei]; + extrudeFaceID = curFaces[curFacei]; - if (!mesh.isInternalFace(cf)) + if (!mesh.isInternalFace(extrudeFaceID)) { - // Face not internal. Check if it is in the zone - if (zoneMesh.whichZone(cf) != faceZoneID_.index()) + // Face not internal. Check if it is not in the zone + const label cfZone = zoneMesh.whichZone(extrudeFaceID); + if (cfZone != faceZoneID_.index()) { // Found the face in a boundary patch which is not in zone - patchID = mesh.boundaryMesh().whichPatch(cf); - zoneID = mesh.faceZones().whichZone(cf); + patchID = mesh.boundaryMesh().whichPatch(extrudeFaceID); + zoneID = cfZone; break; } @@ -474,6 +477,56 @@ void Foam::layerAdditionRemoval::addCellLayer << " own: " << addedCells[edgeFaces[curEdgeID][0]] << endl; } + + // Handle duplicate boundary faces (for e.g. cyclicACMI) + if (patchID != -1) + { + for (const label cf : curFaces) + { + if (cf != extrudeFaceID && !mesh.isInternalFace(cf)) + { + // Check if it is not in the zone and duplicate of + // extrudeFaceID + const label cfZone = zoneMesh.whichZone(cf); + if + ( + cfZone != faceZoneID_.index() + && face::compare(faces[cf], faces[extrudeFaceID]) == 1 + ) + { + // Found the face in a boundary patch which is not + // in zone (so would not be extruded above) + patchID = mesh.boundaryMesh().whichPatch(cf); + zoneID = cfZone; + + ref.setAction + ( + polyAddFace + ( + newFace, // face + addedCells[edgeFaces[curEdgeID][0]],// owner + -1, // neighbour + -1, // point + meshEdges[curEdgeID], // edge + -1, // face + false, // flip flux + patchID, // patch + zoneID, // zone + false // zone flip + ) + ); + + if (debug > 1) + { + Pout<< "add duplicate boundary face: " << newFace + << " into patch " << patchID + << " own: " + << addedCells[edgeFaces[curEdgeID][0]] << endl; + } + } + } + } + } } // Modify the remaining faces of the master cells to reconnect to the new diff --git a/src/dynamicMesh/layerAdditionRemoval/removeCellLayer.C b/src/dynamicMesh/layerAdditionRemoval/removeCellLayer.C index d3f3f2edd8827825ae8a48dc778863d7dc0116e7..d3c6c2931f9098df789145ebfc91200e7ef00d8d 100644 --- a/src/dynamicMesh/layerAdditionRemoval/removeCellLayer.C +++ b/src/dynamicMesh/layerAdditionRemoval/removeCellLayer.C @@ -396,8 +396,12 @@ void Foam::layerAdditionRemoval::removeCellLayer << " flipFace: " << flipFace << " newPatchID: " << newPatchID << " newZoneID: " << newZoneID << nl - << " oldOwn: " << own[mf[facei]] - << " oldNei: " << nei[mf[facei]] << endl; + << " oldOwn: " << own[mf[facei]]; + if (newPatchID == -1) + { + Pout<< " oldNei: " << nei[mf[facei]]; + } + Pout<< endl; } ref.setAction