discrete adjoint approach to cfd-based shape...

40
Discrete adjoint approach to CFD-based shape optimization Praveen. C [email protected] Tata Institute of Fundamental Research Center for Applicable Mathematics Bangalore 560065 http://math.tifrbng.res.in Indo-German Conference on PDE, Sc. Comp. and Opt. in Appl. IIT Kanpur 7-9 October, 2009 Praveen. C (TIFR-CAM) Shape Optimization IITK, Oct 2009 1 / 40

Upload: others

Post on 20-Aug-2020

1 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Discrete adjoint approach to CFD-based shape …math.tifrbng.res.in/~praveen/slides/iitkan-oct2009.pdfIterative convergence tests Primal residual Adjoint residual Rn= jjR(Qn)jj Rn=

Discrete adjoint approach to CFD-based shapeoptimization

Praveen. [email protected]

Tata Institute of Fundamental ResearchCenter for Applicable Mathematics

Bangalore 560065http://math.tifrbng.res.in

Indo-German Conference onPDE, Sc. Comp. and Opt. in Appl.

IIT Kanpur7-9 October, 2009

Praveen. C (TIFR-CAM) Shape Optimization IITK, Oct 2009 1 / 40

Page 2: Discrete adjoint approach to CFD-based shape …math.tifrbng.res.in/~praveen/slides/iitkan-oct2009.pdfIterative convergence tests Primal residual Adjoint residual Rn= jjR(Qn)jj Rn=

Objectives and controls

• Objective function I(β)mathematical representation of system performance

I(β) = I(β,Q(β))

• Control variables β

β represents the shape

• State variable Q: solution of an ODE or PDE

R(β,Q) = 0 =⇒ Q = Q(β)

Praveen. C (TIFR-CAM) Shape Optimization IITK, Oct 2009 2 / 40

Page 3: Discrete adjoint approach to CFD-based shape …math.tifrbng.res.in/~praveen/slides/iitkan-oct2009.pdfIterative convergence tests Primal residual Adjoint residual Rn= jjR(Qn)jj Rn=

Example: Aerodynamics

http://www.aviation-history.com

Lift = WeightDrag = Thrust

minβD(β), such that L(β) = W

Praveen. C (TIFR-CAM) Shape Optimization IITK, Oct 2009 3 / 40

Page 4: Discrete adjoint approach to CFD-based shape …math.tifrbng.res.in/~praveen/slides/iitkan-oct2009.pdfIterative convergence tests Primal residual Adjoint residual Rn= jjR(Qn)jj Rn=

Gradient-based minimization

minβ∈RN

I(β,Q(β))

• Initialize β0, n = 0• For n = 0, . . . , Niter

I Solve R(βn, Qn) = 0I For j = 1, . . . , N

βn(j) = [βn1 , . . . , βnj + ∆βj , . . . , β

nN ]>

Solve R(βn(j), Qn(j)) = 0

dIdβj

≈I(βn

(j),Qn(j))−I(βn,Qn)

∆βj

I Steepest descent step

βn+1 = βn − sn dI

dβ(βn)

Cost of FD-based steepest-descent

Cost = O(N + 1)Niter = O(N + 1)O(N) = O(N2)Praveen. C (TIFR-CAM) Shape Optimization IITK, Oct 2009 4 / 40

Page 5: Discrete adjoint approach to CFD-based shape …math.tifrbng.res.in/~praveen/slides/iitkan-oct2009.pdfIterative convergence tests Primal residual Adjoint residual Rn= jjR(Qn)jj Rn=

Elements of shape optimization

1 Shape parameterization2 Surface grid generation/deformation3 Domain grid generation/deformation4 Flow solution (Euler/Navier-Stokes solver)5 Adjoint flow solution6 Optimization method

Shape parametersβ

Surface gridXs

Volume grid

XCFD solution

Q I

dI

dβ=

dI

dXdXdXs

dXs

Praveen. C (TIFR-CAM) Shape Optimization IITK, Oct 2009 5 / 40

Page 6: Discrete adjoint approach to CFD-based shape …math.tifrbng.res.in/~praveen/slides/iitkan-oct2009.pdfIterative convergence tests Primal residual Adjoint residual Rn= jjR(Qn)jj Rn=

Adjoint approach: dIdX

• For shape optimization: I = I(X,Q)

dI

dX=

∂I

∂X+∂I

∂Q

∂Q

∂X

• Differentiate state equation R(X,Q) = 0

∂R

∂X+∂R

∂Q

∂Q

∂X= 0

• Flow sensitivity ∂Q∂X ; costly to evaluate

• Introducing an adjoint variable Ψ, we can write

dI

dX=[∂I

∂X+∂I

∂Q

∂Q

∂X

]+ Ψ>

[∂R

∂X+∂R

∂Q

∂Q

∂X

]

Praveen. C (TIFR-CAM) Shape Optimization IITK, Oct 2009 6 / 40

Page 7: Discrete adjoint approach to CFD-based shape …math.tifrbng.res.in/~praveen/slides/iitkan-oct2009.pdfIterative convergence tests Primal residual Adjoint residual Rn= jjR(Qn)jj Rn=

Adjoint approach

• Collect terms involving the flow sensitivity

dI

dX=[∂I

∂X+ Ψ>

∂R

∂X

]+[∂I

∂Q+ Ψ>

∂R

∂Q

]∂Q

∂X

• Choose Ψ so that flow sensitivity vanishes

∂I

∂Q+ Ψ>

∂R

∂Q= 0 =⇒

(∂R

∂Q

)>Ψ +

(∂I

∂Q

)>= 0

• GradientdI

dX=

∂I

∂X+ Ψ>

∂R

∂X

Cost of AD-based steepest-descent

Cost = O(1)Niter = O(N)

Praveen. C (TIFR-CAM) Shape Optimization IITK, Oct 2009 7 / 40

Page 8: Discrete adjoint approach to CFD-based shape …math.tifrbng.res.in/~praveen/slides/iitkan-oct2009.pdfIterative convergence tests Primal residual Adjoint residual Rn= jjR(Qn)jj Rn=

Optimization steps

• β =⇒ Xs =⇒ X

• Solve the flow (primal) equations to steady-state

X =⇒ dQdt

+R(X,Q) = 0 =⇒ Q, I

• Solve adjoint equations to steady-state

X,Q =⇒ dΨdt

+(∂R

∂Q

)>Ψ +

(∂I

∂Q

)>= 0 =⇒ Ψ

• Compute gradient wrt grid X

dI

dX=

∂I

∂X+ Ψ>

∂R

∂X

dI

dβ=

dI

dXdXdXs

dXs

dβ=⇒ β ←− β − εdI

Praveen. C (TIFR-CAM) Shape Optimization IITK, Oct 2009 8 / 40

Page 9: Discrete adjoint approach to CFD-based shape …math.tifrbng.res.in/~praveen/slides/iitkan-oct2009.pdfIterative convergence tests Primal residual Adjoint residual Rn= jjR(Qn)jj Rn=

Continuous and discrete approaches

• Continuous approach (differentiate and discretize)PDE −→ Adjoint PDE −→ Discrete adjoint

• Discrete approach (discretize and differentiate)PDE −→ Discrete PDE −→ Discrete adjoint

• We use the discrete approachI R(X,Q) = 0 finite volume equations which are algebraic equationsI Use ordinary calculus to differentiateI Need to compute

∂I

∂Q,

∂I

∂X,

(∂R

∂Q

)>Ψ,

(∂R

∂X

)>Ψ

• Computer code available to compute

I(X,Q), R(X,Q)

Praveen. C (TIFR-CAM) Shape Optimization IITK, Oct 2009 9 / 40

Page 10: Discrete adjoint approach to CFD-based shape …math.tifrbng.res.in/~praveen/slides/iitkan-oct2009.pdfIterative convergence tests Primal residual Adjoint residual Rn= jjR(Qn)jj Rn=

Automatic differentiation

• Code is made of composition of elementary functions

X −→ Y = F (X)T0 = X

Tr = Fr(Tr−1)Y = F (X) = Fp ◦ Fp−1 ◦ . . . ◦ F1(T0)

• Use differentiation by parts formula: (X, X) −→ Y

Y = F ′(X)X = F ′p(Tp−1)F ′p−1(Tp−2) . . . F ′1(T0)X

• Automated using AD tools

Computer code

PAutomatic

DifferentiationNew code

P

• Note: Computation of Y goes from first line to last line of code

Praveen. C (TIFR-CAM) Shape Optimization IITK, Oct 2009 10 / 40

Page 11: Discrete adjoint approach to CFD-based shape …math.tifrbng.res.in/~praveen/slides/iitkan-oct2009.pdfIterative convergence tests Primal residual Adjoint residual Rn= jjR(Qn)jj Rn=

Reverse differentiation

• Reverse mode computes transpose: (X, Y ) −→ X

X = [F ′(X)]>Y = [F ′1(T0)]>[F ′2(T1)]> . . . [F ′p(Tp−1)]>Y

• Forward sweep and then reverse sweep

Func: T0 −→ F1T1−→ F2

T2−→ . . .Tp−1−→ Fp −→ F

Grad: Tp−1, Y −→ [F ′p]T Tp−2−→ [F ′p−1]T

Tp−3−→ . . .T0−→ [F ′1]T −→ X

Forward variables Tj required in reverse order: store or recompute• Reverse mode useful to compute(

∂I

∂Q

)>,

(∂I

∂X

)>,

(∂R

∂Q

)>Ψ,

(∂R

∂X

)>Ψ

Praveen. C (TIFR-CAM) Shape Optimization IITK, Oct 2009 11 / 40

Page 12: Discrete adjoint approach to CFD-based shape …math.tifrbng.res.in/~praveen/slides/iitkan-oct2009.pdfIterative convergence tests Primal residual Adjoint residual Rn= jjR(Qn)jj Rn=

Differentiation: Example

• A simple example

f = (xy + sinx+ 4)(3y2 + 6)

• Computer code, f = t10

t1 = x

t2 = y

t3 = t1t2

t4 = sin t1t5 = t3 + t4

t6 = t5 + 4t7 = t22

t8 = 3t7t9 = t8 + 6t10 = t6t9

Praveen. C (TIFR-CAM) Shape Optimization IITK, Oct 2009 12 / 40

Page 13: Discrete adjoint approach to CFD-based shape …math.tifrbng.res.in/~praveen/slides/iitkan-oct2009.pdfIterative convergence tests Primal residual Adjoint residual Rn= jjR(Qn)jj Rn=

F77 code: costfunc.f

subroutine costfunc(x, y, f) t1 = x t2 = y t3 = t1*t2 t4 = sin(t1) t5 = t3 + t4 t6 = t5 + 4 t7 = t2**2 t8 = 3.0*t7 t9 = t8 + 6.0 t10 = t6*t9 f = t10 end

Praveen. C (TIFR-CAM) Shape Optimization IITK, Oct 2009 13 / 40

Page 14: Discrete adjoint approach to CFD-based shape …math.tifrbng.res.in/~praveen/slides/iitkan-oct2009.pdfIterative convergence tests Primal residual Adjoint residual Rn= jjR(Qn)jj Rn=

AD Tool: TAPENADE

• TAPENADE: http://www-sop.inria.fr/tropics• Source transformation tool• Fortran and C• Free software• http://www.autodiff.org

Use of tapenade

$ tapenade -backward -vars "x y" -outvars "f" costfunc.fTapenade 3.1 (r2757) - 01/12/09 17:50 - Java 1.5.0_20 Mac OS XCommand: Took subroutine costfunc as default differentiation root.@@ Creating ./costfunc_b.f@@ Creating ./costfunc_b.msg

Praveen. C (TIFR-CAM) Shape Optimization IITK, Oct 2009 14 / 40

Page 15: Discrete adjoint approach to CFD-based shape …math.tifrbng.res.in/~praveen/slides/iitkan-oct2009.pdfIterative convergence tests Primal residual Adjoint residual Rn= jjR(Qn)jj Rn=

Automatic Differentiation: Reverse mode

SUBROUTINE COSTFUNC_B(x, xb, y, yb, f, fb) t1 = x t2 = y t3 = t1*t2 t4 = SIN(t1) t5 = t3 + t4 t6 = t5 + 4 t7 = t2**2 t8 = 3.0*t7 t9 = t8 + 6.0 t10b = fb t6b = t9*t10b t9b = t6*t10b t8b = t9b t7b = 3.0*t8b t5b = t6b t3b = t5b t2b = t1*t3b + 2*t2*t7b t4b = t5b t1b = t2*t3b + COS(t1)*t4b yb = t2b xb = t1b fb = 0.0 END

Z =[xy

]

Z =[xbyb

]=[∂f

∂Z

]>f

If f = 1, then

xb =∂f

∂x

yb =∂f

∂y

Praveen. C (TIFR-CAM) Shape Optimization IITK, Oct 2009 15 / 40

Page 16: Discrete adjoint approach to CFD-based shape …math.tifrbng.res.in/~praveen/slides/iitkan-oct2009.pdfIterative convergence tests Primal residual Adjoint residual Rn= jjR(Qn)jj Rn=

Implementation of AD (steady-state problems)

• Do not differentiate iterative schemes• CFD code written with many subroutines• Subroutines differentiated individually• Assembled together in reverse order to form adjoint solver• Only non-linear portions differentiated with AD

I numerical flux (Roe)I Limiters

• Linear portions differentiated manually• Automate using make utility• Leads to an efficient code with less memory requirements

Praveen. C (TIFR-CAM) Shape Optimization IITK, Oct 2009 16 / 40

Page 17: Discrete adjoint approach to CFD-based shape …math.tifrbng.res.in/~praveen/slides/iitkan-oct2009.pdfIterative convergence tests Primal residual Adjoint residual Rn= jjR(Qn)jj Rn=

Shape parameterization

• Parameterize thedeformations[xsys

]=

[x

(0)s

y(0)s

]+[nxny

]h(ξ)

h(ξ) =m∑k=1

βkBk(ξ)

• Hicks-Henne bump functions

Bk(ξ) = sinp(πξqk), qk =log(0.5)log(ξk)

• Move points along normal toreference line AB

A B

~n

ξ

0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 10

0.1

0.2

0.3

0.4

0.5

0.6

0.7

0.8

0.9

1

ξ

h(ξ)

Exact derivatives dXsdβ can be

computed

Praveen. C (TIFR-CAM) Shape Optimization IITK, Oct 2009 17 / 40

Page 18: Discrete adjoint approach to CFD-based shape …math.tifrbng.res.in/~praveen/slides/iitkan-oct2009.pdfIterative convergence tests Primal residual Adjoint residual Rn= jjR(Qn)jj Rn=

Grid deformation

• Interpolate displacement ofsurface points to interiorpoints using RBF

f(x, y) = a0 + a1x+ a2y +N∑j=1

bj |~r − ~rj |2 log |~r − ~rj |

where ~r = (x, y)

• Results in smooth grids• Exact derivatives dX

dXscan be

computed

Initial grid

Deformed grid

Praveen. C (TIFR-CAM) Shape Optimization IITK, Oct 2009 18 / 40

Page 19: Discrete adjoint approach to CFD-based shape …math.tifrbng.res.in/~praveen/slides/iitkan-oct2009.pdfIterative convergence tests Primal residual Adjoint residual Rn= jjR(Qn)jj Rn=

NUWTUN flow solver

Based on the ISAAC code of Joseph Morrisonhttp://isaac-cfd.sourceforge.net

• Finite volume scheme• Structured, multi-block grids• Roe flux• MUSCL reconstruction with Hemker-Koren limiter• Implicit scheme

Source code of NUWTUN available onlinehttp://nuwtun.berlios.de

Praveen. C (TIFR-CAM) Shape Optimization IITK, Oct 2009 19 / 40

Page 20: Discrete adjoint approach to CFD-based shape …math.tifrbng.res.in/~praveen/slides/iitkan-oct2009.pdfIterative convergence tests Primal residual Adjoint residual Rn= jjR(Qn)jj Rn=

Validation of adjoint gradients

• Dot-product test

R := R′(Q)Q

≈ R(Q+ εQ)−R(Q)ε

Q := [R′(Q)]>R

R>R?= Q>Q

• Upwind schemes and limiterscan cause problems due tonon-differentiability

• Check adjoint derivativesagainst finite difference

I NACA0012: Cd/Cl

I RAE2822: Cd

5 10 15 20Hicks-Henne parameter

-40

-20

0

20

40

60

80

Gra

dien

t

ADFD

5 10 15 20Hicks-Henne parameter

-100

-50

0

50

100

150

Gra

dien

t

ADFD

Praveen. C (TIFR-CAM) Shape Optimization IITK, Oct 2009 20 / 40

Page 21: Discrete adjoint approach to CFD-based shape …math.tifrbng.res.in/~praveen/slides/iitkan-oct2009.pdfIterative convergence tests Primal residual Adjoint residual Rn= jjR(Qn)jj Rn=

Convergence and limiter: RAE2822 airfoil

L(a, b) =a(b2 + 2ε) + b(2a2 + ε)

2a2 − ab+ 2b2 + 3ε, 0 < ε� 1

ε = 10−8 ε = 10−4

1e-05

0.0001

0.001

0.01

0.1

1

0 200 400 600 800 1000 1200 1400 1600

Res

idue

Number of iterations

Densityx-momeny-momenz-momen

Energy

1e-10

1e-09

1e-08

1e-07

1e-06

1e-05

0.0001

0.001

0.01

0.1

1

0 200 400 600 800 1000 1200 1400 1600

Res

idue

Number of iterations

Densityx-momeny-momenz-momen

Energy

Adjoint iterations blow-up No blow-up

Praveen. C (TIFR-CAM) Shape Optimization IITK, Oct 2009 21 / 40

Page 22: Discrete adjoint approach to CFD-based shape …math.tifrbng.res.in/~praveen/slides/iitkan-oct2009.pdfIterative convergence tests Primal residual Adjoint residual Rn= jjR(Qn)jj Rn=

Iterative convergence tests

Primal residual Adjoint residualRn = ||R(Qn)|| Rn = ||[R′(Q∞)]>Ψn + I′(Q∞)||

0 500 1000 1500 2000 2500Number of iterations

1x10-151x10-141x10-131x10-121x10-111x10-101x10-91x10-81x10-71x10-6

0.000010.0001

0.0010.01

0.11

10100

Resid

ue

Flow residual

Adjoint residual

0 500 1000 1500 2000 2500 3000Number of iterations

0.2

0.4

0.6

0.8

Cl

0

0.02

0.04

0.06

0.08

0.1

Cd

ClCd

Convergence characteristics for the flow and adjoint solutions, andconvergence of lift and drag coefficients,

for RAE2822 airfoil at M∞ = 0.73

Praveen. C (TIFR-CAM) Shape Optimization IITK, Oct 2009 22 / 40

Page 23: Discrete adjoint approach to CFD-based shape …math.tifrbng.res.in/~praveen/slides/iitkan-oct2009.pdfIterative convergence tests Primal residual Adjoint residual Rn= jjR(Qn)jj Rn=

Test cases

• NACA0012: M∞ = 0.8, α = 1.25o

I =CdCl

Cl0Cd0

• RAE2822: M∞ = 0.729, α = 2.31oI Penalty approach

I =Cd

Cd0

+ ω

∣∣∣∣1− Cl

Cl0

∣∣∣∣I Constrained minimization

min I =Cd

Cd0

s.t. Cl = Cl0

Praveen. C (TIFR-CAM) Shape Optimization IITK, Oct 2009 23 / 40

Page 24: Discrete adjoint approach to CFD-based shape …math.tifrbng.res.in/~praveen/slides/iitkan-oct2009.pdfIterative convergence tests Primal residual Adjoint residual Rn= jjR(Qn)jj Rn=

NACA0012: Maximize L/D

0 0.2 0.4 0.6 0.8 1x/c

-1

-0.5

0

0.5

1

-Cp

Initialconmin_frcgoptpp_q_newtonsteep

0 0.2 0.4 0.6 0.8 1

-0.06

-0.04

-0.02

0

0.02

0.04

0.06

Initialconmin_frcgoptpp_q_newtonsteep

Method I 100Cd Cl Nfun Ngrad

Initial 1.000 2.072 0.295 - -conmin frcg 0.170 0.389 0.325 50 13

optpp q newton 0.142 0.329 0.329 50 39steep 0.166 0.335 0.287 50 45

Praveen. C (TIFR-CAM) Shape Optimization IITK, Oct 2009 24 / 40

Page 25: Discrete adjoint approach to CFD-based shape …math.tifrbng.res.in/~praveen/slides/iitkan-oct2009.pdfIterative convergence tests Primal residual Adjoint residual Rn= jjR(Qn)jj Rn=

RAE2822: Drag minimization, penalty approach

0 0.2 0.4 0.6 0.8 1x

-1

-0.5

0

0.5

1

1.5

-Cp

Initialconmin_frcgoptpp_q_newtonsteep

0 0.2 0.4 0.6 0.8 1x

-0.06

-0.04

-0.02

0

0.02

0.04

0.06

y

Initialconmin_frcgoptpp_q_newtonsteep

Method I 100Cd Cl Nfun Ngrad

Initial 1.000 1.150 0.887 - -conmin frcg 0.355 0.405 0.890 50 13

optpp q newton 0.351 0.400 0.884 50 51steep 0.341 0.388 0.884 50 47

Praveen. C (TIFR-CAM) Shape Optimization IITK, Oct 2009 25 / 40

Page 26: Discrete adjoint approach to CFD-based shape …math.tifrbng.res.in/~praveen/slides/iitkan-oct2009.pdfIterative convergence tests Primal residual Adjoint residual Rn= jjR(Qn)jj Rn=

RAE2822: Lift-constrained drag minimization

0 0.2 0.4 0.6 0.8 1x/c

-1

-0.5

0

0.5

1

1.5

-Cp

Initialconmin_mfdfsqpipopt

0 0.2 0.4 0.6 0.8 1

-0.06

-0.04

-0.02

0

0.02

0.04

0.06

Initialconmin_mfdfsqpipopt

Method I 100Cd Cl Nfun Ngrad

Initial 1.000 1.150 0.887 - -conmin mfd 0.342 0.394 0.881 50 22

fsqp 0.325 0.374 0.887 50 32ipopt 0.335 0.385 0.887 45 62

Praveen. C (TIFR-CAM) Shape Optimization IITK, Oct 2009 26 / 40

Page 27: Discrete adjoint approach to CFD-based shape …math.tifrbng.res.in/~praveen/slides/iitkan-oct2009.pdfIterative convergence tests Primal residual Adjoint residual Rn= jjR(Qn)jj Rn=

RAE2822: Lift-constrained drag minimization

0 0.2 0.4 0.6 0.8 1x/c

-1

-0.5

0

0.5

1

1.5-Cp

ipoptInitial

0 0.2 0.4 0.6 0.8 1

-0.06

-0.04

-0.02

0

0.02

0.04

0.06

ipoptInitial

Praveen. C (TIFR-CAM) Shape Optimization IITK, Oct 2009 27 / 40

Page 28: Discrete adjoint approach to CFD-based shape …math.tifrbng.res.in/~praveen/slides/iitkan-oct2009.pdfIterative convergence tests Primal residual Adjoint residual Rn= jjR(Qn)jj Rn=

RANS computation

0 0.2 0.4 0.6 0.8 1x/c

-1

-0.5

0

0.5

1

1.5

-Cp

RAE2822Optimized

M=0.729, Re=6.5 million, Cl=0.88, k-w turbulence model

Shape Inviscid RANSAOA Cl 100Cd AOA Cl 100Cd

RAE2822 2.31 0.887 1.150 3.28 0.887 2.558Optimized 2.31 0.887 0.386 3.22 0.885 1.692

Praveen. C (TIFR-CAM) Shape Optimization IITK, Oct 2009 28 / 40

Page 29: Discrete adjoint approach to CFD-based shape …math.tifrbng.res.in/~praveen/slides/iitkan-oct2009.pdfIterative convergence tests Primal residual Adjoint residual Rn= jjR(Qn)jj Rn=

Sensitivity to perturbations

0.7 0.71 0.72 0.73 0.74 0.75 0.76Mach number

0

0.01

0.02

0.03

0.04

Dra

g co

effi

cien

t

InitialOptimized

0.7 0.71 0.72 0.73 0.74 0.75 0.76Mach number

0

50

100

150

200

Lif

t/Dra

g

InitialOptimized

(a) (b)Variation of (a) drag coefficient and (b) L/D with Mach number for

RAE2822 airfoil and optimized airfoil

Need for robust aerodynamic optimization

Praveen. C (TIFR-CAM) Shape Optimization IITK, Oct 2009 29 / 40

Page 30: Discrete adjoint approach to CFD-based shape …math.tifrbng.res.in/~praveen/slides/iitkan-oct2009.pdfIterative convergence tests Primal residual Adjoint residual Rn= jjR(Qn)jj Rn=

ATR

Praveen. C (TIFR-CAM) Shape Optimization IITK, Oct 2009 30 / 40

Page 31: Discrete adjoint approach to CFD-based shape …math.tifrbng.res.in/~praveen/slides/iitkan-oct2009.pdfIterative convergence tests Primal residual Adjoint residual Rn= jjR(Qn)jj Rn=

Thick airfoil

• NACA0040 airfoil: 40% thickness• M∞ = 0.5, α = 0 deg.• Inviscid optimization• A posteriori RANS verification:

Re = 0.5 million, k − ω turbulence model

Praveen. C (TIFR-CAM) Shape Optimization IITK, Oct 2009 31 / 40

Page 32: Discrete adjoint approach to CFD-based shape …math.tifrbng.res.in/~praveen/slides/iitkan-oct2009.pdfIterative convergence tests Primal residual Adjoint residual Rn= jjR(Qn)jj Rn=

NACA0040: inviscid and RANS Cp

0 0.2 0.4 0.6 0.8 1x/c

-1

-0.5

0

0.5

1

1.5

2-Cp

InviscidRANS

Praveen. C (TIFR-CAM) Shape Optimization IITK, Oct 2009 32 / 40

Page 33: Discrete adjoint approach to CFD-based shape …math.tifrbng.res.in/~praveen/slides/iitkan-oct2009.pdfIterative convergence tests Primal residual Adjoint residual Rn= jjR(Qn)jj Rn=

Mitigating adverse pressure gradients

• ~q = velocity vector, q = |~q|• θ = momentum thickness• Separation of boundary layer occurs when (Nash and Macdonald)

θ

q

dqds≤ −0.004

• Objective functional

I =∫A

1q2

[~q

q· ∇p

]+

dA

Minimizing I should reduce tendency for BL separation

Praveen. C (TIFR-CAM) Shape Optimization IITK, Oct 2009 33 / 40

Page 34: Discrete adjoint approach to CFD-based shape …math.tifrbng.res.in/~praveen/slides/iitkan-oct2009.pdfIterative convergence tests Primal residual Adjoint residual Rn= jjR(Qn)jj Rn=

Inviscid: Initial and optimized pressure

0 0.2 0.4 0.6 0.8 1x/c

-1

-0.5

0

0.5

1

1.5

2-C

p

InviscidInviscid opt

Praveen. C (TIFR-CAM) Shape Optimization IITK, Oct 2009 34 / 40

Page 35: Discrete adjoint approach to CFD-based shape …math.tifrbng.res.in/~praveen/slides/iitkan-oct2009.pdfIterative convergence tests Primal residual Adjoint residual Rn= jjR(Qn)jj Rn=

Optimized airfoil: inviscid and RANS solution

0 0.2 0.4 0.6 0.8 1x/c

-1

-0.5

0

0.5

1-C

p Inviscid optRANS opt

Praveen. C (TIFR-CAM) Shape Optimization IITK, Oct 2009 35 / 40

Page 36: Discrete adjoint approach to CFD-based shape …math.tifrbng.res.in/~praveen/slides/iitkan-oct2009.pdfIterative convergence tests Primal residual Adjoint residual Rn= jjR(Qn)jj Rn=

RANS: Mach number

Praveen. C (TIFR-CAM) Shape Optimization IITK, Oct 2009 36 / 40

Page 37: Discrete adjoint approach to CFD-based shape …math.tifrbng.res.in/~praveen/slides/iitkan-oct2009.pdfIterative convergence tests Primal residual Adjoint residual Rn= jjR(Qn)jj Rn=

Drag coefficient

Shape Inviscid RANSInitial 7.0426e-4 4.0229e-2

Optimized 7.5306e-4 2.6779e-2

Praveen. C (TIFR-CAM) Shape Optimization IITK, Oct 2009 37 / 40

Page 38: Discrete adjoint approach to CFD-based shape …math.tifrbng.res.in/~praveen/slides/iitkan-oct2009.pdfIterative convergence tests Primal residual Adjoint residual Rn= jjR(Qn)jj Rn=

Initial and optimized shapes

0 0.2 0.4 0.6 0.8 1

-0.2

-0.1

0

0.1

0.2

InitialOptimized

Praveen. C (TIFR-CAM) Shape Optimization IITK, Oct 2009 38 / 40

Page 39: Discrete adjoint approach to CFD-based shape …math.tifrbng.res.in/~praveen/slides/iitkan-oct2009.pdfIterative convergence tests Primal residual Adjoint residual Rn= jjR(Qn)jj Rn=

Summary

• Adjoint approach in CFD for steady-state problems• AD promises to ease generation/maintenance of adjoint solver

I Differentiation of entire design chain

• True gradient of numerical function• But, is AD gradient consistent with analytical gradient ?

Shocks, non-smooth schemes, turbulence models, etc.• Whenever you need gradients, think of AD

I OptimizationI Adjoint-based error estimation and grid adaptationI Exact linearization for implicit schemes, GMRESI Sensitivity analysisI Uncertainty quantification

• AD tools available for fortran, C, matlab• AD for MPI programs

Praveen. C (TIFR-CAM) Shape Optimization IITK, Oct 2009 39 / 40

Page 40: Discrete adjoint approach to CFD-based shape …math.tifrbng.res.in/~praveen/slides/iitkan-oct2009.pdfIterative convergence tests Primal residual Adjoint residual Rn= jjR(Qn)jj Rn=

Homi Bhabha Centenary Year

http://www.tifr.res.in/~hbbccc

Praveen. C (TIFR-CAM) Shape Optimization IITK, Oct 2009 40 / 40