# Summary of Gmsh hex meshing rules

**URL:** <https://prepomax.discourse.group/t/summary-of-gmsh-hex-meshing-rules/1223>\
**Category:** Tips & Tricks\
**Created:** [November 3, 2023, 1:42pm UTC](https://prepomax.discourse.group/t/summary-of-gmsh-hex-meshing-rules/1223 "2023-11-03T13:42:02Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![FEAnalyst](https://yyz2.discourse-cdn.com/free1/user_avatar/prepomax.discourse.group/feanalyst/32/688_2.png) [@FEAnalyst](https://prepomax.discourse.group/u/FEAnalyst)\
**Post date:** [November 3, 2023, 1:42pm UTC](https://prepomax.discourse.group/t/summary-of-gmsh-hex-meshing-rules/1223/1 "2023-11-03T13:42:02Z")

</div>

In this thread, I’d like to collect all the rules that have to be followed to obtain hex meshes with Gmsh in PrePoMax since there are quite a few of them and some may require additional clarification. Please correct me if anything is wrong in my summary.

1. **Extruded** and **revolved** meshing can’t be applied to compound parts and thus base face partitions should be used instead of volume partitions. Those base face patches should be selected all at once using e.g. Surface angle selection mode.

2. **Extruded** and **revolved** meshing requires faces with 3 or 4 edges to generate hex elements automatically (using the transfinite algorithm). But then why doesn’t the example below work without recombination ?

 ![test](https://global.discourse-cdn.com/free1/uploads/prepomax/original/2X/c/ca3a03d8704c1a095e7a83c5814c3623977a9883.png)

1. If there are no such faces (or if it doesn’t work for cases like above for some reason), one can try using **recombination** to generate hex or hex-dominated mesh.

 ![test 2](https://global.discourse-cdn.com/free1/uploads/prepomax/original/2X/a/a457c3d539682d81b8be90974489c848268df9ff.png)

1. **Transfinite** meshing can be applied to compound parts so volume partitions are the way to go.

2. **Transfinite** hex meshing requires volumes with 5 or 6 faces. Those faces should have 3 or 4 edges each.

---

<div class="post-metadata">

**Author:** ![FEAnalyst](https://yyz2.discourse-cdn.com/free1/user_avatar/prepomax.discourse.group/feanalyst/32/688_2.png) [@FEAnalyst](https://prepomax.discourse.group/u/FEAnalyst)\
**Post date:** [November 3, 2023, 1:52pm UTC](https://prepomax.discourse.group/t/summary-of-gmsh-hex-meshing-rules/1223/2 "2023-11-03T13:52:48Z")

</div>

Ok, it seems that hex meshes are never created automatically, recombination is always necessary (see the example below) and those rules with the number of faces/edges for extruded and revolved meshing are just to enable the transfinite algorithm that creates more structured meshes.

 ![test 3](https://global.discourse-cdn.com/free1/uploads/prepomax/original/2X/7/7b0aad10660a0294d9a0080c3b902f8f7ce616cf.png)

Please correct me if I’m wrong.

---

<div class="post-metadata">

**Author:** ![Matej](https://avatars.discourse-cdn.com/v4/letter/m/a698b9/32.png) [@Matej](https://prepomax.discourse.group/u/Matej)\
**Post date:** [November 3, 2023, 3:08pm UTC](https://prepomax.discourse.group/t/summary-of-gmsh-hex-meshing-rules/1223/3 "2023-11-03T15:08:09Z")

</div>

> [@FEAnalyst](#):
>
> **Extruded** and **revolved** meshing can’t be applied to compound parts and thus base face partitions should be used instead of volume partitions. Those base face patches should be selected all at once using e.g. Surface angle selection mode.

Completely correct.

> [@FEAnalyst](#):
>
> **Extruded** and **revolved** meshing requires faces with 3 or 4 edges to generate hex elements automatically (using the transfinite algorithm). But then why doesn’t the example below work without recombination ?

I agree it was also confusing to me when I started to work with Gmsh what exactly is transfinite what exactly is recombination, and how those two can be combined.

The thing is that both of them can be used separately and also at the same time. A transfinite constraint is based on tranfinite interpolation ([Transfinite interpolation - Wikipedia](https://en.wikipedia.org/wiki/Transfinite_interpolation)), which is a way of how to get internal points between two curves or two faces. The result of using a transfinite constraint on a face/s are nicely - regularly positioned nodes inside the transfinite face. The result looks similar to a mapped mesh. When no recombination is used, these nodes are used to create a triangular mesh in 2D or a tetrahedral mesh in 3D.

Recombination is a process where neighboring triangles are merged into a single quad or where neighboring tetrahedrons are merged into hexahedrons. Without recombination, only triangular or tetrahedral elements can be created.

Using both of them is necessary to get a regular quad-based 2D mesh (in triangular faces, there are some triangular elements at the mesh peak node) that can be extruded/revolved into hexa mesh.

I tried to explain this in my first tutorial: [https://youtu.be/AoDp3eZrG1s](https://youtu.be/AoDp3eZrG1s)

---

<div class="post-metadata">

**Author:** ![Matej](https://avatars.discourse-cdn.com/v4/letter/m/a698b9/32.png) [@Matej](https://prepomax.discourse.group/u/Matej)\
**Post date:** [November 3, 2023, 3:09pm UTC](https://prepomax.discourse.group/t/summary-of-gmsh-hex-meshing-rules/1223/4 "2023-11-03T15:09:50Z")

</div>

> [@FEAnalyst](#):
>
> Ok, it seems that hex meshes are never created automatically, recombination is always necessary (see the example below) and those rules with the number of faces/edges for extruded and revolved meshing are just to enable the transfinite algorithm that creates more structured meshes.

Exactly. Transfinite mesh is only possible on three-sided and four-sided faces. and then needs to be recombined to result in a quad-based shell mesh.
