Faulty ordering of nodes in high order (p > 2) elements on 'reversed' physical surfaces
It seems that Gmsh (2.13.0) may order nodes incorrectly on 2D elements that lie on physical surfaces whose orientation has been reversed. The problem evidently occurs for elements whose polynomial order is 3 or greater. It is very apparent upon saving a '.msh' file and then viewing it with gmsh.
Below is an image of a 2D mesh of order-3 quadrilaterals. Here, the left surface was generated using a symmetry transformation through the vertical (yz-plane) of the geometry on the right.
The left surface then has clockwise orientation, and the right counterclockwise. I want them all counterclockwise for my solver, so I negate the elementary ID of the left surface when defining a physical group including both halves.
... // define geometry of right half
// Mirror lines/surfaces on the right half of the domain to the left half
mirrored_yz[] = Symmetry {1, 0, 0, 0} {
Duplicata { Line{ellipse_bnd, x_sym_l, outer_bnd};
Surface{interior_s}; }
};
ellipse_bnd_2 = mirrored_yz[0];
x_sym_l_2 = mirrored_yz[1];
outer_bnd_2 = mirrored_yz[2];
interior_s_2 = mirrored_yz[3];
// Assign physical groups (note the negations in order to achieve desired
// counterclockwise orientation of all lines and surfaces)
Physical Line("body") = {-ellipse_bnd, ellipse_bnd_2};
Physical Line("symaxis") = {x_sym_l, -x_sym_l_2};
Physical Line("farfield") = {outer_bnd, -outer_bnd_2};
Physical Surface("fluid") = {interior_s, -interior_s_2};
Recombine Surface {interior_s};
Opening the resulting .msh file in Gmsh, there is clearly an issue in rendering elements on the left half (see image below).
The problem seems to be that the nodes are ordered improperly. Taking the topmost right and left elements shown respectively, their nodes in order are (as taken from the msh file)
elem 131 (R): 124 411 34 4 941 942 943 944 45 46 141 142 945 946 947 948
elem 300 (L): 124 4 281 1846 2383 2382 2381 2380 142 141 293 292 2379 2378 2377 2376
However, referencing the image above, the nodes of element 300 on the left should be ordered (according to the documentation)
124 4 281 1846 142 141 293 292 2379 2378 2377 2376 2380 2383 2382 2381
For now, my workaround is to only do the Symmetry command on the lines and then manually define a line loop and surface with the desired orientation for the left half. Then everything seems ok.