Setting up boundary condition numbers of an STL object

More
6 years 2 months ago - 6 years 2 months ago #764 by albertsk
Dear Joachim:
I cannot thank you enough for providing such a wonderful software, netgen, which I use most of my meshing work.

I have a technical question of netgen meshing using an STL file of a plate heat exchanger.
The length and width are 1 m and the thickness is 7 mm. The top and bottom surfaces are curvy and four sides are perpendicular. So, it literally looks like a book or magazine dried after someone spilled water on it.

I was able to make a mesh directly from the STL file, using a command line with -batchmode option to netgen mesh (.vol) and neutral format. Since I have many pieces, I would like to do this without using GUI too much. As I have technically six surfaces, i.e., top, bottom, left, right, front and back. I would like to have distinct six boundary numbers. In some cases, netgen did what I expected, and I guessed that netgen understands an angle between two surfaces and assign a single boundary number per distinct surface. Unfortunately, it was not general for all the cases.

So, I would like to know if there is any method that I can assign specific boundary numbers to surfaces of unique conditions. For example, the left and right surfaces have points that have the minimum and maximum in x-axis, and similar to the front and back surfaces in y-axis.

Could you please let me know or suggest any methods?
Thank you so much.

Albert
Last edit: 6 years 2 months ago by albertsk.
More
6 years 2 months ago - 6 years 2 months ago #765 by christopher
Hi Albert,
if the mesh is ok and you just want to change the boundary conditions of some elements you can use the Python interface like this:
Code:
from netgen.csg import * from netgen.meshing import * mesh = unit_cube.GenerateMesh(maxh=0.2) isinXplane = lambda el: all((abs(mesh[v][0]) < 1e-12 for v in el.vertices)) fd_id = mesh.Add(FaceDescriptor(bc=7,domin=1,domout=0,surfnr=7)) mesh.SetBCName(fd_id-1, "new_bc") for el in mesh.Elements2D(): if isinXplane(el): el.index = fd_id

This adds boundary conditions (FaceDescriptors) to the mesh and changes the index of the desired elements to match the new bc index. The SetBCName function is 0 based and the facedescriptor index 1 based (legacy reasons...) thats why I need the -1

Best
Christopher
Last edit: 6 years 2 months ago by christopher.
More
6 years 2 months ago #1170 by albertsk
Dear Christopher:
Thank you so much!
I may need some study of python, but I think I can figure them out.
I truly appreciate your help.
Albert
Time to create page: 0.097 seconds