Boundarylayer limitation fixes

Squashed commit of the following:

commit a1007d6728
Author: vgeza <vg@cenos-platform.com>
Date:   Fri Sep 1 13:01:01 2023 +0300

    put back

commit 74b145cf7f
Author: vgeza <vgeza@users.noreply.github.com>
Date:   Fri Sep 1 12:44:06 2023 +0300

    Update smoothing

commit 18a2a95a61
Author: vgeza <vgeza@users.noreply.github.com>
Date:   Fri Sep 1 12:32:35 2023 +0300

    More restrictive fixes

commit cc715804ac
Author: vgeza <vgeza@users.noreply.github.com>
Date:   Fri Sep 1 12:31:50 2023 +0300

    fix

commit 36a7b522c3
Author: vgeza <vgeza@users.noreply.github.com>
Date:   Fri Sep 1 12:31:15 2023 +0300

    Update limits at the end of loop

Bounarylayer - safety parameter to limit maximum vector growth
This commit is contained in:
Matthias Hochsteger 2023-09-04 11:48:15 +02:00
parent 499c9086b0
commit 125c21b200
2 changed files with 16 additions and 7 deletions

View File

@ -96,7 +96,7 @@ namespace netgen
array<Point<3>, 2> BoundaryLayerTool :: GetMappedSeg( PointIndex pi ) array<Point<3>, 2> BoundaryLayerTool :: GetMappedSeg( PointIndex pi )
{ {
return { mesh[pi], mesh[pi] + height*limits[pi]*growthvectors[pi] }; return { mesh[pi], mesh[pi] + height*limits[pi]*growthvectors[pi] * 1.5 };
} }
ArrayMem<Point<3>, 4> BoundaryLayerTool :: GetFace( SurfaceElementIndex sei ) ArrayMem<Point<3>, 4> BoundaryLayerTool :: GetFace( SurfaceElementIndex sei )
@ -288,6 +288,9 @@ namespace netgen
while(limit_reached || step<3) while(limit_reached || step<3)
{ {
Array<double, PointIndex> new_limits;
new_limits.SetSize(np);
new_limits = 1.0;
if(step>1) if(step>1)
lam_lower_limit *= 0.8; lam_lower_limit *= 0.8;
@ -345,7 +348,7 @@ namespace netgen
if (isIntersectingFace(seg, face, lam_)) if (isIntersectingFace(seg, face, lam_))
{ {
if (is_bl_sel) if (is_bl_sel)
lam_ *= 0.5; lam_ *= params.limit_safety;
lam = min(lam, lam_); lam = min(lam, lam_);
} }
} }
@ -355,7 +358,7 @@ namespace netgen
if(isIntersectingFace(seg, face, lam_)) if(isIntersectingFace(seg, face, lam_))
{ {
if(is_bl_sel) // allow only half the distance if the opposing surface element has a boundary layer too if(is_bl_sel) // allow only half the distance if the opposing surface element has a boundary layer too
lam_ *= 0.5; lam_ *= params.limit_safety;
lam = min(lam, lam_); lam = min(lam, lam_);
} }
} }
@ -375,19 +378,23 @@ namespace netgen
}); });
if(lam<1) if(lam<1)
{ {
if(lam<lam_lower_limit && step>0) if(lam<lam_lower_limit && step>1)
{ {
limit_reached = true; limit_reached = true;
lam = lam_lower_limit; lam = lam_lower_limit;
} }
limits[pi] = min(limits[pi], lam);
} }
new_limits[pi] = min(limits[pi], lam* limits[pi]);
} }
step++; step++;
limits = new_limits;
if (step > 0)
modifiedsmooth(1);
} }
self_intersection(); self_intersection();
modifiedsmooth(3); modifiedsmooth(1);
for(auto pi : Range(growthvectors)) for(auto pi : Range(growthvectors))
growthvectors[pi] *= limits[pi]; growthvectors[pi] *= limits[pi];
@ -1498,10 +1505,11 @@ namespace netgen
auto segmap = BuildSegMap(); auto segmap = BuildSegMap();
auto in_surface_direction = ProjectGrowthVectorsOnSurface(); auto in_surface_direction = ProjectGrowthVectorsOnSurface();
InterpolateGrowthVectors();
if(params.limit_growth_vectors) if(params.limit_growth_vectors)
LimitGrowthVectorLengths(); LimitGrowthVectorLengths();
InterpolateGrowthVectors();
FixVolumeElements(); FixVolumeElements();
InsertNewElements(segmap, in_surface_direction); InsertNewElements(segmap, in_surface_direction);
SetDomInOut(); SetDomInOut();

View File

@ -19,6 +19,7 @@ public:
bool outside = false; // set the boundary layer on the outside bool outside = false; // set the boundary layer on the outside
bool grow_edges = false; bool grow_edges = false;
bool limit_growth_vectors = true; bool limit_growth_vectors = true;
double limit_safety = 0.3; // alloow only 30% of the growth vector length
bool sides_keep_surfaceindex = false; bool sides_keep_surfaceindex = false;
Array<size_t> project_boundaries; Array<size_t> project_boundaries;
}; };