+ All Categories
Home > Documents > dune-fv a library for h-adaptive finite-volume schemes · G. Puppo (Univ. dell’Insubria, Como),...

dune-fv a library for h-adaptive finite-volume schemes · G. Puppo (Univ. dell’Insubria, Como),...

Date post: 20-Sep-2020
Category:
Upload: others
View: 0 times
Download: 0 times
Share this document with a friend
91
dune-fv a library for h-adaptive finite-volume schemes M. Semplice Dipartimento di Matematica Universit` a degli Studi di Torino Joint work with: I. Cravero (Univ. Torino), A.Coco (Univ. Bristol), G. Puppo (Univ. dell’Insubria, Como), G. Russo (Univ. Catania) SHARK-FV, 18 th of May 2015 Partly supported by GNCS-INDAM, Progetti di ricerca 2013
Transcript
Page 1: dune-fv a library for h-adaptive finite-volume schemes · G. Puppo (Univ. dell’Insubria, Como), G. Russo (Univ. Catania) SHARK-FV, 18th of May 2015 Partly supported by GNCS-INDAM,

dune-fv

a library for h-adaptive finite-volume schemes

M. SempliceDipartimento di Matematica

Universita degli Studi di Torino

Joint work with: I. Cravero (Univ. Torino), A.Coco (Univ. Bristol),G. Puppo (Univ. dell’Insubria, Como), G. Russo (Univ. Catania)

SHARK-FV, 18th of May 2015

Partly supported by GNCS-INDAM, Progetti di ricerca 2013

Page 2: dune-fv a library for h-adaptive finite-volume schemes · G. Puppo (Univ. dell’Insubria, Como), G. Russo (Univ. Catania) SHARK-FV, 18th of May 2015 Partly supported by GNCS-INDAM,

1 FV schemes on locally adapted meshes

2 1D reconstructions for non-uniform meshes

3 2D reconstructions for non-uniform meshes

4 h-adaptive code and tests

5 The dune-fv library

Page 3: dune-fv a library for h-adaptive finite-volume schemes · G. Puppo (Univ. dell’Insubria, Como), G. Russo (Univ. Catania) SHARK-FV, 18th of May 2015 Partly supported by GNCS-INDAM,

One dimensional grids and binary trees

Locally refine cells, splitting them in two halves.A cell of level k has size hk = h02−k .

xk=1 k=2 k=3 k=3

h0

Page 4: dune-fv a library for h-adaptive finite-volume schemes · G. Puppo (Univ. dell’Insubria, Como), G. Russo (Univ. Catania) SHARK-FV, 18th of May 2015 Partly supported by GNCS-INDAM,

Two dimensional grids and quad-trees

locally refine cells, splitting them in two halves

a cell of level k has size hk = h02−k .

Page 5: dune-fv a library for h-adaptive finite-volume schemes · G. Puppo (Univ. dell’Insubria, Como), G. Russo (Univ. Catania) SHARK-FV, 18th of May 2015 Partly supported by GNCS-INDAM,

Finite volume discretization

d

dtuj +

∫∂Ωj

f (u(x(γ)))dγ = 0

boundaryquadrature

∫∂Ωj

f (u(x(γ)))dγ ' Q∂Ωj(f (u))

' Q∂Ωj(F (u; x(γ)))

numer. fluxes

F (u; x(γ)) = F(u(x(γ)in), u(x(γ)out)

)

stages

u(i)j = unj − ∆t

|Ωj |

i−1∑k=1

aikQΩj(F (u(k)))

step

un+1j = unj − ∆t

|Ωj |

ν∑i=1

biQΩj(F (u(i)))

Q: midpoint or 2-point Gauss quadrature on each edge of ∂Ωj

u(i),in/out(x(γ)) are some boundary value reconstructions.

Page 6: dune-fv a library for h-adaptive finite-volume schemes · G. Puppo (Univ. dell’Insubria, Como), G. Russo (Univ. Catania) SHARK-FV, 18th of May 2015 Partly supported by GNCS-INDAM,

Finite volume discretization

d

dtuj +

∫∂Ωj

f (u(x(γ)))dγ = 0

boundaryquadrature

∫∂Ωj

f (u(x(γ)))dγ ' Q∂Ωj(f (u)) ' Q∂Ωj

(F (u; x(γ)))

numer. fluxes F (u; x(γ)) = F(u(x(γ)in), u(x(γ)out)

)stages

u(i)j = unj − ∆t

|Ωj |

i−1∑k=1

aikQΩj(F (u(k)))

step

un+1j = unj − ∆t

|Ωj |

ν∑i=1

biQΩj(F (u(i)))

Q: midpoint or 2-point Gauss quadrature on each edge of ∂Ωj

u(i),in/out(x(γ)) are some boundary value reconstructions.

Page 7: dune-fv a library for h-adaptive finite-volume schemes · G. Puppo (Univ. dell’Insubria, Como), G. Russo (Univ. Catania) SHARK-FV, 18th of May 2015 Partly supported by GNCS-INDAM,

Finite volume discretization

d

dtuj +

∫∂Ωj

f (u(x(γ)))dγ = 0 R-K:c A

bt

boundaryquadrature

∫∂Ωj

f (u(x(γ)))dγ ' Q∂Ωj(f (u)) ' Q∂Ωj

(F (u; x(γ)))

numer. fluxes F (u; x(γ)) = F(u(x(γ)in), u(x(γ)out)

)stages u

(i)j = unj − ∆t

|Ωj |

i−1∑k=1

aikQΩj(F (u(k)))

step un+1j = unj − ∆t

|Ωj |

ν∑i=1

biQΩj(F (u(i)))

Q: midpoint or 2-point Gauss quadrature on each edge of ∂Ωj

u(i),in/out(x(γ)) are some boundary value reconstructions.

Page 8: dune-fv a library for h-adaptive finite-volume schemes · G. Puppo (Univ. dell’Insubria, Como), G. Russo (Univ. Catania) SHARK-FV, 18th of May 2015 Partly supported by GNCS-INDAM,

FV scheme on locally adapted grid

We aim at 3rd order schemes

good resolution properties

quite compact stencils(costly gathering neighbourhoods in adaptive meshes)

We need:

refinement/coarsening criteria, robust and applicable forsystems of conservation laws

time advancement scheme (global or local timestepping)

numerical flux (LLF, . . . )

a robust reconstruction procedure that

can work on locally adapted (e.g. quad-tree) meshescan be evaluated at many points on the cell boundary

Page 9: dune-fv a library for h-adaptive finite-volume schemes · G. Puppo (Univ. dell’Insubria, Como), G. Russo (Univ. Catania) SHARK-FV, 18th of May 2015 Partly supported by GNCS-INDAM,

FV scheme on locally adapted grid

We aim at 3rd order schemes

good resolution properties

quite compact stencils(costly gathering neighbourhoods in adaptive meshes)

We need:

refinement/coarsening criteria, robust and applicable forsystems of conservation laws

time advancement scheme (global or local timestepping)

numerical flux (LLF, . . . )

a robust reconstruction procedure that

can work on locally adapted (e.g. quad-tree) meshescan be evaluated at many points on the cell boundary

Page 10: dune-fv a library for h-adaptive finite-volume schemes · G. Puppo (Univ. dell’Insubria, Como), G. Russo (Univ. Catania) SHARK-FV, 18th of May 2015 Partly supported by GNCS-INDAM,

FV scheme on locally adapted grid

We aim at 3rd order schemes

good resolution properties

quite compact stencils(costly gathering neighbourhoods in adaptive meshes)

We need:

refinement/coarsening criteria, robust and applicable forsystems of conservation laws

time advancement scheme (global or local timestepping)

numerical flux (LLF, . . . )

a robust reconstruction procedure that

can work on locally adapted (e.g. quad-tree) meshescan be evaluated at many points on the cell boundary

Page 11: dune-fv a library for h-adaptive finite-volume schemes · G. Puppo (Univ. dell’Insubria, Como), G. Russo (Univ. Catania) SHARK-FV, 18th of May 2015 Partly supported by GNCS-INDAM,

FV scheme on locally adapted grid

We aim at 3rd order schemes

good resolution properties

quite compact stencils(costly gathering neighbourhoods in adaptive meshes)

We need:

refinement/coarsening criteria, robust and applicable forsystems of conservation laws

time advancement scheme (global or local timestepping)

numerical flux (LLF, . . . )

a robust reconstruction procedure that

can work on locally adapted (e.g. quad-tree) meshescan be evaluated at many points on the cell boundary

Page 12: dune-fv a library for h-adaptive finite-volume schemes · G. Puppo (Univ. dell’Insubria, Como), G. Russo (Univ. Catania) SHARK-FV, 18th of May 2015 Partly supported by GNCS-INDAM,

FV scheme on locally adapted grid

We aim at 3rd order schemes

good resolution properties

quite compact stencils(costly gathering neighbourhoods in adaptive meshes)

We need:

refinement/coarsening criteria, robust and applicable forsystems of conservation laws

time advancement scheme (global or local timestepping)

numerical flux (LLF, . . . )

a robust reconstruction procedure that

can work on locally adapted (e.g. quad-tree) meshescan be evaluated at many points on the cell boundary

Page 13: dune-fv a library for h-adaptive finite-volume schemes · G. Puppo (Univ. dell’Insubria, Como), G. Russo (Univ. Catania) SHARK-FV, 18th of May 2015 Partly supported by GNCS-INDAM,

FV scheme on locally adapted grid

We aim at 3rd order schemes

good resolution properties

quite compact stencils(costly gathering neighbourhoods in adaptive meshes)

We need:

refinement/coarsening criteria, robust and applicable forsystems of conservation laws

time advancement scheme (global or local timestepping)

numerical flux (LLF, . . . )

a robust reconstruction procedure that

can work on locally adapted (e.g. quad-tree) meshescan be evaluated at many points on the cell boundary

Page 14: dune-fv a library for h-adaptive finite-volume schemes · G. Puppo (Univ. dell’Insubria, Como), G. Russo (Univ. Catania) SHARK-FV, 18th of May 2015 Partly supported by GNCS-INDAM,

FV scheme on locally adapted grid

We aim at 3rd order schemes

good resolution properties

quite compact stencils(costly gathering neighbourhoods in adaptive meshes)

We need:

refinement/coarsening criteria, robust and applicable forsystems of conservation laws

time advancement scheme (global or local timestepping)

numerical flux (LLF, . . . )

a robust reconstruction procedure that

can work on locally adapted (e.g. quad-tree) meshes

can be evaluated at many points on the cell boundary

Page 15: dune-fv a library for h-adaptive finite-volume schemes · G. Puppo (Univ. dell’Insubria, Como), G. Russo (Univ. Catania) SHARK-FV, 18th of May 2015 Partly supported by GNCS-INDAM,

FV scheme on locally adapted grid

We aim at 3rd order schemes

good resolution properties

quite compact stencils(costly gathering neighbourhoods in adaptive meshes)

We need:

refinement/coarsening criteria, robust and applicable forsystems of conservation laws

time advancement scheme (global or local timestepping)

numerical flux (LLF, . . . )

a robust reconstruction procedure that

can work on locally adapted (e.g. quad-tree) meshescan be evaluated at many points on the cell boundary

Page 16: dune-fv a library for h-adaptive finite-volume schemes · G. Puppo (Univ. dell’Insubria, Como), G. Russo (Univ. Catania) SHARK-FV, 18th of May 2015 Partly supported by GNCS-INDAM,

Error indicator: the numerical entropy production

is defined as the residual of the entropy inequalityη(u)t +∇ · ψ(u) ≤ 0 on the numerical solution

Snj =1

|Ωj |∆t

(∫Ωj

η(u(tn+1))−∫

Ωj

η(u(tn)) +

∫ tn+1

tn

∫∂Ωj

ψ(u(t)) · n

)

Snj is computed recycling the boundary data alreadycomputed for the evolution

it has the same size of the truncation error:

on smooth flows Snj = O(hp)on rarefaction corners Snj = O(h)on contacts Snj = O(1)on shocks Snj ∼ C/h

Puppo SIAM J. Sci. Comput., 2003

Puppo, Semplice Comm. in Comput. Phys., 2011

Puppo, Semplice Preprint arXiv:1403.4112

Page 17: dune-fv a library for h-adaptive finite-volume schemes · G. Puppo (Univ. dell’Insubria, Como), G. Russo (Univ. Catania) SHARK-FV, 18th of May 2015 Partly supported by GNCS-INDAM,

Error indicator: the numerical entropy production

is defined as the residual of the entropy inequalityη(u)t +∇ · ψ(u) ≤ 0 on the numerical solution

Snj =1

|Ωj |∆t

(∫Ωj

η(u(tn+1))−∫

Ωj

η(u(tn)) +

∫ tn+1

tn

∫∂Ωj

ψ(u(t)) · n

)

Snj is computed recycling the boundary data alreadycomputed for the evolution

it has the same size of the truncation error:

on smooth flows Snj = O(hp)on rarefaction corners Snj = O(h)on contacts Snj = O(1)on shocks Snj ∼ C/h

Puppo SIAM J. Sci. Comput., 2003

Puppo, Semplice Comm. in Comput. Phys., 2011

Puppo, Semplice Preprint arXiv:1403.4112

Page 18: dune-fv a library for h-adaptive finite-volume schemes · G. Puppo (Univ. dell’Insubria, Como), G. Russo (Univ. Catania) SHARK-FV, 18th of May 2015 Partly supported by GNCS-INDAM,

Error indicator: the numerical entropy production

is defined as the residual of the entropy inequalityη(u)t +∇ · ψ(u) ≤ 0 on the numerical solution

Snj =1

|Ωj |∆t

(∫Ωj

η(u(tn+1))−∫

Ωj

η(u(tn)) +

∫ tn+1

tn

∫∂Ωj

ψ(u(t)) · n

)

Snj is computed recycling the boundary data alreadycomputed for the evolution

it has the same size of the truncation error:

on smooth flows Snj = O(hp)

on rarefaction corners Snj = O(h)on contacts Snj = O(1)

on shocks Snj ∼ C/h

Puppo SIAM J. Sci. Comput., 2003

Puppo, Semplice Comm. in Comput. Phys., 2011

Puppo, Semplice Preprint arXiv:1403.4112

Page 19: dune-fv a library for h-adaptive finite-volume schemes · G. Puppo (Univ. dell’Insubria, Como), G. Russo (Univ. Catania) SHARK-FV, 18th of May 2015 Partly supported by GNCS-INDAM,

Error indicator: the numerical entropy production

is defined as the residual of the entropy inequalityη(u)t +∇ · ψ(u) ≤ 0 on the numerical solution

Snj =1

|Ωj |∆t

(∫Ωj

η(u(tn+1))−∫

Ωj

η(u(tn)) +

∫ tn+1

tn

∫∂Ωj

ψ(u(t)) · n

)

Snj is computed recycling the boundary data alreadycomputed for the evolution

it has the same size of the truncation error:

on smooth flows Snj = O(hp)on rarefaction corners Snj = O(h)on contacts Snj = O(1)on shocks Snj ∼ C/h

Puppo SIAM J. Sci. Comput., 2003

Puppo, Semplice Comm. in Comput. Phys., 2011

Puppo, Semplice Preprint arXiv:1403.4112

Page 20: dune-fv a library for h-adaptive finite-volume schemes · G. Puppo (Univ. dell’Insubria, Como), G. Russo (Univ. Catania) SHARK-FV, 18th of May 2015 Partly supported by GNCS-INDAM,

Numerical entropy production

0.0 0.2 0.4 0.6 0.8 1.00.0

0.2

0.4

0.6

0.8

1.0

shock

contact

corner

rarefaction

Sod test problem

103

N of cells

10-3

10-2

10-1

100

101

O(N)

O(1)O(1)

Numerical entropy

103

N of cells

10-8

10-7

10-6

10-5

10-4

10-3

O(1/N)O(1/N)

O(1/N2 )

O(1/N3 )

Numerical entropy

scheme of order 2 continuous linescheme of order 3 dashed line

Page 21: dune-fv a library for h-adaptive finite-volume schemes · G. Puppo (Univ. dell’Insubria, Como), G. Russo (Univ. Catania) SHARK-FV, 18th of May 2015 Partly supported by GNCS-INDAM,

The shallow water system

Balance law

ht + (hu)x = 0

(hu)t + (hu2 + 12gh

2)x = −ghzx

Entropy pair

η(h, u) =1

2hu2 +

1

2gh2 + gzh

ψ(h, u) = u η(h, u)

H(x)=h(x)+z(x)h(x)

z(x)

Page 22: dune-fv a library for h-adaptive finite-volume schemes · G. Puppo (Univ. dell’Insubria, Como), G. Russo (Univ. Catania) SHARK-FV, 18th of May 2015 Partly supported by GNCS-INDAM,

Balance laws with geometric source terms

reconstruct (h + z), q, and h obtaining point values at xj+1/2±

hydrostatic recontruction1 ⇒ states

U∗j+1/2±

=(h∗j+1/2±

, qj+1/2±

)modify fluxes:FRi = F (U∗

j+1/2−,U∗

j+1/2+) + g2 [0, (hj+1/2−)2 − (h∗

j+1/2−)2]T

FLi = F (U∗

j−1/2−,U∗

j−1/2+) + g2 [0, (hj−1/2−)2 − (h∗

j−1/2−)2]T

add the source term

∆xid

dtU i (t) + FR

i −FLi = [0, S

(p)i ]T

use a well-balanced quadrature of order p

S(1)i = 0 S

(2)i = −g

2 (hj+1/2− +hj−1/2+)(zj+1/2−− zj−1/2+)

1 Audusse et al. – SIAM J. Sci. Comput. 25 (2004), 2050–2065

Page 23: dune-fv a library for h-adaptive finite-volume schemes · G. Puppo (Univ. dell’Insubria, Como), G. Russo (Univ. Catania) SHARK-FV, 18th of May 2015 Partly supported by GNCS-INDAM,

Schemes of order 3 and 4

4th order evaluation of the source term via Richardson’sextrapolation of the trapezoidal quadrature2

S(4)j = −g

2

43 (hj + hj−1/2+)(zj − zj−1/2+)

+ 43 (hj+1/2− + hj)(zj+1/2− − zj)

−13 (hj+1/2− + hj−1/2+)(zj+1/2− − zj−1/2+)

⇒ need reconstructions hj , zj at cell center

2 Noelle, Pankratz, Puppo, Natvig – Well-balanced finite volume schemesof arbitrary order of accuracy for shallow water ows. JCP 213 (2006) 474–499.

Page 24: dune-fv a library for h-adaptive finite-volume schemes · G. Puppo (Univ. dell’Insubria, Como), G. Russo (Univ. Catania) SHARK-FV, 18th of May 2015 Partly supported by GNCS-INDAM,

1 FV schemes on locally adapted meshes

2 1D reconstructions for non-uniform meshes

3 2D reconstructions for non-uniform meshes

4 h-adaptive code and tests

5 The dune-fv library

Page 25: dune-fv a library for h-adaptive finite-volume schemes · G. Puppo (Univ. dell’Insubria, Como), G. Russo (Univ. Catania) SHARK-FV, 18th of May 2015 Partly supported by GNCS-INDAM,

WENO3 reconstruction on non-uniform mesh

Let POPT(x) be the central parabola and

PR(x) = uj +uj+1 − ujxj+1 − xj

(x−xj) PL(x) = uj +uj − uj−1

xj − xj−1(x−xj)

For general3 x ∈ Ωj ,

∃CR(x),CL(x) ∈ R : POPT(x) = CL(x)PL(x) + CR(x)PR(x)

IL =(uj−uj−1

xj−xj−1

)2αL(x) = CL(x)

(IL+ε)2 , IR = . . . , αR = . . .

ωL(x) = αL(x)αL(x)+αR(x) ωR(x) = αR(x)

αL(x)+αR(x)

Reconstrauction in Ωj at x = ωL(x)PL(x) + ωR(x)PR(x)

3 Gerolymos – Representation of Lagrange reconstructing polynomial bycombination of substencils JCAM 236 (2012), 2763–2794.

Page 26: dune-fv a library for h-adaptive finite-volume schemes · G. Puppo (Univ. dell’Insubria, Como), G. Russo (Univ. Catania) SHARK-FV, 18th of May 2015 Partly supported by GNCS-INDAM,

WENO3 reconstruction on non-uniform mesh

Let POPT(x) be the central parabola and

PR(x) = uj +uj+1 − ujxj+1 − xj

(x−xj) PL(x) = uj +uj − uj−1

xj − xj−1(x−xj)

For general3 x ∈ Ωj ,

∃CR(x),CL(x) ∈ R : POPT(x) = CL(x)PL(x) + CR(x)PR(x)

IL =(uj−uj−1

xj−xj−1

)2αL(x) = CL(x)

(IL+ε)2 , IR = . . . , αR = . . .

ωL(x) = αL(x)αL(x)+αR(x) ωR(x) = αR(x)

αL(x)+αR(x)

Reconstrauction in Ωj at x = ωL(x)PL(x) + ωR(x)PR(x)

3 Gerolymos – Representation of Lagrange reconstructing polynomial bycombination of substencils JCAM 236 (2012), 2763–2794.

Page 27: dune-fv a library for h-adaptive finite-volume schemes · G. Puppo (Univ. dell’Insubria, Como), G. Russo (Univ. Catania) SHARK-FV, 18th of May 2015 Partly supported by GNCS-INDAM,

WENO3 reconstruction on non-uniform mesh

For example, for right cell boundary:

CL(xj+1/2) =hj−1

hj−1 + hj + hj+1CR(xj+1/2) =

hj + hj+1

hj−1 + hj + hj+1

for left cell boundary:

CL(xj−1/2) =hj + hj+1

hj−1 + hj + hj+1CR(xj−1/2) =

hj−1

hj−1 + hj + hj+1

Each reconstruction point requires its set of weights

For uniform meshes, CL(xj+1/2) = 13 ,CR(xj+1/2) = 2

3 , etc

Weights depend on the mesh geometry in the neighborhoodand should be recomputed after grid adaption

It is impossible to find weights for cell center x = xj ,which is a problem for well-balanced quadratures

Page 28: dune-fv a library for h-adaptive finite-volume schemes · G. Puppo (Univ. dell’Insubria, Como), G. Russo (Univ. Catania) SHARK-FV, 18th of May 2015 Partly supported by GNCS-INDAM,

WENO3 reconstruction on non-uniform mesh

For example, for right cell boundary:

CL(xj+1/2) =hj−1

hj−1 + hj + hj+1CR(xj+1/2) =

hj + hj+1

hj−1 + hj + hj+1

for left cell boundary:

CL(xj−1/2) =hj + hj+1

hj−1 + hj + hj+1CR(xj−1/2) =

hj−1

hj−1 + hj + hj+1

Each reconstruction point requires its set of weights

For uniform meshes, CL(xj+1/2) = 13 ,CR(xj+1/2) = 2

3 , etc

Weights depend on the mesh geometry in the neighborhoodand should be recomputed after grid adaption

It is impossible to find weights for cell center x = xj ,which is a problem for well-balanced quadratures

Page 29: dune-fv a library for h-adaptive finite-volume schemes · G. Puppo (Univ. dell’Insubria, Como), G. Russo (Univ. Catania) SHARK-FV, 18th of May 2015 Partly supported by GNCS-INDAM,

WENO3 reconstruction on non-uniform mesh

For example, for right cell boundary:

CL(xj+1/2) =hj−1

hj−1 + hj + hj+1CR(xj+1/2) =

hj + hj+1

hj−1 + hj + hj+1

for left cell boundary:

CL(xj−1/2) =hj + hj+1

hj−1 + hj + hj+1CR(xj−1/2) =

hj−1

hj−1 + hj + hj+1

Each reconstruction point requires its set of weights

For uniform meshes, CL(xj+1/2) = 13 ,CR(xj+1/2) = 2

3 , etc

Weights depend on the mesh geometry in the neighborhoodand should be recomputed after grid adaption

It is impossible to find weights for cell center x = xj ,which is a problem for well-balanced quadratures

Page 30: dune-fv a library for h-adaptive finite-volume schemes · G. Puppo (Univ. dell’Insubria, Como), G. Russo (Univ. Catania) SHARK-FV, 18th of May 2015 Partly supported by GNCS-INDAM,

WENO3 reconstruction on non-uniform mesh

For example, for right cell boundary:

CL(xj+1/2) =hj−1

hj−1 + hj + hj+1CR(xj+1/2) =

hj + hj+1

hj−1 + hj + hj+1

for left cell boundary:

CL(xj−1/2) =hj + hj+1

hj−1 + hj + hj+1CR(xj−1/2) =

hj−1

hj−1 + hj + hj+1

Each reconstruction point requires its set of weights

For uniform meshes, CL(xj+1/2) = 13 ,CR(xj+1/2) = 2

3 , etc

Weights depend on the mesh geometry in the neighborhoodand should be recomputed after grid adaption

It is impossible to find weights for cell center x = xj ,which is a problem for well-balanced quadratures

Page 31: dune-fv a library for h-adaptive finite-volume schemes · G. Puppo (Univ. dell’Insubria, Como), G. Russo (Univ. Catania) SHARK-FV, 18th of May 2015 Partly supported by GNCS-INDAM,

1D CWENO third order reconstruction

P(2)opt(x)

Page 32: dune-fv a library for h-adaptive finite-volume schemes · G. Puppo (Univ. dell’Insubria, Como), G. Russo (Univ. Catania) SHARK-FV, 18th of May 2015 Partly supported by GNCS-INDAM,

1D CWENO third order reconstruction

P(2)opt(x)

Pl (x)

Pr (x)

2/3 =hj−1 + hj

hj−1 + hj + hj+1

1/3 =hj+1

hj−1 + hj + hj+1

1/3

2/3

WENO3: mesh-dependent, point-dependent coefficients

Page 33: dune-fv a library for h-adaptive finite-volume schemes · G. Puppo (Univ. dell’Insubria, Como), G. Russo (Univ. Catania) SHARK-FV, 18th of May 2015 Partly supported by GNCS-INDAM,

1D CWENO third order reconstruction

P(2)opt(x)

Pl (x)

Pr (x)

Pc (x)

∀x : P(2)opt(x) =

1

2Pc(x) +

1

4Pr (x) +

1

4Pl(x)

Page 34: dune-fv a library for h-adaptive finite-volume schemes · G. Puppo (Univ. dell’Insubria, Como), G. Russo (Univ. Catania) SHARK-FV, 18th of May 2015 Partly supported by GNCS-INDAM,

1D CWENO third order reconstruction

P(2)opt(x)

Pl (x)

Pr (x)

Pc (x)

∀x : P(2)opt(x) =

1

2Pc(x) +

1

4Pr (x) +

1

4Pl(x)

1/4

1/4

1/2

Page 35: dune-fv a library for h-adaptive finite-volume schemes · G. Puppo (Univ. dell’Insubria, Como), G. Russo (Univ. Catania) SHARK-FV, 18th of May 2015 Partly supported by GNCS-INDAM,

1D CWENO third order reconstruction

Generalize the construction of CWENO4 to non-uniform mesh:POPT fitting uj−1, uj , uj+1

Choose Cξ > 0, CC + CR + CL = 1 and define PC by∀x : POPT (x) = CCPC (x) + CRPR(x) + CLPL(x)

Indicators IC , IR , IL and weights ωC , ωR , ωL as in usual WENO

ωC , ωR , ωL do not depend on geometry nor evaluation point:

Pj(x) = ωCPC (x) + ωRPR(x) + ωLPL(x)

is uniformly accurate and can be evaluated where needed(cell boundaries, cell centers, etc)

4 Levy, Puppo, Russo – Compact Central WENO schemes formultidimensional conservation laws – SIAM J. Sci. Comput. (2001)

Page 36: dune-fv a library for h-adaptive finite-volume schemes · G. Puppo (Univ. dell’Insubria, Como), G. Russo (Univ. Catania) SHARK-FV, 18th of May 2015 Partly supported by GNCS-INDAM,

1D CWENO third order reconstruction

Generalize the construction of CWENO4 to non-uniform mesh:POPT fitting uj−1, uj , uj+1

Choose Cξ > 0, CC + CR + CL = 1 and define PC by∀x : POPT (x) = CCPC (x) + CRPR(x) + CLPL(x)

Indicators IC , IR , IL and weights ωC , ωR , ωL as in usual WENO

ωC , ωR , ωL do not depend on geometry nor evaluation point:

Pj(x) = ωCPC (x) + ωRPR(x) + ωLPL(x)

is uniformly accurate and can be evaluated where needed(cell boundaries, cell centers, etc)

4 Levy, Puppo, Russo – Compact Central WENO schemes formultidimensional conservation laws – SIAM J. Sci. Comput. (2001)

Page 37: dune-fv a library for h-adaptive finite-volume schemes · G. Puppo (Univ. dell’Insubria, Como), G. Russo (Univ. Catania) SHARK-FV, 18th of May 2015 Partly supported by GNCS-INDAM,

1D CWENO third order reconstruction

Generalize the construction of CWENO4 to non-uniform mesh:POPT fitting uj−1, uj , uj+1

Choose Cξ > 0, CC + CR + CL = 1 and define PC by∀x : POPT (x) = CCPC (x) + CRPR(x) + CLPL(x)

Indicators IC , IR , IL and weights ωC , ωR , ωL as in usual WENO

ωC , ωR , ωL do not depend on geometry nor evaluation point:

Pj(x) = ωCPC (x) + ωRPR(x) + ωLPL(x)

is uniformly accurate and can be evaluated where needed(cell boundaries, cell centers, etc)

4 Levy, Puppo, Russo – Compact Central WENO schemes formultidimensional conservation laws – SIAM J. Sci. Comput. (2001)

Page 38: dune-fv a library for h-adaptive finite-volume schemes · G. Puppo (Univ. dell’Insubria, Como), G. Russo (Univ. Catania) SHARK-FV, 18th of May 2015 Partly supported by GNCS-INDAM,

Accuracy test on the reconstruction (1D)

Tests on fixed nonuniform meshesErrors of the values reconstructed from cell averages

Smooth test, quasi-uniform gridN ‖E‖1 rate ‖E‖∞ rate

20 5.63e-03 2.17e-0240 8.65e-04 2.70 3.85e-03 2.5080 1.08e-04 3.01 5.26e-04 2.87

160 1.26e-05 3.10 5.36e-05 3.30320 1.47e-06 3.09 7.00e-06 2.94640 1.75e-07 3.08 8.85e-07 2.98

1280 2.11e-08 3.05 1.11e-07 3.002560 2.59e-09 3.03 1.39e-08 3.00

Smooth test, random gridN ‖E‖1 rate ‖E‖∞ rate

20 5.36e-03 1.87e-0240 4.97e-04 3.43 1.35e-03 3.7980 5.07e-05 3.29 1.35e-04 3.32

160 5.46e-06 3.22 1.67e-05 3.02320 6.25e-07 3.13 2.08e-06 3.01640 7.46e-08 3.07 2.64e-07 2.98

1280 9.11e-09 3.03 3.15e-08 3.072560 1.12e-09 3.02 4.19e-09 2.91

Page 39: dune-fv a library for h-adaptive finite-volume schemes · G. Puppo (Univ. dell’Insubria, Como), G. Russo (Univ. Catania) SHARK-FV, 18th of May 2015 Partly supported by GNCS-INDAM,

Shallow water equations, trancritical flow with a shock

Third order (CWENO) scheme with 200 points:

8 9 10 11 12 13 14 150.12

0.14

0.16

0.18

0.2

0.22

0.24

0.26

0.28Water height

VIJIVIRGI

WSPYXMSRSRRSRYRMJSVQQIWL

WSPYXMSRSRYRMJSVQQIWL

Page 40: dune-fv a library for h-adaptive finite-volume schemes · G. Puppo (Univ. dell’Insubria, Como), G. Russo (Univ. Catania) SHARK-FV, 18th of May 2015 Partly supported by GNCS-INDAM,

Shallow water equations, trancritical flow with a shock

Third order (CWENO) scheme with 200 points:

0 5 10 15 20 250

0.05

0.1

0.15

0.2

0.25

0.3

0.35

0.4

0.45Water height

XSTSKVETL]

QIWLWM^ISJRSRYRMJSVQQIWL

XVERWGVMXMGEPWLSGO

RSSWGMPPEXMSRWLIVI

Page 41: dune-fv a library for h-adaptive finite-volume schemes · G. Puppo (Univ. dell’Insubria, Como), G. Russo (Univ. Catania) SHARK-FV, 18th of May 2015 Partly supported by GNCS-INDAM,

A note on the choice of ε

Computation of the nonlinear weigts (both WENO and CWENO):

αξ =Cξ

(Iξ + ε)2ωλ =

αλ∑ξ∈R,L,0

αξ

ε originally introduced to avoid zero denominator

ε affects convergence rates in both WENO and CWENO

on uniform meshes, ε ∼ h2 can restore WENO convergence 5,or use ‘mapped WENO’ 6, modify indicators, . . .

on uniform meshes, for CWENO both ε ∼ h and ε ∼ h2 work 7

5 Arandiga et al., SINUM 20126 Henrick et al., JCP 20057 Kolb, SINUM 2014

Page 42: dune-fv a library for h-adaptive finite-volume schemes · G. Puppo (Univ. dell’Insubria, Como), G. Russo (Univ. Catania) SHARK-FV, 18th of May 2015 Partly supported by GNCS-INDAM,

A primer on the choice of ε

Computation of the nonlinear weigts (both WENO and CWENO):

αξ =Cξ

(Iξ + ε)2ωλ =

αλ∑ξ∈R,L,0

αξ

The Jiang-Shu regularity indicators:

Ij ,ξ =∑r≥1

(hj)2r−1

∫Ωj

[P

(r)j ,ξ (x)

]2dx .

The relative value of ε and hj biases (or not) the reconstructiontowards the central one, because

Ij ,ξ =

O(h2

j ) in general

O(1) when there is a discontinuity in the stencil ofPj ,ξ

O(h4j ) when there is an extremum in the stencil ofPj ,ξ

Page 43: dune-fv a library for h-adaptive finite-volume schemes · G. Puppo (Univ. dell’Insubria, Como), G. Russo (Univ. Catania) SHARK-FV, 18th of May 2015 Partly supported by GNCS-INDAM,

A primer on the choice of ε

Computation of the nonlinear weigts (both WENO and CWENO):

αξ =Cξ

(Iξ + ε)2ωλ =

αλ∑ξ∈R,L,0

αξ

The Jiang-Shu regularity indicators:

Ij ,ξ =∑r≥1

(hj)2r−1

∫Ωj

[P

(r)j ,ξ (x)

]2dx .

The relative value of ε and hj biases (or not) the reconstructiontowards the central one, because

Ij ,ξ =

O(h2

j ) in general

O(1) when there is a discontinuity in the stencil ofPj ,ξ

O(h4j ) when there is an extremum in the stencil ofPj ,ξ

Page 44: dune-fv a library for h-adaptive finite-volume schemes · G. Puppo (Univ. dell’Insubria, Como), G. Russo (Univ. Catania) SHARK-FV, 18th of May 2015 Partly supported by GNCS-INDAM,

Choosing ε on non-uniform meshes

Also on non-uniform meshes (both WENO and CWENO):

αξ =Cξ

(Iξ + ε)2Ij ,ξ =

O(h2

j ) in general

O(1) if discontinuous in stencil(j , ξ)

O(h4j ) if extremum in stencil(j , ξ)

ε acts as a threshold

ε should shade extrasmooth values O(h4j )

we may have cells of very different size in the mesh

choosing ε as a function of the (local) mesh size, e.g. ε = h2j ,

is of paramount importance in h-adaptive schemes.

Cravero, Semplice On the accuracy of WENO and CWENOreconstructions of third order on nonuniform meshes SubmittedPreprint http://arxiv.org/abs/1503.00736

Page 45: dune-fv a library for h-adaptive finite-volume schemes · G. Puppo (Univ. dell’Insubria, Como), G. Russo (Univ. Catania) SHARK-FV, 18th of May 2015 Partly supported by GNCS-INDAM,

Choosing ε on non-uniform meshes

Also on non-uniform meshes (both WENO and CWENO):

αξ =Cξ

(Iξ + ε)2Ij ,ξ =

O(h2

j ) in general

O(1) if discontinuous in stencil(j , ξ)

O(h4j ) if extremum in stencil(j , ξ)

ε acts as a threshold

ε should shade extrasmooth values O(h4j )

we may have cells of very different size in the mesh

choosing ε as a function of the (local) mesh size, e.g. ε = h2j ,

is of paramount importance in h-adaptive schemes.

Cravero, Semplice On the accuracy of WENO and CWENOreconstructions of third order on nonuniform meshes SubmittedPreprint http://arxiv.org/abs/1503.00736

Page 46: dune-fv a library for h-adaptive finite-volume schemes · G. Puppo (Univ. dell’Insubria, Como), G. Russo (Univ. Catania) SHARK-FV, 18th of May 2015 Partly supported by GNCS-INDAM,

Choosing ε on non-uniform meshes

Also on non-uniform meshes (both WENO and CWENO):

αξ =Cξ

(Iξ + ε)2Ij ,ξ =

O(h2

j ) in general

O(1) if discontinuous in stencil(j , ξ)

O(h4j ) if extremum in stencil(j , ξ)

ε acts as a threshold

ε should shade extrasmooth values O(h4j )

we may have cells of very different size in the mesh

choosing ε as a function of the (local) mesh size, e.g. ε = h2j ,

is of paramount importance in h-adaptive schemes.

Cravero, Semplice On the accuracy of WENO and CWENOreconstructions of third order on nonuniform meshes SubmittedPreprint http://arxiv.org/abs/1503.00736

Page 47: dune-fv a library for h-adaptive finite-volume schemes · G. Puppo (Univ. dell’Insubria, Como), G. Russo (Univ. Catania) SHARK-FV, 18th of May 2015 Partly supported by GNCS-INDAM,

Choosing ε on non-uniform meshes

Also on non-uniform meshes (both WENO and CWENO):

αξ =Cξ

(Iξ + ε)2Ij ,ξ =

O(h2

j ) in general

O(1) if discontinuous in stencil(j , ξ)

O(h4j ) if extremum in stencil(j , ξ)

ε acts as a threshold

ε should shade extrasmooth values O(h4j )

we may have cells of very different size in the mesh

choosing ε as a function of the (local) mesh size, e.g. ε = h2j ,

is of paramount importance in h-adaptive schemes.

Cravero, Semplice On the accuracy of WENO and CWENOreconstructions of third order on nonuniform meshes SubmittedPreprint http://arxiv.org/abs/1503.00736

Page 48: dune-fv a library for h-adaptive finite-volume schemes · G. Puppo (Univ. dell’Insubria, Como), G. Russo (Univ. Catania) SHARK-FV, 18th of May 2015 Partly supported by GNCS-INDAM,

Accuracy test on linear transport, smooth solution

Third order scheme on random grids:

101 102 103 10410−9

10−8

10−7

10−6

10−5

10−4

10−3

10−2

10−11−norm error

10−6 weno

10−6 cwenoh wenoh cweno

h2 weno

h2 cweno

Page 49: dune-fv a library for h-adaptive finite-volume schemes · G. Puppo (Univ. dell’Insubria, Como), G. Russo (Univ. Catania) SHARK-FV, 18th of May 2015 Partly supported by GNCS-INDAM,

Accuracy test on linear transport, discontinuous solution

101 102 103 10410−3

10−2

10−1

1001−norm error

10−6 WENO3

10−6 CWENO3h WENO3h CWENO3

h2 WENO3

h2 CWENO3

101 102 103 1041.85

1.9

1.95

2

2.05

2.1

2.15

2.2

2.25Total Variation

Page 50: dune-fv a library for h-adaptive finite-volume schemes · G. Puppo (Univ. dell’Insubria, Como), G. Russo (Univ. Catania) SHARK-FV, 18th of May 2015 Partly supported by GNCS-INDAM,

1 FV schemes on locally adapted meshes

2 1D reconstructions for non-uniform meshes

3 2D reconstructions for non-uniform meshes

4 h-adaptive code and tests

5 The dune-fv library

Page 51: dune-fv a library for h-adaptive finite-volume schemes · G. Puppo (Univ. dell’Insubria, Como), G. Russo (Univ. Catania) SHARK-FV, 18th of May 2015 Partly supported by GNCS-INDAM,

First neighbours in quad-tree meshes (examples)

1 2 3

4

567

8

1

2 3 45

1 2 3

10

11

“Dimensional splitting” is non-trivial. . . At second order, see e.g.

Puppo, Semplice Finite volume schemes on 2D non-uniform gridsProceedings of HYP2012

Page 52: dune-fv a library for h-adaptive finite-volume schemes · G. Puppo (Univ. dell’Insubria, Como), G. Russo (Univ. Catania) SHARK-FV, 18th of May 2015 Partly supported by GNCS-INDAM,

Second degree optimal polynomial in 2D

In a locally adapted mesh, the number of neighbours is always ≥ 5:

Ωi

Choose P2OPT(x , y) such that

exact cell average in Ωi :

1|Ωi |

∫Ωi

POPT = ui

least squares in theneighbourhood Ni of Ωj , i.e.minimize∑j∈Ni

∣∣∣∣∣ 1|Ωj |

∫Ωj

POPT − uj

∣∣∣∣∣2

Page 53: dune-fv a library for h-adaptive finite-volume schemes · G. Puppo (Univ. dell’Insubria, Como), G. Russo (Univ. Catania) SHARK-FV, 18th of May 2015 Partly supported by GNCS-INDAM,

First degree polynomials in 2D

Let NNEi be the neighbours in the NORTH-EAST sector:

Ωi

Choose P1NE(x , y) such that

exact cell average in Ωj :

1|Ωi |

∫Ωj

PNE = ui

least squares in theneighbourhood Ni of Ωj , i.e.minimize∑

j∈Ni

∣∣∣∣∣ 1|Ωj |

∫Ωj

PNE − uj

∣∣∣∣∣2

There are always at least 2 cells in each of NNEi ,NNW

i ,N SWi ,N SE

i .

Page 54: dune-fv a library for h-adaptive finite-volume schemes · G. Puppo (Univ. dell’Insubria, Como), G. Russo (Univ. Catania) SHARK-FV, 18th of May 2015 Partly supported by GNCS-INDAM,

First degree polynomials in 2D

Let NNEi be the neighbours in the NORTH-EAST sector:

Ωi

Choose P1NE(x , y) such that

exact cell average in Ωj :

1|Ωi |

∫Ωj

PNE = ui

least squares in theneighbourhood Ni of Ωj , i.e.minimize∑

j∈Ni

∣∣∣∣∣ 1|Ωj |

∫Ωj

PNE − uj

∣∣∣∣∣2

There are always at least 2 cells in each of NNEi ,NNW

i ,N SWi ,N SE

i .

Page 55: dune-fv a library for h-adaptive finite-volume schemes · G. Puppo (Univ. dell’Insubria, Como), G. Russo (Univ. Catania) SHARK-FV, 18th of May 2015 Partly supported by GNCS-INDAM,

CWENO third order reconstruction in 2D

Pc defined by

POPT = 12Pc + 1

8PNE + 18PNW + 1

8PSE + 18PSW

non-linear weights are defined with the usual regularityindicators and the reconstruction is

Pj(x , y) = ωcPc + ωNEPNE + . . .+ ωSWPSW

P is later evaluated where needed (quadrature points on ∂Ωj)

Semplice, Coco, Russo Adaptive Mesh Refinement for HyperbolicSystems based on Third-Order Compact WENO Reconstruction J.Sci. Comput. (2015)

Page 56: dune-fv a library for h-adaptive finite-volume schemes · G. Puppo (Univ. dell’Insubria, Como), G. Russo (Univ. Catania) SHARK-FV, 18th of May 2015 Partly supported by GNCS-INDAM,

CWENO third order reconstruction in 2D

Pc defined by

POPT = 12Pc + 1

8PNE + 18PNW + 1

8PSE + 18PSW

non-linear weights are defined with the usual regularityindicators and the reconstruction is

Pj(x , y) = ωcPc + ωNEPNE + . . .+ ωSWPSW

P is later evaluated where needed (quadrature points on ∂Ωj)

Semplice, Coco, Russo Adaptive Mesh Refinement for HyperbolicSystems based on Third-Order Compact WENO Reconstruction J.Sci. Comput. (2015)

Page 57: dune-fv a library for h-adaptive finite-volume schemes · G. Puppo (Univ. dell’Insubria, Como), G. Russo (Univ. Catania) SHARK-FV, 18th of May 2015 Partly supported by GNCS-INDAM,

CWENO third order reconstruction in 2D

Pc defined by

POPT = 12Pc + 1

8PNE + 18PNW + 1

8PSE + 18PSW

non-linear weights are defined with the usual regularityindicators and the reconstruction is

Pj(x , y) = ωcPc + ωNEPNE + . . .+ ωSWPSW

P is later evaluated where needed (quadrature points on ∂Ωj)

Semplice, Coco, Russo Adaptive Mesh Refinement for HyperbolicSystems based on Third-Order Compact WENO Reconstruction J.Sci. Comput. (2015)

Page 58: dune-fv a library for h-adaptive finite-volume schemes · G. Puppo (Univ. dell’Insubria, Como), G. Russo (Univ. Catania) SHARK-FV, 18th of May 2015 Partly supported by GNCS-INDAM,

Accuracy test on the reconstruction (2D)

Reconstruction of boundary extrapolated data for

sin(πx) cos(πy)

Example of adapted grid based on 8× 8 coarse grid:

-1 1

-1

1

Adaptive grid, ε = 10−6

NC ‖E‖1 rate ‖E‖∞ rate

82 6.19e-02 3.11e-01

162 1.11e-02 2.48 9.61e-02 1.69

322 1.75e-03 2.67 2.53e-02 1.93

642 2.33e-04 2.91 6.40e-03 1.98

Adaptive grid, ε = hjNC ‖E‖1 rate ‖E‖∞ rate

82 4.48e-02 1.90e-01

162 7.00e-03 2.68 3.74e-02 2.34

322 8.16e-04 3.10 3.79e-03 3.30

642 8.91e-05 3.20 2.55e-04 3.89

Page 59: dune-fv a library for h-adaptive finite-volume schemes · G. Puppo (Univ. dell’Insubria, Como), G. Russo (Univ. Catania) SHARK-FV, 18th of May 2015 Partly supported by GNCS-INDAM,

1 FV schemes on locally adapted meshes

2 1D reconstructions for non-uniform meshes

3 2D reconstructions for non-uniform meshes

4 h-adaptive code and tests

5 The dune-fv library

Page 60: dune-fv a library for h-adaptive finite-volume schemes · G. Puppo (Univ. dell’Insubria, Como), G. Russo (Univ. Catania) SHARK-FV, 18th of May 2015 Partly supported by GNCS-INDAM,

Loop of the h-adaptive algorithm

compute un+1j and

indicator Snj

∃j :

Snj > Sref

hj > hmin

?

coarsen to parent

if all sons have

Snj < Scoa

locally

refine

(locally)

recompute

NO

YES

(nexttimestep)

Page 61: dune-fv a library for h-adaptive finite-volume schemes · G. Puppo (Univ. dell’Insubria, Como), G. Russo (Univ. Catania) SHARK-FV, 18th of May 2015 Partly supported by GNCS-INDAM,

Local recomputation with a 3 stages Runge-Kutta

Split the shaded cell and set the subcells averages at time tn byaveraging the reconstruction on each subcell.

(first computation)

x

xtn

tn+1

(local recomputation of timestep)

Page 62: dune-fv a library for h-adaptive finite-volume schemes · G. Puppo (Univ. dell’Insubria, Como), G. Russo (Univ. Catania) SHARK-FV, 18th of May 2015 Partly supported by GNCS-INDAM,

1d linear transport of a smooth solution

solution, indicator, cell levels errors vs number of cells

−1 −0.8 −0.6 −0.4 −0.2 0 0.2 0.4 0.6 0.8 1−1

−0.5

0

0.5

1

Linear transport test 2

so

luti

on

exact

numerical

10−8

10−6

10−4

10−2

100

−1 −0.8 −0.6 −0.4 −0.2 0 0.2 0.4 0.6 0.8 1

−3

−2

−1

0

x

ce

ll l

ev

el

101

102

103

104

10−5

10−4

10−3

10−2

10−1

100

no

rm−

1 e

rro

rs

average N cells

Linear transport test 2

r=2, L=1

r=2, L=4, s=4

r=3, L=1

r=3, L=4, s=8

Semplice, Coco, Russo Adaptive Mesh Refinement for HyperbolicSystems based on Third-Order Compact WENO Reconstruction J.Sci. Comput. (2015)

Page 63: dune-fv a library for h-adaptive finite-volume schemes · G. Puppo (Univ. dell’Insubria, Como), G. Russo (Univ. Catania) SHARK-FV, 18th of May 2015 Partly supported by GNCS-INDAM,

2d smooth problem (solution and error)

ut +∇ · ([−yx ]ϕ(r)u ) = 0 ϕ(r) = tanh(r)

cosh2(r)1

0.385r

on Ω = [−4, 4]2

−4 −3 −2 −1 0 1 2 3 4−4

−3

−2

−1

0

1

2

3

4

Solution at t=4.0

−0.8

−0.6

−0.4

−0.2

0

0.2

0.4

0.6

0.8

101

102

103

10−4

10−3

10−2

10−1

100

101

no

rm−

1 e

rro

rs

average N cells per direction

2D smooth test

r=2, L=1

r=2, L=4, s=4

r=3, L=1

r=3, L=4, s=8

Page 64: dune-fv a library for h-adaptive finite-volume schemes · G. Puppo (Univ. dell’Insubria, Como), G. Russo (Univ. Catania) SHARK-FV, 18th of May 2015 Partly supported by GNCS-INDAM,

2d smooth problem (grids)

(Darker cells are smaller)

Second order Third order

−4 −3 −2 −1 0 1 2 3 4−4

−3

−2

−1

0

1

2

3

4

Cell level (r=2)

0

1

2

3

−4 −3 −2 −1 0 1 2 3 4−4

−3

−2

−1

0

1

2

3

4

Cell level (r=3)

0

1

2

3

Page 65: dune-fv a library for h-adaptive finite-volume schemes · G. Puppo (Univ. dell’Insubria, Como), G. Russo (Univ. Catania) SHARK-FV, 18th of May 2015 Partly supported by GNCS-INDAM,

Work-precision diagrams

For comparing different h-adaptive numerical schemes:

choose proxy of CPU time, e.g. time average of number ofcells N

choose norm of error, e.g. 1-norm

On uniform meshes, we expect:

E ∼ Hp = N−p/d in Rd , for smooth flows, i.e.H → H/2⇒ E → E/2p.

E ∼ H = N−1/d , for shocked solutions

For h-adaptive meshes, H and N are not linked any more

On shocks, can we do better than E ∼ N−1/d?Can we hope to observe E ∼ N−p/d?

Page 66: dune-fv a library for h-adaptive finite-volume schemes · G. Puppo (Univ. dell’Insubria, Como), G. Russo (Univ. Catania) SHARK-FV, 18th of May 2015 Partly supported by GNCS-INDAM,

Work-precision diagrams

For comparing different h-adaptive numerical schemes:

choose proxy of CPU time, e.g. time average of number ofcells N

choose norm of error, e.g. 1-norm

On uniform meshes, we expect:

E ∼ Hp = N−p/d in Rd , for smooth flows, i.e.H → H/2⇒ E → E/2p.

E ∼ H = N−1/d , for shocked solutions

For h-adaptive meshes, H and N are not linked any more

On shocks, can we do better than E ∼ N−1/d?Can we hope to observe E ∼ N−p/d?

Page 67: dune-fv a library for h-adaptive finite-volume schemes · G. Puppo (Univ. dell’Insubria, Como), G. Russo (Univ. Catania) SHARK-FV, 18th of May 2015 Partly supported by GNCS-INDAM,

A simple scaling argument

p order of the scheme (on smooth solution)

H coarse cell size

` refinement levels: fine cells are of size h = H/2`

O(Hp) typical error on smooth part, i.e. (1/H)d = Nd cells

O(h) typical error on shock, located on (d−1)-dimensionalsubmanifold

In order to reduce the total error by a factor 2p, we have to:

use coarse cells of size H/2

let the finest cells be of size h/2p, by increasing the availablenumber of refinement levels by p−1.

E ∼ (Ntot)−p/d may be observed for d = 1 or d = 2, p ≤ 2, since

then the number of small cells does not increase too much.

Page 68: dune-fv a library for h-adaptive finite-volume schemes · G. Puppo (Univ. dell’Insubria, Como), G. Russo (Univ. Catania) SHARK-FV, 18th of May 2015 Partly supported by GNCS-INDAM,

A simple scaling argument

p order of the scheme (on smooth solution)

H coarse cell size

` refinement levels: fine cells are of size h = H/2`

O(Hp) typical error on smooth part, i.e. (1/H)d = Nd cells

O(h) typical error on shock, located on (d−1)-dimensionalsubmanifold

In order to reduce the total error by a factor 2p, we have to:

use coarse cells of size H/2

let the finest cells be of size h/2p, by increasing the availablenumber of refinement levels by p−1.

E ∼ (Ntot)−p/d may be observed for d = 1 or d = 2, p ≤ 2, since

then the number of small cells does not increase too much.

Page 69: dune-fv a library for h-adaptive finite-volume schemes · G. Puppo (Univ. dell’Insubria, Como), G. Russo (Univ. Catania) SHARK-FV, 18th of May 2015 Partly supported by GNCS-INDAM,

A simple scaling argument

p order of the scheme (on smooth solution)

H coarse cell size

` refinement levels: fine cells are of size h = H/2`

O(Hp) typical error on smooth part, i.e. (1/H)d = Nd cells

O(h) typical error on shock, located on (d−1)-dimensionalsubmanifold

In order to reduce the total error by a factor 2p, we have to:

use coarse cells of size H/2

let the finest cells be of size h/2p, by increasing the availablenumber of refinement levels by p−1.

E ∼ (Ntot)−p/d may be observed for d = 1 or d = 2, p ≤ 2, since

then the number of small cells does not increase too much.

Page 70: dune-fv a library for h-adaptive finite-volume schemes · G. Puppo (Univ. dell’Insubria, Como), G. Russo (Univ. Catania) SHARK-FV, 18th of May 2015 Partly supported by GNCS-INDAM,

Burgers equation: formation of standing shock

101

102

103

10−4

10−3

10−2

10−1

no

rm−

1 e

rro

rs

average N cells

Burgers equation with standing shock

r=2, unif

r=2, L=3, s=2

r=2, L=3+, s=2

Page 71: dune-fv a library for h-adaptive finite-volume schemes · G. Puppo (Univ. dell’Insubria, Como), G. Russo (Univ. Catania) SHARK-FV, 18th of May 2015 Partly supported by GNCS-INDAM,

Burgers equation: formation of standing shock

101

102

103

10−4

10−3

10−2

10−1

no

rm−

1 e

rro

rs

average N cells

Burgers equation with standing shock

r=3, unif

r=3, L=3, s=2

r=3, L=3+, s=2

r=3, L=3++, s=2

r=3, L=3+, s=4

Page 72: dune-fv a library for h-adaptive finite-volume schemes · G. Puppo (Univ. dell’Insubria, Como), G. Russo (Univ. Catania) SHARK-FV, 18th of May 2015 Partly supported by GNCS-INDAM,

Burgers equation: solution with moving shocks

−1 −0.8 −0.6 −0.4 −0.2 0 0.2 0.4 0.6 0.8 1−1.5

−1

−0.5

0

0.5

1

1.5

Burgers equation with moving shocks

t=0

t=0.25

Page 73: dune-fv a library for h-adaptive finite-volume schemes · G. Puppo (Univ. dell’Insubria, Como), G. Russo (Univ. Catania) SHARK-FV, 18th of May 2015 Partly supported by GNCS-INDAM,

Burgers equation: solution with moving shocks

102

103

10−4

10−3

10−2

10−1

no

rm−

1 e

rro

rs

average N cells

Burgers equation with moving shocks

r=2, unif

r=2, L=3+, s=2

r=3, unif

r=3, L=3++, s=2

Page 74: dune-fv a library for h-adaptive finite-volume schemes · G. Puppo (Univ. dell’Insubria, Como), G. Russo (Univ. Catania) SHARK-FV, 18th of May 2015 Partly supported by GNCS-INDAM,

1d Euler equations: shock-acoustic interaction

0.2 0.3 0.4 0.5 0.6 0.7 0.8

3

3.2

3.4

3.6

3.8

4

4.2

4.4

4.6

4.8

Shock−acoustic interaction

reference

N=1024

N=512

Page 75: dune-fv a library for h-adaptive finite-volume schemes · G. Puppo (Univ. dell’Insubria, Como), G. Russo (Univ. Catania) SHARK-FV, 18th of May 2015 Partly supported by GNCS-INDAM,

1d Euler equations: shock-acoustic interaction

0.2 0.3 0.4 0.5 0.6 0.7 0.8

3

3.2

3.4

3.6

3.8

4

4.2

4.4

4.6

4.8

Shock−acoustic interaction

referenceN

0=256, L=12, S

ref=1e−2 (<N>=656)

Page 76: dune-fv a library for h-adaptive finite-volume schemes · G. Puppo (Univ. dell’Insubria, Como), G. Russo (Univ. Catania) SHARK-FV, 18th of May 2015 Partly supported by GNCS-INDAM,

1d Euler equations: shock-acoustic interaction

0.2 0.3 0.4 0.5 0.6 0.7 0.8

0

2

4

6

8

10

Adaptive solution with r=3, N0=256, L=12, ε=1e−2

x

ce

ll l

ev

el

Page 77: dune-fv a library for h-adaptive finite-volume schemes · G. Puppo (Univ. dell’Insubria, Como), G. Russo (Univ. Catania) SHARK-FV, 18th of May 2015 Partly supported by GNCS-INDAM,

1d Euler equations: shock-acoustic interaction

102

103

104

10−3

10−2

10−1

no

rm−

1 e

rro

rs

average N cells

Shock−acoustic interaction

r=2, L=1

r=2, L=6+, s=2

r=2, L=6+, s=4

r=3, L=1

r=3, L=6++, s=2

r=3, L=6++, s=4

Page 78: dune-fv a library for h-adaptive finite-volume schemes · G. Puppo (Univ. dell’Insubria, Como), G. Russo (Univ. Catania) SHARK-FV, 18th of May 2015 Partly supported by GNCS-INDAM,

2d Riemann problem

102

103

10−3

10−2

no

rm−

1 e

rro

rs

(average N cells)1/2

2D Riemann problem

r=2, L=1

r=2, L=4, s=2

r=2, L=4+, s=2

r=3, L=1

r=3, L=4+, s=2

r=3, L=4++, s=2

Page 79: dune-fv a library for h-adaptive finite-volume schemes · G. Puppo (Univ. dell’Insubria, Como), G. Russo (Univ. Catania) SHARK-FV, 18th of May 2015 Partly supported by GNCS-INDAM,

2d Riemann problem

0 0.2 0.4 0.6 0.8 10

0.1

0.2

0.3

0.4

0.5

0.6

0.7

0.8

0.9

1

Cell level (r=2)

0

1

2

3

0 0.2 0.4 0.6 0.8 10

0.1

0.2

0.3

0.4

0.5

0.6

0.7

0.8

0.9

1

Cell level (r=3)

0

1

2

3

Page 80: dune-fv a library for h-adaptive finite-volume schemes · G. Puppo (Univ. dell’Insubria, Como), G. Russo (Univ. Catania) SHARK-FV, 18th of May 2015 Partly supported by GNCS-INDAM,

2d Euler equations: shock-bubble interaction

Page 81: dune-fv a library for h-adaptive finite-volume schemes · G. Puppo (Univ. dell’Insubria, Como), G. Russo (Univ. Catania) SHARK-FV, 18th of May 2015 Partly supported by GNCS-INDAM,

2d Euler equations: shock-bubble interaction

Comparison of the solutions (Schlieren plots)

The third order solution is much sharper.

Page 82: dune-fv a library for h-adaptive finite-volume schemes · G. Puppo (Univ. dell’Insubria, Como), G. Russo (Univ. Catania) SHARK-FV, 18th of May 2015 Partly supported by GNCS-INDAM,

2d Euler equations: shock-bubble interaction

Grids (blue) and solutions (gray levels)

The third order solution is much sharperand it is computed on a much coarser grid!

Page 83: dune-fv a library for h-adaptive finite-volume schemes · G. Puppo (Univ. dell’Insubria, Como), G. Russo (Univ. Catania) SHARK-FV, 18th of May 2015 Partly supported by GNCS-INDAM,

1 FV schemes on locally adapted meshes

2 1D reconstructions for non-uniform meshes

3 2D reconstructions for non-uniform meshes

4 h-adaptive code and tests

5 The dune-fv library

Page 84: dune-fv a library for h-adaptive finite-volume schemes · G. Puppo (Univ. dell’Insubria, Como), G. Russo (Univ. Catania) SHARK-FV, 18th of May 2015 Partly supported by GNCS-INDAM,

The dune-fv library

Download source code from my webpage (GPL licence)After download you can integrate

on locally adapted quad-tree meshes

linear advection, Burgers’, uniform and non-uniform rotationin 2D, Euler equations

with spatial reconstructions up to order 3

with Runge-Kutta up to order 3

with numerical entropy as error indicator

Design principles:

DUNE library (www.dune-project.org) for grid management

coded in C++

make (heavy) use of polymorphism for maximum flexibility

all polymorphism is static (CRTP) for efficiency

easy to provide your own “plug-in”

Page 85: dune-fv a library for h-adaptive finite-volume schemes · G. Puppo (Univ. dell’Insubria, Como), G. Russo (Univ. Catania) SHARK-FV, 18th of May 2015 Partly supported by GNCS-INDAM,

The dune-fv library

Download source code from my webpage (GPL licence)After download you can integrate

on locally adapted quad-tree meshes

linear advection, Burgers’, uniform and non-uniform rotationin 2D, Euler equations

with spatial reconstructions up to order 3

with Runge-Kutta up to order 3

with numerical entropy as error indicator

Design principles:

DUNE library (www.dune-project.org) for grid management

coded in C++

make (heavy) use of polymorphism for maximum flexibility

all polymorphism is static (CRTP) for efficiency

easy to provide your own “plug-in”

Page 86: dune-fv a library for h-adaptive finite-volume schemes · G. Puppo (Univ. dell’Insubria, Como), G. Russo (Univ. Catania) SHARK-FV, 18th of May 2015 Partly supported by GNCS-INDAM,

Compile-time options

Compiles for linear advection, 1D, second order

dune-fv/src$ make dune_fv

Compiles with reconstructions of order n = 1, 2, 3

dune-fv/src$ make CPPFLAGS=’-D FV_REC=n’ dune_fv

or Runge-Kutta of order m = 1, 2, 3

dune-fv/src$ make CPPFLAGS=’-D FV_RK=m’ dune_fv

Compiles for 2D with quad-tree mesh of quadriraterals.

dune-fv/src$ make GRIDDIM=2 GRUDTYPE=ALUGRID_CUBE dune_fv

Page 87: dune-fv a library for h-adaptive finite-volume schemes · G. Puppo (Univ. dell’Insubria, Como), G. Russo (Univ. Catania) SHARK-FV, 18th of May 2015 Partly supported by GNCS-INDAM,

Structure of the main loop

main.cc#include "dune/fv/claw/claw_linear.hh"

typedef CLawLinear<GRIDDIM> CLaw;

#include "dune/fv/flux/llfe.hh"

typedef LLFE<CLaw> F;

#include "dune/fv/rec/reccweno.hh"

typedef RecP2<G,M,t_Urk,flagVec> Reconstruction;

typedef HeunTableaux Tableaux;

typedef ERK<Tableaux,G,M,F,Reconstruction,flagVec> RungeKutta;

RungeKutta RK(grid,mapper,Ui,Fi,Uf,Ff,Icons/*,Idiff*/);

while (t<tfin)

dt = RK.advance(t);

t += dt;

Page 88: dune-fv a library for h-adaptive finite-volume schemes · G. Puppo (Univ. dell’Insubria, Como), G. Russo (Univ. Catania) SHARK-FV, 18th of May 2015 Partly supported by GNCS-INDAM,

Conservation laws: the base class

clawbase.hh

//System of m conservation laws in dim spatial dimensions

template<class CLaw, int D, int M>

class CLawBase

public:

enum dim=D;

enum m=M;

typedef DoF<M> t_u;

typedef typename Dune::FieldVector<double,D> t_c;

CLawBase(t_u& _u):u(_u) //constructor from DoF of cell

t_u getF(t_c n, t_c x, double t) return ReferToDerived().getF(u,n,x,t);

double getVmax(t_c n, t_c x, double t)return ReferToDerived().getVmax(u,n,x,t);

double getVnormal(t_c n, t_c x, double t)return ReferToDerived().getVnormal(u,n,x,t);

double getEnt()return ReferToDerived().getEnt(u);

double getEntF(t_c n, t_c x, double t)return ReferToDerived().getEntF(u);

protected:

t_u &u;

private:

const CLaw& ReferToDerived() constreturn static_cast<const CLaw&>(*this);

;

Page 89: dune-fv a library for h-adaptive finite-volume schemes · G. Puppo (Univ. dell’Insubria, Como), G. Russo (Univ. Catania) SHARK-FV, 18th of May 2015 Partly supported by GNCS-INDAM,

Conservation laws

Defining a new scalar conservation law in 2Dmynewclaw.hh

class MyNewCLaw : public CLawBase<MyNewCLaw,2,1>

public:

MyNewCLaw(t_u _u):t_CLawBase(_u) //constructor

t_u getF(t_c n, t_c x, double t); //exact flux in direction n

double getEnt(); //entropy function

double getEntF(t_c n, t_c x, double t);

private:

//private data if needed (e.g. pressure for Euler eqns.)

//note that CLawBase already stores a reference to _u

;

Page 90: dune-fv a library for h-adaptive finite-volume schemes · G. Puppo (Univ. dell’Insubria, Como), G. Russo (Univ. Catania) SHARK-FV, 18th of May 2015 Partly supported by GNCS-INDAM,

Conclusions

FV scheme, AMR on quad-tree mesh, no virtual cells

numerical entropy production driving AMR

CWENO reconstructions in 1D and 2D nonuniform grids

3rd order stencil is very small: first neighbours

3rd order scheme employs much coarser grids

coding based on DUNE library (www.dune-project.org)

my code (the dune-fv module) is available athttp://www.personalweb.unito.it/matteo.semplice/

future work: MOOD, local timestepping. . .

Thanks for the attention!

Page 91: dune-fv a library for h-adaptive finite-volume schemes · G. Puppo (Univ. dell’Insubria, Como), G. Russo (Univ. Catania) SHARK-FV, 18th of May 2015 Partly supported by GNCS-INDAM,

Conclusions

FV scheme, AMR on quad-tree mesh, no virtual cells

numerical entropy production driving AMR

CWENO reconstructions in 1D and 2D nonuniform grids

3rd order stencil is very small: first neighbours

3rd order scheme employs much coarser grids

coding based on DUNE library (www.dune-project.org)

my code (the dune-fv module) is available athttp://www.personalweb.unito.it/matteo.semplice/

future work: MOOD, local timestepping. . .

Thanks for the attention!


Recommended