CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Meshing & Mesh Conversion (https://www.cfd-online.com/Forums/openfoam-meshing/)
-   -   [Gmsh] Error converting gmsh to Openfoam (https://www.cfd-online.com/Forums/openfoam-meshing/221717-error-converting-gmsh-openfoam.html)

MikeC October 26, 2019 21:03

Error converting gmsh to Openfoam
 
1 Attachment(s)
I'm new to using gmsh, and am getting an error when trying to convert the gmsh *.msh file into openfoam format. It should be a relatively simple mesh (1st order, 2D mesh). I've attached the gmsh script in case I've made an error there. The openfoam error I'm getting is below. Anybody have any ideas what could be causing this?

Create time

Starting to read mesh format at line 2
Read format version 4.1 ascii 0

Starting to read physical names at line 5
Physical names:5
Surface 1 inlet
Surface 2 walls
Surface 3 slipWalls
Surface 4 farfield
Surface 5 frontAndBack

Starting to read points at line 117
Vertices to be read: 993644
Vertices read: 993644

Starting to read cells at line 1987509
Cells to be read:1632833

Unhandled element 15 at line 1987511in/on physical region ID: 0
Perhaps you created a higher order mesh?


--> FOAM FATAL IO ERROR:
Bad token - could not get int32

file: input at line 0.

From function Foam::Istream& Foam::operator>>(Foam::Istream&, int32_t&)
in file primitives/ints/int32/int32IO.C at line 85.

FOAM exiting

virengos October 27, 2019 02:45

Hello Mike,
have you checked already this: "Perhaps you created a higher order mesh?"
See also this topic in the forum:

https://www.cfd-online.com/Forums/op...-warnings.html
https://www.cfd-online.com/Forums/op...oam-error.html
best,
Damian

MikeC October 30, 2019 23:48

Hi Damien,

Yeah, it looks like I'm getting similar errors to those threads. I don't like the solution that they came up with though, so I guess I'm just going to try a different mesher...

Thanks,
Mike

arashgmn March 10, 2020 06:46

1 Attachment(s)
I'm using gmsh version 4.5.4, and openFoam v1912. gmshToFoam gives me the following error:

Code:

Unhandled element 15 at line 84358in/on physical region ID: 0
Perhaps you created a higher order mesh?


FOAM FATAL IO ERROR:
Bad token - could not get int32

file: input at line 0.

    From function Foam::Istream& Foam::operator>>(Foam::Istream&, int32_t&)
    in file primitives/ints/int32/int32IO.C at line 86.

FOAM exiting

None of the previous links helped me, unfortunately. this is very similar to my problem but has no answer either.


In my case, I've used the ASCII4 for saving the mesh, it is a 3d mesh with 1-layer (an extruded 2d geometry) and no higher-order meshing is used.

I appreciate any help.

Cheers,
Arash

koushikChemical March 28, 2022 03:55

Some Info
 
1. A block of code in gmshToFoam.c reads the particular line in file using IStringStream into 4 different label type variables. If one of them "elmType" the 3rd one in stream, does not match with expected types: The code is at line 941
if (elmType == MSHLINE)
else if (elmType == MSHTRI)
else if (elmType == MSHQUAD)
else if (elmType == MSHTET)
else if (elmType == MSHPRISM)
else if (elmType == MSHHEX)
else
{
}
Then the error message will be displayed
static label MSHLINE = 1;
static label MSHTRI = 2;
static label MSHQUAD = 3;
static label MSHTET = 4;
static label MSHHEX = 5;
static label MSHPRISM = 6;
static label MSHPYR = 7;
These are the accepted enumerations. if the 3rd one eleType in stream is greater than 7 or does not fall in this range. Then the error exception will be raised

BIRAJ March 22, 2024 08:38

Hello,
The solution is to export to ASCII 2 format by unchecking both polar coordinates and save all elements. Then, the gmshToFoam command should work fine.


All times are GMT -4. The time now is 20:03.