AOE 5984: Introduction to Parallel Computing Applications

OpenFOAM for CFD Applications

Lecture 4:  Meshing

Professor Eric Paterson
Aerospace and Ocean Engineering, Virginia Tech
21 November 2013

Lecture 4:  Meshing

  • Objectives
    • Discuss OpenFOAM native and 3rd party meshing tools
    • Give overview of mesh manipulation and conversion tools in OpenFOAM
    • Walkthrough of parallel mesh generation with snappyHexMesh
  • Outcomes
    • Students will:
      • appreciate that OpenFOAM has: two mesh generation utilities (blockMesh and snappyHexMesh); and numerous mesh-manipulation tools.
      • understand that meshes can be built in other tools (e.g., Pointwise), and either directly exported to OpenFOAM format, or converted to OpenFOAM format using conversion tools
      • appreciate the limited options of parallel mesh generation (e.g., in commercial mesh generators), and therefore understand the power of snappyHexMesh

    CFD Process

    1. Formulate the problem
    2. Model the geometry and domain
    3. Establish boundary and initial conditions
    4. Mesh generation
    5. Establish simulation strategy
    6. Establish input parameters
    7. CFD simulation
    8. Data analysis
    9. Visualization
    10. Repeat process as needed to explore parameter space
    11. Documentation

    Mesh generation

    1. The computational domain is discretized into a spatial grid.
    2. Mesh generation involves defining the structure and topology and then generating a grid on that topology.  
    3. The grid should exhibit some minimal grid quality as defined by measures of orthogonality, relative grid spacing, grid skewness, etc.
    4. Grid clustering and sizes should be consistent with the desired resolution of important features. 

    OpenFOAM native tools

    1. Algebraic mesher with command-line interface
    2. Great for simple problems, and tutorials
    3. Not useful for complex geometries
    4. User guide

        1. Geometry prescribed using STL file
        2. 3D automatic meshed using hex and split-hex cells
        3. Fully parallelized
        4. User guide

    Running SHM

    To Run SHM, the following items are required
    1. surface data file in STL format, located in constant/triSurface subdirectory
    2. background hex mesh which defines the extent of the computational domain and the baseline mesh density
    3. a snappyHexMeshDict dictionary with appropriate input parameters

    SHM:  Step 1

    The domain and the geometry must be defined

    SHM:  Step 2

    Before SHM is executed, a background mesh of hex cells that fills the entire region must be generated
    This can be done using blockMesh or any other external package.   

    SHM:  Step 3

    Cell splitting begins with cells selected according to specified edge features within the domain

    The features list in the castellatedMeshControls sub-dictionary permits dictionary entries containing a name of an edgeMesh file and the level of refinement

    SHM:  Step 4

    Following feature refinement, cells are selected for splitting in the locality of specified surfaces

    The refinementSurfaces dictionary in castellatedMeshControls requires dictionary entries for each STL surface and a default level specification of the minimum and maximum refinement.

    SHM:  Step 5

    Once the feature and surface splitting is complete a process of cell removal begins. Cell removal requires one or more regions enclosed entirely by a bounding surface within the domain.  Cells are retained if 50% or more of their volume lies within the region

    SHM:  Step 6

    Those cells that lie within one or more specified volume regions can be further split by a rectangular region shown by dark shading. The refinementRegions sub-dictionary in castellatedMeshControls contains entries for refinement of the volume regions specified in the geometry sub-dictionary

    SHM:  Step 7

    The next stage of the meshing process involves moving cell vertex points onto surface geometry to remove the jagged castellated surface from the mesh. The process is:

    1. displace the vertices in the castellated boundary onto the STL surface;
    2. solve for relaxation of the internal mesh with the latest displaced boundary vertices;
    3. find the vertices that cause mesh quality parameters to be violated;
    4. reduce the displacement of those vertices from their initial value (at 1) and repeat from 2 until mesh quality is satisfied.

    SHM:  Step 8

    The mesh output from the snapping stage may be suitable, although it can produce some irregular cells along boundary surfaces. There is an optional stage of the meshing process which introduces additional layers of hexahedral cells aligned to the boundary surface as illustrated by the dark shaded cells

    3rd Party Meshers


    • Process is very different from SHM
    • Instead of command-line, PW uses a CAD-like GUI interface
    •   Mesh construction based upon:
      • CAD input of geometry
      • Connectors (block edges)
      • Domains (block faces or surface mesh) 
      • Blocks (volume mesh)
    • Structured and unstructured surface and volume meshes
    • Nice feature is the graphical selection of boundaries and prescription of boundary conditions
    • Export to many flow solvers, including OpenFOAM

    Pointwise walkthrough

    Mesh Conversion

    • Numerous conversion utilities in OpenFOAM, e.g.,
      • fluentMeshToFoam
      • starToFoam
      • gambitToFoam
      • ideasToFoam 
      • cfx4ToFoam
    • Plus numerous utilities for mesh manipulation, e.g.,
      • checkMesh - checks quality of mesh
      • mergeMeshes - merge two meshes into one
      • mirrorMesh - mirror across a plane
      • refineMesh - refine mesh in multiple directions
      • transformPoints - translate, rotate, scale

    SHM Walkthrough

    Build mesh for Nautilus submarine on BlueRidge
    1. View nautilus.stl file using Paraview
    2. Build background mesh using blockMesh
    3. Run decomposePar 
    4. Examine snappyHexMeshDict
    5. Run SHM in parallel
    6. View each phase of mesh generation

    STL surface

    Background Mesh

    Castellated Mesh

    SHM run on 64 cores on BlueRidge

    Snapped Mesh

    Layers Added


    AOE 5984: OPENFOAM Meshing


    AOE 5984: OPENFOAM Meshing

    OpenFOAM for AOE 5984, Fall 2013. This lecture will cover meshing for OpenFOAM CFD simulations.

    • 7,131
    Loading comments...

    More from