From 6f2fadb48f4bf25d6c4cf8b5898baa99ea9b3a34 Mon Sep 17 00:00:00 2001 From: mattijs Date: Mon, 10 Feb 2025 12:00:53 +0000 Subject: [PATCH] ENH: extrudeToRegionMesh: ignore zone boundaries. Fixes #3318 --- .../extrudeToRegionMesh/extrudeToRegionMesh.C | 24 ++++++++++++++++--- .../annotated/extrudeToRegionMeshDict | 10 ++++++++ 2 files changed, 31 insertions(+), 3 deletions(-) diff --git a/applications/utilities/mesh/generation/extrude/extrudeToRegionMesh/extrudeToRegionMesh.C b/applications/utilities/mesh/generation/extrude/extrudeToRegionMesh/extrudeToRegionMesh.C index 90ff0fc3f5..cf15e2f1a5 100644 --- a/applications/utilities/mesh/generation/extrude/extrudeToRegionMesh/extrudeToRegionMesh.C +++ b/applications/utilities/mesh/generation/extrude/extrudeToRegionMesh/extrudeToRegionMesh.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2016 OpenFOAM Foundation - Copyright (C) 2015-2024 OpenCFD Ltd. + Copyright (C) 2015-2025 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -1520,6 +1520,10 @@ int main(int argc, char *argv[]) const bool adaptMesh(dict.get("adaptMesh")); + const bool addSidePatches(dict.getOrDefault("addSidePatches", true)); + + + if (hasZones) { Info<< "Extruding zones " << zoneNames @@ -1564,6 +1568,15 @@ int main(int argc, char *argv[]) } + if (addSidePatches && zoneNames.size() > 1) + { + Info<< "Extruding edges on more than one faceZone into boundary faces" + << endl; + } + else + { + Info<< "Extruding internal edges into internal faces" << endl; + } //// Read objects in time directory @@ -1918,7 +1931,12 @@ int main(int argc, char *argv[]) edgeMaxZoneID ); - + if (!addSidePatches) + { + // Disabling inter-zone multiple boundary faces by setting 'left' and + // 'right' zone to be the same + edgeMaxZoneID = edgeMinZoneID; + } DynamicList regionPatches(patches.size()); @@ -2190,7 +2208,7 @@ int main(int argc, char *argv[]) label zone0 = zoneID[eFaces[0]]; label zone1 = zoneID[eFaces[1]]; - if (zone0 != zone1) // || (cos(angle) > blabla)) + if (addSidePatches && (zone0 != zone1)) // || (cos(angle) > blabla)) { label minZone = min(zone0,zone1); label maxZone = max(zone0,zone1); diff --git a/etc/caseDicts/annotated/extrudeToRegionMeshDict b/etc/caseDicts/annotated/extrudeToRegionMeshDict index 083de8734f..e2bb5b74e5 100644 --- a/etc/caseDicts/annotated/extrudeToRegionMeshDict +++ b/etc/caseDicts/annotated/extrudeToRegionMeshDict @@ -28,6 +28,16 @@ faceZones (f0 f1); //faceSets (f0 f1); //faceSetsShadow (f0Shadow f1Shadow); + +// Optional : if edge on multiple sets/zones : +// - addSidePatches false : extrude as an internal face (same as a zone-internal +// edge) +// - addSidePatches true : extrude each zone separately so creating multiple +// (default) boundary faces. These faces go into a cyclic type +// patch with corresponding transform. +addSidePatches false; + + // Adapt the original mesh to have mapped patches at where the // faceZones are? // If true: