Previous: Running the case with Up: OpenFOAM tutorial – Cyclone Next: Few notes on snappyHexMeshDict
This is an automatically generated documentation by LaTeX2HTML utility. In case of any issue, please, contact us at info@cfdsupport.com.

SnappyHexMesh and running the case

  • Regarding the previous section, creating computational mesh directly in OpenFOAM requires few modification of all-run script.
  • New AllrunSnappyMesh.sh script is already preset.
  • The main modification is listed below:


echo "Creating backgroundMesh..."
blockMesh > log-02-blockMesh 2>&1
echo "                       ...done"

echo "Generating feature-edges..."
surfaceFeatureExtract > log-03-surfaceFeatureExtract 2>&1
echo "                        ...done"

echo "Decomposing background mesh..."
decomposePar > log-04-decomposePar-backgroundMesh 2>&1
echo "                           ...done"
echo "Running snappyHexMesh..."
mpiexec -np $NPROCESS snappyHexMesh -parallel -overwrite  > log-05-snappyHexMesh 2>&1
echo "                     ...done"

echo "Checking mesh..."
mpiexec -np $NPROCESS checkMesh -parallel > log-06-checkMesh 2>&1
echo "                               ...done"

echo "Reconstructing mesh..."
reconstructParMesh -latestTime -constant > log-07-reconstructParMesh 2>&1
echo "                  ...done"

echo "Cleaning mesh..."
createPatch -overwrite > log-08-createPatch 2>&1
echo "             ...done"


  • lines 45-49 creates the backgroundMesh which is defined in blockMeshDict file.
  • lines 50-53 more robust snapping to geometry edges can be achieved by means of feature-edges which are generated using surfaceFeatureExtract utility.
  • lines 55-58 for parallel mesh generation the case is decomposed.
  • lines 60-63 run snappyHexMesh in parallel; the flag -overwrite means, that new mesh will be stored in /constant/polyMesh directory.
  • lines 65-68 check the quality of new generated mesh.
  • lines 70-73 reconstruct the mesh.
  • lines 75-78 cleans the mesh (uses empty createPatchDict), usually clears zero-sized boundaries (boundaries defined on backgroundMesh which were not used).
  • Go to case directory and run the script, e.g. using 4 cores:
    # ./AllrunSnappyMesh.sh 4