Adjoint code development and optimization using automatic differentiation (AD)

Similar documents
Adjoint approach to optimization

Airfoil shape optimization using adjoint method and automatic differentiation

Finite Volume Method

Efficient Hessian Calculation using Automatic Differentiation

Numerical Solution of Partial Differential Equations governing compressible flows

Is My CFD Mesh Adequate? A Quantitative Answer

Finite volume method on unstructured grids

PDE Solvers for Fluid Flow

An Investigation of the Attainable Efficiency of Flight at Mach One or Just Beyond

Automatic Differentiation for Optimum Design, Applied to Sonic Boom Reduction

Applications of adjoint based shape optimization to the design of low drag airplane wings, including wings to support natural laminar flow

DG Methods for Aerodynamic Flows: Higher Order, Error Estimation and Adaptive Mesh Refinement

A Study of Transonic Flow and Airfoils. Presented by: Huiliang Lui 30 th April 2007

Entropy stable schemes for compressible flows on unstructured meshes

Derivatives for Time-Spectral Computational Fluid Dynamics using an Automatic Differentiation Adjoint

Continuous adjoint based error estimation and r-refinement for the active-flux method

An Introduction to the Discontinuous Galerkin Method

Chapter Two: Numerical Methods for Elliptic PDEs. 1 Finite Difference Methods for Elliptic PDEs

DG Methods for Aerodynamic Flows: Higher Order, Error Estimation and Adaptive Mesh Refinement

Module III: Partial differential equations and optimization

Discrete and continuous adjoint method for compressible CFD J. Peter ONERA

Output-Based Error Estimation and Mesh Adaptation in Computational Fluid Dynamics: Overview and Recent Results

Computation Fluid Dynamics

Challenges and Complexity of Aerodynamic Wing Design

Hp-Adaptivity on Anisotropic Meshes for Hybridized Discontinuous Galerkin Scheme

Progress in Mesh-Adaptive Discontinuous Galerkin Methods for CFD

Application of Dual Time Stepping to Fully Implicit Runge Kutta Schemes for Unsteady Flow Calculations

Numerical Optimization Algorithms

Gradient-Based Optimum Aerodynamic Design Using Adjoint Methods

Simulation of Condensing Compressible Flows

An Investigation of the Attainable Efficiency of Flight at Mach One or Just Beyond

The Shallow Water Equations

Adjoint-based aerodynamic shape optimization

A Stable Spectral Difference Method for Triangles

Aerodynamic Inverse Design and Shape Optimization via Control Theory

Basic Aspects of Discretization

Nonlinear Frequency Domain Methods Applied to the Euler and Navier-Stokes Equations p.1/50

minimize x subject to (x 2)(x 4) u,

Kasetsart University Workshop. Multigrid methods: An introduction

Review and Unification of Methods for Computing Derivatives of Multidisciplinary Computational Models

Lecture 11: Arclength and Line Integrals

6. Iterative Methods for Linear Systems. The stepwise approach to the solution...

Méthode de quasi-newton en interaction fluide-structure. J.-F. Gerbeau & M. Vidrascu

Tangent linear and adjoint models for variational data assimilation

AProofoftheStabilityoftheSpectral Difference Method For All Orders of Accuracy

Poisson Equation in 2D

Using AD to derive adjoints for large, legacy CFD solvers

A hybrid adjoint approach applied to RANS equations

Numerical Analysis Comprehensive Exam Questions

Solution Algorithms for Viscous Flow

Certification of Derivatives Computed by Automatic Differentiation

Application of a Non-Linear Frequency Domain Solver to the Euler and Navier-Stokes Equations

CapSel Roe Roe solver.

First, Second, and Third Order Finite-Volume Schemes for Diffusion

A Multi-Dimensional Limiter for Hybrid Grid

Numerical Solution Techniques in Mechanical and Aerospace Engineering

Solving the Euler Equations!

Chapter 9 Implicit integration, incompressible flows

5. FVM discretization and Solution Procedure

AM 205: lecture 19. Last time: Conditions for optimality Today: Newton s method for optimization, survey of optimization methods

A Crash-Course on the Adjoint Method for Aerodynamic Shape Optimization

An Efficient Low Memory Implicit DG Algorithm for Time Dependent Problems

Final Exam. Monday March 19, 3:30-5:30pm MAT 21D, Temple, Winter 2018

Lagrangian Coherent Structures (LCS)

Sensitivity analysis by adjoint Automatic Differentiation and Application

Hamiltonian partial differential equations and Painlevé transcendents

AA214B: NUMERICAL METHODS FOR COMPRESSIBLE FLOWS

Efficient solution of stationary Euler flows with critical points and shocks

Numerical Optimization

A high-order discontinuous Galerkin solver for 3D aerodynamic turbulent flows

SAROD Conference, Hyderabad, december 2005 CONTINUOUS MESH ADAPTATION MODELS FOR CFD

Well-balanced DG scheme for Euler equations with gravity

Sensitivity Analysis AA222 - Multidisciplinary Design Optimization Joaquim R. R. A. Martins Durand

[N175] Development of Combined CAA-CFD Algorithm for the Efficient Simulation of Aerodynamic Noise Generation and Propagation

Math 234 Exam 3 Review Sheet

A COUPLED-ADJOINT METHOD FOR HIGH-FIDELITY AERO-STRUCTURAL OPTIMIZATION

1 Distributions (due January 22, 2009)

Active sets, steepest descent, and smooth approximation of functions

Discretization Error Reduction through r Adaptation in CFD

COMPLETE CONFIGURATION AERO-STRUCTURAL OPTIMIZATION USING A COUPLED SENSITIVITY ANALYSIS METHOD

Optimal Control. Lecture 18. Hamilton-Jacobi-Bellman Equation, Cont. John T. Wen. March 29, Ref: Bryson & Ho Chapter 4.

Advanced numerical methods for nonlinear advectiondiffusion-reaction. Peter Frolkovič, University of Heidelberg

AeroFoam: an accurate inviscid compressible solver for aerodynamic applications

The Fast Sweeping Method. Hongkai Zhao. Department of Mathematics University of California, Irvine

Implicit Solution of Viscous Aerodynamic Flows using the Discontinuous Galerkin Method

Inverse Lax-Wendroff Procedure for Numerical Boundary Conditions of. Conservation Laws 1. Abstract

Parametric Curves. Calculus 2 Lia Vas

Efficient FEM-multigrid solver for granular material

A Sobolev trust-region method for numerical solution of the Ginz

ADJOINT AND DEFECT ERROR BOUNDING AND CORRECTION FOR FUNCTIONAL ESTIMATES

0.2. CONSERVATION LAW FOR FLUID 9

Total Pressure Losses Minimization in Turbomachinery Cascades, using a New Continuous Adjoint Formulation

Conservation of Mass. Computational Fluid Dynamics. The Equations Governing Fluid Motion

Math 216 Second Midterm 19 March, 2018

Well-balanced DG scheme for Euler equations with gravity

Divergence Formulation of Source Term

Computing Spectra of Linear Operators Using Finite Differences

Functional differentiation

Draft Notes ME 608 Numerical Methods in Heat, Mass, and Momentum Transfer

1 Assignment 1: Nonlinear dynamics (due September

Transcription:

Adjoint code development and optimization using automatic differentiation (AD) Praveen. C Computational and Theoretical Fluid Dynamics Division National Aerospace Laboratories Bangalore - 560 037 CTFD Seminar, March 31, 2006 Praveen. C (CTFD, NAL) Adjoints and optimization CTFD Seminar 1 / 56

Outline 1 Mathematical formulation 2 Computing gradients 3 Quasi 1-D flow 4 Gradient smoothing 5 Quasi 1-D optimization: Pressure matching 6 2-D adjoint Euler solver 7 Future work Praveen. C (CTFD, NAL) Adjoints and optimization CTFD Seminar 2 / 56

Outline 1 Mathematical formulation 2 Computing gradients 3 Quasi 1-D flow 4 Gradient smoothing 5 Quasi 1-D optimization: Pressure matching 6 2-D adjoint Euler solver 7 Future work Praveen. C (CTFD, NAL) Adjoints and optimization CTFD Seminar 3 / 56

Mathematical formulation Constrained minimization problem Find δα such that δj < 0 min α J(α, u) subject to R(α, u) = 0 δj = J J δα + α u δu = J J u δα + α u α δα = Gδα Steepest descent δα = ɛg δj = ɛgg = ɛ G 2 < 0 Praveen. C (CTFD, NAL) Adjoints and optimization CTFD Seminar 4 / 56

Mathematical formulation Constrained minimization problem min α J(α, u) subject to R(α, u) = 0 Find δα such that δj < 0 δj = J J δα + α u δu = J J u δα + α u α δα = Gδα Steepest descent δα = ɛg δj = ɛgg = ɛ G 2 < 0 Praveen. C (CTFD, NAL) Adjoints and optimization CTFD Seminar 5 / 56

Sensitivity approach Linearized state equation or R R δα + α u δu = 0 R u u α = R α Solve sensitivity equation iteratively u t α + R u u α = R α Same eigenvalues as original system Costly if number of α are large Praveen. C (CTFD, NAL) Adjoints and optimization CTFD Seminar 6 / 56

Adjoint approach We have δj = J J R R δα + δu and δα + α u α u δu = 0 Introduce a new unknown v δj = J ( ) J R δα + α u δu + v R δα + α u δu = Adjoint equation Iterative solution ( J α + v R α ) δα + ( ) R ( ) J v = u u v t + ( ) R v = u ( J u + v R u ( ) J u ) δu Praveen. C (CTFD, NAL) Adjoints and optimization CTFD Seminar 7 / 56

Continuous vs Discrete Continuous approach: Start with governing PDE Derive adjoint PDE and boundary conditions Discretize adjoint PDE and solve Must be re-derived whenever cost function changes Not all cost functions admissible Discrete approach: Start with discrete approximation like FVM Derive discrete adjoint equations Solve discrete adjoint equations True sensitivity of discrete solution Praveen. C (CTFD, NAL) Adjoints and optimization CTFD Seminar 8 / 56

Outline 1 Mathematical formulation 2 Computing gradients 3 Quasi 1-D flow 4 Gradient smoothing 5 Quasi 1-D optimization: Pressure matching 6 2-D adjoint Euler solver 7 Future work Praveen. C (CTFD, NAL) Adjoints and optimization CTFD Seminar 9 / 56

Techniques for computing gradients Hand differentiation Finite difference method Complex variable method Automatic differentiation Computer code to compute some function Chain rule of differentiation Generates a code to compute derivatives ADIFOR, ADOLC, ODYSEE, TAMC, TAF, TAPENADE Praveen. C (CTFD, NAL) Adjoints and optimization CTFD Seminar 10 / 56

Differentiation: Example Computer code, f = t 10 t 1 = x A simple example f = (xy + sin x + 4)(3y 2 + 6) t 2 = y t 3 = t 1 t 2 t 4 = sin t 1 t 5 = t 3 + t 4 t 6 = t 5 + 4 t 7 = t 2 2 t 8 = 3t 7 t 9 = t 8 + 6 t 10 = t 6 t 9 Praveen. C (CTFD, NAL) Adjoints and optimization CTFD Seminar 11 / 56

Automatic Differentiation: F77 code 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 (CTFD, NAL) Adjoints and optimization CTFD Seminar 12 / 56

Differentiation: Direct mode Some definitions I k := {i : i < k and t k depends explicitly on t i } ṫ i := t i α, Apply chain rule of differentiation t i,k := t i t k α = x, or y ṫ k = t k α = i I k t i t k = ṫ i t k,i k = 1, 2,..., 9, 10 α t i i I k Praveen. C (CTFD, NAL) Adjoints and optimization CTFD Seminar 13 / 56

Differentiation: Direct mode Apply chain rule of differentiation t 1 = x ṫ 1 = ẋ t 2 = y ṫ 2 = ẏ t 3 = t 1 t 2 ṫ 3 = ṫ 1 t 2 + t 1 ṫ 2 t 4 = sin(t 1 ) ṫ 4 = cos(t 1 )ṫ 1 t 5 = t 3 + t 4 ṫ 5 = ṫ 3 + ṫ 4 t 6 = t 5 + 4 ṫ 6 = ṫ 5 t 7 = t2 2 ṫ 7 = t 8 = 3t 7 ṫ 8 = 2t 2 ṫ 2 3ṫ 7 t 9 = t 8 + 6 ṫ 9 = ṫ 8 t 10 = t 6 t 9 ṫ 10 = ṫ 6 t 9 + t 6 ṫ 9 ẋ = 1, ẏ = 0, ṫ 10 = f x and ẋ = 0, ẏ = 1, ṫ 10 = f y tapenade -d -vars "x y" -outvars f costfunc.f Praveen. C (CTFD, NAL) Adjoints and optimization CTFD Seminar 14 / 56

Automatic Differentiation: Direct mode SUBROUTINE COSTFUNC_D(x, xd, y, yd, f, fd) t1d = xd t1 = x t2d = yd t2 = y t3d = t1d*t2 + t1*t2d t3 = t1*t2 t4d = t1d*cos(t1) t4 = SIN(t1) t5d = t3d + t4d t5 = t3 + t4 t6d = t5d t6 = t5 + 4 t7d = 2*t2*t2d t7 = t2**2 t8d = 3.0*t7d t8 = 3.0*t7 t9d = t8d t9 = t8 + 6.0 t10d = t6d*t9 + t6*t9d t10 = t6*t9 fd = t10d f = t10 END Praveen. C (CTFD, NAL) Adjoints and optimization CTFD Seminar 15 / 56

Differentiation: Reverse mode Some definitions J k := {i : i > k and t i depends explicitly on t k } t i := f t i = t 10 t i, t i,k := t i t k Apply chain rule of differentiation in reverse t k = t 10 = t 10 t i = t i t i,k k = 10, 9,..., 2, 1 t k t i t k i J k i J k Praveen. C (CTFD, NAL) Adjoints and optimization CTFD Seminar 16 / 56

Differentiation: Reverse mode Apply chain rule of differentiation in reverse t 1 = x t 10 = 1 t 2 = y t 9 = t 10 t 10,9 = t 6 t 3 = t 1 t 2 t 8 = t 9 t 9,8 = t 6 t 4 = sin(t 1 ) t 7 = t 8 t 8,7 = 3t 6 t 5 = t 3 + t 4 t 6 = t 10 t 10,6 = t 9 t 6 = t 5 + 4 t 5 = t 6 t 6,5 = t 9 t 7 = t2 2 t 4 = t 5 t 5,4 = t 9 t 8 = 3t 7 t 3 = t 5 t 5,3 = t 9 t 9 = t 8 + 6 t 2 = t 7 t 7,2 + t 3 t 3,2 = 6t 2 t 6 + t 1 t 9 t 10 = t 6 t 9 t 1 = t 4 t 4,1 + t 3 t 3,1 = t 9 cos(t 1 ) + t 9 t 2 t 1 = f x, t 2 = f y tapenade -b -vars "x y" -outvars f costfunc.f Praveen. C (CTFD, NAL) Adjoints and optimization CTFD Seminar 17 / 56

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 Praveen. C (CTFD, NAL) Adjoints and optimization CTFD Seminar 18 / 56

Direct versus reverse AD Direct mode: cost is proportional to number of independent variables Reverse mode: cost does not depend on the number of independent variables Reverse mode preferred when number of independent variables is large Scalar output f Direct mode gives f s for given vector s Reverse mode gives f Vector output R R n Direct mode gives R s for given vector s Reverse mode gives ( R) s Praveen. C (CTFD, NAL) Adjoints and optimization CTFD Seminar 19 / 56

Issues in reverse AD Intermediate variables required in reverse order Some variables may be over-written Iterative solvers Only final solution required AD differentiates the iterative loop Intermediate solutions stored in stack Huge memory requirements Not practical for large problems Piecemeal differentiation approach (Courty et al., Giles et al.): Modular flow solver Adjoint solver written manually AD for differentiating the modules Praveen. C (CTFD, NAL) Adjoints and optimization CTFD Seminar 20 / 56

Outline 1 Mathematical formulation 2 Computing gradients 3 Quasi 1-D flow 4 Gradient smoothing 5 Quasi 1-D optimization: Pressure matching 6 2-D adjoint Euler solver 7 Future work Praveen. C (CTFD, NAL) Adjoints and optimization CTFD Seminar 21 / 56

Discrete 1-D adjoint equations Finite volume residual for i th cell Numerical flux function Perturbation equation δr i = R i := F i+1/2 F i 1/2 = 0 F = F (X, Y ), F i+1/2 = F (U i, U i+1 ) X F i+1/2δu i + Y F i+1/2δu i+1 X F i 1/2δU i 1 Y F i 1/2δU i + R i α δα = 0 Introduce adjoint variable V i for i th cell δj = J α δα + i J U i δu i + i Vi δr i Praveen. C (CTFD, NAL) Adjoints and optimization CTFD Seminar 22 / 56

Discrete adjoint equations Collecting terms containing δu i δj = i [ J U i + V i 1 ( + Vi Vi+1 Y F i 1/2 X F i+1/2 ) Y F i 1/2 ] X F i+1/2 δu i +... Adjoint equation for i th cell ( ) J ( ) + U i Y F i 1/2 V i 1 + ( X F i+1/2 ) Y F i 1/2 V i ( ) X F i+1/2 V i+1 = 0 Praveen. C (CTFD, NAL) Adjoints and optimization CTFD Seminar 23 / 56

Example flow solver While u is not converged res = 0.0 fluxinflow(u(1), res(1)) do i=1,n-1 fluxinterior(u(i), u(i+1), res(i), res(i+1)) enddo fluxoutflow(u(n), res(n)) do i=1,n u(i) = u(i) (dt/dx)*res(i) enddo endwhile cost=0.0 do i=1,n costfunc(u(i), cost) enddo Praveen. C (CTFD, NAL) Adjoints and optimization CTFD Seminar 24 / 56

Example adjoint solver costb=1.0 do i=1,n costfunc_b(u(i), ub1(i), cost, costb) enddo v=0.0 While v is not converged ub2 = 0.0 fluxinflow_b(u(1), ub2(1), res(1), v(1)) do i=1,n-1 fluxinterior_b(u(i), ub2(i), u(i+1), ub2(i+1), res(i), v(i), res(i+1), v(i+1)) enddo fluxoutflow_b(u(n), ub2(n), res(n), v(n)) do i=1,n v(i) = v(i) (dt/dx)*(ub1(i) + ub2(i)) enddo endwhile Praveen. C (CTFD, NAL) Adjoints and optimization CTFD Seminar 25 / 56

Quasi 1-D flow Quasi 1-D flow in a duct t (hu) + dh (hf ) = P, x dx x (a, b) t > 0 ρ ρu 0 U = ρu E, f = p + ρu 2 (E + p)u, P = p 0 h(x) = cross-section height of duct Inverse design: find shape h to get pressure distribution p Optimization problem: find the shape h which minimizes J = b a (p p ) 2 dx Praveen. C (CTFD, NAL) Adjoints and optimization CTFD Seminar 26 / 56

Quasi 1-D flow Finite volume scheme h i du i dt + h i+1/2f i+1/2 h i 1/2 F i 1/2 x Discrete cost function = (h i+1/2 h i 1/2 ) P i x J = N (p i pi )2 i=1 Control variables N = 100 h 1/2, h 1+1/2,..., h i+1/2,..., h N+1/2 Praveen. C (CTFD, NAL) Adjoints and optimization CTFD Seminar 27 / 56

Duct shape 1.9 1.8 1.7 Duct shape Target shape Current shape 1.6 h 1.5 1.4 1.3 1.2 1.1 1 0 2 4 6 8 10 x Praveen. C (CTFD, NAL) Adjoints and optimization CTFD Seminar 28 / 56

Target pressure distribution p 2.5 Target pressure AUSMDV KFVS LF 2 Pressure 1.5 1 0.5 0 2 4 6 8 10 x Praveen. C (CTFD, NAL) Adjoints and optimization CTFD Seminar 29 / 56

Current pressure distribution 2.5 Starting pressure AUSMDV KFVS LF 2 Pressure 1.5 1 0.5 0 2 4 6 8 10 x Praveen. C (CTFD, NAL) Adjoints and optimization CTFD Seminar 30 / 56

Adjoint density 5 0 AUSMDV KFVS LF 5 Adjoint density 10 15 20 25 30 35 0 2 4 6 8 10 x Praveen. C (CTFD, NAL) Adjoints and optimization CTFD Seminar 31 / 56

Convergence history: Explicit Euler 0 1 Convergence history with AUSMDV flux Flow Adjoint Residue 2 3 4 5 6 7 8 9 10 1000 2000 3000 4000 5000 6000 7000 No of iterations Praveen. C (CTFD, NAL) Adjoints and optimization CTFD Seminar 32 / 56

Shape gradient Gradient 35 30 AUSMDV KFVS LF 25 Gradient 20 15 10 5 0 0 2 4 6 8 10 x Praveen. C (CTFD, NAL) Adjoints and optimization CTFD Seminar 33 / 56

Shape gradient Gradient 40 35 30 25 20 15 10 Gradient AUSMDV KFVS LF 5 0 5 2 2.5 3 3.5 4 4.5 5 5.5 6 x Praveen. C (CTFD, NAL) Adjoints and optimization CTFD Seminar 34 / 56

Validation of Shape gradient 35 Gradient with AUSMDV flux 30 25 B Gradient 20 15 10 5 A C 0 0 2 4 6 8 10 x Praveen. C (CTFD, NAL) Adjoints and optimization CTFD Seminar 35 / 56

Validation of shape gradient J J(h + h) J(h h) h 2 h h A B C 0.01 0.4191069499 35.18452823 2.545316345 0.001 0.4231223499 36.10982621 2.556461900 0.0001 0.4231624999 36.11933154 2.556573499 0.00001 0.4231599998 36.11942125 2.556575000 0.000001 0.4231999994 36.11942305 2.556550001 0.0000001 0.4229999817 36.11942329 2.556499971 AD 0.4231628330 36.11941951 2.556574450 Praveen. C (CTFD, NAL) Adjoints and optimization CTFD Seminar 36 / 56

Outline 1 Mathematical formulation 2 Computing gradients 3 Quasi 1-D flow 4 Gradient smoothing 5 Quasi 1-D optimization: Pressure matching 6 2-D adjoint Euler solver 7 Future work Praveen. C (CTFD, NAL) Adjoints and optimization CTFD Seminar 37 / 56

Gradient smoothing Non-smooth gradients especially in the presence of shocks Smooth using an elliptic equation ( 1 ɛ i d 2 dx 2 ) ḡ i = g i L i = ɛ i = { g i+1 g i + g i g i 1 }L i g i+1 2g i + g i 1 max( g i+1 g i + g i g i 1, TOL) Finite difference with Jacobi iterations Praveen. C (CTFD, NAL) Adjoints and optimization CTFD Seminar 38 / 56

Gradient smoothing Gradient using AUSMDV flux 35 30 Original gradient Smoothed gradient 25 Gradient 20 15 10 5 0 0 2 4 6 8 10 x Praveen. C (CTFD, NAL) Adjoints and optimization CTFD Seminar 39 / 56

Outline 1 Mathematical formulation 2 Computing gradients 3 Quasi 1-D flow 4 Gradient smoothing 5 Quasi 1-D optimization: Pressure matching 6 2-D adjoint Euler solver 7 Future work Praveen. C (CTFD, NAL) Adjoints and optimization CTFD Seminar 40 / 56

Quasi 1-D optimization: Shape 1.9 1.8 Target Initial 1.7 1.6 1.5 h 1.4 1.3 1.2 1.1 1 0 1 2 3 4 5 6 7 8 9 10 x Praveen. C (CTFD, NAL) Adjoints and optimization CTFD Seminar 41 / 56

Quasi 1-D optimization: Final shape 1.9 1.8 1.7 1.6 1.5 h 1.4 1.3 Target Initial Final 1.2 1.1 1 0 1 2 3 4 5 6 7 8 9 10 x Praveen. C (CTFD, NAL) Adjoints and optimization CTFD Seminar 42 / 56

Quasi 1-D optimization: Pressure 2.5 2 Pressure 1.5 Target Initial Final 1 0.5 0 1 2 3 4 5 6 7 8 9 10 x Praveen. C (CTFD, NAL) Adjoints and optimization CTFD Seminar 43 / 56

Quasi 1-D optimization: Convergence 10 0 Cost Gradient 10 1 10 2 Cost/Gradient 10 3 10 4 10 5 10 6 0 5 10 15 20 25 30 35 40 45 50 No. of iterations Praveen. C (CTFD, NAL) Adjoints and optimization CTFD Seminar 44 / 56

Quasi 1-D optimization: Adjoint density 0 5 Adjoint density 10 15 Initial Final 20 25 0 2 4 6 8 10 x Praveen. C (CTFD, NAL) Adjoints and optimization CTFD Seminar 45 / 56

Outline 1 Mathematical formulation 2 Computing gradients 3 Quasi 1-D flow 4 Gradient smoothing 5 Quasi 1-D optimization: Pressure matching 6 2-D adjoint Euler solver 7 Future work Praveen. C (CTFD, NAL) Adjoints and optimization CTFD Seminar 46 / 56

2-D finite volume flow solver Unstructured triangular grid Vertex-centroid scheme (Frink, Jameson) Vertex values obtained using inverse-distance averaging with correction for linear consistency p i u p = w i i r i u i w i i r i L R Convergence acceleration using matrix-free LUSGS with spectral radius approximation Praveen. C (CTFD, NAL) Adjoints and optimization CTFD Seminar 47 / 56

2-D finite volume adjoint solver Vertex averaging including weights are differentiated For transonic flow limiter is also differentiated Adjoint solver requires 38% more memory compared to flow solver Time per adjoint iteration = Twice the time per flow solver iteration Convergence acceleration using LUSGS with spectral-radius approximation Automated using Makefile Adjoint validation for J(α) = C l Praveen. C (CTFD, NAL) Adjoints and optimization CTFD Seminar 48 / 56

Grid for NACA-0012: 160 40 Number of vertices = 6560 Number of triangles = 12800 Praveen. C (CTFD, NAL) Adjoints and optimization CTFD Seminar 49 / 56

Validation of adjoints: Lift-curve slope, subsonic flow 0.35 0.3 0.25 C l 0.2 0.15 0.1 0.05 0 0 0.5 1 1.5 2 2.5 3 Angle of attack in degrees Praveen. C (CTFD, NAL) Adjoints and optimization CTFD Seminar 50 / 56

Validation of adjoints: Lift-curve slope, transonic flow 0.8 0.7 0.6 0.5 C l 0.4 0.3 0.2 0.1 0 0 0.5 1 1.5 2 2.5 3 Angle of attack in degrees Praveen. C (CTFD, NAL) Adjoints and optimization CTFD Seminar 51 / 56

Lift-curve slope: C lα AOA M = 0.4 M = 0.8 C lα C lα /Cl th α C lα C lα /Cl th α 0.0 7.2095 1.0516 13.7506 1.3130 0.5 7.2069 1.0512 14.0556 1.3422 1.0 7.2000 1.0502 13.9544 1.3325 1.5 7.1901 1.0487 13.2116 1.2616 2.0 7.1789 1.0471 12.8314 1.2253 2.5 7.1675 1.0455 11.4077 1.0893 3.0 7.1562 1.0438 10.7135 1.0230 Praveen. C (CTFD, NAL) Adjoints and optimization CTFD Seminar 52 / 56

Convergence history: α = 3 o M = 0.4 M = 0.8 100 Flow Adjoint 10 Flow Adjoint 10 1 1 0.1 0.1 0.01 Residue 0.01 0.001 Residue 0.001 1e-04 1e-04 1e-05 1e-05 1e-06 1e-06 1e-07 0 2000 4000 6000 8000 10000 12000 1e-07 0 1000 2000 3000 4000 5000 6000 7000 8000 9000 10000 No. of iterations No. of iterations Praveen. C (CTFD, NAL) Adjoints and optimization CTFD Seminar 53 / 56

Adjoint density for lift coefficient: α = 3 o M = 0.4 M = 0.8 Adjoint_Density, min = -57.979, max = 58.0587 Adjoint_Density, min = -140.596, max = 134.291 Praveen. C (CTFD, NAL) Adjoints and optimization CTFD Seminar 54 / 56

Outline 1 Mathematical formulation 2 Computing gradients 3 Quasi 1-D flow 4 Gradient smoothing 5 Quasi 1-D optimization: Pressure matching 6 2-D adjoint Euler solver 7 Future work Praveen. C (CTFD, NAL) Adjoints and optimization CTFD Seminar 55 / 56

Future work How to deform the grid? How to account for grid perturbation? Smoothing of gradients in 2-D Application to 2-D optimization problems Extension to viscous flows Grid adaptation Praveen. C (CTFD, NAL) Adjoints and optimization CTFD Seminar 56 / 56