CFD Online Discussion Forums

CFD Online Discussion Forums (
-   OpenFOAM Native Meshers: snappyHexMesh and Others (
-   -   Orifice mesh with snappyHexMesh (

sfigato January 29, 2013 03:27

Orifice mesh with snappyHexMesh
1 Attachment(s)
Good Morning Foamers,

I decide to leave ICEM and start to use OpenFOAM mesh tools!!

The first geometry that I want to mesh is an internal flow in a cylindrical orifice! I want to use snappyHexMex but i do not know how I can start!

Anyone has some hints (a dict example file would be very useful!!), or can suggest to me some tutorial??

Here is the geometry


afeworkimussie January 31, 2013 14:10

Reason to change
Hello, meshing on OpenFOAM will be a little difficult as to compare to commercial softwares, that is why it is given as option to import a meshed case from a third party software. May , I know the reason for your change from the use of ICEM ? ICEM is a better and easier meshing tool compare to openFOAM's mesher?

anyway, try this link

romant January 31, 2013 15:21

meshing with snappy hex mesh
One good start are the meshing tutorials in OpenFOAM. They use snappyHexMesh and you can try to work with them first.

Additionally, after doing the first tries with the tutorials, try to set up simple cases and try out some of the options in the snappyHexMeshDict, most of the options are well described in the version that is included in the tutorials. otherwise search for the snappyHexMeshDict, that comes with OpenFOAM on your computer like "locate snappyHexMeshDict". There should be one in the source folder for snappyHexMesh.

Some of the options, that are harder to understand are also explained in the forums.

sfigato February 8, 2013 03:58

Hi Romant,

I am sorry for the late response! I am dealing with my snappy mesh! I export my .stl file from solidWorks and I got two problems:

1)Even if I exported the file with the lowest tolerance it is not enough for a good you know how can I improve the quality of the stl file by means of some foam utility?

2)How can I add patch to my .stl file. Do I need to do it by hand (make diverse parts and tie all of them) or is it a more brilliant solution?


romant February 8, 2013 05:25

I usually did this latter to have different patches (take the thing apart in blender for example) and save the parts single. However, if solidworks supports something like names stl files, the patches will appear automatically after meshing.

check your stl quality by opening it in paraview.

linnemann February 8, 2013 05:31


For such a simple geometry I would make it fully structured mesh using eg. Salome.

Of course if you are doing it with the purpose of learning snappyHexMesh then you need to split your geometry into different stl's based on you patches.

Otherwise you need a CAD software that can split into named stl's.
Not many do so it is not the best solution.

If you want to make a finer surface stl you can save the geometry as a step file and use Netgen or Gmsh to make a really fine surface mesh. They can both export to stl and Gmsh can also be run in batch mode so you can convert all the parts using a script.

Snappy deals with multiple stl's just fine.


sfigato February 8, 2013 05:35

Hi Roman and Hi Niels ,

thanks for your quick reply!

Which software do you use for making the .stl file?

Must all the single parts of my solid be closed ?

The last question..After I have the single parts (that correspond to the single patches) do I need just to cat the diverse stl file, for example with the cat command of linux?


romant February 8, 2013 05:42

I use SolidEdge and also used Salome (as linnemann noticed). As he also noticed, you can just have the seperate stl files in snappyHexMesh, no need to concatonate them.

What do you mean with all of them must be closed? If your surfaces together make a closed surface (all stl files together) then it will work. If you want to cut apart a full stl surface, take a look at blender, in which you can see the different triangles that make a surface. you can select them and cut them to represent a different single surface (which is not necessarily closed). You can then save all of these single surfaces and mesh all at once in snappyHexMesh. I think the igloo tutorial uses different surfaces (as boxes and half spheres).

sfigato February 8, 2013 06:02

Hi roman,

Now, I understand your post!

Anyway, I try to explain myself better. By using a .stl file for each patche can I have problem in the intersacions and in the borders between them?

I mean, can they ovelaps each other? Does it no matter under snappy point of view?


romant February 8, 2013 06:04

I am not sure if they can overlap, but I think they should not overlap. If you cut the stl surface apart, then there should not be any overlap.

sfigato February 8, 2013 06:18

Let's take the bottom border betweem the inlet patch and the wall of my orifice. In order to make sure that there is no empty space (otherwise I cannot get an internal mesh) this border needs a little overlap!

Do you agree with me?

So..during the creation of each .stl file I must account for this phenomena.

Anyway, I will do some trials and I will back to post as soon as possible (maybe with a mesh)

Thanks to anyone for the hints


mgdenno February 28, 2013 14:02

I see that this tread is a little old, but my solution to this is to create two different sets of geometries (stl files) one with overlaps and one without. This way I use the one with overlaps as input to snappy and use the other one to extract feature edges. I have used this approach with pipe ends for example and it has worked well.

doubtsincfd March 7, 2013 16:11

In ICEM you can create surface mesh and export it as stl
Names of the patches are preserved

sfigato March 8, 2013 02:55

Hi Omkar,

that would be amazing! Can you short explain me how can I do it or give me some reference?
For istance, can I import a stl (from solidworks) and refine it in ICEM?


doubtsincfd March 8, 2013 10:04

Hi Marco,

Instead import the geometry into ICEM (iges/step/catia....), name the patches as you want, mesh the surfaces (only surface mesh) and then File-export mesh-write stl

I have not imported stl in ICEM and refined it so dont know if its possible

All times are GMT -4. The time now is 08:59.