CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Meshing & Mesh Conversion

[Gmsh] gmshToFoam : problem with patch

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   October 4, 2009, 05:28
Default gmshToFoam : problem with patch
  #1
jmf
Member
 
Jean-Michel FONTAINE
Join Date: Aug 2009
Location: Orleans - France
Posts: 55
Rep Power: 16
jmf is on a distinguished road
Hello everybody

I try to use gmshToFoam (from 1.6 binaries) to convert meshes with patches from gmsh 2.4.2.

I get following error message:

Code:
Found $MeshFormat tag; assuming version 2 file format.
Starting to read physical names at line 5
Physical names:3
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
I assumed that gmshToFoam supports now .msh version 2
Does anybody know how to solve that ? Here attached one mesh sample

Thanks in advance

J-Michel
Attached Files
File Type: zip meshPatch.msh.zip (1.3 KB, 24 views)
jmf is offline   Reply With Quote

Old   October 4, 2009, 06:43
Default
  #2
Senior Member
 
Philippose Rajan
Join Date: Mar 2009
Location: Germany
Posts: 552
Rep Power: 25
philippose will become famous soon enough
Hello Michel,

A Good Day to you!

I was looking through the GMSH "msh" file that you have posted. It looks like there was a change in the "msh" file format when GMSH 2.4.0 (22 Aug 2009) was released.

The older "msh" versions had the following format for the patch names:
$PhysicalNames
<length of list>
<number> <patch name>
$EndPhysicalNames

The current "msh" has the following format:
$PhysicalNames
<length of list>
<physical dimension> <number> <patch name>
$EndPhysicalNames


gmshToFoam parses the mesh file using the first format, and hence, aborts with an error because the current format has an additional number in each row.

This is a change which has to be made by the maintainers of the "gmshToFoam" code.

The other option is that you make the change to the file "gmshToFoam.C" at line number 316:

lineStr >> regionI >> regionName;

to:

lineStr >> physDim >> regionI >> regionName;

and just ignore the variable "physDim" in the rest of the code. If this works fine, you can submit the change to the "bugs" section of the forum, and get it integrated into the OpenFOAM code base.

I am not sure why this change was made in GMSH, but here is the change log entry which mentions this change:

2.4.0 (Aug 22, 2009): switched build system to CMake; optionally copy
transfinite mesh contraints during geometry transformations; bumped
mesh version format to 2.1 (small change in the $PhysicalNames
section, where the group dimension is now required); ported most
plugins to the new post-processing API; switched from MathEval to
MathEx and Flu_Tree_Browser to Fl_Tree; small bug fixes and
improvements all over the place.

Hope this helps...!

Have a nice day!

Philippose
philippose is offline   Reply With Quote

Old   October 4, 2009, 09:22
Default
  #3
Super Moderator
 
Takuya OSHIMA
Join Date: Mar 2009
Location: Niigata City, Japan
Posts: 518
Blog Entries: 1
Rep Power: 20
7islands is on a distinguished road
Hi guys,
Mattijs says the fix is already in 1.6.x: http://www.cfd-online.com/Forums/ope...-x-import.html

Takuya
7islands is offline   Reply With Quote

Old   October 4, 2009, 16:27
Default gmshToFoam : 1.6 version may not handle .msh version 2.0
  #4
jmf
Member
 
Jean-Michel FONTAINE
Join Date: Aug 2009
Location: Orleans - France
Posts: 55
Rep Power: 16
jmf is on a distinguished road
Dear Philippose and Takuya

Thanks for the time you spend to help me.

The cause of the problem is indeed the new dimension field in patches list.
gmeshToFoam works again after removing this field in each patch line at the beginning of .msh file.

Apparently my OF1.6 did not include up to date gmeshToFoam.
I followed the link given by Takuya, and compiled gmeshToFoam.C.gz archive posted by Etienne. Now it works.

Many thanks to all of you

Regards

J-Michel
jmf is offline   Reply With Quote

Reply

Tags
gmshtofoam patch


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
[snappyHexMesh] SHM addLayers problem: boundary layers collapsing on a patch DOFuser OpenFOAM Meshing & Mesh Conversion 1 October 22, 2015 08:09
[Gmsh] Single volume Mesh gmsh PeteH OpenFOAM Meshing & Mesh Conversion 9 August 6, 2013 08:54
[Other] StarToFoam error Kart OpenFOAM Meshing & Mesh Conversion 1 February 4, 2010 04:38
[Gmsh] Import gmsh msh to Foam adorean OpenFOAM Meshing & Mesh Conversion 24 April 27, 2005 08:19
Multicomponent fluid Andrea CFX 2 October 11, 2004 05:12


All times are GMT -4. The time now is 16:23.