OpenFOAM/C3/Creating-and-Meshing-aerofoil-in-Gmsh/English

From Script | Spoken-Tutorial
Jump to: navigation, search

Tutorial: Creating and Meshing an aerofoil in Gmsh

Script : Gautam Sharma

Narration : Rahul Joshi

Keywords: Meshing, aerofoil, Gmsh, OpenFOAM.


Visual Cue Narration
Slide 1 Hello and welcome to the spoken tutorial on Creating and Meshing an aerofoil in Gmsh
Slide 2 : Learning Objectives


In this tutorial we will learn to
  • How to create an aerofoil using Gmsh
  • Mesh the created aerofoil
Slide 3: Pre-requisite To practice this tutorial, the user should have basic knowledge of aerofoil and Gmsh.


If not, for Gmsh please see the tutorial on Installing and running Gmsh on the spoken tutorial website.

Slide 4:

System Requirement

To record this tutorial, I am using
  • Ubuntu Linux Operating system version 14.04 and
  • Gmsh version 2.8.3
Slide 5: About aerofoil


Let me introduce you to aerofoil.


Aerofoils are streamline shaped wings which are used in airplanes and turbo machinery.


These shapes are such that the drag force is a very small fraction of the lift.

Show the aerofoil This is a picture of an aerofoil.
Slide 5 :

The dat file


Download the dat file and Python script

The predefined coordinates for aerofoil are available in simple text file with .dat extension.


I will download the .dat file and Python script from this url:

http://community.dur.ac.uk/g.l.ingram/download.php

Open in browser

http://community.dur.ac.uk/g.l.ingram/download.php

Open the Downloads folder

Let me open the website.

Download the .dat file and the Python script and go to the Downloads folder.

Copy-paste files Copy and paste these files from the Downloads folder to Desktop.
Open naca5012xyz.dat file


Open the .dat file.

This file contains the calculated X and Y coordinates for each point that defines the aerofoil.


Z coordinate is kept as zero.

We need the X, Y and Z coordintes in Gmsh acceptable format.


This can be done manually but this is time consuming.

Open Python script Now open the Python script.

This Python script

  • converts the data in the .dat file
  • and gives the ouput in a separate file which is understood by Gmsh.
Open the terminal


Now open the Terminal window.

Type cd space Desktop

Run the python Script


python dat2gmsh.py


naca5012xyz.dat

Now type python space dat2gmsh.py space the name of the dat file and press Enter.


Now type ls.


We can see that a new file by the name naca5012xyz.dat .geo will be generated.

Open naca5012xyz.dat.geo Open the geo file.


This contains the co-ordinates in Gmsh format.

Here nac_lc is the characterstic length which is defined in the first line which is 0.005


I will change this to 0.5


This is because we need a coarser mesh.


You can change this value according to your mesh requirement.

Now save this file.

Open file in gmsh In the terminal window, type gmsh space name of the geo file and press Enter.

This opens gmsh with the aerofoil.

Zoom in at the tail


Now zoom in, by scrolling at the tail end of the aerofoil.


You will note that the aerofoil has an open trailing edge.

Close gmsh Close gmsh.
Open the .geo file with text editor again Now go back to the .geo file.


Scroll down.

Add the point We will add the last point and join it.


Now above spline, enter

Point(1046) = { 1.005, -0.0005, 0.00000, nac_lc};

Modify the spline >> save the file


Modify the spline as

Spline(1000) = {1000:1046,1000};


Save the geo file.

Open .geo file in gmsh Open the modified file in Gmsh. We can see that the edge is joint.
Set up a boundary around the aerofoil Now we will make a boundary around the aerofoil using points.


Enter these coordinates and change the prescribed mesh element size to 0.5

Press Enter.

Enter the points as

(4 3 0)

(4 -3 0)

(-4 -3 0)

(-4 3 0)

Similarly, add the other points.

(4 3 0)

(4 -3 0)

(-4 -3 0)

(-4 3 0)

Join the points by Straight lines Now join the points with a straight line.
Define the surface Now click on Plane surface and select the surface boundary.
Select the aerofoil Zoom in and select the aerofoil as the hole boundary.
Press e to end selection Press e to end selection. You can see we have our surface.
Extrude the surface

Translate>extrude surface

Now we will extrude the surface to make it 3D.

Go to Translate >> Extrude Surface.

A new window will appear asking for cordinates for translation.
Enter the coordinates for Z direction

Click on boundary surface

Since we want to extrude the surface in positive Z direction,
  • enter the coordinates for Z direction as 1
  • and click on the boundary of the surface.
Press e to end selection Press e to end selection.
Click to move the geometry Use the left click of the mouse to move the geometry.


You can see that the geometry has been extruded.

Close Close this.


Close the gmsh window

Open the geo file Open the geo file.
Go to Extrude Scroll down and go to Extrude.
Add these lines inside extrude


Inside Extrude add these lines :


Layers{1};

Recombine;


Save this file.


This will ensure that the mesh is one element thick.

Open the geo file in terminal Now in the terminal window, open the geo file.
Generate the mesh Now we have our geometry, we will do the meshing.


Gmsh automaticaly generates the mesh of the defined geometry.

Go to Mesh >> click on 1D mesh >> 2D mesh >> 3D mesh Go to Mesh.


Click on 1D mesh, 2D mesh and 3D mesh.

The mesh has been generated.

You may notice that the mesh is finer near the aerofoil and gets coarser as we move towards the boundary.
Refine the mesh We can also refine the mesh by clicking on the Refine by Splitting parameter in the mesh menu.
Save your work Now let us save our work.
Click on Save as >> Ok >> Ok Go to File menu and click on Save as.


A new window will appear. In the drop down, change to the mesh format.


And type the name the file as aerofoil.msh

Note that here msh stands for the file type mesh.


Click Ok


Again click Ok

Slide : Assignment This brings us to the end of the tutorial.

As an assignment create another aerofoil by using different dat file for different aerofoil shapes.

Slide: Summary In this tutorial we learnt:


  • How To create an aerofoil in Gmsh.
  • How to do meshing in Gmsh
Slide : About Spoken tutorials Watch the video available at this URL:

http://spoken-tutorial.org/What_is_a_Spoken_Tutorial

It summarizes the Spoken Tutorial project.

If you do not have good bandwidth, you can download and watch it.

Slide: About Spoken tutorials The Spoken Tutorial Project Team

-Conducts workshops using spoken tutorials

-Gives certificates to those who pass an online test

-For more details, please write to us

contact@spoken-tutorial.org

Slide: Acknowledgement


Spoken Tutorials are part of Talk to a Teacher project,


It is supported by the National Mission on Education through ICT, MHRD, Government of India.


More information on the same is available at the following URL link http://spoken-tutorial.org/NMEICT-Intro

About the contributor The script was written by Gautam Sharma and this is Rahul Joshi from IIT Bombay signing off. Thanks for joining.

Contributors and Content Editors

Gautam, Nancyvarkey