Upload
others
View
18
Download
0
Embed Size (px)
Citation preview
An Object-oriented Framework for Rapid Discrete Adjoint Development Using OpenFOAM
Ping He, Charles A. Mader, Joaquim R.R.A. Martins, Kevin J. Maki
AIAA SciTech, San Diego, January 9, 2019
Aerodynamics Heat transferStructures
2
We focus on design optimization with high-fidelity
MDO for an electric aircraft using OpenMDAO. (Gray et al. SAMO 2018).
MDO for the uCRM model using ADflow. (Kenway et al. AIAA-2014-3274)
Ø Low-fidelity MDO (conceptual design phase)
Ø High-fidelity MDO (detailed design phase)
3
Gradient-based optimization is preferable for handling large-scale design problems with high-fidelity
Aerostructural optimization using 972 design variables.(Kenway and Martins, AIAA-2015-2790)
4
Adjoint derivative computation is a crucial component in the high-fidelity gradient-based optimization framework
An example of gradient-based optimization framework
5
What is an efficient adjoint solver?
Speed & Scalability
Memory
Accuracy
Development Effort
6
High development effort slows down MDO studies
Speed & Scalability
Memory
Accuracy
Development Effort
To develop an adjoint solver, we need to:
Ø Understand primal code implementations (10K+ lines)
Ø Implement adjoint derivative computation (10K+ lines)
Ø Debug and test
7
Goal: Adjoint framework that needs minimal user input while compatible with any mesh, discipline, and code
Mesh Discipline Code
Structured &Unstructured
Aerodynamics,hydrodynamics, heattransfer,structures,multiphaseflow,combustion,radiation,andtheircoupling
CFD & CSDcodesinFortran,C,C++,Python, Matlab
8
Intermediate Step: An adjoint Framework fora Multiphysics CFD Package: OpenFOAM
Mesh Discipline Code
Structured &Unstructured
Aerodynamics,hydrodynamics, heattransfer,structures,radiation
OpenFOAM
Develop an adjoint solver with adding or modifying only O(100) lines of source code
9
Outline
Ø Introduction
Ø Adjoint framework
Ø Example of rapid adjoint development
Ø Demonstration1) Aerodynamic optimization for a low-speed UAV wing with
full and transitional turbulence2) Aerodynamic optimization for the CRM wing under
subsonic conditions3) Aerothermal optimization for a ribbed U bend channel4) Structural optimization for an engine fan
10
Central recipe: We divide adjoint implementations into solver-agnostic and solver-specific parts
AdjointImplementation
Solver-agnostic implementation
Solver-specific implementation
11
How to divide solver-agnostic and solver-specific?
𝑅 𝑤, 𝑥 = 0
𝑓 = 𝑓 𝑤, 𝑥
d𝑓d𝑥
=𝜕𝑓𝜕𝑥
+𝜕𝑓𝜕𝑤
d𝑤d𝑥
d𝑅d𝑥
=𝜕𝑅𝜕𝑥
+𝜕𝑅𝜕𝑤
d𝑤d𝑥
= 0
d𝑓d𝑥
=𝜕𝑓𝜕𝑥
−𝜕𝑓𝜕𝑤
𝜕𝑅𝜕𝑤
,-
./
𝜕𝑅𝜕𝑥
𝜕𝑅𝜕𝑤
0
𝜓 =𝜕𝑓𝜕𝑤
0
d𝑓d𝑥
=𝜕𝑓𝜕𝑥
− 𝜓0𝜕𝑅𝜕𝑥
Solver-specific part:Ø Elements in 𝑅 and 𝑤Ø Sparsity pattern for 𝜕𝑅/𝜕𝑤Ø Specific form for 𝑅(𝑤, 𝑥)
Solver-agnostic part:Ø Compute partial derivativesØ Solve the adjoint equations
12
Solver-agnostic implementation:
ØCompute partial derivatives
ØSolve the adjoint equations
13
We compute partial derivatives using finite-differencing, accelerated by a heuristic graph coloring scheme
With coloring, we reduce the number of function evaluations to O(1000), independent of the mesh size and CPU cores.
Example of Jacobian sparsity Example of graph coloring
14
We solve the adjoint equations using the GMRES method with a nested preconditioning strategy
𝜕𝑅𝜕𝑤
0𝜓 =
𝜕𝑓𝜕𝑤
0
15
Solver-specific part:
ØElements in 𝑅 and 𝑤
ØSparsity pattern for 𝜕𝑅/𝜕𝑤
ØSpecific form for 𝑅(𝑤, 𝑥)
16
We provide an object-oriented interface to specify residual functions and sparsity information
StateRegistry
regState(solver1)
regState(solver2)
..........
PhysicalModel
TurbulenceModel1
TurbulenceModel2
RadiationModel1
RadiationMode2
..........
Connectivity
conInfo(solver1)
conInfo(solver2)
..........
Derivative
calcRes(solver1)
calcRes(solver2)
..........
Register states Sparsity pattern Specify 𝑅(𝑤, 𝑥)
17
It is straightforward to register states and set connectivity
Incompressible NS equations:𝛻 ⋅ 𝑈 = 0
𝛻𝑈𝑈 +1𝜌𝛻𝑝 − 𝜈Δ𝑈 = 0
Codestoregisterstates:
Codestosetconnectivity:
Example of level-2 stencil
18
We can reuse existing high-level OpenFOAM codes to construct residual functions
Codestocomputeresiduals:
19
We have implemented five adjoint solvers with four turbulence models and one radiation model
Solvers Governing EquationssimpleFoam Incompressible NS equations
buoyantBoussinesqSimpleFoam Incompressible NS equations with heat transfer, buoyancy, and radiation
rhoSimpleFoam Compressible NS equations
buoyantSimpleFoam Compressible NS equations with heat transfer, buoyancy, and radiation
SolidDisplacementFoam Structural displacement equation
Turbulence Models DescriptionSpalartAllmaras Spalart Allmaras one equation model
kEpsilon 𝑘 − 𝜀 two equation model
kOmegaSST 𝑘 − 𝜔 SST two equation model
kOmegaSSTLM Langtry-Menter four equation transitional model based on kOmegaSST
Radiation Model DescriptionP1 Diffusion equation for incident radiation
20
Adjoint/flow runtime ratio less than 2, scaling well up to O(10) million cells and O(1000) CPU cores
Scalability using 10 million cells
21
Adjoint derivatives match the reference values and the averaged error is less than 0.1%
Solvers PhysicalModel Reference Adjoint ErrorsimpleFoam SpalartAllmaras -7.4041616e-4 -7.4052219e-4 0.013%
kEpsilon -7.5604973e-4 -7.5629115e-4 0.032%
kOmegaSST -7.2540944e-4 -7.2553310e-4 0.017%
kOmegaSSTLM -7.5552809e-4 -7.5561422e-4 0.010%
buoyantBoussinesqSimpleFoam
SpalartAllmaras -7.1222547e-4 -7.1232432e-4 0.014%
rhoSimpleFoam SpalartAllmaras -9.2285449e-4 -9.2236336e-4 0.053%
buoyantSimpleFoam SpalartAllmaras -8.7694514e-4 -8.7612072e-4 0.094%
buoyantBoussinesqSimpleFoam
P1 radiation -8.0862271e-2 -8.0171881e-2 0.853%
soildDisplacementFoam N/A 1.2844550e5 1.2857850e5 0.101%
22
Demonstration
1) Aerodynamic optimization for a low-speed UAV wing with full and transitional turbulence
2) Aerodynamic optimization for the CRM wing under subsonic conditions
3) Aerothermal optimization for a ribbed U bend channel
4) Structural optimization for an engine fan
23
1) Aerodynamic optimization for a low-speed UAV wing
Solver: simpleFoamGoverning equations: incompressible NS equations𝛻 ⋅ 𝑈 = 0
𝛻 ⋅ 𝑈𝑈 +1𝜌𝛻𝑝 − 𝛻 ⋅ 𝜏 = 0
Objectivefunctions:𝐶CDesignvariables#:127
(shape+twist+angle ofattack)
Constraints#:414
(lift+volume+thickness+LETE)
Mesh and FFD
24
Drag reduces by 5.6%
25
We achieve the desired elliptical lift distribution
26
Aerodynamic optimization for the low-speed UAV wing with turbulence transition
𝜕(𝑢E𝑘)𝜕𝑥E
− 𝑃G + 𝐷G −𝜕𝜕𝑥E
𝜈 + 𝜎G𝜈J𝜕𝑘𝜕𝑥E
= 0
𝜕(𝑢E𝜔)𝜕𝑥E
− 𝑃K + 𝐷K −𝜕𝜕𝑥E
𝜈 + 𝜎K𝜈J𝜕𝜔𝜕𝑥E
− 2 1 − 𝐹-𝜎KN𝜔
𝜕𝑘𝜕𝑥E
𝜕𝜔𝜕𝑥E
= 0
𝜕(𝑢E𝛾)𝜕𝑥E
− 𝑃P + 𝐷P −𝜕𝜕𝑥E
𝜈 +𝜈J𝜎Q
𝜕𝛾𝜕𝑥E
= 0
𝜕(𝑢E𝑅𝑒SJ)𝜕𝑥E
− 𝑃SJ −𝜕𝜕𝑥E
𝜎SJ 𝜈 + 𝜈J𝜕𝑅𝑒SJ𝜕𝑥E
= 0
Governing equations: Incompressible NS equationsTurbulence model: kOmegaSSTLM
Turbulent kinetic energy contour shows clear turbulence transition on both upper and lower surfaces of the wing
Transition locations
27
Drag reduces by 6.0%; we obtain the desired elliptical lift distribution and a slightly larger laminar region
28
2) Aerodynamic optimization for the CRM wing
Solver: rhoSimpleFoamGoverning equations: compressible NS equations:𝛻 ⋅ 𝜌𝑈 = 0𝛻 ⋅ 𝜌𝑈𝑈 + 𝛻𝑝 − 𝛻 ⋅ 𝜏 = 0𝛻 ⋅ 𝜌𝐸𝑈 + 𝛻 ⋅ 𝑝𝑈 − 𝛻 ⋅ (𝜏 ⋅ 𝑈) + 𝛻 ⋅ 𝑞 = 0
Objectivefunctions:𝐶CDesignvariables#:201
(shape+twist+angle ofattack)
Constraints#:770
(lift+volume+thickness+LETE)
Mesh and FFD for the CRM wing
29
Drag reduces by 5.0%
30
We achieve the desired elliptical lift distribution
31
3) Aerothermal optimization for a ribbed U bend channel
Solver: buoyantBoussinesqSimpleFoamGoverning equations: incompressible NS equations with buoyancy, heat transfer, and radiation𝛻 ⋅ 𝑈 = 0
𝛻 ⋅ 𝑈𝑈 +1𝜌𝛻𝑝 − 𝛻 ⋅ 𝜏 + 𝜌𝑔 = 0
𝛻 ⋅ 𝑈𝑇 + 𝛼 + 𝛼J ΔT −aG − E − 4e𝜎𝑇_
𝜌𝐶`= 0
𝛾Δ𝐺 − 𝑎𝐺 + 4e𝜎𝑇_ − 𝐸 = 0
U bend without ribs.We have 114 design variables
U bend with ribs.We have 145 design variables.
32
Simultaneously considering aerodynamics and heat transfer results in balanced designs
Weighted objective function: 𝑓 = 𝑤𝐶cd − (1 − 𝑤)𝑁𝑢f
Normalized Nusselt number: 𝑁𝑢f = gCh0i,0j Gklm
Normalized pressure loss: 𝐶cd =`mno,`mpqr
s.uvwmx
U bend without ribs U bend with ribs
33
We achieve simultaneous improvement inaerodynamics (11.7%) and heat transfer (13.0%)
Velocity at the symmetry plane Local Nusselt number
34
We achieve simultaneous improvement inaerodynamics (9.7%) and heat transfer (6.9%)
35
4) Structural optimization for an engine fan
Solver: solidDisplacementFoamGoverning equations:
𝜕N(𝜌𝑢)𝜕𝑡N
− 𝛻 ⋅ 𝜇𝛻𝑢 + 𝜇 𝛻𝑢 0 + 𝜆𝑡𝑟 𝛻𝑢 𝐼 − 𝜔×(𝜔×𝑟) = 0
Objectivefunctions:max-von-Mises
Designvariables#:60(shape)
Load:centrifugalforce
FFD for Rotor67
36
Max von Mises stress reduces by 13.5%
37
Summary
Ø The object-oriented framework allows us to develop an adjoint solver with adding or modifying only O(100) lines of source code.
Ø The developed adjoint solvers scale up to O(10) million cells and O(1000) CPU cores and the averaged derivative errors are less than 0.1%.
Ø The developed adjoint solvers enable us to perform optimization for a wide range of disciplines (aerodynamics, heat transfer, and structures) and conditions (incompressible, compressible, full and transitional turbulence).
Ø This framework has the potential of becoming a useful MDO tool for general engineering problems (aircraft, engines, cars, wind turbines, and ships).
38
Thank You!
Aerodynamics Heat transferStructures
We acknowledge computational resources obtained from XSEDE, which is supported by National Science Foundation Grant number ACI-1548562.