CFD Online Logo CFD Online URL
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Meshing & Mesh Conversion

[Other] Boolean operation on OpenFOAM mesh

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

Like Tree2Likes
  • 1 Post By cutter
  • 1 Post By cutter

LinkBack Thread Tools Search this Thread Display Modes
Old   October 13, 2014, 11:20
Default Boolean operation on OpenFOAM mesh
Senior Member
Join Date: Nov 2012
Posts: 142
Rep Power: 9
wc34071209 is on a distinguished road
Hi everybody,

I am wondering if there are some Boolean operations available for OpenFOAM's mesh.

For instance, I have two boxes, one is big and the other is small and inside the big one. I can blockMesh the big box to obtain the base mesh. Then if there is a subtract operation of mesh, I can just subtract the cells located inside the small box.

I know that snappyHexMesh can do it well, but I still think if Boolean operation is worth a try.

wc34071209 is offline   Reply With Quote

Old   October 20, 2014, 09:28
Senior Member
Join Date: Mar 2010
Location: Germany
Posts: 154
Rep Power: 11
cutter is on a distinguished road

I think this can be achieved using setSet (see You basically have to define a cell set consisting of the cells in the small box and remove these cells from the big block mesh afterwards.

Make sure the cells of your blockMesh blocks are aligned with the surface of the smaller box!

Good luck!

mizzou likes this.
cutter is offline   Reply With Quote

Old   October 23, 2014, 09:00
Senior Member
Join Date: Mar 2010
Location: Germany
Posts: 154
Rep Power: 11
cutter is on a distinguished road
note: If your geometry is that simple you could have created the whole thing with blockMesh right from the beginning.
mizzou likes this.
cutter is offline   Reply With Quote

Old   September 11, 2019, 15:59
Default Use snappyHexMesh
New Member
Jairo A. Gutiérrez S
Join Date: Nov 2014
Posts: 13
Rep Power: 7
jairoandres is on a distinguished road
You can do it using SnappyHexMesh is the small geometry (the one to be used as tool to remove from the large one) is complex.

I had written this tutorial for myself, but I gladly share it with you:

- Decide if it is a external or internal flow problem. A external flow problem is for example a “wind tunnel” simulation. An internal flow problem is the flow through a pipe. For both cases, a single or multiple STL files are using as a TOOL to snap the mesh from a blockMesh background mesh.

-Construct the STL file of the geometry. The best option I have tested is the newest geometry - CAD - software : OnShape. It is free to register and needs no installation. I did not get good results with freeCad. It is mandatory to Save the STL as ASCII STL. FreeCad does not work straightforward. Note: Click on the “import” and then right click on the part and hit “export”.

-Split the the STL faces (if required). This is required as OpenFOAM needs to recognize the faces as patches after the SnappyHexMesh procedure is carried. If this is not done, all the faces will be assigned to the same group (for example wall). There are two ways to accomplish this:
1) Use SimScale geometry editor to split the STL faces As the new STL file cannot be downloaded in a straightforward way, it is required to “mesh” the STL and then download the OpenFOAM case. The OpenFoam case will have the splitted STL inside the TriSurface folder. This option works well for me.
2) Use OnShape split geometry option: I have not tried this but was recommended by the SimScale staff.

-After placing the STL in the triSurface directory and set up the other data, run the geometry construction script or do: blockMesh → transformPoints -translate '(0 1 0)' ***or anything required to move the block grid in position for the STL***, surfaceFeatureExtract → snappyHexMesh. *** It would be useful to check the STL tools I include below
Modify the names of the boundaries in the boundary file to include the new named zones of the STL. Also, update the same information in the 0 - files from the fields (U and other fields). The names of the new boundary - patches must be included there.
jairoandres is offline   Reply With Quote

Old   September 12, 2019, 07:32
Senior Member
Join Date: May 2019
Location: Italy
Posts: 139
Rep Power: 3
Carlo_P is on a distinguished road
If you want, you can also build the internal geoemtry with Blockmesh
Run Blockmesh and then run foamToSurface. The mesh in BlockMesh geo.stl is now a STL Ascii file.

Change the blockMeshDict for create the external Block
Run BlockMesh
Run snappy.

P.s. for create different patches, you can run splittPatch -angle or a similar command and you have the surface splitted by the angle
Carlo_P is offline   Reply With Quote


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
Getting Started with OpenFOAM wyldckat OpenFOAM 24 October 2, 2019 22:35
[Salome] Script for converting a mesh from Salome-Platform to OpenFOAM nsf OpenFOAM Meshing & Mesh Conversion 73 June 25, 2019 16:44
[Other] vtk mesh or Abaqus mesh to OpenFOAM bigphil OpenFOAM Meshing & Mesh Conversion 27 November 23, 2015 18:31
[Commercial meshers] About the Commercial and Closed Source Meshers discussed here wyldckat OpenFOAM Meshing & Mesh Conversion 2 October 8, 2015 07:05
fluent add additional zones for the mesh file SSL FLUENT 2 January 26, 2008 12:55

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