JuliaCon 2023

Airfoil meshing automatization with AirfoilGmsh.jl
2023-07-27 , 32-124

In field of aerodynamic is often required to test different geometries, most of them are standard airfoils. The aim is usually to identify promising geometry for a specific application. Many operations repeat mechanically, and are tedious and time consuming. In specific, the mesh creation is a fundamental but routine task, similar but not identical for all the airfoil and all the test cases. This is where GmshAirfoil.jl comes in handy.


It allows the user to create in a few clicks a .geo file containing all the information for the open-source widely used GMSH software to create properly structured meshes. Before exporting the mesh, the user can visualize the preview, and modify almost all the parameters (number of divisions and or the growth ratio in the inlet, airfoil surface or shear ...) and see the new results in real-time. The package also adds the physical tag (inlet, outlet, airfoil and limits) to the entities relieving the workload from the user. The mesh created is compatible with the most popular CFD software (Fluent, STARCCM+). In reality, this package, was born to create airfoil meshes that are compatible with the FEM package Gridap.

The primary purpose of this package is to create a .geo that can be read by GMSH. It has been decided to write a .geo file and not directly the .msh file for three main reasons. Firstly, the .geo file is easy to read and interpret. In this way, the user can perform some easy changes directly on it, without the need to dig deeply into the code. Secondly, it can be imported into GMSH, all the parameters can be modified so the user can visually verify that the mesh is good enough for its purpose. Lastly, the API of GMSH for Julia at the moment does not provide all the features that are needed. The package is simple but quite powerful, it provides basically only two functions:
- from_url_to_csv: the user can browse on the airfoiltools.com website looking for the profile to analyze. It is the biggest database of airfoil online. As the name of the function suggests, it creates a .csv file where the airfoil points are stored. This function comes in handy when the user does not have the file with the points of the profile.
- main_create_geofile: is heart of the package. It allows to create the .geo file. Here its plenty of optional argument that the user can specify to achieve a results closer to his needs:
- Reynolds number: this is used to compute the boundary layer characteristics over the airfoil. An optimal combination of meshing parameters is defined by employing some empiric formulas and setting some constraints on the number of cells in the boundary layer and the growth ratio. In the boundary layer, a sufficient number of cells is needed (at least 30 in a turbulent case), a growth ratio G between 1.05 and 1.2, and we have to ensure that y+ is approximately 1.
- First layer height: sometimes this is the value that the user wants to ensure. Usually, it comes from previous simulations or other authors work.
- Chord: is set c=1 by default, but this value can be overrided.
- Dimensions: 2D or 3D.
- Elements: TRI/TETRA or QUAD/HEXA, can be the shape of the single element.
We have not specified yet because this mesher is defined as "smart". As shows in the previous section, it automatically compute the optimal mesh characteristic requiring no additional work form the user. Furthermore, it is able to distinguish the trailing edge (rear part), the leading edge, the suction side (top part) and pressure side (bottom part). It automatically fixes two point close to the trailing edge, one on the suction and one on the pressure side, in order to create the inlet region.

It can detect the shape of the trailing edge, that can be sharp or not, and so the mesh will be different. Meshing the trailing edge has always been troublesome for engineers due to its strong curvatures and strange shapes.

For a 3D mesh, the user can specify the boundaries surfaces normal to x-axis to be periodic.

The mesh, once the .geo file is open in GMSH, is highly customizable. The user can specify the number of nodes in the inlet section, over the airfoil, over the vertical lines, in the shear, as well as the geometrical growth of the cells. The user can also define the length of the domain. Furthermore, it creates a refinement region close to the airfoil in order to customize the parameters to have a better-refined mesh.
The user can also specify the angle of attack of the profile, which is a fundamental parameters for evaluating airfoil performance. By default it is set to zero. Increasing the AoA leads the airfoil to rotate, as well as the shear and refinement mesh.
Class Shape Transformation (CST) is also implemented. It allows increasing the number of points defining the profile.

PhD student in computational fluid dynamics.
Areas of interest:
- Julia (of course)
- Finite Element Method for fluid-dynamics
- Variational Multiscale Method for incompressible fluids
- HPC for solving large systems

This speaker also appears in: