Mathematical Physics - Volume II - Numerical Methods

18 Chapter 1. Finite difference method and Finite element method

triangular matrix of the N × N order are all within the interval ( p − | 2 q | , p + | 2 q | ) , where p = 1 − 2 r , q = r , we obtain: λ max ≈ ( 1 − 2 r )+ | 2 r | = 1 , (1.38) λ min ≈ ( 1 − 2 r ) − | 2 r | = 1 − 4 r , (1.39) from which follows that 1 − 4 r ≥ − 1, i.e r ≤ 1 / 2. 1.1.6 The program The simplicity of the finite difference method will be illustrated using a com puter program which solved the following problem:

u t = u xx 0 < x < 1 t > 0 , u ( x , 0 ) = 100sin ( π x ) 0 < x < 1 ,

(1.40) (1.41) (1.42)

u ( 0 , t ) = u ( 1 , t ) = 0 t > 0 .

For t = 0 . 5, the result will be compared to the exact solution: u = 100 e − π 2 t sin ( π x ) .

Application of the explicit method is reduced to using the expression (1.12), whereas the application of implicit methods requires additional analysis. If we introduce the weight factor W , we can write the following: U n , j + 1 − U n j = r [( 1 − W ) δ 2 x U n j + W δ 2 x U n , j + 1 ] (1.43) which is reduced to the backward method for W = 1, and to the Crank-Nicolson method for W = 0 . 5. By introducing contour and initial conditions in (1.43), we obtain a three-diagonal system of equations:

   

   

   

    =

1 + 2 Wr

− Wr 1 + 2 Wr

0

0 0

0 0 0

U 1 , j + 1 U 2 , j + 1 U 3 , j + 1 . . .

− Wr

− Wr 1 + 2 Wr

0

− Wr . . .

− Wr . . .

. . .

. . .

. . .

0 0

0 0

− Wr

1 + 2 Wr

− Wr 1 + 2 Wr

U N − 2 , j + 1 U N − 1 , j + 1

0

− Wr

   

   

D 1 D 2 D 3 . . .

(1.44)

=

D N − 2 D N − 1

Made with FlippingBook flipbook maker