CFD Online Logo CFD Online URL
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Pre-Processing

Geometry preparation, snappyhexmesh, OpenFOAM

Register Blogs Members List Search Today's Posts Mark Forums Read

Like Tree2Likes
  • 1 Post By nikhil108
  • 1 Post By Rango

LinkBack Thread Tools Search this Thread Display Modes
Old   June 10, 2020, 18:02
Question Geometry preparation, snappyhexmesh, OpenFOAM
nikhil108's Avatar
Join Date: May 2020
Location: Freiburg
Posts: 43
Rep Power: 6
nikhil108 is on a distinguished road
I have a leak source in a box, which has an outlet. From the leak source a gas releases and mixes with the air inside the box first, then it comes out into the atmosphere outside through an outlet from the box and gets influenced by parameters like turbulence.
So, here I want to consider the flow domain inside the box and also the flow domain outside the box. When I use snappy hex it removes one of the regions when I use the seeding point feature with it, then I am unable to define patches for the box. I tried setSet and toposet, with that I am able to extract the fluid domains of both inside and outside of the box, but I am unable to select and define box walls as walls and a part of the box as an outlet. So, I thought to break the case into 2 parts namely
1. Leak inside the box
2. Leak coming from box to outside environment. Solve the fluxes individually and couple them (output from 1st case acts as input to 2nd case).
Is there any other way to do this, I think I am just complicating the case?
Please have a look at the figure. Any kind of help would be appreciated. Thank you.
Attached Images
File Type: jpg problem_description.jpg (39.2 KB, 35 views)
Harishkolla likes this.

Last edited by nikhil108; June 10, 2020 at 18:04. Reason: Adding image
nikhil108 is offline   Reply With Quote

Old   June 23, 2020, 09:11
New Member
Join Date: Jun 2020
Location: UK
Posts: 22
Rep Power: 5
Rango is on a distinguished road

If I understand your question correctly, you want to perform a multi-region simulation on two regions, "leakSource" and "airBox", coupled through one single patch, "leakOutlet".

Regarding the mesh generation step, you should,

1) use sHM to create cellZones.
snappyHexMesh -overwrite
2) remove unwanted domains created by sHM:
cellSet computationalDomain new zoneToCell airBox
cellSet computationalDomain add zoneToCell leakSource
cellSet computationalDomain subset
subsetMesh -overwrite computationalDomain
3) split the mesh:
splitMeshRegions -cellZones -overwrite
This results in two different mesh regions, "airBox" and "leakSource", with one single patch coupling them, e.g. "leakSource_to_airBox" and "airBox_to_leakSource".

4) use a combination of topoSet and createPatch for each mesh region separatly to create your desired patches.

The following link shares a test case, not exactly but similar to the image that you have posted, which demonstrates these steps in action (please note that I have used OpenFoam-5.x to create and run the case):


All the steps can be found in "run" bash script. Dictionaries for topoSet and createPatch are stored in separate folders in "system/topoSet" and "system/createPatch".

Please let me know if you have any questions/comments!

Attached Images
File Type: png patchMultiRegion.png (78.0 KB, 16 views)
MoCFD likes this.
Rango is offline   Reply With Quote

Old   June 23, 2020, 13:10
Senior Member
Join Date: Nov 2010
Location: USA
Posts: 1,232
Rep Power: 24
me3840 is on a distinguished road
No, you can if you so desire run snappy in multi-region mode, which will give both volumes simultaneously. However, IMO, this is quite limited as you cannot use layer generation in this mode.

Personally for multi-region models I prefer the method you propose, but instead of using two cases still use two regions that you just mesh independently. Then couple the boundary with a cyclicAMI patch.
me3840 is offline   Reply With Quote

Old   June 25, 2020, 10:14
Default create Baffle with stl
nikhil108's Avatar
Join Date: May 2020
Location: Freiburg
Posts: 43
Rep Power: 6
nikhil108 is on a distinguished road
Hallo Rango,

Thaks for your detailed explanation. But, i did the samething using setSet. When i use splitMesh, it splits all my boundary conditions too (ofcourse), which i don't want. Because the properties of the regions are same. So i only need to find a way to create a wall with the stl (small box_inside_stl), so that the gas which leaks inside, only comes from the outlet of inside stl.
So, i created a empty box (empty inside, contains only shape of wall), and used seeding option in snappyhex, which left me with the regions i want. To make it further simpler, as the thickness of the walls is not concerned, i am created a baffle with the inside_stl file i have, and defined it as wall. After that i used toposet (nearestPointToCell) and gave a leak_source. Everything works fine now. Thanks for the help (@Rango, @me3840)
nikhil108 is offline   Reply With Quote


geometry preparation, openfoam, setset, snappyhex, toposet

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Map of the OpenFOAM Forum - Understanding where to post your questions! wyldckat OpenFOAM 10 September 2, 2021 05:29
How to build complex geometry in openfoam? Mark JIN OpenFOAM 4 September 18, 2016 08:38
OpenFOAM Training, London, Chicago, Munich, Sep-Oct 2015 OpenFOAM Announcements from Other Sources 2 August 31, 2015 13:36
Geometry in OpenFoam Mirage12 OpenFOAM Pre-Processing 3 May 24, 2013 00:11
[Gmsh] 2D Mesh Generation Tutorial for GMSH aeroslacker OpenFOAM Meshing & Mesh Conversion 12 January 19, 2012 03:52

All times are GMT -4. The time now is 04:35.