From ceb2151094b7b84ec40eec88a0c59cffa804aee3 Mon Sep 17 00:00:00 2001 From: mattijs Date: Mon, 23 Sep 2024 17:20:52 +0100 Subject: [PATCH] ENH: createPatch: allow duplicating face (for ACMI) --- .../manipulation/createPatch/createPatch.C | 60 +++++++++++++----- etc/caseDicts/annotated/createPatchDict | 63 +++++++++++++++++++ 2 files changed, 106 insertions(+), 17 deletions(-) diff --git a/applications/utilities/mesh/manipulation/createPatch/createPatch.C b/applications/utilities/mesh/manipulation/createPatch/createPatch.C index f07f49bfad..b255fcf58f 100644 --- a/applications/utilities/mesh/manipulation/createPatch/createPatch.C +++ b/applications/utilities/mesh/manipulation/createPatch/createPatch.C @@ -52,6 +52,7 @@ Description #include "IOPtrList.H" #include "polyTopoChange.H" #include "polyModifyFace.H" +#include "polyAddFace.H" #include "wordRes.H" #include "processorMeshes.H" #include "IOdictionary.H" @@ -344,6 +345,7 @@ void matchPatchFaces void changePatchID ( + const bool modify, const fvMesh& mesh, const label faceID, const label patchID, @@ -361,21 +363,43 @@ void changePatchID zoneFlip = fZone.flipMap()[fZone.whichFace(faceID)]; } - meshMod.setAction - ( - polyModifyFace + if (modify) + { + meshMod.setAction ( - mesh.faces()[faceID], // face - faceID, // face ID - mesh.faceOwner()[faceID], // owner - -1, // neighbour - false, // flip flux - patchID, // patch ID - false, // remove from zone - zoneID, // zone ID - zoneFlip // zone flip - ) - ); + polyModifyFace + ( + mesh.faces()[faceID], // face + faceID, // face ID + mesh.faceOwner()[faceID], // owner + -1, // neighbour + false, // flip flux + patchID, // patch ID + false, // remove from zone + zoneID, // zone ID + zoneFlip // zone flip + ) + ); + } + else + { + meshMod.setAction + ( + polyAddFace + ( + mesh.faces()[faceID], // modified face + mesh.faceOwner()[faceID], // owner + -1, // neighbour + -1, // master point + -1, // master edge + faceID, // master face + false, // face flip + patchID, // patch for face + zoneID, // zone for face + zoneFlip // face flip in zone + ) + ); + } } @@ -399,7 +423,9 @@ void changePatchID << " existing boundary faces." << exit(FatalError); } - if (!isRepatchedBoundary.set(facei-mesh.nInternalFaces())) + const bool isFirst = + isRepatchedBoundary.set(facei-mesh.nInternalFaces()); + if (!isFirst) { static label nWarnings = 0; if (nWarnings == 0) @@ -413,14 +439,14 @@ void changePatchID << " name " << mesh.boundaryMesh()[patchID].name() << " is already marked for patch " << newPatchi << " name " << mesh.boundaryMesh()[newPatchi].name() - << ". Suppressing further warnings" + << ". Creating duplicate face. Suppressing further warnings" //<< exit(FatalError); << endl; } nWarnings++; } - changePatchID(mesh, facei, patchID, meshMod); + changePatchID(isFirst, mesh, facei, patchID, meshMod); } } diff --git a/etc/caseDicts/annotated/createPatchDict b/etc/caseDicts/annotated/createPatchDict index 8582a9c698..0922d71bb3 100644 --- a/etc/caseDicts/annotated/createPatchDict +++ b/etc/caseDicts/annotated/createPatchDict @@ -168,6 +168,69 @@ patches // Wildcards&patchGroups allowed. patches (coupling_group); } + + + // Example of creating cyclicACMI patch pair + // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // (creates duplicate faces for blockage) + { + // Name of new patch + name left_couple; + + // Dictionary to construct new patch from + patchInfo + { + type cyclicACMI; + neighbourPatch right_couple; + nonOverlapPatch left_blockage; + } + + // Select faces + constructFrom set; + set left_faces_set; + } + + { + name left_blockage; + patchInfo + { + type wall; + } + + // Select faces + constructFrom set; + set left_faces_set; + } + + { + // Name of new patch + name right_couple; + + // Dictionary to construct new patch from + patchInfo + { + type cyclicACMI; + neighbourPatch left_couple; + nonOverlapPatch right_blockage; + } + + // Select faces + constructFrom set; + set right_faces_set; + } + + { + name right_blockage; + // Dictionary to construct new patch from + patchInfo + { + type wall; + } + + // Select faces + constructFrom set; + set right_faces_set; + } ); // ************************************************************************* //