Finite volume schemes Linear systems Exact Riemann solvers Approximate Riemann solvers Rocky Mountain Mathematics Consortium Summer School Conservation Laws & Applications Lecture II: Finite Volume Methods for 1D Systems James A. Rossmanith Department of Mathematics University of Wisconsin – Madison June 23rd , 2010 J.A. Rossmanith | RMMC 2010 1/29 Finite volume schemes Linear systems Exact Riemann solvers Approximate Riemann solvers Outline 1 Finite volume schemes 2 Linear systems 3 Exact Riemann solvers 4 Approximate Riemann solvers J.A. Rossmanith | RMMC 2010 2/29 Finite volume schemes Linear systems Exact Riemann solvers Approximate Riemann solvers Outline 1 Finite volume schemes 2 Linear systems 3 Exact Riemann solvers 4 Approximate Riemann solvers J.A. Rossmanith | RMMC 2010 3/29 Finite volume schemes Linear systems Exact Riemann solvers Approximate Riemann solvers Finite volume schemes 1D schemes 1D finite volume schemes: Z x 1 i+ 1 2 q (tn , x) dx, Qn := dude i ∆x x 1 i− n+ 1 F̄i− 12 := 2 1 ∆t Z tn+1 tn F (q(t, xi− 1 )) dt 2 2 General 1D finite volume scheme Qn+1 i = Qn i » – ∆t n+ 1 n+ 1 2 2 − F̄i+ 1 − F̄i− 1 ∆x 2 2 n+ 1 Key question: how to compute numerical fluxes F̄i− 12 ? 2 » – X N N N X X 1 ∆t n+ 2 n+ 1 n 2 Qn+1 = Q − F̄ − F̄ = Qn Conservation: i i 1 i N+ 1 ∆x 2 2 i=1 i=1 i=1 J.A. Rossmanith | RMMC 2010 4/29 Finite volume schemes Linear systems Exact Riemann solvers Approximate Riemann solvers Finite volume schemes 1D schemes 1D finite volume schemes: Z x 1 i+ 1 2 q (tn , x) dx, Qn := dude i ∆x x 1 i− n+ 1 F̄i− 12 := 2 1 ∆t Z tn+1 tn F (q(t, xi− 1 )) dt 2 2 General 1D finite volume scheme Qn+1 i = Qn i » – ∆t n+ 1 n+ 1 2 2 − F̄i+ 1 − F̄i− 1 ∆x 2 2 n+ 1 Key question: how to compute numerical fluxes F̄i− 12 ? 2 » – X N N N X X 1 ∆t n+ 2 n+ 1 n 2 Qn+1 = Q − F̄ − F̄ = Qn Conservation: i i 1 i N+ 1 ∆x 2 2 i=1 i=1 i=1 J.A. Rossmanith | RMMC 2010 4/29 Finite volume schemes Linear systems Exact Riemann solvers Approximate Riemann solvers Wave propagation method Scalar conservation laws Definition (LeVeque, 1997) i ∆t h i ∆t h − A ∆Qi+ 1 + A+ ∆Qi− 1 − F̃i+ 1 − F̃i− 1 2 2 2 2 ∆x ∆x ” “ 0 n Speed: si− 1 = f Q̄i− 1 , where Q̄i− 1 = Ave(Qn i , Qi−1 ) Qn+1 = Qn i − i 2 Wave: Fluctuations: Flux correction: Smoothness: 2 2 A± ∆Qi− 1 := s± Wi− 1 i− 1 2 2 2 ˛ ˛ ˛s 1 ˛ ∆t ! “ ” ˛ ˛ i− 2 1˛ F̃i− 1 := si− 1 ˛ 1 − Wi− 1 φ θi− 1 2 2 2 2 2 ∆x θi− 1 := 2 Wi− 3 2 Wi− 1 2 Wave limiter: J.A. Rossmanith | RMMC 2010 2 n Wi− 1 := Qn i − Qi−1 φ = 0 (Upwind), or Wi+ 1 2 Wi− 1 2 φ = 1 (Lax-Wendroff) 5/29 Finite volume schemes Linear systems Exact Riemann solvers Approximate Riemann solvers Lax-Wendroff theorem Theorem (Lax & Wendroff, 1960) Suppose the method is conservative and consistent with q,t + f (q),x = 0, in the sense that Fi− 1 = F (Qi−1 , Qi ) 2 with F (q̄, q̄) = f (q̄), and F is Lipschitz continuous. If a sequence of discrete approximations converge to a function q(t, x) as ∆t, ∆x → 0, then this function is a weak solution of the conservation law. Notes: Does not guarantee that there exists a convergent sequence Two sequences might converge to different weak solutions To resolve these need: (1) stability and an (2) entropy condition J.A. Rossmanith | RMMC 2010 6/29 Finite volume schemes Linear systems Exact Riemann solvers Approximate Riemann solvers Outline 1 Finite volume schemes 2 Linear systems 3 Exact Riemann solvers 4 Approximate Riemann solvers J.A. Rossmanith | RMMC 2010 7/29 Finite volume schemes Linear systems Exact Riemann solvers Approximate Riemann solvers Linear hyperbolic systems Linear system of m hyperbolic PDEs: q,t + A q,x = 0 System is hyperbolic if A has only real e-vals & is diagonalizable “ ” A = RΛR−1 , Λ = diag λ(1) , λ(2) , · · · , λ(m) ˛ ˛ ˛ ˛ ˛ ˛ i i h h ˛ ˛ ˛ ˛ ˛ ˛ R = r(1) ˛ r(2) ˛· · · ˛ r(m) , R−T = `(1) ˛ `(2) ˛· · · ˛ `(m) Diagonalization: q,t + RΛR−1 q,x = 0, w := R−1 q R−1 q,t + ΛR−1 q,x = 0 w,t + Λw,x = 0 =⇒ =⇒ (p) (p) w,t + λ(p) w,x =0 w(p) (t, x) = w̆(p) (x − λ(p) t) = `(p) · q̆(x − λ(p) t) m n o X ∴ q(t, x) = `(p) · q̆(x − λ(p) t) r(p) p=1 J.A. Rossmanith | RMMC 2010 8/29 Finite volume schemes Linear systems Exact Riemann solvers Approximate Riemann solvers Wave propagation framework Riemann soln. consists of waves W (p) prop. at constant speed λ(p) Wave decomposition of solution jump (p) n αi− 1 := `(p) · (Qn i − Qi−1 ) 2 Qn i − Qn i−1 = m X (p) αi− 1 r(p) := 2 p=1 Qn+1 = Qn i − i J.A. Rossmanith | RMMC 2010 ∆t h ∆x (3) m X p=1 (3) (p) Wi− 1 2 (1) λ(2) Wi− 1 + λ(2) Wi− 1 + λ(1) Wi+ 1 2 2 i 2 9/29 Finite volume schemes Linear systems Exact Riemann solvers Approximate Riemann solvers Upwind wave propagation method First-order wave propagation method i ∆t h + Qn+1 A ∆Qi− 1 + A− ∆Qi+ 1 = Qn i − i 2 2 ∆x m h i− X (p) − (p) A ∆Qi− 1 = λ Wi− 1 2 2 p=1 A+ ∆Qi− 1 = m h X 2 λ(p) i+ (p) Wi− 1 2 p=1 Conservation A− ∆Qi− 1 + A+ ∆Qi− 1 = 2 m X 2 p=1 = m X (p) λ(p) Wi− 1 = 2 m X n (p) λ(p) `(p) · (Qn i − Qi−1 ) r p=1 n n n n n r(p) λ(p) `(p) · (Qn i − Qi−1 ) = A (Qi − Qi−1 ) = f (Qi ) − f (Qi−1 ) p=1 J.A. Rossmanith | RMMC 2010 10/29 Finite volume schemes Linear systems Exact Riemann solvers Approximate Riemann solvers Lax-Wendroff method for linear systems Taylor series approximation 1 2 ∆t q,tt + O(∆t3 ) 2 1 q(t + ∆, x) = q − ∆t A q,x + ∆t2 A2 q,xx + O(∆t3 ) 2 Lax-Wendroff method i ∆t h n n n A(Qn Qn+1 = Qn i+1 − Qi ) + A(Qi − Qi−1 ) i − i 2∆x i ∆2 h 2 n 2 n n + A (Qi+1 − Qn i ) − A (Qi − Qi−1 ) 2 2∆x q(t + ∆, x) = q + ∆t q,t + Matrix-vector products n A(Qn i − Qi−1 ) = m X n (p) (p) `(p) · (Qn r i − Qi−1 ) λ p=1 n A2 (Qn i − Qi−1 ) = m X h i2 n (p) r(p) `(p) · (Qn i − Qi−1 ) λ p=1 J.A. Rossmanith | RMMC 2010 11/29 Finite volume schemes Linear systems Exact Riemann solvers Approximate Riemann solvers Wave propagation method Definition (LeVeque, 1997) Qn+1 = Qn i − i Speed: i ∆t h i ∆t h − A ∆Qi+ 1 + A+ ∆Qi− 1 − F̃i+ 1 − F̃i− 1 2 2 2 2 ∆x ∆x (p) si− 1 = λ(p) 2 Wave: (p) n Wi− 1 := `(p) · (Qn i − Qi−1 ) 2 Fluctuations: ± A ∆Qi− 1 := m h X 2 (p) si− 1 i± 2 p=1 (p) Wi− 1 2 0 Flux correction: F̃i− 1 Smoothness: (p) θi− 1 2 2 1 ˛ ˛ ˛ (p) ˛ m ˛ ˛ ∆t “ ” ˛s ˛ i− 1 1 X˛ (p) ˛ B C (p) (p) 2 := ˛si− 1 ˛ @1 − A Wi− 1 φ θi− 1 2 p=1 ∆x 2 2 2 (p) := 2 (p) 2 (p) Wi− 1 · Wi− 1 2 J.A. Rossmanith | RMMC 2010 (p) Wi− 3 · Wi− 1 2 (p) or (p) Wi+ 1 · Wi− 1 2 (p) 2 (p) Wi− 1 · Wi− 1 2 2 12/29 Finite volume schemes Linear systems Exact Riemann solvers Approximate Riemann solvers Outline 1 Finite volume schemes 2 Linear systems 3 Exact Riemann solvers 4 Approximate Riemann solvers J.A. Rossmanith | RMMC 2010 13/29 Finite volume schemes Linear systems Exact Riemann solvers Approximate Riemann solvers Shallow water equations Basic equations Shallow water equations: » – » – » – h hu 0 + = hu ,t hu2 + 21 gh2 ,x −ghb,x h(t, x) := Fluid layer thickness u(t, x) := Depth-averaged fluid layer velocity b(x) := Bottom topography J.A. Rossmanith | RMMC 2010 14/29 Finite volume schemes Linear systems Exact Riemann solvers Approximate Riemann solvers Shallow water equations Hyperbolic structure Flux Jacobian: » 0 A(q) = f (q) = gh − u2 √ Eigenstructure: c := gh » – » – u−c 1 1 Λ= , R= , u+c u−c u+c 0 1 2u – R−1 = » 1 u+c 2c c − u −1 1 – Strictly hyperbolic for all h > 0, weakly hyperbolic if h = 0 Both waves are genuinely nonlinear if h > 0: Lax entropy condition: J.A. Rossmanith | RMMC 2010 1-shock if h? > h` , ∇q λ(p) · r(p) 6= 0 2-shock if h? > h r 15/29 Finite volume schemes Linear systems Exact Riemann solvers Approximate Riemann solvers Shallow water equations Exact Riemann solution Find h? such that Φ(h? ) = Φr (h? ) − Φ` (h? ) = 0, r “ 8 ” <u − (h − h ) g 1 + 1 ? ` ` 2h 2h ? ` Φ` (h? ) := ´ `√ √ : u` + 2 gh` − gh? r “ 8 ” <u + (h − h ) g 1 + 1 r ? r 2h 2h ? r Φr (h? ) := `√ ´ √ : ur − 2 ghr − gh? Newton iteration: J.A. Rossmanith | RMMC 2010 hk+1 = hk? − ? where if h? > h ` if h? ≤ h` if h? > hr if h? ≤ hr Φ(hk ?) Φ0 (hk ?) 16/29 Finite volume schemes Linear systems Exact Riemann solvers Approximate Riemann solvers 1D nonlinear systems Godunov’s method Riemann problem: q,t + f (q),x = 0, n q(t , x) = ( n Qi−1 x < xi− 1 , Qn i x > xi− 1 . 2 2 Often can find exact solution Rankine-Hugoniot conditions Riemann invariants entropy conditions At each interface: J.A. Rossmanith | RMMC 2010 n+1/2 Fi−1/2 := f (h? , u? ) 17/29 Finite volume schemes Linear systems Exact Riemann solvers Approximate Riemann solvers Outline 1 Finite volume schemes 2 Linear systems 3 Exact Riemann solvers 4 Approximate Riemann solvers J.A. Rossmanith | RMMC 2010 18/29 Finite volume schemes Linear systems Exact Riemann solvers Approximate Riemann solvers A different perspective BGK relaxation The problem with exact Riemann solutions: Generally need to solve nonlinear algebraic equations to find q? Even though q? is exact, overall solution is not A small interlude: the Boltzmann equation 1 f,t + v f,x = Q(f, f ) ε f (t, x, v) := distribution function Q(f, f ) := collision term, ε := collision frequency BGK collision operator [Bhatnagar–Gross–Krook, 1954]: r » – “ ” m mv 2 Q(f, f ) = f M − f , f M = exp − 2πkT 2kT As ε → 0: f = f M + εf (1) + O(ε2 ) Relaxation: J.A. Rossmanith | RMMC 2010 collisions drive f towards f M 19/29 Finite volume schemes Linear systems Exact Riemann solvers Approximate Riemann solvers Relaxation systems for scalar equations A simple relaxation system: » – » –» – » – 1 0 1 q q 0 + = µ ,t −α β α + β µ ,x ε f (q) − µ Idea: as ε → 0, µ → f =⇒ q,t + f (q),x = 0 Let µ = f + ε µ(1) + O(ε2 ): First equation: Second equation: Chain rule: Second equation: Second equation: Combine: 2 q,t + f,x = −εµ(1) ,x + O(ε ) f,t − αβ q,x + (α + β) f,x = −µ(1) + O(ε2 ) 2 f,t = f,q q,t = −f,q q,x + O(ε) ˘ ¯ (1) 2 − µ = −f,q + (α + β) f,q − αβ q,x + O(ε) − µ(1) = (f,q − α) (β − f,q ) q,x + O(ε) h i q,t + f,x = ε (f,q − α) (β − f,q ) q,x + O(ε2 ) ,x Sub-characteristic condition: J.A. Rossmanith | RMMC 2010 α ≤ f,q ≤ β 20/29 Finite volume schemes Linear systems Exact Riemann solvers Approximate Riemann solvers Approximate Riemann solvers Local Lax-Friedrichs Operator splitting: » – » q 0 Solve RP for + µ ,t −α β Solve µ,t = 1 ε (f − µ) 1 α+β by setting –» – q =0 µ ,x µ=f Local Lax-Friedrichs [Rusanov, 1961]: Take α = −s and β = s =⇒ α + β = 0 and −αβ = s2 : –» – » – » – » – » – » Qi − Qi−1 1 1 0 1 q q = 0 =⇒ = w1 +w2 + 2 f (Qi ) − f (Qi−1 ) f ,t s 0 f ,x −s s Finite volume method in fluctuation form ˜ ∆t ˆ − Qn+1 = Qn A ∆Qi+1/2 + A+ ∆Qi−1/2 i − i ∆x 1 s A− ∆Qi−1/2 = −sw1 = (f (Qi ) − f (Qi−1 ) − (Qi − Qi−1 ) 2 2 1 s A+ ∆Qi−1/2 = sw2 = (f (Qi ) − f (Qi−1 ) + (Qi − Qi−1 ) 2 2 J.A. Rossmanith | RMMC 2010 21/29 Finite volume schemes Linear systems Exact Riemann solvers Approximate Riemann solvers Approximate Riemann solvers Local Lax-Friedrichs for systems Systems of conservation laws: » – » – » –» – 1 0 q 0I I q + = µ ,t −α β I (α + β) I µ ,x ε f (q) − µ h i h i Sub-characteristic condition: α ≤ min λ (f,q ) ≤ max λ (f,q ) ≤ β ˛ ˛ LLF: α = −s and β = s, where s = max˛λ(f,q )˛ „» –« I λ = −s, −s, −s, . . . , −s, s, s, s, . . . , s s2 I | {z } | {z } m eigenvalues m eigenvalues Finite volume method in fluctuation form ˜ ∆t ˆ − A ∆Qi+1/2 + A+ ∆Qi−1/2 Qn+1 = Qn i − i ∆x 1 s A− ∆Qi−1/2 = (f (Qi ) − f (Qi−1 ) − (Qi − Qi−1 ) 2 2 1 s A+ ∆Qi−1/2 = (f (Qi ) − f (Qi−1 ) + (Qi − Qi−1 ) 2 2 J.A. Rossmanith | RMMC 2010 22/29 Finite volume schemes Linear systems Exact Riemann solvers Approximate Riemann solvers Approximate Riemann solvers Roe solver Roe approximate Riemann solver [Roe, 1981]: Relaxation system: » – » q 0I + ¯2 µ ,t −(J) ` ´ J¯ = fq Q̄ where –» – » – 1 I q 0 = 2J¯ µ ,x ε f (q) − µ ` ´ fq Q̄ (Qr − Q` ) = f (Qr ) − f (Q` ) Eigenvector decomposition » – » (1) – » (m) – Qi − Qi−1 r r = α(1) (1) (1) + · · · + α(m) (m) (m) f (Qi ) − f (Qi−1 ) s r s r 2m equations for only m α’s? Only m lin. ind. eqns due to Roe avg. Finite volume method in fluctuation form m h i± n o X A± ∆Qi−1/2 = s(p) `(p) · (Qi − Qi−1 ) r(p) p=1 J.A. Rossmanith | RMMC 2010 23/29 Finite volume schemes Linear systems Exact Riemann solvers Approximate Riemann solvers Modified Roe solver Conservation without Roe average If Q̄ is not the Roe average, then 2m equations for only m unknowns: » – » (1) – » (m) – Qi − Qi−1 r r = α(1) (1) (1) + · · · + α(m) (m) (m) f (Qi ) − f (Qi−1 ) s r s r Conservation if we only enforce the second set of m equations: f (Qi ) − f (Qi−1 ) = β (1) r(1) · · · + β (m) r(m) β (p) = `(p) · (f (Qi ) − f (Qi−1 )) Z-waves: Z (p) = β (p) r(p) X 1 X A+ ∆Q = Z (p) + 2 (p) (p) p:s Conservation: A+ ∆Q + A− ∆Q = >0 m X p:s Z (p) =0 Z (p) = f (Qi ) − f (Qi−1 ) p=1 J.A. Rossmanith | RMMC 2010 24/29 Finite volume schemes Linear systems Exact Riemann solvers Approximate Riemann solvers Wave propagation method 1D nonlinear systems Definition (LeVeque, 2002) i ∆t h i ∆t h − A ∆Qi+ 1 + A+ ∆Qi− 1 − F̃i+ 1 − F̃i− 1 2 2 2 2 ∆x ∆x ” “ (p) (p) n si− 1 = λ Q̄i− 1 , where Q̄i− 1 = Ave(Qn i , Qi−1 ) Qn+1 = Qn i − i Speed: 2 2 Wave: Fluctuations: (p) Zi− 1 2 := (p) `i− 1 2 F̃i− 1 Smoothness: (p) θi− 1 2 2 (p) (p) ri− 1 2 := X (p) Zi− 1 + (p) Zi− 3 · Zi− 1 2 (p) 2 (p) Zi− 1 · Zi− 1 2 J.A. Rossmanith | RMMC 2010 − f (Qn i−1 )) 1 X (p) Z 2 2 p:s=0 i− 21 2 p:s>0 0 1 ˛ (p) ˛ ˛s 1 ˛ ∆t m “ ” “ ” i− 2 1X (p) A Z (p)1 φ θ(p)1 := sign si− 1 @1 − i− i− 2 p=1 ∆x 2 2 2 A± ∆Qi− 1 := Correction: · 2 (f (Qn i ) 2 (p) or (p) Zi+ 1 · Zi− 1 2 (p) 2 (p) Zi− 1 · Zi− 1 2 2 25/29 Finite volume schemes Linear systems Exact Riemann solvers Approximate Riemann solvers Wave propagation method A note about the entropy fix Need an entropy fix if kth wave is genuinely nonlinear and λ− := λ(k) (Q` ) < 0 λ+ := λ(k) (Qr ) > 0 In this case, will split kth wave into two waves: s(k) W (k) = α λ− W (k) + βλ+ W (k) Conservation dictates that: α+β =1 Therefore α= s − λ+ λ− − λ+ A− ∆Q = A− ∆Q + α λ− W (k) A+ ∆Q = A+ ∆Q + (1 − α) λ+ W (k) J.A. Rossmanith | RMMC 2010 26/29 Finite volume schemes Linear systems Exact Riemann solvers Approximate Riemann solvers Example 1D Euler equations Euler equations: 2 3 2 3 ρ ρu 2 4ρu5 + 4 ρu + p 5 = 0 E ,t u(E + p) ,x E= J.A. Rossmanith | RMMC 2010 p 1 + ρu2 γ−1 2 27/29 Finite volume schemes Linear systems Exact Riemann solvers Approximate Riemann solvers Example 1D Euler equations 2 3 2 3 ρ ρu 2 4ρu5 + 4 ρu + p 5 = 0 E ,t u(E + p) ,x E= p γ−1 + 12 ρu2 Waves: ¬ Sound, ­ Contact, ® Sound J.A. Rossmanith | RMMC 2010 28/29 Finite volume schemes Linear systems Exact Riemann solvers Approximate Riemann solvers Example 1D ideal magnetohydrodynamics 2 ∂ ∂t 3 2 3 ρ ρu ` ´ 2 1 6ρu7 6 7 kBk 2 6 7 + ∇ · 6ρu `⊗ u + p + ´ I − B ⊗ B7 4E 5 4 u E + p + 1 kBk2 − B (u · B) 5 = 0 2 B u⊗B−B⊗u ∇·B=0 Waves: ¬ & ³ Fast, ­ & ² Alfvén, ® & ± Slow, ¯ Entropy, ° Div J.A. Rossmanith | RMMC 2010 29/29