23
Adjoint theory & Solver in OpenFOAM GERMAN OPENFOAM USER MEETING 2017 CHRISTOS KAPELLOS [email protected] TU BRAUNSCHWEIG, 21.03.2017

Adjoint theory & Solver in OpenFOAM - foamacademy.com · Adjoint theory & Solver in OpenFOAM GERMAN OPENFOAM USER MEETING 2017 CHRISTOS KAPELLOS [email protected] TU

  • Upload
    others

  • View
    97

  • Download
    10

Embed Size (px)

Citation preview

Page 1: Adjoint theory & Solver in OpenFOAM - foamacademy.com · Adjoint theory & Solver in OpenFOAM GERMAN OPENFOAM USER MEETING 2017 CHRISTOS KAPELLOS christos.kapellos@volkswagen.de TU

Adjoint theory & Solver in OpenFOAM GERMAN OPENFOAM USER MEETING 2017

CHRISTOS KAPELLOS [email protected] TU BRAUNSCHWEIG, 21.03.2017

Page 2: Adjoint theory & Solver in OpenFOAM - foamacademy.com · Adjoint theory & Solver in OpenFOAM GERMAN OPENFOAM USER MEETING 2017 CHRISTOS KAPELLOS christos.kapellos@volkswagen.de TU

2 Group Research| Vehicle & Electronics| Vehicle Technology / CAE Methods (K-GERFG/V) | Christos Kapellos

AGENDA

• Adjoint theory: • Numerical Optimisation • Why do we need the adjoints? • Continuous adjoint formulation

• OpenFOAM Adjoint Solver:

• Our baseline: adjointShapeOptimizationFoam (version 2.3.1) • Enhance the code • Applications:

• pitzDaily • Airfoil 2D

Page 3: Adjoint theory & Solver in OpenFOAM - foamacademy.com · Adjoint theory & Solver in OpenFOAM GERMAN OPENFOAM USER MEETING 2017 CHRISTOS KAPELLOS christos.kapellos@volkswagen.de TU

3 Group Research| Vehicle & Electronics| Vehicle Technology / CAE Methods (K-GERFG/V) | Christos Kapellos

INTRODUCTION

• Find the minimum of f(x)

• Analytical expression

• Here: 𝛻𝛻𝑓𝑓 = 2𝑥𝑥 , 𝑥𝑥𝑚𝑚𝑚𝑚𝑚𝑚 = 0

NUMERICAL OPTIMISATION

Page 4: Adjoint theory & Solver in OpenFOAM - foamacademy.com · Adjoint theory & Solver in OpenFOAM GERMAN OPENFOAM USER MEETING 2017 CHRISTOS KAPELLOS christos.kapellos@volkswagen.de TU

4 Group Research| Vehicle & Electronics| Vehicle Technology / CAE Methods (K-GERFG/V) | Christos Kapellos

INTRODUCTION

x0

𝜵𝜵𝒇𝒇

x1

f0

f1

𝜵𝜵𝒇𝒇

x2

f2

f3

x3

• In the computational world the analytic functions are not known

• A simulation is a black box with specific inputs and outputs (i.e. Input: Car geometry, flow conditions – Output: Flow field, drag force)

• To optimise an output (Objective Function) with respect to an input (Design Variables) we need the gradient

NUMERICAL OPTIMISATION

• An accurate and fast way to compute the gradient is needed!!

• A way is with Finite Differences: 𝑑𝑑𝑓𝑓𝑑𝑑𝑥𝑥 =

𝑓𝑓+ − 𝑓𝑓−𝑥𝑥+ − 𝑥𝑥−

Page 5: Adjoint theory & Solver in OpenFOAM - foamacademy.com · Adjoint theory & Solver in OpenFOAM GERMAN OPENFOAM USER MEETING 2017 CHRISTOS KAPELLOS christos.kapellos@volkswagen.de TU

5 Group Research| Vehicle & Electronics| Vehicle Technology / CAE Methods (K-GERFG/V) | Christos Kapellos

ADJOINT METHOD

• Primal Equations • Objective Function • Differentiation of these:

INTRODUCTION

Page 6: Adjoint theory & Solver in OpenFOAM - foamacademy.com · Adjoint theory & Solver in OpenFOAM GERMAN OPENFOAM USER MEETING 2017 CHRISTOS KAPELLOS christos.kapellos@volkswagen.de TU

6 Group Research| Vehicle & Electronics| Vehicle Technology / CAE Methods (K-GERFG/V) | Christos Kapellos

ADJOINT METHOD

• Direct Problem

• Adjoint Problem

INTRODUCTION

Page 7: Adjoint theory & Solver in OpenFOAM - foamacademy.com · Adjoint theory & Solver in OpenFOAM GERMAN OPENFOAM USER MEETING 2017 CHRISTOS KAPELLOS christos.kapellos@volkswagen.de TU

7 Group Research| Vehicle & Electronics| Vehicle Technology / CAE Methods (K-GERFG/V) | Christos Kapellos

CONTINUOUS ADJOINT FORMULATION

• Navier-Stokes Equations:

• Generic objective Function

• Augmented objective functions

Page 8: Adjoint theory & Solver in OpenFOAM - foamacademy.com · Adjoint theory & Solver in OpenFOAM GERMAN OPENFOAM USER MEETING 2017 CHRISTOS KAPELLOS christos.kapellos@volkswagen.de TU

8 Group Research| Vehicle & Electronics| Vehicle Technology / CAE Methods (K-GERFG/V) | Christos Kapellos

CONTINUOUS ADJOINT FORMULATION

• Differentiation of the augmented function: • where:

Page 9: Adjoint theory & Solver in OpenFOAM - foamacademy.com · Adjoint theory & Solver in OpenFOAM GERMAN OPENFOAM USER MEETING 2017 CHRISTOS KAPELLOS christos.kapellos@volkswagen.de TU

9 Group Research| Vehicle & Electronics| Vehicle Technology / CAE Methods (K-GERFG/V) | Christos Kapellos

CONTINUOUS ADJOINT FORMULATION

• Product Rule:

• Green-Gauss theorem:

Page 10: Adjoint theory & Solver in OpenFOAM - foamacademy.com · Adjoint theory & Solver in OpenFOAM GERMAN OPENFOAM USER MEETING 2017 CHRISTOS KAPELLOS christos.kapellos@volkswagen.de TU

10 Group Research| Vehicle & Electronics| Vehicle Technology / CAE Methods (K-GERFG/V) | Christos Kapellos

CONTINUOUS ADJOINT FORMULATION

• Applying these rules:

Page 11: Adjoint theory & Solver in OpenFOAM - foamacademy.com · Adjoint theory & Solver in OpenFOAM GERMAN OPENFOAM USER MEETING 2017 CHRISTOS KAPELLOS christos.kapellos@volkswagen.de TU

11 Group Research| Vehicle & Electronics| Vehicle Technology / CAE Methods (K-GERFG/V) | Christos Kapellos

CONTINUOUS ADJOINT FORMULATION

• Applying these rules:

Page 12: Adjoint theory & Solver in OpenFOAM - foamacademy.com · Adjoint theory & Solver in OpenFOAM GERMAN OPENFOAM USER MEETING 2017 CHRISTOS KAPELLOS christos.kapellos@volkswagen.de TU

12 Group Research| Vehicle & Electronics| Vehicle Technology / CAE Methods (K-GERFG/V) | Christos Kapellos

,

“Adjoint Methods for Turbulent Flows, Applied to Shape or Topology

Optimization and Robust Design”, E. Papoutsis-Kiachagias, PhD Thesis

Page 13: Adjoint theory & Solver in OpenFOAM - foamacademy.com · Adjoint theory & Solver in OpenFOAM GERMAN OPENFOAM USER MEETING 2017 CHRISTOS KAPELLOS christos.kapellos@volkswagen.de TU

13 Group Research| Vehicle & Electronics| Vehicle Technology / CAE Methods (K-GERFG/V) | Christos Kapellos

CONTINUOUS ADJOINT FORMULATION

• Field Adjoint Equations

Page 14: Adjoint theory & Solver in OpenFOAM - foamacademy.com · Adjoint theory & Solver in OpenFOAM GERMAN OPENFOAM USER MEETING 2017 CHRISTOS KAPELLOS christos.kapellos@volkswagen.de TU

14 Group Research| Vehicle & Electronics| Vehicle Technology / CAE Methods (K-GERFG/V) | Christos Kapellos

CONTINUOUS ADJOINT FORMULATION

• Boundary conditions at inlet:

Page 15: Adjoint theory & Solver in OpenFOAM - foamacademy.com · Adjoint theory & Solver in OpenFOAM GERMAN OPENFOAM USER MEETING 2017 CHRISTOS KAPELLOS christos.kapellos@volkswagen.de TU

15 Group Research| Vehicle & Electronics| Vehicle Technology / CAE Methods (K-GERFG/V) | Christos Kapellos

CONTINUOUS ADJOINT FORMULATION

• Boundary condition at outlet:

Page 16: Adjoint theory & Solver in OpenFOAM - foamacademy.com · Adjoint theory & Solver in OpenFOAM GERMAN OPENFOAM USER MEETING 2017 CHRISTOS KAPELLOS christos.kapellos@volkswagen.de TU

16 Group Research| Vehicle & Electronics| Vehicle Technology / CAE Methods (K-GERFG/V) | Christos Kapellos

CONTINUOUS ADJOINT FORMULATION

• Boundary condition at walls:

Page 17: Adjoint theory & Solver in OpenFOAM - foamacademy.com · Adjoint theory & Solver in OpenFOAM GERMAN OPENFOAM USER MEETING 2017 CHRISTOS KAPELLOS christos.kapellos@volkswagen.de TU

17 Group Research| Vehicle & Electronics| Vehicle Technology / CAE Methods (K-GERFG/V) | Christos Kapellos

• Sensitivity derivatives:

Page 18: Adjoint theory & Solver in OpenFOAM - foamacademy.com · Adjoint theory & Solver in OpenFOAM GERMAN OPENFOAM USER MEETING 2017 CHRISTOS KAPELLOS christos.kapellos@volkswagen.de TU

18 Group Research| Vehicle & Electronics| Vehicle Technology / CAE Methods (K-GERFG/V) | Christos Kapellos

CONTINUOUS ADJOINT FORMULATION

• Navier-Stokes for topology optimisation:

• Extra “porosity” term:

TOPOLOGY OPTIMISATION

Page 19: Adjoint theory & Solver in OpenFOAM - foamacademy.com · Adjoint theory & Solver in OpenFOAM GERMAN OPENFOAM USER MEETING 2017 CHRISTOS KAPELLOS christos.kapellos@volkswagen.de TU

19 Group Research| Vehicle & Electronics| Vehicle Technology / CAE Methods (K-GERFG/V) | Christos Kapellos

CONTINUOUS ADJOINT FORMULATION

• Field adjoint equations with porosity:

• Sensitivities wrt. porosity:

TOPOLOGY OPTIMISATION

Page 20: Adjoint theory & Solver in OpenFOAM - foamacademy.com · Adjoint theory & Solver in OpenFOAM GERMAN OPENFOAM USER MEETING 2017 CHRISTOS KAPELLOS christos.kapellos@volkswagen.de TU

20 Group Research| Vehicle & Electronics| Vehicle Technology / CAE Methods (K-GERFG/V) | Christos Kapellos

APPLICATIONS

• Objective Function: Power Losses

• Field Adjoint Equations

PITZ DAILY

Page 21: Adjoint theory & Solver in OpenFOAM - foamacademy.com · Adjoint theory & Solver in OpenFOAM GERMAN OPENFOAM USER MEETING 2017 CHRISTOS KAPELLOS christos.kapellos@volkswagen.de TU

21 Group Research| Vehicle & Electronics| Vehicle Technology / CAE Methods (K-GERFG/V) | Christos Kapellos

APPLICATIONS

• Inlet boundary condition:

• Outlet boundary condition:

• Sensitivity derivatives:

PITZ DAILY

Page 22: Adjoint theory & Solver in OpenFOAM - foamacademy.com · Adjoint theory & Solver in OpenFOAM GERMAN OPENFOAM USER MEETING 2017 CHRISTOS KAPELLOS christos.kapellos@volkswagen.de TU

22 Group Research| Vehicle & Electronics| Vehicle Technology / CAE Methods (K-GERFG/V) | Christos Kapellos

APPLICATIONS

• Objective Function: Drag

• Field Adjoint Equations

2D AIRFOIL

Page 23: Adjoint theory & Solver in OpenFOAM - foamacademy.com · Adjoint theory & Solver in OpenFOAM GERMAN OPENFOAM USER MEETING 2017 CHRISTOS KAPELLOS christos.kapellos@volkswagen.de TU

23 Group Research| Vehicle & Electronics| Vehicle Technology / CAE Methods (K-GERFG/V) | Christos Kapellos

APPLICATIONS

• Wall boundary condition:

• Outlet boundary condition:

• Sensitivity derivatives:

2D AIRFOIL