The Distributed and Unified Numerics Environment ( Dune ) and - - PowerPoint PPT Presentation

the distributed and unified numerics environment dune and
SMART_READER_LITE
LIVE PREVIEW

The Distributed and Unified Numerics Environment ( Dune ) and - - PowerPoint PPT Presentation

The Distributed and Unified Numerics Environment ( Dune ) and Applications Albert-Ludwigs-Universitt Freiburg Martin Nolte Sino-German Symposium on Modern Numerical Methods for Compressible Fluid Flows and Related Problems May 21 st 27 th ,


slide-1
SLIDE 1

The Distributed and Unified Numerics Environment (Dune) and Applications

Albert-Ludwigs-Universität Freiburg

Martin Nolte

Sino-German Symposium on Modern Numerical Methods for Compressible Fluid Flows and Related Problems May 21st–27th, 2014

slide-2
SLIDE 2

What is Dune?

“Dune is a modular toolbox for solving PDEs with grid-based methods.”

Web Page: www.dune-project.org

Sino-German Symposium 2014

  • M. Nolte – Dune and Applications

2 / 29

slide-3
SLIDE 3

Who is Dune?

Dune Developers

Aachen (Germany) Oliver Sander Bergen (Norway) Robert Klöfkorn Berlin (Germany) Carsten Gräser Freiburg (Germany) Christoph Gersbacher Martin Nolte Heidelberg (Germany) Peter Bastian Markus Blatt Münster (Germany) Christian Engwer Jorrit Fahlke Mario Ohlberger Stuttgart (Germany) Steffen Müthing Warwick (U.K.) Andreas Dedner

Sino-German Symposium 2014

  • M. Nolte – Dune and Applications

3 / 29

slide-4
SLIDE 4

Dune Design Goals

Flexibility: easily adapt the numerical code to (new) user problems, Efficiency: good performance of the compiled code, Modularity: independent pieces that can be plugged together. This is achieved in C++ through

  • bject orientation,

abstract (mathematical) interfaces, static polymorphism, template meta programming.

Sino-German Symposium 2014

  • M. Nolte – Dune and Applications

4 / 29

slide-5
SLIDE 5

The Dune Grid Interface

The Dune-Grid module defines a slim interface for (locally) adaptive, possibly non-conforming, parallel (based on domain decomposition), multi element type grids in arbitrary space dimensions. A (hierarchical) grid is seen as a parallel container of entities (points, lines, faces, elements, ...) endowed with a hierarchy.

Sino-German Symposium 2014

  • M. Nolte – Dune and Applications

5 / 29

slide-6
SLIDE 6

Implementations of the Dune Grid Interface

AlbertaGrid 1d–3d simplex grid in Rw (w = 1,...,9); bisection refinement ALUGrid parallel 3d grid; either hexahedra or tetrahedra; non-conforming “red” refinement; dynamic load balancing GeometryGrid Meta grid exchaning the geometric realization OneDGrid simple 1d grid; local refinement PrismGrid Meta grid taking product of host grid and a structured 1d grid SPGrid fast, parallel, Carteian grid in arbitrary dimension UGGrid parallel 2d and 3d grid; multiple geometry types; “red” refinement (also with “green” closure); dynamic load balancing

Sino-German Symposium 2014

  • M. Nolte – Dune and Applications

6 / 29

slide-7
SLIDE 7

Dune Reference Elements

Dune provides a predefined set of reference elements Rd for each dimension d ≥ 0. They are defined recursively over d: d = 0: We set R0 := {P}. d → d +1 : For R ∈ Rd we define: R◦: the pyramid over R, R|: the prism over R. We set Rd+1 := {R◦,R| |R ∈ Rd}. Notice: P◦ = P|.

3

(0,1,0)

2

(1,1,0) rear

3

bottom

4

l e f t

2

right

1

front

1

(1,0,0) (0,0,0)

4

(0,0,1)

2

(0,1,0)

5

(0,1,1) bottom

3

l e f t right

2 4

top

1

front

1

(1,0,0) (0,0,0)

3

(0,0,1)

4

(1,0,1)

2

(0,1,0)

3

bottom

1

l e f t right

2

front

1

(1,0,0) (0,0,0)

3

(0,0,1)

2

(0,1,0)

3

(1,1,0)

6

(0,1,1)

7

(1,1,1) rear

3

4

bottom l e f t

1

r i g h t

5

top

2

front

1

(1,0,0) (0,0,0)

4

(0,0,1)

5

(1,0,1)

Set of 3d reference elements

Sino-German Symposium 2014

  • M. Nolte – Dune and Applications

7 / 29

slide-8
SLIDE 8

Dune-Fem: Discretization of PDEs

Design Goals: map mathematical concepts one-to-one to C++ objects “seamless” parallelization hide unnecessary technical details (e.g., DoF numbering) high serial and parallel performance (HPC) Interfaces (and implementations) for grid functions (element-wise representation) discrete function spaces (finite basis + DoF mapper) discrete functions discrete (spatial) operators inverse operators (based, e.g., on Krylov methods) ODE solvers (e.g., SSP-RK)

Sino-German Symposium 2014

  • M. Nolte – Dune and Applications

8 / 29

slide-9
SLIDE 9

Parallel Efficiency of Dune-Fem

Strong Scaling for a DG-Navier-Stokes solver

Strong Scaling auf JUGENE (Jülich): P |G |/P N/P ¯ η S512→P E512→P 512 474.6 296.6k 46.22s — — 4 096 59.3 37.3k 6.29s 7.34 91% 32 768 7.4 4.6k 0.95s 48.71 76% 65 536 3.7 2.3k 0.50s 91.70 72%

P4 ansatz functions, expl. time discretization, SPGrid

P number of processor cores N global degrees of freedom ¯ η average run time per time step S512→P performance gain ( ¯

η512 ¯ ηP )

E512→P parallel efficiency (512

P S512→P)

results by R. Klöfkorn

Sino-German Symposium 2014

  • M. Nolte – Dune and Applications

9 / 29

slide-10
SLIDE 10

A Tsunami-Wave

Sino-German Symposium 2014

  • M. Nolte – Dune and Applications

10 / 29

slide-11
SLIDE 11

Meta Grids

Idea: Implement a Dune grid (meta grid) based on another Dune grid (host grid). With a meta grid we can ... ... easily extend the features of the host grid without changing it. ... speed up the host grid using structural assumptions. ... rapidly test interface changes or additions

Sino-German Symposium 2014

  • M. Nolte – Dune and Applications

11 / 29

slide-12
SLIDE 12

Meta Grids

SphereGrid: Tailoring Towards a Very Special Domain

Very Special Domain: S2 Problem: Using piecewice linear grid, even high order FEM discretizations are only 2nd order accurate due to geometry approximation. Solution: Use a meta grid to replace the geometric realization by spherical triangles.

Sino-German Symposium 2014

  • M. Nolte – Dune and Applications

12 / 29

slide-13
SLIDE 13

Meta Grids

SphereGrid: Tailoring Towards a Very Special Domain

Example: Poisson’s equation on the Sphere −∆Γu = f

  • n S2.

Convergence of Pk-Lagrange finite elements on AlbertaGrid and SphereGrid< AlbertaGrid >:

AlbertaGrid, P2 SphereGrid, P2 AlbertaGrid, P3 SphereGrid, P3 lvl L2-error EOC L2-error EOC L2-error EOC L2-error EOC 3.5·101 — 3.0·100 — 3.6·101 — 1.1·102 — 1 1.7·101 1.08 1.8·101 −2.57 1.4·100 4.66 6.3·100 4.07 2 8.1·10−1 4.37 7.1·10−1 4.63 5.1·10−1 1.48 2.3·10−1 4.80 3 1.4·10−1 2.56 1.4·10−1 2.41 9.2·10−2 2.48 3.0·10−2 2.89 4 2.9·10−2 2.23 1.9·10−2 2.80 2.4·10−2 1.92 2.3·10−3 3.75 5 6.5·10−3 2.16 2.8·10−3 2.81 6.1·10−3 2.00 1.4·10−4 4.06 6 1.6·10−3 2.07 3.6·10−4 2.93 1.5·10−3 2.00 8.3·10−6 4.03 7 3.8·10−4 2.02 4.6·10−5 2.98 3.8·10−4 2.00 5.1·10−7 4.01

Sino-German Symposium 2014

  • M. Nolte – Dune and Applications

13 / 29

slide-14
SLIDE 14

Meta Grid Example: PrismGrid

Idea: Meta grid formed by the tensor product of a host grid (nd) with a 1d grid Advantages: efficient iterators for additional (structured) direction

  • nly entities for host grid

be stored in memory

Sino-German Symposium 2014

  • M. Nolte – Dune and Applications

14 / 29

slide-15
SLIDE 15

Example: Heat Flow on a Moving Surface

Let Γ(t) be a moving, closed surface (e.g., a deformation of S2). Problem for Heat Equation: ˙ u +u∇Γ ·w −∇Γ ·(D∇Γu) = 0 in Γ(·)×]0,T[ u(·,0) = u0 in Γ(0) w: domain velocity Galerkin Approximation: Find u(t) ∈ XG (t) ⊂ H1(ΓG (t)) such that ∂t

  • ΓG (t) u(t)ϕ(t)+
  • ΓG (t) D∇ΓG u(t)·∇ΓG ϕ(t) =
  • ΓG (t) u(t) ˙

ϕ(t) for all ϕ(t) ∈ XG (t).

Sino-German Symposium 2014

  • M. Nolte – Dune and Applications

15 / 29

slide-16
SLIDE 16

Example: Heat Flow on a Moving Surface

Reference domain: ˆ Ω Moving domain: Ω(t) = A (ˆ Ω,t) Domain velocity: w(·,t) = At(A (·,t)−1,t) Idea: Use any Dune grid to model ˆ Ω. Use a GeometryGrid and the mapping A (·,t) to model Ω(t). Advantages: No changes to the host grid (representing ˆ Ω) No changes to our discretization

Sino-German Symposium 2014

  • M. Nolte – Dune and Applications

16 / 29

slide-17
SLIDE 17

Example: Heat Flow on Moving Mesh

Anisotropic heat equation on a moving domain

Sino-German Symposium 2014

  • M. Nolte – Dune and Applications

17 / 29

slide-18
SLIDE 18

Compression in a Two-Stroke Engine

Sino-German Symposium 2014

  • M. Nolte – Dune and Applications

18 / 29

slide-19
SLIDE 19

The Moving Piston

GeometryGrid<FilteredGrid<SPGrid» FilteredGrid<SPGrid> SPGrid

b(t) b(t) b(t)

1 Construct a stack of meta-grids on top of a structured grid

implementation (SPGrid).

2 FilteredGrid enables us to filter out elements not

intersection Ωt from the host grid.

3 Using GeometryGrid, we adapt the geometry of boundary

elements to the exact boundary ∂Ωt.

4 ALE formulation to treat boundary cells correctly

Sino-German Symposium 2014

  • M. Nolte – Dune and Applications

19 / 29

slide-20
SLIDE 20

The Moving Piston

Solver properties: P4 compact DG solver (CDG2) 3rd order semi-implicit ODE solver limiter-based stabilition dimension-independent code

Sino-German Symposium 2014

  • M. Nolte – Dune and Applications

20 / 29

slide-21
SLIDE 21

Validation: Fluid Flow in a Moving Domain

Compressible Euler Equations in time-dependent domain: Ωt =]0,b(t)[×]0,1[, b(t) = 0.9+0.1 sin(10π t) Initial data: (ρ, v,p) =

  • ( 4

3, 35 99, 3 2),

x < 0.5, (1,0,1), x > 0.5. Boundary condition on the moving boundary b(t)×]0,1[:   ρout

  • vout

pout   =   ρin

  • vin −2
  • vin ·ν − ˙

b(t)

  • ν

pin  .

  • A. Chertock and A. Kurganov. A simple Eulerian finite volume method for compressible

fluids in domains with moving boundaries. Commun. Math. Sci., 6(3):531–556, 2008

Sino-German Symposium 2014

  • M. Nolte – Dune and Applications

21 / 29

slide-22
SLIDE 22

Validation: Fluid Flow in a Moving Domain

Sino-German Symposium 2014

  • M. Nolte – Dune and Applications

22 / 29

slide-23
SLIDE 23

Anisotropic Discretization

Consider Shallow-Water flow around a cylindical obstacle

❥ ✛ ✲

200m

✻ ❄

20m Upper and lower boundaries are rigid walls Inflow at left boundary Outflow at right boundary Initial data: (h0,u0,v0) ≡ (3,2,0)

results by Ch. Gersbacher

Sino-German Symposium 2014

  • M. Nolte – Dune and Applications

23 / 29

slide-24
SLIDE 24

Embedding of 1d SWE into 2d SWE

2d shallow water equations: ∂th+∂x(hu)+∂y(hv) = 0 ∂t(hu)+∂x(hu2 + g

2h2)+∂y(huv) = 0

∂t(hv)+∂x(huv)+∂y(hv2 + g

2h2) = 0

Add auxilliary variable to 1d shallow water equations: hv = 0 In 1d regions, solve solve 2d shallow water equations with only hv = 0 as ansatz functions.

Sino-German Symposium 2014

  • M. Nolte – Dune and Applications

24 / 29

slide-25
SLIDE 25

Anisotropic Discretization

Sino-German Symposium 2014

  • M. Nolte – Dune and Applications

25 / 29

slide-26
SLIDE 26

Outlook: High-Dimensional Control Problems

Trivial example (no constraints on the control space): minimize J(y,u) =

T

0 |y(t)|2 +|u(t)|2 dt

subject to y′(t) = y(t)+u(t), y(0) = x Let yu,x be the solution of the ODE. Value Function: v(x,t) = minu J(yu,x,u) Hamilton-Jacobi-Bellman equation: −∂tv +|∇v|2 −|x +∇v|2 = 0 v(·,T) = 0

Sino-German Symposium 2014

  • M. Nolte – Dune and Applications

26 / 29

slide-27
SLIDE 27

Outlook: High-Dimensional Control Problems

Solver Properties: discontinuous Galerkin scheme (Yan, Osher, 2011) based on “standard” numerical Hamiltonians (here: Lax-Friedrichs) no requirements on the grid dimension-independent code in general, higher order needs stabilization

Sino-German Symposium 2014

  • M. Nolte – Dune and Applications

27 / 29

slide-28
SLIDE 28

Outlook: High-Dimensional Control Problems

Example: 6d P0-solution on Cartesian grid (≈ 24 mio. cells)

0.05 0.1 0.15 0.2 0.25 1 2 3 4 5 y t Approximate Trajectory Exact Trajectory

Optimal Trajectory

  • 0.8
  • 0.6
  • 0.4
  • 0.2

0.2 0.4 1 2 3 4 5 y t Approximate Control Exact Control

Optimal Control

Sino-German Symposium 2014

  • M. Nolte – Dune and Applications

28 / 29

slide-29
SLIDE 29

Summary

Abstract interfaces allow for effective reuse of code. We have a common language to talk about code: mathematics. Despite being generic, the code is efficient in serial and parallel. A wide range of PDE’s and numerical schemes can be handled.

Sino-German Symposium 2014

  • M. Nolte – Dune and Applications

29 / 29