[Gmsh] Segmentation fault with -optimize_netgen. gmsh 2.6.1-source.

"А.С. Хорошев" vskych at gmail.com
Wed Oct 3 13:44:11 CEST 2012


Hello! I built GMSH-2.6.1 with options: Ann Bamg Bfgs Blas Blossom Chaco 
DIntegration Dlopen FlTree Fltk GMP Gmm Have64BitSizeT Jpeg Kbipack 
Lapack MPI MathEx Mesh Metis Mmg3d Mpeg NativeFileChooser Netgen OSMesa 
OneLab OpenGL OptHom PETSc Parser Plugins Png Post RTree SLEPc Solver 
Tetgen(1.5) Voro3D Zlib.
I have a file:
----------
cl = 0.25;
R = 1;
P_c = newp; Point (P_c) = {0, 0, 0, cl};
P_sm = newp; Point (P_sm) = {0, R, 0, cl};
temp_mas[] = Rotate {{ 0, 0, 10},{0, 0, 0}, -2*Pi/3} { Duplicata { 
Point{P_sm}; } };
P_s1 = newp; P_s1 = temp_mas[0];
temp_mas[] = Rotate {{ 0, 0, 10},{0, 0, 0}, 2*Pi/3} { Duplicata { 
Point{P_sm}; } };
P_s2 = newp; P_s2 = temp_mas[0];
     Circ_s_1 = newreg; Circle (Circ_s_1) = {P_s1, P_c, P_s2};
     Circ_s_2 = newreg; Circle (Circ_s_2) = {P_s2, P_c, P_sm};
     Circ_s_3 = newreg; Circle (Circ_s_3) = {P_sm, P_c, P_s1};
     line_loop_s = newreg; Line Loop (line_loop_s) = {Circ_s_1, 
Circ_s_2, Circ_s_3};
     Surface_s = newreg; Plane Surface (Surface_s) = {line_loop_s};
ee = 0;
tt[] = Extrude {0, 0, 2} {Surface{Surface_s};};
         For kk In {2:4}
             side[ee] = tt[kk];
             ee++;
         EndFor
in_vol = tt[1];
Surface_en = tt[0];

/*
R_ex = 5*R;
P_c_ex = newp; Point (P_c_ex) = {0, 0, -5, cl};
P_sm_ex = newp; Point (P_sm_ex) = {0, R_ex, -5, cl};
temp_mas[] = Rotate {{ 0, 0, 10},{0, 0, 0}, -2*Pi/3} { Duplicata { 
Point{P_sm_ex}; } };
P_s1_ex = newp; P_s1_ex = temp_mas[0];
temp_mas[] = Rotate {{ 0, 0, 10},{0, 0, 0}, 2*Pi/3} { Duplicata { 
Point{P_sm_ex}; } };
P_s2_ex = newp; P_s2_ex = temp_mas[0];
     Circ_s_1_ex = newreg; Circle (Circ_s_1_ex) = {P_s1_ex, P_c_ex, 
P_s2_ex};
     Circ_s_2_ex = newreg; Circle (Circ_s_2_ex) = {P_s2_ex, P_c_ex, 
P_sm_ex};
     Circ_s_3_ex = newreg; Circle (Circ_s_3_ex) = {P_sm_ex, P_c_ex, 
P_s1_ex};
     line_loop_s_ex = newreg; Line Loop (line_loop_s_ex) = {Circ_s_1_ex, 
Circ_s_2_ex, Circ_s_3_ex};
     Surface_s_ex = newreg; Plane Surface (Surface_s_ex) = {line_loop_s_ex};
ee = 0;
tt[] = Extrude {0, 0, 12} {Surface{Surface_s_ex};};
         For kk In {2:4}
             side_ex[ee] = tt[kk];
             ee++;
         EndFor
ex_vol = tt[1];
Surface_ex_en = tt[0];
*/
esp = newreg; Surface Loop (esp) = {Surface_s,Surface_en, 
/*Surface_s_ex, Surface_ex_en, side_ex[],*/ side[]};
bv = newreg; Volume(bv) = {esp};
air_vol = newreg;
Physical Volume (air_vol)= {bv};
-----------------
If I use the command "gmsh example.geo -3 -optimize_netgen" with this 
file, that all good, but if I uncomment the second part of the file 
(delete two "/* */" areas), the gmsh crashes with message "Segmentation 
fault (core dumped)". See log:
----------
gmsh compound.geo -3 -optimize_netgen
Info    : Running 'gmsh compound.geo -3 -optimize_netgen' [1 node(s), 
max. 1 thread(s)]
....
....
Info    : 0.95 -    1: 0
Info    : total error: 0
Info    : Optimizing volume 46
Info    : CalcLocalH: 12839 Points 51211 Elements 19804 Surface Elements
Info    : Remove Illegal Elements
Info    : 763 illegal tets
Info    : SplitImprove
Info    : badmax = 5.14894e+35
Segmentation fault
-----------
Also, if I use MMG3D the gmsh crashes too in any case:
-----
Info    : 13998 points 0 edges and 19804 faces in the final mesh
   -- MMG3d, Release 4.0 c (July 20, 2010)
      Copyright (c) LJLL/IMB, 2010
      Jeu 26 avr 2012 18:59:04 CEST

   -- MESH QUALITY   55459
      AVERAGE QUALITY              2.2162
      BEST  ELEMENT QUALITY        1.0053
      WORST ELEMENT QUALITY       20.7485
      WORST ELEMENT   29349 (29349)   12717 12268 7876 13953

&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
    MODULE MMG3D-LJLL/IMB : 4.0 c (July 20, 2010)  ANISO
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
   MAXIMUM NUMBER OF POINTS    (NPMAX) :  1000000
   MAXIMUM NUMBER OF TRIANGLES (NTMAX) :   700000
   MAXIMUM NUMBER OF ELEMENTS  (NEMAX) :  7000000
   ** WARNING: -18484 NON-BOUNDARY TRIANGLES : SEVERAL SD CONSIDERED 
(19144 660)
   ## memory alloc problem (hash)
*** glibc detected *** gmsh: free(): invalid next size (normal): 
0x0000000002c49ef0 ***
======= Backtrace: =========
/lib/x86_64-linux-gnu/libc.so.6(+0x7ec96)[0x7fc56a137c96]
/usr/lib/libmmg3dlib4.0.so(M_free+0x4d)[0x7fc56ce9cb4d]
/usr/lib/libmmg3dlib4.0.so(MMG_seedTria+0x1ea)[0x7fc56ce9a3ba]
/usr/lib/libmmg3dlib4.0.so(MMG_markBdry+0x2e1)[0x7fc56ce9a741]
/usr/lib/libmmg3dlib4.0.so(MMG_mmg3dlib+0x3b9)[0x7fc56cebce39]
gmsh(_Z13refineMeshMMGP7GRegion+0xfdb)[0x7b4d5b]
gmsh(_Z18MeshDelaunayVolumeRSt6vectorIP7GRegionSaIS1_EE+0x1409)[0x796e09]
gmsh(_Z12GenerateMeshP6GModeli+0xf06)[0x72cfe6]
gmsh(_ZN6GModel4meshEi+0x9)[0x642a29]
gmsh(_Z9GmshBatchv+0x237)[0x556617]
gmsh(main+0x6c)[0x54c74c]
/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xed)[0x7fc56a0da76d]
gmsh[0x555e81]
---
or:
----
Info    : 387 points 0 edges and 660 faces in the final mesh
   -- MMG3d, Release 4.0 c (July 20, 2010)
      Copyright (c) LJLL/IMB, 2010
      Jeu 26 avr 2012 18:59:04 CEST

   -- MESH QUALITY   1223
      AVERAGE QUALITY              1.6383
      BEST  ELEMENT QUALITY        1.0241
      WORST ELEMENT QUALITY        5.9574
      WORST ELEMENT   836 (836)   333 266 220 254

&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
    MODULE MMG3D-LJLL/IMB : 4.0 c (July 20, 2010)  ANISO
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
   MAXIMUM NUMBER OF POINTS    (NPMAX) :  1000000
   MAXIMUM NUMBER OF TRIANGLES (NTMAX) :   700000
   MAXIMUM NUMBER OF ELEMENTS  (NEMAX) :  7000000
            9 INSERTED       42 REMOVED       38 FILTERED

   -- MESH QUALITY   947
      AVERAGE QUALITY              2.1583
      BEST  ELEMENT QUALITY        1.0246
      WORST ELEMENT QUALITY        6.7119
      WORST ELEMENT   977 (740)   56 331 335 371

   -- RESULTING EDGE LENGTHS  641
      AVERAGE LENGTH               1.2642
      SMALLEST EDGE LENGTH         0.1170      312     96
      LARGEST  EDGE LENGTH         2.8640      335     88
      EFFICIENCY INDEX             0.7482
      0.71 < L < 1.41       353   55.07 %

   -- ANISOTROPIC RATIO OBTAINED   947
       AVERAGE RATIO             3.4648
      SMALLEST RATIO             1.2476
       LARGEST RATIO            13.3372
            ELEMENT   969 (733)   56 335 156 371

&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
    END OF MODULE MMG3D
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
Info    : MMG3D succeeded (ITER=0) 355 vertices 947 tetrahedra
   -- MMG3d, Release 4.0 c (July 20, 2010)
      Copyright (c) LJLL/IMB, 2010
      Jeu 26 avr 2012 18:59:04 CEST

   -- MESH QUALITY   947
      AVERAGE QUALITY              2.1583
      BEST  ELEMENT QUALITY        1.0246
      WORST ELEMENT QUALITY        6.7119
      WORST ELEMENT   740 (740)   56 303 307 341

&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
    MODULE MMG3D-LJLL/IMB : 4.0 c (July 20, 2010)  ANISO
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
   MAXIMUM NUMBER OF POINTS    (NPMAX) :  1000000
   MAXIMUM NUMBER OF TRIANGLES (NTMAX) :   700000
   MAXIMUM NUMBER OF ELEMENTS  (NEMAX) :  7000000

   -- MESH QUALITY   947
      AVERAGE QUALITY              2.1518
      BEST  ELEMENT QUALITY        1.0246
      WORST ELEMENT QUALITY        6.7119
      WORST ELEMENT   740 (736)   56 303 307 341

   -- RESULTING EDGE LENGTHS  641
      AVERAGE LENGTH               1.6228
      SMALLEST EDGE LENGTH         0.1316      344    341
      LARGEST  EDGE LENGTH         4.5027      242    102
      EFFICIENCY INDEX             0.7014
      0.71 < L < 1.41       264   41.19 %

   -- ANISOTROPIC RATIO OBTAINED   947
       AVERAGE RATIO             3.4552
      SMALLEST RATIO             1.2476
       LARGEST RATIO            13.3372
            ELEMENT   733 (729)   56 307 144 341

&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
    END OF MODULE MMG3D
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
Info    : MMG3D succeeded (ITER=1) 355 vertices 947 tetrahedra
   ## SEGMENTATION FAULT. STOP
----------
What I doing wrong?