nextfoam / baram

CFD for Everyone
https://baramcfd.org/
GNU General Public License v3.0
100 stars 17 forks source link

Gmsh import failure #30

Closed jiban closed 5 months ago

jiban commented 1 year ago

Describe the bug Gmsh mesh import fails

To Reproduce Steps to reproduce the behavior: Import attached Gmsh mesh

Expected behavior The mesh is imported with errors

Ahmed_Body_gmsh.msh.txt

jiban commented 1 year ago

While importing the mesh in command line, following error happens.

C:\Users\jakej\Documents\tmp\baramTestProjects\extrude\case>gmshToFoam.exe ..\..\..\..\..\Downloads\Ahmed_Body_gmsh.msh 
/*---------------------------------------------------------------------------*\
| =========                 |                                                 |
| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
|  \\    /   O peration     | Version:  2206                                  |
|   \\  /    A nd           | Website:  www.openfoam.com                      |
|    \\/     M anipulation  |                                                 |
\*---------------------------------------------------------------------------*/
Build  : 9955c25453-20221212 OPENFOAM=2206 version=v2206
Arch   : "LSB;label=32;scalar=64"
Exec   : gmshToFoam.exe ..\..\..\..\..\Downloads\Ahmed_Body_gmsh.msh
Date   : Dec 29 2022
Time   : 09:14:17
Host   : LAPTOP-JIWON
PID    : 18532
I/O    : uncollated
Case   : C:/Users/jakej/Documents/tmp/baramTestProjects/extrude/case
nProcs : 1
trapFpe: Floating point exception trapping enabled (FOAM_SIGFPE).
fileModificationChecking : Monitoring run-time modified files using timeStampMaster (fileModificationSkew 5, maxFileModificationPolls 20)
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 points at line 131
Vertices to be read: 1159
Vertices read: 1159

Starting to read cells at line 2575
Cells to be read:5386

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

--> FOAM FATAL IO ERROR: (openfoam-2206)
Bad token - could not get int32

file: input at line 0.

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

FOAM exiting

C:\Users\jakej\Documents\tmp\baramTestProjects\extrude\case>
jiban commented 1 year ago

Line 2577 of the mesh file image

According to the spec. of gmsh, the type of element is 1-node point(15). Unfortunately, 1-node point(15) seems not to be supported by gmshToFoam according to the source code of it.

// Element type numbers

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;