Pde Slides Numerical Laplace

Embed Size (px)

Citation preview

  • 8/13/2019 Pde Slides Numerical Laplace

    1/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 = (b a)/N,discreti ation of x, u, and the derivative(s) of u leads to N e!uations for u i, i = ", #, $, %%%, N, whereui u(i x) and xi i x% (&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 twovaria les x and y% 'wo indices, i and j, are used for the discreti ation in x and y% -e will ado*t theconvention, u i, j u(i x, j y), xi i x, y j j y, and consider x and y constants ( ut generall+ allow x todiffer from y)%

  • 8/13/2019 Pde Slides Numerical Laplace

    2/9

    For a oundar+ value *ro lem with a $nd order ODE, the two %c%.s would reduce the degree of freedomfrom N to N $ -e o tain a s+stem of N $ linear e!uations for the interior *oints that can e solved witht+*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% -ewill e tend the idea to the solution for 1a*lace.s e!uation in two dimensions%

  • 8/13/2019 Pde Slides Numerical Laplace

    3/9

    Laplace equation

    Example 1 2 &olve the discreti ed form of 1a*lace.s e!uation, $ u x

    $ $ u y

    $ = " , for u( x, y) defined within

    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 areim*osed to each of the four walls%

  • 8/13/2019 Pde Slides Numerical Laplace

    4/9

    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 todetermine their values% 1et us first a**ro imate the second *artial derivatives in the DE + a 2nd ordercentered difference scheme ,

    $ u x

    $

    i , j

    u i # , j $ u i , j u i # , j

    x$ , (#)

    $ u y$ i , j

    u i , j # $ u i , j u i , j #

    y$ % ($)

  • 8/13/2019 Pde Slides Numerical Laplace

    5/9

    ('he formula in (#) or ($) can e readil+ derived + 'a+lor series e *ansion% &ee undergraduate te t oo9son numerical methods%)

    E!uations (#) and ($) are the same as those for the ordinar+ $nd derivatives, d $

    u/dx$

    and d $

    u/dy$

    , onl+ thatin E!% (#) y is held constant (all terms in E!% (#) have the same j) and in E!% ($) x is held constant (all termshave the same i)% For those who are not familiar with the inde notation, E!s% (#) and ($) are e!uivalent to

    $ u x

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

    x$ , (#a)

    $

    u y$

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

    % ($a)

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

  • 8/13/2019 Pde Slides Numerical Laplace

    6/9

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

    u i # , j $ u i , j u i # , j

    x$

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

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

    -hen x = y, this e!uation can e rearranged into

    5 u i , j u i #, j u i #, j u i , j # u i , 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 grids+stem of our *ro lem% For e am*le, at the grid *oint, ( i, j) = ($,$), the terms in E!% (0) are u$,$ at center andu$,0, u$,#, u#,$, and u0,$ at to*, ottom, left, and right of the grid *oint% 'he relevant grid *oints form a 6cross6

    *attern%

  • 8/13/2019 Pde Slides Numerical Laplace

    7/9

  • 8/13/2019 Pde Slides Numerical Laplace

    8/9

    sing E!% (0), we can now write the e!uations for u i, j at the four interior *oints,

    5 u#, # ; u#, $ ; u$, # ; u",# ; u#," = "

    u#, # 5 u#, $ ; u$,$ ; u",$ ; u#,0 = " (5) u#, $ 5 u$, $ ; u$, # ; u$,0 ; u0,$ = " u#, # ; u$, $ 5 u$, # ; u$," ; u0,# = " %

    &ee the *receding diagram for the locations of the red and green varia les% 'he red s+m ols corres*ond tothe un9nown u i,j at the interior *oints% 'he green ones are 9nown values of u i,j given + the oundar+conditions,

    (3) >ottom2 u#," = # , u$," = # (33) 'o*2 u#,0 = $ , u$,0 = $

    (333) 1eft2 u",# = # , u",$ = # (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#,$u$,$u$,#

    =

    $ 0 5 0

    , (B)

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

  • 8/13/2019 Pde Slides Numerical Laplace

    9/9

    'he solution is illustrated elow% 'he ehavior of the solution is well e *ected2 7onsider the 1a*lace.se!uation as the governing e!uation for the stead+ state solution of a $