# How to Do thin-gap Meshing in SnappyHexMesh

@Runmin ZHAO  July 31, 2018

It is often the case that the mesh quality in thin gaps is difficult to control when using snappyHexMesh. Some times there would be no ample mesh layers to fully represent the flow properties in thin gaps and sometimes the patches would even disappear for the failing of snappyHexMesh to recognize and resolve the gap.

The core idea of thin-gap meshing using SHM is

• rescaling the model, turning the thin gap a wide one
• controlling the mesh refinement near the gap
• generate the mesh, and scale the mesh back.

# Rescale the model

In the terminal, transformPoints command to rescale. To enlarge the coordinate value by ten thousand, use the following command.

transformPoints -scale "(10000 10000 10000)"

# Control the mesh refinement near the gap

We can use the distance-mode regional refinement to control the mesh quality between two surfaces, for example, using the following code.

castellatedMeshControls
{
...
refinementRegions
{
surfaceGroup
{
mode distance;
levels ((5 4) (20 3) (40 2));
}
}
...
}

Be careful with the magnitude of the distance values, i.e. 5, 20, 40, they represent 0.5, 2, 4 Millimeters respectively.

The values at this magnitude are more handy to use.

# Generate the mesh and scale the mesh back

After generating the mesh, use this command to transform the mesh back to the original size

transformPoints -scale "(0.0001 0.0001 0.0001)"