[Gmsh] negative volume tets in MEDIT .mesh output

Geordie McBain gdmcbain at freeshell.org
Tue Jun 30 06:56:47 CEST 2009


Hello.  I'm sometimes finding I get negative volume tetrahedral
elements when saving in MEDIT .mesh format; i.e. the vertices are
sometimes in the wrong order.  I can demonstrate this most simply by
appending the following lines to t2.geo; e.g. by saving them in
myt2.geo and calling the lot with "gmsh t2.geo myt2.geo":

Mesh 3;
Mesh.Format = 30;
Save "first.mesh";
Mesh.Format = 1;
Save "myt2.msh";
Mesh.Format = 30;
Save "myt2.mesh";
Exit;

This produces two .mesh files and one .msh.  The two .mesh files are
identical in every respect except that the first and second vertices
of each tetrahedron have been swapped.  Thus those of the first .mesh
file have negative volume.  (I believe the MEDIT .mesh file format has
the same tetrahedron node-numbering convention as Gmsh.  This is
supported by integrating over the volumes in FreeFem++, which reads
.mesh files.  Meshes with negative-volume elements don't work well in
finite element solutions in FreeFem++.)  The lines 1989--1993 of the
two files are:

Tetrahedra
 8429
 1488 423 1489 1577 119
 448 1029 374 398 119
 1313 1312 1272 1311 119

Tetrahedra
 8429
 423 1488 1489 1577 119
 1029 448 374 398 119
 1312 1313 1272 1311 119

The second ("myt2.mesh"), is correct, and corresponds closely to
2042--2044 of the myt2.msh file:

185 4 3 1 119 0 423 1488 1489 1577
186 4 3 1 119 0 1029 448 374 398
187 4 3 1 119 0 1312 1313 1272 1311

>From the command line ("gmsh -3 -format mesh t2.geo"), I get different
results (a different number of vertices and tetrahedra), but again
negative volumes.

Am I doing something wrong here?  How can I ensure my .mesh file has a
consistent node-numbering of its tetrahedra?

The above results are with Gmsh 2.3.1 compiled from source on openSUSE
10.2.  If I run on Ubuntu Hardy using the gmsh package (v. 2.2.5), I
get different results: for first.mesh there are a mixture of positive
and negative volume tetrahedra, but myt2.mesh comes out consistently
positive again.

Geordie McBain
http://gdmcbain.freeshell.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: myt2.geo
Type: application/octet-stream
Size: 121 bytes
Desc: not available
URL: <http://www.geuz.org/pipermail/gmsh/attachments/20090630/e759a8b3/attachment.geo>