Department of Mechanical Engineering Application of the Discrete Adjoint Method to Coupled Multidisciplinary Unsteady Flow Problems for Error Estimation and Optimization Karthik Mani Department of Mechanical Engineering University of Wyoming Ph.D. Defense March 27, 2009
Outline Motivation Background Goals Analysis problem Adjoint gradient and optimization results Adjoint error estimates and adaptation results Concluding remarks
Motivation – Part 1 Began with shape optimization in unsteady flow problems Evolved to address multiple coupled unsteady disciplines Airfoil design for unsteady applications such as dynamic stall , flutter control, highly unsteady flows such as rotorcraft forward flight, rotor-stator interactions in turbomachines etc Primary mechanism – use adjoint equations for computing gradient vector CFX ONERA NLR ONERA
Motivation – Part 2 Adjoint variables can also be used for goal-based error estimation Can be used to drive adaptive solutions Spatial goal-based adaptation for steady-state problems has been done Time-dependent adjoint variables now available. Can we adapt time-domain in unsteady problems? Vendetti & Darmofal MIT FUN3D - NASA Langley
Background: Gradient-based Optimization Minimization of a functional by modifying inputs Output functional Function Input parameters dL/dD L D
Background: Computation of the Gradient F = Flow equations or discrete flow solution (CFD-code) D = parametric representation of geometry L = functional of interest (ex: lift,drag etc) Change D (i.e shape) to change L (Ex: lift) => need gradient dL/dD => how? Finite difference Input D CFD Code Output L Input D+e CFD Code Output Lnew dL/dD ~ DL/DD = (Lnew – L)/e e is heuristically determined Large -> wrong slope due to nonlinear effects Small -> machine error Multiple D => multiple evaluations of F
Background: Differentiating F for Gradient Possible to directly differentiate analytic F to obtain expression for analytic dL/dD L = F(D) dL/dD = dF(D)/dD Continuous Linearization Can also sequentially differentiate operations in CFD code which computes L=F(D) Input D CFD Code Output L d CFD Code dL/dD dD Discrete Linearization
Background: Continuous vs. Discrete Linearization
Background: Adaptive Solutions - Spatial Domain Goal is to efficiently use of computational resources Add points to the mesh on-the-fly only where it is important But which areas are important? High gradients? Local error? Boundary layers? Shock waves? Venditti MIT Wakes? Stagnation points? Whatever is relevant to our functional of interest (Ex: lift, drag) is what is important ! Same argument in time domain. Adjoint equations establish a relationship between the functional and the regions of the mesh that are relevant to it
Goals: Develop a unified framework for computing adjoint variables for coupled unsteady equations Compute functional gradients using adjoint variables and demonstrate shape optimization for aeroelastic problems Extend utility of adjoint variables for estimating functional relevant temporal discretization error and algebraic error Demonstrate adaptation of the time-domain and adaptation of convergence tolerances Do this in an unstructured framework with finite-volume formulation applied to dynamic meshes.
Analysis Problem: Flow Equations Conservative form of Euler equations Integrate over a moving control volume Spatial discretization uses second-order accurate matrix dissipation scheme Temporal discretization uses second-order accurate BDF2 scheme Define flow residual as: Newton solver
Analysis Problem Mesh Motion Equations Approximate edges as springs Overall linear system: relates interior displacements to boundary displacements 2 Spring equations (x and y) for each node that can be solved as Solve using Gauss-Seidel or linear multigrid
Analysis Problem: Structural Equations Equations of motion Airfoil with 2 pitch and plunge degrees-of-freedom Matrix form: Transform as: Structure residual: Newton solver:
Analysis Problem: Geometry Parameterization Hicks-Henne Sine bump function: node displacement bump magnitude node location bump location Valid for: Bump magnitudes amax are the design variables D
Analysis Problem: Coupled Aeroelastic Solution Coupled residual equations: Coupled iterative solution Coupled iterations convergence
Analysis Problem: Overall Solution Procedure Read flow parameters and mesh Steady-State solution from freestream conditions Deform mesh to correct AOA Deform mesh to prescribed orientation at current time-step Initiate unsteady solution using steady-state solution Unsteady aeroelastic solution initiated by prescribed unsteady solution Flow solution at current time-step Prescribed unsteady time-integration Time-integration with coupled iterative aeroelastic solution at each time-step
Adjoint-based Gradient: A Simple Steady-State Example Consider a functional L evaluated using solution state U: state sensitivity to D is a matrix Linearize for gradient: Linearization of scalar – easily computable
Adjoint-based Gradient: A Simple Steady-State Example Residual equation used to obtain solution U Residual has to evaluate to zero at all points, therefore derivative is also zero Limiting case of a single D, this is a linear system that can be solved to be obtain state sensitivity (vector) For multiple D, multiple linear solutions required to construct state sensitivity one column at a time Better than finite-difference in terms of accuracy, but no better in cost
Adjoint-based Gradient: A Simple Steady-State Example Transpose to obtain adjoint linearization: Rearrange state sensitivity expression: Substitute into adjoint linearization and introduce adjoint variable: Linear adjoint equation No dependence on D during linear solution Effect of D confined to final matrix-vector product
Generalized Form for Multidisciplinary Unsteady Coupled Equations m coupled disciplines=> L is a functional computed using multidisciplinary solution set: Linearize using chain rule with respect to D: Inner-product form: Tranpose for adjoint total sensitivity:
Generalized Form for Multidisciplinary Unsteady Coupled Equations Linearize with respect to D: Residual equations for m disciplines: Write in combined matrix form:
Generalized Form for Multidisciplinary Unsteady Coupled Equations Transpose and rearrange for vector of state sensitivity matrices:
Generalized Form for Multidisciplinary Unsteady Coupled Equations Substitute into adjoint total sensitivity equation:
Generalized Form for Multidisciplinary Unsteady Coupled Equations Define vector of disciplinary adjoint variables: Rearrange to recover linear adjoint system:
Generalized Form for Multidisciplinary Unsteady Coupled Equations General Jacobian matrix when expanded discretely in time is lower triangular due to hyperbolic nature of time: Swap rows and columns to obtain an upper triangular linear system that can be solved by back substitution
Generalized Form for Multidisciplinary Unsteady Coupled Equations Finally, substitute vector of disciplinary adjoint variables into total sensitivity equation to obtain gradient
Unsteady Aeroelastic Problem Functional based on solution to unsteady flow, structure and mesh equations Linearize, tranpose, and write in inner-product form for adjoint total sensitivity: Tap flow, structure and mesh residuals for state variable sensitivity matrix expression Mesh residual is function of structural state
Unsteady Aeroelastic Problem Linearize residuals: Combined matrix form:
Unsteady Aeroelastic Problem Substitute expression for vector of state variables sensitivity matrices into adjoint total sensitivity equation and define adjoint variables:
Unsteady Aeroelastic Problem Now determine form of discrete temporal expansion of Jacobians Flow residual at time-step n: Tri-diagonal for both residual to flow state and residual to mesh coordinate sensitivity
Unsteady Aeroelastic Problem Mesh residual at time-step n: All Jacobians are diagonal since there is no dependence beyond time-step n: Structure residual:
Unsteady Aeroelastic Problem Substitute expanded Jacobians back into adjoint system:
Unsteady Aeroelastic Problem Swap rows and columns to form an upper triangular system: Each diagonal block represents one time-step Diagonal block is coupled – requires solution procedure similar to analysis problem Backward sweep in time with coupled iterative solution at each time step
Unsteady Aeroelastic Problem Segregated form at an arbitrary time-step: When adjoint variables are available, substitute back into total sensitivity equation: Complete gradient then:
Uncoupled Unsteady Problem Functional based on only time-dependent flow and mesh coordinates: Linearize, tranpose and convert to inner-product form: Residual equations: Linearize, combine into matrix form, tranpose and rearrange for vector of state variable sensitivity matrices
Uncoupled Unsteady Problem Substitute into total sensitivity and define vector of adjoint variables: Discretely expand in time using definitions for Jacobians from before:
Uncoupled Unsteady Problem Rearrange to form upper triangular adjoint system Note: Diagonal blocks are also upper triangular => uncoupled equations Segregated form: First solve flow adjoint then solve mesh adjoint Substitute adjoint variables into total sensitivity.
Steady-State Problem Adjoint system is same as the uncoupled unsteady problem. No discrete temporal expansion since solutions span only space. Solve directly by forward substitution First solve flow adjoint as: Then mesh adjoint as: Mesh residual for steady-state: Final gradient then becomes:
Validation of Adjoint-based Gradient Forward linearization is first verified against finite-difference Dual consistency between transpose operations is used to verify adjoint gradient Primal operation Dual operation Dual consistency requires: Comparison of adjoint gradient with finite-difference
Steady-State Shape Optimization Lift constrained drag minimization of a NACA0012 in transonic flow Mach number = 0.8, AOA = 1.25 degrees Functional: Computational mesh ~ 20,000 elements L-BFGS-B algorithm for optimization Uses gradient and builds approximate Hessian on-the-fly using history 32 bump functions – 16 on upper surface and 16 lower surface Magnitudes of bumps form vector design variables
Steady-State Shape Optimization
Steady-State Shape Optimization
Steady-State Shape Optimization Entropy Contours
Uncoupled Unsteady Problem Time-Dependent Load Matching AGARD test case No.5: Mach number = 0.755, a=0.016o, kc=0.0814, am=2.51o L-BFGS-B Optimization Algorithm 290 design variables Bump at each surface node Same mesh as steady-state problem Target load is that of NACA64210
Uncoupled Unsteady Problem Time-Dependent Load Matching
Uncoupled Unsteady Problem Time-Dependent Load Matching
Uncoupled Unsteady Problem Time-Dependent Load Matching
Uncoupled Unsteady Problem Time-Dependent Pressure Distribution Matching Same unsteady problem and global functional formulation. Local functional at each time-step is the difference between pressures Inverse design in unsteady flow from NACA0012 to NACA64210 Target airfoil is NACA64210 “type” airfoil Target is closest match possible using the parameterization of the geometry 290 design variables (Convergence stalls) Reduced to 14 design variables and true optimum achieved in 28 iterations
Uncoupled Unsteady Problem Time-Dependent Pressure Distribution Matching 290 design variables 14 design variables
Uncoupled Unsteady Problem Time-Dependent Pressure Distribution Matching 290 design variables case
Uncoupled Unsteady Problem Time-Dependent Pressure Distribution Matching 14 design variables case
Uncoupled Unsteady Problem Time-Dependent Lift Constrained Drag Minimization Same unsteady problem functional formulation as time-dependent load matching. Target drag now set to zero at all time-steps. Target lift is that of NACA0012
Uncoupled Unsteady Problem Time-Dependent Lift Constrained Drag Minimization
Unsteady Aeroelastic Problem Single Element Airfoil – Flutter Control Functional formulation for zero velocities and displacements at final time-step, constrained by steady-state lift at max forced pitch: NACA64A010 airfoil at Mach number = 0.825, Flutter velocity = 0.75 32 design variables, 16 upper, 16 lower. L-BFGS-B algorithm
Unsteady Aeroelastic Problem Single Element Airfoil – Flutter Control
Unsteady Aeroelastic Problem Single Element Airfoil – Flutter Control
Unsteady Aeroelastic Problem Two-Element Slotted Airfoil – Flutter Control Functional formulation same as previous case but converted to sum over final 10 time-steps: Slotted airfoil with identical structural parameters at Mach number = 0.6, Flutter velocity = 1.85 32 design variables, 8x4 upper and lower on both airfoils. L-BFGS-B algorithm
Unsteady Aeroelastic Problem Two-Element Slotted Airfoil – Flutter Control
Unsteady Aeroelastic Problem Two-Element Slotted Airfoil – Flutter Control
Functional Relevant Error A Simple Spatial Example Arbitrary coarse resolution - H Arbitrary fine resolution - h Functional using real solution on h: Functional using real solution on H: Lh(Uh) LH(UH) Can we estimate true fine level functional using only coarse level solution?
Functional Relevant Error A Simple Spatial Example Project coarse solution onto fine solution UH UHh Evaluate functional on fine level using projected solution, then expand using Taylor series: Up to first order
Functional Relevant Error A Simple Spatial Example Rearrange and approximate the error in the functional as: We don’t know this because we don’t want to solve on h to get Uh Easily computable Expand residual on fine level the same way: Rearrange for unknown:
Functional Relevant Error A Simple Spatial Example Substitute into error equation: Define adjoint variable on fine level: Rearrange for fine adjoint system: Approximate on coarse (to avoid fine level solution): Project to fine level:
Functional Relevant Error A Simple Spatial Example Substitute adjoint and then error estimate becomes: Inner-product between Adjoint and Nonzero residual. Residual evaluated of fine level using projection of solution from coarse level. Interpret inner-product as sum of adjoint-weighted nonzero residual over all cells. Non-zero residual is an estimate of local error in each cell. This is a distribution in space of the error relevant to functional L. Sum of distribution (i.e. e) is also a correction to the functional. Use error distribution to adapt relevant regions of mesh.
Sources of Error Multidisciplinary solution Temporal discretization error Spatial discretization error Algebraic error Within each type of error, contributions from each discipline
Temporal Discretization Error: Generalized Error Form for Multidisciplinary Unsteady Coupled Equations Temporal Discretization Error: Convention is now: h-fine temporal mesh, H-coarse temporal mesh Functional on some arbitrary fine temporal level using multidisciplinary solution set: Assuming full convergence, expand using Taylor series about functional computed using projected solution from coarse temporal mesh:
Generalized Error Form for Multidisciplinary Unsteady Coupled Equations Truncate to remove higher-order terms and write in inner-product form: Easily computable Unknown at this point
Generalized Error Form for Multidisciplinary Unsteady Coupled Equations Residual equation of arbitrary discipline j on fine temporal mesh expanded about residual constructed using projected solution from coarse temporal mesh: Do this for all disciplines and write in combined matrix form:
Generalized Error Form for Multidisciplinary Unsteady Coupled Equations Rearrange to get an expression for vector state variable differences due to projection: Substitute back into error equation and define vector of disciplinary adjoint variables:
Generalized Error Form for Multidisciplinary Unsteady Coupled Equations Recover adjoint system (this is on the fine temporal mesh): Recast on coarse temporal mesh – Now this system is identical to that presented in the gradient derivation:
Generalized Error Form for Multidisciplinary Unsteady Coupled Equations Project adjoint variables onto fine level and now error is the inner-product between disciplinary adjoint and corresponding disciplinary non-zero residual: Total temporal discretization error = sum of disciplinary adjoint weighted disciplinary residuals. Tells us how much discretization error arises from each discipline. But each disciplinary inner product is again a sum in time. Tells us how much temporal discretization error arises from each time-step within each discipline
Generalized Error Form for Multidisciplinary Unsteady Coupled Equations Algebraic Error: Convention is now: overbar indicates partial convergence All operations on coarse temporal level Expand functional on coarse level computed using fully converged solution about functional based on partially converged solution:
Generalized Error Form for Multidisciplinary Unsteady Coupled Equations Truncate and write in inner-product form:
Generalized Error Form for Multidisciplinary Unsteady Coupled Equations Expand fully converged disciplinary residual about partially converged residual: Do for all disciplines and write in combined matrix form. Rearrange to extract unknown:
Generalized Error Form for Multidisciplinary Unsteady Coupled Equations Substitute into algebraic error equation and define adjoint variables to recover adjoint system as: Nearly identical to adjoint system for temporal discretization error. Except now use partially converged solution on coarse level Disciplinary algebraic error is now again adjoint-weighted nonzero residual (due to partial convergence)
Separation of Algebraic and Temporal Discretization Errors For temporal discretization we assumed full convergence on coarse level before projecting to fine level to get: If we partially converge on coarse level and then project to fine level then: This includes effects due to partial convergence and projection = Total error. Separate temporal discretization error by subtracting algebraic error.
Validation of Error Estimates Temporal discretization error only: Flow algebraic error: Mesh algebraic error:
Validation of Error Estimates Combined total error:
Adaptation Results General Notes: Targeted temporal adaptation compared against local error-based adaptation: Local error estimated as: Adaptation strategy: Sort by time-steps by error contribution - decreasing order Parse down list and flag time-steps for refinement until 99% error is covered Same for all error components Temporal resolution adaptation = divide time-step by two Convergence tolerance adaptation = tighten by factor of 3
Adaptation Results Non-Time-Integrated Functional NACA64A010 Airfoil with prescribed pitching motion operating at Mach number of 0.3
Adaptation Results Non-Time-Integrated Functional
Adaptation Results Non-Time-Integrated Functional
Adaptation Results Non-Time-Integrated Functional At first adaptation cycle
Adaptation Results Non-Time-Integrated Functional
Adaptation Results Non-Time-Integrated Functional
Adaptation Results Non-Time-Integrated Functional
Adaptation Results Non-Time-Integrated Functional
Adaptation Results Time-Integrated Functional Interaction of a convecting vortex with a slowly pitching airfoil. NACA0012 airfoil pitching at kc=0.001. Mach number is 0.4225. Starting at 50 steps uniform time-steps.
Adaptation Results Time-Integrated Functional
Adaptation Results Time-Integrated Functional
Adaptation Results Time-Integrated Functional
Adaptation Results Time-Integrated Functional
Adaptation Results Time-Integrated Functional
Adaptation Results Time-Integrated Functional
Adaptation Results Time-Integrated Functional
Adaptation Results Time-Integrated Functional
Concluding Remarks Summary: Developed a unified framework for computing adjoint variables for multidisciplinary coupled unsteady equations Adjoint variables were used to construct gradient for use in shape optimization Goal-based error estimates for temporal discretization and algebraic errors formulated using adjoint variables Adaptation of time domain and convergence tolerances were demonstrated
Concluding Remarks Potential Applications: Rapid determination of gradient vector or sensitivity derivatives for coupled unsteady equations for design optimization Model parameter sensitivity Improved unsteady simulation capability Quantification and compensation for algebraic errors Error due to coupling
Concluding Remarks Future work: Demonstrate algorithms in realistic 3D problems Target all error components (spatial, temporal, algebraic, coupling etc) to develop efficient solvers
Thank you. Questions?