75 Elments found with wrong node order in the .vtu file converted by the .msh file using GMSH2OGS

Hi everyone,

I have encountered some problems using Gmsh for preprocessing.

First, I used Gmsh to generate a PJ.geo file, and then exported the corresponding PJ.msh file (Version 2 ASCII format).

Afterwards, I successfully converted the PJ.msh file to a PJ.vtu file using the following command:

PS D:\Projects> .\GMSH2OGS -i PJ.msh -o PJ.vtu -e

To ensure the PJ.vtu file was correct, I executed the following command:

PS D:\Projects> .\checkMesh PJ.vtu -p -v

However, the following error message appeared:

[2026-04-20 16:56:21.114] [ogs] [info] 75 elements found with wrong node order.
ElementIDs: 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 340, 341, 342, 343, 344, 345, 346, 347, 348, 349, 350, 351, 352, 353, 354, 355, 356, 357, 358, 359, 430, 431, 432, 433, 434, 435, 436, 437, 438, 439, 440, 441, 442, 443, 444, 445, 446, 447, 448, 449, 450, 451, 452, 453, 454, 455, 456, 457, 458, 459, 460, 461, 462, 463, 464, 465, 466, 467, 468, 469, 470, 471, 472, 473, 474,

I am not sure which step or part is causing the problem. The PJ.geo file is attached below.

// Gmsh project created on Mon Apr 20 13:44:26 2026
SetFactory(“OpenCASCADE”);
//+
Point(1) = {0, 0, 0, 1};
//+
Point(2) = {0, 0.75e-2, 0, 1};
//+
Point(3) = {0, -0.75e-2, 0, 1};
//+
Point(4) = {0, 10e-2, 0, 1};
//+
Point(5) = {0, -7e-2, 0, 1};
//+
Point(6) = {5e-2, 0, 0, 1};
//+
Point(7) = {5e-2, 0.75e-2, 0, 1};
//+
Point(8) = {5e-2, -0.75e-2, 0, 1};
//+
Point(9) = {5e-2, 10e-2, 0, 1};
//+
Point(10) = {5e-2, -7e-2, 0, 1};
//+
Point(11) = {15e-2, 0, 0, 1};
//+
Point(12) = {15e-2, 0.75e-2, 0, 1};
//+
Point(13) = {15e-2, -0.75e-2, 0, 1};
//+
Point(14) = {15e-2, 10e-2, 0, 1};
//+
Point(15) = {15e-2, -7e-2, 0, 1};
//+
Point(16) = {26.5e-2, 0, 0, 1};
//+
Point(17) = {26.5e-2, 0.75e-2, 0, 1};
//+
Point(18) = {26.5e-2, -0.75e-2, 0, 1};
//+
Point(19) = {26.5e-2, 10e-2, 0, 1};
//+
Point(20) = {26.5e-2, -7e-2, 0, 1};

//+
Line(1) = {4, 2};
//+
Line(2) = {1, 2};
//+
Line(3) = {1, 3};
//+
Line(4) = {3, 5};
//+
Line(5) = {5, 10};
//+
Line(6) = {10, 15};
//+
Line(7) = {15, 20};
//+
Line(8) = {20, 18};
//+
Line(9) = {18, 16};
//+
Line(10) = {16, 17};
//+
Line(11) = {17, 19};
//+
Line(12) = {19, 14};
//+
Line(13) = {9, 14};
//+
Line(14) = {9, 4};
//+
Line(15) = {2, 7};
//+
Line(16) = {7, 12};
//+
Line(17) = {12, 17};
//+
Line(18) = {1, 6};
//+
Line(19) = {6, 11};
//+
Line(20) = {11, 16};
//+
Line(21) = {3, 8};
//+
Line(22) = {8, 13};
//+
Line(23) = {13, 18};
//+
Line(24) = {9, 7};
//+
Line(25) = {6, 7};
//+
Line(26) = {6, 8};
//+
Line(27) = {8, 10};
//+
Line(28) = {14, 12};
//+
Line(29) = {12, 11};
//+
Line(30) = {11, 13};
//+
Line(31) = {13, 15};

//+
Transfinite Curve {12, 17, 20, 23, 7, 6, 22, 19, 16, 13, 1, 24, 28, 11} = 11 Using Progression 1;
//+
Transfinite Curve {2, 3, 25, 26, 29, 30, 10, 9} = 2 Using Progression 1;
//+
Transfinite Curve {14, 15, 18, 21, 5} = 6 Using Progression 1;
//+
Transfinite Curve {4, 27, 31, 8} = 8 Using Progression 1;

//+
Curve Loop(1) = {1, 15, 24, 14};
//+
Plane Surface(1) = {1};
//+
Curve Loop(2) = {24, 16, 28, 13};
//+
Plane Surface(2) = {2};
//+
Curve Loop(3) = {28, 17, 11, 12};
//+
Plane Surface(3) = {3};
//+
Curve Loop(4) = {29, 20, 10, 17};
//+
Plane Surface(4) = {4};
//+
Curve Loop(5) = {20, 9, 23, 30};
//+
Plane Surface(5) = {5};
//+
Curve Loop(6) = {31, 7, 8, 23};
//+
Plane Surface(6) = {6};
//+
Curve Loop(7) = {16, 29, 19, 25};
//+
Plane Surface(7) = {7};
//+
Curve Loop(8) = {19, 30, 22, 26};
//+
Plane Surface(8) = {8};
//+
Curve Loop(9) = {27, 6, 31, 22};
//+
Plane Surface(9) = {9};
//+
Curve Loop(10) = {21, 27, 5, 4};
//+
Plane Surface(10) = {10};
//+
Curve Loop(11) = {18, 26, 21, 3};
//+
Plane Surface(11) = {11};
//+
Curve Loop(12) = {2, 15, 25, 18};
//+
Plane Surface(12) = {12};

//+
Transfinite Surface {1};
//+
Transfinite Surface {2};
//+
Transfinite Surface {3};
//+
Transfinite Surface {4};
//+
Transfinite Surface {7};
//+
Transfinite Surface {12};
//+
Transfinite Surface {11};
//+
Transfinite Surface {8};
//+
Transfinite Surface {5};
//+
Transfinite Surface {6};
//+
Transfinite Surface {9};
//+
Transfinite Surface {10};

//+
Physical Surface(“blocks”, 32) = {1, 2, 3, 10, 9, 6};
//+
Physical Surface(“channel”, 33) = {12, 11, 7, 8, 4, 5};
//+
Physical Curve(“inlet”, 34) = {2, 3};
//+
Physical Curve(“outlet”, 35) = {10, 9};
//+
Physical Curve(“surface”, 37) = {1, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4};

//+
Recombine Surface {1, 2, 3, 4, 7, 12, 11, 10, 8, 9, 5, 6};

I would be very grateful if someone could help me resolve this.

Best regards,

Wu

Hi Wu,

i think it comes from the not clockwise definitions of the curve loops that then got ‘concealed’ by using the OpenCascade kernel. With the default gmsh kernel all your curve loops throw an error. I fixed them (see following). If you are using the gmsh GUI in the bird eyes view (view on x-y plane) meshes that a colorful are correct ordered, when they appear black the order is off. When you turn it around 180 degree and look from the other side this changes to the opposite. You can fix this by inverting the curve loops or by negating (inverting) the plane command Plane Surface(1) = {1}; -> Plane Surface(1) = {-1};. One note i think i had to change the quotation marks, but this could be related to OS language settings :man_shrugging:. Perhaps as a suggestion for a more powerful transformation tool to look into is ogstools its the newer conversion tool with more functionalities but the GMSH2OGS does still work. Hope i could help!
Best
Max

//SetFactory("OpenCASCADE");

Point(1) = {0, 0, 0, 1};
Point(2) = {0, 0.75e-2, 0, 1};
Point(3) = {0, -0.75e-2, 0, 1};
Point(4) = {0, 10e-2, 0, 1};
Point(5) = {0, -7e-2, 0, 1};
Point(6) = {5e-2, 0, 0, 1};
Point(7) = {5e-2, 0.75e-2, 0, 1};
Point(8) = {5e-2, -0.75e-2, 0, 1};
Point(9) = {5e-2, 10e-2, 0, 1};
Point(10) = {5e-2, -7e-2, 0, 1};
Point(11) = {15e-2, 0, 0, 1};
Point(12) = {15e-2, 0.75e-2, 0, 1};
Point(13) = {15e-2, -0.75e-2, 0, 1};
Point(14) = {15e-2, 10e-2, 0, 1};
Point(15) = {15e-2, -7e-2, 0, 1};
Point(16) = {26.5e-2, 0, 0, 1};
Point(17) = {26.5e-2, 0.75e-2, 0, 1};
Point(18) = {26.5e-2, -0.75e-2, 0, 1};
Point(19) = {26.5e-2, 10e-2, 0, 1};
Point(20) = {26.5e-2, -7e-2, 0, 1};


Line(1) = {4, 2};
Line(2) = {1, 2};
Line(3) = {1, 3};
Line(4) = {3, 5};
Line(5) = {5, 10};
Line(6) = {10, 15};
Line(7) = {15, 20};
Line(8) = {20, 18};
Line(9) = {18, 16};
Line(10) = {16, 17};
Line(11) = {17, 19};
Line(12) = {19, 14};
Line(13) = {9, 14};
Line(14) = {9, 4};
Line(15) = {2, 7};
Line(16) = {7, 12};
Line(17) = {12, 17};
Line(18) = {1, 6};
Line(19) = {6, 11};
Line(20) = {11, 16};
Line(21) = {3, 8};
Line(22) = {8, 13};
Line(23) = {13, 18};
Line(24) = {9, 7};
Line(25) = {6, 7};
Line(26) = {6, 8};
Line(27) = {8, 10};
Line(28) = {14, 12};
Line(29) = {12, 11};
Line(30) = {11, 13};
Line(31) = {13, 15};

Transfinite Curve {12, 17, 20, 23, 7, 6, 22, 19, 16, 13, 1, 24, 28, 11} = 11 Using Progression 1;
Transfinite Curve {2, 3, 25, 26, 29, 30, 10, 9} = 2 Using Progression 1;
Transfinite Curve {14, 15, 18, 21, 5} = 6 Using Progression 1;
Transfinite Curve {4, 27, 31, 8} = 8 Using Progression 1;

Curve Loop(1) = {-1, -14, 24, -15};
Plane Surface(1) = {-1};

Curve Loop(2) = {-24, 13, 28, -16};
Plane Surface(2) = {-2};

Curve Loop(3) = {28, 17, 11, 12};
Plane Surface(3) = {3};

Curve Loop(4) = {-29, 17, -10, -20};
Plane Surface(4) = {-4};

Curve Loop(5) = {-30, 20, -9, -23};
Plane Surface(5) = {-5};

Curve Loop(6) = {-31, 23, -8, -7};
Plane Surface(6) = {-6};

Curve Loop(7) = {25, 16, 29, -19};
Plane Surface(7) = {-7};

Curve Loop(8) = {-26, 19, 30, -22};
Plane Surface(8) = {-8};

Curve Loop(9) = {-27, 22, 31, -6};
Plane Surface(9) = {-9};

Curve Loop(10) = {-4, 21, 27, -5};
Plane Surface(10) = {-10};

Curve Loop(11) = {-3, 18, 26, -21};
Plane Surface(11) = {-11};

Curve Loop(12) = {2, 15, -25, -18};
Plane Surface(12) = {-12};


Transfinite Surface {1:12};

Physical Surface("blocks", 32) = {1, 2, 3, 10, 9, 6};
Physical Surface("channel", 33) = {12, 11, 7, 8, 4, 5};

Physical Curve("inlet", 34) = {2, 3};
Physical Curve("outlet", 35) = {10, 9};
Physical Curve("surface", 37) = {1, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4};


Recombine Surface {1:12};
//Mesh 2;

Hi Max,

Many thanks for your help, and you’re correct! It is caused by the definition of the curve loops. I have modified the curve loops, and all meshes in the bird-eye view (on the x-y plane) are now coloured. After that, no errors appear.

Regarding the quotation marks in the .geo file, I am using the Win11 system. It is still workable after deleting the quotation marks.

Best regards,

Wu

1 Like