application of ad in turbomachinery design euroad workshop... · application of ad in...
TRANSCRIPT
Application of AD in Turbomachinery Design
19th European Workshop on Automatic Differentiation Jan Backhaus DLR Cologne
www.DLR.de • Chart 1
CFD based Optimization
www.DLR.de • Chart 2
Gradient-free optimization is possible, but expensive
CRISP 1 rig
CRISP 2 optimization result
Design Process
www.DLR.de • Chart 3
CAD parameters
blade generator
surfaces
mesh generator mesh deformation
mesh
TRACE
CFD solution
POST
Objectives
Bladegenerator • Forward Mode AD CodiPack
Mesh deformation • self-adjoint problem: manually adjoined
TRACE • Reverse Mode AD: ADOL-C, DCO, CodiPack
POST • Reverse Mode AD:ADOL-C, DCO, CodiPack
Bladegenerator
www.DLR.de • Chart 4
DLRs NURBS based turbomachinery geometry tool differentiated with CodiPack + tinyform in forwardMode (Reverse Mode in progress)
Bladegenerator forward AD sensitivities
www.DLR.de • Chart 5
NonLinear TRACE - finite volume method on structured and
unstructured meshes - compressible Navier-Stokes, real-gas model - upwind-scheme 2nd order accurate - implicit time integration scheme - hybrid parallelization (MPI/OpenMP/SSE)
- turbulence modelling
- Spalart-Allmaras - Wilcox k-ω - Menter SST k-ω - W&J EARSM k-ω (Hellsten) - RSTM Wilcox Stress-ω
- transition modelling
- non-local: MultiMode − γ−Reθ Model (Menter & Langtry) - LKE Model
DES computation of a mixer
TRACE Post-Processing
- Data reduction - Massively parallel - Flexible process chains - Topology independet - Based on VTK
www.DLR.de • Chart 7
• Coupling of the aerodynamic and propulsion analysis tools for aircraft design is a necessity in multi- disciplinary design analysis and optimization of new aircraft concepts with highly integrated engines.
• To the authors knowledge, currently no propulsion system analysis tool is capable of providing analytic derivatives for gradient based optimization.
• Refactoring of DLR‘s inhouse gas turbine performance code GTlab-Performance undertaken in order to employ automatic differentiation.
• Current status: • Incorporation of active datatypes for AD (using CodiPack) • Introduction of a polynomial gas model • Interpolation libraries provide analytic derivatives which are
interfaced to the AD datatypes (forward and reverse mode) • Testing, testing, testing...;)
Automatic Differentiation in Gas Turbine Performance
DLR.de • Chart 8
AD in TRACE
AD-adjoint TRACE
AD know-how
(TU-KL)
industrial application
(MTU)
simulation code (DLR)
www.DLR.de • Chart 9
Adjoint Method
Continuous Discrete
Manual implementation
(+ GMRES)
+Finite differences
+Selective forward AD
adjointTRACE
Reverse Mode AD
+Optimizations
AD-adjointTRACE
3 year BMWi project R&E-Turb (completed) 3 year EU project CleanSky 2 (running)
Motivation: • new simulation models • consistency
TRACE Software Development
- 20+ years of code history - ~20 core developers + external developers at MTU, Universities - Language: C - Philosophy: stable trunk
- Coding guidelines - Code reviews - Automated test and validation suite - Branches for substantial developments
Task Tool Version Management Subversion Continuous Integration Jenkins Automated testing and validation In-house Python tools Bug tracking Mantis IDE Eclipse
AD in TRACE (2)
www.DLR.de • Chart 11
• ADOL-C • DCO • CodiPack
AD-Tools implemented for TRACE
• Adjoint MPI • Adjoinable MPI
adjoint Parallelization
• reverse accumulation
• pre accumulation of Jacobians
Optimizations
Challenges
• C is not C++ • C is not too strict about types • communication / structs • printf (tip: tinyformat) • unions • designated initializers • TRACE is optimized for performance • no influence on primal performance • only moderate changes to primal code • developer acceptance • restarting/checkpointing • computational ressources
Implicit Solution Scheme
www.DLR.de • Chart 12
dq
dt= R(q) = 0
qn+1 = qn + ¢tRn+1
Rn+1 ¼ Rn +@R
@q¢q + O(¢t2)
µ1
¢t¡ @R
@q
¯̄¯̄n¶
¢q = Rn
qn+1 = G(qn); q¤ = G(q¤)
Ãn+1 = Gadj(q¤; Ãn)
Steady Solution:
Euler Forward:
Taylor Series:
Implicit pseudo- time stepping:
Fixed point iteration:
Reverse Accumulation:
Implicit Solution Scheme
www.DLR.de • Chart 13
dq
dt= R(q) = 0
qn+1 = qn + ¢tRn+1
Rn+1 ¼ Rn +@R
@q¢q + O(¢t2)
µ1
¢t¡ @R
@q
¯̄¯̄n¶
¢q = Rn
qn+1 = G(qn); q¤ = G(q¤)
Ãn+1 = Gadj(q¤; Ãn)
What if we keep³
1¢t¡ @R
@q
¯̄¯n´
constant inside Gadj?
Steady Solution:
Euler Forward:
Taylor Series:
Implicit pseudo- time stepping:
Fixed point iteration:
Reverse Accumulation:
Constant implicit matrix CRISP 2
www.DLR.de • Chart 14
Testcase CRISP 2
www.DLR.de • Chart 15
CAD parameters
blade generator
surfaces
mesh deformation
mesh
TRACE
CFD solution
POST
Objectives
Testcase CRISP 2
www.DLR.de • Chart 16
CAD parameters
blade generator
surfaces
mesh deformation
mesh
TRACE
CFD solution
POST
Objectives
24 parameter shape changes by deformed surfaces
Sensitivities
www.DLR.de • Chart 17
CAD Param Const implicit mat. Updated implicit mat. 0 -2.82085542e-05 -2.82085543e-05 1 -1.81798135e-04 -1.81798135e-04 2 -3.57947732e-04 -3.57947732e-04 3 -1.46026411e-04 -1.46026411e-04 4 4.38913667e-07 4.38913632e-07 5 5.20296047e-05 5.20296037e-05 6 2.09157619e-04 2.09157620e-04 7 8.86496439e-06 8.86496444e-06 8 4.20493924e-05 4.20493929e-05 9 -3.66017192e-04 -3.66017194e-04
10 -4.88746949e-04 -4.88746951e-04 11 -1.46196978e-05 -1.46196979e-05 12 -3.83111784e-05 -3.83111781e-05 13 -7.83842571e-05 -7.83842570e-05 14 -1.88390056e-04 -1.88390056e-04 15 -4.38789624e-05 -4.38789619e-05 16 1.45440904e-05 1.45440899e-05 17 3.64904762e-05 3.64904757e-05 18 6.95241023e-05 6.95241020e-05 19 6.28804897e-06 6.28804871e-06 20 -1.17077950e-05 -1.17077951e-05 21 -1.58782348e-04 -1.58782349e-04 22 -2.65836414e-04 -2.65836415e-04 23 -1.11831870e-04 -1.11831870e-04
after 1000 adjoint iterations
www.DLR.de • Chart 18
Testcase CRESCENDO: 1st stage LPT
1.8 Mio Cells Wilcox k-w Multi-Mode transition Model Testbed for joint optimizations among MTU and RR distributed onto 72 procs
Constant implicit matrix
www.DLR.de • Chart 19
Memory [GB] factor time / iteration factor mem
Primal 12,79 1 1
adjoint var impmatrix 219,97 2,62 17,19
adjoint const impmatrix 123,36 1,12 9,64
Thanks! www.DLR.de • Chart 20