gmsh basics
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! :D Lindsay |
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! |
Hi Eric
Thanks so much for your help! I made my first mesh and viewed it in paraFoam! yay :p |
still having problems
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 |
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! |
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 |
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! |
Aah ... that's how I attach files :p
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) :cool: 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? |
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 |
Thanks Eric, that helped :D
|
Lindsey,
So how do you phrase the command to convert *.msh into someting OpenFoam can read? |
In a sourced shell type:
gmshToFoam yourMeshName.msh |
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:
... |
1 Attachment(s)
Posting again for coarser mesh and smaller file. The same console output:
Code:
... |
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. |
1 Attachment(s)
Thanks for the quick reply. Indeed I meshed with gmsh, here is the geo-file.
|
1 Attachment(s)
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 |
Well you have stumped me. I cleaned up you file to just the active code so others can review it quickly.
Code:
// 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 |
All times are GMT -4. The time now is 13:39. |