Mathematical Physics - Volume II - Numerical Methods

22 Chapter 1. Finite difference method and Finite element method

99002 FORMAT (’T=’,F5.2,T18,’NUMERICKI’,T35,’TACNO’,/) 99003 FORMAT (’Z=’,F4.1,T13,F13.6,T30,F13.6) 99004 FORMAT (I5,F15.6) END

1.1.7 Application of the finite difference method to hyperbolic partial differential equations – one-dimensional wavelength Let us now consider a one-dimensional wavelength equation, as a typical representative of hyperbolic partial differential equations: u tt = c 2 u xx (1.48) let ( x n , t j ) = ( nh , jk ) ( n , j = 0 , 1 , 2 ... ) and s = k / h . We will used the following equations: U n , j + 1 − 2 U n j + U n , j − 1 k 2 = c 2 U n + 1 , j − 2 U n j + U n − 1 , j h 2 (1.49) i.e. δ 2 t U n j = c 2 s 2 δ 2 x U n j for explicit method: δ 2 t U n j = c 2 s 2 δ 2 x U n , j + 1 + δ 2 x U n , j − 1 2 (1.50) i.e. − c 2 s 2 U n − 1 , j + 1 +( 2 + 2 c 2 s 2 ) U n , j + 1 − c 2 s 2 U n + 1 , j + 1 = 4 U n j − 2 U n , j − 1 + c 2 s 2 δ 2 x U n j for the implicit method. Herein local rounding errors in both cases are O ( k 2 + h 2 ) ; the explicit method is con ditionally stable iff c 2 s 2 ≤ 1, and the implicit method is unconditionally stable. Attention should be paid to conditions u ( x , 0 ) = f ( x ) and u t ( x , 0 ) = g ( x ) , which, unlike the previous ones, also include u t ( x , 0 ) , and are defined in accordance with the principle that the error introduced here must not be greater than the local rounding error, which in this case is O ( k 2 + h 2 ) . It is obvious that this condition is fulfilled for U n 0 = f ( x n ) , since the error is equal to 0. As far as U n 1 is concerned, let us assume that f is contained in c 2 and that (1.49) also holds for t = 0, and then apply the Taylor theorem:

u ( x n , t 1 ) = u ( x n , 0 )+ ku t ( x n , 0 )+ k 2 2

3 ) =

u tt ( x n , 0 )+ O ( k

k 2 2

(1.51)

c 2 f ′′ ( x

3 ) =

= u ( x n , 0 )+ kg ( x n )+

n )+ O ( k

k 2 c 2 2

2 h 2 + k 3 )

= u ( x n , 0 )+ kg ( x n )+

[ f ( x n − 1 ) − 2 f ( x n )+ f ( x n + 1 )] + O ( k

Where f ′′ ( x n ) was approximated in the final step using a second-order finite difference, see (1.50). It can now be seen that the expression

kc 2 2 h 2

U n 1 − U n 0 k

g ( x n ) =

[ f ( x n − 1 ) − 2 f ( x n )+ f ( x n + 1 )]

(1.52)

Made with FlippingBook flipbook maker