Chapter 9 NUMERICAL SOLUTION OF PARTIAL DIFFERENTIAL EQUATIONS 1 CLASSIFICATION A general second order partial differential equation may be written as AUXX + BUXY + CUYY + DUX + EUY + FU = 0 where A, B, C, D, E, F are in general functions of x and y. The above equation is classified as follows: ● ● ● Elliptic if Parabolic if Hyperbolic if B2 – 4AC < 0 B2 – 4AC = 0 B2 – 4AC > 0 2 Standard Examples Elliptic equations Laplace equation 2u x 2 Poisson equation 2u x 2 + 2u y 2 =0 + 2u y 2 = f (x, y) Parabolic equations One dimensional heat equation 2u x 2 = 1 2 u t Hyperbolic equations One dimensional wave equation 2u x 2 = 1 2 2u t 2 3 ELLIPTIC EQUATIONS Finite Difference Method—In solving elliptic equations, we approximate the derivatives using finite differences. u ( x 0 h, y 0 ) u ( x 0 , y 0 ) h ux (x0, y0) = Also ux (x0, y0) = uxx (x0, y0) = uy(x0, y0) = [Forward difference] u ( x 0 , y 0 ) u ( x 0 h, y 0 ) h [Backward difference] u ( x 0 h , y 0 ) 2u ( x 0 , y 0 ) u ( x 0 h , y 0 ) h2 u(x 0 , y 0 k) u(x 0 , y 0 ) k [Forward difference] Also ux (x0, y0) = u(x 0 , y 0 ) u(x 0 , y 0 k) k and uyy (x0, y0) = u ( x 0 , y 0 k ) 2u ( x 0 , y 0 ) u ( x 0 , y 0 k ) k2 [Backward difference] 4 Graphical Representation I = 0 1 i=m j=n 2 xij+1 xi-1, j xij xi+1, j xi, j+1 J=2 J=1 J=0 5 Representation & Approximation Then (i, j+1) (i -1, j) (i, j) (i, j- 1) (i +1, j) ux = = uy = = uxx = uyy = u i 1, j u ij [Forward difference] h u i , j u i 1, j h u i ,1 j u i , j h u i , j u i , j1 h [Backward difference] [Forward difference] [Backward difference] u i 1, j 2u ij u i 1, j h u i , j1 2u i , j u ij1 k2 6 Solution of Elliptic Equations The most important type of elliptic equation is Laplace equation uxx + uyy = 0. Approximating the derivatives by difference expressions, we get uij = 14 (ui-1, j + ui+1,j + ui,j-1 + ui,j +1) when h = k u(i, j+1) u(i -1, j) u(i, j) u(i +1, j) u(i, j- 1) This is called diagonal averaging. 7 Diagonal averaging (ui-1, j+1) (ui-1,j-1) (ui+1,j+1) (ui+1,j-1) Also we can use the values of u at the diagonal points. ui,j = 14 (ui-1, j-1 + ui+1,j+1 + ui+1, j-1 + ui-1,j +1) 8 Liebmann’s Method To solve uxx + uyy = 0, in a square region R whose boundary is C. The square region is sub-divided into small squares. The values on the boundary points are given. We have to find the values for the function u (x,y) in the interior mesh points. For this we use the approximation using cross-averaging wherever possible and diagonal averaging otherwise. This iterative process is continued until the values at each mesh point converge. While applying this method, symmetry about the horizontal, vertical and diagonal lines should be taken into consideration. 9 Example Find by Liebmann’s Method the values at the interior lattice points of a square plate of the harmonic function u whose boundary values are given in the figure. 0 0 0 0 0 1 4 9 U1 U2 U4 U5 U6 U7 U8 U9 3 U3 6 16 15 9 14 13 12 10 Solution Using cross averaging and diagonal averaging, the successive iterations yield the following values: u1 u2 2.5000 5.625 u3 u4 u5 u6 u7 u8 u9 10.000 3.1250 6.0000 9.8750 3.0000 6.1250 9.5000 2.4375 5.6094 9.8711 2.8594 6.1172 9.8721 2.9948 6.1530 9.5063 2.3672 5.5888 9.8652 2.8698 6.1209 9.8731 3.0057 6.1582 9.5078 2.3647 5.5877 9.8652 2.8728 6.1230 9.8740 3.0078 6.1597 9.5084 2.3651 5.5883 9.8656 2.8740 6.1240 9.8745 3.0084 6.1602 9.5087 11 PARABOLIC EQUATION Most important parabolic equation One dimensional heat equation 2 u u 2 t = x 2 where 2 k = c and c is the specific heat, is the density and k is the thermal conductivity of the material. The above equation can be written as: uxx = aut 1 where a = 2 12 Bender – Schmidt Method Consider the equation uxx = aut with boundary conditions u(0, t) = T0 and u(1, t) = T1 The initial condition is u (x, 0) = f(x). Let h be the spacing for x and k be the spacing for t. Using finite difference approximation for derivatives, and applying boundary conditions and considering the k special case = = ½ , we get 2 h a 13 Bender – Schmidt Method ui,j+1 = ½ (ui-1,j + ui+1,j) This formula means that the value of u at x = xi and t = tj+1 is the arithmetic mean of the values of u at the surrounding points xi-1 and xi+1 at the previous time tj. B C ui-1,j ui,j ui,j+1 ui+1,j Value at A = ½ (Value at B + Value at C) A 14 Example Find the value of the function u (x,t) satisfying the equation u 2u 4 2 t x The boundary conditions are u (0,t) 0 u (8, t) 1 2 and the initial condition is u ( x,0) 4 x x 2 at the points x = i, i = 0, 1, 2, 3, 4 and t = (1/8) j, j = 0, 1, 2, 3, 4, 5. 15 Solution 1 k 1 1 Given a = , h = 1, = 2 = 4k. If = then k = . 4 2 8 h a i 0 1 2 3 4 5 6 7 8 0 0 3.5 6 7.5 8 7.5 6 3.5 0 1 0 3 5.5 7 7.5 7 5.5 3 0 2 0 2.75 5 6.5 7 6.5 5 2.75 0 3 0 2.5 4.625 6 6.5 6 4.625 2.5 0 4 0 2.3125 4.25 5.5525 6 5.5625 4.25 2.125 0 5 0 2.125 3.9875 5.125 5.5625 5.125 3.9875 2.125 0 j 16 HYPERBOLIC EQUATION Most important hyperbolic equation One – dimensional wave equation u 2 u a 2 t x 2 2 17 Solution of One–Dimensional Wave Equation a2 uxx – utt = 0 The boundary conditions are u The initial conditions are (0, t) = 0 = u (1, t) u (x, 0) = f (x) and ut (x, 0) = 0. Let h be the spacing for x and k be the spacing for t. Using finite difference approximation for derivatives, and applying boundary conditions and considering the k 1 special case = = , we get h a 18 Solution of One–Dimensional Wave Equation The boundary conditions u(0, t) = 0, u(1, t) = 0 can be written in the from u 0, j = 0 and un,j = 0 when l = nh. The initial condition u (x, 0) = f (x) can be expressed as: ui,0 = f (ih) i = 1, 2,…, That is ui,0 = fi. For the initial condition ut(x, 0) = 0, we use Central Difference Approximation for the derivative and write u i ,1 f i 1 f i 1 2 19 Solution of One – Dimensional Wave Equation ui, j+1 = ui+1, j + ui-1,j – ui, j-1 ui-1, j-1 ui-1, j ui, j-1 ui, j ui+1, j ui+1, j ui, j+1 Note: u(xi,tj+1)=(sum of surrounding values at previous time) – u(xi,tj-1) 20 Example Tabulate the pivotal values for the equation 2u 2u 16 2 2 x t Given that u (0, t) = 0, u (5, t) = 0, u (x, 0) = x2 (5 – x) and ut (x, 0) = 0 Assume h = 1. 21 Solution i 0 1 2 3 4 5 0 0 4 12 18 16 0 1 0 6 11 14 9 0 2 0 7 8 2 -2 0 3 0 2 -2 -8 -7 0 4 0 -9 -14 -11 -6 0 5 0 -16 -18 -12 -4 0 6 0 -9 -14 -11 -6 0 7 0 2 -2 -8 -7 0 8 0 7 8 2 -2 0 9 0 6 11 14 9 0 10 0 4 12 18 16 0 j ui,j+1 = ui-1, j + ui+1, j – ui, j-1 22 The End…… Wish you all the best… 23