From 7aff94046f2e00b146bf5ab5d668cf70f0f0ae3c Mon Sep 17 00:00:00 2001 From: Matthias Hochsteger Date: Thu, 6 Feb 2025 18:50:04 +0100 Subject: [PATCH] Also smooth boundary layers at corners if adjacent surface elements have similar normal vectors --- libsrc/meshing/boundarylayer_interpolate.cpp | 23 ++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/libsrc/meshing/boundarylayer_interpolate.cpp b/libsrc/meshing/boundarylayer_interpolate.cpp index 22fb31eb..e7ac6c08 100644 --- a/libsrc/meshing/boundarylayer_interpolate.cpp +++ b/libsrc/meshing/boundarylayer_interpolate.cpp @@ -155,8 +155,27 @@ void BoundaryLayerTool ::InterpolateGrowthVectors() { for (auto* p_seg : edgenr2seg[edgenr]) for (auto pi : p_seg->PNums()) - if (pi < first_new_pi && point_types[pi] == EDGEPOINT) - point_types[pi] = SURFACEPOINT; + { + if (pi >= first_new_pi) + continue; + if (point_types[pi] == EDGEPOINT) + point_types[pi] = SURFACEPOINT; + else if (point_types[pi] == FIXEDPOINT) + { + // Check at edge corners if all adjacent surface elements have roughly the same normal. + // If so, also treat this point as surface point for growth vector interpolation + Vec<3> n = 0.0; + for (auto si : p2sel[pi]) + n += getNormal(mesh[si]); + n.Normalize(); + bool is_corner = false; + for (auto si : p2sel[pi]) + if (getNormal(mesh[si]) * n < 0.9) + is_corner = true; + if (!is_corner) + point_types[pi] = SURFACEPOINT; + } + } continue; } }