Viscous Layer generation - boundary overlapping

Good morning,

I am trying to develop a mesh with a viscous layer, using the NETGEN algorithm in SALOME. I convert a remeshed STL to a solid file (brep, for example).
The geometry has quite steep angles and zones that are much thicker than others, for which if I try to set values above a certain level, I get an error saying that the boundaries are overlapping (and I can actually see the geometry having the 3D prisms coming out of the boundary surface).

I was wondering if there was a way to avoid this from happening, for example setting a relative thickness value rather than absolute, or other solutions - like for example merging the nodes at each layer addition iteration or recalculate the normal/element combination to extrude the generate the subsequent layer.

Can this be solved using the Node_offset method rather than the face_offset or surface_offset_smooth? Does that use relative sizes? Although it doesn’t really seem to me.

Plus, I have observed that for coarser meshes, I can extend the maximum thickness above which I get the mesh overlapping error.
Now I am running a test with a much finer mesh where the sharp angles/ small spaces are - it just takes ages to compute so I cannot really draw a conclusion!

Is there a way to do it directly with the native NETGEN?

Thank you so much in advance.

Hi, as far as I know netgen is only used for surface and tet meshing in salome, not for the viscous layer generation, no idea what they are doing there exactly.
We have currently under development our own code for creating these layers, but it is still work in progress and features like your requested ones are not (yet) there.

Automatic detection of too thick layers and limiting in problematic regions is currently in active development. Can be enabled with the limit_growth_vectors=True flag, but has some known issues that will hopefully be adressed in the coming weeks.

from netgen.occ import *
from ngsolve import *

b1 = Box((0,0,0), (1,1,1))
b2 = Box((0.2,0.2,0.2), (0.8,0.8,0.3))
b2.solids.name = "plate"

b1 -= b2
b1.solids.name = "air"

shape = Glue([b1,b2])

mesh = OCCGeometry(shape).GenerateMesh(maxh=0.1)

mesh.BoundaryLayer(".*", [0.01,0.02], material="plate_layer", domains="plate")

mesh = Mesh(mesh)
Draw(mesh)

also note, the code has been developed for specific use cases (mainly EM), so the layers might not be “good” for all applications.

Hi Christopher, I started from your code but changed the plate to a cylinder. My aim is to create a cylinder with thin mesh layers for solving a time harmonics maxwell/eddy current problem. However, the inner surfaces of the mesh layers got distorted (they are not cylindical, but I want them cylindrical). Is it possible to create “viscous layers” for a cylinder in a simlar way as you showed for the plate?

yes, what do you mean with distorted?

from netgen.occ import *
from ngsolve import *

cyl = Cylinder((0,0,0), Z, 1, 1)
cyl.solids.name = "mat"
geo = OCCGeometry(cyl)

mesh = geo.GenerateMesh(maxh=0.2)
mesh.BoundaryLayer(".*", [0.01, 0.02], material="mat", domains="mat")
mesh = Mesh(mesh)
Draw(mesh)

1 Like

Thanks! I made a mistake with the mesh size. I had set the mesh size of the cylinder equal to the layer size (which doesn’t make sense :blush:) and that’s why my mesh looked strange.

Hello Christopher,
Thank you so much with your reply and the code snippet.
I am trying to develop a CFD compound mesh for a conjugate heat transfer case (1 solid, 2 fluids).
The error that I get in Salome seems to belong to Ng:
image
The advancing layer algorithm seems unable to deal with front intersection cases ( if it’s something that is also limiting your netgen algorithm, I found this paper that may be helpful Click here ).

If I try to use the native mesher of NETGEN, the BL gets created but the thickness is very inconsistent, and gives me an error whenever I add more layers.
I understand that in the thickness parameter, each element of the list is the thickness of the layer itself and not the layer height, right?
I am trying to work starting from STL geometries. Do you recommend using STLs directly or converting them to BREP first?

A lot of questions at once :wink:

I have not much idea how netgen is integrated in Salome, boundary mesh overlap usually means that the boundary that is given to the volume mesher is not correct.

The limit layer thickness we have implemented is something similar I guess to the paper you suggest (but not sure if already fully correctly implemented).

each element of the list gives the height of the elements inserted. So the total layer height is the sum over all.

if you can create smooth brep maybe it is a shot, but if you mean by converting to brep to make a brep triangle out of each stl triangle I’d stick with stl, this should be way more efficient then. In the step, each triangle would be fully resolved within the mesh, whereas the stl mesher tries to approximate the stl geometry smoothly.

Thank you so much for all the answers!
I’ll go with STL then, hoping that it works!

When you mean that the boundary is not correct, do you mean in terms of face normals, watertightness, etc? Or even other aspects that I may be overlooking?
I try to fix the geometry with blender first, and I also smooth the very sharp angles. I recalculate the normals and smooth them.

The error message suggests that boundary elements are overlapping. Maybe you need to refine some boundaries that are coming close to each other?

I have tried to refine it quite a bit, remeshed it, and preprocessed it better with Blender, but it still didn’t work and give me the error.

I’ll try to get it to work well with your native software, rather than Salome… I will keep you posted!

Hi,
I am trying (still in SALOME) to define the faces where the BL should not be built (top and bottom faces as my geometry is periodic), however, if I try to set them, I get this error:
image
Any idea on what could be the cause?

as said, the layer code in salome is not from us. maybe ask in their community?