Close

17th February 2014

OpenFOAM 2.3.0: snappyHexMesh

Feature Snapping

In this release, we have extended existing feature edge handling, reported previously in news and in v2.2.0. Explicit feature snapping uses one or more files containing a description of feature edges in the geometry. snappyHexMesh accepts basic edge mesh file formats, including OpenFOAM’s native .eMesh format, and .obj, .vtk and NASTRAN .nas formatted files containing lines.

In this version, an extended feature edge mesh format (.extendedFeatureEdgeMesh) has been introduced, which contains additional information about the feature edges, including distinction between region edges and purely geometric features. The surfaceFeatureExtract utility can now generate these files which can be used by snappyHexMesh to snap preferentially to the different feature types.

In addition, snapping now uses ray tracing near the surfaces of thin structures in order to ensure that points are attracted only to sections of surface that are directly visible. This modification significantly reduces the problem in which a mesh boundary can jump between two surfaces of a thin structure. The new functionality can be deactivated using the following keyword entry in snappyHexMeshDict.

detectNearSurfacesSnap false;

Layer Addition

In the layer insertion process, mesh vertices are displaced away from the surface to make space for the layers. Until now, all vertices would be displaced irrespective of the distance from a given surface. In this version, the displacement of vertices can be confined to within a specified number of cell layers from the surface. This overcomes a problem where a dislocation feature, with excessive mesh distortion, could appear in meshes generated between two opposite-facing surfaces. The behaviour is controlled using the following keyword entry in snappyHexMeshDict.

// No of steps walking away from the surface
nMedialAxisIter 10; // default: 2^31 (unlimited)

The left image below shows a mesh without nMedialAxisIter activated, in which one strong dislocation line runs vertically, slightly right of centre and two other dislocations appear within white striped regions of the mesh. In the right image, nMedialAxisIter is set to 10; distortion of cells is slightly increased close to the surface, but strongly distorted dislocation lines are removed.

nMedialAxisIterOff
nMedialAxisIterOn

At the end of the layer insertion stage, snappyHexMesh writes out layer coverage statistics, including number of layers per patch. It also optionally writes out cell and face sets of the layers and field information of the coverage.

Parallel Running

All phases in snappyHexMesh have been made to operate in parallel, independently of the number of processors. This has been achieved by improving the statistics to account for points and edges existing on multiple processors and by making attraction of a vertex to a surface independent of parallel decomposition.

Parallel scaling has been improved by eliminating the need for the master processor to synchronise point and edge data. decomposePar has been extended to decompose refinement information so snappyHexMesh can be restarted following a decomposition, i.e. after initially running snappyHexMesh in serial.

Refinement in Small Gaps

Users can now specify additional refinement in small gaps between geometry surfaces. A gap is a region between geometry surfaces that are facing one another (within a planarAngle of being parallel), that is spanned by only one or two cells. The refinement is specified by gapLevelIncrement which applies additional refinement above the refinement already applied to the surface, e.g. in the example below, there is level 2 refinement at surfaces, so with a gapLevelIncrement of 2, the refinement in the gap between surfaces will be 4. One additional change is that automatic refinement is applied to any single cell surrounded by cells with more refinement.

body.stl
{
    level (2 2);

    //- Optional increment (on top of max level) in small gaps
    gapLevelIncrement 2;
}

Additional Features

snappyHexMesh includes the other following improvements:

  • a patch associated with a triangulated surface with a single region is now given the name of the surface, by default, without the region name as a suffix following underscore (_<region>);
  • snappyHexMesh functions correctly with cyclic patches in the initial mesh;
  • stopping execution of the mesher between each stage of the meshing process, i.e. castellated, snapping, layer addition, now produces the same mesh as completing all stages in one execution.
  • The skewness check in snappyHexMesh is now consistent in checkMesh and all other mesh utilities and the default setting will highlight a larger number of skew faces.

Source code

  • snappyHexMesh
    $FOAM_UTILITIES/mesh/generation/snappyHexMesh

Examples

  • motorbike
    $FOAM_TUTORIALS/incompressible/simpleFoam/motorBike
  • flange
    $FOAM_TUTORIALS/mesh/snappyHexMesh/flange
  • turbine siting
    $FOAM_TUTORIALS/incompressible/simpleFoam/turbineSiting