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/)
-   -   Version 20 of the bmshb file format to FOAM converter (http://www.cfd-online.com/Forums/openfoam-meshing-open/61877-version-20-bmshb-file-format-foam-converter.html)

7islands February 15, 2007 22:24

Hi all, Have anyone tried sup
 
Hi all,
Have anyone tried supporting version 2.0 of the .msh file format in gmshToFoam?

Thanks,
Takuya

7islands February 16, 2007 01:58

OK here's the one (with quick
 
OK here's the one (with quick and dirty hacks of course).
http://www.cfd-online.com/OpenFOAM_D...hment_icon.gif gmshToFoam-20070216.C
Regards,
Takuya

7islands February 16, 2007 08:32

Hi all, I've renamed it to gm
 
Hi all,
I've renamed it to gmsh2ToFoam and posted it on Wiki.

http://openfoamwiki.net/index.php/Contrib_gmsh2ToFoam

Takuya

7islands February 17, 2007 23:50

Hi all, I've made an importan
 
Hi all,
I've made an important fix to the correspondence problem between OpenFOAM cellZone/patch numbering and Gmsh physical/elementary entity tagging.

If there's anyone who have tried the first version could you please try the new version (gmsh2ToFoam-20070218) again.

Thanks,
Takuya

7islands February 19, 2007 03:55

Hi Gmsh users, This time gm
 
Hi Gmsh users,

This time gmsh2ToFoam assigns physical entity names defined by "Physical Surface" and "Physical Volume" gmsh commands (such as "inlet", "outlet", ...) to patches / cellZones / faceZones insted of automatically generated names (such as "patch0", "patch1", ...). This is realized by utilizing one of the new key features in Gmsh 2.0.

This is supposed to be useful especially in practical use and actually is what I really wanted to do through gmsh2ToFoam. For Gmsh 1.x users who don't get what I mean, I've prepared a deteiled example on the Wiki.

http://openfoamwiki.net/index.php/Contrib_gmsh2ToFoam

Thanks,
Takuya

msrinath80 February 21, 2007 07:18

Thanks for the updates Takuya.
 
Thanks for the updates Takuya. I'll give your version a try when I create my next mesh http://www.cfd-online.com/OpenFOAM_D...part/happy.gif

7islands March 9, 2007 09:27

Hi Marco, Thanks for testing
 
Hi Marco,
Thanks for testing gmsh2ToFoam. Seems that gmsh2ToFoam.C you tested is an old one (maybe the initial version I guess) since the current version gmsh2ToFoam-20070305 (05 Mar 2007) on the Wiki already has the code almost exactly like what you wrote. Further the 20070305 version can assign string labels in $PhysicalNames section as patch names. If you have time to test the version please give it a try.

Takuya

mavimo March 9, 2007 10:13

Hi Takuya, I write a small pi
 
Hi Takuya,
I write a small piece of code to applay $PhysicalNames to patch generated with gmsh2ToFoam, the name of physical surface is saved into physicalNameList variable and after the code apply this name to patch (replace pathc0, patch1, ...). It's so easy to write the code, I don't have my version of gmsh2ToFoam.C file on this PC, sorry, but work with my case (It has not been tested with other models).

Bye
Marco

7islands March 9, 2007 10:55

Hi, Yes, that's exactly what
 
Hi,
Yes, that's exactly what I've done in the newest gmsh2ToFoam-20070305 (saving the region numbers and string labels in $PhysicalNames section into arrays and later matching the numbers with the labels). Maybe with your knowledge you can get what I've done as soon as you look into my newest code.

http://openfoamwiki.net/images/e/eb/...0070305.tar.gz

Additionaly, the code also has ability to remove unused points (still experimental though) frequently discussed in the Gmsh mailing list e. g.:
http://www.geuz.org/pipermail/gmsh/2007/002396.html
so that checkMesh test no longer fails even if a .msh file contains such points.

Takuya

mavimo March 9, 2007 11:22

Thanks Bya Marco
 
Thanks

Bya Marco

mavimo March 9, 2007 11:23

Thanks! Bye Marco
 
Thanks!

Bye
Marco

mavimo March 9, 2007 18:21

I have create a new model with
 
I have create a new model with gmsh 2.0.4:
// Gmsh project created on Mon Mar 5 14:41:29 2007
nc = 10;

// ************************************************** ***** //
// * Flame plane *
// ************************************************** *****
Point(1) = {0,0,0,0.1};

l1[] = Extrude {0,0.035,0} { Point{1}; Layers{nc*3,1}; };
l2[] = Extrude {0,0.008,0} { Point{2}; Layers{nc*1,1}; };
l3[] = Extrude {0,0.017,0} { Point{3}; Layers{nc*1,1}; };

s1[] = Extrude {{0,0,1}, {0,0,0}, Pi/16} {
Line{l1[1]}; Layers{nc*0.5,1}; Recombine;
};
s2[] = Extrude {{0,0,1}, {0,0,0}, Pi/16} {
Line{l2[1]}; Layers{nc*0.5,1}; Recombine;
};
s3[] = Extrude {{0,0,1}, {0,0,0}, Pi/16} {
Line{l3[1]}; Layers{nc*0.5,1}; Recombine;
};

// Uniscle superfici
stot[] = {s1[1], s2[1], s3[1]};

// Le estrudo per creare il volume
Extrude {0,0,0.023} {
Surface{stot[]}; Layers{nc*2,1}; Recombine;
}

// ************************************************** ***** //
// * wall plane *
// ************************************************** *****
Extrude {0,0,0.008} {
Surface{53}; Layers{nc*2,1}; Recombine;
}
Extrude {0,0,0.008} {
Surface{75}; Layers{nc*2,1}; Recombine;
}

// ************************************************** ***** //
// * smoke plane *
// ************************************************** ***** //
l4[] = Extrude {0,0.035,0} { Point{37}; Layers{nc*3,1}; };
s4[] = Extrude {{0,0,1}, {0,0,0}, Pi/16} {

Line{l4[1]}; Layers{nc*0.5,1}; Recombine;
};


Extrude {0,0,0.06} {
Surface{123}; Layers{nc*2,1}; Recombine;
}

Extrude {0,0,0.06} {
Surface{119}; Layers{nc*2,1}; Recombine;
}

Extrude {0,0,0.06} {
Surface{97}; Layers{nc*2,1}; Recombine;
}

// Create a volume
Surface Loop(185) = {139,123,131,140,135};
Volume(186) = {185};


// ************************************************** ***** //
// * Assegnazione nomi *
// ************************************************** ***** //
// Generate surface whit name
Physical Surface("plate") = {123,96,31};
Physical Surface("inlet-flame") = {6};
Physical Surface("inlet-inert") = {10};
Physical Surface("atmosphere") = {14,66,110,153,184,162,140};
Physical Surface("simmetry1") = {139,179,157,114,92,48,70,30};
Physical Surface("simmetry2") = {131,22,40,62,149,171,84,106};
Physical Volume("internalField") = {186};

but when I convert the mesh obtain this error:

.msh file version 2

Found $PhysicalNames section.

Read nVerts:15036

Read nElems:6000

Mapping physical region 2 to Foam physical patch 0
Mapping physical region 1 to Foam physical patch 1
Mapping physical region 4 to Foam physical patch 2
Mapping physical region 3 to Foam physical patch 3
Mapping physical region 6 to Foam physical patch 4
Mapping physical region 5 to Foam physical patch 5

Cells:
total:0
hex :0
prism:0
pyr :0
tet :0

Patches:
Patch Size Name
0 150 inlet-flame
1 400 plate
2 600 atmosphere
3 50 inlet-inert
4 2400 simmetry2
5 2400 simmetry1

CellZones:
Zone Size Name



--> FOAM FATAL ERROR : faces deallocated

From function const faceList& polyMesh::allFaces() const
in file meshes/polyMesh/polyMesh.C at line 655.

FOAM aborting

Foam::error::printStack(Foam:http://www.cfd-online.com/OpenFOAM_D...part/proud.gifstream&)
Foam::error::abort()
Foam::polyMesh::allFaces() const
Foam::polyPatch::polyPatch(Foam::word const&, int, int, int, Foam::polyBoundaryMesh const&)
Foam::polyPatch::addwordConstructorToTable<foam::p olypatch>::New(Foam::word const&, int, int, int, Foam::polyBoundaryMesh const&)
Foam::polyPatch::New(Foam::word const&, Foam::word const&, int, int, int, Foam::polyBoundaryMesh const&)
Foam::polyMesh::polyMesh(Foam::IOobject const&, Foam::Field<foam::vector<double> > const&, Foam::List<foam::cellshape> const&, Foam::List<foam::list<foam::face> > const&, Foam::List<foam::word> const&, Foam::List<foam::word> const&, Foam::word const&, Foam::List<foam::word> const&)
gmsh2ToFoam [0x8052fe0]
__libc_start_main
__gxx_personality_v0
Aborted


(I had removed the code for delete unused points)

Bye
Marco

7islands March 9, 2007 20:34

Hi, I tested your .geo also w
 
Hi,
I tested your .geo also with Gmsh 2.0.4, and found the resulting .msh after generating a 3D mesh contains no volumetric elements (tet, hexa, ...) even though a physical volume 186 is defined. I guess the last line of your .geo

Physical Volume("internalField") = {186};

should be replaced by

Physical Volume("internalField") = {1,2,3,4,5,6,7,8};

and gmsh2ToFoam converts the mesh successfully (although checkMesh fails the face skewness test). Could you have a careful look into the generated mesh with Tools -> Visibility menu of Gmsh?

Takuya

mavimo March 10, 2007 13:45

With Physical Volume("interna
 
With
Physical Volume("internalField") = {186};
and
Physical Volume("internalField") = {1,2,3,4,5,6,7,8};
I don't see mesh into tools -> Visibility -> Mesh partitions, but I see volume in Physical partitions.

Bye
Marco

7islands March 10, 2007 20:36

No, no. You must *remove* the
 
No, no. You must *remove* the line

Physical Volume("internalField") = {186};

and add the line

Physical Volume("internalField") = {1,2,3,4,5,6,7,8};

instead.

Checking your physical volume definition with Tools -> Visibility -> Physical groups menu and selecting internalField -> Apply you should only see

http://www.cfd-online.com/OpenFOAM_D...your_image.gif

which apparently does not contain any internal mesh. But replacing volume 186 with 1-8 and doing the same checking you'll see the entire volume with internal mesh.

http://www.cfd-online.com/OpenFOAM_D...your_image.gif

And the final generated 3D .msh's follow the figures above -- the .msh genereted by your original .geo does not contain any internal meshes but the corrected one does.

T.

7islands March 10, 2007 20:45

No, no. You must *remove* the
 
No, no. You must *remove* the line

Physical Volume("internalField") = {186};

and add the line

Physical Volume("internalField") = {1,2,3,4,5,6,7,8};

instead.

Checking your original physical volume definition 186 with Tools -> Visibility -> Physical groups menu and selecting internalField -> Apply you should only see

http://www.cfd-online.com/OpenFOAM_D...ges/1/3981.jpg

which apparently does not contain any internal mesh. But replacing volume 186 with 1-8 and doing the same checking you'll see the entire volume with internal mesh.

http://www.cfd-online.com/OpenFOAM_D...ges/1/3982.jpg

And the final generated 3D .msh's follow the figures above -- the .msh genereted by your original .geo does not contain any internal meshes but the corrected one does.

T.

mavimo March 11, 2007 06:23

Sorry, I'm explained to me bad
 
Sorry, I'm explained to me badly ... I use ONLY Physical Volume("internalField") = {186}; or Physical Volume("internalField") = {1,2,3,4,5,6,7,8};. With your explanation I solved the problem.

Thanks for your patience.
Marco

segersson October 4, 2007 08:14

Hi, I just found the gmshFoam
 
Hi,
I just found the gmshFoam utility on the Wiki, quite impressing. I'm also using gmsh, constructing the .geo files from ESRI shape-files with a small Python module. I've run into some serious trouble using gmsh that maybe you can help me with.

I'm extruding multiple surfaces (simultainously) to form a volume mesh of a city block. The buildings are later cut out of the mesh using OpenFoam utilities:

http://www.cfd-online.com/OpenFOAM_D...ges/1/5569.gif

The conversion using gmsh2ToFoam produces warnings (could not match face and unused points) and the short mesh check says that the mesh is invalid. A total meshCheck produces a great number of errors, failing 6 mesh checks. This despite the fact that the mesh is quite simple. A visual check of the 2d-mesh that is extruded in gmsh makes it hard to understand all the errors. My conclusion is that something goes wrong either during the extrusion (although gmsh does not complain) or during the export to OpenFOAM. I'm having a really hard time figuring out how to fix this, and considering the ~2 weeks I've put into getting the shapeToGeo conversion funcion I do not want to let it go.

Does anybody (7islands?) have the possibility to try an example .geo file:
http://www.cfd-online.com/OpenFOAM_D...s/mime_txt.gif buildings.geo

and maybe give some suggestion on what´s going wrong.

The .geo-file uses the pos-file as a background-grid/size function when setting the mesh sizes. The files need to be in the same directory or the link in the .geo-file should be changed.

With hope of help
/David

segersson October 4, 2007 08:33

A small correction, I could n
 
A small correction,
I could not upload the .pos file since it was to big. I commented out this part from the .geo-file and it works anyway, just giving other cell sizes.

Regards
David

mattijs October 4, 2007 15:21

Hi David, just ran gmsh2.08
 
Hi David,

just ran gmsh2.08 on your .geo case, ran it through 1.4.1 gmshToFoam and get a lot of warnings of the form

--> FOAM Warning :
From function gmshToFoam
in file gmshToFoam.C at line 799
Could not match gmsh face 3(215 2086 214) to any of the interior or exterior faces that share the same 0th point

which means that the surfaces you export (triangles I assume) don't cover the faces of your volume mesh? (gmshToFoam tries to use the surface mesh triangles/quads to denote the patches of the volume mesh)

Anyway end up with following geometry
http://www.cfd-online.com/OpenFOAM_D...ges/1/5578.jpg which makes me believe your geometry consists of multiple parts and only one gets meshed or exported?


All times are GMT -4. The time now is 09:29.