OpenFOAM® v2.2.0: Changes to snappyHexMesh

OpenFOAM® v2.2.0: Changes to snappyHexMesh

Feature Snapping

In this release, we have extended existing feature edge handling, reported previously and have also implemented a new method for handling feature edges.

In the existing method, the user typically extracts feature edges from the geometry surface using the surfaceFeatureExtract utility and then explicitly specifies the features through the features entry in the snappyHexMeshDict file. The method attracts points on the mesh boundary onto nearest points of the supplied feature edge.

The new implicit method does not require the user to extract features. Instead, it uses the resolveFeatureAngle keyword entry to identify surface geometric features, e.g. creases in the geometry. Rather than snapping directly to an edge geometry, as supplied explicitly in the previous method, the implicit method snaps to a representation of the feature, calculated from local surface topology.

The existing explicit method has been extended to handle snapping features that represent the intersection between boundary patches, even if the patches are in the same plane, i.e. along a flat surface. This is illustrated below where the right image is of a mesh generated with the latest version of snappyHexMesh, compared to the previous version in the left image. Meshing without Patch Snapping Meshing with Patch
Snapping

The additional settings in the snappyHexMeshDict file that relate to the new functionality can be found in examples in the tutorials, and are:

// Number of feature edge snapping iterations. (disabled if omitted).
nFeatureSnapIter 10;

// Detects (geometric only) features by sampling the surface (default=false).
implicitFeatureSnap false;

// Use features in castellatedMeshControls (default = true).
explicitFeatureSnap true;

// For explicitFeatureSnap, detect features between multiple surfaces (default = false)
multiRegionFeatureSnap false;

The explicit method offers greater control and, from our experience, provides slightly better feature conformation. The implicit method has the advantage of being fully automated.

Layer Addition

During the layer addition process in previous versions of OpenFOAM, vertices on boundaries were fixed. If a user chose to add layers of cells to a given patch, the layers would pinch at the outer edge of the patch. In the latest version, vertices can slide along a boundary, allowing the layers to be created without pinching.

Layer Insertion with Vertex Slipping

Sliding will occur when the angle between the patch on which layers are added and its neighbouring patch is larger than that specified by the slipFeatureAngle entry in the addLayersControls sub-dictionary of snappyHexMeshDict. The user can deactivate sliding along a particular patch by including that patch in the layers sub-dictionary with nSurfaceLayers 0;

Improvements have been made to the detection of medial surfaces that are used for mesh shrinking during the layer addition process. This results in better layer addition, in particular in narrow regions of a domain, as shown in the figures below. The top image shows layers from a mesh generated with version 2.1.0, the bottom image is the new improved mesh using version 2.2.0.

Layer Addition with 2.1.0 Medial Surface Layer Addition with 2.2.0 Medial
Surface

New controls have been added where the user can specify the thickness of the first layer and the entire layer region, using the keywords firstLayerThickness and thickness respectively.

Baffle and Boundary Creation

Recent versions of snappyHexMesh can conform internal faces to an internal surface geometry, by specifying a faceZone in refinementSurfaces in the configuration of snappyHexMeshDict. The faces on the internal surface become a set of internal faces under the name of the specified faceZone.

While some simulations use a faceZone to define the intersection of two regions, e.g. fluid and solid regions in a conjugate heat transfer simulation, a faceZone can also be used to define a set of boundary faces. The latest version of snappyHexMesh can automatically process the faceZone according to the faceType keyword with the options:

  • internal — keeps the faceZone as internal faces;
  • baffle — creates co-located pairs of faces from the faceZone, to represent a zero-thickness boundary, i.e. a baffle;
  • boundary — similar to baffle but creates non-co-located pairs of faces from the faceZone, representing a boundary with non-matching faces;

Creating baffles directly within snappyHexMesh is better than creating an internal faceZone and running createBaffles afterwards because the mesh quality controls at baffle faces are more relaxed than at internal faces, making snapping more reliable. It is particularly useful for rotating geometries where it is best to have faces perpendicular to the rotational direction. An example set of entries in the snappyHexMeshDict file is as follows:

refinementSurfaces
{
    heater
    {
        level (0 0);
        faceZone heater;

        // Create baffles for all faces on the surface
        faceType baffle;

        cellZone heater;
        cellZoneInside inside;
    }
}

Feature Refinement

In the previous version, refinement at features was limited to a single refinement level attributed to cells intersected by the feature. In the latest version, users can specify levels of refinement based on distance to a feature. The following example shows how level 2 refinement can be specified at the feature edges, with level 1 refinement at a distance within 0.33 m from the feature edge.

features
(
    {
        file "someLine.eMesh";
        levels ((0.0 2)(0.33 1));
    }
);

Distance to Feature Refinement

Other Improvements

snappyHexMesh includes the following improvements:

  • a decomposeParDict file is now only required when running in parallel;
  • better mesh smoothing with edge-weighted interpolation for snapping and layer addition;
  • use of parallelised point normal calculation throughout the meshing process;
  • users can now specify surface names for region refinement using wildcards;
  • snappyHexMesh can be run using a -checkGeometry option, which will check all defined geometry for overlaps and intersections. Intersection lines are output as .vtk files.

Source code
snappyHexMesh -
$FOAM_UTILITIES/mesh/generation/snappyHexMesh
Examples
motorbike -
$FOAM_TUTORIALS/incompressible/simpleFoam/motorBike
flange -
$FOAM_TUTORIALS/mesh/snappyHexMesh/flange