Skip to content

snappyHexMesh gets stuck at "Setting refinement level of surface to be consistent with shells."

Summary

I have noticed an issue where snappyHexMesh can take a very long time or even get stuck on the refinement phase. This seems to happen when parts of the geometry are highly detailed and very small relative to the overall geometry. In such cases, snappyHexMesh will spend a lot of time on the step "Setting refinement level of surface to be consistent with shells."

It's not just the matter of number of faces. I have run simulations on STL file which were 20x larger in terms of number of faces and file size compared to the attached case without any issues at all.

Steps to reproduce

Run the attached case

Example case

The link below is the motorBike tutorial, with the geometry replaced by a problematic one.

https://drive.google.com/file/d/1WnyoL7RfQSrFZoLoe1yfAhu7qTmQCPNP/view?usp=sharing

The geometry is a simple box of 1 m with a detailed sphere of 1 mm radius inside. The top of the box is open.

What is the current bug behaviour?

snappyHexMesh gets stuck at "Setting refinement level of surface to be consistent with shells." and it can take hours to complete, if at all. I had a case where it took 16 hours, and it was not finished, I had to kill it.

What is the expected correct behavior?

snappyHexMesh not getting stuck at "Setting refinement level of surface to be consistent with shells."

Environment information

  • OpenFOAM version : v2206|v2112|v2106
  • Operating system : ubuntu 22.04
  • Hardware info : AMD Epyc with 24 cores
  • Compiler : Installed with apt-get

Possible fixes

https://develop.openfoam.com/Development/openfoam/-/blob/master/applications/utilities/mesh/generation/snappyHexMesh/snappyHexMesh.C#L1212

Commenting line 1212 will fix the issue, but I'm not sure if there are any consequences for the quality of the mesh. After visual inspection, the mesh looked good.