40
1 Romain Teyssier 5th JETSET School Numerical Solutions for Hyperbolic Systems of Conservation Laws: from Godunov Method to Adaptive Mesh Refinement Romain Teyssier CEA Saclay

Numerical Solutions for Hyperbolic Systems of Conservation ... · Spectral methods can show exponential convergence. More flexible approaches: use ultra-high-order shock-capturing

  • Upload
    others

  • View
    0

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Numerical Solutions for Hyperbolic Systems of Conservation ... · Spectral methods can show exponential convergence. More flexible approaches: use ultra-high-order shock-capturing

1Romain Teyssier5th JETSET School

Numerical Solutions for

Hyperbolic Systems of

Conservation Laws:

from Godunov Method to

Adaptive Mesh Refinement

Romain Teyssier

CEA Saclay

Page 2: Numerical Solutions for Hyperbolic Systems of Conservation ... · Spectral methods can show exponential convergence. More flexible approaches: use ultra-high-order shock-capturing

2Romain Teyssier5th JETSET School

- Euler equations, MHD, waves, hyperbolic systems of conservationlaws, primitive form, conservative form, integral form

- Advection equation, exact solution, characteristic curve, Riemanninvariant, finite difference scheme, modified equation, Von Neumananalysis, upwind scheme, Courant condition, Second order scheme

- Finite volume scheme, Godunov method, Riemann problem,approximate Riemann solver, Second order scheme, Slope limiters,Characteristic tracing

- Multidimensional scheme, directional splitting, Godunov, Runge-Kutta, CTU, 3D slope limiting

- AMR, patch-based versus cell-based, octree structure, gradedoctree, flux correction, EMF correction, restriction and prolongation,divB conserving interpolation

- Parallel computing with the RAMSES code

Outline

Page 3: Numerical Solutions for Hyperbolic Systems of Conservation ... · Spectral methods can show exponential convergence. More flexible approaches: use ultra-high-order shock-capturing

3Romain Teyssier5th JETSET School

Lagrangian form: fluid element of unit mass

- Mass conservation:

- Euler equation:

- First law of thermodynamics:

Chain rule:

from Lagrange derivative to Euler derivative

Volume expansion rate:

The Euler equations

Page 4: Numerical Solutions for Hyperbolic Systems of Conservation ... · Spectral methods can show exponential convergence. More flexible approaches: use ultra-high-order shock-capturing

4Romain Teyssier5th JETSET School

Eulerian form: fixed volume element

- Mass conservation

- Momentum conservation

- Energy conservation

The Euler equations

Kinetic energy Internal energy Equation of state

Page 5: Numerical Solutions for Hyperbolic Systems of Conservation ... · Spectral methods can show exponential convergence. More flexible approaches: use ultra-high-order shock-capturing

5Romain Teyssier5th JETSET School

The Euler equations

System of conservation laws

- Vector of conservative variables

- Flux function

Integral form

x

t

x2x1

t1

t2

Page 6: Numerical Solutions for Hyperbolic Systems of Conservation ... · Spectral methods can show exponential convergence. More flexible approaches: use ultra-high-order shock-capturing

6Romain Teyssier5th JETSET School

The Euler equations

Primitive form of the Euler equations:

- Vector of primitive variables

- Quasi-linear form

Page 7: Numerical Solutions for Hyperbolic Systems of Conservation ... · Spectral methods can show exponential convergence. More flexible approaches: use ultra-high-order shock-capturing

7Romain Teyssier5th JETSET School

The Euler equations

Hyperbolic system: J and A have real eigenvalues.

Eigenvectors are travelling waves.

Perturbation of an equilibrium state:

Wave equation:

Eigenvalues:A=

Sound speed: Eigenvectors:

Page 8: Numerical Solutions for Hyperbolic Systems of Conservation ... · Spectral methods can show exponential convergence. More flexible approaches: use ultra-high-order shock-capturing

8Romain Teyssier5th JETSET School

Linear scalar partial differential equation:

Initial conditions:

Defining and using the chain rule, we get:

Along the characteristic curve

we have the Riemann invariant

The advection equation

x

u

t=0

t>0

a x t

Page 9: Numerical Solutions for Hyperbolic Systems of Conservation ... · Spectral methods can show exponential convergence. More flexible approaches: use ultra-high-order shock-capturing

9Romain Teyssier5th JETSET School

Piecewise constant initial states:

Solution:

The Riemann problem

x

u

uL

uR

Page 10: Numerical Solutions for Hyperbolic Systems of Conservation ... · Spectral methods can show exponential convergence. More flexible approaches: use ultra-high-order shock-capturing

10Romain Teyssier5th JETSET School

Finite difference scheme

Finite difference approximation of the advection equation

Page 11: Numerical Solutions for Hyperbolic Systems of Conservation ... · Spectral methods can show exponential convergence. More flexible approaches: use ultra-high-order shock-capturing

11Romain Teyssier5th JETSET School

The Modified Equation

Taylor expansion in time up to second order

Taylor expansion in space up to second order

The advection equation becomes the advection-diffusion equation

Negative diffusion coefficient: the scheme is unconditionally unstable

Page 12: Numerical Solutions for Hyperbolic Systems of Conservation ... · Spectral methods can show exponential convergence. More flexible approaches: use ultra-high-order shock-capturing

12Romain Teyssier5th JETSET School

The Upwind scheme

a>0: use only upwind values, discard downwind variables

Taylor expansion up to second order:

Upwind scheme is stable if C<1, with

Page 13: Numerical Solutions for Hyperbolic Systems of Conservation ... · Spectral methods can show exponential convergence. More flexible approaches: use ultra-high-order shock-capturing

13Romain Teyssier5th JETSET School

Von Neumann analysis

Fourier transform the current solution:

Evaluate the amplification factor of the 2 schemes.

Fromm scheme:

Upwind scheme:

ω>1: the scheme is unconditionally unstable

ω<1 if C<1: the scheme is stable under the Courant condition.

Page 14: Numerical Solutions for Hyperbolic Systems of Conservation ... · Spectral methods can show exponential convergence. More flexible approaches: use ultra-high-order shock-capturing

14Romain Teyssier5th JETSET School

The advection-diffusion equation

Finite difference approximation of the advection equation:

Central differencing unstable:

Upwind differencing is stable:

Smearing of initialdiscontinuity:

“numerical diffusion”

Thickness increases

as

Page 15: Numerical Solutions for Hyperbolic Systems of Conservation ... · Spectral methods can show exponential convergence. More flexible approaches: use ultra-high-order shock-capturing

15Romain Teyssier5th JETSET School

Finite volume scheme

Finite volume approximation of the advection equation:

Use integral form of the conservation law:

Exact evolution of volume averaged quantities:

Time averaged flux function:

Page 16: Numerical Solutions for Hyperbolic Systems of Conservation ... · Spectral methods can show exponential convergence. More flexible approaches: use ultra-high-order shock-capturing

16Romain Teyssier5th JETSET School

Sergei Konstantinovich Godunov

Page 17: Numerical Solutions for Hyperbolic Systems of Conservation ... · Spectral methods can show exponential convergence. More flexible approaches: use ultra-high-order shock-capturing

17Romain Teyssier5th JETSET School

Godunov scheme for the advection equation

The time averaged flux function:

is computed using the solution of the Riemann problem defined at cell interfaces with piecewise constant initial data.

x

ui

ui+1

For all t>0:

The Godunov scheme for the advection equation is identical tothe upwind finite difference scheme.

Page 18: Numerical Solutions for Hyperbolic Systems of Conservation ... · Spectral methods can show exponential convergence. More flexible approaches: use ultra-high-order shock-capturing

18Romain Teyssier5th JETSET School

The time average flux function iscomputed using the self-similarsolution of the inter-cell Riemannproblem:

Godunov scheme for hyperbolic systemsThe system of conservation laws

is discretized using the followingintegral form:

This defines the Godunov flux:

Advection: 1 wave, Euler: 3 waves, MHD: 7 waves

Piecewise constantinitial data

Page 19: Numerical Solutions for Hyperbolic Systems of Conservation ... · Spectral methods can show exponential convergence. More flexible approaches: use ultra-high-order shock-capturing

19Romain Teyssier5th JETSET School

Riemann solvers

Exact Riemann solution is costly: involves Raphson-Newtoniterations and complex non-linear functions.

Approximate Riemann solvers are more useful.

Two broad classes:

- Linear solvers

- HLL solvers

Page 20: Numerical Solutions for Hyperbolic Systems of Conservation ... · Spectral methods can show exponential convergence. More flexible approaches: use ultra-high-order shock-capturing

20Romain Teyssier5th JETSET School

Linear Riemann solvers

Define a reference state as the arithmetic average or the Roe average

Evaluate the Jacobian matrix at this reference state.

Compute eignevalues and (left and right) eigenvectors

The flux function is given by the linear Riemann solution.

where

A simple example, the upwind Riemann solver:

Page 21: Numerical Solutions for Hyperbolic Systems of Conservation ... · Spectral methods can show exponential convergence. More flexible approaches: use ultra-high-order shock-capturing

21Romain Teyssier5th JETSET School

Approximate the true Riemann fan by 2 waves and 1 intermediate state:

HLL Riemann solver

x

t

UL UR

U*

Compute U* using the integral form between SLt and SRt

Compute F* using the integral form between SLt and 0.

Page 22: Numerical Solutions for Hyperbolic Systems of Conservation ... · Spectral methods can show exponential convergence. More flexible approaches: use ultra-high-order shock-capturing

22Romain Teyssier5th JETSET School

Other HLL-type Riemann solvers

Lax-Friedrich Riemann solver:

HLLC Riemann solver: add a third wave for the contact (entropy) wave.

x

t

UL UR

U*L

SL SRS*

U*R

See Toro (1997) for details.

Page 23: Numerical Solutions for Hyperbolic Systems of Conservation ... · Spectral methods can show exponential convergence. More flexible approaches: use ultra-high-order shock-capturing

23Romain Teyssier5th JETSET School

Higher Order Godunov schemes

Bram Van Leer

Godunov method is stable but very diffusive. It wasabandoned for two decades, until…

Page 24: Numerical Solutions for Hyperbolic Systems of Conservation ... · Spectral methods can show exponential convergence. More flexible approaches: use ultra-high-order shock-capturing

24Romain Teyssier5th JETSET School

Second Order Godunov scheme

x

ui

ui+1Piecewise linearapproximation of the solution:

The linear profile introduces a length scale: theRiemann solution is not self-similar anymore:

The flux function is approximated using a predictor-corrector scheme:

The corrected Riemann solver has now predicted states as initial data:

Page 25: Numerical Solutions for Hyperbolic Systems of Conservation ... · Spectral methods can show exponential convergence. More flexible approaches: use ultra-high-order shock-capturing

25Romain Teyssier5th JETSET School

Predictor Step for the advection equation

x

ui

ui+1

The predicted states are computedusing a Taylor expansion in spaceand time:

Second order predicted states are the new initial conditions forthe Riemann solver:

The corrected flux function is the upwind predicted state:

Page 26: Numerical Solutions for Hyperbolic Systems of Conservation ... · Spectral methods can show exponential convergence. More flexible approaches: use ultra-high-order shock-capturing

26Romain Teyssier5th JETSET School

Modified equation for the second order scheme

Taylor expansion in space and time up to third order:

We obtain a dispersive term and the scheme is stable for C<1.

Page 27: Numerical Solutions for Hyperbolic Systems of Conservation ... · Spectral methods can show exponential convergence. More flexible approaches: use ultra-high-order shock-capturing

27Romain Teyssier5th JETSET School

Summary: the MUSCL scheme for systems

Compute second order predicted states using a Taylor expansion:

Update conservative variables using corrected Godunov fluxes

Page 28: Numerical Solutions for Hyperbolic Systems of Conservation ... · Spectral methods can show exponential convergence. More flexible approaches: use ultra-high-order shock-capturing

28Romain Teyssier5th JETSET School

Monotonicity preserving schemes

We use the central finite difference approximation for the slope:

In this case, the solution is oscillatory, and therefore non physical.

Second order linear scheme.

firstorder

secondorder

Oscillations are due to the non monotonicity of the numerical scheme.

A scheme is monotonicity preserving if:

- No new local extrema are created in the solution

- Local minimum (maximum) non decreasing (increasing) function of time.

Godunov theorem: only first order linear schemes are monotonicity preserving !

Page 29: Numerical Solutions for Hyperbolic Systems of Conservation ... · Spectral methods can show exponential convergence. More flexible approaches: use ultra-high-order shock-capturing

29Romain Teyssier5th JETSET School

Slope limiters

Harten introduced the Total Variation of the numerical solution:

Harten’s theorem: a Total Variation Diminishing (TVD) scheme ismonotonicity preserving.

Design non-linear TVD second order scheme using slope limiters:

where the slope limiter is a non-linear function satisfying:

Page 30: Numerical Solutions for Hyperbolic Systems of Conservation ... · Spectral methods can show exponential convergence. More flexible approaches: use ultra-high-order shock-capturing

30Romain Teyssier5th JETSET School

No local extrema

We define 3 local slopes: left, right and central slopes

and

x

ui

ui+1

ui-1

New maximum !

For all slope limiters:

Page 31: Numerical Solutions for Hyperbolic Systems of Conservation ... · Spectral methods can show exponential convergence. More flexible approaches: use ultra-high-order shock-capturing

31Romain Teyssier5th JETSET School

The minmod slope

x

ui

ui+1

ui-1

Linear reconstruction is monotone at time tn

Slope limiting is never truly second order !

Page 32: Numerical Solutions for Hyperbolic Systems of Conservation ... · Spectral methods can show exponential convergence. More flexible approaches: use ultra-high-order shock-capturing

32Romain Teyssier5th JETSET School

The moncen slope

x

ui

ui+1

ui-1

Extreme values don’t overshoot initial average states.

Page 33: Numerical Solutions for Hyperbolic Systems of Conservation ... · Spectral methods can show exponential convergence. More flexible approaches: use ultra-high-order shock-capturing

33Romain Teyssier5th JETSET School

The superbee slope

Predicted states don’t overshoot initial average states.

TVD constraint is preserved by the Riemann solver.

The Courant factor now enters the slope definition.

Page 34: Numerical Solutions for Hyperbolic Systems of Conservation ... · Spectral methods can show exponential convergence. More flexible approaches: use ultra-high-order shock-capturing

34Romain Teyssier5th JETSET School

The ultrabee slope

Use the final state to compute the slope limiter.

Upwind Total Variation constraint.

Strict Total Variation preserving limiter.

Page 35: Numerical Solutions for Hyperbolic Systems of Conservation ... · Spectral methods can show exponential convergence. More flexible approaches: use ultra-high-order shock-capturing

35Romain Teyssier5th JETSET School

Summary: slope limiters

first order

minmod moncen

superbee ultrabee

Page 36: Numerical Solutions for Hyperbolic Systems of Conservation ... · Spectral methods can show exponential convergence. More flexible approaches: use ultra-high-order shock-capturing

36Romain Teyssier5th JETSET School

Non linear systems: characteristics tracing.

x

ui

ui+1 Non-linear Riemann problems: waves speedsdepend on the input states.

TVD schemes are not necessary monotone.

Modify the predictor step according to the localRiemann solution: Piecewise Linear Method(PLM) and Piecewise Parabolic Method (PPM).

If

else

If

else

Page 37: Numerical Solutions for Hyperbolic Systems of Conservation ... · Spectral methods can show exponential convergence. More flexible approaches: use ultra-high-order shock-capturing

37Romain Teyssier5th JETSET School

Multidimensional Godunov schemes

2D Euler equations in integral (conservative) form

Flux functions are now time and space average.

2D Riemann problems interact along cell edges:

Even at first order, self-similarity does not apply to theflux functions anymore.

Predictor-corrector schemes ?

Page 38: Numerical Solutions for Hyperbolic Systems of Conservation ... · Spectral methods can show exponential convergence. More flexible approaches: use ultra-high-order shock-capturing

38Romain Teyssier5th JETSET School

Perform 1D Godunov scheme along each direction in sequence.

X step:

Y step:

Change direction at the next step using the same time step.Compute Δt, X step, Y step, t=t+Δt Y step, X step t=t+Δt

Courant factor per direction:

Courant condition:

Cost: 2 Riemann solves per time step.Second order based on corresponding 1D higher order method.

Directional (Strang) splitting

Page 39: Numerical Solutions for Hyperbolic Systems of Conservation ... · Spectral methods can show exponential convergence. More flexible approaches: use ultra-high-order shock-capturing

39Romain Teyssier5th JETSET School

Unsplit schemes

Godunov schemeNo predictor step.Flux functions computed using 1DRiemann problem at time tn in eachnormal direction.2 Riemann solves per step.Courant condition:

Runge-Kutta schemePredictor step using the Godunovscheme and Δt/2.Flux functions computed using 1DRiemann problem at time tn+1/2 ineach normal direction.4 Riemann solves per step.Courant condition:

Corner Transport UpwindPredictor step in transverse directiononly using the 1D Godunov scheme.Flux functions computed using 1DRiemann problem at time tn+1/2 ineach normal direction.4 Riemann solves per step.Courant condition:

Second order schemes: multidimensional Taylorexpansions and multidimensional slope limiters.

Page 40: Numerical Solutions for Hyperbolic Systems of Conservation ... · Spectral methods can show exponential convergence. More flexible approaches: use ultra-high-order shock-capturing

40Romain Teyssier5th JETSET School

Beyond second order Godunov schemes ?

Smooth regions of the flowMore efficient to go to higher order.Spectral methods can show exponential convergence.More flexible approaches: use ultra-high-order shock-capturing schemes: WENO, discontinuous Galerkin anddiscontinuous element methods

Discontinuity in the flowMore efficient to refine the mesh, since higher order schemesdrop to first order.Adaptive Mesh Refinement is the most appealing approach.

What about the future ?Combine the 2 approaches.Usually referred to as “h-p adaptivity”.