[Gmsh] 2D Mesh (P2) has some reverse ordering, negative determinants

Christophe Geuzaine cgeuzaine at uliege.be
Mon Aug 17 13:18:56 CEST 2020



> On 15 Aug 2020, at 10:52, Marc <marc.graham at campus.tu-berlin.de> wrote:
> 
> Hello all,
> 
> 
> 
> Not sure if this is a bug, but I have been trying to figure out where some weird results are coming from and I think it is because some elements in the meshes are ordered in reverse, some of the time.  Here is a simple example:

One of your surfaces is oriented along +z, the other along -z. The mesh follows the orientation of the geometry, so the result is correct.

Change the definition of Plane 2 as follows

Plane Surface(2) = {2, 1};

to get something coherent.

Christophe


> 
> 
> 
> // Gmsh project created on Fri Aug 14 22:33:15 2020
> //+
> Point(1) = {0, 0, 0, 0.5};
> //+
> Point(2) = {0.4, 0.2, 0, 0.5};
> //+
> Point(3) = {0.6, 0.2, 0, 0.5};
> //+
> Point(4) = {1., 0, 0, 0.5};
> //+
> Point(5) = {1., 1., 0, 0.5};
> //+
> Point(6) = {0., 1., 0, 0.5};
> //+
> Point(7) = {0.4, 0.4, 0, 0.5};
> //+
> Point(8) = {0.6, 0.4, 0, 0.5};
> //+
> Line(1) = {1, 4};
> //+
> Line(2) = {4, 5};
> //+
> Line(3) = {5, 6};
> //+
> Line(4) = {6, 1};
> //+
> Line(6) = {2, 3};
> //+
> Line(7) = {3, 8};
> //+
> Line(8) = {8, 7};
> //+
> Line(9) = {7, 2};
> //+
> Curve Loop(1) = {9, 6, 7, 8};
> //+
> Plane Surface(1) = {1};
> //+
> Curve Loop(2) = {4, 1, 2, 3};
> //+
> Plane Surface(2) = {1, 2};
> //+
> Physical Curve("zero") = {4};
> //+
> Physical Curve("one") = {9, 8, 7, 6};
> //+
> Physical Surface("main") = {2, 1};
> 
> 
> 
> In my case, I am doing this with second order triangles.  The following elements are reverse ordered:
> 
> 25
> 26
> 27
> 28
> 29
> 30
> 31
> 32
> 33
> 34
> 35
> 36
> 37
> 38
> 39
> 40
> 41
> 42
> 43
> 44
> 45
> 46
> 
> According to the documentation in section "9.2.2 High-order elements": The orientation of a face is such that the computed normal points outward; the starting point is the node with the lowest index. 
> 
> But if the mesh is strictly 2D and all on one plane, I would expect the code to give all elements the same normal direction. In my example the hole and the main square have different normal directions. I think this is unexpected behaviour. 
> 
> I am using 4.6.0
> 
> Thanks for all your great work!
> 
> Regards,
> 
> Marc
> 
> 
> 
> 
> 
> 
> 
> 
> 
> <pEpkey.asc>_______________________________________________
> gmsh mailing list
> gmsh at onelab.info
> http://onelab.info/mailman/listinfo/gmsh

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






More information about the gmsh mailing list