optimization of low speed airfoils using mathlab

64
Shape Optimization of Low Speed Airfoils using MATLAB and Automatic Differentiation Christian Wauquiez Stockholm 2000 Licentiate’s Thesis Royal Institute of Technology Department of Numerical Analysis and Computing Science

Upload: samy90x

Post on 26-Oct-2014

71 views

Category:

Documents


5 download

TRANSCRIPT

Page 1: Optimization of Low Speed Airfoils Using Mathlab

Shape Optimization of Low Speed Airfoilsusing MATLAB and Automatic Differentiation

Christian Wauquiez

Stockholm 2000

Licentiate’s ThesisRoyal Institute of Technology

Department of Numerical Analysis and Computing Science

Page 2: Optimization of Low Speed Airfoils Using Mathlab

lowtlab

. Thethe

dragary

and: thepartthe

la.

tive

ntingiffer-

timi-

AbstractThe goal of the project is to develop an innovative tool to perform shape optimization ofspeed airfoils. This tool is written in Matlab, and is constructed by coupling the MaOptimization Toolbox with a parametrised numerical aerodynamic solver.

The airfoil shape is expressed analytically as a function of some design parametersNACA 4 digits library is used with design parameters that control the camber andthickness of the airfoil.

The solver has to provide fast and robust computation of the lift, pitching moment andof an airfoil placed in a low-speed viscous flow. A one-way coupled inviscid - boundlayer model is used.

The inviscid flow is computed with a linear vortex panel method, which provides the liftmoment coefficients. The boundary layer is computed using an integral formulationlaminar part of the flow is computed with a two-equation formulation, and the turbulentis solved with Head’s model. An e9-type amplification formulation is used to locatetransition area. Finally, the drag coefficient is computed using the Squire-Young formu

In order to be used in optimization, the solver must provide derivatives of the objecfunction and limiting constraints with the solution for each set of parameters.

These derivatives are computed by automatic differentiation, a technique for augmecomputer programs with the computation of derivatives based on the chain rule of dential calculus. The recent Matlab automatic differentiation toolbox ADMAT is used.

Finally as an application, sample optimization problems are solved using the Matlab Opzation Toolbox, and the resulting optimal airfoils are analysed.

ISBN 91-7170-520-1● TRITA-NA-0004 ● ISSN 0348-2952● ISRN KTH/NA/R--00/04--SE

1

Page 3: Optimization of Low Speed Airfoils Using Mathlab
Page 4: Optimization of Low Speed Airfoils Using Mathlab

7

9

1

1

erestand

roothe

H,, is

Contents

Introduction

1- The Aerodynamics Solver. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .1.1- Introduction - Overview of the Model1.2- Airfoil and Flow Parameters1.3- Inviscid Flow Model1.4- Boundary Layer Model

2- Automatic Differentiation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32.1- Introduction2.2- Method Fundamentals2.3- Computer Implementation2.4- ADMAT, Automatic Differentiation Toolbox for Matlab2.5- Application of ADMAT to the Aerodynamic Solver

3- Airfoil Shape Optimization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53.1- Definition of the Optimization Problems3.2- Solving the Optimization Problems

Conclusion. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6

References

AcknowledgementsI would like to thank my supervisor, Associate Professor Jesper Oppelstrup, for his intand support throughout this work, and Professor Arthur Rizzi for providing informationfor many helpful discussions.

I would also like to thank, for advice and technical support, Associate Professor Ilan Kfrom Stanford University and Desktop Aeronautics, and Doctor Arun Verma fromCornell University Theory Center.

Financial support from NUTEK through the Parallel Scientific Computing Institute, KTand TFR through the Center for Computational Mathematics and Mechanics, KTHgratefully acknowledged.

3

Page 5: Optimization of Low Speed Airfoils Using Mathlab
Page 6: Optimization of Low Speed Airfoils Using Mathlab

t andliedflow

ow,

of theain

ers

ased

sedf this

daryon ofn aresktopian

nedters.In thehain-ramseneralatthis

0],inedare

IntroductionThe performance of an airfoil can be characterized by three quantities : the lift, momendrag coefficients :Cl, CmandCd respectively. They represent the aerodynamic loads appto the airfoil. The actual loads are proportional to the coefficients times the square of thevelocity.

• Cl corresponds to the force acting on the airfoil in the direction orthogonal to the flwhich allows an aircraft to fly by compensating its weight.

• Cmcorresponds to the moment of the aerodynamic force with respect to the quarterairfoil chord length. For the equilibrium of an aircraft, the pitching moment of the mwing has to be compensated by the moment of a negative-lift tail.Cmshould therefore notbe too large.

• Finally, Cdcorresponds to the component of the force in the flow direction, which hindaerodynamic performances and causes fuel consumption.

The present work focuses on shape optimization of airfoils in low speed viscous flows, bon the analysis ofCl, Cm andCd.

The airfoils are chosen from the NACA 4 digits library [1], in which the shape is expresanalytically as a function of three parameters. The library is presented in section 1.2 oreport.

The formulation used to compute the aerodynamic coefficients is an inviscid - bounlayer model. The advantage of this kind of approach is that it provides a fast computatithe flow solution, the disadvantage being that cases with massive flow separatioimpossible to handle. Famous codes based on this formulation include for 2D cases DeAeronautics’ Panda [9], and Mark Drela’s ISES [10] and Xfoil [12], and for 3D cases BrMaskew’s VSAERO [3]. The solver is presented in section 1.

In order to perform optimization, the solver has to provide the derivatives of the defiobjective function and limiting constraints with the solution for a given set of parameThe most common method used to compute these derivatives is finite differences.present work, a new approach, called automatic differentiation (AD), is used. Is is a crule-based technique to compute the derivative of functions defined by computer progwith respect to their input variables, and has been investigated since 1960. In 1998, a gAD toolbox for programs written in Matlab, called ADMAT [19], has been developpedCornell University by Arun Verma and Thomas F. Coleman. The present work usestoolbox. Automatic differentiation is presented in section 2.

Finally, airfoil shape optimization is performed using the Matlab Optimization Toolbox [2which uses a Sequential Quadratic Programming algorithm for non linear constraproblems. The formulation of sample optimization problems and their resolutionpresented in section 3.

5

Page 7: Optimization of Low Speed Airfoils Using Mathlab
Page 8: Optimization of Low Speed Airfoils Using Mathlab

f theodel,

pletein apastthislayerodel.

tionpanelyinghis is

fer inrces,t oneboutistri-utta

ceoullited by

1- The Aerodynamic SolverThe solver used to provide the objective function as well as the limiting constraints ooptimization is presented. The solution is computed using an inviscid-boundary layer mand consists in the lift, moment, and drag coefficients : Cl, Cm and Cd respectively.

1.1- Introduction - Overview of the Model

The general Navier-Stokes equations are very powerful since they give a comdescription of all possible flow situations. However it is very time-consuming to obtanumerical solution using them. In our particular case, the incompressible turbulent flowan airfoil, the viscous effects are important only in a small region near the profile. Inregion, the Navier-Stokes equations can be approximated by the so-called boundaryequations. Outside, viscous effects can be neglected, and one can use an inviscid flow m

The inviscid flow model

The inviscid part of the flow can be solved in several ways. A finite difference discretizaof the steady Euler equation on a grid around the airfoil can be used, as in ISES [10], or amethod, as in Xfoil [12] and Panda [9]. One advantage of the first option is that by appla periodic boundary condition to the outer boundary, cascade flows can be simulated. Tdone in MISES [13], an extension of ISES.

In the present work, a panel method is used. A variety of such methods exists, they difthe choice of the singularity used to represent the velocity potential on the airfoil (soudoublets or vortices), and by the choice of the Kutta condition, an extra condition thamust add to the final system of equations in order to obtain a unique solution. Details adifferent panel methods can be found in [2]. The present work uses a linear vortex dbution, which gives a good solution accuracy, even with only a few panels. The Kcondition chosen is especially well suited for linearly varying singularity distributions.

The inviscid flow solver provides the tangential velocity distribution on the airfoil’s surfa(Ue). The pressure distribution is then computed from the velocity field using the Bernequation. The lift and moment coefficients, as well as the pressure drag, are calculaintegrating the pressure over the body surface.

V V

Navier-Stokes Euler

Boundary Layer

7

Page 9: Optimization of Low Speed Airfoils Using Mathlab

, aon

tionswhich

r andn theinariallyresentrated

ore

, the

ending

y thearyface.

.

s.

has

hisientdified

1- The Aerodynamic Solver

The boundary layer model

The boundary layer formulation consists of a model for the laminar part of the flowtransition criterion, and a model for the turbulent part of the flow. The flow models relyone or two differential equations derived from the integration of the Falker-Skan equaaccross the boundary layer thickness, and on additional semi-empirical equationsclose the sytem.

Xfoil and ISES use the same viscous formulation : a set of two differential equations(integral momentum and kinetic energy shape parameter equations) for both laminaturbulent flows, and different closure relations depending on the flow regime. Panda oother hand uses simpler formulations : Thwaites’ one equation method [4] for the lampart, and Head’s two equations method [5] for the turbulent part. The present work initused simple models, thus Thwaites’ and Head’s. But since Thwaites’ model cannot repseparated flow, Xfoil’s laminar boundary layer model, which can describe thin separegions, has been implemented instead.

Concerning the transition criterion, Panda uses Michel’s criterion, and Xfoil uses a madvanced e9-type formulation. The second method has been chosen after testing.

Details about the reasons of these choices are found in sections 1.4.1 and 1.4.2.

The results provided by the boundary layer solver include the displacement thicknessmomentum thickness , the shape factorH, and the skin friction coefficientCf. Thesequantities are used to compute the drag coefficient. Different methods can be used depon the coupling between the inviscid flow and the boundary layer.

The coupling

The coupling between the two models is as follows :

• The effect of the boundary layer is that it modifies the shape of the airfoil as seen bexternal flow. This gives the inviscid flow a zero normal velocity condition on a boundobtained by adding the boundary layer displacement thickness to the airfoil’s sur

• The boundary layer equations depend on the external tangential velocity distribution

Two different approaches are possible for the coupling of inviscid - boundary layer flow

Two-way coupled computation

In this case, the modification of the boundary where the zero normal velocity conditionto be met due to the boundary layer thickness is taken into account.

The solution begins with the inviscid flow problem, which produces the velocity field. Tdata is then fed into the boundary layer model which results the local wall friction coefficand the displacement thickness. Then a second iteration is performed, now with mo

δ∗θ

δ∗

Inviscid Flow withBoundary Layer

Ue

δ∗zero normal velocity condition

on Airfoil +δ∗

8

Page 10: Optimization of Low Speed Airfoils Using Mathlab

nelsntil a

itionr the

rag,y

nce isThe

olvedthod

ion isthe

fectsults

d forflowt work.

plethree

imum

1.2- Airfoil Shape Parameters

surface geometry. This modification can be obtained by displacing the body paaccording to the local displacement thickness, and the procedure is reiterated uconverged solution is obtained.

Another way to account for the displacement effects is to modify the boundary condinstead of the geometry. In this case the normal flow is made non-zero to account foeffect of . This formulation, known as the transpiration velocity concept, states that :

on the airfoil’s surface.

Using a two-ways coupled model, the total drag is found by adding the friction dobtained by integrating the skin friction coefficientCf, to the pressure drag, obtained bintegrating the inviscid pressure distribution.

A study of such iterative methods can be found in [14], where it appears that convergenot easy to obtain. A more recent approach is the one used in ISES and Xfoil.transpiration velocity concept is used, and the entire nonlinear equation set is ssimultaneously as a fully coupled system by a Newton-Raphson method. This meprovides more robust results than the iterative approach.

One-way coupled computation

In this case the effect of the boundary layer thickness is neglected. One single iteratperformed : the external tangential velocity is computed by the inviscid model withconditionV.n=0 on the airfoil’s surface, and then fed into the boundary layer model.

The drag coefficient is obtained using the Squire-Young formula [8], which in efcomputes the momentum deficit. It is a function of some of the boundary layer re(momentum thickness and shape factor) at the trailing edge.

Compared to coupled computations, the accuracy of the lift is very good, but not as goothe drag. However the sensitivity of the results with respect to airfoil shape orparameters is well reproduced. This method is used in Panda, as well as in the presen

1.2- Airfoil Shape Parameters

The shape of the airfoil can be chosen in the famous Naca 4 digits library [1]. This simlibrary is interesting because the shape is expressed analytically as a function ofparameters, which control the maximum camber, maximum camber location, and maxthickness of the airfoil.

δ∗

V n⋅ ddx------ Ueδ∗( )=

x

y

Maximum Camber

Maximum Thickness

Maximum Camber Location

2412

8412

4212

4812

4406

4420

9

Page 11: Optimization of Low Speed Airfoils Using Mathlab

n the

atestegertens

d.

dge,

ion, athe

on as

1- The Aerodynamic Solver

A wide variety of airfoils can be obtained by varying the three parameters, as shown oprevious figure.

A numbering system is used to define NACA 4-digits wing sections. The first digit indicthe maximum value of the mean-line ordinate in percent of the chord. The second inindicates the distance from the leading edge to the location of the maximum camber inof the chord. The last two integers indicate the section thickness in percent of the chor

Thus, the NACA 4512 has 4% camber located at 50 % of the chord from the leading eand is 12% thick.

We note that these digits do not really have to be integers. By extension of the notatNACA 4.23 2.21 17.2 would have 4.23% camber located at 22.1% of the chord fromleading edge, and be 17.2% thick

The wing section is obtained by combining the camber line and the thickness distributishown on the following figure

And :

where and are points on the upper and lower surface respectively.

The thickness distribution and the camber line are given by :

And : for

for

In these expressions,c is the airfoil chord length,m is the maximum camber,p is themaximum camber location, and is the maximum thickness.

x

y

ythθ

yth

yc

xU x yth θcos–=

yU yc yth θsin+=

xL x yth θcos+=

yL yc yth– θsin=

xU yU,( ) xL yL,( )

yth 5τc 0.2969 xc--- 0.126

xc---– 0.3537

xc---

2– 0.2843

xc---

30.1015

xc---

4–+

=

ycmp2----- 2p

xc--- x

c---

2–

=xc--- p≤

m1 p–( )2

------------------- 1 2p 2+– pxc--- x

c---

2–

=xc--- p≥

τ

10

Page 12: Optimization of Low Speed Airfoils Using Mathlab

icallythenthe

tial.

o :

:

ationly set

esP is

1.3- Inviscid Flow Model

1.3- Inviscid Flow Model

The incompressible potential flow governed by the Laplace equation is solved numerwith a panel method, which provides the tangential external velocity. The pressure isobtained using the Bernoulli equation, and Cl and Cm are derived by integratingpressure over the airfoil.

Theoretical equation of the flow

For an irrotational flow, the velocity is the gradient of a quantity called the velocity poten

Substituting this into the continuity equation for an inviscid incompressible flow leads t

or : (Laplace equation)

On the airfoil’s surface A, the external Neumann boundary condition must be satisfied

,

where can be related to integral boundary layer quantities through the transpirvelocity model. In our case, the effect of the boundary layer is neglected and is simpto zero, which produces the classical zero normal velocity condition.

General solution of the incompressible potential flow

A general solution to the Laplace equation is obtained by adding a distribution of vorticon the airfoil’s surface to the potential of the free stream. The solution at any field pointthus given by :

,

where is the potential of a unit strength vortex :

being the polar coordinate of P relative to (ds).

airfoil A

nInviscidIncompressibleIrrotational

U∞α

V u v,( ) ∇φ= =

x2

2

∂∂ φ

y2

2

∂∂ φ+ 0= ∆φ 0=

φ∂n∂

------ Vn=

VnVn

γ

φP u∞ x v∞ y γ φv sdA∫+⋅+⋅=

φv

φv1

2π------θ–=

r θ,( )

11

Page 13: Optimization of Low Speed Airfoils Using Mathlab

ody isem at

mes :

ack

ained

1- The Aerodynamic Solver

This equation has to satisfy the boundary condition for every point on A, which gives :

This is the basis equation for the panel method. To construct a numerical solution the bdivided into N flat panels and the boundary condition equation is specified on each of tha "collocation point" defined as the panel mid-point.

Moreover, the integration is performed on each panel and the boundary condition beco

Singularity element

Now, the integral on each panel must be computed :

We will first computeu andv in the panel coordinate system, and then transform them bin the global coordinate system.

We now consider the coordinates (x,y) in the panel coordinate system. They are obtusing the following transformation :

,

where are the coordinates of the panel origin in the global coordinate system.

∇φP n⋅ 0 u∞ v∞,( ) n γφ∂ v

n∂-------- sd

A∫+⋅⇒ 0= =

1

23

NN-1Panel corner pointCollocation point

u∞ v∞,( ) n γφ∂ v

n∂-------- sd

panel∫

i 1=

N

∑+⋅ 0=

γφ∂ v

n∂-------- sd

panel∫ γ

φ∂ v

x∂-------- s γ

φ∂ v

y∂-------- sd

panel∫,d

panel∫

n u v,( ) n⋅≡⋅=

x

y

p

αicos αisin–

αisin αicos

x x0–

y y0–

G

=

x0 y0,( )

x

y Global CSPanel CS

xp

yp

αi

Panel i

12

Page 14: Optimization of Low Speed Airfoils Using Mathlab

ryingential

1.3- Inviscid Flow Model

On each panel, we choose a linear vortex distribution .

This is simply the superposition of a constant-strength element and a linearly vaelement. For simplicity, we consider the two elements separately to compute the potand the velocity induced by one panel.

So :

And :

Details of the computation of the integrals appear in [2]. The result is :

and :

We consider the linear term now :

So :

And :

γ x( ) γ0 γ1x+=

yp

xp

L

γ0

γ0 γ1x+

φγ 0

γ0–

2π-------- y

x x0–--------------atan x0d

0

L

∫=

uγ 0

φγ 0∂

x∂----------

γ0

2π------ y

x x0–( )2 y2+--------------------------------- x0d

0

L

∫= =

vγ 0

φγ 0∂

y∂----------

γ– 0

2π--------

x x0–

x x0–( )2 y2+--------------------------------- x0d

0

L

∫= =

uγ 0

γ0

2π------ θ2 θ1–( )= vγ 0

γ0

2π------

r2

r1----ln=

φγ 1x

γ1–

2π-------- x0

yx x0–--------------atan x0d

0

L

∫=

uγ 1x

φγ 1x∂

x∂------------

γ1

2π------

x0y

x x0–( )2 y2+--------------------------------- x0d

0

L

∫= =

vγ 1x

φγ 1x∂

y∂------------

γ– 1

2π--------

x0 x x0–( )x x0–( )2 y2+

--------------------------------- x0d

0

L

∫= =

13

Page 15: Optimization of Low Speed Airfoils Using Mathlab

holeto thegure.

el end

ng

1- The Aerodynamic Solver

Solving the integrals gives :

And :

Now, what we really want is a piecewise linear continuous vortex distribution on the wairfoil surface. So we have to set the strength of at the beginning of each panel equalstrength of the vortex at the end point of the previous panel as shown on the following fi

The relation between the vortex strengths of the elements shown above and the panvalues and is :

and

Thus, rearranging the expressions foru andv in terms of and gives :

These two equations can be divided into velocity induced by and , such that :

,

where the subscriptsa and b represent the contribution due to the leading and trailisingularity respectively. By rearranging the equations, we obtain thea part of the velocity :

uγ 1x

γ– 1

4π-------- 2z

r1

r2---- 2x θ2 θ1–( )–ln=

vγ 1x

γ– 1

2π-------- x

r1

r2---- L z θ2 θ1–( )+ +ln=

γ

yp

xp

j-1j

j+1

j+2

γ j 1–

γ j

γ j 1+

γ j 2+

P(x,y)

θ j 1+

θ j

r j 1+

r j

γ0 γ1

γ j γ0= γ j 1+ γ0 γ1L+=

γ j γ j 1+

uz

2π------

γ j 1+ γ j–

x j 1+ xj–-----------------------

r j 1+

r j-----------

γ j x j 1+ xj–( ) γ j 1+ γ j–( ) x xj–( )+

2π xj 1+ xj–( )-------------------------------------------------------------------------------------- θ j 1+ θ j–( )+ln=

vγ j x j 1+ xj–( ) γ j 1+ γ j–( ) x xj–( )+

2π xj 1+ xj–( )--------------------------------------------------------------------------------------

r j

r j 1+-----------

z2π------

γ j 1+ γ j–

x j 1+ xj–-----------------------

xj 1+ xj–

z----------------------- θ j 1+ θ j–( )++ln–=

γ j γ j 1+

u v,( ) ua va,( ) ub vb,( )+=

uaγ j

2π xj 1+ xj–( )---------------------------------- z–

r j 1+

r j----------- x j 1+ x–( ) θ j 1+ θ j–( )+ln=

vaγ– j

2π xj 1+ xj–( )---------------------------------- x j 1+ x–( )

r j

r j 1+----------- x j 1+ xj–( ) z θ j 1+ θ j–( )++ln=

14

Page 16: Optimization of Low Speed Airfoils Using Mathlab

on by

to

ailingnear

, and

1.3- Inviscid Flow Model

And theb part of the velocity :

To transform these velocity components back to the global coordinate system, a rotatithe panel orientation angle is performed as given by :

(1)

The expressions above can be included in an induced velocity functionF, which willcompute the velocity(u,v) at an arbitrary point (x,y) in the global coordinate system duethe j-th panel.

Discretization of geometry

In most cases involving thick airfoils, a denser paneling is used near the leading and tredges. A frequently used method for dividing the chord into panels with larger densitythe edges is the full cosine method. It is shown on the figure below.

If nine chordwise panels are needed, then the semicircle is divided by this number. The correspondingx stations are found by using the following formula :

Then the airfoil points coordinates are computed using the airfoil shape function.

ubγ j 1+

2π xj 1+ xj–( )---------------------------------- z

r j 1+

r j----------- x xj–( ) θ j 1+ θ j–( )+ln=

vbγ j 1+

2π xj 1+ xj–( )---------------------------------- x xj–( )

r j

r j 1+----------- x j 1+ xj–( ) z θ j 1+ θ j–( )++ln–=

αi

u

v

G

αicos αisin

αisin– αicos

u

w

p

=

ua va,ub vb,

F γ j γ j 1+ x z xj y j x j 1+ yj 1+, , , , , , ,( )=

∆β

∆β

∆β

1 2 3 4 5 6 7 8 910

x

y

12

34

5678

9

1011 12 13 14 15 16 17 18 19

Corner pointCollocation point

∆β π 9⁄=

xc2--- 1 βcos–( )=

15

Page 17: Optimization of Low Speed Airfoils Using Mathlab

, theis

f thel

rface.

1- The Aerodynamic Solver

Influence coefficients

In this phase, the zero normal flow boundary condition is implemented. For examplevelocity induced by thejth element with a unit strength at the first collocation pointobtained by :

This shows that the velocity at each collocation point is influenced by the two edges ojth panel. When adding the influence of thej+1 panel and on, the local induced velocity wilhave the form :

This equation can be reduced to the form :

Such that for the first and last terms :

and :

And for all other terms :

The influence coefficient is then defined as the velocity component normal to the su

The contribution of a unit strength singularity elementj at collocation point 1 is therefore :

,

where :

ua va,ub vb,

1 j

F γ j 1= γ j 1+ 1= x1 z1 xj y j x j 1+ yj 1+, , , , , , ,( )=

u v,( )1 ua va,( )11γ1 ub vb,( )11 ua va,( )12+[ ]γ2 … ub vb,( )1N 1– ua va,( )1N+[ ]γN ub vb,( )1NγN 1++ + + +=

u v,( )1 u v,( )11γ1 u v,( )12γ2 … u v,( )1NγN u v,( )1N 1+ γN 1++ + + +=

u v,( )11 ua va,( )11= u v,( )1N 1+ ub vb,( )1N=

u v,( )1 j ub vb,( )1 j 1– ua va,( )1 j+[ ]=

aij

a1 j u v,( )1 j n1⋅=

ni αi αicos,sin( )=

x

y

αi

ni αi αicos,sin( )=

ti αi αisin–,cos( )=

16

Page 18: Optimization of Low Speed Airfoils Using Mathlab

ints

sicalation

:

using

.

1.3- Inviscid Flow Model

Establishing boundary conditions

The free stream normal velocity component is found as :

Specifying the boundary condition equation for each (i= 1 to N) of the collocation poresults in N linear equations with the unknowns (j = 1 to N+1).

An additional condition must be established in order to obtain a unique solution. Phyconsiderations lead to the choice of the Kutta condition, which specifies that the circulat the trailing edge must be zero :

With our model, the circulation is given by , and the Kutta condition is

This extra condition is added to the system of equations to give :

(2)

The above set of equations has well defined diagonal, and can be solved for bystandard methods of linear algebra.

Modification of the Kutta condition

With the implementation of the Kutta condition above, strange results can be obtained

Indeed the condition makes possible results such as :

and

A better Kutta condition would require in addition that both vorticities must be small.

We apply the following :

and

RHSi u∞ v∞,( ) αi αicos,sin( )⋅–=

γ j

a11 a12 … a1N 1+

a21 a22 … a2N 1+

… … … …aN1 aN2 … aNN 1+

γ1

γ2

…γN 1+

RHS1

RHS2

…RHSN

=

γTE 0=

γTE γ1 γN 1++=

γ1 γN 1++ 0=

a11 a12 … a1N 1+

a21 a22 … a2N 1+

… … … …aN1 aN2 … aNN 1+

1 0 … 1

γ1

γ2

…γN 1+

RHS1

RHS2

…RHSN

0

=

γ i

γ1 γN 1++ 0=

γ1 1e6= γN 1+ 1– e6=

γ1 0= γN 1+ 0=

17

Page 19: Optimization of Low Speed Airfoils Using Mathlab

tant-avesrtion

of

s from

in the by :

1- The Aerodynamic Solver

It is thus necessary to introduce an additional unknown. A wake panel with a consstrength vortex is added to the model as shown on the following figure. The panel lethe trailing edge at its median angle and extends to infinity, so that in practice the far po(starting vortex) will have no influence.

In the panel coordinate system, the velocity induced by the constant-strength vortexthe wake panel at point is :

where is the angle at which P sees the wake panel, and and are the distance

P to the wake panel end points, as shown on the following figure.

These velocity components are computed at each collocation point, and transferedglobal coordinate system using equation (1). The influence coefficient is then obtained

,

where :

This is then included in the influence matrix, as well as the new Kutta condition.

We obtain :

(3)

Which can be solved for .

γw

12

3

NN-1W

γwP xi yi,( )

uiw1

2π------βiwγw=

viw1

2π------

ri1

ri∞------

γwln=

βiw ri1 ri∞

X

Y

Wake panel

P xi yi,( )

βiwx1

x∞

ri∞ri1

aiw u v,( )iw ni⋅=

ni αi αicos,sin( )=

a11 a12 … a1N 1+ a1w

a21 a22 … a2N 1+ a2w

… … … … …aN1 aN2 … aNN 1+ aNw

1 0 … 0 0

0 0 … 1 0

γ1

γ2

…γN 1+

γW RHS1

RHS2

…RHSN

0

0

=

γ i

18

Page 20: Optimization of Low Speed Airfoils Using Mathlab

se is a

o the

1.3- Inviscid Flow Model

Results are now presented using the regular and modified Kutta conditions. The test caNACA 9912 at zero angle of attack, with 100 panels.

This example clearly shows the improvement of the solution.

Calculation of the velocity

The velocity is obtained by adding the tangential components of (u,v) of each panel ttangential component of the external flow velocity.

So we have to build the matrixb of coefficients such that :

,

where :

And the vector of terms :

Then, we have :

Which gives the tangential velocity at each airfoil collocation point.

N N 1+× bij

bij u v,( )ij ti⋅=

ti αicos αisin–,( )=

Ue∞ Ue∞( )i u∞ v∞,( ) αicos αisin–,( )⋅–=

Ue1

Ue2

…UeN

b11 b12 … b1N 1+

b21 b22 … b2N 1+

… … … …bN1 bN2 … bNN 1+

γ1

γ2

…γN 1+

Ue∞1

Ue∞2

…Ue∞N

+=

19

Page 21: Optimization of Low Speed Airfoils Using Mathlab

nt on

ents.

total

1- The Aerodynamic Solver

Computation of the pressure

The Bernoulli equation applied to a streamline between the upstream infinity and a poithe airfoil’s surface gives :

So :

Then :

Gives :

We can thus compute the pressure coefficient at each airfoil collocation point.

Computation of the aerodynamic coefficients

We are looking for the lift coefficient Cl, and the moment coefficient Cm, which represthe moment of the aerodynamic force with respect to the point of coordinates

Dimensionless coefficients are obtained by integrating Cp.

The elementary forces and acting on panelj is obtained as :

and :

And the elementary moment is given by :

By doing this for each panel and by adding the elementary forces and moments, theload applied to the airfoil is obtained : (Fx, Fy) and Cm.

p12---ρUe

2+ p∞

12---ρ∞U∞

2+=

p p∞12---ρ∞U∞

2 12---ρUe

2–+=

Cpp p∞–

1 2⁄ ρ∞U∞2

---------------------------=

Cp 1Ue

2

U∞2

----------–=

c 4 0,⁄( )

x

y

xj y j,( )

xj 1+ yj 1+,( )

panel j

Cpj

f xj f yj

f xj Cpj y j 1+ yj–( )= f yj Cpj x j 1+ xj–( )=

mj

mj f– xj

y j 1+ yj+

2-----------------------

f yj

x j 1+ xj+

2----------------------- c

4---–

+=

20

Page 22: Optimization of Low Speed Airfoils Using Mathlab

ACAanels.ures.

mbertssureputeo not

samewing

test

1.3- Inviscid Flow Model

The lift coefficient is then simply the component of F normal to the flow direction :

And the pressure drag coefficient is the component of F in the flow direction :

Validation of the inviscid flow model

First, the accuracy of the solver is tested. The lift, moment and drag coefficients of a N4412 airfoil at 5 degrees angle of attack are computed with 50, 100, 200, 400 and 800 pThe results is a clear convergence for all coefficients, as can be seen on the following fig

Note that the pressure drag coefficient tends to zero. This result is known as the d’Aleparadox : if the effect of the displacement thickness is not taken into account, the predrag of an airfoil is theoretically equal to zero. Fortunately, the method we use to comthe drag (the Squire-Young formula, see 1.4.4) provides directly the total drag, so we dhave to estimate the pressure and friction parts of the drag separately.

The results are then compared to the solution provided by Xfoil, which uses exactly theformulation and has been validated with respect to experimental data [12]. On the follographs, our program is referred to as PMBL (Panel Method / Boundary Layer).

Graphical results obtained with the two programs are seen in the following figure. Thecase is the inviscid flow past a Naca 4512 at zero angle of attack.

Cl α Fx α Fy⋅cos+⋅sin–=

Cdp Fx α Fy αsin⋅+cos⋅=

XfoilPMBL

21

Page 23: Optimization of Low Speed Airfoils Using Mathlab

ses.gle of

este test

1- The Aerodynamic Solver

The lift coefficientsCl computed by the two programs are compared in several test caEach case shows the sensitivity, i.e. the evolution, of the results with respect to the anattack and to shape parameters.

The moment coefficientsCmcomputed by the two programs are now compared in two tcases.Cmdoes not vary much with respect to the angle of attack and the thickness, so wthe sensitivity with respect to the camber and camber location parameters only.

22

Page 24: Optimization of Low Speed Airfoils Using Mathlab

tionodelition

the

thethusthe

theationngth

ternalhoutld af the

patialerpo-y is

1.4- Boundary Layer Model

1.4- Boundary Layer Model

An integral model is used : the laminar part of the flow is computed with a two-equaformulation previously used in ISES [10], and the turbulent part is solved with Head’s m[5]. An e9-type amplification formulation also used in ISES is used to locate the transarea. Finally, the drag coefficient is computed using the Squire-Young formula [8], andresults are compared to the solution provided by Xfoil [12].

1.4.1- Preliminary Work

• Before using them in the boundary layer model, the external velocity distribution andcoordinates of the airfoil must be made dimensionless. The external velocity isdivided by the far field flow velocity and the airfoil point coordinates are divided byairfoil chord length.

• The boundary layer should start at the stagnation point, and follow the flow alongupper or lower surface toward the trailing edge. This requires identifying the stagnpoint in the inviscid solution and using the panel discretization to compute the arc lealong the surface from the stagnation point, which is the lengthx in the boundary layerequations.

• The discretization of each side can be given directly by the panels used for the exflow computation. But in order to be able to solve the boundary layer accurately withaving to use many panels for the inviscid flow solution, it is more convenient to buiuniform arc length grid on each side. This grid is based on a spline interpolation oairfoil panels corner points.

• The boundary layer model uses the external tangential velocity, as well as its first sderivative. The value of the velocity at each mesh point is obtained using a spline intlation of the velocity field known at the panel nodes. The derivative of the velocitobtained by differentiating the spline interpolation.

x4

32

1

Upper surface boundary layer Lower surface boundary layer

2 3 4x

1

23

Page 25: Optimization of Low Speed Airfoils Using Mathlab

adylayer

h

ers,

here

fromtion

esses

1- The Aerodynamic Solver

1.4.2- The Laminar Boundary Layer

Theoretical equation of the flow

By analyzing and comparing the order of magnitude of the terms of the steincompressible Navier-Stokes equations, we can derive the following Prandtl boundaryequations (details of the computations and approximations can be found in [6]) :

(4)

(5)

(6)

Note : xandy are not Cartesian coordinates.x is measured along the airfoil’s surface witx=0 locating the stagnation point, andy is measured normally to the surface.

The most important assumptions used in the derivation are :

• The boundary layer thickness is very small compared to L for large Reynolds numb• The tangential velocityu is much larger than the normal componentv,• The pressure is essentially constant across the boundary layer (in they direction).

These results naturally lead to the concept of an integral boundary layer formulation, wthe properties are assumed to depend only onx.

Integral momentum equation

By combining the boundary layer equations, and integrating the resulting expressionzero to infinity with respect to y, the well known Von Karman integral momentum equais obtained.

See [6] for more details about the derivation. The displacement and momentum thickn and , and the skin friction coefficient are defined as follows.

, where :

x∂∂u

y∂∂v+ 0=

ρ ux∂

∂uv

y∂∂u

+

x∂∂p– µ

y2

2

∂∂ u

+=

y∂∂p 0=

xddθ θ

Ue------ 2 δ∗

θ-----+

xd

dUe+12---Cf=

δ∗ θ Cf

δ∗ 1 uUe------–

yd

0

∫=

θ uUe------ 1 u

Ue------–

yd

0

∫=

Cf

τw

1 2⁄ ρUe2⋅

-------------------------= τw µy∂

∂u

y 0=

=

24

Page 26: Optimization of Low Speed Airfoils Using Mathlab

rfacesame

:

al

:

on (7)

1.4- Boundary Layer Model

Note : The displacement thickness can be seen as the displacement of the airfoil’s suneeded to construct a constant velocity profile through the boundary layer having theflow volume as in the real case.

This flow volume equivalence can be analytically expressed as :

By introducing the shape factor , the momentum equation can be written as

(7)

Kinetic energy integral equation

If the momentum equation is multiplied byu and then integrated, the kinetic energy integrequation results :

, (8)

where the kinetic energy thickness , and the dissipation coefficient are defined by

and :

Then, by introducing the second shape parameter and substracting equatifrom equation (8), the kinetic energy equation can be written as :

(9)

Displacement thickness

Ue

real BL thickness

y

x

Uey

xAirfoil’s surfaceAirfoil’s surface

δ x( )δ∗ x( )

Ue u–( ) yd

0

∫ δ∗ Ue⋅=

H δ∗ θ⁄=

xddθ θ

Ue------ 2 H+( )

xd

dUe+12---Cf=

dθ∗dx--------- 3

θ∗Ue------

dUe

dx---------+ 2CD=

θ CD

θ∗ 1u

Ue------

2–

uUe------ yd

0

∫= CD1

ρUe3

---------- µy2

2

∂∂ u

yd

0

∫=

H∗ θ∗ θ⁄=

θdH∗dx

---------- H∗ H 1–( )[ ] θUe------

dUe

dx---------+ 2CD H∗

Cf

2-----–=

25

Page 27: Optimization of Low Speed Airfoils Using Mathlab

.

ness

la :

curacy

1- The Aerodynamic Solver

Thwaites’ model

This simple model relies on the integral momentum equation, and is derived as follows

Multiplying equation (7) by the Reynolds number based on the momentum thick, we obtain :

,

where : and : ,

Then, Thwaites found that the right hand side can be approximated by the linear formu

When this and the definition of are substituted in the equation, we obtain :

Which leads to the differential equation :

The value of at the stagnation point is known :

Starting from that, the integration is performed as follows :

The integral is evaluated using a 5th-order Gauss quadrature, which gives a better acthan the 1st-order trapezoidal rule recommended in [6] or [7] :

,

where and .

Reθ ReθUe=

ReUedθ2

dx--------- 2 L 2 H)λ+( )–[ ]=

L ReθUe

Cf

2-----= λ Reθ2

dUe

dx---------=

2 l 2 H)λ+( )–[ ] 0.45 6λ–≈

λ

ReUedθ2

dx--------- 0.45 6Reθ2

dUe

dx---------–=

Rexd

d θ2Ue6( ) 0.45Ue

5=

θ

θ x 0=( ) 0.075

RedUe

dx--------- 0( )

-------------------------=

Re θ2Ue6( )

i 1–

i0.45 Ue

5

xi 1–

xi

∫ dx=

Ue5 x( )

xi 1–

xi

∫ dxdx18------ 5Ue

5 xm35---

dx2

------– 8Ue

5 xm( ) 5Ue5 xm

35---

dx2

------+ + +≈

dx xi xi 1––= xm xi xi 1–+( ) 2⁄=

26

Page 28: Optimization of Low Speed Airfoils Using Mathlab

t

since itniqueted byin

tion is

thetionies a

n of%.

sitionide as

ve ofand

1.4- Boundary Layer Model

Once is known, can be calculated. The shape factor H and the skin friction coefficienare then computed from semi-empirical formulas given by Cebeci and Bradshaw [4] :

for

for

And : ,

with : for

for

As all the one-equation methods, Thwaites method can not represent separated flowsuniquely ties the shape parameter to the local pressure gradient which is, in fact, a nonurelationship in separating flows. Therefore, for some cases, laminar separation (detecthe vanishing of ) is obtained before transition. After that, following what is donePanda, laminar separation is considered as a trigger for transition and the computacarried on with the turbulent flow model.

There are thus two different effective transition criteria, which may impairdifferentiability of the solution with respect to the design parameters. A slight modificaof the airfoil geometry can make a change in the active criterion, and since this impljump in the start of the turbulent flow, a resulting jump is obtained in the drag results.

As an example, we consider a 12 % thick airfoil, with 4% maximum camber. The locatiothe maximum camberp varies between 20 and 30% of the chord length by increment of 1

As p increases, we have first laminar separation on both sides up to p=22%, then tranhappens on the lower side from p=23%, and finally transition takes place on the upper swell from p=27%.

The discontinuities in the solution which are seen on the above graph result from the mothe start of the turbulent flow : from 9.1% of the chord for p=22% to 15,5% for p=23%,from 26.5% of the chord for p=26% to 43% for p=27%.

θ λ Cf

H λ( ) 2.61 3.75λ– 5.24λ2+= 0 λ 0.1< <

2.088 0.0731λ 0.14+--------------------+= 0.1– λ 0< <

Cf2L λ( )ReVeθ------------------=

L λ( ) 0.22 1.57λ 1.8λ2–+= 0 λ 0.1< <

0.22 1.402λ 0.018λλ 0.107+-----------------------+ += 0.1– λ 0< <

Cf

27

Page 29: Optimization of Low Speed Airfoils Using Mathlab

ations.ow istion.

t beSkanonal

.515

tion

1- The Aerodynamic Solver

Two-equation model

This more advanced model is based on the integral momentum and kinetic energy equIt adequately describes thin separated regions. Thus the computation of the laminar flalways carried out until transition, and there are no longer any discontinuities in the solu

Closure relations

Since the system of equations (7) and (9) contains too many unknowns, it mussupplemented by other equations. Semi-empirical relations derived from the Falkner-one-parameter velocity profile family are used to close the system. The following functidependencies are assumed :

for H < 4

for

for H < 7.4

for

for H < 4

for

Note : The correlation between H* and H indicates that H* can never be lower than 1which occurs for H = 4. Equation (9), however, does not guarantee that dH*/dx = 0 at thispoint. Now H = 4 is obtained very seldom, but still there are cases where the solusuddenly ceases to exist because (9) indicates dH*/dx* = 0 close to H =4. In this case weforce transition to be able to continue the calculation downstream.

Practical equations

The equations are written in terms of H and . Multiplying equation (7) byand arranging the derivative to make appear gives :

And multiplying equation (9) by , and expanding the derivative to makeappear results in :

,

where , , , and .

H∗ H∗ H( ) 1.515 0.0764 H–( )2

H--------------------+= =

1.515 0.0404 H–( )2

H--------------------+= H 4≥

ReθCf

2----- f 1 H( ) 0.067– 0.01977

7.4 H–( )2

H 1–-------------------------+= =

0.067– 0.022 1 1.4H 6–-------------–

2+= H 7.4≥

Reθ2CD

H∗---------- f 2 H( ) 0.207 0.00205 4 H–( )5.5+= =

0.207 0.0034 H–( )2

1 0.02 H 4–( )2+-----------------------------------------–= H 4≥

ω Reθ2= Reθdθ2 dx⁄

V x( )2

------------dωdx------- 2 H+( )ωW x( )+ f 1 H( )=

Reθ H⁄ ∗ dH dx⁄

ωV x( )g H( )dHdx------- 1 H–( )ωW x( )+ f 3 H( )=

V Ue= W dUe dx⁄= g H( ) d H∗ln( ) dH⁄= f 3 H( ) f 2 H( ) f 1 H( )–=

28

Page 30: Optimization of Low Speed Airfoils Using Mathlab

anyuted

tepin atly.

ched.

ichis a

gion,ion

basednoldssed on

and

1.4- Boundary Layer Model

Initial values at the stagnation point

They are chosen such that and are equal to zero. This choice avoidsinitial transient and allows large steps to be taken from x=0. H(0) and are compfrom :

, with the root

And :

Implicit scheme

We apply a backward Euler with slight modification to avoid implicit iterations. In the sfrom to , and are linearized around and g is taken as . This resultssystem of two bilinear equations in and which can be solved exac

This procedure is used until transition is predicted or until the trailing edge point is rea

1.4.2- Locating Transition

Transition from laminar to turbulent flow is a result of the growth of disturbances whmake the laminar boundary layer unstable. Accurate prediction of the transition regioncrucial point in obtaining a good drag estimate since it separates the laminar flow rewhere the skin-friction drag is low, from the turbulent flow region, where the skin frictdrag increases dramatically.

Michel’s criterion

This criterion is based on the idea that transition starts at a specific Reynolds numberon the distance x from the start of the boundary layer. The value of the transition Reynumber depends on many factors, the most important being the pressure gradient impothe boundary layer by the inviscid flow and the surface roughness.

For incompressible flows without heat transfer, Michel [15] examined a variety of dataconcluded that, for airfoil-type applications, transition should be expected when :

,

where : and : .

dω dx⁄ dH dx⁄ω 0( )

1 H–2 H+-------------

f 3 H( )f 1 H( )--------------= H0 2.24≈

ω0

f 1 H0( )W 0( ) 2 H0+( )-----------------------------------=

xn xn 1+ f 1 f 3 Hn gnH Hn 1+= ω ωn 1+=

Vn 1+

2∆x------------- 2Wn 1++

ω Wn 1+ Hω f'1nH–Vn 1+

2∆x-------------ωn– f1n– f'1nHn+ + 0=

Wn 1+

gHnVn 1+

∆x------------------------–

ωgVn 1+

∆x----------------- Wn 1+–

Hω f'3nH– f3n– f'3nHn+ + 0=

Reθ Reθmax> 1.174 1 22.4Rex----------+

Rex( )0.46=

Reθ ReUeθ= Rex ReUex=

29

Page 31: Optimization of Low Speed Airfoils Using Mathlab

entumclude

good

notcan

nishes,s, as

the

dragof the

sentother

1- The Aerodynamic Solver

This formula does account for the effect of the pressure gradient, because the momthickness grows more rapidly in a positive pressure gradient. However, it does not inthe effect of surface roughness, but being based on data taken on airfoils, it should befor wing analysis.

Implementation of this criterion reveals that for cases where the external flow velocity ismonotone past the suction peak, the function is not monotone either, andtherefore have several zeros. Since transition is predicted as soon as the function vathis can result in a discontinuity in the solution with respect to the design parameterillustrated on the following example.

We consider a 12% thick airfoil with 4% maximum camber. For a slight modification ofmaximum camber location from 71 to 72%, the active root of the criterion changes.

Transition therefore moves suddenly forward by approximately 17%, and a jump in theresults is obtained. Transition then keeps moving forward, which explains the increasedrag.

This behavior is suspect with respect to reality. It is moreover problematic for the prework, because it makes the drag solution discontinuous and non differentiable. Antransition criterion is thus considered.

Reθ R– eθmax

30

Page 32: Optimization of Low Speed Airfoils Using Mathlab

nowny of

thedary

ion of

sume.

d 11ground

latedlopes

the

iss the

.

st theinatehel’s

to

1.4- Boundary Layer Model

ISES’ e9-type method

ISES uses a spatial amplification theory based on the Orr-Sommerfeld equation, also kin the literature as the method. This equation governs the growth and decainfinitesimal wave-like disturbances in two or three dimensional shear layers. Sinceunstable growth of disturbances is known to be the precursor of free transition in bounlayers, the calculation of the growth of such disturbances is a good basis for the predicttransition.

The procedure is to compute the maximum amplification ratio downstream and to asthat transition occurs when the amplitude has grown by more than a factor ofThis is a wholly empirical assumption. The exponent "9" actually can vary between 7 andepending on quantities such as free stream turbulence, surface roughness, and backnoise level as discussed in Cebeci and Bradshaw [4].

Using the Falker-Skan profile family, the spatial amplification curve envelopes can be reto the local boundary layer parameters. The procedure is described in [11]. The enveare then approximated by straight lines, giving :

, (10)

where is the logarithm of the maximum amplification ratio. The slope andcritical Reynolds number are expressed by the following empirical formulas :

And :

For simple cases such as symmetric airfoils at zero angle of attack and flat plates,uniquely related to the streamwise coordinate x, and equation (10) immediately giveamplitude ratio as a unique function of x. Transition is assumed to occur where

For more general cases, where the external flow velocity may not be monotone pasuction peak, it is more physically realistic to use x as the spatial amplification coordrather than . This is where the present transition criterion becomes better than Micformulation.

Using some basic properties of the Falkner-Skan profile family, the conversion fromx is accomplished as follows by Drela [10] :

e9

e9 8100≈

ndn

dReθ------------ H( ) Reθ Reθ0

–[ ]=

n dn dReθ⁄Reθ0

dndReθ------------ 0.01 2.4H 3.7– 2.5 1.5H 4.65–( )tanh+[ ]2 0.25+{ }1 2⁄=

log10 Reθ0( ) 1.415

H 1–------------- 0.489–

20H 1–------------- 12.9–

3.295H 1–------------- 0.44+ +tanh=

Reθ

n n x( ) 9=

Reθ

Reθ

dndx------

dndReθ------------

dReθdx

------------ dndReθ------------1

2--- x

Ue------

dUe

dx--------- 1+

ρUeθ2

µx----------------1

θ---= =

31

Page 33: Optimization of Low Speed Airfoils Using Mathlab

,

of theingg athod

as the+1),

a

1- The Aerodynamic Solver

Using the empirical relations :

And :

The spatial amplification rate is expressed as a function of H and :

And this amplification rate is then integrated downstream from the instability pointwhere :

Again transition is assumed to occur when .

Using this criterion, there is no longer a discontinuity in the solution.

Implementation

Transition to turbulence is not an instantaneous process. Rather, over a certain lengthairfoil, the flow is intermittently laminar and turbulent. Since no method exists for describthis transition process, we have to adopt the fiction of a transition point. After usinlaminar boundary layer model up to the transition point, one switches to a different mefor the turbulent part.

For an accurate and reliable solution, it is essential that no discontinuities are admittedtransition point moves across a grid point. The transition is first located in an interval (i, isuch that and for Michel’s criterion, or

and for the e9-type criterion.

This interval is then treated as two subintervals as shown in the following figure.

is the exact point where , or . It is found as the root of

linear interpolation of , or , on the interval.

ρUeθ2

µx---------------- p H( ) 6.54H 14.07–( ) H2⁄= =

xUe------

dUe

dx--------- m H( ) 0.058

H 4–( )2

H 1–-------------------- 0.068–

1p H( )------------= =

θ

dndx------ H θ,( ) dn

dReθ------------ H( ) m H( ) 1+

2-----------------------p H( )1

θ---⋅=

xcrReθ Reθ0

=

n x( ) dndx------ xd

xcr

x

∫=

n x( ) 9=

Reθ xi( ) Reθmax xi( )< Reθ xi 1+( ) Reθmax xi 1+( )>n xi( ) 9< n xi 1+( ) 9>

i i+1xtr

x

Laminar step Turbulent step

xtr Reθ x( ) Reθmax x( )= n x( ) 9=

Reθ x( ) R– eθmax x( ) n x( ) 9–

32

Page 34: Optimization of Low Speed Airfoils Using Mathlab

t i.e.s. Thiss thatpe oft to

eadytions

h

bovere less

. The

this

that

ities.

1.4- Boundary Layer Model

1.4.3- The Turbulent Boundary Layer

For a large enough Reynolds number, the boundary layer can become turbulenexperience an unsteadiness due to an unstable response to small disturbanceunsteadiness is due to weak viscosity which is unsufficient to damp out disturbancenaturally appear and results in a random unstable flow. In such a case, there is little hofollowing the fluid motion in detail. It is necessary and, for practical purposes, sufficienuse some form of average description for the flow.

For this we define the time-average of any flow quantity by :

and label the fluctuating part of a ( ) with the symbol a’, so :

Theoretical equation of the flow

By time-averaging and comparing the order of magnitude of the terms of the stincompressible Navier-Stokes equations, the following turbulent boundary layer equacan be derived :

(11)

(12)

(13)

Note :x and y are not Cartesian coordinates : x ismeasured along the airfoil’s surface witx=0 locating the transition point, and y is measured normally to the surface.

Calculation details can be found in [6]. The approximations that lead to the equations aare the same as in the laminar case, the difference here is that the neglected terms anegligible in this case.

Von Karman momentum integral equation

The Von Karman integral equation can also be derived from the turbulent equationsdifferences with respect to the laminar case are :

• The inclusion in equation (12) of a term , called Reynolds stress. Fortunately term vanishes at the airfoil’s surface because of the no-slip condition.

• The term is non zero in equation (13). However the boundary layer is so thinwe can assume that the pressure is constant in the y direction,

• The integral quantities , , H and are now expressed with time-averaged veloc

a x y,( ) 1T---

T ∞→lim a x y t, ,( ) td

to

to T+

∫=

a a–

a x y t, ,( ) a x y,( ) a' x y t, ,( )+=

u∂x∂

----- v∂y∂

-----+ 0=

ρ uu∂x∂

----- vu∂y∂

-----+ p∂

x∂-----–

y∂∂ µ u∂

y∂----- ρu'v'–

+=

p∂y∂

-----y∂

∂ µ v∂y∂

----- ρv'2– =

ρu'v'–

p y∂⁄∂

δ∗ θ Cf

33

Page 35: Optimization of Low Speed Airfoils Using Mathlab

meIt is a

pirical

the

andntal

an

1- The Aerodynamic Solver

Head’s model

Head’s model is described in detail in [2]. It is a typical integral method, wherein soanalytical procedures have been carried out before the numerical problem is posed.reasonably accurate and especially fast method.

The model uses the Von Karman equation and, as in the laminar case, some semi-emrelations to close the system. The method has been derived as follows.

We consider the volume rate of flow within the boundary layer at x :

,

where is the boundary layer thickness. Combining this with the definition ofdisplacement thickness, we find :

We introduce the entrainment velocity :

Which we write :

With :

Head assumed that the dimensionless entrainment velocity depends only onthat , in turn, is a function of H. Cebeci and Bradshaw [4] fit several sets of experimedata to the following formulas :

(14)

And : for

for

The fourth equation used to solve for the unknowns , H, and is the Ludwieg-Tillmskin friction law :

Q x( ) u yd0

δ x( )∫=

δ x( )

δ∗ δ QUe------–=

Exd

dQxd

d Ue δ δ∗–( )= =

Exd

d UeθH1( )=

H1δ δ∗–

θ--------------=

E Ue⁄ H1H1

1Ue------

xdd UeθH1( ) 0.0306 H1 3–( ) 0.6169–=

H1 k H( ) 3.3 0.8234 H 1.1–( ) 1.287–+= = H 1.6≤

3.3 1.5501 H 0.6778–( ) 3.064–+= H 1.6>

θ H1 Cf

Cf 0.246 100.678H–( )⋅ Reθ0.268–=

34

Page 36: Optimization of Low Speed Airfoils Using Mathlab

ue at

losurehe

1.4- Boundary Layer Model

Explicit scheme

To integrate the Head equations, a 2nd order Runge Kutta method is used.

We have :

Which we write : with :

The initial values at the beginning of the turbulent boundary layer are given by the valthe end of the laminar run.

The procedure follows :

• , then

The procedure is used until one of these two things happen :

• The trailing edge point is reached,• Turbulent separation takes place.

Turbulent separation

The turbulent boundary layer equations can not always be solved because of the crelation , which is not defined for all values of H and . It is obvious on tfollowing graph of the function.

xddθ θ

Ue------ 2 H+( )

dUe

dx---------–

12---Cf+=

dH1

dx---------- H1

1Ue------

dUe

dx--------- 1

θ---

xddθ

+ –

0.0306θ

---------------- H1 3–( ) 0.6169–+=

sddY f Y x,( )= Y

θH1

=

f1 f Y i x, i( )= Y∗ Yi x i 1+ xi–( )f1+=

f2 f Y∗ xi 1+,( )=

Yi 1+ Yi x i 1+ xi–( ) f1 f2+2

----------------- +=

H1 k H( )= H1

35

Page 37: Optimization of Low Speed Airfoils Using Mathlab

tests

reasesancevery

thege.

locity

tionbothich

s not

ilingllowingistri-

1- The Aerodynamic Solver

can not be computed for H < 1.1, and H can not be computed for , so thathave to be included in the Runge-Kutta procedure.

Turbulent separation really corresponds to the case when approaches 3.3, and H incrapidly. A typical value for H at separation often presented in the literature (see for inst[7] and [9]) is H = 2.4. This can be used as a separation criterion, since H increasesrapidly close to separation anyway. In our case, we use the criterion .

1.4.4- Computation of the Drag Coefficient

The Squire-Young formula [8] provides a means of predicting the profile drag by relatingmomentum defect far downstream to the values of the flow field given at the trailing ed

Given the dimensionless momentum thickness , shape factor H and dimensionless ve at the trailing edge on the upper and lower sides, the drag is found from :

This formula gives directly the total profile drag (i.e. the sum of pressure drag and fricdrag) as a function of the values of Ue, , and H at the trailing edge, computed fromsides of the airfoil. It is thus particularly well suited for one-way coupled methods, in whthe computation of the pressure drag is not possible because the inviscid flow iinfluenced by the effect of the boundary layer.

1.4.5- Special Characteristics

The effect of the boundary layer on the inviscid flow is especially important near the traedge, where it reduces the adverse pressure gradient. This can be seen on the fofigure, which presents results obtained using Xfoil (the solid line is the viscous Cp dbution, the dashed line is the inviscid solution).

H1 H1 3.3<

H1

H1 3.3=

θUe

Cd 2θTE Ue( )TE

HTE 5+2

-------------------⋅

UP

2θTE Ue( )TE

HTE 5+2

-------------------⋅

LOW

+=

θ

36

Page 38: Optimization of Low Speed Airfoils Using Mathlab

r, and

nts ofer ofuch a

n after

ilingwas

rmula

thoutof the

ide,ide,ide,ide.

er thela is

es.

zeror the

1.4- Boundary Layer Model

In our case, the external velocity is not modified by the presence of the boundary layewe have to deal with an unrealistic very high adverse gradient at the trailing edge.

The problem is that it makes the boundary layer separate very easily in the last percethe chord length : even on a NACA 0012 at zero angle of attack with a Reynolds numb1e6, turbulent separation takes place. The drag coefficient can not be computed in scase because the computation of the turbulent boundary layer can not be carried oseparation.

The solution to this problem consists in not solving the boundary layer up to the traedge, but up to % of the chord length. Separation of the boundary layer whichhappening in the last percents of the chord is thus avoided, and the Squire-Young fostill gives good results, since it is based on a loss of momentum.

The exact value of is chosen so that a large variety of airfoils can be analysed wiany turbulent separation. It should not be too small though, because then a big partinformation would be lost. The following test cases illustrate the situation.

• NACA 0012 at and Re = 1e6 : turbulent separation at 100% on both sides,• NACA 9412 at and Re = 1e6 : turbulent separation at 98.54% on the upper s• NACA 4412 at and Re = 1e6 : turbulent separation at 98.98% on the upper s• NACA 4812 at and Re = 1e6 : turbulent separation at 98.11% on the upper s• NACA 6812 at and Re = 1e6 : turbulent separation at 97.85% on the upper s

It appears that a reasonable value of is 98%. This means that we do not considboundary layer on the last 2% of the chord length, and that the Squire-Young formuapplied not at the trailing edge, but at 98% of the chord on the upper and lower surfac

1.4.6- Validation of the Boundary Layer Model

First, the accuracy of the solver is tested. The drag coefficient of a NACA 4412 airfoil atangle of attack and Re=1e6 is computed with 50, 100, 200, 400 and 800 grid points foboundary layers.

The result is a clear convergence, as can be seen on this figure.

Coff

Coff

α 0=α 0=α 5=α 5=α 0=

Coff

37

Page 39: Optimization of Low Speed Airfoils Using Mathlab

utednsitivity

s,

il, it

L

oil’sputedesigntion.

mum

1- The Aerodynamic Solver

Then, the results are compared to results provided by Xfoil. The drag coefficient compby the two programs are compared in several test cases. Each test case shows the seof the results with respect to the angle of attack and to the shape parameters.

We have to recall the differences between Xfoil and PMBL :

• The turbulent flow models are different. Xfoil’s can handle thin separated flow regionwhile Head’s model cannot.

• The couplings between the boundary layer and the inviscid flow are different. In Xfois performed in two ways, while in PMBL, only one-way coupling is modelled.

• The drag coefficient computation is different. In Xfoil the drag estimate includes theintegration of the pressure distribution and of the boundary layer friction, while PMBuses the Squire-Young formula.

The graphs show that the drag coefficient computed by PMBL is higher than Xfsolution. This might be a characteristic of one-way coupled methods, since results comwith Panda behave the same. However, the sensitivity of the results with respect to the dparameters is well reproduced, which makes PMBL an appropriate solver for optimizaThe main difference is seen on the graph of the solution as a function of the maxicamber location, where the position of the minimum is not the same.

38

Page 40: Optimization of Low Speed Airfoils Using Mathlab

thetion,tlabients.

thes for

rical

puter

alsot andbe a

ode,

2- Automatic DifferentiationAutomatic differentiation (AD) is a technique for augmenting computer programs withcomputation of derivatives based on the chain rule of differential calculus. In this secthe method is presented. Then ADMAT, a toolbox for automatic differentiation of Mafunctions, is introduced and used to produce the derivatives of the aerodynamic coeffic

2.1- Introduction

The methods employed for the solution of many scientific computing problems requireevaluation of derivatives of some functions. Probably best known are gradient methodoptimization, Newton’s method for the solution of non-linear problems, and the numesolution of stiff differential equations.

In the context of optimization for instance, given a functionf : , one can find aminimizer off using variable metric methods that involve the iteration :

For suitable step multipliers . is the gradient off at a particular pointx, andis a positive definite approximation to the Hessian off.

In many cases, the function f is not represented in closed form, but in the form of a comprogram. For purpose of illustration, we assume thatf : and that we wish tocompute the derivatives ofy with respect tox. We callx the input variable, andy the outputvariable. There are four approaches to computing derivatives.

By Hand : One can differentiate the code by hand and thus arrive at a code thatcomputes derivatives. However, handcoding of derivatives for a large code is a difficulerror-prone process, especially as the problem complexity increases. It is liable toconsiderable amount of work in comparison with the development of the original calthough it is likely to result in the most efficient code.

Finite Differences : The derivative off with respect to theith component ofx at a particularpoint is approximated by either :

• One-Sided Differences :

• or Central Differences :

where is theith cartesian basis vector.

Rn R→x∗

while not converged do

Solve Bisi ∇f x i( )–=xi 1+ xi αi si+=

end do

αi 0> ∇f x( ) Bi

x Rn∈ y R∈→

xo

xi∂∂ f x0( )

f x0 h ei⋅±( ) f x0( )–

h±-------------------------------------------------≈

xi∂∂ f x0( )

f x0 h ei⋅+( ) f x0 h– ei⋅( )–

2h-----------------------------------------------------------------≈

ei

39

Page 41: Optimization of Low Speed Airfoils Using Mathlab

y thesmallher -tionuire

asolicof thenot

ctiont be

oce of

mputerulection,entialtly

ng ordated

,

g

2- Automatic Differentiation

Computing derivatives by divided differences has the advantage that we need onlfunction as a "black box". The main drawback is that their accuracy is hard to assess. Astep size h is needed to minimize the truncation error resulting from the omission of higorder terms for properly approximating derivatives, yet may lead to numerical cancellaand the loss of many digits of accuracy. In addition, different scales of the ’s may reqdifferent step sizes for the various independent variables.

Symbolic Differentiation : This functionality is provided by symbolic packages suchMaple or Mathematica. Given a string describing the definition of a function, symbmanipulation packages provide exact derivatives, expressing the derivatives in termsintermediate variables. Symbolic differentiation is a powerful technique, but it mayderive good computational recipes, and it may run into resource limitation when the fundescription is complicated. Moreover, functions involving branches or loops cannoreadily handled by symbolic differentiation.

Automatic Differentiation (AD) : AD techniques rely on the fact that every function, nmatter how complicated, is executed on a computer as a (potentially very long) sequenoperations such as additions, multiplications, and elementary functions such assin andcos,for which the derivative can be easily computed. Then, by applying the chain rule :

over and over again to the composition of those elementary operations, one can coderivatives off exactly, and in a completely mechanical fashion. By applying the chainstep by step to the elementary operations executed in the course of computing the funAD computes exact derivatives (up to machine precision, of course), and avoids the potpitfalls of divided differences. The technique of automatic differentiation is direcapplicable to functions with branches and loops. We also note that, unlike handcodisymbolic assisted approaches, automatic differentiation enables derivatives to be upeasily when the original code changes.

2.2- Method Fundamentals

We consider the case of a functionf : , of n variables which we will callinput variables. The case of a function with several resultsf : will be treated as anextension of this case.

The function is represented by a computer program, which for the input ofreturnsy = f(x). We want to generate a program which will also return the value ofi.e. all the first order partial derivatives .

Original program

We start by considering the general form of a program to compute , usinNintermediate variables .

xi

x∂∂ f g x( )( )

x x0=s∂

∂ f s( )s g x0( )=

x∂∂ g x( )

x x0= ⋅=

Rn R→ x1 … xn, ,Rn Rm→

x x1 … xn, ,( )=∇f x( )

f x1 x( )∂⁄ … f xn x( )∂⁄∂, ,∂

f x1 … xn, ,( )xn 1+ … xN, ,

40

Page 42: Optimization of Low Speed Airfoils Using Mathlab

ble isn this

les),

utedre

riablescome

suchr the

, ...)n of

n. We

ethods the, the

ave

f the

2.2- Method Fundamentals

The simplest thing is to consider that at each statement, a new intermediate variaintroduced, and that its value is computed using the previously introduced variables. Icontext, the program can be written :

For i = n+1 to N, do

The program is manipulating N variables (n input variables, and N-n intermediate variaband uses N-n statements.

Usually, the intermediate functions do not depend on all the previously compvariables : there is a set such that , whe

. With these new notations, we can write the program like :

For i = n+1 to N, do

This model is not general enough because some programs may have intermediate vathat are redefined several times, which is impossible here. Since the explanation bemore complex if we want to account for this case, and since a program whichredefinition of variables can easily be turned into a program without any, we consideprogram above as general enough for our point.

The intermediate functions

An intermediate function can be anything, from elementary functions (+, -, *, /, sin, costo some higher-level functions such as the multiplication of two matrices, or the resolutioa linear system of equations. It can actually be any sub-programy = f(x).

So, the choice of the intermediate functions is open, and depends on the implementatiowill return to this issue in the section dealing with the Matlab AD tool ADMAT.

Forward mode

This technique is easy to understand as well as to program on a computer. The mcomputes derivatives alongside the evaluation of the function itself, and propagatederivatives using the chain rule. So when the function evaluation has completedderivatives of the results have also been calculated.

We denote by , i = 1, ..., N the gradient of with respect to the input variables. We hof course for i = 1, ..., n where is theith cartesian basis vector.

For i = n+1, ..., N, the definition of and the chain rule give :

The forward mode consists in performing this kind of computation for each statement ooriginal code.

xi ϕi x1 … xi 1–, ,( )=

f xN=

ϕiPi 1 2 … i 1–, , ,{ }⊂ xi ϕi xPi

( )=

xPix j j Pi∈,{ }=

xi ϕi xPi( )=

f xN=

∇xi xi∇xi ei= ei

xi

∇xi

ϕi∂xj∂

--------∇xjj Pi∈∑=

41

Page 43: Optimization of Low Speed Airfoils Using Mathlab

t to anfore,

of thelues.ing iniablesethod

gram

f the

wn

2- Automatic Differentiation

Applying this to our programs leads to :

For i = 1 to n, doFor i = n+1 to N, do {

}

This program evaluates both functions and gradients simultaneously, each assignmenintermediate quantity being simply augmented by the calculation of its gradient. Therethe forward mode increases the number of operations by a factor proportional ton (numberof input variables).

Reverse mode

This technique is based on a not as obvious way of using the chain rule. The first stepmethod is to evaluate the function itself while storing information about intermediate vaWhen the evaluation is done, the derivatives are calculated by traversing the recordreverse order, propagating derivatives of the result with respect to the intermediate vardown to the initial values. Because of the recording and the reverse propagation, this mis also the most difficult to program on a computer.

We associate with each intermediate variable , the derivative :

By definition, we have , and .

As a consequence of the chain rule applied to an elementary statement of our pro, theseadjoint quantities satisfy the relation :

,

Or : , where

Thus, we can see that can be computed once all with are known. In terms o

program structure, it is slightly more convenient to increment all with for a kno

i by the appropriate contribution .

∇xi ei=

xi ϕi xPi( )=

∇xi

ϕi∂xj∂

--------∇xjj Pi∈∑=

∇f ∇xN=

f xN=

xi

xi xi∂∂f=

xN 1= ∇f x i( )i 1 … n, ,==

xi ϕi xPi( )=

f∂xj∂

-------ϕi∂xj∂

-------- f∂xi∂

-------i Qj∈∑=

xj

ϕi∂xj∂

--------xii Qj∈∑= Qj i N j Pi∈;≤{ }=

xj xi i j>xj j Pi∈

xi ϕi x j∂⁄∂⋅

42

Page 44: Optimization of Low Speed Airfoils Using Mathlab

udingber ofin

ian

st

tionnow ayhe

2.2- Method Fundamentals

This mathematically equivalent looping leads to the following extended program :

Forward step :

For i = n+1 to N, do

Reverse step :

For i = 1 to N-1, do

For i = N down to n+1, do for all

For i = 1 to n, do

This program evaluates the function in the first step, and computes all the adjoints inclthe components of the gradient in the second step. In this case, the increase in the numoperations is independent ofn, and an estimation of an upper bound of 5 for the increasework can be found in [16].

Extension tof :

We consider the function given by the following program :

For i = n+1 to N, do

,

where them results are them last variables of the program. We are looking for the JacobmatrixJ, which(i,j) term is :

.

Using theforward mode, the application is straight-forward. Rowi of J is nothing but thegradient of componenti of f, . We have the same relative computation coas in the scalar case, the increase in the number of operations isn.

Using thereverse mode, we have exactly the same algorithm as in the scalar value funccase. The difference is that the adjoint associated with each intermediate variable isvector withm components. Componentp of this vector is the derivative of the elementarvariable with respect to resultsp, p = 1, ..., m. Therefore, the reverse mode increases tnumber of operations by a factor proportional tom.

xi ϕi xPi( )=

f xN=

xi 0=xN 0=

xj x j ϕi x j∂⁄ xi⋅∂+= j Pi∈

xi∂∂f xi=

Rn Rm→

xi ϕi xPi( )=

f

f 1

…f m

xN m– 1+

…xN

= =

Jij

f i∂xj∂

-------=

∇f i ∇xN m– i+=

43

Page 45: Optimization of Low Speed Airfoils Using Mathlab

e forf that

labrators.dientyblesn

nd

ve

an

es

mapsItnted

e of

tomggatives

2- Automatic Differentiation

2.3- Computer Implementation

AD can be seen as a particular semantic transformation problem : given a codcomputing a function, we would like to generate a code that computes the derivatives ofunction. To affect this transformation, two approaches can be employed.

Operator Overloading : Modern computer languages like C++ or Fortran 90, and Mat(version 5.0 and above), make it possible to redefine the meaning of elementary opeThat is, we can for example define a type for floating point numbers that have graobjects associated with them (let’s call themadouble, say), and for each elementaroperation such as multiplication, we can define the meaning of the operator ’*’ for variaof type adouble. If we define the usual product rule ( ), theeach occurence of a multiplication of two variables of typeadoublein the code will alsoeffect the update of the associated derivatives in a transparent fashion.

Tools using this implementation include ADOL-C for algorithms written in C/C++, aADMAT for algorithms written in Matlab.

Source transformation : Another way is to rewrite the code explicitly. This is what we hadone to explain how AD works in the previous section. For example, the assignmentz = xy isrewritten into a piece of code that not only contains the computation of z, but alsoimplementation of the derivative .

Tools using this implementation include ADIFOR for algorithms written in Fortran.

For more information, refer to [17]. Check also a collection of AD tools which includADOL-C and ADIFOR, presented at :

http://www-unix.mcs.anl.gov/autodiff/AD_Tools/index.html

2.4- ADMAT, Automatic Differentiation Toolbox for Matlab

ADMAT computes gradients, Jacobian matrices and Hessian matrices of nonlineardefined via M-files. This is the first ever AD tool written for differentiating M-files.belongs to the operator overloading class of AD tools, and uses the Object OrieProgramming feature present in MATLAB 5 for implementation. A direct consequencthis being that ADMAT can be used only with MATLAB version 5 or above.

Implementation of derivative classes

ADMAT is designed as a three-layer toolbox with the top layers inheriting from the botlayers. The core of the toolbox is the classderiv, which is the basic forward mode computinengine. The layer abovederivcontains the classderivtape, the basic reverse mode computinengine, and the topmost layer is concerned with the computation of second order derivand consists of the classderivtapeH for computing the Hessian of a function.

z xy ∇z→ x∇y y∇x+= =

∇z x∇y y∇x+=

44

Page 46: Optimization of Low Speed Airfoils Using Mathlab

). Ats

which

het and

ition,

a

theninput

2.4- ADMAT, Automatic Differentiation Toolbox for MATLAB

Implementation of the forward mode : class deriv

deriv is an extension of double (Matlab floating point numbers belong to class doublederiv object has two fields,val andderiv, which stand for the value of the variable and iderivative. In the AD mode, the function computation is carried out withderiv variables,causing all the operations to be used in the overloaded mode, thus invoking the rulesupdate the derivative of the output along with the value.

The constructor is used as follows :y = deriv(x,V). It constructs aderiv objecty with thegiven derivativeV. Here is a simplified version of the code for the constructor (tsimplification consists in not reporting all tests on the dimensions of s1, s2 and souconsequent branches) :

function s = deriv(a,V)s.val = a;if nargin == 1

s.deriv = zeros(size(a));else

s.deriv = V;end;s = class(s,’deriv’);

To illustrate how the operators are modified, we present the simplified functions for addcosinus, and exponential of aderiv class variable.

function sout=plus(s1,s2) function sout=cos(s1)sout.val=s1.val+s2.val; sout.val=cos(s1.val);if ~isa(s1,’deriv’) sout.deriv=-sin(s1.val).*s1.deriv;

sout.deriv=s2.deriv; sout=class(sout,’deriv’);elseif ~isa(s2,’deriv’)

sout.deriv=s1.deriv; function sout=exp(s1)else sout.val=exp(s1.val);

sout.deriv=s1.deriv+s2.deriv; sout.deriv=sout.val*s1.deriv;end; sout=class(sout,’deriv’);sout=class(sout,’deriv’);

The following example illustrates the way to use thederivclass to compute the Jacobian ofMatlab functiony = fun(x). The steps are :

• Define the input point : x = ones(N,1);• Initialise the Jacobian of x : xdot = eye(N);• Make x belong to thederiv class : x = deriv(x,xdot);• Compute the function (as well as the derivatives via overloading) : y = fun(x);• Get the value of the function : val = y.val;• Get the value of the Jacobian : J = y.deriv;

Implementation of the reverse mode : class derivtape and function parsetape

To implement the reverse mode, ADMAT uses atape, which records all the intermediatevalues and operations performed in the function evaluation. Computation of adjoints isdone in a reverse pass on the tape, and at the end of the pass the adjoints of thevariables are picked up from the front of the tape.

45

Page 47: Optimization of Low Speed Airfoils Using Mathlab

as anrd the

ition,

n,

djoint

nt the

2- Automatic Differentiation

The tape is generated by the methods of classderivtape. derivtapeobjects have two fields,val which contains the value of the variable and counter, a unique counter which servesindex to the tape. Every Matlab operation is overloaded to update the value, and recooperation onto the tape.

Here is the constructor of classderivtape :

function s= derivtape(a)global tape;global varcounter;s.val=a;s.varcount=varcounter;s=class(s,’derivtape’);

To illustrate how the operators are modified, we present the functions for the addcosinus, and exponential of aderivtape class variable.

function sout=plus(s1,s2) function sout=cos(s1)global varcounter global varcounter;if (~isa(s2,’derivtape’)) sout.val=cos(s1.val);

sout.val=s1.val+s2; sout.varcount=varcounter;sout.varcount=varcounter; sout=class(sout,’derivtape’);sout=class(sout,’derivtape’); savetape(’cos’,sout,s1.varcount);savetape(’plus’,sout,s1.varcount);

elseif (~isa(s1,’derivtape’)) function sout=tan(s1)sout.val=s1+s2.val; global varcounter;sout.varcount=varcounter; sout.val=exp(s1.val);sout=class(sout,’derivtape’); sout.varcount=varcounter;savetape(’plus’,sout,s2.varcount); sout=class(sout,’derivtape’);

else savetape(’exp’,sout,s1.varcount);sout.val=s1.val+s2.val;sout.varcount=varcounter;sout=class(sout,’derivtape’);savetape(’plus’,sout,s1.varcount,s2.varcount);

end

In these programs, functionsavetapeis used to record the operator, the value of the functioand the index of the operands of the elementary operation in the objecttape(varcounter).

Then the computation of the adjoints is performed by functionparsetape. This functionprocesses the tape backwards, and, at each step, invokes a function to compute the acorresponding to the operator involved.

To illustrate how the adjoints of the operators are computed and propagated, we presesimplified functions for the addition, cosinus, and exponential.

function adjplus(i)global tapeif (tape(i).arg2vc > 0)

tape(tape(i).arg1vc).W=tape(tape(i).arg1vc).W+tape(i).W;tape(tape(i).arg2vc).W=tape(tape(i).arg2vc).W+tape(i).W;

elsetape(tape(i).arg1vc).W=tape(tape(i).arg1vc).W+tape(i).W;

end

46

Page 48: Optimization of Low Speed Airfoils Using Mathlab

.W);

ute

ersion

n(x);

2.4- ADMAT, Automatic Differentiation Toolbox for MATLAB

function adjcos(i)global tapetape(tape(i).arg1vc).W=tape(tape(i).arg1vc).W-sin(tape(tape(i).arg1vc).val).*tape(i).W;

function adjexp(i)global tapetape(tape(i).arg1vc).W=tape(tape(i).arg1vc).W+exp(tape(tape(i).arg1vc).val).*tape(i).W;

The following example illustrates the way to use thederivtapeclass and theparsetapefunction to compute the Jacobian of a Matlab scalar value functiony = fun(x). The steps are :

• Define the input point : x = ones(N,1);• Make x belong to thederivtape class : x = derivtape(x);• Compute the function (taping every intermediate via overloading) : y = fun(x);• Initialize the adjoint matrix : W = 1;• Parse and process the tape backwards to compute the adjoints : parsetape(W);• Grab the Jacobian as the transpose of the front end of the tape : J = transp(tape(1)

Computation of the Hessian : class derivtapeH and function parsetape

ComputingtheHessianmatrixoff(x)combinestheforwardandreversemodes.Wefirstcompusing the forward mode, and then by reverse mode, sincew has

fewer number of variables thanx.

Then :

Thus thederivtapeHobject has the two same fields as thederiv class,val andderiv, exceptthat they are themselves instances of thederivtapeclass. This way the value of the functionas well as its gradient are computed and recorded on the tape. Here is the simplified vof the constructor of classderivtapeH :

function s= derivtapeH(a,V)a = derivtape(a);s.val=a;s.deriv=derivtape(V);s=class(s,’derivtapeH’);

The operators onderivtapeHvariables are the same as those of classderiv, they compute andpropagate the forward mode derivative of the results.

The following example illustrates the way to use thederivtapeHclass and theparsetapefunction to compute the Hessian of a Matlab scalar value functiony = fun(x). The steps are :

• Define the input point : x = ones(N,1);• Initialise the Jacobian of x : xdot = eye(N);• Make x belong to thederivtapeH class : x = derivtape(x, xdot);• Forward mode : compute the function and the derivatives and create the tape : y = fu• Initialize the adjoint matrix : W = eye(N);• Reverse mode : parse and process the tape backwards : parsetape(W);• Grab the Hessian as the front end of the tape : H = tape(1).W;

w ∇f( )T= dw dt⁄( )T

∇2fd ∇f( )T

dx------------------

T=

47

Page 49: Optimization of Low Speed Airfoils Using Mathlab

, areround

on oftormple itave toils on

are

lift,grams are

ard,e the

in thestantd theters.

grid

2- Automatic Differentiation

Elementary operations

All arithmetic operations, as well as the comparison and assignment operatorsoverloaded so that any or all of their operands can be an active variable. This means a120 functions.

Matlab features some high-level operators, such as matrix matrix product, or the solutia linear system of equation. Thinking about AD in terms of high-level matrix vecoperations as opposed to the scalar level operations has a lot of advantages, for exasaves the storage of the intermediate variables in the reverse mode, where you only hsave the high level vectors instead. A lot of discussion on this subject, and more detahigh-level differentiation can be found in the work by Coleman and Verma, see [18].

In the following table, we present a listing of how some of the matrix-vector operationshandled using the forward and reverse mode.

2.5- Application of ADMAT to the Aerodynamic Solver

The Matlab automatic differentiation toolbox is used to compute the gradient of themoment and drag coefficients. The three quantities are computed by one Matlab prowhich is introduced. The accuracy and running time of the computation of the derivativethen tested on several cases.

Note :The application of ADMAT to the aerodynamic solver has not been straight-forwbecause the toolbox was not bug-free. The correction of around 30 bugs has maddifferentiation of the solver possible.

2.5.1- Aerodynamic Solver Program

The input variables are the shape parameters (i.e. the 4 digits, with the same scaling asNACA notation), and the angle of attack. The computations are performed at a conReynolds number equal to 1e6. The number of panels for the inviscid flow solution annumber of grid points in the boundary layer are also specified, but as constant parame

The solution for a NACA 4512 at 3 degrees angle of attack using 100 panels and 200points for the boundary layer is thus computed by invoking :solver([4;5;12;3],[100;200]);

Operation Gradient Adjoints

,

,

,

,

,

z xTy= ∇z yT∇x xT∇y+= x yz= y xz=

z x y+= ∇z ∇x ∇y+= x z= y z=

z x *y⋅= ∇z ∇x *y x * ∇y⋅+⋅= x diag y( ) z⋅= y diag x( ) z⋅=

y Ax= ∇y ∇Ax A ∇x+= x ATy= A yxT=

y A\x= ∇y A\ ∇x ∇Ay–( )= x AT\y= A A T\y( )yT–=

48

Page 50: Optimization of Low Speed Airfoils Using Mathlab

finite

rangle

iation

alsoolver

ves bybothl be

the

2.5- Application of ADMAT to the Aerodynamic Solver

The program procedure is shown on the following figure :

2.5.2- Accuracy

The analytic derivatives computed by automatic differentiation are compared to centraldifferences derivatives with a step size h = 1e-4. The test case is a NACA 4412 atwith 100 panels and 200 grid points for the boundary layer.

We have three results,Cl, CmandCd, which are noted , and respectively, and fouparameters, maximum camber, maximum camber location, maximum thickness, andof attack, which are noted , , and respectively.

The derivatives are presented in a Jacobian matrix J, which (i,j) element is :

The element-by-element ratio between the Jacobian computed by automatic differentand the Jacobian computed by finite differences is :

1.00000000010672 1.00000000024421 0.99999998912999 0.999999999984961.00000000042880 1.00000000040818 0.99999995238333 1.000000000131841.00000000670311 1.00000026823053 1.00000000787586 1.00000632378303

This proves that automatic differentiation of the program has been well performed. Itshows that computing the derivatives by central finite differences, thus considering the sprogram as a black box, gives a very good accuracy.

2.5.3- Running Time

The same test case is used to measure the time required to compute the derivatiautomatic differentiation and finite differences. Since automatic differentiation computethe function and the derivatives at the same time, the time performance of AD wilcompared to the time it takes to compute the derivatives by finite differences andfunction.

Shape Parameters

Airfoil Shape Inviscid Flow Boundary Layer

Squire Young Formula

Velocity

and

Pressure Distribution

Angle of Attack

CL Cm Cd

α 0=

f 1 f 2 f 3

p1 p2 p3 p4

Jij

f i∂pj∂

-------=

49

Page 51: Optimization of Low Speed Airfoils Using Mathlab

twondary

wer

of the(500.86 s.14.

akes adarythe

eachtime

, the

ork for

2- Automatic Differentiation

Forward mode

The computation of the aerodynamic coefficients and their derivatives is performed ondifferent problem sizes : 50 and 100 panels, and 100 and 200 grid points for the boulayer. The test case is still a NACA 4412 at .

The CPU times are the following :

Computing the derivatives of our function by AD is therefore approximately six times slothan computing them by central finite differences.

In section 2.2, we saw that the forward mode increases the number of operationsfunction computation by a factor proportional to the number of input variables. For theand 100) case, one function computation takes 0.42 s, and for the (100 and 200) case,An approximate value for the proportion factor in our case can thus be given : around

Reverse mode

The reverse mode is extremely slow because recording all the elementary operations tvery long time. For our test case, with only 10 panels and 50 grid points for the bounlayer, the size of the tape is 18060. The following table shows the CPU times forcomputation of the derivatives.

Since the size of the tape is a priori unknown, it is reallocated through the recording atnew elementary operation. By allocating the tape at the beginning of the program, therequired by AD goes down to 623.17 s, and 15% of time are saved.

For larger problems, 50 panels and 100 grid points for the boundary layer for instancedifferentiation procedure results in a crash of the program.

The conclusion is that we are going to use the forward mode for the optimization.

Hessian

The computation of the Hessian has been tested on simple examples, but it does not wthe aerodynamic solver. Because of time constraints, the problems within thederivtapeHoperators have not been fixed.

α 0=

time AD (s) time FD (s)

50 and 100

100 and 200

ratio AD/FD

24.46 3.79

7.7747.35

6.45

6.15

time AD (s) time FD (s) ratio AD/FD

739.67 1.74 425

50

Page 52: Optimization of Low Speed Airfoils Using Mathlab

ated,

threekness.ign theruise

nt the

s theo the

its

rium

rcraft

3- Airfoil Shape OptimizationThe solver is used to perform airfoil design. Sample optimization problems are formuland solved using the Matlab optimization toolbox [20].

3.1- Definition of the Optimization Problems

We consider the airfoil as a section of the main wing of a low speed aircraft. We haveshape parameters : maximum camber, maximum camber location, and maximum thicThe flow angle of attack can also be considered a parameter since it is possible to desairplane so that the wing has a non zero incidence angle when the aircraft is in cconditions.

We are interested in three results : lift, moment, and drag coefficients. They represeaerodynamic loads applied to the airfoil, the actual loads being given by :

where S is the airfoil’s planform area, and c is the airfoil’s chord length. Planform area iarea of a projection of the airfoil’s shape onto a horizontal surface beneath it, similar tairfoil’s shadow when the sun is directly overhead.

• The lift must be large enough in order to allow the aircraft to fly by compensatingweight,

• The pitching moment of the main wing must not be too large, because for the equilibof the aircraft, it must be compensated by the moment of a negative-lift tail.

• The drag should be as low as possible, since it has no positive effect at all on the aiperformance.

L Cl12---ρU∞

2 S⋅=

D Cd12---ρU∞

2 S⋅=

M Cm12---ρU∞

2 Sc⋅=

Lift L

Drag D

Pitching Moment M

U∞

α

51

Page 53: Optimization of Low Speed Airfoils Using Mathlab

ake-o be

ag of

ety of

e

3- Airfoil Shape Optimization

Two different design problems are derived depending on the flight conditions. During toff and landing, the crucial issue is to have a high lift coefficient, since the aircraft has tflying at very low speed. In this context, the optimization problem is formulated as :

max (Cl) (15)subject to bounds on Cm and Cd

On the other hand, during cruise conditions, the important issue is to minimize the drthe plane, in order to save fuel. A second optimization problem is thus formulated as :

min (Cd) (16)subject to bounds on Cl and Cm

The value of the bounds are derived by making a survey on the performances of a variairfoils. For simplicity, the Reynolds number is taken to be equal to 1e6 in all cases.

• For both problems, the maximum negative value ofCm is chosen to correspond to thesolution of the NACA 4812 airfoil at zero angle of attack : ,

• For problem (15), the maximum value ofCd is chosen to correspond to the solution of thNACA 0015 airfoil at zero angle of attack : ,

• And finally for problem (16), the minimum value ofCl is chosen to correspond to thesolution of the NACA 5412 airfoil at zero angle of attack : .

The solutions for the airfoils above are presented in the following figures.

Cm 0 23,–≥

Cd 0 0070,≤

Cl 0 65,≥

52

Page 54: Optimization of Low Speed Airfoils Using Mathlab

elves,e the

.2).

nedFGSsolved

ed byof

are

andoints

3.2- Solving the Optimization Problems

For both optimization problems, we also have to add bounds on the parameters themsso that the optimization is performed in a space of reasonable airfoils. We choosfollowing minimum and maximum values :

The solver uses the same scaling of the variables as the NACA 4 digits notation (see 1

3.2- Solving the Optimization Problems

The Matlab Optimization Toolbox [20] is used. For non linear inequality constraiproblems like ours, it uses a Sequential Quadratic Programming algorithm with a Bupdate of the Hessian matrix and a linesearch method. The quadratic subproblems arewith a modified projection method.

The exact Hessian information is not used, and thus the only analytic derivatives providthe solver are the gradients ofCl, CmandCd. They are computed using the forward modeautomatic differentiation. In order to see the differences, all the optimization problemsalso solved with finite difference derivatives, with a constant step size h=0.0001.

Two different initial points are chosen for the optimization : the symmetric NACA 0016,the cambered NACA 4416, both considered at zero angle of attack. The initial psolutions are presented on the two following figures.

Maximization of the lift coefficient at zero angle of attack

In this case, the angle of attack is not considered as a parameter. The problem is :

max (Cl)subject to : and : ,

without forgetting the bounds on the shape parameters.

0% Maximum camber 9%≤ ≤20% Maximum camber location 80%≤ ≤7% Maximum Thickness 20%≤ ≤0° Angle of Attack 3°≤ ≤

Cm 0 23,–≥ Cd 0 0070,≤

53

Page 55: Optimization of Low Speed Airfoils Using Mathlab

16,btainedfaster

3- Airfoil Shape Optimization

With NACA 0016 as initial point, we obtain the following convergence ofCl :

And starting from NACA 4416 :

All converge to the same optimizer. More iterations are used starting from NACA 44because cases with turbulent separation, where the results are not accurate, are oalong the optimization process. In both cases, the use of AD derivatives provides aconvergence, which was expected theoretically.

The optimal airfoil shape and solution are shown on the following figure.

54

Page 56: Optimization of Low Speed Airfoils Using Mathlab

bothber,

eaterlue.

der toby the

aster

3.2- Solving the Optimization Problems

At the optimal solution, the constraints on the pitching moment and on the drag areactive, which means that they are both useful. The large lift is obtained by strong camlocated approximately at the middle of the chord. The thickness, which has a grnegative effect on the drag than positive effect on the lift, is equal to its minimum vaObserve that the pressure distribution is very smooth.

Maximization of the lift coefficient considering the angle of attack as a parameter

The point is to determine what happens when the angle of attack can be modified. In oravoid cases with separation of the turbulent boundary layer, which can not be handledsolver, the upper bound we use on is not very large (3 degrees).

Starting from NACA 0016 at =0, we obtain the following convergence ofCl :

And starting from NACA 4416 at =0 :

All converge to the same optimizer, and the use of analytic derivatives gives a fconvergence.

α

α

α

55

Page 57: Optimization of Low Speed Airfoils Using Mathlab

ual to, but

thethat the

ive

3- Airfoil Shape Optimization

The optimal solution is presented on the following figure.

Compared with the previous case, when the angle of attack was kept constant and eqzero, the result here is a higher lift coefficient. The optimal airfoil has a little less camberlocated at the same place, and it has the same thickness as in the previous case.

The angle of attack is equal to its maximum value, which gives a lot of lift, andconsequent increase in drag is compensated by a smaller amount of camber. Observeboundary layer is fully laminar on the lower side, which contributes to a low drag.

Minimization of the drag coefficient at zero angle of attack

First, we do not consider the angle of attack as a parameter. The problem is :

max (Cd)subject to : and : ,

and bounds on the shape parameters.

With NACA 0016 as initial point, we obtain the following convergence of the objectfunctionCd :

Cm 0 23,–≥ Cl 0 65,≥

56

Page 58: Optimization of Low Speed Airfoils Using Mathlab

e to

lyticlongelpsit,

em.

nedion of.4.6.

3.2- Solving the Optimization Problems

And starting from NACA 4416 :

Starting from NACA 0016, and using finite differences derivatives, we do not managreach the same optimum as the three other cases.

We also note that with both initial points, convergence is slower with the use of anaderivatives. This can be explained by the fact that the variable is obviously crawling athe boundary. It is possible that the lack of precision of the finite differences derivatives hin making the optimization procedure actually violating the constraint without realizingand thus go faster to the optimum.

The optimal airfoil shape and solution are shown on the following figure.

The resulting shape is very different from the solution of the previous optimization probl

The thickness is equal to its minimum value, which gives a low drag. The lift is obtaithanks to a small amount of camber, located completely rearward. This rearward locatthe camber is also a factor of low drag ; remember the sensitivity curves seen in 1Observe that the constraint on the pitching moment is inactive this time.

57

Page 59: Optimization of Low Speed Airfoils Using Mathlab

es a

3- Airfoil Shape Optimization

Mimimisation of the drag coefficient considering the angle of attack as a parameter

The angle of attack can now vary between 0 and 3 degrees.

Starting from NACA 0016 at =0, we obtain the following convergence ofCd :

And starting from NACA 4416 at =0 :

All four procedures converge to the same optimizer, and the use of AD derivatives givfaster convergence.

α

α

58

Page 60: Optimization of Low Speed Airfoils Using Mathlab

ual tober,

se.

amber

the

theof these of

The optimal solution is presented on the following figure.

Compared with the previous case, when the angle of attack was kept constant and eqzero, the result here is a lower drag coefficient. The optimal airfoil has a little less cambut it is located at the same place, and it has the same thickness as in the previous ca

The angle of attack is equal to 0.65 degrees, which gives some more lift, so that less ccan be used. This smaller amount of camber allows a reduction of the drag.

Stability of the optimal airfoils

The result of the maximization of the lift problem is very stable. A slight modification ofoptimal value of the design parameter gives a differentiable variation of the results.

On the other hand, it should be underlined that the airfoil which results fromminimization of the drag problem is less stable. The suction peak present at the rearchord is a factor of separation of the turbulent boundary layer, which gives a large increathe drag.

3.2- Solving the Optimization Problems

59

Page 61: Optimization of Low Speed Airfoils Using Mathlab
Page 62: Optimization of Low Speed Airfoils Using Mathlab

ion ofdetail.ld behapetion of

theoint,

warda large

thetion

ConclusionThe three main parts of the project, development of an aerodynamic solver, computatanalytic derivatives, and exercises of airfoil shape optimization have been presented inThe resulting optimization tool has proven to be a useful airfoil design system, and couused to solve a real optimization problem. The principal conditions are that the airfoil sbe defined analytically, and that the solution does not correspond to a case with separathe turbulent boundary layer.

An improvement to the solver method is possible, by modelling a full coupling betweenexternal flow and the boundary layer, as done in Xfoil. This was envisionned at one pbut not realized because of time constraints.

Automatic differentiation has been performed on the aerodynamic solver using the forand the reverse mode. It has been demonstrated to provide accurate derivatives, but attime cost. It would be interesting to test the computation of the Hessian by ADMAT.

Then an improvement of the optimization algorithm would be possible, by modifyingMatlab optimization toolbox so that it uses the Hessian provided by automatic differentiainstead of a BFGS update.

61

Page 63: Optimization of Low Speed Airfoils Using Mathlab
Page 64: Optimization of Low Speed Airfoils Using Mathlab

c,

nel

here

, P.

ohn

&

lds

the

s.89.

of

yer

8A,

ntsmic

icA.

98.

r

at

References

[1] I.H. Abbott and A.E. Von Doenhoff : Theory of Wing Sections. Dover Publications InNew York, 1959.

[2] J. Katz and A. Plotkin : Low Speed Aerodynamics, From Wing Theory to PaMethods. Mac-Graw Hill, 1991.

[3] B. Maskew, Program VSAERO Theory document. NASA CR 4023, Sept 1987.

[4] T. Cebeci and P. Bradshaw, Momentum Transfer in Boundary Layers. HemispPublishing Corporation 1977.

[5] W.C. Reynolds and T. Cebeci : Calculation of Turbulent Flows. In TurbulenceBradshaw, ed., Springer-Verlag, Topics in Applied Physics Series, Vol. 12, 1978.

[6] J. Moran : An Introduction to Theoretical and Computational Aerodynamics. JWiley and sons, 1984.

[7] W.H.Mason : Boundary Layer Analysis methods. Aerocal, 1981.

[8] H. B. Squire and A. D. Young : The Calculation of the Profile Drag of Aerofoils. R.M. No1838. A.R.C. Technical report, London, 1938.

[9] I. Kroo : PANDA - A Program for Analysis and Design of Airfoils. © DesktopAeronautics, Stanford, 1988. Available on www.desktopaero.com.

[10] M. Drela and M. B. Giles : Viscous-Inviscid Analysis of Transonic and Low ReynoNumber Airfoils. AIAA Journal, 25 (10), Oct. 1987.

[11] M. Drela : Two-Dimensional Transonic Aerodynamic Design and Analysis usingEuler Equations. PhD Thesis. MIT, Gas Turbine Laboratory Rept. 187, Feb. 1986

[12] M. Drela : Xfoil : An Analysis and Design System for Low Reynolds Number AirfoilLow Reynolds Number Aerodynamics, Springer-Verlag, Lec. Notes in Eng. 54, 19

[13] H. Youngren and M. Drela : Viscous / Inviscid Method for Preliminary DesignTransonic Cascades, MIT, Department of Aeronautics and Astronautics, 1991.

[14] E.G.M Coenen : Computational Techniques for Viscous-Inviscid Boundary LaInteraction. KTH, Dept. of Aeronautics, Stockholm, 1996.

[15] R. Michel : Etude de la Transition sur les Profiles d’Ailes, Onera Report 1/1571951.

[16] A. Griewank : On Automatic Differentiation, In Mathematical Programming : ReceDevelopments and Applications, M. Iri and K. Tanabe, eds., Kluwer AcadePublishers, Dordrecht, 1991.

[17] D. Juedes : A Taxonomy of Automatic Differentiation Tools, in AutomatDifferentiation of Algorithms : Theory, Implementations and Applications,Griewank and G. F. Corliss, eds., SIAM, Philadelphia, Penn., 1991.

[18] A. Verma, Structured Automatic Differentiation, PhD Thesis, Cornell University, 19

[19] T. F. Coleman and A. Verma : ADMAT : An Automatic Differentiation Toolbox foMATLAB, Technical report, Cornell University Theory Center, 1998.

[20] Matlab Optimization Toolbox 2.0, User Guide and Theory Document. Availablehttp://www.mathworks.com/access/helpdesk/help/pdf_doc/optim/optim_tb.pdf

63