Laplace Finite Difference
Laplace Finite Difference
[Note: We will illustrate this in 2D. Extension to 3D is straightforward.]
Suppose seek a solution to the Laplace Equation subject to Dirichlet boundary conditions :
2 2 ( x, y ) 2 ( x , y )
( x, y ) 0 subject to specified on the boundary
x y
We discretize the (x,y) region of interest into a grid, with equal Δx = Δy = h grid spacings.
y
h
h
As we showed on HW #1, centered difference approximations to the partial derivatives at
As we showed on HW #1 centered difference approximations to the partial derivatives at
a grid point (i,j) are :
2 ( x, y ) i 1, j 2 i , j i 1, j 2 ( x, y ) i , j 1 2 i , j i , j 1
x 2
(i , j )
h 2
y 2
(i , j )
h 2
Thus, the discretized approximation to the Laplace Equation becomes :
i 1, j 2 i , j i 1, j i , j 1 2 i , j i , j 1
2
2
0
h h
i, j
1
i 1, j i 1, j i , j 1 i , j 1
4
Thus, we see that under this
approximation the value of at grid Numerical Analysis:
point (i,j) depends on the values of at “five‐point stencil”
its four nearest neighboring grid points.
y
“Boundary value problem” becomes :
y p
[1] “boundary values” specified on
grid points on the boundary
x
[2] Want to be able to numerically
calculate the values of at the interior grid
points.
points
Because at grid point (i,j) depends on its four neighbors, we can iteratively solve
f at the interior grid points via the following iterative scheme (“relaxation”) :
for h i i id i i h f ll i i i h (“ l i ”)
[0a] Fix the initial values of on the grid boundaries subject to the boundary values.
[0b] Set/choose initial values for the interior grid points
[0b] Set/choose initial values for the interior grid points.
[1] Successively sweep through all of the interior grid points, where on the (m+1)th
sweep (iteration) through all of the grid points :
1
im, j 1 im, j
4
im1, j im1, j im, j 1 im, j 1 4 im, j
im, j im, j
value from previous residual of mth
iteration iteration
y
Basic “Jacobi Iteration” scheme :
Step 0: Fix the boundary values; choose initial
guesses for the interior points.
f h i i i
Iteration 1: Calculate at all of the interior grid points
according to the formulas below. The values of at
x all of the interior grid points have been “updated”
all of the interior grid points have been “updated”.
Iteration 2: Re‐calculate at all of the interior grid
points using the “updated” values from Iteration 1.
Again update the values of at each grid point.
Again update the values of at each grid point
Continue N times …
m 1
i, j
1
im1, j im1, j im, j 1 im, j 1 4 im, j
m
i, j
4
im, j im, j After many iterations the residual will
After many iterations, the residual will
become small (i.e., the solution will
value from previous residual of mth
iteration iteration
have “relaxed” to its true value).
Notes :
[1] Under this scheme, the values of on the boundary are not modified.
[2] The accuracy of the solution will, in general, depend on the grid spacing h.
[3] The accuracy will, in general, improve with the number of iterations N, but is
subject to [2]. (The CPU time will also, in general, scale with N.)
Extension to 3D is straightforward. Have a 7‐point stencil, where the value of
g p , at
(i,j,k) depends on its six neighboring points:
(i+1,j,k), (i‐1,j,k), (i,j+1,k), (i,j‐1,k), (i,j,k+1), (i,j,k‐1)
Jacobi iteration is the simplest/most‐elementary approach to a numerical solution of
the Laplace Equation via relaxation.
More sophisticated methods (e.g., Gauss‐Seidel, Successive Overrelaxation, Multigrid
Methods, etc.) exist which improve both the accuracy and speed towards
h d ) h h b h h d d d
convergence.
See, for example, Numerical Recipes in C++.