The mesh file doesn't contain vertices in FreeFEM

Hello FreeFEM community,
I used Gmsh to generate a 3D mesh. By the fact, the Gmsh code is extracted from a Gmsh tutorial (t19.geo).
Unfortunately I got the following error when reading the mesh with FreeFEM:
ERROR: The mesh file doesn’t contain vertices

The FreeFEM code is:
‘’’
load “gmsh”
system(“gmsh -3 -o noVertices.msh noVertices.geo”);
mesh3 Th(“noVertices.msh”);
plot(Th,wait=1);
‘’’
and the geo file for Gmsh is as follows:
‘’’
SetFactory(“OpenCASCADE”);
nturns = 1;
npts = 20;
r = 1;
h = 1 * nturns;
For i In {0 : npts - 1}
theta = i * 2Pinturns/npts;
Point(1000 + i) = {r * Cos(theta), r * Sin(theta), i * h/npts};
EndFor
Spline(1000) = {1000 : 1000 + npts - 1};
Wire(1000) = {1000};
Disk(1000) = {1,0,0, 0.2};
Rotate {{1, 0, 0}, {0, 0, 0}, Pi/2} { Surface{1000}; }
Extrude { Surface{1000}; } Using Wire {1000}
Delete{ Surface{1000}; }
Geometry.NumSubEdges = 1000;
Mesh.MeshSizeFromCurvature = 20;
Mesh.MeshSizeMin = 0.001;
Mesh.MeshSizeMax = 0.3;
Surface Loop(2) = {1003, 1002, 1001};
‘’’
Many Thanks for your support
Dominique

As a start, you must add the argument -format msh22 when you run Gmsh.

Chris, thanks for your answer.
Unfortunately the problem persists even after forcing the version of msh (either console mode or with the Gmsh application). I tried with an example out of the gmsh tutorial (t19.geo), and still the problem.
The versions of my installations are gmsh 4.11.1 and FreeFEM++ 4.13.
I will pursue the investigations because I’m stuck to use FreeFEM++ for solving my problem.

It also looks like you havent defined a volume? You can try to use this example for troubleshooting.

If you later have a problem with element orientations, you can try this trick:

lockOrientation = false;
mesh3 Th1 = gmshload3("noVertices.msh"); // load mesh stored in Gmsh .mesh format
lockOrientation = true;
mesh3 Th = Th1;

Chris,
the case you provided gave the same error:
“-- Mesh3 : plate.msh2, space dimension 3, num Tetrahedron elts 0, num Vertice 0 num Bordary elts 0”
No elements were found.
For my own case, I introduced a volume so that it looks like:


SetFactory(“OpenCASCADE”);

nturns = 1;
npts = 20;
r = 1;
h = 1 * nturns;
For i In {0 : npts - 1}
theta = i * 2Pinturns/npts;
Point(1000 + i) = {r * Cos(theta), r * Sin(theta), i * h/npts};
EndFor
Spline(1000) = {1000 : 1000 + npts - 1};
Wire(1000) = {1000};

Disk(1000) = {1,0,0, 0.2};
Rotate {{1, 0, 0}, {0, 0, 0}, Pi/2} { Surface{1000}; }
Extrude { Surface{1000}; } Using Wire {1000}
Volume(1) = {1};
Delete{ Surface{1000}; }

Physical Volume(“fluid”, 1005) = {1};
Physical Surface(“inlet”, 1006) = {1003};
Physical Surface(“outlet”, 1007) = {1000};
Physical Surface(“wall”, 1008) = {1002};


and the call for FreeFEM:


load “msh3”
system(“gmsh -format msh22 -3 -o noVertices.msh2 noVertices.geo”);
mesh3 Th(“noVertices.msh2”);
plot(Th,wait=1);


But still the same error (no elements found).
For the two cases (yours and mine), I tried exporting from Gmsh using “version 2 ASCII”, with all the possible combinations with “Save all elements” and “Save parametric coordinates”.

Chris,
after so many trials I got my case running when running gmsh from the edp file:


load “msh3”
load “gmsh”

lockOrientation = false;

system(“gmsh -format msh22 -3 -o noVertices.msh noVertices.geo”);
mesh3 Th = gmshload3(“noVertices.msh”); // load mesh stored in Gmsh .mesh format
lockOrientation = true;

plot(Th,wait=1);


Unfortunately, I was unable to get results for the case plate.geo you provided.
I failed using the meshes exported by gmsh, whatever the case.
Now I need to find how to refine the mesh when using the command line:
system(“gmsh -format msh22 -3 -o noVertices.msh noVertices.geo”);

I’m not sure I understand your question. You can control mesh resolution a number a different ways as described in the GMSH manual.

Thanks Chris,
Everything is clearer after many trials, and I understood how to refine the mesh in the geo file. My first goal is achieved and the next step is to handle multi-properties (properties material) and multi-physics calculations domain (conduction is one part and conduction/convection in a second part).

1 Like