OpenFOAM Tutorial snappyHexMesh

This will show how to create a mesh from STL files with snappyHexMesh (using OpenFOAM 2.3 or higher).

We will then setup a steadystate turbulent case with simpleFOAM – and run it.

The meshing and solving will be done in parallel on the following machine:

Hardware:

Supermicro X7DWA-N Server Board

32Gb Ram
Dual X5473 Quad core 3.33Ghz XEONS
Nvidia Graphics Card

Software:

Ubuntu 12.04 LTS
PyFOAM (only needed if you want to plot residuals)
-NumPY (required for PyFOAM)
OpenFOAM 2.3

Two text files are given here which show you which commands to type into the OpenFOAM terminal window in Linux to complete the
mesh and running of the case. Also included is a blank “template” piece of code in case you want to add any “function objects” to the
case. Such as for making streamlines before post-processing or calculating things like wall shear stress.

Openfoam_code.tar

calibrate_3.0_SimpleFoam.tar

In this case its a small mesh – so as long as you have at least 4GB Ram you will be fine – it only uses a max of about 1.8Gb but if you only have a 2GB machine
you will probably find it starts using swap and gets very slow !

For the full tutorial see the video on (coming on 1st June 2014) youtube. However here are shown some pictures of the resulting mesh.

Patch Names
Patch Names
Section view 1
Section view 1
Overall Section View
Overall Section View
Closeup of refined viscous layers
Closeup of refined viscous layers
Viscous Layers
Viscous Layers
Outer Refinement Zones
Outer Refinement Zones
Overall Mesh
Overall Mesh
Velocity_SimpleFoam
Velocity_SimpleFoam
Pressure_SimpleFoam
Pressure_SimpleFoam

9 thoughts on “OpenFOAM Tutorial snappyHexMesh

  1. What is purpose of refinement box under the geometry in snappyHexMeshDict?

    1. You will have to clarify if you dont understand:
      a) What a refinement box does in OpenFOAM
      b) What it does specifically in this case

      Two possible answers to your question !

  2. You are a star! Thank you so much for these tutorials. So much more thorough and easier to understand than other ones on You Tube with no one speaking. After following your tutorial, I managed to get a passable mesh for my own geometry quite easily!

  3. An excellent tutorial from an expert in his field. Thank you.

  4. […] this snappyHexMesh tutorial which was run on version 2.3. I tried running it on version 3.0.1 https://www.calum-douglas.com/openfoam-tuto…comment-169285 I tried running the same example, using the exact same instructions as given in the attached file […]

    1. Yes I`m sorry I have not been able to spend time to update the files to OF3 yet, so you will experience
      issues.

  5. Very helpful tutorial to understand the snappy Hex mesh.

  6. Hello sir!

    I am facing an error while executing this run. its showing ‘unknown function type wallShearStress’ type. Can you help me regarding this!! I would be thankful if you do so.

    1. Please see this new video which shows (also) how to impliment wall shear stress with openfoam7 (the method changed).
      Skip forward to about 10minuites.

      https://www.youtube.com/watch?v=iHjkBubRjzI&feature=youtu.be

Leave a Reply

Your email address will not be published. Required fields are marked *