Skip to content

snappyHexMesh : refine based on curvature

Mattijs Janssens requested to merge feature-ep_1823_curvature_refinement into develop


Currently snappyHexMesh refines based on geometry intersection by the rays between neighbouring cells. It looks at the angle between the local normal at these intersection points and decides if the geometry forms a feature. This is determined by the resolveFeatureAngle parameter.

In this project the curvature based refinement has been extended to look at the actual (triangulated) surface to decide if the surface requires refinement to resolve.

The algorithm in snappyHexMesh pre-calculates the needed refinement level for each triangle on the surface and this then triggers refinement when actually doing the castellation. The behaviour is controlled by the resolveFeatureAngle parameter and the new optional curvatureLevel parameter:

// Additional refinement for regions of high curvature. Expressed
// (bit similar to gapLevel) as:
// - number of cells per radius of curvature. (usually a few is
//   good enough)
// - starting cell level? Not used at the moment.
// - maximum cell level. This can be smaller or larger than the
//   max 'surface' level
// - minumum curvature radius to ignore (expressed as a cell level).
//   This can be used to avoid detecting small sharp surface
//   features. Set to -1 to ignore.
curvatureLevel (10 0 10 -1);


The logic is:

  • calculate the curvature of the surface
  • unmark points on edges with angles sharper than resolveFeatureAngle (these are resolved by feature-edge snapping)
  • convert the curvature + specified number-of-cells-per-radius to a needed refinement level
  • clip to the specified maximum refinement level
  • store on the surface such that it gets used during follow-on refinement

In some cases the curvature refinement should only be applied to a particular geometric region. One way is to extract part of the surface (using e.g. the surfaceSubset application or the subTriSurfaceMesh surface). Another way is to use the limitRegions functionality inside snappyHexMesh:

    box_limit    // geometry defining region without explicit refinement
        // Don't refine at all inside 'box_limit'
        mode        inside;
        levels      ((10000 0));

In the tutorial mesh/snappyHexMesh/block_with_curvature this has been used to limit the curvature refinement to outside a box. Without limitRegions: no_limitRegions With limitRegions: limitRegions. Note the bleeding of the refinement to inside the limitRegion due to the 2:1 constraint.

Resolved bugs (If applicable)

(Links to issues)

Details of new models (If applicable)

See above


  • this is still an experimental feature - it might not cover all situations
  • it only measures curvature on a (single) surface - it does not use the mesh intersections (like e.g. resolveFeatureAngle does). This might be a future extension
  • if e.g. subTriSurfaceMesh is used to extract part of the geometry this will cause duplicate triangles - each with their own patch. This might lead to inconsistent patching (since it randomly chooses either one or the other patch) and hence snapping.

Merge request reports