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

Marc marc.graham at campus.tu-berlin.de
Sat Aug 15 10:52:42 CEST 2020

```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:

// 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

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://onelab.info/pipermail/gmsh/attachments/20200815/3d3ab309/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pEpkey.asc
Type: application/pgp-keys
Size: 2460 bytes
Desc: not available
URL: <http://onelab.info/pipermail/gmsh/attachments/20200815/3d3ab309/attachment.asc>
```