CFD Online Discussion Forums

CFD Online Discussion Forums (
-   OpenFOAM Meshing & Mesh Conversion (
-   -   [snappyHexMesh] snappyHexMesh for chtMultiRegionFoam (

thessling August 29, 2019 06:20

snappyHexMesh for chtMultiRegionFoam
5 Attachment(s)

I am trying to run some chtMultiRegionFoam simulations with heat transfer between an air flow in an insulated duct. To get familiar with the setup I started with a simple rectangular geometry but it will get more complicated, that's why I use snappyHexMesh.

The basic setup is taken from the heatedDuct tutorial case. My problem is that sometimes the temperature starts to diverge at certain mesh positions, so I guess I need a better mesh.

With the heatedDuct tutorial setup the mesh doesn't look to good, as you can see in the first image. It is asymmetric and the edges show some artefacts as well. When I try to add layers they are created in the solid domain, not the fluid as they are supposed to. The full case is attached.

When searching this forum and googling I found a comment that when meshing multi regions one should have a single STL file for every region. The tutorial case is set up differently with all external surfaces in a single file and the interfaces/baffles in a separate one.

When I try the one-stl-per-region setup I get a different problem. First, I noticed that I cannot have the coincident interface in both STL files, it will lead to errors in the faceZones. Removing it from one file fixes this but even then SHM removes all boundary faces in the end. They appear to be recognized correctly in the logs by I cannot get them to last. This case is also attached.

Since I couldn't solve this on my own with this forum and other documentation I'd like to ask some questions here:

What is the preferred/correct way to set up snappyHexMesh with multi region cases?

Why does SHM add the layers in the solid domain in my first example, can this be changed?

Why does SHM remove by boundaries in the second case? They are defined the same way as in the first case.

Are there any tips on how I can improve the mesh quality?

I am quite new to OpenFOAM and right now don't know how to proceed on these problems. Any help is appreciated!

Thanks a lot,

thessling September 4, 2019 04:09

I've managed to make some progress and create a mesh with correct layers. Maybe someone else finds this useful. I had to create one STL file with all external surfaces of the mesh and one for each baffle between solid and fluid region. I also need to set the default cellZone to fluid in blockMeshDict.

Getting the layers is a bit tricky, there's is an example available at Initially you run SHM with only "castellatedMesh" and "snap" set to true. Then you run splitMeshRegions and manually copy the fluid region's polyMesh folder to constant/polyMesh. With this SHM is run again with only "addLayers" and the resulting polyMesh is copied back to constant/fluid/polyMesh. It's a bit cumbersome but works.

The simulation still diverges, though, but I suppose that's a different problem...

simrego September 4, 2019 06:37


Using the snappyHexMesh from ESI group (v17xx, v18x0, v19xx), you are able to define locationsInMesh, so an inside point for every region. Thus you don't need that tricky stl generation. Also you can add layers on faceZone, for example on fluid_to_solid, but it is better (I think) if you decompose your case into regions as you did, and you can use the switch like snappyHexMesh -region "regionName", and it'll read the system/"regionName"/snappyHexMeshDict file. So you don't need that trick with the mesh copy... Also in parallel case it would be a nightmare what you did.

thessling September 5, 2019 09:09

Thank you for your suggestions! I wasn't aware that there are different SHM versions in the OpenFOAM distributions. I will try the ESI version, the -region option will make things a lot easier.

simrego September 5, 2019 09:16

The -region is working in the foundation version too i think. But the locationsInMesh not.

thessling September 5, 2019 09:22

SHM from the latest OpenFOAM 7 release unfortunately does not recognize the -region option. Installation of OpenFOAM 1906 is already in progress ;-)

All times are GMT -4. The time now is 02:20.