CFD Online Discussion Forums

CFD Online Discussion Forums (
-   Open Source Meshers: Gmsh, Netgen, CGNS, ... (
-   -   IO error using gmshToFoam (

Emilie March 15, 2011 18:30

IO error using gmshToFoam
Hello guys,

I am new to OpenFoam and I tried to create a very simple mesh : a cavity, with Gmsh.
My mesh looks great, however, when I save it as a .msh file, Gmsh offers several options :

-Version 1.0
-Version 2.0 Binary
-Version 2.0 ASCII
and the options:
-save all (ignore physical groups)
-save parametric coordinates

I tried all the options but eliminated the 'binary', 'save all' and 'save parametric coordinates' because they didn't seem useful.

I finally chose the 2.0 ASCII without ticking the two options.

When I use the "gmshToFoam" command, I have this error :

Create time

Found $MeshFormat tag; assuming version 2 file format.
Starting to read mesh format at line 2
Read format version 2.1 ascii 0

Starting to read points at line 5
Vertices to be read:10498
Vertices read:10498

Starting to read cells at line 10506
Cells to be read:10496

Mapping region 30 to Foam patch 0
Mapping region 31 to Foam patch 1
Mapping region 29 to Foam patch 2
hex :0
pyr :0
tet :0

No cells read from file "carre_parfait_test_renomme.msh"
Does your file specify any 3D elements (hex=5, prism=6, pyramid=7, tet=4)?
Perhaps you have not exported the 3D elements?

file: carre_parfait_test_renomme.msh at line 21004.

From function readCells(..)
in file gmshToFoam.C at line 719.

FOAM exiting


Does anyone ever had this error/know where it comes from ?

Thank you very much for your help !:)

Versions : OpenFoam 1.7.1 and Gmsh 2.4.2

Akuji March 16, 2011 09:45

hex :0
pyr :0
tet :0

OpenFoam didn't find any cell of your mesh.

When you saved you mesh, what size of .msh file?

Akuji March 16, 2011 09:48

Also, if you want to convert 3D mesh from gmsh, you need to define physical volume.

Emilie March 16, 2011 17:30

Thank you for your help Akuji !

Indeed there was a problem with the mesh file : the size was 800kb and 21000 lines.
I defined the volume with Gmsh before generating the mesh (by clicking on 3D) and now my mesh file has a size of 9Mb and over 160000 lines.

The foamToGmsh command returned me a better message, except for :

--> FOAM Warning :
From function polyMesh:polyMesh(... construct from shapes...)
in file meshes/polyMesh/polyMeshFromShapeMesh.C at line 576
Found 10496 undefined faces in mesh; adding to default patch.

but I don't think it'll be a problem, I just need to modify the boundary file concerning the default faces.

Anyway, thank your very much !

All times are GMT -4. The time now is 19:47.