# v2106: New and improved pre-processing

## snappyHexMesh: improved automatic refinement in small gaps

TOP

snappyHexMesh has support for automatic refinement in small gaps, enabled through the gapMode and gapLevel entries. The gapMode specifies which side of the surface to apply the algorithm to, and gapLevel the wanted level. It is applied to the cells selected by a refinementRegion.

Gap detection is performed by walking from one surface to another and seeing if:

• the two surfaces are closer than the gapLevel indicated distance
• the two surface normals are sufficiently parallel
• (v2012) surfaces are differing (gapSelf false)
• (v2106) the two surfaces do not 'see' each other i.e. there is no other surface inbetween

Note that the following picture is taken from the v2012 gapSelf development; a similar case was used for the v2106 extension.

See

Source code

Tutorial

## Improved splitMeshRegions utility

TOP

The splitMeshRegions utility splits a mesh into multiple regions to run e.g. conjugate heat-transfer simulations. It can split according to the topology (regions not connected by any face) or according to cellZones. Normally each topological region or each cellZone becomes its own mesh region. In this version sets of cellZones can be kept together in a single region.

Usage

splitMeshRegions \
-cellZonesOnly \
-combineZones '((zoneA "zoneB.*")(zoneC zoneD))'

This will put all of zoneA, zoneB into the same region using a synthesized name, e.g. zoneA_zoneB, and similarly for zoneC, zoneD, regardless of the topology. Accordingly, zoneA_zoneB, zoneC_zoneD can consist of multiple disconnected parts.

Note that

• the exact name currently depends on the matching process and may not be known a priori;
• wildcards are allowed for the zone names; and
• the reserved name none signifies all unzoned cells.

The following example shows splitting according to topology and then according to combinations of cellZones:

splitMeshRegions \
-cellZones \
-combineZones '((zoneA "zoneB.*")(zoneC zoneD))'

This indicates that each region contains a single, connected part which either contains a single cellZone or a combination of cellZones. The synthesised region names will now be region0, region1 etc. since there is no unique zone combination.

Source code

## New spline support for extrudeMesh

TOP

This is an extension of the extrusion model polyline introduced in version 2012. It now supports Catmull–Rom splines in the edge definition.

Usage

Usage remains similar to the last release, whereby the extrudeModel is set to polyline and the polylineCoeffs dictionary is used to define vertices and edges. However, the edge type can also be a spline:

// Using spline edges
(
spline 0 9
(
( 0 0 0.05 )
( 0 0 0.5 )
( 0.5 0 0.5 )
( 0.5 0 0 )
( 1.5 0 0 )
( 1.5 -1 0 )
( 1.5 -1 1.183974596 )
)
);

Tutorials

Source code

Acknowledgements

## Improved checkMesh surface field writing

TOP

checkMesh has a new option writeAllSurfaceFields to write the relevant mesh quality fields as surfaceFields for post-processing.

In the figure below it is used to visualise the per-face non-orthogonality angle on internal faces.

Usage

The new option is used in combination with the -writeFields or -writeAllFields options, e.g.:

checkMesh -writeAllFields -writeAllSurfaceFields

This writes the relevant face-based fields with the prefix face_, e.g. face_nonOrhoAngle to avoid conflict with the existing max-per-cell nonOrthoAngle field. Available fields include:

• face_nonOrthoAngle: non-orthogonality angle
• face_faceWeight: linear interpolation weights (0.5 for uniform mesh)
• face_skewness: skewness
• face_cellVolumeRatio: ratio of cell volumes on either side of the face
• face_minPyrVolume: minimum pyramid volume on either side of the face

The surface field can be post-processed by, e.g. using foamToVTK, to write a file in the VTK/ directory that can be loaded into ParaView. The default method is to write the surface field as a point value on each face centre:

foamToVTK -surfaceFields

Surface fields can also be generated for faceZones, typically created using the topoSet utility, e.g. to select a set of faces as a faceSet and output as a faceZone a typical topoSetDict may look like this:

actions
(
{
name intFaceSet;
type faceSet;
action new;
source boundaryToFace;
}
{
name intFaceSet;
type faceSet;
action invert;
}
{
name intFaceZone;
type faceZoneSet;
action new;
source setToFaceZone;
faceSet intFaceSet;
}
);

This faceZone can then be output as a face-based mesh with fields:

foamToVTK -faceZones '(intFaceZone)'

Source code

## Improved utility region handling

TOP

Many non-solver utilities have been extended to support multiple mesh regions. These can be selected using the command-line options:

• -region <myRegion> : single named region.
• -allRegions : all regions mentioned inside the constant/regionProperties dictionary as used by e.g. the chtMultiRegionFoam solvers. If no regionProperties dictionary is present, the default region is selected.
• -regions '(region1 region2 .. regionN)' : list of named regions. Individual regions can be regular expressions in which case they are matched to the region names in the constant/regionProperties dictionary.

Utilities that support the the new region options include:

• checkMesh
• decomposePar
• foamToEnsight
• foamToVTK
• redistributePar
• renumberMesh
• rotateMesh
• transformPoints

Note that the regions are iterated over one by one and are not combined.

Source code

## Improved patch expressions

TOP

Patch-field expressions introduced in v1912 now include support for snGrad(...), internalField(...) and neighbourField(...) functions. These enable the use of field gradients within an expression, and provide a simple means to define difference operations between patch field values and the internal field close to the patch.

Both patch-field and volume-field expressions now also have access to the current time step via the deltaT() function.

Tutorials

Source code