potential_flow
DESCRIPTION
Solving the potential flow about airfoils, using the Matlab partial differential equation toolbox.TRANSCRIPT
Potential Flow
Introduction
This report describes the finite element analysis using the Matlab partial differential equation toolbox to solve the elliptic potential flow equation computationally over a triangular grid
Potential flow equation : ∇2∅ = 0
Start The Matlab & The PDE-toolbox
1- Start the Matlab , 2010a or later
2- Start the PDE-toolbox :
>> pdetool
This is how it looks, it goes to the draw mode by default, you don’t have to make anything now :
Domain Geometry To create a rectangle to contain your airfoil, the PDE-tool can draw two types of rectangles by default, you can create any of them it doesn’t make any difference
Rectangle/square , where you right click at the rectangle corner and drag to extend from one side
Rectangle/square (centered) , same as before with a drawing symmetry added 1- Use the toolbar or use the menubar >> Draw , and click on any rectangle you want
2- Left click and hold your mouse button anywhere in the drawing area and drag the mouse
to draw the rectangle, don’t worry about the dimensions now
3- Once you draw the rectangle, make sure that there is no button in the toolbar is pressed on, if so, you have to press it back again to turn it off
4- Double click on the rectangle to open the Object Dialog window , it has the object type
and the object name with four numbers representing the rectangle position [ lower left x position , lower left y position , width , height ] , put the dimensions shown in the figure below
5- Use the menubar >> Options, and check the axes equal
6- You can delete any wrong rectangle by simply left-click anywhere outside the drawing
area, then select the wrong rectangle and press the delete button or the backspace button on your keyboard
Airfoil Geometry
1- Use any software to create your airfoil dimensions or download any geometry file you want
2- Input your geometry into the PDE-toolbox as a polygon >> pdepoly ( x , y , ‘name’ ); Where :
x and y are the airfoil coordinates, sometimes you have to delete the x and y coordinates of the last point, because they are the same as the first point, so it’s better to type this >> pdepoly( x( 1 : end-1 ) , y( 1 : end-1 ) , 'F' );
name is a character to identify your airfoil, it’s better to use a single character, for this example use the letter ( F )
3- Set the geometric formula to B – F, to subtract the airfoil from the domain box
Generate Mesh
The default and the only mesh in the PDE-tool is the delaunay triangular grid 1- Use the menubar >> mesh and check the initialize mesh, or use the toolbar, or simply press
Ctrl+i to generate the mesh
2- You may refine the mesh if it needs to be refined, by clicking the button on the right side of the initialize mesh button, do not use too much panels because it may harm your computer
Boundary Conditions
1- Press Ctrl + b for the boundary mode
2- Press Ctrl + a to select all the geometry, the boundary mode selects all by default, but you
have to be sure
3- Menubar >> Boundary >> Specify Boundary Conditions
4- Choose Neumann boundary condition for all the segments in the drawing , with g = 0 , q =
0 , then press ok, this represents the slip flow condition, compare the Boundary condition
equation n*c*grad(u) + qu = g with 𝛿∅ 𝛿�̂�⁄ = 0 , where �̂� is the unit normal vector of the
area
5- Double click on the left side of the rectangle or from the menubar >> Boundary >> Specify Boundary Conditions , it will open the Boundary Condition dialogue again, for this input flow surface set g = 1 , q = 1 , then press ok
6- Double click on the right side of the rectangle or from the menubar >> Boundary >> Specify
Boundary Conditions , it will open the Boundary Condition dialogue again, for this outflow surface set g = 1 , q = 0 , then press ok
SET the PDE Coefficients
From the toolbar, press the PDE button, compare the equation written in the PDE Specification dialogue –div(c*grad(u)) + a*u = f with the ∇2∅ = 0 , set the PDE coefficients as follows, and press ok
Solve & Plot
1- Select the plotting parameters from the menubar >> Parameters, or press the Plot button from the toolbar
2- Set the plotting parameters as follows :
3- Check the results
This result shows the absolute velocity distribution, you can refine the mesh and resolve
Export To The WorkSpace
1- Export the solver parameters to the Matlab workspace, by default the variable is ( u ) , and press ok
2- Export the mesh parameters to the Matlab workspace, by default the mesh parameters are : p , e , t
Calculate Velocity & Pressure
At this stage you have the following variables : p , e , t , u in the Matlab workspace, representing the mesh parameters and the solved velocity potential ∅
1- To extract the velocity components from the velocity potential ∅, type this : >> [ ux , uy ] = pdegrad( p , t , u ) ; % you can calculate the absolute velocity v = sqrt ( ux.^2 + uy.^2 ); but ux alone is enough for demonstration 2- Calculate the pressure coefficient >> cp = 1 – ( ux.^2 ); 3- Plot
>> figure( ‘color’ , ’w’ , ’numbertitle’ , ’off’ , ’menu’ ,’none’ , ’name’ ,’Ta7ya Masr’)
>> tmp = { -ux , cp ; ‘Velocity Field’ , ’Pressure Field’ }; >> for i = 1 : 2 >> subplot( 2 , 1 , i ) >> pdeplot( p ,[],t,'xydata', tmp{ 1 , i } ,…
'xystyle' , 'interp' , 'contour' , 'on' ,... 'flowdata' , [ -ux ; -uy ] , 'flowstyle' , 'off' ,...
'colormap' , 'jet' , 'colorbar' , 'on' );
>> set( gca , 'XLim' , [-1 2] , 'YLim' , [-1 1] ) >> axis equal ; axis off ; zoom(2) ; zoom on >> title ( tmp{ 2 , i } ) >> end
Hard Coded Solvers
Many options with the boundary conditions and the PDE specifications may be made to enhance the solution and to check more geometries under aero/hydro/structural/thermal loads, the following links show how to solve the PDE’s programmatically with more different techniques
1- Seven different methods to solve the potential flow equation about Joukowski airfoils http://www.airloads.net/Joukowski.html
2- Solving the potential flow about airfoils in cascade http://www.youtube.com/watch?v=avY5UdOuddg&list=UUNrcSFqQZs71WpBtI4Slq7w&feature=c4-overview
3- Solving the elasticity equations over a rectangular cross-section
http://www.airloads.net/Numerical_Structure.html
4- Solving the heat equation over a rectangular grid http://www.airloads.net/Heat.html
https://www.facebook.com/Airloads In the hope it will be useful, Cairo-2014.