snappyHexMesh is a fully parallel, split hex, mesh generator that guarantees a minimum mesh quality. Controlled using OpenFOAM dictionaries, it is particularly well suited to batch driven operation.

Key features:

  • starts from any pure hex mesh (structured or unstructured)
  • reads geometry in triangulated formats, e.g. in stl, obj, vtk
  • no limit on the number of input surfaces
  • can use simple analytically-defined geometry, e.g. box, sphere, cone
  • generates prismatic layers
  • scales well when meshing in parallel
  • can work with dirty surfaces, i.e. non-watertight surfaces

snappyHexMesh: Quick reference

Meshing process

The overall meshing process is summarised by the figure below:

snappyHexMesh overview

This includes:

  • creation of the background mesh using the blockMesh utility (or any other hexahedral mesh generator)
  • extraction of features on the surfaces with surfaceFeatureExtract utility
  • setting up the snappyHexMeshDict input dictionary
  • running snappyHexMesh in serial or parallel

Evolution of the snappy mesh for the iglooWithFridges tutorial is shown below:


Meshing controls are set in the snappyHexMeshDict located in the case system directory. This has five main sections, described by the following:

  • geometry: specification of the input surfaces
  • castellatedMeshControls: starting from any pure hex mesh, refine and optionally load balance when running in parallel. The refinement is specified both according to surfaces, volumes and gaps
  • snapControls: guaranteed mesh quality whilst morphing to geometric surfaces and features
  • addLayersControls: prismatic layers are inserted by shrinking an existing mesh and creating an infill, subject to the same mesh quality constraints
  • meshQualityControls: mesh quality settings enforced during the snapping and layer addition phases
  • Global settings


The command snappyHexMesh executes the meshing process. Adding the -help option, i.e.

snappyHexMesh -help

returns the list of available options

Usage: snappyHexMesh [OPTIONS]
  -case <dir>       Specify case directory to use (instead of the cwd)
  -checkGeometry    Check all surface geometry for quality
  -decomposeParDict <file>
                    Use specified file for decomposePar dictionary
  -dict <file>      Use alternative snappyHexMeshDict
  -dry-run          Check case set-up only using a single time step
  -outFile <file>   Name of the file to save the simplified surface to
  -overwrite        Overwrite existing mesh/results files
  -parallel         Run in parallel
  -patches <(patch0 .. patchN)>
                    Only triangulate selected patches (wildcards supported)
  -profiling        Activate application-level profiling
  -region <name>    Specify alternative mesh region
  -surfaceSimplify <boundBox>
                    Simplify the surface using snappyHexMesh starting from a
  -doc              Display documentation in browser
  -help             Display short help and exit
  -help-compat      Display compatibility options and exit
  -help-full        Display full help and exit

Automatic split hex mesher. Refines and snaps to surface

Using: OpenFOAM-v1906 (1906) (see
Build: v1906
Arch:  LSB;label=32;scalar=64

By default, each of snappyHexMesh's phases, i.e castellation, snapping and layer addition will write a complete mesh in time folders. This behaviour can be suppressed by using the option

snappyHexMesh `-overwrite`

Would you like to suggest an improvement to this page? Create an issue

Copyright © 2016-2017 OpenCFD Ltd.

Licensed under the Creative Commons License BY-NC-ND Creative Commons License