CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   Open Source Meshers: Gmsh, Netgen, CGNS, ... (http://www.cfd-online.com/Forums/openfoam-meshing-open/)
-   -   gmsh to openFoam (http://www.cfd-online.com/Forums/openfoam-meshing-open/94684-gmsh-openfoam.html)

Artex85 November 22, 2011 14:40

gmsh to openFoam
 
Dear Forum Users,

Today I started with gmsh (2.4.2), unfortunately my knowledge is still too low for understanding the error messages at the converting. The goal is to convert the .msh file into a openFOAM (1.5-dev) mesh. After overloading the google search button, i downloaded the bugfix for the gmshToFoam.C (http://www.cfd-online.com/Forums/ope...-x-import.html) and copied it over the old one. Somewho know how to compile the new file? Or have other ideas?

First of all i created a simple cylinder:

Code:

r = 15;
h = 50;

lc = 4;

Point(1) = {0, 0, 0, lc};
Point(2) = {0, r, 0, lc};
Point(3) = {0, -r, 0, lc};
Point(4) = {r, 0, 0, lc};
Point(5) = {-r, 0, 0, lc};

Circle(1) = {5, 1, 2};
Circle(2) = {2, 1, 4};
Circle(3) = {4, 1, 3};
Circle(4) = {3, 1, 5};

Line Loop(5) = {2, 3, 4, 1};
Plane Surface(6) = {5};
Extrude {0, 0, h} {
  Surface{6};Layers{10};
}
Physical Surface("inlet") = {6};
Physical Surface("outlet") = {28};
Physical Surface("walls") = {27, 15, 19, 23};
Physical Volume("inner") = {1};

Here is the error message from gmshToFoam:
Code:

ubuntu@ubuntu:~/OpenFOAM/ubuntu-1.5-dev/run/mySolver_heissgas/pipe$ gmshToFoam rohr.msh

Exec  : gmshToFoam rohr.msh
Date  : Nov 22 2011
Time  : 18:09:23
Host  : ubuntu
PID    : 4728
Case  : /home/ubuntu/OpenFOAM/ubuntu-1.5-dev/run/mySolver_heissgas/pipe
nProcs : 1

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

Found $MeshFormat tag; assuming version 2 file format.
Starting to read physical names at line 5
Physical names:4


wrong token type - expected string found on line 0 the label 1

file: IStringStream.sourceFile at line 0.

    From function operator>>(Istream&, string&)
    in file primitives/strings/string/stringIO.C at line 57.

FOAM exiting

ubuntu@ubuntu:~/OpenFOAM/ubuntu-1.5-dev/run/mySolver_heissgas/pipe$

Solution: Just downloaded an old gmsh version (2.2.6), and all is fine...

XXLRay December 2, 2011 04:31

Your mesh foramt looks wrong. My mesh created in gmsh looks as follows:

Code:

$MeshFormat
2.1 0 8
$EndMeshFormat
$Nodes
175
1 0 0 0
...
175 49.80471076454903 18.51136030950413 64.10544445835805
$EndNodes
$Elements
1333
1 15 3 0 1 0 1
...
1333 4 3 0 72 0 135 136 70 69
$EndElements

How did you exactly create your mesh? I simply chose "Save Mesh" from the GUI.


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