Loop over different Mesh.MeshSizeMax in python API
Hi, again: great project!
I want to loop over some mesh sizes until one of the meshes is generated succesfully. I am doing this like this:
meshsizes = np.linspace(2.5,8.5,16)
for i_count in meshsizes:
gmsh.option.setNumber("Mesh.MeshSizeMax", i_count)
try:
gmsh.model.mesh.generate(2)
except:
print("Failed with mesh size "+ str(i_count))
gmsh.model.mesh.clear()
time.sleep(3)
continue
print("Succeeded with mesh size "+ str(i_count))
time.sleep(3)
break
gmsh.write("test.msh")
gmsh.finalize()
But it tells me that it is busy, after the exception is thrown:
Info : [ 10%] Meshing surface 764 (Cylinder, Frontal-Delaunay)
Info : [ 10%] Meshing surface 765 (Cylinder, Frontal-Delaunay)
Info : [ 10%] Meshing surface 766 (BSpline surface, Frontal-Delaunay)
Error : The 1D mesh seems not to be forming a closed loop (2 boundary nodes are considered once)
Failed with mesh size 2.5
Info : [ 10%] I'm busy! Ask me that later...
Succeeded with mesh size 2.9
Info : Writing 'test.msh'...
Info : Done writing 'test.msh'
Am I doing something wrong, here? Reloading the .stp file would solve this, but it will cost me some time, because it is huge.
Thanks!