From Finite Volumes to Discontinuous Galerkin and Flux Reconstruction
Total Page:16
File Type:pdf, Size:1020Kb
From Finite Volumes to Discontinuous Galerkin and Flux Reconstruction Sigrun Ortleb Department of Mathematics and Natural Sciences, University of Kassel GOFUN 2017 OpenFOAM user meeting March 21, 2017 Numerical simulation of fluid flow This includes flows of liquids and gases such as flow of air or flow of water src: NCTR src: NOAA src: NASA Goddard Spreading of Tsunami waves Weather prediction Flow through sea gates Requirements on numerical solvers High accuracy of computation Detailed resolution of physical phenomena Stability and efficiency, robustness Compliance with physical laws CC BY 3.0 (e.g. conservation) Flow around airplanes 1 Contents 1 The Finite Volume Method 2 The Discontinuous Galerkin Scheme 3 SBP Operators & Flux Reconstruction 4 Current High Performance DG / FR Schemes Derivation of fluid equations Based on physical principles: conservation of quantities & balance of forces mathematical tools: Reynolds transport & Gauß divergence theorem Different formulations: Integral conservation law d Z Z Z u dx + F(u; ru) · n dσ = s(u; x; t) dx dt V @V V Partial differential equation @u n + r · F = s @t V embodies the physical principles 2 Physical principle: conservation of mass dm d Z Z @ρ Z = ρ dx = dx + ρv · n dσ = 0 dt dt Vt Vt @t @Vt Divergence theorem yields Z @ρ @ρ + r · (ρv) dx = 0 ) + r · (ρv) = 0 V ≡Vt @t @t continuity equation Derivation of the continuity equation Based on Reynolds transport theorem d Z Z @u(x; t) Z u(x; t) dx = dx + u(x; t) v · n dσ dt Vt Vt @t @Vt rate of change rate of change convective transfer = + in moving volume in fixed volume through surface (Vt control volume of fluid particles) 3 Divergence theorem yields Z @ρ @ρ + r · (ρv) dx = 0 ) + r · (ρv) = 0 V ≡Vt @t @t continuity equation Derivation of the continuity equation Based on Reynolds transport theorem d Z Z @u(x; t) Z u(x; t) dx = dx + u(x; t) v · n dσ dt Vt Vt @t @Vt rate of change rate of change convective transfer = + in moving volume in fixed volume through surface (Vt control volume of fluid particles) Physical principle: conservation of mass dm d Z Z @ρ Z = ρ dx = dx + ρv · n dσ = 0 dt dt Vt Vt @t @Vt 3 Derivation of the continuity equation Based on Reynolds transport theorem d Z Z @u(x; t) Z u(x; t) dx = dx + u(x; t) v · n dσ dt Vt Vt @t @Vt rate of change rate of change convective transfer = + in moving volume in fixed volume through surface (Vt control volume of fluid particles) Physical principle: conservation of mass dm d Z Z @ρ Z = ρ dx = dx + ρv · n dσ = 0 dt dt Vt Vt @t @Vt Divergence theorem yields Z @ρ @ρ + r · (ρv) dx = 0 ) + r · (ρv) = 0 V ≡Vt @t @t continuity equation 3 The compressible Navier-Stokes equations ... are based on conservation of mass, momentum and energy @u @u + r · F = s + r · Finv + r · (A(u)ru) = s @t @t inviscid & viscous fluxes 5 3×5 5 Conservative variables u 2 R , fluxes F 2 R and sources s 2 R 0 ρ 1 0 ρv 1 0 0 1 u = @ ρv A; F = @ ρv ⊗ v + pI − τ A; s = @ ρg A ρE (ρE + p)v − κrT − τ · v ρ(q + g · v) convective fluxes, body forces heat fluxes & surface forces & heat sources p pressure, T temperature g gravitational & τ viscous stress tensor electromag. forces κ thermal conductivity q intern. heat sources ! simplified programming by representation in same generic form ! sufficient to develop discretization schemes for generic conservation law 4 General discretization techniques Finite differences / differential form xi;j+1 approximation of nodal values and nodal x x x derivatives i−1;j i;j i+1;j easy to derive, efficient xi;j−1 essentially limited to structured meshes Finite volumes / integral form approximation of cell means and integrals conservative by construction suitable for arbitrary meshes difficult to extend to higher order Finite elements / weak form weighted residual formulation quite flexible and general suitable for arbitrary meshes 5 Finite volume schemes ... based on the integral rather than the differential form Integral conservation enforced for small control volumes Vi defined by computational mesh K [ V¯ = V¯i i=1 Degrees of freedom: cell means 1 Z ui (t) = u(x; t) dx cell-centered vs. vertex-centered jVi j Vi possibly staggered for different variables To be specified: concrete definition of control volumes type of approximation inside these numerical method for evaluation of integrals and fluxes 6 It is important to ensure correct shock speed Characteristic curves are straight lines and cross ! smooth solution breaks down integral form (time integrated) still holds Why the integral form? Because this is the form directly obtained from physics. 1 2 @u @u 1D scalar hyperbolic f (u) = 2 u ) @t + u @x = 0 conservation law (Burgers equation) 8 < 1; x < 0; @u @f (u) init. cond.: u0(x) = cos(πx); 0 ≤ x ≤ 1; + = 0 @t @x : −1; x > 1: PDE theory tells us: As long as the exact solution is smooth, it is constant along charactereristic curves 7 It is important to ensure correct shock speed Why the integral form? Because this is the form directly obtained from physics. 1 2 @u @u 1D scalar hyperbolic f (u) = 2 u ) @t + u @x = 0 conservation law (Burgers equation) 8 < 1; x < 0; @u @f (u) init. cond.: u0(x) = cos(πx); 0 ≤ x ≤ 1; + = 0 @t @x : −1; x > 1: PDE theory tells us: As long as the exact solution is smooth, it is constant along charactereristic curves Characteristic curves are straight lines and cross ! smooth solution breaks down integral form (time integrated) still holds 7 Why the integral form? Because this is the form directly obtained from physics. 1 2 @u @u 1D scalar hyperbolic f (u) = 2 u ) @t + u @x = 0 conservation law (Burgers equation) 8 < 1; x < 0; @u @f (u) init. cond.: u0(x) = cos(πx); 0 ≤ x ≤ 1; + = 0 @t @x : −1; x > 1: PDE theory tells us: As long as the exact solution is smooth, it is constant along charactereristic curves It is important to ensure correct shock speed Characteristic curves are straight lines and cross ! smooth solution breaks down integral form (time integrated) still holds 7 On a control volume V = [xi−1=2; xi+1=2], the exact solution fulfills x d Z i+1=2 x u dx + [f (u)] i+1=2 = 0 dt xi−1=2 xi−1=2 un+1 − un discretized: ∆x i i + f (un ) − f (un ) = 0 i ∆t i+1=2 i−1=2 flux values f (ui±1=2) depending on unknown face quantities ui−1=2; ui+1=2 ! reconstruction necessary from available data :::; ui−1; ui ; ui+1;::: ! Introduction of numerical flux functions f ∗ ∆x un+1 = un − i f ∗(un; un ) − f ∗(un ; un) i i ∆t i i+1 i−1 i Discretization in conservative form In 1D, the FV scheme can be regarded as a FD scheme in conservative form 1 Z xi+1=2 ui (t) = u(x; t) dx ∆xi xi−1=2 8 flux values f (ui±1=2) depending on unknown face quantities ui−1=2; ui+1=2 ! reconstruction necessary from available data :::; ui−1; ui ; ui+1;::: ! Introduction of numerical flux functions f ∗ ∆x un+1 = un − i f ∗(un; un ) − f ∗(un ; un) i i ∆t i i+1 i−1 i Discretization in conservative form In 1D, the FV scheme can be regarded as a FD scheme in conservative form 1 Z xi+1=2 ui (t) = u(x; t) dx ∆xi xi−1=2 On a control volume V = [xi−1=2; xi+1=2], the exact solution fulfills x d Z i+1=2 x u dx + [f (u)] i+1=2 = 0 dt xi−1=2 xi−1=2 un+1 − un discretized: ∆x i i + f (un ) − f (un ) = 0 i ∆t i+1=2 i−1=2 8 Discretization in conservative form In 1D, the FV scheme can be regarded as a FD scheme in conservative form 1 Z xi+1=2 ui (t) = u(x; t) dx ∆xi xi−1=2 On a control volume V = [xi−1=2; xi+1=2], the exact solution fulfills x d Z i+1=2 x u dx + [f (u)] i+1=2 = 0 dt xi−1=2 xi−1=2 un+1 − un discretized: ∆x i i + f (un ) − f (un ) = 0 i ∆t i+1=2 i−1=2 flux values f (ui±1=2) depending on unknown face quantities ui−1=2; ui+1=2 ! reconstruction necessary from available data :::; ui−1; ui ; ui+1;::: ! Introduction of numerical flux functions f ∗ ∆x un+1 = un − i f ∗(un; un ) − f ∗(un ; un) i i ∆t i i+1 i−1 i 8 Discretization in conservative form In 1D, the FV scheme can be regarded as a FD scheme in conservative form 1 Z xi+1=2 ui (t) = u(x; t) dx ∆xi xi−1=2 On a control volume V = [xi−1=2; xi+1=2], the exact solution fulfills x d Z i+1=2 x u dx + [f (u)] i+1=2 = 0 dt xi−1=2 xi−1=2 un+1 − un discretized: ∆x i i + f (un ) − f (un ) = 0 i ∆t i+1=2 i−1=2 flux values f (ui±1=2) depending on unknown face quantities ui−1=2; ui+1=2 ! reconstruction necessary from available data :::; ui−1; ui ; ui+1;::: ! Introduction of numerical flux functions f ∗ The heart of FV schemes ∆x un+1 = un − i f ∗(un; un ) − f ∗(un ; un) i i ∆t i i+1 i−1 i 8 Upwind methods @u @u Scalar linear equation a > 0 ( @t + a @x = 0) ∆x un+1 = un − (aun − aun )(f ∗(u ; u ) = au ) i i ∆t i i−1 i i+1 i ∗ + − Linear system of equations ! f (ui ; ui+1) = A ui + A ui+1 ∆t un+1 = un − A+(un − un ) + A−(un − un) i i ∆x i i−1 i+1 i Nonlinear systems ! Flux vector splitting + − ∗ + − f(u) = f (u) + f (u) ) f (ui ; ui+1) = f (ui ) + f (ui+1) Steger & Warming, van Leer, AUSM and variants Classical numerical flux functions linked to Riemann problems & characteristic directions 9 Classical numerical flux functions linked to Riemann problems & characteristic directions Upwind methods @u @u Scalar linear equation a > 0 ( @t + a @x = 0) ∆x un+1 = un − (aun − aun )(f ∗(u ; u ) = au ) i i ∆t i i−1 i i+1 i ∗ + − Linear system of equations ! f (ui ; ui+1) = A ui + A ui+1 ∆t un+1 = un − A+(un − un ) + A−(un − un) i i ∆x i i−1 i+1 i Nonlinear systems ! Flux vector splitting + − ∗ + − f(u) = f (u) + f (u) ) f (ui ; ui+1) = f (ui ) + f (ui+1) Steger & Warming, van Leer, AUSM and variants 9 Properties of Roe matrix ALR ALR ≈ A(u) = Df(u) ALR (u; u) = A(u) ALR is diagonalizable f(uR )−f(uL) = ALR (uR −uL) (mean value property) entropy-fix needed HLL scheme Godunov-type scheme approximates only one