Hi all !
I’m trying to understand how PrePoMax does its meshing and replicate it with a python program. For this, i’m using the python solutions provided by NGSolve to launch Netgen Mesher. For each shell object, the simple part of the code looks like this :
from netgen.occ import *
from netgen.meshing import *
geo = OCCGeometry(stp_file) #stp_file being a file name as str
export_meshRefinement(freecad_shape_obj, ref, refine_val, MESHSIZEFILE) #Homemade function that creates MESHSIZEFILE. This file has the exact same structure as *meshRefinement* file of PrePoMax (as I inspired myself from it). I compared their output results and they are indeed exactly the same.
param = MeshingParameters(curvaturesafety=2, segmentsperedge=2, maxh=1, meshsizefilename=MESHSIZEFILE)
mesh = geo.GenerateMesh(param)
export_mesh(mesh, "mesh.inp") #Homemade function to export a netgen mesh to abaqus .inp format, which can be interpreted by both FreeCAD and PrePoMax.
This small snippet of code creates a netgen mesh, with refinement along edges defined in ref. I don’t touch the other meshing parameters as their default values are seemingly the same as in PrePoMax.
I then input the resulting .inp mesh in PrePoMax to visualize the meshing and compare FEM results.
First of all, we can see that the mesh, even though really similar, are not perfectly the same. I thought that despite this, I could get similar results, as the differences are so small. Unfortunately, that’s not the case ! With the same simulation setup, the homemade mesh crashes whereas the PrePoMax mesh works perfectly fine.
I have found that the parameters used by PrePoMax are stored in the temp file meshParameters. For netgen, i found a list of editable parameters here, in the function Ng_SetMeshingParameters. Unfortunately, most parameters don’t have the same designation in PrePoMax’s file and in netgen’s git.
So the question is the following : what are the netgen parameters defined by PrePoMax ? is it even possible to recreate the same mesh through netgen in python or am I going for a dead end ?
As a new user, i cannot attach files, but here’s a swisstransfer link : https://www.swisstransfer.com/d/278bf3d2-ebf3-4906-ad43-25b7d94b625d. You’ll find the two .pmx files, the .inp of my homemade generated mesh and the initial .stp file.
Any hint/idea/help will be very much appreciated !