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/)
-   -   [Other] converting fluent .msh file to openfoam (https://www.cfd-online.com/Forums/openfoam-meshing/221166-converting-fluent-msh-file-openfoam.html)

laurenj95 October 7, 2019 11:17

converting fluent .msh file to openfoam
 
Hi,

I have a .msh file which opens in fluent but I am getting the following error message when I try to convert the fluent file to openfoam:


--> FOAM FATAL IO ERROR:
Attempt to get back from bad stream

file: IStringStream.sourceFile at line 0.

From function bool Foam::Istream::getBack(Foam::token&)
in file db/IOstreams/IOstreams/Istream.C at line 56.

FOAM exiting


I am using the following command in openfoam:

fluentMeshToFoam <mesh_file>.msh


(I am using OF version 6)

Any help would be much appreciated!

Lauren

Светлана October 7, 2019 19:27

How did you create the .msh file?

piotr.mecht October 8, 2019 03:38

If it's a 3d mesh try
Code:

fluent3DMeshToFoam <mesh_file>.msh
https://openfoamwiki.net/index.php/Fluent3DMeshToFoam


If the mesh was created on Windows try to convert this to Unix formatting first:
Code:

dos2unix <mesh_file>.msh

laurenj95 October 8, 2019 04:21

Hi,

I meshed the geometry in VMTK

laurenj95 October 8, 2019 04:22

Quote:

Originally Posted by piotr.mecht (Post 746453)
If it's a 3d mesh try
Code:

fluent3DMeshToFoam <mesh_file>.msh
https://openfoamwiki.net/index.php/Fluent3DMeshToFoam


If the mesh was created on Windows try to convert this to Unix formatting first:
Code:

dos2unix <mesh_file>.msh

I have also tried the command

fluent3DMeshToFoam but I get the following message:

--> FOAM FATAL IO ERROR:
wrong token type - expected int64_t, found on line 0 the word 'a'

file: IStringStream.sourceFile at line 0.

From function Foam::Istream& Foam::operator>>(Foam::Istream&, int64_t&)
in file primitives/ints/int64/int64IO.C at line 62.

FOAM exiting


The mesh was created in VMTK on a linux PC.

piotr.mecht October 8, 2019 15:04

Quote:

Originally Posted by laurenj95 (Post 746462)
--> FOAM FATAL IO ERROR:
wrong token type - expected int64_t, found on line 0 the word 'a'


IStream errors are due to input variable incompatibilities. This one e.g. expects some number in the first read line, but it gets some word beginning from the letter 'a'.

Can you copy your mesh file header with some first lines? It should look a bit like (opened in some text editor):
Code:

(0 grid written by ANSYS Meshing
    nodes:        (10 (id start end type)    (x    y    z    ...))
    faces:        (13    (id start end type elemType) (v-0 v-1 .. v-n right cell left-cell ...))
    cells:        (12 (id start end type elemtype))
    parent-face (59 (start end parent child) (nchilds child0 child1 ...))

)
(2 3)
(10 (0 1 3d00 0))
(13 (0 1 ac6a 0))
(12 (0 1 37dd 0))
(10 (4 1 32dc 1 3))(

Is it written with ASCII? OpenFOAM converters do not accept binary input. Are you sure it is Fluent mesh? GMSH also uses *.msh extension

laurenj95 October 9, 2019 06:27

Here is the first few lines of my .msh file:


(0 "GAMBIT to Fluent File")
(0 "Dimension:")
(2 3)

(10 (0 1 691ef 1 3))
(10 (1 1 691ef 1 3)(
-1.2803401947e+01 -1.3421555519e+01 -5.0188274384e+01
-1.3403158188e+01 -1.3795591354e+01 -4.9609939575e+01
-1.3658709526e+01 -1.3156168938e+01 -5.0240833282e+01
1.1650079489e+00 -4.0743322372e+00 -4.4399948120e+01
1.3966637850e+00 -4.2284913063e+00 -4.5130626678e+01
1.4664224386e+00 -3.4754595757e+00 -4.5022266388e+01


I have made sure it is ASCII format and it the mesh works in Fluent.

Thanks,
Lauren


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