Numerical Solutions to Partial Differential Equations Zhiping Li LMAM and School of Mathematical Sciences Peking University
Finite Difference Methods for Hyperbolic Equations Finite Difference Schemes for Advection-Diffusion Equations A Model Problem of the Advection-Diffusion Equation A Model Problem of the Advection-Diffusion Equation An initial value problem of a 1D constant-coefficient advection-diffusion equation ( a > 0, c > 0): u t + au x = cu xx , u ( x , 0) = u 0 ( x ), x ∈ R . x ∈ R , t > 0; By a change of variables y = x − at and v ( y , t ) � u ( y + at , t ), y ∈ R , t > 0; v ( x , 0) = u 0 ( x ), x ∈ R . v t = cv yy , Characteristic global properties of the solution u : 1 There is a characteristic speed as in the advection equation, which plays an important role to the solution, especially when | a | ≫ c (advection dominant). 2 Along the characteristic, the solution behaves like a parabolic solution (dissipation and smoothing). 2 / 42
Finite Difference Methods for Hyperbolic Equations Finite Difference Schemes for Advection-Diffusion Equations Classical Explicit and Implicit Difference Schemes Classical Difference Schemes and Their Stability Conditions Classical explicit difference schemes: � � τ − 1 △ t + + a (2 h ) − 1 △ 0 x ch − 2 δ 2 U m x U m = ˜ j , j c = c , central; c + a 2 τ 2 , modified central; c + 1 (˜ 2 ah , upwind). 1 Maximum principle ⇔ ˜ c τ h 2 ≤ 1 2 , h ≤ 2˜ c a . 2 L 2 strongly stable ⇔ ˜ c τ h 2 ≤ 1 2 and τ ≤ 2˜ c a 2 . The Crank-Nicolson scheme � � � � τ − 1 δ t U m + 1 2 + a (4 h ) − 1 △ 0 x j + U m +1 = c (2 h 2 ) − 1 δ 2 j + U m +1 U m U m , x j j 1 Maximum principle ⇔ µ ≤ 1, h ≤ 2 c a . 2 Unconditionally L 2 strongly stable. 3 / 42
What Do We See Along a Characteristic Line? For constant-coefficient advection-diffusion equation: 1 The characteristic equation for the advection part: d x d t = a . a 1 2 Unit vector in characteristic direction: n s = ( 1+ a 2 , 1+ a 2 ). √ √ 3 Let s be the length parameter for the characteristic lines. � ∂ u � � ∂ u � ∂ u ∂ x , ∂ u 1 ∂ t + a ∂ u ∂ s = grad ( u ) · n s = · n s = √ . 4 ∂ t 1 + a 2 ∂ x c ∂ 2 u 5 This yields ∂ u ∂ s = ˜ ∂ x 2 , ( i.e. along the characteristics d x d t = a , the solution u to the constant-coefficient advection-diffusion equation ∂ x = c ∂ 2 u ∂ u ∂ t + a ∂ u ∂ x 2 behaves like a solution to a diffusion equation with √ c diffusion coefficient ˜ c = 1+ a 2 .)
Finite Difference Methods for Hyperbolic Equations Finite Difference Schemes for Advection-Diffusion Equations Characteristic Difference Schemes Operator Splitting and Characteristic Difference Schemes For general variable coefficients advection-diffusion equations: 1 The idea of the characteristic difference schemes for the advection-diffusion equation is to approximate the process by applying the operator splitting method. 2 Every time step will be separated into two sub-steps. 3 In the first sub-step, approximate the advection process by the u m +1 j ) = u ( x j − a m +1 � u (¯ x m characteristic method: ˜ τ ), along j j the characteristics. 5 / 42
Finite Difference Methods for Hyperbolic Equations Finite Difference Schemes for Advection-Diffusion Equations Characteristic Difference Schemes Operator Splitting and Characteristic Difference Schemes 4 In the second sub-step, approximate the diffusion process with u m +1 ˜ as the initial data at t m by, say, the implicit scheme: j u m +1 u m +1 j +1 − 2 u m +1 + u m +1 x m − u (¯ j ) j j j − 1 = c m +1 + ¯ T m j , j h 2 τ 5 The local truncation error ¯ = O ( τ + h 2 ). T m j 6 Replacing u (¯ x m j ) by certain interpolations of the nodal values leads to characteristic difference schemes. 6 / 42
Finite Difference Methods for Hyperbolic Equations Finite Difference Schemes for Advection-Diffusion Equations Characteristic Difference Schemes A Characteristic Difference Scheme by Linear Interpolation x m x m x m Suppose ¯ ∈ [ x i − 1 , x i ) and | ¯ j − x i − 1 | < h . Approximate u (¯ j ) j by the linear interpolation of u m i − 1 and u m leads to: i U m +1 U m +1 j +1 − 2 U m +1 + U m +1 − α m j U m i − (1 − α m j ) U m j i − 1 j j − 1 = c m +1 , j h 2 τ j = h − 1 (¯ where α m x m j − x i − 1 ) ∈ [0 , 1), or equivalently (1+2 µ m +1 ) U m +1 i − 1 + µ m +1 ( U m +1 j +1 + U m +1 = α m j U m i +(1 − α m j ) U m j − 1 ) , j j j where µ m +1 = c m +1 τ h − 2 . j j 7 / 42
Finite Difference Methods for Hyperbolic Equations Finite Difference Schemes for Advection-Diffusion Equations Characteristic Difference Schemes A Characteristic Difference Scheme by Linear Interpolation 1 T m = O ( τ + τ − 1 h 2 ). ( u (¯ x m j ) = α m j u m i + (1 − α m j ) u m i − 1 + O ( h 2 )) . j j ∈ [0 , 1), µ m +1 2 Maximum principle holds. (Note α m > 0.) j Since e − i k ( j − i +1) h = e − i k ( α m j h + a m +1 τ ) , we have 3 j 1 − α m j (1 − cos kh )+ i α m j sin kh e − i k ( α m j h + a m +1 τ ) , | λ k | ≤ 1, ∀ k , λ k = j 1+4 µ m +1 sin 2 1 2 kh j j sin kh | 2 = 1 − 2 α m ∵ | 1 − α m j (1 − cos kh ) + i α m j (1 − α m j )(1 − cos kh ). 4 Unconditionally locally L 2 stable. 5 Optimal convergence rate is O ( h ), when τ = O ( h ). 8 / 42
A Characteristic Difference Scheme by Quadratic Interpolation j − x i − 1 ) ∈ [ − 1 2 , 1 Suppose α m j = h − 1 (¯ x m x m 2 ]. Approximate u (¯ j ) by the quadratic interpolation of u m i − 2 , u m i − 1 and u m leads to: i U m +1 − 1 i − 1 + 1 2 α m j (1 + α m j ) U m i − (1 − α m j )(1 + α m j ) U m 2 α m j (1 − α m j ) U m j i − 2 τ U m +1 j +1 − 2 U m +1 + U m +1 j j − 1 = c m +1 . j h 2 = O ( τ + τ − 1 h 3 + h 2 ). (quadratic interpolation error O ( h 3 )) . 1 T m j j ∈ [ − 1 2 , 1 2 Maximum principle does not hold. (Note α m 2 ].) 1 − ( α m j ) 2 (1 − cos kh )+ i α m j sin kh j h + a m +1 e − i k ( α m τ ) , | λ k | ≤ 1, ∀ k . 3 λ k = j 1+4 µ m +1 sin 2 1 2 kh j j sin kh | 2 = 1 − ( α m ( ∵ | 1 − ( α m j ) 2 (1 − cos kh ) + i α m j ) 2 (1 − ( α m j ) 2 )(1 − cos kh ).) 4 Unconditionally locally L 2 stable. 5 Optimal convergence rate is O ( h 3 / 2 ), when τ = O ( h 3 / 2 ).
Finite Difference Methods for Hyperbolic Equations Finite Difference Schemes for Advection-Diffusion Equations Characteristic Difference Schemes Dissipation, Dispersion and Group Speed of the Scheme In the case of the constant-coefficient, u ( x , t ) = e − ck 2 t e i k ( x − at ) are the Fourier mode solutions for the advection-diffusion equation. 1 Dissipation speed: e − ck 2 ; dispersion relation: ω ( k ) = − ak ; group speed: C ( k ) = a ; for all k . 2 For the Fourier mode U m = λ m k e i kjh , j j ) 2 (1 − cos kh ) + i α m 1 − ( α m j sin kh j h + a m +1 e − i k ( α m τ ) , ∀ k . λ k = j 1 + 4 µ m +1 sin 2 1 2 kh j 3 The errors on the amplitude, phase shift and group speed can be worked out (see Exercise 3.12). 10 / 42
Finite Difference Methods for Hyperbolic Equations Finite Difference Schemes for the Wave Equation Initial and Initial-Boundary Value Problems of the Wave Equation 1 1D wave equation u tt = a 2 u xx , x ∈ I ⊂ R , t > 0. 2 Initial conditions u 0 ( x ) , x ∈ I ⊂ R , u ( x , 0) = v 0 ( x ) , x ∈ I ⊂ R . u t ( x , 0) = 3 Boundary conditions, when I is a finite interval, say I = (0 , 1), α 0 ( t ) u (0 , t ) − β 0 ( t ) u x (0 , t ) = g 0 ( t ) , t > 0 , α 1 ( t ) u (1 , t ) + β 1 ( t ) u x (1 , t ) = g 1 ( t ) , t > 0 , where α i ≥ 0, β i ≥ 0, α i + β i � = 0, i = 0 , 1. 11 / 42
Equivalent First Order Hyperbolic System of the Wave Equation 1 Let v = u t and w = − au x ( a > 0). The wave equation is transformed to � v � � 0 � � v � a + = 0 . 0 w a w t x 2 The eigenvalues of the system are ± a . 3 The two families of characteristic lines of the system � x + at = c , ∀ c ∈ R . x − at = c , 4 The solution to the initial value problem of the wave equation: � x + at � � u ( x , t ) = 1 + 1 u 0 ( x + at ) + u 0 ( x − at ) v 0 ( ξ ) d ξ. 2 2 a x − at
The Explicit Difference Scheme for the Wave Equation U m +1 j + U m − 1 − 2 U m − a 2 U m j +1 − 2 U m j + U m j j j − 1 = 0. 1 τ 2 h 2 2 The local truncation error: �� � � �� j = O ( τ 2 + h 2 ) . τ − 2 δ 2 t − h − 2 a 2 δ 2 ∂ 2 t − a 2 ∂ 2 u m − x x 3 By u ( x , τ ) = u ( x , 0) + τ u t ( x , 0) + 1 2 τ 2 u tt ( x , 0) + O ( τ 3 ), u ( x , τ )= u 0 ( x )+ τ v 0 ( x )+1 2 ν 2 ( u 0 ( x + h ) − 2 u 0 ( x )+ u 0 ( x − h ) )+ O ( τ 3 + τ 2 h 2 ) . 4 The discrete initial conditions (local truncation error O ( τ 3 + τ 2 h 2 )), denote ν = a τ/ h : 2 ν 2 � � j = 1 U 0 j = u 0 U 1 U 0 j +1 + U 0 + (1 − ν 2 ) U 0 j + τ v 0 j ; j . j − 1 Remark: If an additional term 1 6 τν 2 δ 2 x v 0 ( x ) is used in (3), then the truncation error is O ( τ 4 + τ 2 h 2 ).
Recommend
More recommend