Download as pdf or txt
Download as pdf or txt
You are on page 1of 64

Shape Optimization of Low Speed Airfoils

using MATLAB and Automatic Differentiation


Christian Wauquiez
Stockholm 2000
Licentiates Thesis
Royal Institute of Technology
Department of Numerical Analysis and Computing Science
1
Abstract
The goal of the project is to develop an innovative tool to perform shape optimization of low
speed airfoils. This tool is written in Matlab, and is constructed by coupling the Matlab
Optimization Toolbox with a parametrised numerical aerodynamic solver.
The airfoil shape is expressed analytically as a function of some design parameters. The
NACA 4 digits library is used with design parameters that control the camber and the
thickness of the airfoil.
The solver has to provide fast and robust computation of the lift, pitching moment and drag
of an airfoil placed in a low-speed viscous ow. A one-way coupled inviscid - boundary
layer model is used.
The inviscid ow is computed with a linear vortex panel method, which provides the lift and
moment coefcients. The boundary layer is computed using an integral formulation : the
laminar part of the ow is computed with a two-equation formulation, and the turbulent part
is solved with Heads model. An e9-type amplication formulation is used to locate the
transition area. Finally, the drag coefcient is computed using the Squire-Young formula.
In order to be used in optimization, the solver must provide derivatives of the objective
function and limiting constraints with the solution for each set of parameters.
These derivatives are computed by automatic differentiation, a technique for augmenting
computer programs with the computation of derivatives based on the chain rule of differ-
ential calculus. The recent Matlab automatic differentiation toolbox ADMAT is used.
Finally as an application, sample optimization problems are solved using the Matlab Optimi-
zation Toolbox, and the resulting optimal airfoils are analysed.
ISBN 91-7170-520-1 q TRITA-NA-0004 q ISSN 0348-2952 q ISRN KTH/NA/R--00/04--SE
3
Contents
Introduction
1- The Aerodynamics Solver . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
1.1- Introduction - Overview of the Model
1.2- Airfoil and Flow Parameters
1.3- Inviscid Flow Model
1.4- Boundary Layer Model
2- Automatic Differentiation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
2.1- Introduction
2.2- Method Fundamentals
2.3- Computer Implementation
2.4- ADMAT, Automatic Differentiation Toolbox for Matlab
2.5- Application of ADMAT to the Aerodynamic Solver
3- Airfoil Shape Optimization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51
3.1- Denition of the Optimization Problems
3.2- Solving the Optimization Problems
Conclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61
References
Acknowledgements
I would like to thank my supervisor, Associate Professor Jesper Oppelstrup, for his interest
and support throughout this work, and Professor Arthur Rizzi for providing information and
for many helpful discussions.
I would also like to thank, for advice and technical support, Associate Professor Ilan Kroo
from Stanford University and Desktop Aeronautics, and Doctor Arun Verma from the
Cornell University Theory Center.
Financial support from NUTEK through the Parallel Scientic Computing Institute, KTH,
and TFR through the Center for Computational Mathematics and Mechanics, KTH, is
gratefully acknowledged.
5
Introduction
The performance of an airfoil can be characterized by three quantities : the lift, moment and
drag coefcients : Cl, Cm and Cd respectively. They represent the aerodynamic loads applied
to the airfoil. The actual loads are proportional to the coefcients times the square of the ow
velocity.
Cl corresponds to the force acting on the airfoil in the direction orthogonal to the ow,
which allows an aircraft to y by compensating its weight.
Cm corresponds to the moment of the aerodynamic force with respect to the quarter of the
airfoil chord length. For the equilibrium of an aircraft, the pitching moment of the main
wing has to be compensated by the moment of a negative-lift tail. Cm should therefore not
be too large.
Finally, Cd corresponds to the component of the force in the ow direction, which hinders
aerodynamic performances and causes fuel consumption.
The present work focuses on shape optimization of airfoils in low speed viscous ows, based
on the analysis of Cl, Cm and Cd.
The airfoils are chosen from the NACA 4 digits library [1], in which the shape is expressed
analytically as a function of three parameters. The library is presented in section 1.2 of this
report.
The formulation used to compute the aerodynamic coefcients is an inviscid - boundary
layer model. The advantage of this kind of approach is that it provides a fast computation of
the ow solution, the disadvantage being that cases with massive ow separation are
impossible to handle. Famous codes based on this formulation include for 2D cases Desktop
Aeronautics Panda [9], and Mark Drelas ISES [10] and Xfoil [12], and for 3D cases Brian
Maskews VSAERO [3]. The solver is presented in section 1.
In order to perform optimization, the solver has to provide the derivatives of the dened
objective function and limiting constraints with the solution for a given set of parameters.
The most common method used to compute these derivatives is nite differences. In the
present work, a new approach, called automatic differentiation (AD), is used. Is is a chain-
rule-based technique to compute the derivative of functions dened by computer programs
with respect to their input variables, and has been investigated since 1960. In 1998, a general
AD toolbox for programs written in Matlab, called ADMAT [19], has been developped at
Cornell University by Arun Verma and Thomas F. Coleman. The present work uses this
toolbox. Automatic differentiation is presented in section 2.
Finally, airfoil shape optimization is performed using the Matlab Optimization Toolbox [20],
which uses a Sequential Quadratic Programming algorithm for non linear constrained
problems. The formulation of sample optimization problems and their resolution are
presented in section 3.
7
1- The Aerodynamic Solver
The solver used to provide the objective function as well as the limiting constraints of the
optimization is presented. The solution is computed using an inviscid-boundary layer model,
and consists in the lift, moment, and drag coefcients : Cl, Cm and Cd respectively.
1.1- Introduction - Overview of the Model
The general Navier-Stokes equations are very powerful since they give a complete
description of all possible ow situations. However it is very time-consuming to obtain a
numerical solution using them. In our particular case, the incompressible turbulent ow past
an airfoil, the viscous effects are important only in a small region near the prole. In this
region, the Navier-Stokes equations can be approximated by the so-called boundary layer
equations. Outside, viscous effects can be neglected, and one can use an inviscid ow model.
The inviscid flow model
The inviscid part of the flow can be solved in several ways. A finite difference discretization
of the steady Euler equation on a grid around the airfoil can be used, as in ISES [10], or a panel
method, as in Xfoil [12] and Panda [9]. One advantage of the first option is that by applying
a periodic boundary condition to the outer boundary, cascade flows can be simulated. This is
done in MISES [13], an extension of ISES.
In the present work, a panel method is used. A variety of such methods exists, they differ in
the choice of the singularity used to represent the velocity potential on the airfoil (sources,
doublets or vortices), and by the choice of the Kutta condition, an extra condition that one
must add to the final system of equations in order to obtain a unique solution. Details about
different panel methods can be found in [2]. The present work uses a linear vortex distri-
bution, which gives a good solution accuracy, even with only a few panels. The Kutta
condition chosen is especially well suited for linearly varying singularity distributions.
The inviscid ow solver provides the tangential velocity distribution on the airfoils surface
(Ue). The pressure distribution is then computed from the velocity eld using the Bernoulli
equation. The lift and moment coefcients, as well as the pressure drag, are calculated by
integrating the pressure over the body surface.
V
V
Navier-Stokes Euler
Boundary Layer
8
The boundary layer model
The boundary layer formulation consists of a model for the laminar part of the ow, a
transition criterion, and a model for the turbulent part of the ow. The ow models rely on
one or two differential equations derived from the integration of the Falker-Skan equations
accross the boundary layer thickness, and on additional semi-empirical equations which
close 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 laminar and
turbulent ows, and different closure relations depending on the ow regime. Panda on the
other hand uses simpler formulations : Thwaites one equation method [4] for the laminar
part, and Heads two equations method [5] for the turbulent part. The present work initially
used simple models, thus Thwaites and Heads. But since Thwaites model cannot represent
separated ow, Xfoils laminar boundary layer model, which can describe thin separated
regions, has been implemented instead.
Concerning the transition criterion, Panda uses Michels criterion, and Xfoil uses a more
advanced 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 thickness , the
momentum thickness , the shape factor H, and the skin friction coefcient Cf. These
quantities are used to compute the drag coefcient. Different methods can be used depending
on the coupling between the inviscid ow and the boundary layer.
The coupling
The coupling between the two models is as follows :
The effect of the boundary layer is that it modies the shape of the airfoil as seen by the
external ow. This gives the inviscid ow a zero normal velocity condition on a boundary
obtained by adding the boundary layer displacement thickness to the airfoils surface.
The boundary layer equations depend on the external tangential velocity distribution.
Two different approaches are possible for the coupling of inviscid - boundary layer ows.
Two-way coupled computation
In this case, the modication of the boundary where the zero normal velocity condition has
to be met due to the boundary layer thickness is taken into account.
The solution begins with the inviscid ow problem, which produces the velocity eld. This
data is then fed into the boundary layer model which results the local wall friction coefcient
and the displacement thickness. Then a second iteration is performed, now with modied

Inviscid Flow with


Boundary Layer
Ue

zero normal velocity condition


on Airfoil +

1- The Aerodynamic Solver


9
surface geometry. This modication can be obtained by displacing the body panels
according to the local displacement thickness, and the procedure is reiterated until a
converged solution is obtained.
Another way to account for the displacement effects is to modify the boundary condition
instead of the geometry. In this case the normal ow is made non-zero to account for the
effect of . This formulation, known as the transpiration velocity concept, states that :
on the airfoils surface.
Using a two-ways coupled model, the total drag is found by adding the friction drag,
obtained by integrating the skin friction coefcient Cf, to the pressure drag, obtained by
integrating the inviscid pressure distribution.
A study of such iterative methods can be found in [14], where it appears that convergence is
not easy to obtain. A more recent approach is the one used in ISES and Xfoil. The
transpiration velocity concept is used, and the entire nonlinear equation set is solved
simultaneously as a fully coupled system by a Newton-Raphson method. This method
provides 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 iteration is
performed : the external tangential velocity is computed by the inviscid model with the
condition V.n=0 on the airfoils surface, and then fed into the boundary layer model.
The drag coefcient is obtained using the Squire-Young formula [8], which in effect
computes the momentum decit. It is a function of some of the boundary layer results
(momentum thickness and shape factor) at the trailing edge.
Compared to coupled computations, the accuracy of the lift is very good, but not as good for
the drag. However the sensitivity of the results with respect to airfoil shape or ow
parameters is well reproduced. This method is used in Panda, as well as in the present work.
1.2- Airfoil Shape Parameters
The shape of the airfoil can be chosen in the famous Naca 4 digits library [1]. This simple
library is interesting because the shape is expressed analytically as a function of three
parameters, which control the maximum camber, maximum camber location, and maximum
thickness of the airfoil.

V n
d
dx
------ U
e

( ) =
x
y
Maximum Camber
Maximum Thickness
Maximum Camber Location
2412
8412
4212
4812
4406
4420
1.2- Airfoil Shape Parameters
10
A wide variety of airfoils can be obtained by varying the three parameters, as shown on the
previous gure.
A numbering system is used to dene NACA 4-digits wing sections. The rst digit indicates
the maximum value of the mean-line ordinate in percent of the chord. The second integer
indicates the distance from the leading edge to the location of the maximum camber in tens
of the chord. The last two integers indicate the section thickness in percent of the chord.
Thus, the NACA 4512 has 4% camber located at 50 % of the chord from the leading edge,
and is 12% thick.
We note that these digits do not really have to be integers. By extension of the notation, a
NACA 4.23 2.21 17.2 would have 4.23% camber located at 22.1% of the chord from the
leading edge, and be 17.2% thick
The wing section is obtained by combining the camber line and the thickness distribution as
shown on the following gure
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 the
maximum camber location, and is the maximum thickness.
x
y
y
th

y
th
y
c
x
U
x y
th
cos =
y
U
y
c
y
th
sin + =

'

x
L
x y
th
cos + =
y
L
y
c
y
th
sin =

'

x
U
y
U
, ( ) x
L
y
L
, ( )
y
th
5c 0.2969
x
c
--- 0.126
x
c
--- 0.3537
x
c
-- -
,
_
2
0.2843
x
c
---
,
_
3
0.1015
x
c
---
,
_
4
+
,
_
=
y
c
m
p
2
----- 2p
x
c
---
x
c
---
,
_
2

,
_
=
x
c
--- p
m
1 p ( )
2
------------------- 1 2p 2 + p
x
c
---
x
c
-- -
,
_
2

,
_
=
x
c
--- p

1- The Aerodynamic Solver


11
1.3- Inviscid Flow Model
The incompressible potential ow governed by the Laplace equation is solved numerically
with a panel method, which provides the tangential external velocity. The pressure is then
obtained using the Bernoulli equation, and Cl and Cm are derived by integrating the
pressure over the airfoil.
Theoretical equation of the ow
For an irrotational ow, the velocity is the gradient of a quantity called the velocity potential.
Substituting this into the continuity equation for an inviscid incompressible ow leads to :
or : (Laplace equation)
On the airfoils surface A, the external Neumann boundary condition must be satised :
,
where can be related to integral boundary layer quantities through the transpiration
velocity model. In our case, the effect of the boundary layer is neglected and is simply set
to zero, which produces the classical zero normal velocity condition.
General solution of the incompressible potential ow
A general solution to the Laplace equation is obtained by adding a distribution of vortices
on the airfoils surface to the potential of the free stream. The solution at any eld point P is
thus given by :
,
where is the potential of a unit strength vortex :
being the polar coordinate of P relative to (ds).
airfoil A
n
Inviscid
Incompressible
Irrotational
U

V u v , ( ) = =
x
2
2


y
2
2


+ 0 = 0 =

n
------ V
n
=
V
n
V
n

P
u

x v

y
v
s d
A

+ + =

v
1
2
------ =
r , ( )
1.3- Inviscid Flow Model
12
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 body is
divided into N at panels and the boundary condition equation is specied on each of them at
a "collocation point" dened as the panel mid-point.
Moreover, the integration is performed on each panel and the boundary condition becomes :
Singularity element
Now, the integral on each panel must be computed :
We will rst compute u and v in the panel coordinate system, and then transform them back
in the global coordinate system.
We now consider the coordinates (x,y) in the panel coordinate system. They are obtained
using the following transformation :
,
where are the coordinates of the panel origin in the global coordinate system.

P
n 0 u

, ( ) n

v
n
-------- s d
A

+ 0 = =
1
2
3
N
N-1
Panel corner point
Collocation point
u

, ( ) n

v
n
-------- s d
panel

,

_
i 1 =
N

+ 0 =


v
n
-------- s d
panel



v
x
-------- s

v
y
-------- s d
panel

, d
panel

,

_
n u v , ( ) n =
x
y ,

_
p

i
cos
i
sin

i
sin
i
cos
x x
0

y y
0
,

_
G
=
x
0
y
0
, ( )
x
y Global CS
Panel CS
x
p
y
p

i
Panel i
1- The Aerodynamic Solver
13
On each panel, we choose a linear vortex distribution .
This is simply the superposition of a constant-strength element and a linearly varying
element. For simplicity, we consider the two elements separately to compute the potential
and 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

1
x + =
y
p
x
p
L

0

1
x +

2
--------
y
x x
0

-------------- atan x
0
d
0
L

=
u

x
----------

0
2
------
y
x x
0
( )
2
y
2
+
--------------------------------- x
0
d
0
L

= =
v

y
----------

0
2
--------
x x
0

x x
0
( )
2
y
2
+
--------------------------------- x
0
d
0
L

= =
u

0
2
------
2

1
( ) = v

0
2
------
r
2
r
1
---- ln =

1
x

2
-------- x
0
y
x x
0

-------------- atan x
0
d
0
L

=
u

1
x

1
x

x
------------

1
2
------
x
0
y
x x
0
( )
2
y
2
+
--------------------------------- x
0
d
0
L

= =
v

1
x

1
x

y
------------

1
2
--------
x
0
x x
0
( )
x x
0
( )
2
y
2
+
--------------------------------- x
0
d
0
L

= =
1.3- Inviscid Flow Model
14
Solving the integrals gives :
And :
Now, what we really want is a piecewise linear continuous vortex distribution on the whole
airfoil surface. So we have to set the strength of at the beginning of each panel equal to the
strength of the vortex at the end point of the previous panel as shown on the following gure.
The relation between the vortex strengths of the elements shown above and the panel end
values and is :
and
Thus, rearranging the expressions for u and v in terms of and gives :
These two equations can be divided into velocity induced by and , such that :
,
where the subscripts a and b represent the contribution due to the leading and trailing
singularity respectively. By rearranging the equations, we obtain the a part of the velocity :
u

1
x

1
4
-------- 2z
r
1
r
2
---- 2x
2

1
( ) ln =
v

1
x

1
2
-------- x
r
1
r
2
---- L z
2

1
( ) + + ln =

y
p
x
p
j-1
j
j+1
j+2

j 1

j 1 +

j 2 +
P(x,y)

j 1 +

j
r
j 1 +
r
j

0

1

j

0
=
j 1 +

0

1
L + =

j

j 1 +
u
z
2
------

j 1 +

j

x
j 1 +
x
j

---------------------- -
,
_
r
j 1 +
r
j
-----------

j
x
j 1 +
x
j
( )
j 1 +

j
( ) x x
j
( ) +
2 x
j 1 +
x
j
( )
------------------------------------------------------------------------------------- -
j 1 +

j
( ) + ln =
v

j
x
j 1 +
x
j
( )
j 1 +

j
( ) x x
j
( ) +
2 x
j 1 +
x
j
( )
------------------------------------------------------------------------------------- -
r
j
r
j 1 +
-----------
z
2
------

j 1 +

j

x
j 1 +
x
j

---------------------- -
,
_
x
j 1 +
x
j

z
---------------------- -
j 1 +

j
( ) + + ln =

j

j 1 +
u v , ( ) u
a
v
a
, ( ) u
b
v
b
, ( ) + =
u
a

j
2 x
j 1 +
x
j
( )
---------------------------------- z
r
j 1 +
r
j
----------- x
j 1 +
x ( )
j 1 +

j
( ) + ln =
v
a

j
2 x
j 1 +
x
j
( )
---------------------------------- x
j 1 +
x ( )
r
j
r
j 1 +
----------- x
j 1 +
x
j
( ) z
j 1 +

j
( ) + + ln =
1- The Aerodynamic Solver
15
And the b part of the velocity :
To transform these velocity components back to the global coordinate system, a rotation by
the panel orientation angle is performed as given by :
(1)
The expressions above can be included in an induced velocity function F, which will
compute the velocity (u,v) at an arbitrary point (x,y) in the global coordinate system due to
the j-th panel.
Discretization of geometry
In most cases involving thick airfoils, a denser paneling is used near the leading and trailing
edges. A frequently used method for dividing the chord into panels with larger density near
the edges is the full cosine method. It is shown on the gure below.
If nine chordwise panels are needed, then the semicircle is divided by this number, and
. The corresponding x stations are found by using the following formula :
Then the airfoil points coordinates are computed using the airfoil shape function.
u
b

j 1 +
2 x
j 1 +
x
j
( )
---------------------------------- z
r
j 1 +
r
j
----------- x x
j
( )
j 1 +

j
( ) + ln =
v
b

j 1 +
2 x
j 1 +
x
j
( )
---------------------------------- x x
j
( )
r
j
r
j 1 +
----------- x
j 1 +
x
j
( ) z
j 1 +

j
( ) + + ln =

i
u
v ,

_
G

i
cos
i
sin

i
sin
i
cos
u
w ,

_
p
=
u
a
v
a
,
u
b
v
b
,
,

_
F
j

j 1 +
x z x
j
y
j
x
j 1 +
y
j 1 +
, , , , , , , ( ) =

1 2 3 4 5 6 7 8 9 10
x
y
1
2
3
4
5
6
7
8
9
10
11 12
13
14 15 16 17
18 19
Corner point
Collocation point
9 =
x
c
2
--- 1 cos ( ) =
1.3- Inviscid Flow Model
16
Inuence coefcients
In this phase, the zero normal ow boundary condition is implemented. For example, the
velocity induced by the jth element with a unit strength at the rst collocation point is
obtained by :
This shows that the velocity at each collocation point is inuenced by the two edges of the
jth panel. When adding the inuence of the j+1 panel and on, the local induced velocity will
have the form :
This equation can be reduced to the form :
Such that for the rst and last terms :
and :
And for all other terms :
The inuence coefcient is then dened as the velocity component normal to the surface.
The contribution of a unit strength singularity element j at collocation point 1 is therefore :
,
where :
u
a
v
a
,
u
b
v
b
,
,

_
1j
F
j
1 =
j 1 +
1 = x
1
z
1
x
j
y
j
x
j 1 +
y
j 1 +
, , , , , , , ( ) =
u v , ( )
1
u
a
v
a
, ( )
11

1
u
b
v
b
, ( )
11
u
a
v
a
, ( )
12
+ [ ]
2
u
b
v
b
, ( )
1N 1
u
a
v
a
, ( )
1N
+ [ ]
N
u
b
v
b
, ( )
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
u
a
v
a
, ( )
11
= u v , ( )
1N 1 +
u
b
v
b
, ( )
1N
=
u v , ( )
1j
u
b
v
b
, ( )
1j 1
u
a
v
a
, ( )
1j
+ [ ] =
a
ij
a
1j
u v , ( )
1j
n
1
=
n
i

i

i
cos , sin ( ) =
x
y

i
n
i

i

i
cos , sin ( ) =
t
i

i

i
sin , cos ( ) =
1- The Aerodynamic Solver
17
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 points
results 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. Physical
considerations lead to the choice of the Kutta condition, which species that the circulation
at 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 dened diagonal, and can be solved for by using
standard methods of linear algebra.
Modication 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
RHS
i
u

, ( )
i

i
cos , sin ( ) =

j
a
11
a
12
a
1N 1 +
a
21
a
22
a
2N 1 +

a
N1
a
N2
a
NN 1 +

N 1 +
,





_
RHS
1
RHS
2

RHS
N
,





_
=

TE
0 =

TE

1

N 1 +
+ =

1

N 1 +
+ 0 =
a
11
a
12
a
1N 1 +
a
21
a
22
a
2N 1 +

a
N1
a
N2
a
NN 1 +
1 0 1

N 1 +
,





_
RHS
1
RHS
2

RHS
N
0 ,







_
=

1

N 1 +
+ 0 =

1
1e6 =
N 1 +
1 e6 =

1
0 =
N 1 +
0 =
1.3- Inviscid Flow Model
18
It is thus necessary to introduce an additional unknown. A wake panel with a constant-
strength vortex is added to the model as shown on the following gure. The panel leaves
the trailing edge at its median angle and extends to innity, so that in practice the far portion
(starting vortex) will have no inuence.
In the panel coordinate system, the velocity induced by the constant-strength vortex of
the wake panel at point is :
where is the angle at which P sees the wake panel, and and are the distances from
P to the wake panel end points, as shown on the following gure.
These velocity components are computed at each collocation point, and transfered in the
global coordinate system using equation (1). The inuence coefcient is then obtained by :
,
where :
This is then included in the inuence matrix, as well as the new Kutta condition.
We obtain :
(3)
Which can be solved for .

w
1
2
3
N
N-1
W

w
P x
i
y
i
, ( )
u
iw
1
2
------
iw

w
=
v
iw
1
2
------
r
i1
r
i
------
,
_

w
ln =

iw
r
i1
r
i
X
Y
Wake panel
P x
i
y
i
, ( )

iw
x
1
x

r
i
r
i1
a
iw
u v , ( )
iw
n
i
=
n
i

i

i
cos , sin ( ) =
a
11
a
12
a
1N 1 +
a
1w
a
21
a
22
a
2N 1 +
a
2w

a
N1
a
N2
a
NN 1 +
a
Nw
1 0 0 0
0 0 1 0

N 1 +

W
,







_
RHS
1
RHS
2

RHS
N
0
0
,








_
=

i
1- The Aerodynamic Solver
19
Results are now presented using the regular and modied Kutta conditions. The test case is a
NACA 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 to the
tangential component of the external ow velocity.
So we have to build the matrix b of coefcients such that :
,
where :
And the vector of terms :
Then, we have :
Which gives the tangential velocity at each airfoil collocation point.
N N 1 + b
ij
b
ij
u v , ( )
ij
t
i
=
t
i

i
cos
i
sin , ( ) =
U
e
U
e
( )
i
u

, ( )
i
cos
i
sin , ( ) =
U
e
1
U
e2

U
eN
,





_
b
11
b
12
b
1N 1 +
b
21
b
22
b
2N 1 +

b
N1
b
N2
b
NN 1 +

N 1 +
,





_
U
e
1
U
e2

U
eN
,





_
+ =
1.3- Inviscid Flow Model
20
Computation of the pressure
The Bernoulli equation applied to a streamline between the upstream innity and a point on
the airfoils surface gives :
So :
Then :
Gives :
We can thus compute the pressure coefcient at each airfoil collocation point.
Computation of the aerodynamic coefcients
We are looking for the lift coefcient Cl, and the moment coefcient Cm, which represents
the moment of the aerodynamic force with respect to the point of coordinates .
Dimensionless coefcients are obtained by integrating Cp.
The elementary forces and acting on panel j 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, the total
load applied to the airfoil is obtained : (Fx, Fy) and Cm.
p
1
2
-- -U
e
2
+ p

1
2
---

2
+ =
p p

1
2
---

2 1
2
-- -U
e
2
+ =
Cp
p p

1 2

2
--------------------------- =
Cp 1
U
e
2
U

2
---------- =
c 4 0 , ( )
x
y
x
j
y
j
, ( )
x
j 1 +
y
j 1 +
, ( )
panel j
Cp
j
f
xj
f
yj
f
xj
Cp
j
y
j 1 +
y
j
( ) = f
yj
Cp
j
x
j 1 +
x
j
( ) =
m
j
m
j
f
xj
y
j 1 +
y
j
+
2
---------------------- -
,
_
f
yj
x
j 1 +
x
j
+
2
---------------------- -
c
4
---
,
_
+ =
1- The Aerodynamic Solver
21
The lift coefcient is then simply the component of F normal to the ow direction :
And the pressure drag coefcient is the component of F in the ow direction :
Validation of the inviscid ow model
First, the accuracy of the solver is tested. The lift, moment and drag coefcients of a NACA
4412 airfoil at 5 degrees angle of attack are computed with 50, 100, 200, 400 and 800 panels.
The results is a clear convergence for all coefcients, as can be seen on the following gures.
Note that the pressure drag coefcient tends to zero. This result is known as the dAlembert
paradox : if the effect of the displacement thickness is not taken into account, the pressure
drag of an airfoil is theoretically equal to zero. Fortunately, the method we use to compute
the drag (the Squire-Young formula, see 1.4.4) provides directly the total drag, so we do not
have 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 the same
formulation and has been validated with respect to experimental data [12]. On the following
graphs, our program is referred to as PMBL (Panel Method / Boundary Layer).
Graphical results obtained with the two programs are seen in the following gure. The test
case is the inviscid ow past a Naca 4512 at zero angle of attack.
C
l
F
x
F
y
cos + sin =
C
dp
F
x
F
y
sin + cos =
Xfoil PMBL
1.3- Inviscid Flow Model
22
The lift coefcients Cl computed by the two programs are compared in several test cases.
Each case shows the sensitivity, i.e. the evolution, of the results with respect to the angle of
attack and to shape parameters.
The moment coefcients Cm computed by the two programs are now compared in two test
cases. Cm does not vary much with respect to the angle of attack and the thickness, so we test
the sensitivity with respect to the camber and camber location parameters only.
1- The Aerodynamic Solver
23
1.4- Boundary Layer Model
An integral model is used : the laminar part of the ow is computed with a two-equation
formulation previously used in ISES [10], and the turbulent part is solved with Heads model
[5]. An e9-type amplication formulation also used in ISES is used to locate the transition
area. Finally, the drag coefcient is computed using the Squire-Young formula [8], and the
results 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 and the
coordinates of the airfoil must be made dimensionless. The external velocity is thus
divided by the far eld ow velocity and the airfoil point coordinates are divided by the
airfoil chord length.
The boundary layer should start at the stagnation point, and follow the ow along the
upper or lower surface toward the trailing edge. This requires identifying the stagnation
point in the inviscid solution and using the panel discretization to compute the arc length
along the surface from the stagnation point, which is the length x in the boundary layer
equations.
The discretization of each side can be given directly by the panels used for the external
ow computation. But in order to be able to solve the boundary layer accurately without
having to use many panels for the inviscid ow solution, it is more convenient to build a
uniform arc length grid on each side. This grid is based on a spline interpolation of the
airfoil panels corner points.
The boundary layer model uses the external tangential velocity, as well as its rst spatial
derivative. The value of the velocity at each mesh point is obtained using a spline interpo-
lation of the velocity eld known at the panel nodes. The derivative of the velocity is
obtained by differentiating the spline interpolation.
x
4
3
2
1
Upper surface boundary layer Lower surface boundary layer
2 3 4
x
1
1.4- Boundary Layer Model
24
1.4.2- The Laminar Boundary Layer
Theoretical equation of the ow
By analyzing and comparing the order of magnitude of the terms of the steady
incompressible Navier-Stokes equations, we can derive the following Prandtl boundary layer
equations (details of the computations and approximations can be found in [6]) :
(4)
(5)
(6)
Note : x and y are not Cartesian coordinates. x is measured along the airfoils surface with
x=0 locating the stagnation point, and y 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 numbers,
The tangential velocity u is much larger than the normal component v,
The pressure is essentially constant across the boundary layer (in the y direction).
These results naturally lead to the concept of an integral boundary layer formulation, where
the properties are assumed to depend only on x.
Integral momentum equation
By combining the boundary layer equations, and integrating the resulting expression from
zero to innity with respect to y, the well known Von Karman integral momentum equation
is obtained.
See [6] for more details about the derivation. The displacement and momentum thicknesses
and , and the skin friction coefcient are dened as follows.
, where :
x
u
y
v
+ 0 =
u
x
u
v
y
u
+
,
_
x
p

y
2
2

u
+ =
y
p
0 =
x d
d
U
e
------ 2

----- +
,
_
x d
dU
e
+
1
2
-- -C
f
=

C
f

1
u
U
e
------
,
_
y d
0

u
U
e
------ 1
u
U
e
------
,
_
y d
0

=
C
f

w
1 2 U
e
2

------------------------- =
w

y
u
y 0 =
=
1- The Aerodynamic Solver
25
Note : The displacement thickness can be seen as the displacement of the airfoils surface
needed to construct a constant velocity prole through the boundary layer having the same
ow volume as in the real case.
This ow 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 by u and then integrated, the kinetic energy integral
equation results :
, (8)
where the kinetic energy thickness , and the dissipation coefcient are dened by :
and :
Then, by introducing the second shape parameter and substracting equation (7)
from equation (8), the kinetic energy equation can be written as :
(9)
Displacement thickness
Ue
real BL thickness
y
x
Ue
y
x
Airfoils surface Airfoils surface
x ( )

x ( )
U
e
u ( ) y d
0

U
e
=
H

=
x d
d
U
e
------ 2 H + ( )
x d
dU
e
+
1
2
-- -C
f
=
d

dx
--------- 3

U
e
------
dU
e
dx
--------- + 2C
D
=
C
D

1
u
U
e
------
,
_
2

,
_
u
U
e
------ y d
0

= C
D
1
U
e
3
----------
y
2
2

u
y d
0

=
H

dH

dx
---------- H

H 1 ( ) [ ]

U
e
------
dU
e
dx
--------- + 2C
D
H

C
f
2
----- =
1.4- Boundary Layer Model
26
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 thickness
, we obtain :
,
where : and : ,
Then, Thwaites found that the right hand side can be approximated by the linear formula :
When this and the denition 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 accuracy
than the 1st-order trapezoidal rule recommended in [6] or [7] :
,
where and .
Re

ReU
e
=
ReU
e
d
2
dx
--------- 2 L 2 H) + ( ) [ ] =
L ReU
e
C
f
2
----- = Re
2
dU
e
dx
--------- =
2 l 2 H) + ( ) [ ] 0.45 6

ReU
e
d
2
dx
--------- 0.45 6Re
2
dU
e
dx
--------- =
Re
x d
d

2
U
e
6
( ) 0.45U
e
5
=

x 0 = ( )
0.075
Re
dU
e
dx
--------- 0 ( )
------------------------- =
Re
2
U
e
6
( )
i 1
i
0.45 U
e
5
x
i 1
x
i

dx =
U
e
5
x ( )
x
i 1
x
i

dx
dx
18
------ 5U
e
5
x
m
3
5
---
dx
2
------
,
_
8U
e
5
x
m
( ) 5U
e
5
x
m
3
5
---
dx
2
------ +
,
_
+ +
dx x
i
x
i 1
= x
m
x
i
x
i 1
+ ( ) 2 =
1- The Aerodynamic Solver
27
Once is known, can be calculated. The shape factor H and the skin friction coefcient
are 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 ows since it
uniquely ties the shape parameter to the local pressure gradient which is, in fact, a nonunique
relationship in separating ows. Therefore, for some cases, laminar separation (detected by
the vanishing of ) is obtained before transition. After that, following what is done in
Panda, laminar separation is considered as a trigger for transition and the computation is
carried on with the turbulent ow model.
There are thus two different effective transition criteria, which may impair the
differentiability of the solution with respect to the design parameters. A slight modication
of the airfoil geometry can make a change in the active criterion, and since this implies a
jump in the start of the turbulent ow, a resulting jump is obtained in the drag results.
As an example, we consider a 12 % thick airfoil, with 4% maximum camber. The location of
the maximum camber p varies between 20 and 30% of the chord length by increment of 1%.
As p increases, we have rst laminar separation on both sides up to p=22%, then transition
happens on the lower side from p=23%, and nally transition takes place on the upper side as
well from p=27%.
The discontinuities in the solution which are seen on the above graph result from the move of
the start of the turbulent ow : from 9.1% of the chord for p=22% to 15,5% for p=23%, and
from 26.5% of the chord for p=26% to 43% for p=27%.
C
f
H ( ) 2.61 3.75 5.24
2
+ = 0 0.1 < <
2.088
0.0731
0.14 +
-------------------- + =
0.1 0 < <
C
f
2L ( )
ReVe
------------------ =
L ( ) 0.22 1.57 1.8
2
+ = 0 0.1 < <
0.22 1.402
0.018
0.107 +
----------------------- + + = 0.1 0 < <
C
f
1.4- Boundary Layer Model
28
Two-equation model
This more advanced model is based on the integral momentum and kinetic energy equations.
It adequately describes thin separated regions. Thus the computation of the laminar ow is
always carried out until transition, and there are no longer any discontinuities in the solution.
Closure relations
Since the system of equations (7) and (9) contains too many unknowns, it must be
supplemented by other equations. Semi-empirical relations derived from the Falkner-Skan
one-parameter velocity prole family are used to close the system. The following functional
dependencies 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 1.515
which occurs for H = 4. Equation (9), however, does not guarantee that dH*/dx = 0 at this
point. Now H = 4 is obtained very seldom, but still there are cases where the solution
suddenly ceases to exist because (9) indicates dH*/dx * = 0 close to H =4. In this case we
force transition to be able to continue the calculation downstream.
Practical equations
The equations are written in terms of H and . Multiplying equation (7) by
and arranging the derivative to make appear gives :
And multiplying equation (9) by , and expanding the derivative to make
appear results in :
,
where , , , and .
H

H ( ) 1.515 0.076
4 H ( )
2
H
-------------------- + = =
1.515 0.040
4 H ( )
2
H
-------------------- + = H 4
Re

C
f
2
----- f
1
H ( ) 0.067 0.01977
7.4 H ( )
2
H 1
------------------------- + = =
0.067 0.022 1
1.4
H 6
-------------
,
_
2
+ = H 7.4
Re

2C
D
H

---------- f
2
H ( ) 0.207 0.00205 4 H ( )
5.5
+ = =
0.207 0.003
4 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 ( )
dH
dx
------- 1 H ( )W x ( ) + f
3
H ( ) =
V U
e
= W dU
e
dx = g H ( ) d H

ln ( ) dH = f
3
H ( ) f
2
H ( ) f
1
H ( ) =
1- The Aerodynamic Solver
29
Initial values at the stagnation point
They are chosen such that and are equal to zero. This choice avoids any
initial transient and allows large steps to be taken from x=0. H(0) and are computed
from :
, with the root
And :
Implicit scheme
We apply a backward Euler with slight modication to avoid implicit iterations. In the step
from to , and are linearized around and g is taken as . This results in a
system of two bilinear equations in and which can be solved exactly.
This procedure is used until transition is predicted or until the trailing edge point is reached.
1.4.2- Locating Transition
Transition from laminar to turbulent ow is a result of the growth of disturbances which
make the laminar boundary layer unstable. Accurate prediction of the transition region is a
crucial point in obtaining a good drag estimate since it separates the laminar ow region,
where the skin-friction drag is low, from the turbulent ow region, where the skin friction
drag increases dramatically.
Michels criterion
This criterion is based on the idea that transition starts at a specic Reynolds number based
on the distance x from the start of the boundary layer. The value of the transition Reynolds
number depends on many factors, the most important being the pressure gradient imposed on
the boundary layer by the inviscid ow and the surface roughness.
For incompressible ows without heat transfer, Michel [15] examined a variety of data and
concluded 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 ( )
-------------- = H
0
2.24

0
f
1
H
0
( )
W 0 ( ) 2 H
0
+ ( )
----------------------------------- =
x
n
x
n 1 +
f
1
f
3
H
n
g
n
H H
n 1 +
=
n 1 +
=
V
n 1 +
2x
------------- 2W
n 1 +
+
,
_
W
n 1 +
H f'
1n
H
V
n 1 +
2x
-------------
n
f
1n
f'
1n
H
n
+ + 0 =
W
n 1 +
gH
n
V
n 1 +
x
------------------------
,
_

gV
n 1 +
x
----------------- W
n 1 +

,
_
H f'
3n
H f
3n
f'
3n
H
n
+ + 0 =
Re

Re
max
> 1.174 1
22.4
Re
x
---------- +
,
_
Re
x
( )
0.46
=
Re

ReU
e
= Re
x
ReU
e
x =
1.4- Boundary Layer Model
30
This formula does account for the effect of the pressure gradient, because the momentum
thickness grows more rapidly in a positive pressure gradient. However, it does not include
the effect of surface roughness, but being based on data taken on airfoils, it should be good
for wing analysis.
Implementation of this criterion reveals that for cases where the external ow velocity is not
monotone past the suction peak, the function is not monotone either, and can
therefore have several zeros. Since transition is predicted as soon as the function vanishes,
this can result in a discontinuity in the solution with respect to the design parameters, as
illustrated on the following example.
We consider a 12% thick airfoil with 4% maximum camber. For a slight modication of the
maximum 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 the drag
results is obtained. Transition then keeps moving forward, which explains the increase of the
drag.
This behavior is suspect with respect to reality. It is moreover problematic for the present
work, because it makes the drag solution discontinuous and non differentiable. Another
transition criterion is thus considered.
Re

R e
max
1- The Aerodynamic Solver
31
ISES e9-type method
ISES uses a spatial amplication theory based on the Orr-Sommerfeld equation, also known
in the literature as the method. This equation governs the growth and decay of
innitesimal wave-like disturbances in two or three dimensional shear layers. Since the
unstable growth of disturbances is known to be the precursor of free transition in boundary
layers, the calculation of the growth of such disturbances is a good basis for the prediction of
transition.
The procedure is to compute the maximum amplication ratio downstream and to assume
that transition occurs when the amplitude has grown by more than a factor of .
This is a wholly empirical assumption. The exponent "9" actually can vary between 7 and 11
depending on quantities such as free stream turbulence, surface roughness, and background
noise level as discussed in Cebeci and Bradshaw [4].
Using the Falker-Skan prole family, the spatial amplication curve envelopes can be related
to the local boundary layer parameters. The procedure is described in [11]. The envelopes
are then approximated by straight lines, giving :
, (10)
where is the logarithm of the maximum amplication ratio. The slope and the
critical Reynolds number are expressed by the following empirical formulas :
And :
For simple cases such as symmetric airfoils at zero angle of attack and at plates, is
uniquely related to the streamwise coordinate x, and equation (10) immediately gives the
amplitude ratio as a unique function of x. Transition is assumed to occur where .
For more general cases, where the external ow velocity may not be monotone past the
suction peak, it is more physically realistic to use x as the spatial amplication coordinate
rather than . This is where the present transition criterion becomes better than Michels
formulation.
Using some basic properties of the Falkner-Skan prole family, the conversion from to
x is accomplished as follows by Drela [10] :
e
9
e
9
8100
n

dn

dRe

------------ H ( ) Re

Re

0
[ ] =
n

dn

dRe

Re

0
dn

dRe

------------ 0.01 2.4H 3.7 2.5 1.5H 4.65 ( ) tanh + [ ]


2
0.25 + { }
1 2
=
log
10
Re

0
( )
1.415
H 1
------------- 0.489
,
_
20
H 1
------------- 12.9
,
_
3.295
H 1
------------- 0.44 + + tanh =
Re

x ( ) 9 =
Re

Re

dn

dx
------
dn

dRe

------------
dRe

dx
------------
dn

dRe

------------
1
2
---
x
U
e
------
dU
e
dx
--------- 1 +
,
_
U
e

2
x
----------------
1

--- = =
1.4- Boundary Layer Model
32
Using the empirical relations :
And :
The spatial amplication rate is expressed as a function of H and :
And this amplication rate is then integrated downstream from the instability point ,
where :
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 length of the
airfoil, the ow is intermittently laminar and turbulent. Since no method exists for describing
this transition process, we have to adopt the ction of a transition point. After using a
laminar boundary layer model up to the transition point, one switches to a different method
for the turbulent part.
For an accurate and reliable solution, it is essential that no discontinuities are admitted as the
transition point moves across a grid point. The transition is rst located in an interval (i, i+1),
such that and for Michels criterion, or
and for the e9-type criterion.
This interval is then treated as two subintervals as shown in the following gure.
is the exact point where , or . It is found as the root of a
linear interpolation of , or , on the interval.
U
e

2
x
---------------- p H ( ) 6.54H 14.07 ( ) H
2
= =
x
U
e
------
dU
e
dx
--------- m H ( ) 0.058
H 4 ( )
2
H 1
-------------------- 0.068
,
_
1
p H ( )
------------ = =

dn

dx
------ H , ( )
dn

dRe

------------ H ( )
m H ( ) 1 +
2
-----------------------p H ( )
1

--- =
x
cr
Re

Re

0
=
n

x ( )
dn

dx
------ x d
x
cr
x

=
n

x ( ) 9 =
Re

x
i
( ) Re
max
x
i
( ) < Re

x
i 1 +
( ) Re
max
x
i 1 +
( ) >
n

x
i
( ) 9 < n

x
i 1 +
( ) 9 >
i
i+1 x
tr
x
Laminar step Turbulent step
x
tr
Re

x ( ) Re
max
x ( ) = n

x ( ) 9 =
Re

x ( ) R e
max
x ( ) n

x ( ) 9
1- The Aerodynamic Solver
33
1.4.3- The Turbulent Boundary Layer
For a large enough Reynolds number, the boundary layer can become turbulent i.e.
experience an unsteadiness due to an unstable response to small disturbances. This
unsteadiness is due to weak viscosity which is unsufcient to damp out disturbances that
naturally appear and results in a random unstable ow. In such a case, there is little hope of
following the uid motion in detail. It is necessary and, for practical purposes, sufcient to
use some form of average description for the ow.
For this we dene the time-average of any ow quantity by :
and label the uctuating part of a ( ) with the symbol a, so :
Theoretical equation of the ow
By time-averaging and comparing the order of magnitude of the terms of the steady
incompressible Navier-Stokes equations, the following turbulent boundary layer equations
can be derived :
(11)
(12)
(13)
Note : x and y are not Cartesian coordinates : x is measured along the airfoils surface with
x=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 above
are the same as in the laminar case, the difference here is that the neglected terms are less
negligible in this case.
Von Karman momentum integral equation
The Von Karman integral equation can also be derived from the turbulent equations. The
differences with respect to the laminar case are :
The inclusion in equation (12) of a term , called Reynolds stress. Fortunately this
term vanishes at the airfoils surface because of the no-slip condition.
The term is non zero in equation (13). However the boundary layer is so thin that
we can assume that the pressure is constant in the y direction,
The integral quantities , , H and are now expressed with time-averaged velocities.
a x y , ( )
1
T
---
T
lim a x y t , , ( ) t d
to
to T +

=
a a
a x y t , , ( ) a x y , ( ) a' x y t , , ( ) + =
u
x
-----
v
y
----- + 0 =
u
u
x
----- v
u
y
----- +
,
_
p
x
-----
y

u
y
----- u' v'
,
_
+ =
p
y
-----
y

v
y
----- v'
2

,
_
=
u' v'
p y

C
f
1.4- Boundary Layer Model
34
Heads model
Heads model is described in detail in [2]. It is a typical integral method, wherein some
analytical procedures have been carried out before the numerical problem is posed. It is a
reasonably accurate and especially fast method.
The model uses the Von Karman equation and, as in the laminar case, some semi-empirical
relations to close the system. The method has been derived as follows.
We consider the volume rate of ow within the boundary layer at x :
,
where is the boundary layer thickness. Combining this with the denition of the
displacement thickness, we nd :
We introduce the entrainment velocity :
Which we write :
With :
Head assumed that the dimensionless entrainment velocity depends only on and
that , in turn, is a function of H. Cebeci and Bradshaw [4] t several sets of experimental
data to the following formulas :
(14)
And : for
for
The fourth equation used to solve for the unknowns , H, and is the Ludwieg-Tillman
skin friction law :
Q x ( ) u y d
0
x ( )

=
x ( )


Q
U
e
------ =
E
x d
dQ
x d
d
U
e

( ) = =
E
x d
d
U
e
H
1
( ) =
H
1

-------------- =
E U
e
H
1
H
1
1
U
e
------
x d
d
U
e
H
1
( ) 0.0306 H
1
3 ( )
0.6169
=
H
1
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 >
H
1
C
f
C
f
0.246 10
0.678H
( ) Re

0.268
=
1- The Aerodynamic Solver
35
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 value at
the 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 closure
relation , which is not dened for all values of H and . It is obvious on the
following graph of the function.
x d
d
U
e
------ 2 H + ( )
dU
e
dx
---------
1
2
-- -C
f
+ =
dH
1
dx
---------- H
1
1
U
e
------
dU
e
dx
---------
1

---
x d
d
+
,
_

0.0306

---------------- H
1
3 ( )
0.6169
+ =
s d
dY
f Y x , ( ) = Y

H
1
,
_
=
f 1 f Y
i
x ,
i
( ) = Y

Yi x
i 1 +
x
i
( )f 1 + =
f 2 f Y

x
i 1 +
, ( ) =
Yi 1 + Yi x
i 1 +
x
i
( )
f 1 f 2 +
2
-----------------
,
_
+ =
H
1
k H ( ) = H
1
1.4- Boundary Layer Model
36
can not be computed for H < 1.1, and H can not be computed for , so that tests
have to be included in the Runge-Kutta procedure.
Turbulent separation really corresponds to the case when approaches 3.3, and H increases
rapidly. A typical value for H at separation often presented in the literature (see for instance
[7] and [9]) is H = 2.4. This can be used as a separation criterion, since H increases very
rapidly close to separation anyway. In our case, we use the criterion .
1.4.4- Computation of the Drag Coefcient
The Squire-Young formula [8] provides a means of predicting the prole drag by relating the
momentum defect far downstream to the values of the ow eld given at the trailing edge.
Given the dimensionless momentum thickness , shape factor H and dimensionless velocity
at the trailing edge on the upper and lower sides, the drag is found from :
This formula gives directly the total prole drag (i.e. the sum of pressure drag and friction
drag) as a function of the values of Ue, , and H at the trailing edge, computed from both
sides of the airfoil. It is thus particularly well suited for one-way coupled methods, in which
the computation of the pressure drag is not possible because the inviscid ow is not
inuenced by the effect of the boundary layer.
1.4.5- Special Characteristics
The effect of the boundary layer on the inviscid ow is especially important near the trailing
edge, where it reduces the adverse pressure gradient. This can be seen on the following
gure, which presents results obtained using Xfoil (the solid line is the viscous Cp distri-
bution, the dashed line is the inviscid solution).
H
1
H
1
3.3 <
H
1
H
1
3.3 =

U
e
C
d
2
TE
U
e
( )
TE
H
TE
5 +
2
-------------------

UP
2
TE
U
e
( )
TE
H
TE
5 +
2
-------------------

LOW
+ =

1- The Aerodynamic Solver


37
In our case, the external velocity is not modied by the presence of the boundary layer, and
we 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 percents of
the chord length : even on a NACA 0012 at zero angle of attack with a Reynolds number of
1e6, turbulent separation takes place. The drag coefcient can not be computed in such a
case because the computation of the turbulent boundary layer can not be carried on after
separation.
The solution to this problem consists in not solving the boundary layer up to the trailing
edge, but up to % of the chord length. Separation of the boundary layer which was
happening in the last percents of the chord is thus avoided, and the Squire-Young formula
still 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 without
any turbulent separation. It should not be too small though, because then a big part of the
information 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 side,
NACA 4412 at and Re = 1e6 : turbulent separation at 98.98% on the upper side,
NACA 4812 at and Re = 1e6 : turbulent separation at 98.11% on the upper side,
NACA 6812 at and Re = 1e6 : turbulent separation at 97.85% on the upper side.
It appears that a reasonable value of is 98%. This means that we do not consider the
boundary layer on the last 2% of the chord length, and that the Squire-Young formula is
applied not at the trailing edge, but at 98% of the chord on the upper and lower surfaces.
1.4.6- Validation of the Boundary Layer Model
First, the accuracy of the solver is tested. The drag coefcient of a NACA 4412 airfoil at zero
angle of attack and Re=1e6 is computed with 50, 100, 200, 400 and 800 grid points for the
boundary layers.
The result is a clear convergence, as can be seen on this gure.
C
off
C
off
0 =
0 =
5 =
5 =
0 =
C
off
1.4- Boundary Layer Model
38
Then, the results are compared to results provided by Xfoil. The drag coefcient computed
by the two programs are compared in several test cases. Each test case shows the sensitivity
of 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 ow models are different. Xfoils can handle thin separated ow regions,
while Heads model cannot.
The couplings between the boundary layer and the inviscid ow are different. In Xfoil, it
is performed in two ways, while in PMBL, only one-way coupling is modelled.
The drag coefcient computation is different. In Xfoil the drag estimate includes the
integration of the pressure distribution and of the boundary layer friction, while PMBL
uses the Squire-Young formula.
The graphs show that the drag coefcient computed by PMBL is higher than Xfoils
solution. This might be a characteristic of one-way coupled methods, since results computed
with Panda behave the same. However, the sensitivity of the results with respect to the design
parameters is well reproduced, which makes PMBL an appropriate solver for optimization.
The main difference is seen on the graph of the solution as a function of the maximum
camber location, where the position of the minimum is not the same.
1- The Aerodynamic Solver
39
2- Automatic Differentiation
Automatic differentiation (AD) is a technique for augmenting computer programs with the
computation of derivatives based on the chain rule of differential calculus. In this section,
the method is presented. Then ADMAT, a toolbox for automatic differentiation of Matlab
functions, is introduced and used to produce the derivatives of the aerodynamic coefcients.
2.1- Introduction
The methods employed for the solution of many scientic computing problems require the
evaluation of derivatives of some functions. Probably best known are gradient methods for
optimization, Newtons method for the solution of non-linear problems, and the numerical
solution of stiff differential equations.
In the context of optimization for instance, given a function f : , one can nd a
minimizer of f using variable metric methods that involve the iteration :
For suitable step multipliers . is the gradient of f at a particular point x, and
is a positive denite approximation to the Hessian of f.
In many cases, the function f is not represented in closed form, but in the form of a computer
program. For purpose of illustration, we assume that f : and that we wish to
compute the derivatives of y with respect to x. We call x the input variable, and y the output
variable. There are four approaches to computing derivatives.
By Hand : One can differentiate the code by hand and thus arrive at a code that also
computes derivatives. However, handcoding of derivatives for a large code is a difcult and
error-prone process, especially as the problem complexity increases. It is liable to be a
considerable amount of work in comparison with the development of the original code,
although it is likely to result in the most efcient code.
Finite Differences : The derivative of f with respect to the ith component of x at a particular
point is approximated by either :
One-Sided Differences :
or Central Differences :
where is the ith cartesian basis vector.
R
n
R
x

while not converged do


Solve B
i
s
i
f x
i
( ) =
x
i 1 +
x
i

i
s
i
+ =
end do

i
0 > f x ( ) B
i
x R
n
y R
x
o
x
i

f x
0
( )
f x
0
h e
i
t ( ) f x
0
( )
h t
-------------------------------------------------
x
i

f x
0
( )
f x
0
h e
i
+ ( ) f x
0
h e
i
( )
2h
-----------------------------------------------------------------
e
i
40
Computing derivatives by divided differences has the advantage that we need only the
function as a "black box". The main drawback is that their accuracy is hard to assess. A small
step size h is needed to minimize the truncation error resulting from the omission of higher -
order terms for properly approximating derivatives, yet may lead to numerical cancellation
and the loss of many digits of accuracy. In addition, different scales of the s may require
different step sizes for the various independent variables.
Symbolic Differentiation : This functionality is provided by symbolic packages such as
Maple or Mathematica. Given a string describing the denition of a function, symbolic
manipulation packages provide exact derivatives, expressing the derivatives in terms of the
intermediate variables. Symbolic differentiation is a powerful technique, but it may not
derive good computational recipes, and it may run into resource limitation when the function
description is complicated. Moreover, functions involving branches or loops cannot be
readily handled by symbolic differentiation.
Automatic Differentiation (AD) : AD techniques rely on the fact that every function, no
matter how complicated, is executed on a computer as a (potentially very long) sequence of
operations such as additions, multiplications, and elementary functions such as sin and cos,
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 compute
derivatives of f exactly, and in a completely mechanical fashion. By applying the chain rule
step by step to the elementary operations executed in the course of computing the function,
AD computes exact derivatives (up to machine precision, of course), and avoids the potential
pitfalls of divided differences. The technique of automatic differentiation is directly
applicable to functions with branches and loops. We also note that, unlike handcoding or
symbolic assisted approaches, automatic differentiation enables derivatives to be updated
easily when the original code changes.
2.2- Method Fundamentals
We consider the case of a function f : , of n variables which we will call
input variables. The case of a function with several results f : will be treated as an
extension of this case.
The function is represented by a computer program, which for the input of
returns y = f(x). We want to generate a program which will also return the value of ,
i.e. all the rst order partial derivatives .
Original program
We start by considering the general form of a program to compute , using N
intermediate variables .
x
i
x

f g x ( ) ( )
x x
0
=
s

f s ( )
s g x
0
( ) =
,
_
x

g x ( )
x x
0
=
,
_
=
R
n
R x
1
x
n
, ,
R
n
R
m

x x
1
x
n
, , ( ) =
f x ( )
f x
1
x ( ) f x
n
x ( ) , ,
f x
1
x
n
, , ( )
x
n 1 +
x
N
, ,
2- Automatic Differentiation
41
The simplest thing is to consider that at each statement, a new intermediate variable is
introduced, and that its value is computed using the previously introduced variables. In this
context, 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 variables),
and uses N-n statements.
Usually, the intermediate functions do not depend on all the previously computed
variables : there is a set such that , where
. 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 variables
that are redened several times, which is impossible here. Since the explanation become
more complex if we want to account for this case, and since a program which such
redenition of variables can easily be turned into a program without any, we consider the
program above as general enough for our point.
The intermediate functions
An intermediate function can be anything, from elementary functions (+, -, *, /, sin, cos, ...)
to some higher-level functions such as the multiplication of two matrices, or the resolution of
a linear system of equations. It can actually be any sub-program y = f(x).
So, the choice of the intermediate functions is open, and depends on the implementation. We
will 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 method
computes derivatives alongside the evaluation of the function itself, and propagates the
derivatives using the chain rule. So when the function evaluation has completed, the
derivatives of the results have also been calculated.
We denote by , i = 1, ..., N the gradient of with respect to the input variables. We have
of course for i = 1, ..., n where is the ith cartesian basis vector.
For i = n+1, ..., N, the denition of and the chain rule give :
The forward mode consists in performing this kind of computation for each statement of the
original code.
x
i

i
x
1
x
i 1
, , ( ) =
f x
N
=

i
P
i
1 2 i 1 , , , { } x
i

i
x
P
i
( ) =
x
P
i
x
j
j P
i
, { } =
x
i

i
x
P
i
( ) =
f x
N
=
x
i
x
i
x
i
e
i
= e
i
x
i
x
i

x
j

--------x
j
j P
i

=
2.2- Method Fundamentals
42
Applying this to our programs leads to :
For i = 1 to n, do
For i = n+1 to N, do {
}
This program evaluates both functions and gradients simultaneously, each assignment to an
intermediate quantity being simply augmented by the calculation of its gradient. Therefore,
the forward mode increases the number of operations by a factor proportional to n (number
of input variables).
Reverse mode
This technique is based on a not as obvious way of using the chain rule. The rst step of the
method is to evaluate the function itself while storing information about intermediate values.
When the evaluation is done, the derivatives are calculated by traversing the recording in
reverse order, propagating derivatives of the result with respect to the intermediate variables
down to the initial values. Because of the recording and the reverse propagation, this method
is also the most difcult to program on a computer.
We associate with each intermediate variable , the derivative :
By denition, we have , and .
As a consequence of the chain rule applied to an elementary statement of our program
, these adjoint quantities satisfy the relation :
,
Or : , where
Thus, we can see that can be computed once all with are known. In terms of the
program structure, it is slightly more convenient to increment all with for a known
i by the appropriate contribution .
x
i
e
i
=
x
i

i
x
P
i
( ) =
x
i

x
j

--------x
j
j P
i

=
f x
N
=
f x
N
=
x
i
x
i
x
i

f
=
x
N
1 = f x
i
( )
i 1 n , , =
=
x
i

i
x
P
i
( ) =
f
x
j

-------

i

x
j

--------
f
x
i

-------
i Q
j

=
x
j

x
j

--------x
i
i Q
j

= Q
j
i N j P
i
; { } =
x
j
x
i
i j >
x
j
j P
i

x
i

i
x
j

2- Automatic Differentiation
43
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 rst step, and computes all the adjoints including
the components of the gradient in the second step. In this case, the increase in the number of
operations is independent of n, and an estimation of an upper bound of 5 for the increase in
work can be found in [16].
Extension to f :
We consider the function given by the following program :
For i = n+1 to N, do
,
where the m results are the m last variables of the program. We are looking for the Jacobian
matrix J, which (i,j) term is :
.
Using the forward mode, the application is straight-forward. Row i of J is nothing but the
gradient of component i of f, . We have the same relative computation cost
as in the scalar case, the increase in the number of operations is n.
Using the reverse mode, we have exactly the same algorithm as in the scalar value function
case. The difference is that the adjoint associated with each intermediate variable is now a
vector with m components. Component p of this vector is the derivative of the elementary
variable with respect to results p, p = 1, ..., m. Therefore, the reverse mode increases the
number of operations by a factor proportional to m.
x
i

i
x
P
i
( ) =
f x
N
=
x
i
0 =
x
N
0 =
x
j
x
j

i
x
j
x
i
+ = j P
i

x
i

f
x
i
=
R
n
R
m

x
i

i
x
P
i
( ) =
f
f
1

f
m
,



_
x
N m 1 +

x
N
,



_
= =
J
ij
f
i

x
j

------- =
f
i
x
N m i +
=
2.2- Method Fundamentals
44
2.3- Computer Implementation
AD can be seen as a particular semantic transformation problem : given a code for
computing a function, we would like to generate a code that computes the derivatives of that
function. To affect this transformation, two approaches can be employed.
Operator Overloading : Modern computer languages like C++ or Fortran 90, and Matlab
(version 5.0 and above), make it possible to redene the meaning of elementary operators.
That is, we can for example dene a type for oating point numbers that have gradient
objects associated with them (lets call them adouble, say), and for each elementary
operation such as multiplication, we can dene the meaning of the operator * for variables
of type adouble. If we dene the usual product rule ( ), then
each occurence of a multiplication of two variables of type adouble in the code will also
effect the update of the associated derivatives in a transparent fashion.
Tools using this implementation include ADOL-C for algorithms written in C/C++, and
ADMAT for algorithms written in Matlab.
Source transformation : Another way is to rewrite the code explicitly. This is what we have
done to explain how AD works in the previous section. For example, the assignment z = xy is
rewritten into a piece of code that not only contains the computation of z, but also an
implementation 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 includes
ADOL-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 nonlinear maps
dened via M-les. This is the rst ever AD tool written for differentiating M-les. It
belongs to the operator overloading class of AD tools, and uses the Object Oriented
Programming feature present in MATLAB 5 for implementation. A direct consequence of
this 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 bottom
layers. The core of the toolbox is the class deriv, which is the basic forward mode computing
engine. The layer above deriv contains the class derivtape, the basic reverse mode computing
engine, and the topmost layer is concerned with the computation of second order derivatives
and consists of the class derivtapeH for computing the Hessian of a function.
z xy z xy yx + = =
z xy yx + =
2- Automatic Differentiation
45
Implementation of the forward mode : class deriv
deriv is an extension of double (Matlab oating point numbers belong to class double). A
deriv object has two elds, val and deriv, which stand for the value of the variable and its
derivative. In the AD mode, the function computation is carried out with deriv variables,
causing all the operations to be used in the overloaded mode, thus invoking the rules which
update the derivative of the output along with the value.
The constructor is used as follows : y = deriv(x,V). It constructs a deriv object y with the
given derivative V. Here is a simplied version of the code for the constructor (the
simplication consists in not reporting all tests on the dimensions of s1, s2 and sout and
consequent 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 modied, we present the simplied functions for addition,
cosinus, and exponential of a deriv 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 the deriv class to compute the Jacobian of a
Matlab function y = fun(x). The steps are :
Dene the input point : x = ones(N,1);
Initialise the Jacobian of x : xdot = eye(N);
Make x belong to the deriv 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 a tape, which records all the intermediate
values and operations performed in the function evaluation. Computation of adjoints is then
done in a reverse pass on the tape, and at the end of the pass the adjoints of the input
variables are picked up from the front of the tape.
2.4- ADMAT, Automatic Differentiation Toolbox for MATLAB
46
The tape is generated by the methods of class derivtape. derivtape objects have two elds,
val which contains the value of the variable and counter, a unique counter which serves as an
index to the tape. Every Matlab operation is overloaded to update the value, and record the
operation onto the tape.
Here is the constructor of class derivtape :
function s= derivtape(a)
global tape;
global varcounter;
s.val=a;
s.varcount=varcounter;
s=class(s,derivtape);
To illustrate how the operators are modied, we present the functions for the addition,
cosinus, and exponential of a derivtape 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, function savetape is used to record the operator, the value of the function,
and the index of the operands of the elementary operation in the object tape(varcounter).
Then the computation of the adjoints is performed by function parsetape. This function
processes the tape backwards, and, at each step, invokes a function to compute the adjoint
corresponding to the operator involved.
To illustrate how the adjoints of the operators are computed and propagated, we present the
simplied functions for the addition, cosinus, and exponential.
function adjplus(i)
global tape
if (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;
else
tape(tape(i).arg1vc).W=tape(tape(i).arg1vc).W+tape(i).W;
end
2- Automatic Differentiation
47
function adjcos(i)
global tape
tape(tape(i).arg1vc).W=tape(tape(i).arg1vc).W-sin(tape(tape(i).arg1vc).val).*tape(i).W;
function adjexp(i)
global tape
tape(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 the derivtape class and the parsetape
function to compute the Jacobian of a Matlab scalar value function y = fun(x). The steps are :
Dene the input point : x = ones(N,1);
Make x belong to the derivtape 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).W);
Computation of the Hessian : class derivtapeH and function parsetape
ComputingtheHessianmatrixof f(x) combinestheforwardandreversemodes. Werst compute
using the forward mode, and then by reverse mode, since w has
fewer number of variables than x.
Then :
Thus the derivtapeH object has the two same elds as the deriv class, val and deriv, except
that they are themselves instances of the derivtape class. This way the value of the function
as well as its gradient are computed and recorded on the tape. Here is the simplied version
of the constructor of class derivtapeH :
function s= derivtapeH(a,V)
a = derivtape(a);
s.val=a;
s.deriv=derivtape(V);
s=class(s,derivtapeH);
The operators on derivtapeH variables are the same as those of class deriv, they compute and
propagate the forward mode derivative of the results.
The following example illustrates the way to use the derivtapeH class and the parsetape
function to compute the Hessian of a Matlab scalar value function y = fun(x). The steps are :
Dene the input point : x = ones(N,1);
Initialise the Jacobian of x : xdot = eye(N);
Make x belong to the derivtapeH class : x = derivtape(x, xdot);
Forward mode : compute the function and the derivatives and create the tape : y = fun(x);
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

2
f
d f ( )
T
dx
------------------
,
_
T
=
2.4- ADMAT, Automatic Differentiation Toolbox for MATLAB
48
Elementary operations
All arithmetic operations, as well as the comparison and assignment operators, are
overloaded so that any or all of their operands can be an active variable. This means around
120 functions.
Matlab features some high-level operators, such as matrix matrix product, or the solution of
a linear system of equation. Thinking about AD in terms of high-level matrix vector
operations as opposed to the scalar level operations has a lot of advantages, for example it
saves the storage of the intermediate variables in the reverse mode, where you only have to
save the high level vectors instead. A lot of discussion on this subject, and more details on
high-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 operations are
handled 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 the lift,
moment and drag coefcients. The three quantities are computed by one Matlab program
which is introduced. The accuracy and running time of the computation of the derivatives are
then tested on several cases.
Note : The application of ADMAT to the aerodynamic solver has not been straight-forward,
because the toolbox was not bug-free. The correction of around 30 bugs has made the
differentiation 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 as in the
NACA notation), and the angle of attack. The computations are performed at a constant
Reynolds number equal to 1e6. The number of panels for the inviscid ow solution and the
number of grid points in the boundary layer are also specied, but as constant parameters.
The solution for a NACA 4512 at 3 degrees angle of attack using 100 panels and 200 grid
points for the boundary layer is thus computed by invoking : solver([4;5;12;3],[100;200]);
Operation Gradient Adjoints
,
,
,
,
,
z x
T
y = z y
T
x x
T
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 Ax + = x A
T
y = A yx
T
=
y A\x = y A\ x Ay ( ) =
x A
T
\y = A A
T
\y ( )y
T
=
2- Automatic Differentiation
49
The program procedure is shown on the following gure :
2.5.2- Accuracy
The analytic derivatives computed by automatic differentiation are compared to central nite
differences derivatives with a step size h = 1e-4. The test case is a NACA 4412 at
with 100 panels and 200 grid points for the boundary layer.
We have three results, Cl, Cm and Cd, which are noted , and respectively, and four
parameters, maximum camber, maximum camber location, maximum thickness, and angle
of 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 differentiation
and the Jacobian computed by finite differences is :
1.00000000010672 1.00000000024421 0.99999998912999 0.99999999998496
1.00000000042880 1.00000000040818 0.99999995238333 1.00000000013184
1.00000000670311 1.00000026823053 1.00000000787586 1.00000632378303
This proves that automatic differentiation of the program has been well performed. It also
shows that computing the derivatives by central nite differences, thus considering the solver
program 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 derivatives by
automatic differentiation and nite differences. Since automatic differentiation compute both
the function and the derivatives at the same time, the time performance of AD will be
compared to the time it takes to compute the derivatives by nite differences and the
function.
Shape Parameters
Airfoil Shape
Inviscid Flow
Boundary Layer
Squire Young Formula
Velocity
and
Pressure Distribution
Angle of Attack
C
L
C
m
C
d
0 =
f
1
f
2
f
3
p
1
p
2
p
3
p
4
J
ij
f
i

p
j

------- =
2.5- Application of ADMAT to the Aerodynamic Solver
50
Forward mode
The computation of the aerodynamic coefcients and their derivatives is performed on two
different problem sizes : 50 and 100 panels, and 100 and 200 grid points for the boundary
layer. 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 slower
than computing them by central nite differences.
In section 2.2, we saw that the forward mode increases the number of operations of the
function computation by a factor proportional to the number of input variables. For the (50
and 100) case, one function computation takes 0.42 s, and for the (100 and 200) case, 0.86 s.
An approximate value for the proportion factor in our case can thus be given : around 14.
Reverse mode
The reverse mode is extremely slow because recording all the elementary operations takes a
very long time. For our test case, with only 10 panels and 50 grid points for the boundary
layer, the size of the tape is 18060. The following table shows the CPU times for the
computation of the derivatives.
Since the size of the tape is a priori unknown, it is reallocated through the recording at each
new elementary operation. By allocating the tape at the beginning of the program, the time
required 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 instance, the
differentiation 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 work for
the aerodynamic solver. Because of time constraints, the problems within the derivtapeH
operators have not been xed.
0 =
time AD (s) time FD (s)
50 and 100
100 and 200
ratio AD/FD
24.46
3.79
7.77 47.35
6.45
6.15
time AD (s) time FD (s) ratio AD/FD
739.67
1.74 425
2- Automatic Differentiation
51
3- Airfoil Shape Optimization
The solver is used to perform airfoil design. Sample optimization problems are formulated,
and solved using the Matlab optimization toolbox [20].
3.1- Denition of the Optimization Problems
We consider the airfoil as a section of the main wing of a low speed aircraft. We have three
shape parameters : maximum camber, maximum camber location, and maximum thickness.
The ow angle of attack can also be considered a parameter since it is possible to design the
airplane so that the wing has a non zero incidence angle when the aircraft is in cruise
conditions.
We are interested in three results : lift, moment, and drag coefcients. They represent the
aerodynamic loads applied to the airfoil, the actual loads being given by :
where S is the airfoils planform area, and c is the airfoils chord length. Planform area is the
area of a projection of the airfoils shape onto a horizontal surface beneath it, similar to the
airfoils shadow when the sun is directly overhead.
The lift must be large enough in order to allow the aircraft to y by compensating its
weight,
The pitching moment of the main wing must not be too large, because for the equilibrium
of 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 aircraft
performance.
L C
l
1
2
-- -U

2
S =
D C
d
1
2
-- -U

2
S =
M C
m
1
2
---U

2
Sc =
Lift L
Drag D
Pitching Moment M
U

52
Two different design problems are derived depending on the ight conditions. During take-
off and landing, the crucial issue is to have a high lift coefcient, since the aircraft has to be
ying 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 drag of
the 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 variety of
airfoils. For simplicity, the Reynolds number is taken to be equal to 1e6 in all cases.
For both problems, the maximum negative value of Cm is chosen to correspond to the
solution of the NACA 4812 airfoil at zero angle of attack : ,
For problem (15), the maximum value of Cd is chosen to correspond to the solution of the
NACA 0015 airfoil at zero angle of attack : ,
And nally for problem (16), the minimum value of Cl is chosen to correspond to the
solution of the NACA 5412 airfoil at zero angle of attack : .
The solutions for the airfoils above are presented in the following gures.
C
m
0 23 ,
C
d
0 0070 ,
C
l
0 65 ,
3- Airfoil Shape Optimization
53
For both optimization problems, we also have to add bounds on the parameters themselves,
so that the optimization is performed in a space of reasonable airfoils. We choose the
following minimum and maximum values :
The solver uses the same scaling of the variables as the NACA 4 digits notation (see 1.2).
3.2- Solving the Optimization Problems
The Matlab Optimization Toolbox [20] is used. For non linear inequality constrained
problems like ours, it uses a Sequential Quadratic Programming algorithm with a BFGS
update of the Hessian matrix and a linesearch method. The quadratic subproblems are solved
with a modied projection method.
The exact Hessian information is not used, and thus the only analytic derivatives provided by
the solver are the gradients of Cl, Cm and Cd. They are computed using the forward mode of
automatic differentiation. In order to see the differences, all the optimization problems are
also solved with nite difference derivatives, with a constant step size h=0.0001.
Two different initial points are chosen for the optimization : the symmetric NACA 0016, and
the cambered NACA 4416, both considered at zero angle of attack. The initial points
solutions are presented on the two following gures.
Maximization of the lift coefcient 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
C
m
0 23 , C
d
0 0070 ,
3.2- Solving the Optimization Problems
54
With NACA 0016 as initial point, we obtain the following convergence of Cl :
And starting from NACA 4416 :
All converge to the same optimizer. More iterations are used starting from NACA 4416,
because cases with turbulent separation, where the results are not accurate, are obtained
along the optimization process. In both cases, the use of AD derivatives provides a faster
convergence, which was expected theoretically.
The optimal airfoil shape and solution are shown on the following gure.
3- Airfoil Shape Optimization
55
At the optimal solution, the constraints on the pitching moment and on the drag are both
active, which means that they are both useful. The large lift is obtained by strong camber,
located approximately at the middle of the chord. The thickness, which has a greater
negative effect on the drag than positive effect on the lift, is equal to its minimum value.
Observe that the pressure distribution is very smooth.
Maximization of the lift coefcient considering the angle of attack as a parameter
The point is to determine what happens when the angle of attack can be modied. In order to
avoid cases with separation of the turbulent boundary layer, which can not be handled by the
solver, the upper bound we use on is not very large (3 degrees).
Starting from NACA 0016 at =0, we obtain the following convergence of Cl :
And starting from NACA 4416 at =0 :
All converge to the same optimizer, and the use of analytic derivatives gives a faster
convergence.

3.2- Solving the Optimization Problems


56
The optimal solution is presented on the following gure.
Compared with the previous case, when the angle of attack was kept constant and equal to
zero, the result here is a higher lift coefcient. The optimal airfoil has a little less camber, but
located 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, and the
consequent increase in drag is compensated by a smaller amount of camber. Observe that the
boundary layer is fully laminar on the lower side, which contributes to a low drag.
Minimization of the drag coefcient 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 objective
function Cd :
C
m
0 23 , C
l
0 65 ,
3- Airfoil Shape Optimization
57
And starting from NACA 4416 :
Starting from NACA 0016, and using nite differences derivatives, we do not manage to
reach the same optimum as the three other cases.
We also note that with both initial points, convergence is slower with the use of analytic
derivatives. This can be explained by the fact that the variable is obviously crawling along
the boundary. It is possible that the lack of precision of the nite differences derivatives helps
in making the optimization procedure actually violating the constraint without realizing it,
and thus go faster to the optimum.
The optimal airfoil shape and solution are shown on the following gure.
The resulting shape is very different from the solution of the previous optimization problem.
The thickness is equal to its minimum value, which gives a low drag. The lift is obtained
thanks to a small amount of camber, located completely rearward. This rearward location of
the camber is also a factor of low drag ; remember the sensitivity curves seen in 1.4.6.
Observe that the constraint on the pitching moment is inactive this time.
3.2- Solving the Optimization Problems
58
Mimimisation of the drag coefcient 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 of Cd :
And starting from NACA 4416 at =0 :
All four procedures converge to the same optimizer, and the use of AD derivatives gives a
faster convergence.

3- Airfoil Shape Optimization


59
The optimal solution is presented on the following gure.
Compared with the previous case, when the angle of attack was kept constant and equal to
zero, the result here is a lower drag coefcient. The optimal airfoil has a little less camber,
but it is located at the same place, and it has the same thickness as in the previous case.
The angle of attack is equal to 0.65 degrees, which gives some more lift, so that less camber
can 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 modication of the
optimal 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 from the
minimization of the drag problem is less stable. The suction peak present at the rear of the
chord is a factor of separation of the turbulent boundary layer, which gives a large increase of
the drag.
3.2- Solving the Optimization Problems
61
Conclusion
The three main parts of the project, development of an aerodynamic solver, computation of
analytic derivatives, and exercises of airfoil shape optimization have been presented in detail.
The resulting optimization tool has proven to be a useful airfoil design system, and could be
used to solve a real optimization problem. The principal conditions are that the airfoil shape
be dened analytically, and that the solution does not correspond to a case with separation of
the turbulent boundary layer.
An improvement to the solver method is possible, by modelling a full coupling between the
external ow and the boundary layer, as done in Xfoil. This was envisionned at one point,
but not realized because of time constraints.
Automatic differentiation has been performed on the aerodynamic solver using the forward
and the reverse mode. It has been demonstrated to provide accurate derivatives, but at a large
time 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 modifying the
Matlab optimization toolbox so that it uses the Hessian provided by automatic differentiation
instead of a BFGS update.
63
References
[1] I.H. Abbott and A.E. Von Doenhoff : Theory of Wing Sections. Dover Publications Inc,
New York, 1959.
[2] J. Katz and A. Plotkin : Low Speed Aerodynamics, From Wing Theory to Panel
Methods. 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. Hemisphere
Publishing Corporation 1977.
[5] W.C. Reynolds and T. Cebeci : Calculation of Turbulent Flows. In Turbulence, P.
Bradshaw, ed., Springer-Verlag, Topics in Applied Physics Series, Vol. 12, 1978.
[6] J. Moran : An Introduction to Theoretical and Computational Aerodynamics. John
Wiley 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 Prole 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. Desktop
Aeronautics, Stanford, 1988. Available on www.desktopaero.com.
[10] M. Drela and M. B. Giles : Viscous-Inviscid Analysis of Transonic and Low Reynolds
Number Airfoils. AIAA Journal, 25 (10), Oct. 1987.
[11] M. Drela : Two-Dimensional Transonic Aerodynamic Design and Analysis using the
Euler Equations. PhD Thesis. MIT, Gas Turbine Laboratory Rept. 187, Feb. 1986
[12] M. Drela : Xfoil : An Analysis and Design System for Low Reynolds Number Airfoils.
Low Reynolds Number Aerodynamics, Springer-Verlag, Lec. Notes in Eng. 54, 1989.
[13] H. Youngren and M. Drela : Viscous / Inviscid Method for Preliminary Design of
Transonic Cascades, MIT, Department of Aeronautics and Astronautics, 1991.
[14] E.G.M Coenen : Computational Techniques for Viscous-Inviscid Boundary Layer
Interaction. KTH, Dept. of Aeronautics, Stockholm, 1996.
[15] R. Michel : Etude de la Transition sur les Proles dAiles, Onera Report 1/1578A,
1951.
[16] A. Griewank : On Automatic Differentiation, In Mathematical Programming : Recents
Developments and Applications, M. Iri and K. Tanabe, eds., Kluwer Academic
Publishers, Dordrecht, 1991.
[17] D. Juedes : A Taxonomy of Automatic Differentiation Tools, in Automatic
Differentiation of Algorithms : Theory, Implementations and Applications, A.
Griewank and G. F. Corliss, eds., SIAM, Philadelphia, Penn., 1991.
[18] A. Verma, Structured Automatic Differentiation, PhD Thesis, Cornell University, 1998.
[19] T. F. Coleman and A. Verma : ADMAT : An Automatic Differentiation Toolbox for
MATLAB, Technical report, Cornell University Theory Center, 1998.
[20] Matlab Optimization Toolbox 2.0, User Guide and Theory Document. Available at
http://www.mathworks.com/access/helpdesk/help/pdf_doc/optim/optim_tb.pdf

You might also like