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

From Script | Spoken-Tutorial
Revision as of 02:01, 8 August 2014 by Gautam (Talk | contribs)

Jump to: navigation, search

Tutorial: Creating and Meshing an airfoil in Gmsh

Script and Narration: Gautam Sharma


Keywords: Gmsh, Meshing, airfoil.


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


In this tutorial we will learn
  • How to create an airfoil using Gmsh
  • How to mesh the created airfoil


Slide 2:

System Requirement

To record this tutorial, I am using
  • Ubuntu Linux Operating system version 13.10. and
  • Gmsh version 2.8.4


Slide 3: Pre-requisite To practice this tutorial the user should have basic knowledge of Airfoil and Gmsh.


If not, for Gmsh kindly refer the tutorial on Installing and running Gmsh on the spoken tutorial website.

Slide 4: About Airfoil


Let me introduce you to aerofoil.


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


These shapes are such that the drag force is a very small as compared to the lift.

Show the airfoil This is the geometry of an airfoil.
Slide 5 :

The dat file


Download the dat file and Python script


Open browser


Download the files


Go to desktop

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

We will download the .dat file and python script from this url:

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


I will open the browser now.


In the address bar type in the url as shown in previous slide.


Download the naca5012xyz.dat file and the python script dat2gmsh.py and save on the desktop.


Go to the desktop. Here you can see both the files.

Open naca5012xyz.dat file


Open Python script

Let me show you the .dat file.


This file contains the calculated X and Y coordinates of each point that defines the airfoil.


We need the X, Y and Z coordintes in Gmsh acceptable format. This can be done manually but is time consuming.


We will use a python script to do it.


Let me show you the script.


This is the python script. Close the script.

Open the terminal


Press alt ctrl and T key simultaneously to open the terminal.


In the terminal type cd space Desktop to change the present working directory to desktop.


Type ls and press enter. You can see both the files.

Run the python Script

python dat2gmsh.py naca5012xyz.dat

Now type python space dat2gmsh.py space naca5012xyz.dat


This creates a new file with .geo extension which contains the coodinates in gmsh acceptable format.

Open naca5012xyz.dat.geo Let me show you the file.


The nac_lc is the characterstic length which is defined as 0.005

Open file in gmsh


Zoom in at the tail


Close the gmsh

In the terminal type gmsh space naca5012xyz.dat.geo and press enter.


This opens the gmsh with the airfoil.


Zoom in by scrolling at the tail of the airfoil. You will note that the aerofoil has an open trailing edge.


Close the gmsh.

Open the .geo file with text editor again


Add the point

Go back to the .geo file. Scroll down to the bottom.


We will add a new point at the tail to complete the aerofoil.


Type:

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

Modify the spline


Open .geo file in gmsh

Modify the spline to add the new point

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

Save and close the file.


In the terminal repeat the same command by pressing the up key. You will note that the edge is joined.

Set up a boundary around the airfoil


Enter the points as


(4 3 0)

(4 -3 0)

(-4 -3 0)

(-4 3 0)

Now we will make a boundary for the airfoil.


Go to Geometry > Elementary entitites > Add and click on Points. Enter the coordinates of the boundary as:

(4 3 0)

(4 -3 0)

(-4 -3 0)

(-4 3 0)

Join the points by Straight lines Now join the points with straight line
Define the surface Click on Plane surface. Select the surface boundary



Select the aerofoil


Press e to end selection

Zoom in and select the airfoil as the hole boundary.


Click e to end selection. We have our surface

Extrude the surface


Translate>extrude surface

Now we will extrude the surface to make it 3D


Go to Translate and click on Extrude Surface.



Enter the coordinates for Z direction


Press e to end selection


Move the geometry

Since we want to extrude the surface in positive Z direction.

The Z component is kept as 1


Select the boundary of the surface.


Press e to end selection.


Use the left click of the mouse to move the geometry. You can see that the 3D geometry.

Generate the mesh


Go to Mesh>3D

Now we will do the meshing. Gmsh automaticaly generates the mesh of the defined geometry.


Scroll down to Mesh and click on 3D. The mesh has been generated.


You may note that the mesh is finer near the airfoil and gets coarse as it goes towards the boundary.

Refine the mesh We can also refine the mesh by clicking on the Refine by Splitting in the mesh menu.
Save you work Now let us save our work.
Click on save as Go to File menu and click on Save mesh.

We will name our file as airfoil.msh


Note that here msh stands for the file type mesh.

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


As an assignment try creating airfoil by using different dat file for different airfoil shapes.

Slide : Summary


In this tutorial we learnt :


  • To create an Airfoil in Gmsh.
  • To mesh 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

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.

This project is coordinated by http://spoken-tutorial

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

About the contributor This is Gautam Sharma from IIT BOMBAY signing off.

Thanks for joining.

Contributors and Content Editors

Gautam, Nancyvarkey