OpenFOAM / OpenFOAM-8

OpenFOAM Foundation repository for OpenFOAM version 8
GNU General Public License v3.0
115 stars 85 forks source link

gmshToFoam failed #10

Open ldv1 opened 3 years ago

ldv1 commented 3 years ago

Hi,

I am using OpenFoam-8 on a Suse Linux box. I generated a simple 3D mesh with gmsh, and exported it in two flavors: airfoil.msh (native gmsh format) and airfoil.vtk. Running gmshToFoam airfoil.msh, I get an error:

/*---------------------------------------------------------------------------*\
  =========                 |
  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
   \\    /   O peration     | Website:  https://openfoam.org
    \\  /    A nd           | Version:  8
     \\/     M anipulation  |
\*---------------------------------------------------------------------------*/
Build  : 8-563c11b49eaf
Exec   : gmshToFoam airfoil.msh
Date   : Jan 28 2021
Time   : 23:05:36
Host   : "localhost.localdomain"
PID    : 12854
I/O    : uncollated
Case   : /home/laurent/OpenFOAM/OpenFOAM-8/tutorials/compressible/rhoSimpleFoam/airfoil_nacaXX
nProcs : 1
sigFpe : Enabling floating point exception trapping (FOAM_SIGFPE).
fileModificationChecking : Monitoring run-time modified files using timeStampMaster (fileModificationSkew 10)
allowSystemOperations : Allowing user-supplied system call operations

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Create time

Using #calcEntry at line 20 in file "/home/laurent/OpenFOAM/OpenFOAM-8/tutorials/compressible/rhoSimpleFoam/airfoil_nacaXX/system/controlDict/functions/forceCoeffsCompressible/forceCoeffsCompressible"
Using #codeStream with "/home/laurent/OpenFOAM/OpenFOAM-8/tutorials/compressible/rhoSimpleFoam/airfoil_nacaXX/dynamicCode/platforms/linux64GccDPInt32Opt/lib/libcodeStream_1cdcbfab46358bbcf2b09b5ffdb81074e9595ac2.so"
Using #codeStream at line 21 in file "/home/laurent/OpenFOAM/OpenFOAM-8/tutorials/compressible/rhoSimpleFoam/airfoil_nacaXX/system/controlDict/functions/forceCoeffsCompressible/forceCoeffsCompressible"
Using #codeStream with "/home/laurent/OpenFOAM/OpenFOAM-8/tutorials/compressible/rhoSimpleFoam/airfoil_nacaXX/dynamicCode/platforms/linux64GccDPInt32Opt/lib/libcodeStream_4e53ea6683014d43aaae7f1655fdc419be73fa84.so"
Using #codeStream at line 27 in file "/home/laurent/OpenFOAM/OpenFOAM-8/tutorials/compressible/rhoSimpleFoam/airfoil_nacaXX/system/controlDict/functions/forceCoeffsCompressible/forceCoeffsCompressible"
Using #codeStream with "/home/laurent/OpenFOAM/OpenFOAM-8/tutorials/compressible/rhoSimpleFoam/airfoil_nacaXX/dynamicCode/platforms/linux64GccDPInt32Opt/lib/libcodeStream_3a1ca79d5a971693a00301e3a44b841419f9a7ca.so"
Using #codeStream at line 33 in file "/home/laurent/OpenFOAM/OpenFOAM-8/tutorials/compressible/rhoSimpleFoam/airfoil_nacaXX/system/controlDict/functions/forceCoeffsCompressible/forceCoeffsCompressible"
Using #codeStream with "/home/laurent/OpenFOAM/OpenFOAM-8/tutorials/compressible/rhoSimpleFoam/airfoil_nacaXX/dynamicCode/platforms/linux64GccDPInt32Opt/lib/libcodeStream_2d58ca55a9c3d5f23a93b18c140764657d312776.so"
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:4
    Line 1      airfoil
    Line 2      farfield
    Surface 1   mesh
    Volume 1    volume

Skipping tag $Entities at line 12
Starting to read points at line 1398
Vertices to be read:817

--> 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

With vtkUnstructuredToFoam airfoil.vtk, I get

/*---------------------------------------------------------------------------*\
  =========                 |
  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
   \\    /   O peration     | Website:  https://openfoam.org
    \\  /    A nd           | Version:  8
     \\/     M anipulation  |
\*---------------------------------------------------------------------------*/
Build  : 8-563c11b49eaf
Exec   : vtkUnstructuredToFoam airfoil.vtk
Date   : Jan 28 2021
Time   : 23:08:44
Host   : "localhost.localdomain"
PID    : 13476
I/O    : uncollated
Case   : /home/laurent/OpenFOAM/OpenFOAM-8/tutorials/compressible/rhoSimpleFoam/airfoil_nacaXX
nProcs : 1
sigFpe : Enabling floating point exception trapping (FOAM_SIGFPE).
fileModificationChecking : Monitoring run-time modified files using timeStampMaster (fileModificationSkew 10)
allowSystemOperations : Allowing user-supplied system call operations

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Create time

Using #calcEntry at line 20 in file "/home/laurent/OpenFOAM/OpenFOAM-8/tutorials/compressible/rhoSimpleFoam/airfoil_nacaXX/system/controlDict/functions/forceCoeffsCompressible/forceCoeffsCompressible"
Using #codeStream with "/home/laurent/OpenFOAM/OpenFOAM-8/tutorials/compressible/rhoSimpleFoam/airfoil_nacaXX/dynamicCode/platforms/linux64GccDPInt32Opt/lib/libcodeStream_1cdcbfab46358bbcf2b09b5ffdb81074e9595ac2.so"
Using #codeStream at line 21 in file "/home/laurent/OpenFOAM/OpenFOAM-8/tutorials/compressible/rhoSimpleFoam/airfoil_nacaXX/system/controlDict/functions/forceCoeffsCompressible/forceCoeffsCompressible"
Using #codeStream with "/home/laurent/OpenFOAM/OpenFOAM-8/tutorials/compressible/rhoSimpleFoam/airfoil_nacaXX/dynamicCode/platforms/linux64GccDPInt32Opt/lib/libcodeStream_4e53ea6683014d43aaae7f1655fdc419be73fa84.so"
Using #codeStream at line 27 in file "/home/laurent/OpenFOAM/OpenFOAM-8/tutorials/compressible/rhoSimpleFoam/airfoil_nacaXX/system/controlDict/functions/forceCoeffsCompressible/forceCoeffsCompressible"
Using #codeStream with "/home/laurent/OpenFOAM/OpenFOAM-8/tutorials/compressible/rhoSimpleFoam/airfoil_nacaXX/dynamicCode/platforms/linux64GccDPInt32Opt/lib/libcodeStream_3a1ca79d5a971693a00301e3a44b841419f9a7ca.so"
Using #codeStream at line 33 in file "/home/laurent/OpenFOAM/OpenFOAM-8/tutorials/compressible/rhoSimpleFoam/airfoil_nacaXX/system/controlDict/functions/forceCoeffsCompressible/forceCoeffsCompressible"
Using #codeStream with "/home/laurent/OpenFOAM/OpenFOAM-8/tutorials/compressible/rhoSimpleFoam/airfoil_nacaXX/dynamicCode/platforms/linux64GccDPInt32Opt/lib/libcodeStream_2d58ca55a9c3d5f23a93b18c140764657d312776.so"
Header   : "# vtk DataFile Version 2.0"
Title    : "1234, Created by Gmsh"
dataType : "ASCII"
line:4 tag:DATASET
geomType : UNSTRUCTURED_GRID
line:5 tag:POINTS
Reading 80754 numbers representing 80754 coordinates.
line:80761 tag:CELLS
Reading 160682 cells or faces.
line:241445 tag:CELL_TYPES
Read 80339 cells;80339 faces.
line:402129 tag:CELL_DATA
line:402130 tag:SCALARS
Reading scalar CellEntityIds of type int from lookup table
Read points:80754 cellShapes:80339 faces:80339 lines:4

Cell fields:
Read 1 labelField fields:
Size    Name
----    ----
160682  CellEntityIds

Point fields:

Other fields:
--> FOAM Warning : 
    From function Foam::polyMesh::polyMesh(const Foam::IOobject&, Foam::pointField&&, const cellShapeList&, const faceListList&, const wordList&, const wordList&, const Foam::word&, const Foam::word&, const wordList&, bool)
    in file meshes/polyMesh/polyMeshFromShapeMesh.C at line 595
    Found 161093 undefined faces in mesh; adding to default patch.
Writing mesh ...
End

I would prefer to work with the gmsh format though. I can provide airfoil.msh for debugging. Thanks for the help.

AleksZhuravlyov commented 3 years ago

Same here.

john-arul1 commented 3 years ago

Hi, I also have the same issue.

/---------------------------------------------------------------------------\ ========= | \ / F ield | OpenFOAM: The Open Source CFD Toolbox \ / O peration | Website: https://openfoam.org \ / A nd | Version: 8 \/ M anipulation | *---------------------------------------------------------------------------*/ Build : 8-1c9b5879390b Exec : gmshToFoam test1.msh Date : Aug 22 2021 Time : 11:22:07 Host : "DESKTOP-IVQE0BE" PID : 268 I/O : uncollated Case : /home/john/OpenFoamApps/buoyantCavity nProcs : 1 sigFpe : Enabling floating point exception trapping (FOAM_SIGFPE). fileModificationChecking : Monitoring run-time modified files using timeStampMaster (fileModificationSkew 10) allowSystemOperations : Allowing user-supplied system call operations

// * // 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:6 Surface 1 front Surface 2 back Surface 3 bottom Surface 4 left Surface 5 top Surface 6 right

Skipping tag $Entities at line 14 Starting to read points at line 44 Vertices to be read:22

--> 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

monotype9551 commented 1 year ago

Looks like OpenFOAM can't handle the newer output of GMSH. See the following: https://www.cfd-online.com/Forums/openfoam-meshing/206228-issue-converting-mesh-gmsh-openfoam.html https://jontateixeira.github.io/posts/gmsh-exporting-old-msh-format/

SamMallinson commented 1 year ago

I get this error even when using -format msh2 on the command line. I'm using OpenFOAM-10.

My mesh is pretty big - about 400M elts. The file size is about 30 Gb. But the machine I am using has 128 Gb of RAM.

Starting to read points at line 27
Vertices to be read:69510056

--> 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
AleksZhuravlyov commented 1 year ago

Hi @SamMallinson, does this work with a smaller mesh?

SamMallinson commented 1 year ago

@AleksZhuravlyov - once I got under 80 Melts - maybe a machine (RAM) related issue?