Automatic di erentiation of a uid-structure interaction ... · PDF fileAutomatic di...

23
Automatic differentiation of a fluid-structure interaction problem Gabriel Balaban, Anders Logg, Marie E. Rognes Simula Research Laboratory University of Oslo FEniCS Worksop 2013, Cambridge 2013–03–18 March 20, 2013

Transcript of Automatic di erentiation of a uid-structure interaction ... · PDF fileAutomatic di...

Page 1: Automatic di erentiation of a uid-structure interaction ... · PDF fileAutomatic di erentiation of a uid-structure interaction problem Gabriel Balaban, Anders Logg, Marie E. Rognes

Automatic differentiation of a fluid-structure interaction problemGabriel Balaban, Anders Logg,Marie E. Rognes Simula Research LaboratoryUniversity of Oslo FEniCS Worksop 2013, Cambridge 2013–03–18

March 20, 2013

Page 2: Automatic di erentiation of a uid-structure interaction ... · PDF fileAutomatic di erentiation of a uid-structure interaction problem Gabriel Balaban, Anders Logg, Marie E. Rognes

Examples of Fluid–structure interaction

Modelling Challenges

I model must integrate solid and fluid mechanics

I fluid geometry depends on structure deformation

Page 3: Automatic di erentiation of a uid-structure interaction ... · PDF fileAutomatic di erentiation of a uid-structure interaction problem Gabriel Balaban, Anders Logg, Marie E. Rognes

Solving the FSI problem

Issues:

I Continuum mechanics formulation

I Partitioned vs monolithic

I Fixed-pointed vs Newton

I Approximation of the Jacobian

In this work we:

I derive a Newton’s method with exact Jacobians for FSIproblems using the arbitrary Lagrangian Eulerianformulation

I implement a monolithic solver in Python (using FEniCS)

I investigate various optimizations and simplifications

Page 4: Automatic di erentiation of a uid-structure interaction ... · PDF fileAutomatic di erentiation of a uid-structure interaction problem Gabriel Balaban, Anders Logg, Marie E. Rognes

Setup of the FSI problem

ΩF

ωF (t)

ΩS

ωS(t)

UF

uF

dS

t=

0DS

Page 5: Automatic di erentiation of a uid-structure interaction ... · PDF fileAutomatic di erentiation of a uid-structure interaction problem Gabriel Balaban, Anders Logg, Marie E. Rognes

Mismatch in standard fluid and solid models

ρSD

S−Div Σ

S(D

S) = B

S

ρF

(uF

+ grad uF· u

F) − div σ

F= b

F

div uF

= 0

Page 6: Automatic di erentiation of a uid-structure interaction ... · PDF fileAutomatic di erentiation of a uid-structure interaction problem Gabriel Balaban, Anders Logg, Marie E. Rognes

Mesh smoothing problem

Mesh equationD

M−Div Σ

M(D

M) = 0

Page 7: Automatic di erentiation of a uid-structure interaction ... · PDF fileAutomatic di erentiation of a uid-structure interaction problem Gabriel Balaban, Anders Logg, Marie E. Rognes

Arbitrary Lagrangian-Eulerian framework

u(x(X , t), t)

ALE time derivative:

d

dt(ρu) = ρu + ρ (grad u· (u − D

M))

ALE fluid equation:

ρF

(uF

+ grad uF· (u

F− D

M)) − div σ

F(u

F, p

F) = b

Fin ω

F(t)

div uF

= 0 in ωF

(t)

Page 8: Automatic di erentiation of a uid-structure interaction ... · PDF fileAutomatic di erentiation of a uid-structure interaction problem Gabriel Balaban, Anders Logg, Marie E. Rognes

Interface conditions

ΓFS

γFS

(t)

I Stress continuity:

σS· n = σ

F· n on γ

FS(t)

I Kinematic continuity:

uF

= uS

on γFS

(t)

I Domain continuity:

dM

= dS

on γFS

(t)

Page 9: Automatic di erentiation of a uid-structure interaction ... · PDF fileAutomatic di erentiation of a uid-structure interaction problem Gabriel Balaban, Anders Logg, Marie E. Rognes

Linearization of the FSI problem

Two challenges:

I Derivative of fluid equation with respect to geometry?

ddt (ρu) − div σ

F(u

F, p

F) = b

Fin ω

F(t)

div uF

= 0 in ωF

(t)

I Linearization of essential BCs

uF

= uS

on γFS

(t)

dM

= dS

on γFS

(t)

Page 10: Automatic di erentiation of a uid-structure interaction ... · PDF fileAutomatic di erentiation of a uid-structure interaction problem Gabriel Balaban, Anders Logg, Marie E. Rognes

The reference domain approach

I Map the fluid problem to the reference domain

I Use standard techniques to differentiate

I Straightforward but tedious

I Can be automated!

Page 11: Automatic di erentiation of a uid-structure interaction ... · PDF fileAutomatic di erentiation of a uid-structure interaction problem Gabriel Balaban, Anders Logg, Marie E. Rognes

Navier–Stokes pulled back to reference domain

I Equation:

ρFJM

(UF

+ Grad UF· F−1

M· (U

F− D

M)) −Div Σ

F= B

F

Div (JMF−1

M· U

F) = 0

I Pulled-back fluid stress:

ΣF

= JM

F(Grad U

F· F−1

M+ F−>

M·Grad U>

F) − P

FI)·F−>

M

Page 12: Automatic di erentiation of a uid-structure interaction ... · PDF fileAutomatic di erentiation of a uid-structure interaction problem Gabriel Balaban, Anders Logg, Marie E. Rognes

Interface conditions: How to linearize?

ΓFS

γFS

(t)

Stress continuity:

ΣS· N = Σ

F· N on Γ

FS

Kinematic continuity:

UF

= US

on ΓFS

Domain continuity:D

M= D

Son Γ

FS

Page 13: Automatic di erentiation of a uid-structure interaction ... · PDF fileAutomatic di erentiation of a uid-structure interaction problem Gabriel Balaban, Anders Logg, Marie E. Rognes

Linearization of essential boundary conditions

Introduce Lagrange multipliers (τF, τ

M) and corresponding trial

functions (χF, χ

M)

Kinematic continuity:

UF− U

SτF Γ

FS+ χ

FvF Γ

FS

Domain continuity:

DM− D

SτM Γ

FS+ χ

MvM Γ

FS

Page 14: Automatic di erentiation of a uid-structure interaction ... · PDF fileAutomatic di erentiation of a uid-structure interaction problem Gabriel Balaban, Anders Logg, Marie E. Rognes

The linearized FSI operator (the Jacobian)

Page 15: Automatic di erentiation of a uid-structure interaction ... · PDF fileAutomatic di erentiation of a uid-structure interaction problem Gabriel Balaban, Anders Logg, Marie E. Rognes

FEniCS implementation

J = derivative(R, U)

Page 16: Automatic di erentiation of a uid-structure interaction ... · PDF fileAutomatic di erentiation of a uid-structure interaction problem Gabriel Balaban, Anders Logg, Marie E. Rognes

An analytic test problem

pdf/pdf/analyticproblem.pdftexPrimary variables:

UF

= y(1 − y) sin t

PF

= 2C sin t(1 − x − Cxy(1 − y)(1 − cos t))

DS

= Cy(1 − y)(1 − cos t)

US

= Cy(1 − y) sin t

DM

= Cxy(1 − y)(1 − cos t)

Page 17: Automatic di erentiation of a uid-structure interaction ... · PDF fileAutomatic di erentiation of a uid-structure interaction problem Gabriel Balaban, Anders Logg, Marie E. Rognes

Convergence for analytic test problem

10-210-1100

mesh size hmin

10-9

10-8

10-7

10-6

10-5

10-4

10-3

10-2L2

err

or

0.99

2.002.67

PF

DS

DF

UF

Page 18: Automatic di erentiation of a uid-structure interaction ... · PDF fileAutomatic di erentiation of a uid-structure interaction problem Gabriel Balaban, Anders Logg, Marie E. Rognes

A two-dimensional blood vessel

Page 19: Automatic di erentiation of a uid-structure interaction ... · PDF fileAutomatic di erentiation of a uid-structure interaction problem Gabriel Balaban, Anders Logg, Marie E. Rognes

Break-down of run-time

Problem Routine Calls Time (s)Analytic problem Jacobian assembly 28 83.9s 90%mesh size = 231 Linear solve 28 1.86s 2%time steps = 10 Residual assembly 38 0.915s 1%

Blood vessel Jacobian assembly 343 2980s 81%mesh size = 1271 Linear solve 343 254s 18%time steps = 140 Residual assembly 483 64.1s 1%

Page 20: Automatic di erentiation of a uid-structure interaction ... · PDF fileAutomatic di erentiation of a uid-structure interaction problem Gabriel Balaban, Anders Logg, Marie E. Rognes

Effect of Jacobian reuse

Problem Routine CallsAnalytic problem Jacobian assembly 1 (-27) -95 %mesh size = 231 Linear solve 51 (+23) -96%time steps = 10 Residual assembly 61 (+23) +54%

Total Runtime: -93 %

Blood vessel Jacobian assembly 25 (-308) -93 %mesh size = 1271 Linear solve 1287 (+944) -92 %time steps = 140 Residual assembly 1427 (+944) +192%

Total -91 %

Page 21: Automatic di erentiation of a uid-structure interaction ... · PDF fileAutomatic di erentiation of a uid-structure interaction problem Gabriel Balaban, Anders Logg, Marie E. Rognes

Effect of Jacobian reuse

0 10 20 30 40 50 60 70time

0

5

10

15

20

25

30

35Nu

mbe

r of I

tera

tions

Newton Iterations per time step

Page 22: Automatic di erentiation of a uid-structure interaction ... · PDF fileAutomatic di erentiation of a uid-structure interaction problem Gabriel Balaban, Anders Logg, Marie E. Rognes

Optimization summary

Jacobian Reuse

Jacobian Simplification

Jacobian Buffering

ReducedQuadratureOrder

Optimization Runtime Memory Robustness

Page 23: Automatic di erentiation of a uid-structure interaction ... · PDF fileAutomatic di erentiation of a uid-structure interaction problem Gabriel Balaban, Anders Logg, Marie E. Rognes

Summary: How to use the automatic derivative to solveFSI problems

I Map the fluid equation to thereference domain

I Impose essential BC’s usingLagrange multipliers

I Let the automatic derivativecompute the Jacobian

Challenges / work in progress:

I Long FFC compilation times

I Preconditioning