|
[Sponsors] |
January 21, 2010, 08:21 |
gmsh basics
|
#1 |
New Member
Lindsay Westraadt
Join Date: Jan 2010
Posts: 13
Rep Power: 16 |
Hi there
I'm really new to OpenFoam and gmsh, so please bear with me. For starters I simply want to create a mesh in gmsh and then convert that to something that can be used in OpenFoam. So, I copied the cavity tutorial into my run folder. I deleted everything in the polyMesh folder except for the boundary file. I then pasted cavity.msh and cavity.geo into the polyMesh folder (these are the files I created in gmsh). I then went back to the cavity directory and entered: gmshToFoam cavity.msh .... but its not working. The last line of the error message says segmentation fault. Any ideas? Should have installed gmshToFoam somewhere along the line? I saw it in the utilities folder so I figured it should take care of its self. Any help will be greatly appreciated! Lindsay |
|
January 21, 2010, 23:51 |
|
#2 |
Senior Member
|
Kindof the right start.
First OpenFOAM doesnt care about the .geo file. This is solely for gmsh's use. Second OpenFOAM doesnt read the .msh file directly. You use the utility you mentioned (gmshToFoam) to convert the .msh file into the mesh files that OpenFOAM reads. gmshToFoam is pre-installed by the way, go ahead and type it in your terminal and the errors will direct you. Once the mesh is converted you will continue to get errors, because the boundary conditions are not correctly set up yet. Try to get as far as you can. The errors are detailed and helpful. Post again when(or if, lets stay positive) you get stuck. Cheers! |
|
January 22, 2010, 03:34 |
|
#3 |
New Member
Lindsay Westraadt
Join Date: Jan 2010
Posts: 13
Rep Power: 16 |
Hi Eric
Thanks so much for your help! I made my first mesh and viewed it in paraFoam! yay |
|
January 26, 2010, 03:22 |
still having problems
|
#4 |
New Member
Lindsay Westraadt
Join Date: Jan 2010
Posts: 13
Rep Power: 16 |
Hi there
So, I can make a mesh in gmsh and convert it so that I can use it in OpenFoam, but there's still a problem. When I run icoFoam (still working with the cavity tutorial) and view the results in paraFoam, the results are wrong (there is no pressure field, and the velocity field is 'broken' and incorrect). I checked all the boundary conditions and the only thing that is different between my cavity example and the one provided in the tutorial is the mesh. Does anyone know why this is not working? Am I using the wrong type of mesh? (I specified the all hexas algorithm) Help will be greatly appreciated at this point Lindsay |
|
January 26, 2010, 12:42 |
|
#5 |
Senior Member
|
Does the mesh look the same as the original in paraview?(redundant but note worthy)
For viewing the contours; did you view all the time steps or just zero?(upper right hand corner of paraview) The boundary conditions will likely not work exactly the same unless the names of the boundaries in your mesh are eXAcTly the same(case sensitive). More times than not this is where the problem is. If none of those things spark and idea, post a full screen print screen of the broken mesh/contours in paraview. Hope that helps! |
|
January 27, 2010, 01:54 |
|
#6 |
New Member
Lindsay Westraadt
Join Date: Jan 2010
Posts: 13
Rep Power: 16 |
Hi Eric
Thanks again for your response. Below are some screenshots that might help explain my problem: http://www.quickshare.co.za/files/hv...orial.png.html http://www.quickshare.co.za/files/4y...orial.png.html http://www.quickshare.co.za/files/aq...orial.png.html http://www.quickshare.co.za/files/wj..._gmsh.png.html http://www.quickshare.co.za/files/y7..._gmsh.png.html http://www.quickshare.co.za/files/4o..._gmsh.png.html I am running all the time steps. Also, I made sure that the patch names in the boundary file match those in the initial boundary conditions of p and U. The only thing that I changed in the boundary conditions is the velocity of the movingWall: I changed it from (1 0 0) to (0 0 1) because the coordinates are different in my mesh. Lindsay |
|
February 3, 2010, 21:04 |
|
#7 |
Senior Member
|
Sorry to take such a long time to reply.
FYI: In the future I would attach my screen shots by clicking the manage attachments button below. If they are too big just trim them down in GIMP.(this is easier to read, and helps out people 20years down the road when the 3rd party site doesnt exist any more) Your mesh is much different than I had visualised. You may have just have a convergence issue. Try doubling or tripling the resolution and give it another go. If that doesn't help it is still probably a boundary issue. Confirm that you have properly specified your boundary conditions in the following files: YOURCASE/constant/polymesh/boundary YOURCASE/0/U YOURCASE/0/P YOURCASE/0/nut (if you have one) YOURCASE/0/nuTilda (if you have one) YOURCASE/0/... (if you have any others in your "0" folder) If you have transformed these to your mesh and still cant get it to work, attach the files specified above to your post. Best of luck! |
|
February 4, 2010, 00:37 |
|
#8 |
New Member
Lindsay Westraadt
Join Date: Jan 2010
Posts: 13
Rep Power: 16 |
Aah ... that's how I attach files
There was something wrong with the boundary conditions. I was correct in assuming that the velocity of the moving wall was no longer (1 0 0), but, it wasn't (0 0 1) either, it was (0 1 0) So, things are looking better, but the output is still not as smooth as the original example. I think I should just use a finer mesh. The problem I am having now is with generating a finer mesh. I need the mesh to be only 1 element thick, but when I make the mesh finer in gmsh, it also adds an extra layer of elements to the mesh, and OpenFoam doesn't like this. Make sense? |
|
February 4, 2010, 01:34 |
|
#9 |
Senior Member
|
Dont refine using the gmsh gui. You should only control mesh size with the "characteristic length" variable.
http://www.geuz.org/gmsh/doc/texinfo...ristic-lengths The tutorials section of the user-guide also has good information on its use. http://www.geuz.org/gmsh/doc/texinfo/gmsh.html#Tutorial |
|
February 4, 2010, 06:56 |
|
#10 |
New Member
Lindsay Westraadt
Join Date: Jan 2010
Posts: 13
Rep Power: 16 |
Thanks Eric, that helped
|
|
June 28, 2010, 00:17 |
|
#11 |
New Member
Join Date: May 2009
Location: Texas
Posts: 10
Rep Power: 17 |
Lindsey,
So how do you phrase the command to convert *.msh into someting OpenFoam can read? |
|
June 28, 2010, 03:35 |
|
#12 |
Senior Member
|
In a sourced shell type:
gmshToFoam yourMeshName.msh |
|
July 14, 2010, 10:12 |
|
#13 |
Senior Member
Join Date: Apr 2010
Posts: 151
Rep Power: 16 |
Hello,
I am also a beginner in gmsh, trying to convert using gmshToFoam. I am sure I have a nice msh-file, because I can see the mesh in gmsh. But when I convert it, the console complains that it cannot find any cell. This is the lower part of the console output: Code:
... Unhandled element 1 at line 4738 Unhandled element 1 at line 4739 Unhandled element 1 at line 4740 Unhandled element 1 at line 4741 Unhandled element 1 at line 4742 Unhandled element 1 at line 4743 Unhandled element 1 at line 4744 Unhandled element 1 at line 4745 Unhandled element 1 at line 4746 Unhandled element 1 at line 4747 Unhandled element 1 at line 4748 Mapping region 0 to Foam patch 0 Cells: total:0 hex :0 prism:0 pyr :0 tet :0 No cells read from file "blok01.msh" Does your file specify any 3D elements (hex=5, prism=6, pyramid=7, tet=4)? Perhaps you have not exported the 3D elements? From function readCells(..) in file gmshToFoam.C at line 662. FOAM exiting |
|
July 14, 2010, 10:23 |
|
#14 |
Senior Member
Join Date: Apr 2010
Posts: 151
Rep Power: 16 |
Posting again for coarser mesh and smaller file. The same console output:
Code:
... Unhandled element 1 at line 435 Unhandled element 1 at line 436 Unhandled element 1 at line 437 Unhandled element 1 at line 438 Mapping region 0 to Foam patch 0 Cells: total:0 hex :0 prism:0 pyr :0 tet :0 No cells read from file "blok01.msh" Does your file specify any 3D elements (hex=5, prism=6, pyramid=7, tet=4)? Perhaps you have not exported the 3D elements? From function readCells(..) in file gmshToFoam.C at line 662. FOAM exiting |
|
July 14, 2010, 14:51 |
|
#15 |
Senior Member
|
Just because you can see the mesh does not indicate its quality or compatibility.
Did you make the mesh in gmsh? If so post the geo file. Its possible you have not created any volumes (openfoam only sees volumes, even in 2d) If you are just viewing the mesh in gmsh you will need to use the openfoam converter for the program that generated it. (you may be able to import into gmsh and save, but it is hard to debug things like the existence of volumes in this fashion. |
|
July 14, 2010, 17:22 |
|
#16 |
Senior Member
Join Date: Apr 2010
Posts: 151
Rep Power: 16 |
Thanks for the quick reply. Indeed I meshed with gmsh, here is the geo-file.
|
|
July 14, 2010, 17:39 |
|
#17 |
Senior Member
Join Date: Apr 2010
Posts: 151
Rep Power: 16 |
Hello again,
I am also converting a mesh around an extruded "lens-shaped" half ship. The mesh has two problems: 1. Three unused points: these are the centres of the arcs. They are outside the mesh and not needed, but I do not know how to delete them. 2. High aspect ratio cells. I was able to improve mesh quality by refining the cells and by smoothing and optimizing. I used following command: gmsh -3 -smooth 5 -optimize lens.geo How can I use other mesh algorithms. I tried the option -algo front3d, but the concole responded Fatal : Unknown mesh algorithm (this also happened with the other algorithms) BTW: I use gmsh-2.4.2 and OpenFOAM-1.6 |
|
July 14, 2010, 23:19 |
|
#18 |
Senior Member
|
Well you have stumped me. I cleaned up you file to just the active code so others can review it quickly.
Code:
// lc = 0.03; Point(0) = {0, 0, 0, lc}; Point(1) = {.1, 0, 0, lc} ; Point(2) = {.1, .3, 0, lc} ; Point(3) = {0, .3, 0, lc} ; Point(4) = {0, 0, .3, lc}; Point(5) = {.1, 0, .3, lc} ; Point(6) = {.1, .3, .3, lc} ; Point(7) = {0, .3, .3, lc} ; Line(0) = {0,1} ; Line(1) = {1,2} ; Line(2) = {3,2} ; Line(3) = {0,3} ; Line(4) = {0,4} ; Line(5) = {1,5} ; Line(6) = {2,6} ; Line(7) = {3,7} ; Line(8) = {4,5} ; Line(9) = {5,6} ; Line(10) = {7,6} ; Line(11) = {4,7} ; Line Loop(12) = {0,1,-2,-3} ; Line Loop(13) = {0,5,-8,-4} ; Line Loop(14) = {1,6,-9,-5} ; Line Loop(15) = {2,6,-10,-7} ; Line Loop(16) = {3,7,-11,-4} ; Line Loop(17) = {8,9,-10,-11} ; Plane Surface(20) = {12} ; Plane Surface(21) = {13} ; Plane Surface(22) = {14} ; Plane Surface(23) = {15} ; Plane Surface(24) = {16} ; Plane Surface(25) = {17} ; Surface Loop(100) = {20,21,22,23,24,25}; Volume(101) = {100}; If this is a practice case you will need to resolve the issue. If you are only trying to create a box, I strongly encourage you to use the extrude command instead of the surface loop method. I will review it later as time alots... Here is my error statement if it helps. It recognizes the tets but not much different. Code:
Unhandled element 1 at line 558 Unhandled element 1 at line 559 Unhandled element 1 at line 560 Unhandled element 1 at line 561 Unhandled element 1 at line 562 Unhandled element 1 at line 563 Unhandled element 1 at line 564 Unhandled element 1 at line 565 Mapping region 0 to Foam patch 0 Mapping region 0 to Foam cellZone 0 Cells: total:1748 hex :0 prism:0 pyr :0 tet :1748 CellZones: Zone Size 0 1748 Skipping tag at line 2971 Patch 0 gets name patch0 --> FOAM Warning : From function polyMesh::polyMesh(... construct from shapes...) in file meshes/polyMesh/polyMeshFromShapeMesh.C at line 582 Found 656 undefined faces in mesh; adding to default patch. Finding faces of patch 0 |
|
Tags |
gmshtofoam |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
[Gmsh] Converting gmsh to OpenFoam | Friendly | OpenFOAM Meshing & Mesh Conversion | 3 | June 26, 2018 06:46 |
[Gmsh] Insatlling gmsh from the source code-issue? | CFD-Lover | OpenFOAM Meshing & Mesh Conversion | 20 | June 12, 2018 07:39 |
[Gmsh] 2D Mesh Generation Tutorial for GMSH | aeroslacker | OpenFOAM Meshing & Mesh Conversion | 12 | January 19, 2012 04:52 |
[Gmsh] gmshToFoam problem: not the same mesh in Gmsh vs. paraview | zhernadi | OpenFOAM Meshing & Mesh Conversion | 8 | July 7, 2011 03:28 |
[Gmsh] Import problem | ARC | OpenFOAM Meshing & Mesh Conversion | 0 | February 27, 2010 11:56 |