From Script | Spoken-Tutorial
Jump to: navigation, search
Time Narration
00:00 Hello and welcome to the spoken tutorial on Introduction to snappyHexMesh in OpenFOAM.
00:07 In this tutorial, we will learn about

the parameters in snappyHexMesh to generate Mesh in OpenFOAM.

00:14 As a pre-requisite, the user requires:

Surface data files in STL format, located in constant/trisurface sub-directory of the case directory A domain with hex mesh snappyHexMeshDict dictionary located in the system sub-directory of case.

00:35 To record this tutorial, I am using:

Ubuntu Linux operating system 12.04 OpenFOAM version 2.2.2 ParaView version 3.12.0

00:50 Let us learn to create a Mesh with the snappyHexMesh utility.
00:55 The steps are as follows-

Step 1 : Create a base mesh by using blockMesh utility Step 2 : Refine base mesh Step 3 : Remove unused cells Step 4 : Snap mesh to surface Step 5 : Add layers.

01:18 We will open the terminal and enter the path for flange as shown. Type: cd space OpenFOAM-2.2.2/tutorials/mesh/snappyHexMesh/flange and press Enter.
01:40 Now type "ls" and press Enter. There are two folders constant and system.
01:50 Type cd space system and press Enter.
01:55 Now type ls and press Enter. You can see snappyHexMeshDict file.
02:04 To view the contents of the file, type: -gedit space snappyHexMeshDict and press Enter.(Note that H, M and D here are in capital letters.)
02:19 This will open up the snappyHexMeshDict file.
02:23 snappyHexMeshDict file contains all the instructions and the entire process revolves around this file.
02:32 With the first rows of snappyHexMeshDict, you can activate or skip sections of the process.
02:40 In the geometry section, all active regions that take part in snappy process can be defined.
02:50 The parameters that govern the process of cell splitting are described in castellatedMeshControls section.
02:58 The parameters that are listed below are well explained in snappyHexMeshDict file. nCellsBetweenLevels defines the number of cells for each refinement level.
03:12 The higher it is, the more gradual the mesh will be.
03:17 In the Explicit feature edge refinement section, you can set specific refinement level for geometry’s feature edges. The ".eMesh" file can be obtained with the surfaceFeatureExtract utility.
03:34 In the surface-based refinement section, you can set the refinement levels of all surfaces defined in geometry file.
03:45 Mesh selection is a very important parameter. If the chosen point is inside the surface described in geometry file, then snappyHexMesh will create the internal mesh.
03:59 Otherwise, the external part (i.e. inside the blockMesh) is meshed.
04:04 The next step involves moving cell vertex points onto the surface geometry.
04:12 The snapping process is carried out by four parameters:

nSmoothPatch tolerance nSolveIter nRelaxIter.

04:23 These parameters control the number of iterations and tolerance between mesh and STL surface.
04:32 nSmoothPatch option specifies the number of times the exterior (that is the boundary wall) should be iterated. The mesh will become smoother if the number of iterations are more.
04:46 Tolerance option specifies the distance the program should look for a point to snap. The distance will be the number that is in tolerance.
04:58 nSolveIter option specifies the number of times the snapping part of snappyHexMesh should be run.
05:07 nRelaxIter option specifies the number of times the mesh should run a relaxing script, that removes bad mesh points.
05:19 The process of mesh layer addition involves shrinking the existing mesh from the boundary and inserting layers of cells.
05:27 The first group of parameters define the dimensions for layers and surface, on which they will be attached.
05:36 RelativeSizes option (that is true or false) changes the way to read the parameters given next.

true: next parameters define the layers' dimensions as parameters. false: next parameters define directly the layers' dimensions.

05:55 In layers option, you can define the number of layers and the patch on which to attach the layers. It must be an STL (Bold text) patch in geomery sub-menu, and not a user defined region.
06:10 ExpansionRatio parameters set the growth factor of the layers (that is ratio between two subsequent layers).
06:19 finalLayerThickness parameter sets the thickness of the last layer. minThickness parameter sets the minimum allowable thickness of layer.
06:34 Advanced settings is the second group of parameters. It contains more specific controls that can help in layer creation.
06:45 FeatureAngle is the angle above which the surface will not be extruded.
06:52 nRelaxIter option specifies the number of times the mesh will run a relaxing script.
07:00 maxFaceThicknessRatio option specifies the maximum allowable value of aspect ratio.
07:10 meshQualityControls parameter sets the minimum thresholds to generate mesh in snap and add-layers parts.
07:18 In 99% of the cases, it is better to leave the default values. But sometimes, you can deactivate one or more controls to force mesh generation.
07:30 These are the different parameters in snappyHexMeshDict. These parameters are important to generate mesh using snappyHexMesh utility.
07:40 Let us summarize.
07:42 In this tutorial, we learnt different parameters in snappyHexMesh to generate mesh in OpenFoam.
07:50 Watch the video available at this URL: It summarizes the Spoken Tutorial project. If you do not have good bandwidth, you can download and watch it.

08:03 The Spoken Tutorial Project team:

Conducts workshops using spoken tutorials. Gives certificates to those who pass an online test. For more details, please write

08:21 Spoken Tutorials are part of Talk to a Teacher project. It is supported by the National Mission on Education through ICT, MHRD, Government of India.

More information on the same is available at following URL:

08:37 This is Chaitrali Ghodke from IIT Bombay, signing off. Thanks for joining.

Contributors and Content Editors

PoojaMoolya, Pratik kamble, Sandhya.np14