You are on page 1of 23

Meshing tutorial for NACA0012 profile - two-dimensional

Note:

● This tutorial has only didactic purpose, aiming to help beginners, and it does
not guarantee quality of simulation results. Verification and validation of the
results, and also the study of mesh refinement and other analyzes are left as
responsibility of the user.
● This offering is not approved or endorsed by OpenCFD Limited, producer and
distributor of the OpenFOAM software via ​www.openfoam.com​, and owner of
the OPENFOAM® and OpenCFD® trade marks.
● This tutorial was created within the context of an UFSC extension project and
it is not approved by GMSH and OpenFOAM® developers.
● This tutorial was prepared by the undergraduate students Juliano Simon and
Eduardo de Bittencourt Ribeiro, under the supervision of Filipe Dutra da Silva.
● Please quote this page if you use this material. Questions and suggestions
can be sent to the contact addresses shown at the end of this page.

This tutorial will present the procedure to generate a 2D structured mesh (C-grid) for
NACA 0012 airfoil, using the Gmsh code. There are two ways of using Gmsh:
through the commands of the graphical interface of the software or editing the script
with extension .geo, which is generated by the software. Both ways of using the
software will be shown here. To open the script, go to ​Modules → Geometry​ and click
on ​Edit Script.
First it is necessary to load the points that are required to generate the profile lines. These
points must be written in the .geo file as shown below:

Point (number) = (x, y, z, 1.0);

You can use an external code to write the coordinates in the required format, considering the
large number of points. For this tutorial, the sequence of points is at the end.
The next step is to create the points located at the boundaries of the computational domain.
The domain shape is shown at the beginning of this tutorial. To facilitate the possible need to
change the size of this domain, several parameters will be defined using variables.
The next step is to connect the points that will define the mesh. Go to ​Modules→Geometry → 
Elementary entities → Add → Line ​and select the two points you want to connect. Connect the
points as shown in the images.
The .geo code should be as shown below:

To complete the mesh front side, a half circle should be made. To do this, select ​Modules → 
Geometry → Elementary entities → Add → Circle arc ​and select the highest point, the
centerpoint and the lowest point.
In the .geo file:
Then, we will create splines that define the airfoil shape. Go to ​Modules → Geometry → 
Elementary entities → Add → Spline​ ​and select the sets of points in the sequence shown
in the figures below.
The .geo file should be as following:
Now, the “Transfinite” function should be applied to the edges of the mesh. This will
define the number of elements at each line of the block and the rate of growth of the
elements. Go to ​Modules → Mesh → Define → Transfinite → Curve ​and select the
curves in that order:

● The front side curves of the airfoil and the front boundary of the mesh.
● The vertical lines
● The lateral lines of the airfoil and the boundaries of the mesh
● The horizontal lines
The .geo file should look like this:

Then, we will adjust the number of volumes in each part of the mesh and also the
spacing of those volumes. To do this, set these modifications in .geo file:
Now it is necessary to define the plans. Go to ​Modules → Geometry → Elementary 
entities → Add → Plane surface ​and select the curves that define each plane and press
“e” to confirm. Example:
Doing this for each plane, the final result should be as shown below:
The .geo file should look like this:
Now we will use the “Transfinite” function applied to the mesh faces. ​Go to Modules 
→ Mesh → Define → Transfinite → Surface ​and select the faces pressing “e” to
confirm. In the .geo file:

Then go to ​Modules → Mesh → Define → Recombine ​and select all faces and press
“e” to confirm. In .geo file:
Now the mesh will be extruded. Go to ​Modules → Geometry → Elementary entities → 
Extrude → Translate ​and select all faces and press “e” to confirm. The result should be
like this:

In .geo file, change the settings as shown below:

Finally, we must name each surface of the mesh that will be responsible for the
boundary conditions. Go to ​Modules → Geometry → Physical Groups → Add → Surface. 
Select and name the surfaces in this order:

● inlet
● outlet

● airfoil
● front and back

Now, go to ​Modules → Geometry → Physical Groups → Add → Volume ​and select all
the volumes:
The result in .geo file should be as follows:

At the end, add the command “Mesh 3;” in the .geo file and then the mesh creation is
complete. To create the file that will be used in OpenFOAM, click on ​File → Export ​,
choose the directory where you want to save, and save it with .msh extension. Then
an “MSH Options” window will appear, select the “Version 2 ASCII” format and click
on save.

You might also like