3D-Boundary Layer mesh of imported STL MESH

Good morning,

I am trying to generate a 3D CFD mesh with a viscous boundary layer for a complex geometry. Such a geometry is generated using Python and saved as a stl, which means that the surface is already discretised in many (MANY) triangles. I have tried the ‘Union Faces’ tool but due to the nature of the geometry, the facets are not joined together.
I managed to generate a 3D-tetrahedral geometry ONLY IF I import the stl directly as a mesh, not as a geometry component. If I convert the stl to brep, the faceting is maintained and if I try to generate the mesh, it takes ages and never generates a mesh.
I have been trying to use the Viscous Layer API from SALOME-9.12.0 (Defining Hypotheses and Algorithms — Mesh 9.12.0 documentation) but with no success. I believe there is a problem when choosing the face or something like that. It gives me an error related to the impossibility of assigning a quadrangle_2d_algorithm or a prism_2d or a triangle_2d.
I was wondering if you could help me, as this mesh is crucial for the advancement of my phd!

Thank you in advance for your reply.

Best wishes
Fil

Where are you generating the geometry, which software? Can you share it here by a dowloadable link?

I use the Python Module ‘PyVista’ and then do an initial remesh with the native netgen APP.

Unfortunately I cannot share the geometry file itself

Not a lot of information to work on.

  1. The viscous layer api, is for Cad geometries not meshes.
  2. You need to search how to create a 3d mesh from a surface mesh, and then use netgen 3d with added hypothesis of boundary layers
  3. If is an engineer model not something like a head of a person or something natural. Il would recommend to re create the geometry in Salome, using python. Salome in general is more consieve for creating meshes from a cad model not from meshes.
  4. You have snappyHexMesh from Openfoam cfd package which can generate hex dominant meshes with addition of boundary layers from a surface mesh.
    Regards.

Thank you for your reply.

  1. I can also import the geometry as a step or brep, but it still doesn’t work. I feel there is a problem with the face selection? Do I have to perform the partition?
  2. I can generate the 3d mesh from a surface mesh, but no matter which parameters I input for the BL/hypothesis, no boundary layer is created. I believe that salome cannot handle the many surfaces deriving from the triangular discretization of the input 2d mesh?
  3. I generate the geometry starting from a scalar field defined by an equation and then extract isovalues. Can it be done in SALOME as well? I am new to this
  4. I have tried snappyHexMesh and cfMesh but while one algorithm fails with adding the BL, the other gives me meshes whose feature edges are stair-stepped.

Best wishes

  1. give me at least an example of geometry. something to work on. change parameters so it is not your geometry but something similar. in STEP
  2. you need to explain WAY more how you are doing things, give examples screenshots it is not possible to troubleshoot something from ‘i believe…’ and then ‘new to this’. with open source software a lot of the time the error is not comming from where you ‘think’ it is comming so you need to help the person in front of you understand what are you doing, would say use same geometry as I ask in 1. but in stl do your workflow and upload the .hdf file
  3. it has tools to generate surfaces and edges from points clouds and that type of things you will need to dig on this geometry module is more feature rich for this type of modeling approach. but if you can export a real STEP or BREP file from your soft and not a false step file where each triangulation of a mesh is interpretated as a triangular face CAD salome will handle correctly (specially brep)
  4. SHM depending the geometry can achieve to a level a BL creation, would recommend to go a look for some guides in it over internet there are plenty. but it is not the forum for OF. in any case, if you ask for help there keep in mind what I told you in 1. and 2. and prepare at least a dummy model.

Here is a section of my geometry (.step). There is no other way from which I can export the geometry from that python module.

what I thought… it is a false step, I imagine that this is a result from an optimization. up to my knowledge it is not feasable the classic workflow ->cad ->mesh (so no viscous layer API for sure). maybe there are some workflows that I dont know of using a surface mesh to construct a 3D volumetric mesh (what I mentioned in 2. in my second message).
as I mentionned in 3. of my third message, you have an organic geometry (I coulnt remember the name of this kind of geometries) this is not the strenght of salome and also up to my knowledge not faisable with it. (to reconstruct it to a ‘clean’ STEP)
IMO, for your type of geometries you have 2 options in open source SHM (and something in salome I just added at the end of the comment), 1 in close-payed source (free for academia up to when I was following this kind of things) nTopology.
i would go with SHM.
one approach you can do i salome from what i could test, is by using the false step.
is import it in GEOM, and mesh it using 3D: netgen 3D, 2D: polygon per face, 1D: number of elements per edge =1. this will normally create a 3D mesh, and you can use in 3D the BL (Additional Hypotheses — Mesh 9.12.0 documentation), with the faces you dont want to of you want to. for this a little bit of python for their selection of the corresponding faces would be a good idea.
if you can prepare a STEP file of a cube created by your workflow where you separate the inlet and outlet and remining faces in 3 steps this could be quite easy to automate, but it is a hell of a hackish way to do in salome at least. I would recommend SHM

edit: I have tested with a ‘false’ STEP that I created myself the salome workflow, it works for the creation of 3D netgen mesh, but it output error when creating the BL.
here is the hdf file of what I tested so you get a feeling of salome, but as I mentionned for BL it does not work. so yeah… would go SHM route.
example.hdf (178,7 KB)

Thank you so much for your help. Thanks to your guideline on which 1D and 2D hypotheses to use, I have managed to get a mesh and extract the boundary layer. However, the problem I am facing now is that the mesh I generate only has BL elements.
I tried my same code for a simple cylinder geometry, and it works.
Any recommendation to fix this? Is it a matter of minimum sizes?
The meshing process stops after the BL creation for ‘overlapping’.

EDIT: Would you be able to explain what these two options mean, please?
NETGEN_3D_Parameters_1.SetElemSizeWeight( )
NETGEN_3D_Parameters_1.SetCheckChartBoundary( )

My code:

import sys
import salome

salome.salome_init()
import salome_notebook
notebook = salome_notebook.NoteBook()
sys.path.insert(0, r'')

###
### GEOM component
###

import GEOM
from salome.geom import geomBuilder
import math
import SALOMEDS


geompy = geomBuilder.New()

O = geompy.MakeVertex(0, 0, 0)
OX = geompy.MakeVectorDXDYDZ(1, 0, 0)
OY = geompy.MakeVectorDXDYDZ(0, 1, 0)
OZ = geompy.MakeVectorDXDYDZ(0, 0, 1)
f1_stl_1 = geompy.ImportSTL("test.stl" )
print('F1 was imported')

Solid_1 = geompy.MakeSolid([f1_stl_1])
geompy.addToStudy( O, 'O' )
geompy.addToStudy( OX, 'OX' )
geompy.addToStudy( OY, 'OY' )
geompy.addToStudy( OZ, 'OZ' )
geompy.addToStudy( f1_stl_1, 'f1.stl_1' )
geompy.addToStudy( Solid_1, 'Solid_1' )
print('SOLID WAS GENERATED')
###
### SMESH component
###

import  SMESH, SALOMEDS
from salome.smesh import smeshBuilder

smesh = smeshBuilder.New()

Mesh_1 = smesh.Mesh(Solid_1,'Mesh_1')
Regular_1D = Mesh_1.Segment()
Number_of_Segments_1 = Regular_1D.NumberOfSegments(1)
PolygonPerFace_2D = Mesh_1.Polygon()
NETGEN_3D = Mesh_1.Tetrahedron()
NETGEN_3D_Parameters_1 = NETGEN_3D.Parameters()
NETGEN_3D_Parameters_1.SetMaxSize( 0.03 )
NETGEN_3D_Parameters_1.SetMinSize( 0.005 )
NETGEN_3D_Parameters_1.SetOptimize( 1 )
NETGEN_3D_Parameters_1.SetFineness( 2 )
NETGEN_3D_Parameters_1.SetCheckOverlapping( 0 )
NETGEN_3D_Parameters_1.SetElemSizeWeight( 0. ) #9.86072e-312 
NETGEN_3D_Parameters_1.SetCheckChartBoundary( 184 )
print('Mesh without boundary layer...')
isDone = Mesh_1.Compute()
Mesh_1.ExportUNV('t_withoutBL.unv')

Viscous_Layers_1 = NETGEN_3D.ViscousLayers(0.003,1,1,[],1,smeshBuilder.FACE_OFFSET,'Viscous Layers')
print('Start computing the mesh....')
isDone = Mesh_1.Compute()
print('The mesh was correctly computed')

Viscous_Layers = Mesh_1.GetGroups()[ 0 ]
[ Viscous_Layers ] = Mesh_1.GetGroups()
Mesh_1.ExportUNV('t.unv')

## Set names of Mesh objects
smesh.SetName(Regular_1D.GetAlgorithm(), 'Regular_1D')
smesh.SetName(NETGEN_3D.GetAlgorithm(), 'NETGEN 3D')
smesh.SetName(PolygonPerFace_2D.GetAlgorithm(), 'PolygonPerFace_2D')
smesh.SetName(NETGEN_3D_Parameters_1, 'NETGEN 3D Parameters_1')
smesh.SetName(Viscous_Layers_1, 'Viscous Layers_1')
smesh.SetName(Number_of_Segments_1, 'Number of Segments_1')
smesh.SetName(Mesh_1.GetMesh(), 'Mesh_1')
smesh.SetName(Viscous_Layers, 'Viscous Layers')


Hello,
@franco.ota sorry to bother but looking in the forum it seems that you are the pro here!

I was wondering if you could be able to tell me how to solve an error like this:
image
It only appears if I try to impose that the BL does not get generated starting from the top and bottom faces of my geometry, but just on the sides.
For a simple cylinder case it works, but not for this complex geometry. Can you suggest a work around?

and also what do these parameters do?
NETGEN_3D_Parameters_1.SetElemSizeWeight( )
NETGEN_3D_Parameters_1.SetCheckChartBoundary( )

i am simply an user that have struggled a lot with salome and try to help when I can…
it is said int the error message itself. it means that you have a vertex that has more than 3 faces attached to it and that the algorithm does not support it so it is not going to work (and you can not control that much the triangulation your geometry, I imagine that is a netgen result) (also not sure what it means by attached to 3 faces as this is super common in tri meshes, I should go a look at the point that it mentions in the error to understand better I personally would appreciate if you could show a screenshot of the vertex and the ‘body’ to see what it means exactly).
as I told you in my previous comments, salome is not ‘thought’ for this kind of work… so you will face problems at each step.
IMHO I would not go that route… salome is made mostly to go button up approach, from 1D to 2D to 3D, where you have something already as input.
as I said previously I am not the most experienced user, and I know salome from my uses, not every tool that exist, so I might be missing some.
now that this is clear, I would recommend:
A. go with a top down approach mesher, such as snappy or cfmesh, where you have as input a mesh
B. if you have some financing for your thesis for this kind of things (like developing/software etc) it would be awsome for the community to contact the guys at EDF/CEA to see if they could help you to develop something for this kind of workflow, saying recreation of the geometry from point cloud to a real ‘CAD’ like model which exist in other software
but I repeat myself again, I don’t know all the tools inside salome and I might be missing some.
i don’t want to break your dreams but I know rabbit holes, and this will be one, and you are in thesis there are priorities. at least discuss with the folks of salome to get their opinion!
regards and good luck!