CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Meshing & Mesh Conversion

[Gmsh] Error converting gmsh to Openfoam

Register Blogs Members List Search Today's Posts Mark Forums Read

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   October 26, 2019, 21:03
Default Error converting gmsh to Openfoam
  #1
New Member
 
Mike
Join Date: Dec 2016
Posts: 14
Rep Power: 9
MikeC is on a distinguished road
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:perator>>(Foam::Istream&, int32_t&)
in file primitives/ints/int32/int32IO.C at line 85.

FOAM exiting
Attached Files
File Type: txt coanda.txt (2.1 KB, 4 views)
MikeC is offline   Reply With Quote

Old   October 27, 2019, 02:45
Default
  #2
Member
 
Damian Berghof
Join Date: May 2019
Posts: 41
Rep Power: 11
virengos will become famous soon enough
Hello Mike,
have you checked already this: "Perhaps you created a higher order mesh?"
See also this topic in the forum:

GmshToFoam warnings
gmshToFoam error
best,
Damian
__________________
Get more support about Meshing with Salome and Visualization with ParaView in my growing groups
https://bit.ly/2lFfDkQ
https://bit.ly/2k2u8Pj
virengos is offline   Reply With Quote

Old   October 30, 2019, 23:48
Default
  #3
New Member
 
Mike
Join Date: Dec 2016
Posts: 14
Rep Power: 9
MikeC is on a distinguished road
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
MikeC is offline   Reply With Quote

Old   March 10, 2020, 06:46
Default
  #4
New Member
 
Arash
Join Date: May 2017
Posts: 17
Rep Power: 9
arashgmn is on a distinguished road
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
Attached Files
File Type: txt geo_file.txt (3.3 KB, 10 views)
arashgmn is offline   Reply With Quote

Old   March 28, 2022, 03:55
Default Some Info
  #5
New Member
 
Koushik
Join Date: Mar 2022
Posts: 1
Rep Power: 0
koushikChemical is on a distinguished road
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
koushikChemical is offline   Reply With Quote

Old   March 22, 2024, 08:38
Default
  #6
New Member
 
FOAMraj
Join Date: Apr 2021
Posts: 19
Rep Power: 5
BIRAJ is on a distinguished road
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.
BIRAJ is offline   Reply With Quote

Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Getting Started with OpenFOAM wyldckat OpenFOAM 26 June 21, 2024 07:54
[Gmsh] Converting gmsh to OpenFoam Friendly OpenFOAM Meshing & Mesh Conversion 3 June 26, 2018 06:46
STL -> GMSH -> OpenFOAM eric.m.tridas OpenFOAM 7 September 7, 2011 13:06
[Technical] Salome + Gmsh or enGrid for OpenFOAM? wwrfd OpenFOAM Meshing & Mesh Conversion 2 July 21, 2011 11:38
[Gmsh] Import problem ARC OpenFOAM Meshing & Mesh Conversion 0 February 27, 2010 11:56


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