Application of the Discrete Adjoint Method to Coupled Multidisciplinary Unsteady Flow
Problems for Error Estimation and Optimization
Karthik ManiDepartment 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
ONERA NLR
ONERA
CFX
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 & DarmofalMIT
FUN3D - NASA Langley
Background: Gradient-based Optimization
)(DFL Output functional Input parametersFunction
Minimization of a functional by modifying inputs
D
L
dL/dD
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)
Input D CFD Code Output L
Input D+ CFD Code Output Lnew
Change D (i.e shape) to change L (Ex: lift) => need gradient dL/dD => how?
Finite difference
dL/dD ~ L/D = (Lnew – L)/
• is heuristically determined• Large -> wrong slope due to nonlinear effects• Small -> machine error
Multiple D => multiple evaluations of F
Background:Differentiating F for Gradient
L = F(D)dL/dD = dF(D)/dD
Possible to directly differentiate analytic F to obtain expression for analytic dL/dD
Can also sequentially differentiate operations in CFD code which computes L=F(D)
Input D CFD Code Output L
CFD Coded
dDdL/dD
Continuous Linearization
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?
Stagnation points? Wakes?
Shock waves?Boundary layers?
VendittiMIT
• 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
Define flowresidual as:
Newton solver
• Spatial discretization uses second-order accurate matrix dissipation scheme• Temporal discretization uses second-order accurate BDF2 scheme
Analysis Problem Mesh Motion Equations
Approximate edges as springs
2 Spring equations (x and y) for each node that can be solved as
Overall linear system: relates interior displacements to boundary displacements
Solve using Gauss-Seidel or linear multigrid
0][ surfxxKG
Analysis Problem:Structural Equations
Airfoil with 2 pitch and plunge degrees-of-freedom
Equations of motion
Matrix form:
Transform as:
Structure residual:
Newton solver:
Analysis Problem:Geometry Parameterization
Hicks-Henne Sine bump function:
bump location
node location
node displacement
bump magnitude
10 xValid 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
Steady-State solution from freestream
conditions
Initiate unsteady solution using steady-state solution
Unsteady aeroelastic solution initiated by prescribed unsteady
solution
Read flow parameters and
mesh
Deform mesh to correct AOA
Deform mesh to prescribed orientation at current time-step
Flow solution at current time-step
Prescribed unsteadytime-integration Time-integration with coupled
iterative aeroelastic solution at each time-step
Adjoint-based Gradient:A Simple Steady-State Example
))(,( DUDLL
D
U
UDD
LL
d
dL
Consider a functional L evaluated using solution state U:
Linearize for gradient:
Linearization of scalar – easily computable
state sensitivity to D is a matrix
Adjoint-based Gradient:A Simple Steady-State Example
Residual equation used to obtain solution U 0))(,( DUDR
Residual has to evaluate to zero at all points, therefore derivative is also zero
D
R
D
U
U
R
0
D
U
U
R
D
R
• 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
TTTT LL
d
dL
UD
U
DD
TTT
U
R
D
R
D
U
U
UU
R
D
R
DD
TTTTT LL
d
dL
Transpose to obtain adjoint linearization:
TTL
UU
RU
Rearrange state sensitivity expression:
Substitute into adjoint linearization and introduce adjoint variable:
Linear adjoint equation D
R
D
U
U
R
• No dependence on D during linear solution• Effect of D confined to final matrix-vector product UD
R
DD
TTT L
d
dL
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
Residual equations for m disciplines:Linearize with respect to D:
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 ProblemFunctional 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 ProblemSubstitute expression for vector of state variables sensitivity matrices into
adjoint total sensitivity equation and define adjoint variables:
Unsteady Aeroelastic ProblemNow 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 ProblemMesh 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 ProblemSwap 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 ProblemFunctional 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 ProblemAdjoint 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 operationDual operation
Comparison of adjoint gradient with finite-difference
Dual consistency requires:
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 ProblemTime-Dependent Load Matching
AGARD test case No.5: Mach number = 0.755, =0.016o, kc=0.0814, m=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 ProblemTime-Dependent Load Matching
Uncoupled Unsteady ProblemTime-Dependent Load Matching
Uncoupled Unsteady ProblemTime-Dependent Load Matching
Uncoupled Unsteady ProblemTime-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 ProblemTime-Dependent Pressure Distribution Matching
14 design variables290 design variables
Uncoupled Unsteady ProblemTime-Dependent Pressure Distribution Matching
290 design variables case
Uncoupled Unsteady ProblemTime-Dependent Pressure Distribution Matching
14 design variables case
Uncoupled Unsteady ProblemTime-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 ProblemTime-Dependent Lift Constrained Drag
Minimization
Unsteady Aeroelastic ProblemSingle 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.7532 design variables, 16 upper, 16 lower. L-BFGS-B algorithm
Unsteady Aeroelastic ProblemSingle Element Airfoil – Flutter Control
Unsteady Aeroelastic ProblemSingle Element Airfoil – Flutter Control
Unsteady Aeroelastic ProblemTwo-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.8532 design variables, 8x4 upper and lower on both airfoils. L-BFGS-B algorithm
Unsteady Aeroelastic ProblemTwo-Element Slotted Airfoil – Flutter Control
Unsteady Aeroelastic ProblemTwo-Element Slotted Airfoil – Flutter Control
Functional Relevant ErrorA Simple Spatial Example
Arbitrary fine resolution - hArbitrary coarse resolution - H
Lh(Uh)LH(UH)Functional using real solution on h:
Functional using real solution on H:
Can we estimate true fine level functional using only coarse level solution?
Functional Relevant ErrorA Simple Spatial Example
Project coarse solution onto fine solution
UH UHh
Evaluate functional on fine level using projected solution, then expand using Taylor series:
Hhh
Hhhhh
Hh
LLL UU
UUU
U
)()(
Up to first order
Functional Relevant ErrorA Simple Spatial Example
Hhh
Hhhhh
Hh
LLL UU
UUU
U
)()(
Rearrange and approximate the error in the functional as:
Easily computableWe don’t know this because we don’t want to solve on h to get Uh
0)()(
Hhh
Hhhhh
Hh
UUU
RURUR
U
)(1
Hhh
Hhh
Hh
URU
RUU
U
Expand residual on fine level the same way:
Rearrange for unknown:
Functional Relevant ErrorA Simple Spatial Example
)()()(1
Hhh
Hhhhh
Hh
Hh
LLL UR
U
R
UUU
UU
1
Hh
Hh
h
LT
UUU U
R
U
TT
Hh
hHh
L
UU
U UU
R
Substitute into error equation:
Define adjoint variable on fine level: Rearrange for fine adjoint system:
Approximate on coarse (to avoid fine level solution):
TT
H
H
H
L
UU
U UU
R
H
Hhh I UU
Project to fine level:
Functional Relevant ErrorA Simple Spatial Example
)()()( Hhh
THhhhh h
LL URUU USubstitute adjoint and then error estimate becomes:
ncells
iii
1
R
•This is a distribution in space of the error relevant to functional L.•Sum of distribution (i.e. ) is also a correction to the functional.•Use error distribution to adapt relevant regions of mesh.
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.
Sources of Error
Multidisciplinary solution
Temporal discretization
error
Spatial discretization
error
Algebraic error
Within each type of error, contributions from each discipline
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 EstimatesTemporal discretization error only:
Flow algebraic error:
Mesh algebraic error:
Validation of Error Estimates
Combined total error:
Adaptation ResultsGeneral 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 coveredSame for all error components
Temporal resolution adaptation = divide time-step by twoConvergence tolerance adaptation = tighten by factor of 3
Adaptation ResultsNon-Time-Integrated Functional
NACA64A010 Airfoil with prescribed pitching motion operating at Mach number of 0.3
Adaptation ResultsNon-Time-Integrated Functional
Adaptation ResultsNon-Time-Integrated Functional
Adaptation ResultsNon-Time-Integrated Functional
At first adaptation cycle
Adaptation ResultsNon-Time-Integrated Functional
Adaptation ResultsNon-Time-Integrated Functional
Adaptation ResultsNon-Time-Integrated Functional
Adaptation ResultsNon-Time-Integrated Functional
Adaptation ResultsTime-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 ResultsTime-Integrated Functional
Adaptation ResultsTime-Integrated Functional
Adaptation ResultsTime-Integrated Functional
Adaptation ResultsTime-Integrated Functional
Adaptation ResultsTime-Integrated Functional
Adaptation ResultsTime-Integrated Functional
Adaptation ResultsTime-Integrated Functional
Adaptation ResultsTime-Integrated Functional
Concluding RemarksSummary:
• 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 RemarksPotential 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 RemarksFuture work:
• Demonstrate algorithms in realistic 3D problems
• Target all error components (spatial, temporal, algebraic, coupling etc) to develop efficient solvers
Thank you.
Questions?