Numerical Methods for Wave Equations: Part I: Smooth Solutions
Total Page:16
File Type:pdf, Size:1020Kb
WPPII Computational Fluid Dynamics I Numerical Methods for Wave Equations: Part I: Smooth Solutions Instructor: Hong G. Im University of Michigan Fall 2001 Computational Fluid Dynamics I WPPII Outline Solution Methods for Wave Equation Part I • Method of Characteristics • Finite Volume Approach and Conservative Forms • Methods for Continuous Solutions - Central and Upwind Difference - Stability, CFL Condition - Various Stable Methods Part II • Methods for Discontinuous Solutions - Burgers Equation and Shock Formation - Entropy Condition - Various Numerical Schemes WPPII Computational Fluid Dynamics I Method of Characteristics WPPII Computational Fluid Dynamics I 1st Order Wave Equation ∂f ∂f + c = 0 ∂t ∂x The characteristics for this equation are: dx df = c; = 0; f dt dt t f x WPPII Computational Fluid Dynamics I 1-D Wave Equation (2nd Order Hyperbolic PDE) ∂ 2 f ∂ 2 f − c2 = 0 ∂t 2 ∂x2 Define ∂f ∂f v = ; w = ; ∂t ∂x which leads to ∂v ∂w − c2 = 0 ∂t ∂x ∂w ∂v − = 0 ∂t ∂x WPPII Computational Fluid Dynamics I In matrix form v 0 − c2 v t + x = 0 or u + Au = 0 − t x wt 1 0 wx Can it be transformed into the form v λ 0v t + x = 0 or u + λu = 0 ? λ t x wt 0 wx Find the eigenvalue, eigenvector ()AT − λI q = 0 − λ −1 l 1 = 0 − 2 − λ c l2 WPPII Computational Fluid Dynamics I Eigenvalue dx AT − λI = 0; λ2 − c2 = 0; λ = = ±c dt Eigenvector 1 For λ = +c, − cl − l = 0; q = 1 2 1 − c 1 For λ = −c, cl − l = 0; q = 1 2 2 c The solution (v,w) is governed by ODE’s along the characteristic lines dx / dt = ±c WPPII Computational Fluid Dynamics I On dx / dt = +c, T ⋅()+ = ()− 2 − ()− q1 ut Au x vt c wx c wt vx dv dw = ()()v + cv − c w + cw = − c = 0 t x t x dt dt ≡ − If r1 v cw (Riemann Invariant), we have d(v − cw) = 0 on dx = +cdt (If c = const) dt WPPII Computational Fluid Dynamics I On dx / dt = −c, T ⋅()+ = ()− 2 + ()− q2 ut Au x vt c wx c wt vx dv dw = ()()v − cv + c w − cw = + c = 0 t x t x dt dt ≡ + If r1 v cw (Riemann Invariant), we have d(v + cw) = 0 on dx = −cdt (If c = const) dt WPPII Computational Fluid Dynamics I 3 dx / dt = −c P 2 dx / dt = +c dv dw − c = 0 on dx = +cdt dt dt 1 dv + dw = = − ∂f ∂f c 0 on dx cdt f , , known dt dt ∂t ∂x = + df ft dt f x dx WPPII Computational Fluid Dynamics I Finite difference approximation to determine f (P) dx / dt = +c []= = v ft , w f x 2 P dx / dt = −c 1 − = [][]+ − x(P) x(1) c(P) c(1) t(P) t(1) dx 2 on = +c 1 1 dt v(P) − v(1) = [][]c(P) + c(1) w(P) − w(1) 2 1 − = − [][]+ − x(P) x(2) c(P) c(2) t(P) t(2) dx 2 on = −c 1 dt v(P) − v(2) = − [][]c(P) + c(2) w(P) − w(2) 2 1 1 f (P) − f (1) = [][]v(P) + v(1) t(P) − t(1) + [][]w(P) + w(1) x(P) − x(1) 2 2 Nonlinear system – iterative procedure WPPII Computational Fluid Dynamics I Numerical Methods: Finite Volume Approach WPPII Computational Fluid Dynamics I When using finite volume approximations, we work directly with the integral form of the conservation principles. The average values of f over a small volume are stored f f j−1 f j f j+1 x xj−1/2 xj+1/2 WPPII Computational Fluid Dynamics I In finite volume method, equations in conservative forms are needed in order to satisfy conservation properties. As an example, consider a 1-D equation ∂f (x,t) ∂F[ f (x,t)] + = 0 ∂t ∂x where F denotes a general advection/diffusion term, e.g. 1 ∂f F = f 2 ; F = µ(x) 2 ∂x WPPII Computational Fluid Dynamics I Integrating over the domain L, ∂f ∂F dx + dx = 0 ∫ ∂ ∫ ∂ L t L x F(L) − F(0) = 0 d ⇒ ∫ fdx = 0 dt L If F = 0 at the end points of the domain, f is conserved. WPPII Computational Fluid Dynamics I f j−1 In discretized form: f j f j+1 − ∂F F + F − ∫ dx = ∑ j 1/ 2 j 1/ 2 ∂x ∆x L xj−1/2 xj+1/2 x 1 = []+ F − − F − + F + − F − + F + − F + + ∆x ! j 1/ 2 j 3/ 2 j 1/ 2 j 1/ 2 j 3/ 2 j 1/ 2 ! 1 = []F − F ∆x L 0 WPPII Computational Fluid Dynamics I Examples of Conservative Form ∂f ∂ 1 ∂f ∂ ∂f + f 2 = 0, + µ(x) = 0 ∂t ∂x 2 ∂t ∂x ∂x ∂ ∂f Discretize µ(x) ∂x ∂x 1 ∂f ∂f µ − µ = ∂ ∂ h x j+1/ 2 x j−1/ 2 1 []()()()()µ + µ f − f − µ + µ f − f 2h2 j+1 j j+1 j j j−1 j j−1 Conservative WPPII Computational Fluid Dynamics I Examples of Non-conservative Form ∂f ∂f ∂f ∂ 2 f ∂µ ∂f + f = 0, + µ + = 0 ∂t ∂x ∂t ∂x2 ∂x ∂x ∂ 2 ∂µ ∂ Discretize µ f + f ∂x2 ∂x ∂x 1 µ ()+ − + 1 ()()µ − µ − = j f j+1 f j−1 2 f j j+1 j−1 f j+1 f j−1 h2 4 1 ()µ + µ − µ + 1 ()µ − µ − µ + µ j f j+1 j f j−1 2 j f j j+1 f j+1 j+1 f j−1 j−1 f j+1 j−1 f j−1 h2 4 Non-conservative WPPII Computational Fluid Dynamics I Finite Volume Method for Conservative Equations ∂f ∂F + = 0 ∂t ∂x F = Uf Advection ∂f F = D Diffusion ∂x ∂f F = Uf − D Advection/Diffusion ∂x WPPII Computational Fluid Dynamics I Finite Volume Formulation f j−1 f j ∂f ∂F f + + = 0 j 1 ∂t ∂x ∂f ∂F j−1 j j+1 x ∫ dx + ∫ dx = 0 ∂ ∂ Fj−1/2 Fj+1/2 ∆x t ∆x x d + − = ∫ f dx Fj+1/ 2 Fj−1/ 2 0 dt ∆x d (hf ) + F − F = 0 dt j j+1/ 2 j−1/ 2 WPPII Computational Fluid Dynamics I 1-D Advection-Diffusion Equation ∂f ∂ ∂f + Uf − D = 0 ∂t ∂x ∂x FVM Equation: d ∂f ∂f h f = −U ( f − f ) + D − j j+1/ 2 j−1/ 2 ∂ ∂ dt x j+1/ 2 x j−1/ 2 Approximating f ≈ 1 ( f n + f n ) j+1/ 2 2 j+1 j ∂ f n − f n f ≈ j+1 j ∂ x j+1/ 2 h d 1 + f ≈ ( f n 1 − f n ) dt j ∆t j j WPPII Computational Fluid Dynamics I Substituting: h + ( f n 1 − f n ) = ∆t j j f n − f n f n − f n − []1 n + n − 1 n + n + j+1 j − j j−1 U ( f j+1 f j ) ( f j f j−1 ) D 2 2 h h Rearranging the terms: f n+1 − f n j j U n n D ()n n n + ( f + − f − ) = f + − 2 f + f − ∆t 2h j 1 j 1 h2 j 1 j j 1 Which is exactly the same as the finite difference equation if we take the average value to be the same as the value in the center of the cell WPPII Computational Fluid Dynamics I Numerical Methods for 1-D Advection Equation: Stability Consideration (Finite Difference Approach) WPPII Computational Fluid Dynamics I We will start by examining the linear advection equation: ∂f ∂f +U = 0 ∂t ∂x The characteristic for this equation are: dx df = U; = 0; dt dt Showing that the initial conditions t f are simply advected by a constant velocity U f x WPPII Computational Fluid Dynamics I Finite difference equation ∂f ∂f +U = 0 ∂t ∂x A forward in time, centered in space (FTCS) discretization yields ∆ n+1 n t n n f = f − U ( f + − f − ) j j 2h j 1 j 1 n+1 n j−1 j j+1 WPPII Computational Fluid Dynamics I This scheme is O(∆t, ∆x2) accurate, but a stability analysis shows that the error grows as + ε n 1 U∆t = 1− i sin kh ε n 2h n+1 Since the amplification ε factor has the form 1+i() ε n the absolute value of this complex number is always U∆t i sin kh larger than unity and the 2h method is unconditionally unstable for this case. 1 WPPII Computational Fluid Dynamics I Alternative Scheme: Upwind Difference f j−1 f j f j+1 ∂f ∂f +U = 0 ∂t ∂x U A forward in time but “upwind” (windward) in space discretization yields + ∆t f n 1 = f n − U ( f n − f n ) j j h j j−1 n+1 This scheme is O(∆t, ∆x) n accurate. j−1 j WPPII Computational Fluid Dynamics I To examine the stability we use the von Neuman’s method: n = n + ε n f j f j j Substituting into the modified equation, + ε n 1 −ε n U j j + (ε n −ε n ) = 0 ∆t h j j−1 ε n = ε n ikx j j e ε n+1 −ε n ε n +U (1− e−ikh ) = 0 ∆t h WPPII Computational Fluid Dynamics I ε n+1 −ε n ε n +U (1− e−ikh ) = 0 ∆t h Amplification factor n+1 ε U∆t − U∆t U∆t =1− (1− e ikh ) =1− (1− cos kh) − isin kh ε n h h h or + ε n 1 2U∆t kh U∆t =1− sin 2 − isin kh ε n h 2 h WPPII Computational Fluid Dynamics I Amplification Factor − U∆t G =1− λ(1− e ikh ), λ = h Im(G) Stability Condition: λ <1 1 U∆t Stable ≤ 1 G h kh Re(G) 1 CFL Condition (Courant-Friedrichs-Lewy; 1932) 1−λ λ Computational Fluid Dynamics I WPPII Stability Implication of the CFL Condition (Hirsch, vol.1, p.