Godunov/Roe Fluxes - TUM · 2015. 5. 20. · Godunov’s method A step further: Find the solution...

24
Technische Universit¨ at M ¨ unchen Godunov/Roe Fluxes Oliver Meister May 20 th 2015 Oliver Meister: Godunov/Roe Fluxes , May 20 th 2015 1

Transcript of Godunov/Roe Fluxes - TUM · 2015. 5. 20. · Godunov’s method A step further: Find the solution...

Page 1: Godunov/Roe Fluxes - TUM · 2015. 5. 20. · Godunov’s method A step further: Find the solution to the general Riemann problem (see last talk). Evaluate the solution at the cell

Technische Universitat Munchen

Godunov/Roe Fluxes

Oliver Meister

May 20th 2015

Oliver Meister: Godunov/Roe Fluxes

, May 20th 2015 1

Page 2: Godunov/Roe Fluxes - TUM · 2015. 5. 20. · Godunov’s method A step further: Find the solution to the general Riemann problem (see last talk). Evaluate the solution at the cell

Technische Universitat Munchen

Integral form of Conservation Law

Start point: Integral form of a general conservation law in 1D:For any x1, x2, t1, t2 ∈ R the quantity q is conserved if:

x2∫x1

q(x , t2)− q(x , t1) dx +

t2∫t1

f (q(x2, t))− f (q(x1, t))dt = 0 (1)

where:• x , t ∈ R: space and time variables• q : R× R→ Rd : conserved quantity vector

(function over space and time)• f : Rd → Rd : flux function

Oliver Meister: Godunov/Roe Fluxes

, May 20th 2015 2

Page 3: Godunov/Roe Fluxes - TUM · 2015. 5. 20. · Godunov’s method A step further: Find the solution to the general Riemann problem (see last talk). Evaluate the solution at the cell

Technische Universitat Munchen

FV discretization

Finite Volumes: subdivision of domain into grid cells, eachdenoted by a range Ci := (xi− 1

2, xi+ 1

2).

Similarly, we choose a finite set of time steps (tn)n=1...N This

gives the following update rule:

xi+ 1

2∫x

i− 12

q(x , tn+1)− q(x , tn)dx =

tn+1∫tn

f (q(xi− 12, t))− f (q(xi+ 1

2, t))dt

(2)Note: No approximation has been performed. So far we havean exact solver.

Oliver Meister: Godunov/Roe Fluxes

, May 20th 2015 3

Page 4: Godunov/Roe Fluxes - TUM · 2015. 5. 20. · Godunov’s method A step further: Find the solution to the general Riemann problem (see last talk). Evaluate the solution at the cell

Technische Universitat Munchen

FV discretization

Discretization:Average q over space by Qn

i := 1∆x

∫Ci

q(x , tn)dx .

Average f (q) over time by F ni+ 1

2:= 1

∆t

tn+1∫tn

f (q(xi+ 12, t))dt .

⇒ Qn+1i = Qn

i −∆t∆x

(F ni+ 1

2− F n

i− 12)

Problem: Assume Qni is known, how do we get F n

i− 12, F n

i+ 12

in

order to compute Qn+1i ?

Oliver Meister: Godunov/Roe Fluxes

, May 20th 2015 4

Page 5: Godunov/Roe Fluxes - TUM · 2015. 5. 20. · Godunov’s method A step further: Find the solution to the general Riemann problem (see last talk). Evaluate the solution at the cell

Technische Universitat Munchen

FV discretization

Discretization:Average q over space by Qn

i := 1∆x

∫Ci

q(x , tn)dx .

Average f (q) over time by F ni+ 1

2:= 1

∆t

tn+1∫tn

f (q(xi+ 12, t))dt .

⇒ Qn+1i = Qn

i −∆t∆x

(F ni+ 1

2− F n

i− 12)

Problem: Assume Qni is known, how do we get F n

i− 12, F n

i+ 12

in

order to compute Qn+1i ?

Oliver Meister: Godunov/Roe Fluxes

, May 20th 2015 4

Page 6: Godunov/Roe Fluxes - TUM · 2015. 5. 20. · Godunov’s method A step further: Find the solution to the general Riemann problem (see last talk). Evaluate the solution at the cell

Technische Universitat Munchen

FV discretization

Discretization:Average q over space by Qn

i := 1∆x

∫Ci

q(x , tn)dx .

Average f (q) over time by F ni+ 1

2:= 1

∆t

tn+1∫tn

f (q(xi+ 12, t))dt .

⇒ Qn+1i = Qn

i −∆t∆x

(F ni+ 1

2− F n

i− 12)

Problem: Assume Qni is known, how do we get F n

i− 12, F n

i+ 12

in

order to compute Qn+1i ?

Oliver Meister: Godunov/Roe Fluxes

, May 20th 2015 4

Page 7: Godunov/Roe Fluxes - TUM · 2015. 5. 20. · Godunov’s method A step further: Find the solution to the general Riemann problem (see last talk). Evaluate the solution at the cell

Technische Universitat Munchen

An unstable method

Problem: Assume Qni is known, how do we get F n

i− 12, F n

i+ 12

in

order to compute Qn+1i ?

Use a numerical flux function

F ni+ 1

2= F(Qn

i ,Qni+1)

First attempt:

F(Qni ,Q

ni+1) :=

12

(f (Qni ) + f (Qn

i+1))

Resulting method:

Qn+1i = Qn

i −∆t

2∆x(f (Qn

i+1)− f (Qni−1))

⇒ Central difference term, unstable.

Oliver Meister: Godunov/Roe Fluxes

, May 20th 2015 5

Page 8: Godunov/Roe Fluxes - TUM · 2015. 5. 20. · Godunov’s method A step further: Find the solution to the general Riemann problem (see last talk). Evaluate the solution at the cell

Technische Universitat Munchen

An unstable method

Problem: Assume Qni is known, how do we get F n

i− 12, F n

i+ 12

in

order to compute Qn+1i ?

Use a numerical flux function

F ni+ 1

2= F(Qn

i ,Qni+1)

First attempt:

F(Qni ,Q

ni+1) :=

12

(f (Qni ) + f (Qn

i+1))

Resulting method:

Qn+1i = Qn

i −∆t

2∆x(f (Qn

i+1)− f (Qni−1))

⇒ Central difference term, unstable.

Oliver Meister: Godunov/Roe Fluxes

, May 20th 2015 5

Page 9: Godunov/Roe Fluxes - TUM · 2015. 5. 20. · Godunov’s method A step further: Find the solution to the general Riemann problem (see last talk). Evaluate the solution at the cell

Technische Universitat Munchen

An unstable method

Problem: Assume Qni is known, how do we get F n

i− 12, F n

i+ 12

in

order to compute Qn+1i ?

Use a numerical flux function

F ni+ 1

2= F(Qn

i ,Qni+1)

First attempt:

F(Qni ,Q

ni+1) :=

12

(f (Qni ) + f (Qn

i+1))

Resulting method:

Qn+1i = Qn

i −∆t

2∆x(f (Qn

i+1)− f (Qni−1))

⇒ Central difference term, unstable.Oliver Meister: Godunov/Roe Fluxes

, May 20th 2015 5

Page 10: Godunov/Roe Fluxes - TUM · 2015. 5. 20. · Godunov’s method A step further: Find the solution to the general Riemann problem (see last talk). Evaluate the solution at the cell

Technische Universitat Munchen

Lax-Friedrichs Method

Problem: Assume Qni is known, how do we get F n

i− 12, F n

i+ 12

in

order to compute Qn+1i ?

Use a numerical flux function

F ni+ 1

2= F(Qn

i ,Qni+1)

Another attempt:

F(Qni ,Q

ni+1) :=

12

(f (Qni ) + f (Qn

i+1))− ∆t∆x

(Qni+1 −Qn

i )

Resulting method:

Qn+1i =

12

(Qni−1 + Qn

i+1) +∆t

2∆x(f (Qn

i+1)− f (Qni−1))

⇒ Lax-Friedrichs Method, stable but diffusive.

Oliver Meister: Godunov/Roe Fluxes

, May 20th 2015 6

Page 11: Godunov/Roe Fluxes - TUM · 2015. 5. 20. · Godunov’s method A step further: Find the solution to the general Riemann problem (see last talk). Evaluate the solution at the cell

Technische Universitat Munchen

Lax-Friedrichs Method

Problem: Assume Qni is known, how do we get F n

i− 12, F n

i+ 12

in

order to compute Qn+1i ?

Use a numerical flux function

F ni+ 1

2= F(Qn

i ,Qni+1)

Another attempt:

F(Qni ,Q

ni+1) :=

12

(f (Qni ) + f (Qn

i+1))− ∆t∆x

(Qni+1 −Qn

i )

Resulting method:

Qn+1i =

12

(Qni−1 + Qn

i+1) +∆t

2∆x(f (Qn

i+1)− f (Qni−1))

⇒ Lax-Friedrichs Method, stable but diffusive.

Oliver Meister: Godunov/Roe Fluxes

, May 20th 2015 6

Page 12: Godunov/Roe Fluxes - TUM · 2015. 5. 20. · Godunov’s method A step further: Find the solution to the general Riemann problem (see last talk). Evaluate the solution at the cell

Technische Universitat Munchen

Lax-Friedrichs Method

Problem: Assume Qni is known, how do we get F n

i− 12, F n

i+ 12

in

order to compute Qn+1i ?

Use a numerical flux function

F ni+ 1

2= F(Qn

i ,Qni+1)

Another attempt:

F(Qni ,Q

ni+1) :=

12

(f (Qni ) + f (Qn

i+1))− ∆t∆x

(Qni+1 −Qn

i )

Resulting method:

Qn+1i =

12

(Qni−1 + Qn

i+1) +∆t

2∆x(f (Qn

i+1)− f (Qni−1))

⇒ Lax-Friedrichs Method, stable but diffusive.Oliver Meister: Godunov/Roe Fluxes

, May 20th 2015 6

Page 13: Godunov/Roe Fluxes - TUM · 2015. 5. 20. · Godunov’s method A step further: Find the solution to the general Riemann problem (see last talk). Evaluate the solution at the cell

Technische Universitat Munchen

Upwind Method

Idea: Use Riemann problems for scalar conservation laws inorder to approximate fluxes

• Riemann problem: constant function with a singlediscontinuity at x = 0 in an infinite domain

• Finite Volumes: piecewise constant function withdiscontinuities between cell interfaces

• Find a single shock solution on the cell interfaces→ solution q on the interface is either left state ql or rightstate qr . Then f (q) = f (ql) or f (qr ).

Oliver Meister: Godunov/Roe Fluxes

, May 20th 2015 7

Page 14: Godunov/Roe Fluxes - TUM · 2015. 5. 20. · Godunov’s method A step further: Find the solution to the general Riemann problem (see last talk). Evaluate the solution at the cell

Technische Universitat Munchen

Upwind Method

Result:

Qn+1i =

{Qn

i −∆t∆x (f (Qn

i )− f (Qni−1)) f ′(Qn

i ) ≥ 0Qn

i −∆t∆x (f (Qn

i+1)− f (Qni )) f ′(Qn

i ) < 0

Upwind method, works if f ′ ≥ 0 or f ′ < 0. But what aboutsystems of equations and rarefaction waves?

⇒ Godunov’s method, etc.

Oliver Meister: Godunov/Roe Fluxes

, May 20th 2015 8

Page 15: Godunov/Roe Fluxes - TUM · 2015. 5. 20. · Godunov’s method A step further: Find the solution to the general Riemann problem (see last talk). Evaluate the solution at the cell

Technische Universitat Munchen

Upwind Method

Result:

Qn+1i =

{Qn

i −∆t∆x (f (Qn

i )− f (Qni−1)) f ′(Qn

i ) ≥ 0Qn

i −∆t∆x (f (Qn

i+1)− f (Qni )) f ′(Qn

i ) < 0

Upwind method, works if f ′ ≥ 0 or f ′ < 0. But what aboutsystems of equations and rarefaction waves?

⇒ Godunov’s method, etc.

Oliver Meister: Godunov/Roe Fluxes

, May 20th 2015 8

Page 16: Godunov/Roe Fluxes - TUM · 2015. 5. 20. · Godunov’s method A step further: Find the solution to the general Riemann problem (see last talk). Evaluate the solution at the cell

Technische Universitat Munchen

Upwind Method

Result:

Qn+1i =

{Qn

i −∆t∆x (f (Qn

i )− f (Qni−1)) f ′(Qn

i ) ≥ 0Qn

i −∆t∆x (f (Qn

i+1)− f (Qni )) f ′(Qn

i ) < 0

Upwind method, works if f ′ ≥ 0 or f ′ < 0. But what aboutsystems of equations and rarefaction waves?

⇒ Godunov’s method, etc.

Oliver Meister: Godunov/Roe Fluxes

, May 20th 2015 8

Page 17: Godunov/Roe Fluxes - TUM · 2015. 5. 20. · Godunov’s method A step further: Find the solution to the general Riemann problem (see last talk). Evaluate the solution at the cell

Technische Universitat Munchen

Godunov’s method

A step further:

• Find the solution to the general Riemann problem(see last talk).

• Evaluate the solution at the cell interface. Due to theself-similarity of the Riemann solution, the result q◦ isconstant in time.

• ⇒ The numerical flux 1∆t

tn+1∫tn

f (q(x , t))dt reduces to the

simple formula f (q◦)

Oliver Meister: Godunov/Roe Fluxes

, May 20th 2015 9

Page 18: Godunov/Roe Fluxes - TUM · 2015. 5. 20. · Godunov’s method A step further: Find the solution to the general Riemann problem (see last talk). Evaluate the solution at the cell

Technische Universitat Munchen

Godunov’s method with Roe linearization

General Riemann problem is far too expensive, hence we try toapproximate the solution by linearization.

Goal: For each cell interface, find matrix A ∈ Rd×d such that thesystem

qt + Ai− 12qx = 0

approximates the original system

qt + f ′(q)qx = 0

by Ai− 12→ f ′(q) as Qi−1,Qi → q.

Oliver Meister: Godunov/Roe Fluxes

, May 20th 2015 10

Page 19: Godunov/Roe Fluxes - TUM · 2015. 5. 20. · Godunov’s method A step further: Find the solution to the general Riemann problem (see last talk). Evaluate the solution at the cell

Technische Universitat Munchen

Godunov’s method with Roe linearization

Assumption: A single shock wave with speed s connects Qiand Qi+1, so that

f (Qi)− f (Qi−1) = s · (Qi −Qi−1)

Our approximation must meet

Ai− 12(Qi −Qi+1) = s · (Qi −Qi−1) = f (Qi)− f (Qi−1)

Oliver Meister: Godunov/Roe Fluxes

, May 20th 2015 11

Page 20: Godunov/Roe Fluxes - TUM · 2015. 5. 20. · Godunov’s method A step further: Find the solution to the general Riemann problem (see last talk). Evaluate the solution at the cell

Technische Universitat Munchen

Godunov’s method with Roe linearization

Set:q(ξ) := Qi−1 + ξ · (Qi −Qi−1)

Then

f (Qi) − f (Qi−1) =

1∫0

df (q(ξ))

dξdξ =

1∫0

f ′(q(ξ))q′(ξ)dξ =

1∫0

f ′(q(ξ))dξ

(Qi −Qi−1)

So a suitable choice for A is1∫0

f ′(q(ξ))dξ.

Oliver Meister: Godunov/Roe Fluxes

, May 20th 2015 12

Page 21: Godunov/Roe Fluxes - TUM · 2015. 5. 20. · Godunov’s method A step further: Find the solution to the general Riemann problem (see last talk). Evaluate the solution at the cell

Technische Universitat Munchen

Godunov’s method with Roe linearization

Set:q(ξ) := Qi−1 + ξ · (Qi −Qi−1)

Then

f (Qi) − f (Qi−1) =

1∫0

df (q(ξ))

dξdξ =

1∫0

f ′(q(ξ))q′(ξ)dξ =

1∫0

f ′(q(ξ))dξ

(Qi −Qi−1)

So a suitable choice for A is1∫0

f ′(q(ξ))dξ.

Oliver Meister: Godunov/Roe Fluxes

, May 20th 2015 12

Page 22: Godunov/Roe Fluxes - TUM · 2015. 5. 20. · Godunov’s method A step further: Find the solution to the general Riemann problem (see last talk). Evaluate the solution at the cell

Technische Universitat Munchen

Godunov’s method with Roe linearization

Usually, instead of integrating over ξ a transformation z(ξ) isused to integrate a path on, because the resulting system mightnot be hyperbolic any more.

f (Qi)− f (Qi−1) =

1∫0

f ′(q(z(ξ)))dξ

(Zi − Zi−1)

where Zi = z(Qi),Zi−1 = z(Qi−1) and

Qi −Qi−1 =

1∫0

dq(z(ξ)))

dzdξ

(Zi − Zi−1)

Oliver Meister: Godunov/Roe Fluxes

, May 20th 2015 13

Page 23: Godunov/Roe Fluxes - TUM · 2015. 5. 20. · Godunov’s method A step further: Find the solution to the general Riemann problem (see last talk). Evaluate the solution at the cell

Technische Universitat Munchen

Roe solver for the 1D Shallow Water Equations

Nonlinear system of equations (ignoring source terms):[h

hu

]t

+

[hu

hu2 + 12gh2

]x

= 0

They can be described in quasilinear form:[h

hu

]t

+

[0 1

−(u)2 + gh 2u

] [h

hu

]x

= 0

Oliver Meister: Godunov/Roe Fluxes

, May 20th 2015 14

Page 24: Godunov/Roe Fluxes - TUM · 2015. 5. 20. · Godunov’s method A step further: Find the solution to the general Riemann problem (see last talk). Evaluate the solution at the cell

Technische Universitat Munchen

Roe solver for the 1D Shallow Water Equations

Choose as parameter vector z := 1√hq. Leaving out

intermediate steps we obtain:

A =

[0 1

−u2 + gh 2u

]as our Roe matrix with the arithmetic average h and the Roeaverage u. Applying Godunov’s method for the time step, wehave a full numerical scheme now.

Oliver Meister: Godunov/Roe Fluxes

, May 20th 2015 15