You are on page 1of 9

Numerical methods for Laplace's equation Discretization: From ODE to PDE For an ODE for u(x) defined on the

interval, x [a, b], and consider a uniform grid with x = (ba)/N, discreti ation of x, u, and the derivative(s) of u leads to N e!uations for ui, i = ", #, $, %%%, N, where ui u(ix) and xi ix% (&ee illustration%)

'he idea for (DE is similar% 'he diagram in ne)t *age shows a t+*ical grid s+stem for a (DE with two varia,les x and y% 'wo indices, i and j, are used for the discreti ation in x and y% -e will ado*t the convention, u i, j u(ix, jy), xi ix, yj jy, and consider x and y constants (,ut generall+ allow x to differ from y)%

For a ,oundar+ value *ro,lem with a $nd order ODE, the two ,%c%.s would reduce the degree of freedom from N to N$/ -e o,tain a s+stem of N$ linear e!uations for the interior *oints that can ,e solved with t+*ical matri) mani*ulations% For an initial value *ro,lem with a #st order ODE, the value of u" is given% 'hen, u#, u$, u0, %%%, are determined successivel+ using a finite difference scheme for du/dx, and so on% -e will e)tend the idea to the solution for 1a*lace.s e!uation in two dimensions%

Laplace equation

u u = " , for u(x,y) defined within Example 12 &olve the discreti ed form of 1a*lace.s e!uation, $ $ x y the domain of " x # and " y #, given the ,oundar+ conditions (3) u(x, ") = # (33) u (x,#) = $ (333) u(",y) = # (34) u(#,y) = $ %

'he domain for the (DE is a s!uare with 5 6walls6 as illustrated ,elow% 'he four ,oundar+ conditions are im*osed to each of the four walls%

7onsider a 6to+6 e)am*le with 8ust a few grid *oints (with ) = + = #/0)2

3n the *receding diagram, the values of the varia,les in green are alread+ given ,+ the ,oundar+ conditions% 'he onl+ un9nowns are the red u i, j at the interior *oints% -e have 5 un9nowns, need 5 e!uations to determine their values% 1et us first a**ro)imate the second *artial derivatives in the (DE ,+ a 2nd order centered difference scheme,


u $ x
$ $

u i # , j $ u i , j ui # , j x
$

(#)

i, j

u $ y

u i , j # $ u i , j ui , j # y
$

($)

i, j

('he formula in (#) or ($) can ,e readil+ derived ,+ 'a+lor series e)*ansion% &ee undergraduate te)t,oo9s on numerical methods%) E!uations (#) and ($) are the same as those for the ordinar+ $nd derivatives, d $u/dx$ and d $u/dy$, onl+ that in E!% (#) y is held constant (all terms in E!% (#) have the same j) and in E!% ($) x is held constant (all terms have the same i)% For those who are not familiar with the inde) notation, E!s% (#) and ($) are e!uivalent to

$ u x x , y $ u x , y u x x , y u , $ $ x x $ u x , y y $ u x , y u x , y y u % $ $ y y

(#a)

($a)

'he corres*ondence ,etween the two set of notations is illustrated in the following%

(lugging E!s% (#) and ($) into the original 1a*lace.s e!uation, we o,tain u i # , j $ u i , j ui # , j x
$

ui , j # $ u i , j ui , j # y
$

= " , at the grid *oint (i, j) %

(0:)

-hen x = y, this e!uation can ,e rearranged into 5 ui , j ui #, j u i#, j ui , j # ui , j # = " , at the grid *oint (i, j) % (0)

'he 9e+ insight here is that the *artial derivatives, $u/x$;$u/y$, at the grid *oint (i, j) can ,e evaluated ,+ E!% (0) using the discrete values of u at (i, j) itself (with weight of 5) and those at its 5 neigh,oring *oints < at left, right, to*, and ,ottom% 'he diagram in the ne)t *age illustrates how this fits into the grid s+stem of our *ro,lem% For e)am*le, at the grid *oint, (i, j) = ($,$), the terms in E!% (0) are u$,$ at center and u$,0, u$,#, u#,$, and u0,$ at to*, ,ottom, left, and right of the grid *oint% 'he relevant grid *oints form a 6cross6 *attern%

=sing E!% (0), we can now write the e!uations for ui, j at the four interior *oints, 5 u#, # ; u#, $ ; u$, # u#, # 5 u#, $ ; u$,$ u#, $ 5 u$, $ ; u$, # u#, # ; u$, $ 5 u$, # ; u",# ; u#," ; u",$ ; u#,0 ; u$,0 ; u0,$ ; u$," ; u0,# = = = = " " " " (5) %

&ee the *receding diagram for the locations of the red and green varia,les% 'he red s+m,ols corres*ond to the un9nown ui,j at the interior *oints% 'he green ones are 9nown values of ui,j given ,+ the ,oundar+ conditions, (3) >ottom2 u#," = # , u$," = # (333) 1eft2 u",# = # , u",$ = # (33) 'o*2 u#,0 = $ , u$,0 = $ (34) ?ight2 u0,# = $ , u0,$ = $ (@)

Aoving the green s+m,ols in E!% (5) to the right hand side and re*lacing them with the 9nown values given ,+ the ,%c% in E!% (@), we have

5 # " # # 5 # " " # 5 # # " # 5


u#,# $ u#,$ = 0 5 u$,$ 0 u$,#

(B)

which can ,e readil+ solved to o,tain the final solution, (u#,#, u#,$ , u$,$ , u$,#) = (#%$@, #%@, #%C@, #%@)%

'he solution is illustrated ,elow% 'he ,ehavior of the solution is well e)*ected2 7onsider the 1a*lace.s e!uation as the governing e!uation for the stead+ state solution of a $<D heat e!uation, the 6tem*erature6, u, should decrease from the to* right corner to lower left corner of the domain% Note that while the matri) in E!% (B) is not strictl+ tridiagonal, it is s*arse% 'he situation will remain so when we im*rove the grid resolution (i%e%, using more grid *oints for the domain)2 'he matri) will ,ecome ,igger ,ut it will have man+ ero elements% 3f the matri) is small enough, solution ,+ a direct inversion of the matri) or classical direct method (such as Dauss elimination) will wor9% Otherwise, iterative methods (e%g%, Eaco,i.s or Dauss< &eidel methods) can ,e ado*ted to solve the matri) *ro,lem%

You might also like