[Gmsh] gmsh generates corrupt 3D mesh (Re: gmsh mesh gives "Degenerate 3D element" error in Elmer)

Christophe Geuzaine cgeuzaine at ulg.ac.be
Mon Mar 4 13:43:04 CET 2013


Hi Matthias,

Did you optimize the 3D mesh (-optimize and/or -optimize_netgen on the command line, or "Optimize 3D" in the GUI) ?

Christophe

On 04 Mar 2013, at 13:27, "Zenker, Dr. Matthias" <Matthias.Zenker at erbe-med.com> wrote:

> Hi,
>  
> I have examined the problem described below more closely and found that unfortunately it seems tob e gmsh’s fault: There are tetrahedra with all 3 nodes having the same x coordinate, which seems obviously erroneous.
> To reproduce just mesh the geo file in the attachment, with everything set to default.
> I cannot tell exactly which elements are degenerate since Elmer renumbers everything. However, problematic coordinates seem to be (extract from Elmer’s error messages which give the coordinates of 3 nodes of problematic tetrahedra):
> ERROR:: ElementMetric: Degenerate 3D element: 176234
> DetG:-0.557E-18
> ElementMetric: Dir: 1 Coord: -1.40      2.15      3.50
> ElementMetric: Dir: 2 Coord: -1.40      2.15      4.00
> ElementMetric: Dir: 3 Coord: -1.40      1.66      3.75
> ERROR:: ElementMetric: Degenerate 3D element: 176887
> ElementMetric: DetG:-0.274E-18
> ElementMetric: Dir: 1 Coord: -1.40      1.67      7.75
> ElementMetric: Dir: 2 Coord: -1.40      2.15      7.50
> ElementMetric: Dir: 3 Coord: -1.40      1.80      7.25
> ERROR:: ElementMetric: Degenerate 3D element: 177378
> ElementMetric: DetG:-0.963E-19
> ElementMetric: Dir: 1 Coord: -1.40      2.15      9.50
> ElementMetric: Dir: 2 Coord: -1.40      2.15      10.0
> ElementMetric: Dir: 3 Coord: -1.40      1.67      9.75
> ERROR:: ElementMetric: Degenerate 3D element: 179163
> ElementMetric: DetG:-0.194E-17
> ElementMetric: Dir: 1 Coord:-0.900      1.80      4.25
> ElementMetric: Dir: 2 Coord:-0.900      2.15      4.00
> ElementMetric: Dir: 3 Coord:-0.900      1.67      3.75
> ERROR:: ElementMetric: Degenerate 3D element: 179367
> ElementMetric: DetG:-0.654E-19
> ElementMetric: Dir: 1 Coord:-0.900      2.15      10.0
> ElementMetric: Dir: 2 Coord:-0.900      1.67      9.75
> ElementMetric: Dir: 3 Coord:-0.900      1.80      10.3
>  
> I have tried to track down the first element (number 176234 above) in the msh file generated by gmsh, compared to the one written out by Elmergrid (which for debugging and mesh inspection purposes can write gmsh format since some time). I find all 4 nodes of the tetrahedron with x coordinate equal to -1.4 in the file written by Elmergrid. In the original msh file generated by gmsh, 3 nodes have x coordinate -1.4 and the 4th one has -1.399999999999556. I would consider this a VERY flat tetrahedron, and the height in x direction is by far smaller than the characteristic lengths I have set in the geo file. I suspect that Elmer will interpret the x coordinate as being equal due to rounding.
> I doesn’t help if I set the Min Element Size to the smallest characteristic length in Tools-Options-Mesh-General.
>  
> It is not the first time that I have this problem. In the past, it mysteriously went away sometimes after remeshing, sometimes after coarsening the characteristic lengths a bit. But this time, it won’t.
>  
> I consider this, if not a bug, then at least a problematic feature in gmsh.
> At the moment I cannot do a certain simulation due to this problem.
>  
> I would very much appreciate if someone knowledgeable could have a look on this case and fix it or state how to avoid this kind of problems.
> BTW I have used gmsh 2.6.2-svn, downloaded 31.01.2013, under Windows XP.
>  
> Thank you,
>  
> Matthias
>  
>  
>  
> _____________________________________________
> Von: Zenker, Dr. Matthias 
> Gesendet: Dienstag, 26. Februar 2013 16:26
> An: gmsh at geuz.org
> Cc: Christophe Geuzaine [cgeuzaine at ulg.ac.be] (cgeuzaine at ulg.ac.be)
> Betreff: gmsh mesh gives "Degenerate 3D element" error in Elmer
>  
>  
> Hi,
>  
> I have a problem with a 3D mesh generated by gmsh: I get a Degenerate 3D element" error when I use this mesh with the Elmer FEM software. The mesh is produced when I mesh the attached geo file , just using the default settings in gmsh (2.6.2-svn, Windows XP).
> My questions are:
>  
> 	• How can I find out if there are degenerate elements? Is there a way to check the mesh quality in gmsh?
> 	• What can I do to avoid degenerate elements?
>  
> Thank you for helpful hints,
>  
> Matthias
>  
> < Datei: test.geo >>
>  
> 
> 
> _____________________________________________________________________
> ERBE Elektromedizin GmbH
> Firmensitz: 72072 Tuebingen
> Geschaeftsfuehrer: Christian O. Erbe, Reiner Thede
> Registergericht: Stuttgart HRB 380137

-- 
Prof. Christophe Geuzaine
University of Liege, Electrical Engineering and Computer Science 
http://www.montefiore.ulg.ac.be/~geuzaine