Compact AMR schemes for Conservation Laws Erwan Deriaz Équipe Plasmas Chauds Institut Jean Lamour (Nancy), CNRS / Université de Lorraine Projet ANR Vlasix Avec: Nicolas Besse 1 , Stéphane Colombi 2 , Thierry Sousbie 2

CANUM 2016 Obernai – 9-13 mai 2016

1. Observatoire de Nice 2. Institut d’Astrophysique de Paris

Compact AMR schemes for Conservation Laws

Plan

1 Introduction-Motivations

2 Refinement filters and scaling functions

3 Mass conservation issues

4 Numerical experiments

Compact AMR schemes for Conservation Laws Introduction-Motivations

Vlasov-Poisson equations

Distribution function f : R2d +1 → R+ , (t, x, v) 7→ f (t, x, v) ∂t f + v · ∇x f + F (t, x) · ∇v f = 0

(1)

with Z ∆x φ(t, x) =

F (t, x) = ±∇x φ(t, x), Z f (t, x, v)d v − f (t, x, v)d v d x. v∈Rd

x,v∈Rd

(2) (3)

Compact AMR schemes for Conservation Laws Introduction-Motivations

Interaction of two Plummer models

z y

v=(0.3,0,0) x=(−6,0,−2) v=(0,0.3,0) x=(0,−6,2)

x

Compact AMR schemes for Conservation Laws Introduction-Motivations

Collision of two Plummer : 3D-3V, 3D-view

Compact AMR schemes for Conservation Laws Introduction-Motivations

Cut in phase space 5126 uniform grid equivalent accuracy

(z,w) at max

cut in (z,w) at zero

grid in (z,w) at zero

Compact AMR schemes for Conservation Laws Introduction-Motivations

Collision of two Plummer : 3D-3V for t ∈ [0, 21.7], number of time steps : 695 max number of points : 3,000,000,000 (on Curie supercomputer at IDRIS, Extra Large Node with 512 GB main memory). 1.18

5.0e+09

1.16

4.5e+09

1.14

4.0e+09

Mass

1.08 1.06

mem

3.5e+09

efficiency

1.10

number of points

S

1.12

relative quantities

0.73

efficiency 3.0e+09 2.5e+09 2.0e+09

1.04

Max

L2−norm

nb of pts

1.5e+09

1.02

1.0e+09

1.00

5.0e+08

0.98

0.66

0.0e+00

0

5

10

15

time

conservations

20

25

0

5

10

15

time

point storage efficiency

20

25

Compact AMR schemes for Conservation Laws Introduction-Motivations

Application to plasma physics : Bump-on-Tail in 1D-1V

Simulation box : (x, v ) ∈ [− 10 π, 3

10 π] 3

× [−10, 10]

Initial condition Bump-on-Tail : 0.2 −4(v −4.5)2 0.9 − v22 f0 (x, v ) = √ e +√ e . 2π 2π

Compact AMR schemes for Conservation Laws Introduction-Motivations

1D-1V

distribution function

grid

Compact AMR schemes for Conservation Laws Introduction-Motivations

1D-1V 0.6

uniform grid AMR grid 0.5

0.4

0.3

0.2

0.1

0.0 0

10

20

30

40

50

60

70

80

90

100

Figure: Plots of the maximum absolute value of the field E for two instances of the bump-on-tail instability : with an uniform grid and with an AMR grid.

Compact AMR schemes for Conservation Laws Introduction-Motivations

1D-1V 0.01

energy max

0.00 −0.01

mass

−0.02 −0.03

min −0.04 −0.05 −0.06 −0.07 −0.08 −0.09 0

10

20

30

40

50

60

70

80

90

100

Figure: Relative variations (∆f /f ) for the mass, the total energy and the maximum value of the distribution function. These should remain constant. For visualization purpose, the mass variation was multiplied by ten.

Compact AMR schemes for Conservation Laws Introduction-Motivations

1D-1V 1.8

Total Energy Ec Ep

1.6

1.4

1.2

1.0

0.8

0.6

0.4

0.2

0.0 0

10

20

30

40

50

60

70

80

90

100

Figure: Variation of the kinetic (Ec) and potential (Ep) energies. The kinetic energy was vertically shifted by −23.

Compact AMR schemes for Conservation Laws Refinement filters and scaling functions

Refinement filter each refinement scheme issues a scaling function x X ϕ = ak ϕ(x − k) 2 k∈Z

with

P

k∈Z

ak = 2.

ϕ( x2 )

ϕ( x2 − 1) a2

a−2

a−1

a0

a1 a1

a−2 a−1

a2 a0

ϕ(x + 2) ϕ(x − 3)ϕ(x − 4) ϕ(x + 1)ϕ(x) ϕ(x − 1) ϕ(x − 2)

Compact AMR schemes for Conservation Laws Refinement filters and scaling functions

Gradation and compacity

Key element of the refinement algorithms : an element can become active only if its parents (the elements from which it is interpolated) are already active. Hence the notion of gradation. The more non zero ak the larger the gradation margin, the needed memory and the complexity. Critical in many dimensions. It is possible to apply finite difference schemes to elements of the same level (identical elements). Interest of the interpolet scaling functions : many zero coefficients, easy to pass an element from a level to an other level since it corresponds to a point value.

Compact AMR schemes for Conservation Laws Refinement filters and scaling functions

Special filters Finite volume elements ϕ

x 2

=

X

bk ϕ(x − k)

k∈Z

with ∀k 6= 0, b2k + b2k+1 = 0, and b0 = b1 = 1 if symmetry Interpolet scaling functions x X = ak ϕ(x ˙ − k) ϕ˙ 2 k∈Z

with a0 = 1 and ∀k 6= 0, a2k = 0 (lots of gaps) Any finite volume scaling function derives from an interpolet scaling function : ϕ˙ 0 (x) = ϕ(x) − ϕ(x − 1) bk + bk+1 2 Interpolets are much smoother than finite volume scaling functions. ∀k

ak =

Compact AMR schemes for Conservation Laws Refinement filters and scaling functions

Finite volume scaling functions 1.2

Scaling function of 1st order

1.0

0.8

0.6

3rd order

0.4

0.2

5th order 0.0

−0.2

−0.4 −4

−3

−2

−1

0

1

2

3

4

5

Compact support

Scaling functions ϕ corresponding to the finite volume schemes.

Compact AMR schemes for Conservation Laws Refinement filters and scaling functions

Interpolets : finite difference scaling functions 1.0

0.8

Interpolet of 4th order 0.6

0.4

of 2nd order

0.2

0.0

−0.2 −3

−2

−1

0

1

2

3

Compact support

Scaling functions ϕ corresponding to the finite difference schemes.

Compact AMR schemes for Conservation Laws Refinement filters and scaling functions

Comparison between these two types 1.2

finite volume 5th order 1.0

3rd order 0.8

0.6

4th order interpolet

0.4

0.2

0.0

−0.2

−0.4 −4

−3

−2

−1

0

1

2

Re−centered compact support

Scaling functions ϕ recentered for comparison.

3

4

Compact AMR schemes for Conservation Laws Mass conservation issues

Mass calculation in AMR

Two instances when the mass M =

R Ω

u(x) dx is affected by the AMR scheme :

when the grid changes : refined or coarsed. when solving the conservation law ∂t u + ∇ · f (u, x) = 0 in the non uniform grid : un → un+1 . In the case of the finite volumes, the volume of an element depends exclusively from its level and from the fact of being a leaf of not. In the other cases, it depends on which descendents are activated. Applying a wavelet transform concentrates all the mass on the coarsest level. It allows to modify the grid safely.

Compact AMR schemes for Conservation Laws Mass conservation issues

Advection and fluxes

For the finite volumes, we have to compute the fluxes F = f (u, x) along the the surface S in the conservation law ∂t + ∇ · f (u, x) = 0. volume V C0

f(u,x)

Fg dt

then

C1 surface s Fd dt

Fg − Fd s dt V Interest : as the Fg of C1 equals the Fd of C0 , the mass is strictly conserved. du =

Compact AMR schemes for Conservation Laws Mass conservation issues

Making the scheme conservative Let (xi , `i )i be a set of elements (points,weights) containing the information (ui ) subject to a conservative equation ∂t u − ∂x u = 0. We approximate the term ∂x u by a finite difference formula at order pi : (∂x u)i ∼ δui =

1 X αij uj . `i j

We can compute the flux going outside the element (xj , `j ) : ! X Fj = αij uj . i

These fluxes should be zero. If it is not the case we substract them introducing correcting terms in some of the (αij ) stencils : ! X X 1 X 1 X αi0 j uj − Fj = αi0 j − αij uj . (∂x u)i0 ∼ δui0 = `i0 `i0 j

j

j

i

Compact AMR schemes for Conservation Laws Mass conservation issues

Points with volumes

Using the refinement scheme for 4th order interpolet we derive the following ‘volumes’ for the points

2

2

2

2

2

33 16

33 16

3 15 15 3 2 1 16 1 1 1 1 1 1 2 16

33 16

2

2

2

3 1 15 1 1 1 1 1 1 1 15 1 3 2 2 16 16

33 16

2

2

2

Compact AMR schemes for Conservation Laws Numerical experiments

Tranport in 1D 1.0

a=1

0.8 0.6

u=sin(2x−1.5)

0.4 0.2

u

0.0 −0.2 −0.4 −0.6 −0.8 −1.0 −2

−1

0

1

x

2

L

∂t u + a∂x u = 0 for t ∈ [0, T ] with T = 4 L, on 21 points.

3

4

Compact AMR schemes for Conservation Laws Numerical experiments

Spectrum of the discrete operator : eighenvalues λ 8

6

Immaginary part of lambda

4

2

0

−2

−4

−6

−8 −0.5

0.0

0.5

1.0

1.5

2.0

2.5

3.0

3.5

4.0

Real part of lambda

A u is our discrete approximation of ∂x u, λ ∈ C are the eighenvalues of A.

Compact AMR schemes for Conservation Laws Numerical experiments

Compact AMR schemes for Conservation Laws Numerical experiments

No change in the error 0.3

without correction 0.2

with correction

Error

0.1

0.0

−0.1

−0.2

−0.3 −2

−1

0

x

1

2

Error at four instances: L, 2L, 3L and 4L

3

4

Compact AMR schemes for Conservation Laws Numerical experiments

Total mass variation during time

Mass without correction (left) and with correction (right) The mass conservation is ok now

Compact AMR schemes for Conservation Laws Conclusion

Conclusion–Perspectives

Conclusion : application of finite volume principles in interpolant AMR, application of wavelet constructions through the considerations on scaling functions, 6D simulations demand a lot of memory, we pass from 100,000 to 300,000 the number of points necessary for a local refinement. Perspectives : finish to implement the 6D code with these improvements, as soon as the numerical scheme is validated, implement a MPI parallelisation, test other schemes, lagrangian, Galekin discontinuous, cf Eric Madaule’s PhD.