Aerodynamic Design Using VLM Gradient Generation Using ADIFOR (Automatic Differentiation in Fortran) Santosh N. Abhyankar Prof. K. Sudhakar.

Slides:



Advertisements
Similar presentations
ATMOSPHERIC TRANSMISSION AND RADIANCE MODELS
Advertisements

Running a model's adjoint to obtain derivatives, while more efficient and accurate than other methods, such as the finite difference method, is a computationally.
Automatic Differentiation Tutorial
Python Crash Course Accuracy 3 rd year Bachelors V1.0 dd Hour 7.
July 31, 2013 Jason Su. Background and Tools Cramér-Rao Lower Bound (CRLB) Automatic Differentiation (AD) Applications in Parameter Mapping Evaluating.
Computational Modeling for Engineering MECN 6040
A Discrete Adjoint-Based Approach for Optimization Problems on 3D Unstructured Meshes Dimitri J. Mavriplis Department of Mechanical Engineering University.
Marcello Tobia Benvenuto
July 11, 2006 Comparison of Exact and Approximate Adjoint for Aerodynamic Shape Optimization ICCFD 4 July 10-14, 2006, Ghent Giampietro Carpentieri and.
Derivatives Part A. Review of Basic Rules f(x)=xf`(x)=1 f(x)=kx f`(x)= k f(x)=kx n f`(x)= (k*n)x (n-1)    1.) The derivative of a variable is 1. 2.)
ITEC113 Algorithms and Programming Techniques
Engineering Optimization – Concepts and Applications Engineering Optimization Concepts and Applications Fred van Keulen Matthijs Langelaar CLA H21.1
Aerodynamic Shape Optimization in the Conceptual and Preliminary Design Stages Arron Melvin Adviser: Luigi Martinelli Princeton University FAA/NASA Joint.
Introduction to Scientific Computing ICE / ICE 508 Prof. Hyuckjae Lee KAIST- ICC
Lecture 2: Numerical Differentiation. Derivative as a gradient
ECIV 301 Programming & Graphics Numerical Methods for Engineers Lecture 4 Programming and Software EXCEL and MathCAD.
Rules for Differentiating Univariate Functions Given a univariate function that is both continuous and smooth throughout, it is possible to determine its.
Planning operation start times for the manufacture of capital products with uncertain processing times and resource constraints D.P. Song, Dr. C.Hicks.
ECIV 301 Programming & Graphics Numerical Methods for Engineers Lecture 3 Programming and Software.
Srinivasan Memorial Lecture The Aeronautical Society of India, Trivandrum VSSC K. Sudhakar Centre for Aerospace Systems Design & Engineering Department.
Applications of Adjoint Methods for Aerodynamic Shape Optimization Arron Melvin Adviser: Luigi Martinelli Princeton University FAA/NASA Joint University.
Applications of Calculus. The logarithmic spiral of the Nautilus shell is a classical image used to depict the growth and change related to calculus.
A Brief Overview of Methods for Computing Derivatives Wenbin Yu Department of Mechanical & Aerospace Engineering Utah State University, Logan, UT.
February 7, 2003MDO - 0 Multidisciplinary Design Optimization Activities at CASDE, I I T, Bombay
Biointelligence Laboratory, Seoul National University
Scientific Programmes Committee Centre for Aerospace Systems Design & Engineering K. Sudhakar Department of Aerospace Engineering Indian Institute of Technology,
SAROD Aerodynamic Design Optimization Studies at CASDE Amitay Isaacs, D Ghate, A G Marathe, Nikhil Nigam, Vijay Mali, K Sudhakar, P M Mujumdar Centre.
CC112 Structured Programming Lecture 4 1 Arab Academy for Science and Technology and Maritime Transport College of Engineering and Technology Computer.
Segmental Hidden Markov Models with Random Effects for Waveform Modeling Author: Seyoung Kim & Padhraic Smyth Presentor: Lu Ren.
Fourer et al., The NEOS Benchmarking Service INFORMS International, Puerto Rico, July 8-11, INFORMS International Session MC07, July 9, 2007 The.
Module 1: Statistical Issues in Micro simulation Paul Sousa.
1 EEE 431 Computational Methods in Electrodynamics Lecture 4 By Dr. Rasime Uyguroglu
Computational Biology, Part 15 Biochemical Kinetics I Robert F. Murphy Copyright  1996, 1999, 2000, All rights reserved.
MA/CS 375 Fall MA/CS 375 Fall 2002 Lecture 31.
Software Life Cycle What Requirements Gathering, Problem definition
Derivatives In modern structural analysis we calculate response using fairly complex equations. We often need to solve many thousands of simultaneous equations.
NUMERICAL SIMULATION OF WIND TURBINE AERODYNAMICS Jean-Jacques Chattot University of California Davis OUTLINE Challenges in Wind Turbine Flows The Analysis.
Computer Animation Rick Parent Computer Animation Algorithms and Techniques Optimization & Constraints Add mention of global techiques Add mention of calculus.
Sensitivity Analysis of Mesoscale Forecasts from Large Ensembles of Randomly and Non-Randomly Perturbed Model Runs William Martin November 10, 2005.
Some Fortran programming tips ATM 562 Fall 2015 Fovell (see also PDF file on class page) 1.
Differentials Intro The device on the first slide is called a micrometer….it is used for making precision measurements of the size of various objects…..a.
1 MAE 3241: AERODYNAMICS AND FLIGHT MECHANICS Finite Wings: General Lift Distribution Summary April 18, 2011 Mechanical and Aerospace Engineering Department.
Introduction to Computer Programming
Numerical Methods.
O PTIMAL SERVICE TASK PARTITION AND DISTRIBUTION IN GRID SYSTEM WITH STAR TOPOLOGY G REGORY L EVITIN, Y UAN -S HUN D AI Adviser: Frank, Yeong-Sung Lin.
Sensitivity derivatives Can obtain sensitivity derivatives of structural response at several levels Finite difference sensitivity (section 7.1) Analytical.
MECN 3500 Inter - Bayamon Lecture 9 Numerical Methods for Engineering MECN 3500 Professor: Dr. Omar E. Meza Castillo
Texas A&M University, Department of Aerospace Engineering AN EMBEDDED FUNCTION TOOL FOR MODELING AND SIMULATING ESTIMATION PROBLEMS IN AEROSPACE ENGINEERING.
1 Programming a Computer Lecture Ten. 2 Outline  A quick introduction to the programming language C  Introduction to software packages: Matlab for numerical.
CS404 Design and Analysis of Algorithms BBy DDr. M V S Peri Sastry BB.E, PhD(BITS-Pilani)
CHAP 3 WEIGHTED RESIDUAL AND ENERGY METHOD FOR 1D PROBLEMS
Written by Changhyun, SON Chapter 5. Introduction to Design Optimization - 1 PART II Design Optimization.
Advanced Engineering Mathematics, 7 th Edition Peter V. O’Neil © 2012 Cengage Learning Engineering. All Rights Reserved. CHAPTER 4 Series Solutions.
L25 Numerical Methods part 5 Project Questions Homework Review Tips and Tricks Summary 1.
Derivative-Enhanced Variable Fidelity Kriging Approach Dept. of Mechanical Engineering, University of Wyoming, USA Wataru YAMAZAKI 23 rd, September, 2010.
February 7, 2002MDO - 0 Aero India 2003, Bangalore Multidisciplinary Design Optimization Activities at CASDE, I I T, Bombay K Sudhakar & PM Mujumdar Centre.
Basis of Mathematical Modeling LECTURE 3 Numerical Analysis with MATLAB Dr. N.K. Sakhnenko, PhD, Professor Associate.
Optimization in Engineering Design 1 Introduction to Non-Linear Optimization.
A Different Solution  alternatively we can use the following algorithm: 1. if n == 0 done, otherwise I. print the string once II. print the string (n.
Spring 2006CISC101 - Prof. McLeod1 Announcements Assn 4 is posted. Note that due date is the 12 th (Monday) at 7pm. (Last assignment!) Final Exam on June.
ALGORITHMS AND FLOWCHARTS. Why Algorithm is needed? 2 Computer Program ? Set of instructions to perform some specific task Is Program itself a Software.
Linear Programming McGraw-Hill/Irwin Copyright © 2012 by The McGraw-Hill Companies, Inc. All rights reserved.
Texas A&M University, Department of Aerospace Engineering AUTOMATIC GENERATION AND INTEGRATION OF EQUATIONS OF MOTION BY OPERATOR OVER- LOADING TECHNIQUES.
Derivative of an Exponential
FE Exam Tutorial
Code-Based Sensitivities for Verification and Validation
Class Notes 18: Numerical Methods (1/2)
Computers in Civil Engineering 53:081 Spring 2003
Derivatives and Gradients
Presentation transcript:

Aerodynamic Design Using VLM Gradient Generation Using ADIFOR (Automatic Differentiation in Fortran) Santosh N. Abhyankar Prof. K. Sudhakar

Brief Outline Why ADIFOR ? What is ADIFOR ? Where ADIFOR has been used ? Case studies in CASDE

Why ADIFOR ?

Gradient-based Optimization Gradients calculated to give search direction Accuracy of gradients affect: –Efficiency of the optimizer –Accuracy of the optimum solution

Different Ways to Calculate Gradients Numerical methods –Finite difference –Complex variable method –Adjoint method Analytical methods –Manual differentiation –Automated differentiation

Finite Difference Vs Complex Variable CFL3D of NASA. Inviscil, Laminar, Turb., (Un)steady, Multi-blk, Accel, etc Complex 115 mts 75.2 MB FD 36 mts 37.7 MB 41 mts 37.7 MB Note : For several cases FDM required trying out several step sizes to get correct derivative. Factoring this in, it was seen that time taken on an average was more than 2 times for a single analysis.

Optimizer General Flowchart of an Optimization Cycle Analysis Functions Say: f(x),h(x), g(x) = any Complicated functions

Optimizer Gradient Calculation using Forward Difference Method Analysis Functions Say: f(x),g(x), h(x) = any Complicated function

Drawbacks of Numerical Gradients Approximate Round-off errors Computational requirements: requires (n+1) evaluations of function f Difficulties with noisy functions

Optimizer Analysis Functions Say: f(x) = Sin(x) Externally supplied Analytical Gradients: = Cos(x) Facility to provide user-supplied Gradients

Optimizer F(x)/g(x)/h(x): Complex Analysis Code Externally supplied Analytical Gradients: = ? Facility to provide user-supplied Gradients

User Supplied Gradients Complex Analysis Code in Fortran Manually extract sequence of mathematical operations Code the complex derivative evaluator in Fortran Manually differentiate mathematical functions - chain rule FORTRAN source code that can evaluate gradients

User Supplied Gradients Manually extract sequence of mathematical operations Use symbolic math packages to automate derivative evaluation Code the complex derivative evaluator in Fortran Complex Analysis Code in FORTARN FORTRAN source code that can evaluate gradients

User Supplied Gradients Parse and extract the sequence of mathematical operations Use symbolic math packages to automate derivative evaluation Code the complex derivative evaluator in Fortran Complex Analysis Code in FORTARN FORTRAN source code that can evaluate gradients

Gradients by ADIFOR Complex Analysis Code in FORTARN FORTRAN source code that can evaluate gradients Automated Differentiation Package

What is ADIFOR ?

Automatic DIfferentiation in FORtran {ADIFOR} by Mathematics and Computer Science Division, Argonne National Laboratories, NASA.

Initial Inputs to ADIFOR The top level routine which contains the functions The dependant and the independent variables The maximum number of independent variables

Functionality of ADIFOR Consider The derivative of is given by

Functionality of ADIFOR …contd. For any set of functions say: ADIFOR generates a Jacobian:

SUBROUTINE test(x,f) double precision x(2),f(3) f(1) = x(1)**2 + x(2)**2 f(2) = x(1)*x(2) f(3) = 2.*x(1) + 3.*x(2)**2 return end ADIFOR

subroutine g_test(g_p_, x, g_x, ldg_x, f, g_f, ldg_f) double precision x(2), f(3) integer g_pmax_ parameter (g_pmax_ = 2) integer g_i_, g_p_, ldg_f, ldg_x double precision d6_b, d4_v, d2_p, d1_p, d5_b, d4_b, d2_v, g_f(l *dg_f, 3), g_x(ldg_x, 2) integer g_ehfid intrinsic dble data g_ehfid /0/ C call ehsfid(g_ehfid, 'test','g_subrout5.f') C if (g_p_.gt. g_pmax_) then print *, 'Parameter g_p_ is greater than g_pmax_' stop endif

d2_v = x(1) * x(1) d2_p = 2.0d0 * x(1) d4_v = x(2) * x(2) d1_p = 2.0d0 * x(2) do g_i_ = 1, g_p_ g_f(g_i_, 1) = d1_p * g_x(g_i_, 2) + d2_p * g_x(g_i_, 1) enddo f(1) = d2_v + d4_v C do g_i_ = 1, g_p_ g_f(g_i_, 2) = x(1) * g_x(g_i_, 2) + x(2) * g_x(g_i_, 1) enddo f(2) = x(1) * x(2) C g_test contd.

d4_v = x(2) * x(2) d1_p = 2.0d0 * x(2) d4_b = dble(3.) d5_b = d4_b * d1_p d6_b = dble(2.) do g_i_ = 1, g_p_ g_f(g_i_, 3) = d5_b * g_x(g_i_, 2) + d6_b * g_x(g_i_, 1) enddo f(3) = dble(2.) * x(1) + dble(3.) * d4_v C return end g_test contd.

ADIFOR Where ??

Applications of ADIFOR and ADIC ADIFOR and ADIC have been applied to application codes from various domains of science and engineering. Atmospheric Chemistry On-Chip Interconnect Modeling Mesoscale Weather Modeling CFD Analysis of the High-Speed Civil Transport Rotorcraft Flight 3-D Groundwater Contaminant Transport 3-D Grid Generation for the High-Speed Civil Transport A Numerically Complicated Statistical Function -- the Log-Likelihood for log-F distribution (LLDRLF).

Mesoscale Weather Modeling : Temperature sensitivity as computed by Divided Difference using a second-order forward-difference formula

Mesoscale Weather Modeling: Temperature sensitivity as computed by ADIFOR

Case Study at CASDE

Optimization Problem Minimize : induced drag (C di ) Subject to: C L = 0.2 Design variables: jig-twist(  ) and angle of attack at root (     has a linear variation from zero at root to  at tip.   is constant over the entire wing semi-span. crcr ctct 

The VLM Code 600 lines (approx) SUBROUTINE vlm(amach, cr, ct, bby2, sweep,twist,alp0,isym, ni_gr, nj_gr, cl, cd, cm) CALL mesh(cr, ct, bby2, sweep, …,ni_gr, nj_gr) CALL matinv(aic, np_max, index, np) CALL setalp(r_p, beta, twist, bby2, alp0, alp, np) CALL mataxb(aic, alp, gama, np_max, np_max, np, np, 1) CALL mataxb(aiw, gama, w, np_max, np_max, np, np, 1) CALL loads(…,gama, w, str_lift, alift, cl, cd, cm)

The ADIFOR-generated derivative of VLM subroutine g_vlm(g_p_, …, twist, g_twist,ldg_twist, alp0, g_alp0, ldg_alp0, isym, ni_gr, nj_gr, cl, g_cl,ldg_cl, cd, g_cd, ldg_cd, cm) call mesh(cr, ct, bby2, sweep, …, ni_gr, nj_gr) call matinv(aic, np_max, index, np) call g_setalp(g_p_, r_p, beta, twist, g_twist, ldg_twist, bby2, alp0, g_alp0, ldg_alp0, alp, g_alp, g_pmax_, np) call g_mataxb(g_p_, aic, alp, g_alp, g_pmax_, gama, g_gama, g_pmax_, np_max, np_max, np, np, 1) call g_mataxb(g_p_, aiw, gama, g_gama, g_pmax_, w, g_w, g_pmax_, np_max, np_max, np, np, 1) call g_loads(g_p_, …, ni_gr, nj_gr, np, …, gama, g_gama, g_pmax_, w, g_w, g_pmax_, str_lift, alift, g_alift, g_pmax_, cl, g_cl, ldg_cl, cd, g_cd, ldg_cd, cm)

Optimization Results Jig-twist  CLCL C Di Starting Values Values at Optimum (FD) Values at Optimum (ADIFOR)

Optimization Results Jig-twist  CLCL C Di Starting Values Values at Optimum (FD) Values at Optimum (ADIFOR)

Comparison of Time Taken for Optimization With Finite Difference With ADIFOR No. of function Evaluations 2515 Total time in Seconds

Codes with CASDE Inviscid 3D Code for arbitrary configurations. Tried on ONERA M6. Optimised for memory and CPU time. –total subroutines: 93 –total source lines : 5077 Viscous laminar, 2D, Cartesian for simple configurations. Not optimized. More easily readable. Research code. –total subroutines : 35 –total source lines : 2316

Limitations Strict ANSI Fortran 77 code.

Thank You