snappyHexMesh

Overview

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

Meshing process

The overall meshing process is summarised by the figure below:

snappyHexMesh-overview-small.png
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:

Configuration

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

Usage

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

snappyHexMesh -help

returns the list of available options

Usage: snappyHexMesh [OPTIONS]
options:
  -case <dir>       specify alternate case directory, default is the cwd
  -checkGeometry    check all surface geometry for quality
  -decomposeParDict <file>
                    read decomposePar dictionary from specified location
  -dict <file>      read control dictionary from specified location
  -noFunctionObjects
                    do not execute functionObjects
  -outFile <fileName>
                    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
  -roots <(dir1 .. dirN)>
                    slave root directories for distributed running
  -surfaceSimplify <boundBox>
                    simplify the surface using snappyHexMesh starting from a
                    boundBox
  -srcDoc           display source code in browser
  -doc              display application documentation in browser
  -help             print the usage

Using: OpenFOAM-plus (see www.OpenFOAM.com)
Build: plus-3d414cf4be8a

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

Copyright ©  OpenCFD Ltd. 2017
Creative Commons License