PolyDualMesh, a useful OpenFOAM utility

Hi everybody!
In our category Tips & Tricks for CFD, I propose in this little article to describe an OpenFOAM functionality named polyDualMesh. So let’s see what is this tool 🙂.

A little reminder : what is a dual mesh?

Let be a given primal n-dimension mesh named M. Its dual mesh M* can be defines as follows : for k ∈[0,n], for any k-cell of M corresponds a (n-k)-cell of M*. So there is a direct link between cells of the two meshes. In practical terms, convert a mesh into its dual is an operation where its faces are swapped with vertices, and its vertices are turned into faces, creating one vertex per face, and an edge between each pair of adjacent face. The Figure 1 shows an overview of the concept with a 2D triangular mesh.

Illustration of a mesh and its dual
Figure 1 - A 2D triangular mesh (blue) and its dual (red)

There are some different approaches in a topological point of view (barycentric dual, Voronoi dual, etc.) which will be no described here. But here is an interesting point to know : a polyhedral mesh is the dual of a Delaunay tetrahedral mesh.

Use of polyDualMesh

As indicated with its name, this utility allows to generate the dual of a mesh, adhering to all the feature and patch edges. Once loaded the OpenFOAM environment with an existing polyMesh, this tool works with the following command :

polyDualMesh [OPTIONS] featureAngle

With the argument featureAngle in degrees [0-180], which allows to set the minimum treated angle : it detects any boundary edge with an angle greater than the featureAngle value, and creates multiple boundary faces for it.

As usual with OpenFOAM utilities, some options are available, using -help to get a list of it. One of the most useful is the option -concaveMultiCells, which split cells on concave boundary edges into multiple cells. This might limit the amount of distortion of the generated mesh in some configurations.

The Figure 2 presents an example, with an initial tetrahedral mesh generated with Salome platform, and the obtained polyhedral mesh using the utility polyDualMesh.

User example of the polyDualMesh utility
Figure 2 - Generated polyhedral mesh with polyDualMesh

Why this utility is useful?

Polyhedral meshes aren’t a universal answer to the large amount of numerical problems arising from the quality of a mesh. But sometimes they can be useful, reducing imprecision due to the calculation of fluxes and gradients in a tetrahedral mesh, and thus significantly speed up the convergence of a simulation.

Unfortunately, in the open source world, possibilities are currently quite limited to generate polyhedral meshes. This is one of the main strengths of this tool, natively included in OpenFOAM.

Thank you for reading this article, and for visiting our website! 🙂


[1] OpenFOAM website.

[2] This article is adapted from one of our Linkedin publication.

Leave a Comment

Your email address will not be published. Required fields are marked *