Random infinit loop during gmsh.model.mesh.generate(3) for specific models
Hi, I am now faced with a mystery problem in generating mesh. I use python API to call gmsh but I don't think the problem is resulted by python.
The problem is, for some models, sometimes, the call to gmsh.model.mesh.generate(3)
never end. To debug the problem, I had set General.Verbosity
to 10
. The log seem to suggest that the infinity lies in the mesh improving stage:
(The meshing algorithm is HXT.)
(version: the current git version-2022-1-24 23:11:20)
The normal log:
22:42:58 DEBUG: 180 entities in model
22:42:58 INFO: Backgroud size filed number: #1
22:42:58 INFO: Performing mesh operation, please be patient ...
[gmsh.model.mesh.generate(3) called here]
Info : Meshing 1D...
Info : [ 0%] Meshing curve 3 (Line)
Info : [ 0%] Meshing curve 1 (Line)
Info : [ 0%] Meshing curve 4 (Line)
Info : [ 0%] Meshing curve 7 (Line)
Info : [ 0%] Meshing curve 8 (Line)
Info : [ 0%] Meshing curve 2 (Line)
Info : [ 0%] Meshing curve 6 (Line)
Info : [ 0%] Meshing curve 5 (Line)
Info : [ 10%] Meshing curve 9 (Circle)
Info : [ 10%] Meshing curve 10 (Line)
Info : [ 10%] Meshing curve 11 (Circle)
Info : [ 10%] Meshing curve 12 (BSpline)
Info : [ 10%] Meshing curve 13 (BSpline)
Info : [ 10%] Meshing curve 14 (BSpline)
Info : [ 10%] Meshing curve 15 (Circle)
Info : [ 10%] Meshing curve 16 (Line)
Info : [ 20%] Meshing curve 17 (Circle)
Info : [ 20%] Meshing curve 18 (BSpline)
Info : [ 20%] Meshing curve 19 (BSpline)
Info : [ 20%] Meshing curve 20 (Line)
Info : [ 20%] Meshing curve 21 (Line)
Info : [ 20%] Meshing curve 22 (Line)
Info : [ 20%] Meshing curve 23 (Line)
Info : [ 20%] Meshing curve 24 (Circle)
Info : [ 20%] Meshing curve 25 (Line)
Info : [ 30%] Meshing curve 26 (BSpline)
Info : [ 30%] Meshing curve 27 (Circle)
Info : [ 30%] Meshing curve 28 (Line)
Info : [ 40%] Meshing curve 35 (BSpline)
Info : [ 30%] Meshing curve 30 (Circle)
Info : [ 30%] Meshing curve 31 (Line)
Info : [ 30%] Meshing curve 32 (Circle)
Info : [ 30%] Meshing curve 33 (Line)
Info : [ 30%] Meshing curve 34 (Circle)
Info : [ 30%] Meshing curve 29 (Circle)
Info : [ 40%] Meshing curve 36 (BSpline)
Info : [ 40%] Meshing curve 37 (BSpline)
Info : [ 40%] Meshing curve 38 (Circle)
Info : [ 40%] Meshing curve 39 (Line)
Info : [ 40%] Meshing curve 40 (Circle)
Info : [ 40%] Meshing curve 41 (Line)
Info : [ 40%] Meshing curve 42 (Circle)
Info : [ 40%] Meshing curve 43 (Circle)
Info : [ 50%] Meshing curve 44 (Circle)
Info : [ 50%] Meshing curve 45 (Line)
Info : [ 50%] Meshing curve 52 (Line)
Info : [ 50%] Meshing curve 47 (Circle)
Info : [ 50%] Meshing curve 48 (Line)
Info : [ 50%] Meshing curve 49 (Circle)
Info : [ 50%] Meshing curve 50 (Line)
Info : [ 50%] Meshing curve 51 (Circle)
Info : [ 50%] Meshing curve 46 (Line)
Info : [ 60%] Meshing curve 53 (Circle)
Info : [ 60%] Meshing curve 54 (Circle)
Info : [ 60%] Meshing curve 55 (Line)
Info : [ 60%] Meshing curve 56 (Circle)
Info : [ 60%] Meshing curve 57 (Circle)
Info : [ 60%] Meshing curve 58 (Circle)
Info : [ 60%] Meshing curve 59 (Line)
Info : [ 60%] Meshing curve 60 (Circle)
Info : [ 70%] Meshing curve 61 (Line)
Info : [ 70%] Meshing curve 62 (Circle)
Info : [ 70%] Meshing curve 63 (Circle)
Info : [ 80%] Meshing curve 70 (Line)
Info : [ 70%] Meshing curve 65 (Circle)
Info : [ 70%] Meshing curve 66 (Line)
Info : [ 70%] Meshing curve 67 (Circle)
Info : [ 70%] Meshing curve 68 (Line)
Info : [ 70%] Meshing curve 69 (Line)
Info : [ 70%] Meshing curve 64 (Circle)
Info : [ 80%] Meshing curve 71 (Line)
Info : [ 80%] Meshing curve 72 (Line)
Info : [ 90%] Meshing curve 79 (Line)
Info : [ 80%] Meshing curve 74 (Line)
Info : [ 80%] Meshing curve 75 (Line)
Info : [ 80%] Meshing curve 76 (Line)
Info : [ 80%] Meshing curve 77 (Line)
Info : [ 80%] Meshing curve 78 (Line)
Info : [ 80%] Meshing curve 73 (Line)
Info : [ 90%] Meshing curve 80 (Line)
Info : [ 90%] Meshing curve 81 (Line)
Info : [ 90%] Meshing curve 82 (Line)
Info : [ 90%] Meshing curve 83 (Line)
Info : [ 90%] Meshing curve 84 (Line)
Info : [ 90%] Meshing curve 85 (Line)
Info : [ 90%] Meshing curve 86 (Circle)
Info : [ 90%] Meshing curve 87 (Line)
Info : [100%] Meshing curve 88 (Circle)
Info : Done meshing 1D (Wall 0.156079s, CPU 0.015625s)
Info : Meshing 2D...
Info : [ 0%] Meshing surface 3 (Cone, Frontal-Delaunay)
Info : [ 0%] Meshing surface 4 (Plane, Frontal-Delaunay)
Info : [ 0%] Meshing surface 1 (Plane, Frontal-Delaunay)
Info : [ 0%] Meshing surface 2 (Plane, Frontal-Delaunay)
Info : [ 0%] Meshing surface 5 (Cylinder, Frontal-Delaunay)
Info : [ 0%] Meshing surface 6 (Plane, Frontal-Delaunay)
Info : [ 0%] Meshing surface 7 (Cylinder, Frontal-Delaunay)
Info : [ 0%] Meshing surface 8 (Cylinder, Frontal-Delaunay)
Info : [ 10%] Meshing surface 9 (Cone, Frontal-Delaunay)
Info : [ 10%] Meshing surface 10 (Cone, Frontal-Delaunay)
Info : [ 30%] Meshing surface 14 (Cylinder, Frontal-Delaunay)
Info : [ 40%] Meshing surface 17 (Plane, Frontal-Delaunay)
Info : [ 20%] Meshing surface 13 (Cone, Frontal-Delaunay)
Info : [ 20%] Meshing surface 11 (Cylinder, Frontal-Delaunay)
Info : [ 30%] Meshing surface 15 (Plane, Frontal-Delaunay)
Info : [ 30%] Meshing surface 16 (Plane, Frontal-Delaunay)
Info : [ 20%] Meshing surface 12 (Plane, Frontal-Delaunay)
Info : [ 40%] Meshing surface 18 (Torus, Frontal-Delaunay)
Info : [ 40%] Meshing surface 19 (Cylinder, Frontal-Delaunay)
Info : [ 50%] Meshing surface 20 (Torus, Frontal-Delaunay)
Info : [ 50%] Meshing surface 21 (Plane, Frontal-Delaunay)
Info : [ 60%] Meshing surface 22 (Cylinder, Frontal-Delaunay)
Info : [ 60%] Meshing surface 23 (Torus, Frontal-Delaunay)
Info : [ 60%] Meshing surface 24 (Cylinder, Frontal-Delaunay)
Info : [ 70%] Meshing surface 25 (Torus, Frontal-Delaunay)
Info : [ 70%] Meshing surface 26 (Cylinder, Frontal-Delaunay)
Info : [ 70%] Meshing surface 27 (Plane, Frontal-Delaunay)
Info : [ 80%] Meshing surface 28 (Cylinder, Frontal-Delaunay)
Info : Done meshing 2D (Wall 0.664992s, CPU 1.375s)
Info : Meshing 3D...
Info : 3D Meshing 1 volume with 1 connected component
Info : Creating an empty mesh with 22345 vertices
Info : Reordering points from 0 to 22345
Info : Initialization of tet. mesh
Info : Initialization reserved 244216 Tet.
Info : Delaunay of 22341 points on 8 threads - mesh.nvert: 4
Info : 1 thrd | 393/393 -> 100.0%
Info : 1 thrd | 2582/2582 -> 100.0%
Info : 8 thrd | 7035/19366 -> 36.3%
Info : 4 thrd | 1478/12331 -> 12.0%
Info : 2 thrd | 2121/10853 -> 19.5%
Info : 1 thrd | 8732/8732 -> 100.0%
Info : Reordering tetrahedra (reproducible==true)
Info : Empty mesh finished
Info : Recovering 8 missing facet(s)
Info : Recover Delaunay
Info : Constrained lines and triangles recovered
Info : All volumes of the BRep were found and colorized accordingly
Info : Computing interpolated mesh sizes...
Info : Done computing interpolated mesh sizes
Info : Refinement adds 51677 points from 487958 tetrahedra
Info : Reordering points from 22345 to 74022
Info : Delaunay of 51677 points on 8 threads - mesh.nvert: 22345
Info : 1 thrd | 756/756 -> 100.0%
Info : 2 thrd | 2215/2309 -> 95.9%
Info : 1 thrd | 64/64 -> 100.0%
Info : 8 thrd | 2856/5057 -> 56.5%
Info : 1 thrd | 778/778 -> 100.0%
Info : - 45008 points filtered
Info : = 6669 points added
Info : mem. allocated: 0.05GB - mesh.ntet: 528040 - mesh.nvert: 29014
Info : Reordering tetrahedra (reproducible==true)
Info : Computing interpolated mesh sizes...
Info : Done computing interpolated mesh sizes
Info : Refinement adds 52618 points from 528040 tetrahedra
Info : Reordering points from 29014 to 81632
Info : Delaunay of 52618 points on 8 threads - mesh.nvert: 29014
Info : 8 thrd | 9296/16531 -> 56.2%
Info : 2 thrd | 3820/4184 -> 91.3%
Info : 1 thrd | 200/200 -> 100.0%
Info : - 39302 points filtered
Info : = 13316 points added
Info : mem. allocated: 0.05GB - mesh.ntet: 617017 - mesh.nvert: 42330
Info : Reordering tetrahedra (reproducible==true)
Info : Computing interpolated mesh sizes...
Info : Done computing interpolated mesh sizes
Info : Refinement adds 31688 points from 617017 tetrahedra
Info : Reordering points from 42330 to 74018
Info : Delaunay of 31688 points on 8 threads - mesh.nvert: 42330
Info : 8 thrd | 8492/11238 -> 75.6%
Info : 1 thrd | 1679/1679 -> 100.0%
Info : - 21517 points filtered
Info : = 10171 points added
Info : mem. allocated: 0.05GB - mesh.ntet: 683179 - mesh.nvert: 52501
Info : Reordering tetrahedra (reproducible==true)
Info : Computing interpolated mesh sizes...
Info : Done computing interpolated mesh sizes
Info : Refinement adds 4199 points from 683179 tetrahedra
Info : Reordering points from 52501 to 56700
Info : Delaunay of 4199 points on 2 threads - mesh.nvert: 52501
Info : 2 thrd | 2333/2422 -> 96.3%
Info : 1 thrd | 69/69 -> 100.0%
Info : - 1797 points filtered
Info : = 2402 points added
Info : mem. allocated: 0.05GB - mesh.ntet: 697967 - mesh.nvert: 54903
Info : Reordering tetrahedra (reproducible==true)
Info : Computing interpolated mesh sizes...
Info : Done computing interpolated mesh sizes
Info : Refinement adds 276 points from 697967 tetrahedra
Info : Reordering points from 54903 to 55179
Info : Delaunay of 276 points on 1 threads - mesh.nvert: 54903
Info : 1 thrd | 222/222 -> 100.0%
Info : - 54 points filtered
Info : = 222 points added
Info : mem. allocated: 0.05GB - mesh.ntet: 699307 - mesh.nvert: 55125
Info : Computing interpolated mesh sizes...
Info : Done computing interpolated mesh sizes
Info : Refinement adds 12 points from 699307 tetrahedra
Info : Reordering points from 55125 to 55137
Info : Delaunay of 12 points on 1 threads - mesh.nvert: 55125
Info : 1 thrd | 10/10 -> 100.0%
Info : - 2 points filtered
Info : = 10 points added
Info : mem. allocated: 0.05GB - mesh.ntet: 699362 - mesh.nvert: 55135
Info : Computing interpolated mesh sizes...
Info : Done computing interpolated mesh sizes
Info : Refinement adds 2 points from 699362 tetrahedra
Info : Reordering points from 55135 to 55137
Info : Delaunay of 2 points on 1 threads - mesh.nvert: 55135
Info : 1 thrd | 2/2 -> 100.0%
Info : Computing interpolated mesh sizes...
Info : Done computing interpolated mesh sizes
Info : Refinement adds 0 points from 699372 tetrahedra
Info : Mesh refinement finished
Info : Improving 9875 tet. on 8 thrd (S & ER)
Info : 8 thrd | 9233/9567 281 conflicts
Info : 2 thrd | 250/276 20 conflicts
Info : 1 thrd | 20/20 0 conflicts
Info : Improving 356 tet. on 8 thrd (S & ER)
Info : 2 thrd | 278/352 4 conflicts
Info : 1 thrd | 3/4 0 conflicts
Info : Improving 91 tet. on 8 thrd (S & ER)
Info : 1 thrd | 17/91 0 conflicts
Info : Improving 76 tet. on 8 thrd (S & ER)
Info : 1 thrd | 0/76 0 conflicts
Info : Improving 76 tet. on 8 thrd (GSC)
Info : 8 thrd | 53/74 20 conflicts
Info : 2 thrd | 2/20 10 conflicts
Info : 1 thrd | 1/10 0 conflicts
Info : Improving 20 tet. on 8 thrd (S & ER)
Info : 1 thrd | 3/20 0 conflicts
Info : Improving 21 tet. on 8 thrd (S & ER)
Info : 1 thrd | 1/21 0 conflicts
Info : Improving 20 tet. on 8 thrd (S & ER)
Info : 1 thrd | 0/20 0 conflicts
Info : Improving 20 tet. on 8 thrd (GSC)
Info : 2 thrd | 1/20 9 conflicts
Info : 1 thrd | 0/9 0 conflicts
Info : Improving 19 tet. on 8 thrd (S & ER)
Info : 1 thrd | 0/19 0 conflicts
Info : 19 bad tet. | mean quality: 0.663946 | min quality: 0.0708064
Info : Mesh improvement finished
Info : Final tet. mesh contains 691081 tetrahedra
Info : Final tet. mesh contains 55137 vertices
Info : tEmptyMesh = 0.263
Info : tVerifyBnd = 0.024
Info : tBndRecovery = 0.400
Info : tConvertMesh = 0.047
Info : tRefine = 0.693
Info : tOptimize = 0.121
Info : Mesh generated
Info : Done meshing 3D (Wall 1.61906s, CPU 2.125s)
Info : 56224 nodes 318770 elements
22:43:01 INFO: Tidy duplicate nodes in mesh ...
Info : Removing duplicate mesh nodes...
Info : Found 10 duplicate nodes
Info : Removed 10 duplicate mesh nodes
Info : Done removing duplicate mesh nodes
22:43:01 INFO: Generating mesh finished
The infinite log:
[The earlier log is identical with the above normal log]
Info : Delaunay of 1 points on 1 threads - mesh.nvert: 55202
Info : 1 thrd | 1/1 -> 100.0%
Info : Computing interpolated mesh sizes...
Info : Done computing interpolated mesh sizes
Info : Refinement adds 0 points from 699676 tetrahedra
Info : Mesh refinement finished
Info : Improving 9705 tet. on 8 thrd (S & ER)
Info : 8 thrd | 9062/9418 305 conflicts
Info : 2 thrd | 279/298 16 conflicts
Info : 1 thrd | 16/16 0 conflicts
Info : Improving 383 tet. on 8 thrd (S & ER)
Info : 2 thrd | 294/378 3 conflicts
Info : 1 thrd | 3/3 0 conflicts
Info : Improving 109 tet. on 8 thrd (S & ER)
Info : 1 thrd | 25/109 0 conflicts
Info : Improving 87 tet. on 8 thrd (S & ER)
Info : 1 thrd | 3/87 0 conflicts
Info : Improving 84 tet. on 8 thrd (S & ER)
Info : 1 thrd | 0/84 0 conflicts
Info : Improving 84 tet. on 8 thrd (GSC)
Info : 8 thrd | 58/83 17 conflicts
Info : 2 thrd | 0/0 0 conflicts
Info : 2 thrd | 0/0 0 conflicts
Info : 2 thrd | 0/0 0 conflicts
Info : 2 thrd | 0/0 0 conflicts
Info : 2 thrd | 0/0 0 conflicts
Info : 2 thrd | 0/0 0 conflicts
Info : 2 thrd | 0/0 0 conflicts
[below this line I got 10k+ identical lines]
It seems that the gmsh is trying to optimize a few cells forever.
Other clues about this include:
- When the multithread function is turned on, maybe it's easier to be traped in such a loop, but I am not so sure.
- For some models, such a problem merely happens, while for other models the case is easy to happen. I am sure the model in question is not the only one, but due to data privacy issues, I cannot post the model here.
- I noticed this issue during the attempt to use the multithreaded HXT algorithm, but I think such cases had happened earlier.
I am not sure if this is bug, or there is some configuration to help me out.