
[Sponsors] 
May 5, 2005, 14:45 
Hello everyone,
I have been

#1 
Senior Member
Billy
Join Date: Mar 2009
Posts: 167
Rep Power: 9 
Hello everyone,
I have been working on a voxel mesh generator using STL files as input. This has two advantages: 1. It can handle complex geometries modelled by standard CAD applications, 2. It builds an orthogonal grid (mesh), which is ideal for FV calculations. In the meantime, I am testing it with some simple geometries and it seems to work. I can make the source code available soon to anyone wishing to try it. 

May 5, 2005, 14:52 
Hi Billy,
This is very inte

#2 
Senior Member
Hrvoje Jasak
Join Date: Mar 2009
Location: London, England
Posts: 1,783
Rep Power: 22 
Hi Billy,
This is very interesting  I've always had trouble building foam meshes for complex 3D geometries I wanted to do. :) Could you please set up a small site (if you haven't already) with some pictures of the meshes you create. I am particularly interested in kinds of cell shapes you produce and mesh quality around concave corners + control of mesh resolution etc. Do you think it would be possible to hook the mesh generator info FOAM by using FOAM mesh classes for direct conversion. Are there any plans to handle a dynamically changing STL geometry (say, moving or morphing in time) and handle deltachanges in the mesh. This would allow simulations of breaking bubbles (and similar) using a moving/deforming/morphing mesh technique. Thanks, Hrv
__________________
Hrvoje Jasak Providing commercial FOAM/OpenFOAM and CFD Consulting: http://wikki.co.uk 

May 5, 2005, 14:56 
Billy,
I'd like to see your

#3 
New Member
Michael Prinkey
Join Date: Mar 2009
Posts: 3
Rep Power: 9 
Billy,
I'd like to see your code too. Making a cartesian mesher like this is something that has been on my todo list since I started working with OpenFOAM. Thanks, Mike 

May 5, 2005, 15:12 
Hi Harje,
I don't have a si

#4 
Senior Member
Billy
Join Date: Mar 2009
Posts: 167
Rep Power: 9 
Hi Harje,
I don't have a site with the pictures of the meshes yet. For now the cell shapes are hexahedrons. About the curvature aspect, I think it may possible to adjust cells to the curvature using a projection method, thus increasing nonorthogonality but I have not anything done yet. Can openFOAM deal with nonmatching grids? If it can maybe it is possible to refine only the cells near the boundaries. I would also like to plug it into openFOAM. But I think I need to eliminate some of the bugs first. Is it possible to post the source code here on this site? Billy. 

May 5, 2005, 15:16 
Yes OpenFOAM can handle meshes

#5 
Senior Member
Join Date: Mar 2009
Posts: 854
Rep Power: 14 
Yes OpenFOAM can handle meshes with local refinement and we have utilities to do this.
You are very welcome to post the source code here, just clear it out of binaries and pack and compress, I am pretty sure it will be small enough to be accepted by the attachment facility. 

May 6, 2005, 08:27 
Here is the source code:
h

#6 
Senior Member
Billy
Join Date: Mar 2009
Posts: 167
Rep Power: 9 

May 6, 2005, 08:29 
I also send a STL file as an e

#7 
Senior Member
Billy
Join Date: Mar 2009
Posts: 167
Rep Power: 9 

May 6, 2005, 09:44 
Hi, Billy,
Thanks a lot for

#8 
Senior Member
PeiYing Hsieh
Join Date: Mar 2009
Posts: 317
Rep Power: 10 
Hi, Billy,
Thanks a lot for posting the mesher. You are an amazing guy  it is very difficult to do unstructured hex grid based on my conversation with several commercial CFD mesher companies. I compiled the code without any problem and was able to generate the lever.msh file. A couple of questions: 1. is it possible to view the .msh? 2. I converted the .msh using gmshToFoam and got a warning message  Foam warning: polyMesh::polyMesh(... construct from shapes ...): Found 9656 undefined faces in mesh: adding to default patch. 3. how to put the boundary patches in boundary (using autoPatch? I am not familar with this utililty yet) so that BCs can be defined? Again, great work! Thanks! Pei 

May 6, 2005, 10:18 
Hi, Billy,
Is this cartesia

#9 
Senior Member
PeiYing Hsieh
Join Date: Mar 2009
Posts: 317
Rep Power: 10 
Hi, Billy,
Is this cartesian grid and not bodyfitted grid? Pei 

May 6, 2005, 10:19 
Hi Pei,
You can open the me

#10 
Senior Member
Billy
Join Date: Mar 2009
Posts: 167
Rep Power: 9 
Hi Pei,
You can open the mesh using GMSH. http://www.geuz.org/gmsh/ Another way is to view it in paraview. I create a new case in FoamX and then I copy the mesh file there. After I run gmshToFoam to obtain the points, faces and cells. Then I run FoamX to define the boundary and then I open it using paraFoam. Yes, you can use the autoPatch which is really a great tool to reconstruct the patches. You can see that the mesh obtained has some error compared with the original geometry. To get a good aproximation you need to increase the number of divisions but this usually produces a very heavy mesh. I am thinking about ways to improve the quality of the mesh and to refine it better near boundaries. Any suggestions? Billy. 

May 6, 2005, 11:28 
Hi, Billy,
Thanks for the r

#11 
Senior Member
PeiYing Hsieh
Join Date: Mar 2009
Posts: 317
Rep Power: 10 
Hi, Billy,
Thanks for the response. After I ran gmshToFoam. Under FoamX, I only see one default boundary. When I ran autoPatch, I played with several different angles (80, 90, 100, 120). 90 generated 256 patches and 100 and greater generated 2 patches. I still do not understand how autoPatch works. I really have zero experience in mesh generation (only a user). However, a couple of years back, I did read a couple of papers discussing local cartesian grid refinement(someting like hanging nodes). I will let you know if I come across those again. I have also seen a cartesian grid generator from NASA. You might want to check it out. Pei 

May 6, 2005, 17:24 
autoPatch is really quite simp

#12 
Super Moderator
Mattijs Janssens
Join Date: Mar 2009
Posts: 1,416
Rep Power: 17 
autoPatch is really quite simple. It takes all the edges on the surface of the mesh, marks those edges where the angle between the two faces using the edge is larger than the user specified value and then puts all faces inside such a delimited region into a single patch.


May 7, 2005, 12:29 
Hi billy,
There is a "Algorit

#13 
New Member
stefan
Join Date: Mar 2009
Posts: 5
Rep Power: 9 
Hi billy,
There is a "Algorithm oriented mesh database". Maybe you can use this code to get some inspiration. http://www.scorec.rpi.edu/AOMD/ Stefan 

May 8, 2005, 16:28 
Thanks Stefan for the link. I

#14 
Senior Member
Billy
Join Date: Mar 2009
Posts: 167
Rep Power: 9 
Thanks Stefan for the link. I will look into it.
Billy. 

May 9, 2005, 09:29 
Hi, Billy,
I don't know whe

#15 
Senior Member
PeiYing Hsieh
Join Date: Mar 2009
Posts: 317
Rep Power: 10 
Hi, Billy,
I don't know whether this is very difficult to do or not, but, just a thought: Is it possible to project all the nodes near the walls onto the walls? If possible, then, you have an bodyfitted mesh. Pei 

May 9, 2005, 09:51 
Pei,
I think it is a little

#16 
New Member
Michael Prinkey
Join Date: Mar 2009
Posts: 3
Rep Power: 9 
Pei,
I think it is a little more complicated than projecting. The staircase mesh cannot be made to conform to a smooth boundary without adding "fillet" cells (wedges or tets). That changes the topology of the staircase and would allow it to be projected to the walls with mesh morphing. The other option is to cut the cells at the surface. Then you have boundary hex cells with one or more vertices removed and various possible numbers of faces. This is pretty commonly done. Most references on cartesian meshing address this. Handling all of the possible cut cells at the boundary is one of the difficult parts. Calculating the volume of a regular hex cell cut by an arbitrary plane is more challenging than it may seem at first. Mike 

May 9, 2005, 13:18 
Hi, Mike,
Thanks for the in

#17 
Senior Member
PeiYing Hsieh
Join Date: Mar 2009
Posts: 317
Rep Power: 10 
Hi, Mike,
Thanks for the information. It is very informative. Almost all my work involves strong surface tension and wall adhesion effect. I have always used bodyfitted mesh to preserve the wall geomtry. I have not tried cartensian grid. It is not clear to me if wall contact angle can be properly handled in a cartesian grid. Pei 

August 10, 2005, 04:07 
Hello,
Can anyone tell me h

#18 
Member
Sita Drost
Join Date: Mar 2009
Location: Arnhem, The Netherlands
Posts: 52
Rep Power: 9 
Hello,
Can anyone tell me how to create .stl files? I know it is possible in Solid Works, but that's rather huge and (as far as I know) you need M$ Windows for it. Is there another program (preferably freeware, Linux...) that I can use? Sita 

August 10, 2005, 05:08 
Hi Sita,
I came up with thi

#19 
Super Moderator
Mattijs Janssens
Join Date: Mar 2009
Posts: 1,416
Rep Power: 17 
Hi Sita,
I came up with this list before: http://www.cfdonline.com/cgibin/Op...st=859#POST859 For polygon modelling you might also have a look at e.g. Blender which is very active. 

August 10, 2005, 11:25 
Thanks! And sorry that I did n

#20 
Member
Sita Drost
Join Date: Mar 2009
Location: Arnhem, The Netherlands
Posts: 52
Rep Power: 9 
Thanks! And sorry that I did not search the discussion board more thorouhgly before posting my question...


Thread Tools  
Display Modes  


Similar Threads  
Thread  Thread Starter  Forum  Replies  Last Post 
'Best' algorithm for CFD on unstructured 2d grids?  andy2o  Main CFD Forum  6  August 19, 2008 12:50 
Unstructured grids:  zxaar  Main CFD Forum  4  April 5, 2005 20:05 
unstructured grids  beginner  Main CFD Forum  1  October 22, 2004 16:08 
unstructured grids  oscar  Main CFD Forum  0  May 27, 2004 07:01 
TVD/NVD in unstructured grids  m.s. darwish  Main CFD Forum  0  August 24, 1999 13:44 