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 when using gmshToFoam (https://www.cfd-online.com/Forums/openfoam-meshing/131958-error-when-using-gmshtofoam.html)

sur4j March 23, 2014 10:50

Error when using gmshToFoam
 
I am trying to mesh a test component in GMSH but am having problems.

I meshed the component using the [Mesh] [3D] option and then saved as a .msh extension. When I tried to run this in OpenFOAM using gmshToFoam I got the following error:
Code:

Create time

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

Starting to read physical names at line 5
Physical names:3
    Surface 1    frontAndBack
    Surface 2    base
    Surface 3    walls

Starting to read points at line 11
Vertices to be read:74
Vertices read:74

Starting to read cells at line 88
Cells to be read:122

Mapping region 1 to Foam patch 0
Mapping region 3 to Foam patch 1
Mapping region 2 to Foam patch 2
Cells:
    total:0
    hex  :0
    prism:0
    pyr  :0
    tet  :0



--> FOAM FATAL IO ERROR:
No cells read from file "gmshtest.msh"
Does your file specify any 3D elements (hex=5, prism=6, pyramid=7, tet=4)?
Perhaps you have not exported the 3D elements?

file: gmshtest.msh at line 212.

    From function readCells(..)
    in file gmshToFoam.C at line 726.

FOAM exiting

Could someone please try this out and check it it works or please explain what I am doing wrong?

Thank you.

GDTech April 3, 2014 05:04

Hi,

I think you forgot to create a physical volume containing your 3D mesh as follow :

Quote:

Physical Volume("fluid") = {1};
Regards,
Laurent.

lramutti April 15, 2014 22:26

Hello Laurent,

I also have the same problem. In my case, I have imported a geometry created in CAD and I am trying to mesh it. How can define the fluid based on the provided parameters in gmsh?

Regards,

Lucas

GDTech April 16, 2014 08:06

1 Attachment(s)
Hi Lucas,

Check your elementary entities (menubar -> tools -> visibility) and add IDs of your volume(s) to the Physical Volume like this :

Code:

Physical Volume("fluid") = {1,2,3};
If you do not have any volume elementary entity, you have to define (at least) one volume entity with its bounding surfaces (geometry -> elementary entities -> add -> volume).

Regards,
Laurent.

lramutti April 16, 2014 12:41

Hello Laurent,

Thanks for replying. I have tried to implement your suggestion however it seems that an elementary entity called surface 1 is already there for the analyzed STL. I tried to hit apply to see if it makes a difference and then refine but for some strange reason when I try to convert my .msh file into OpenFOAM I still get this message

--> FOAM FATAL IO ERROR:
No cells read from file "Harran_clean.msh"
Does your file specify any 3D elements (hex=5, prism=6, pyramid=7, tet=4)?
Perhaps you have not exported the 3D elements?

file: Harran_clean.msh at line 13832697.


Then, I open my .geo file and it says the following:

Merge "Harran_clean.stl";
Surface Loop(2) = {1};


Would you mind if I forward to your e-mail my STL?

Regards,

Lucas

GDTech April 17, 2014 03:25

From my knowledge, gmsh is not able to build a 3D mesh from STL file. It handles STEP and IGES from CAD software.

Go to menubar -> tools -> statistics -> "mesh" tab and you will see you don't have any 3D mesh elements ...

alexeym April 17, 2014 03:53

Hi,

in fact you've forgotten to add one line to your geo file:

Code:

Merge "your-stl-file.stl";
Surface Loop(2) = {1};
Volume(3) = {2};

and created msh file can be converted with gmshToFoam without errors (at least it was possible with my rather simple geometry).


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