Professional Documents
Culture Documents
Solving Poisson's Equation by Finite Differences
Solving Poisson's Equation by Finite Differences
P2: OSO/OVY
JWCL374-09-II
QC: SCF/OVY
T1: SCF
JWCL374-Brannan-v1
710
Chapter 9
Project 2 PROBLEMS
1. Derive the telegraph equation (5) from the
transmission line equations (3) and (4).
2. Show that if we look for solutions of Eq. (5) in
the form v(x, t) = z(t)y(x, t), then first derivative
terms can be removed if we choose z to satisfy
2 z + z = 0, and consequently, y(x, t) must
satisfy Eq. (7).
3. Show that if (x) = sin x is a solution of Eq. (11),
then the dependence of phase velocity on spatial
frequency is given by Eq. (12).
4. (a) Find the steady-state solution v(x)
of Eq. (5)
subject to the boundary conditions in Eq. (14)
by setting vt = vtt = 0 in Eq. (5), and then substituting the general solution of the resulting
equation into the boundary conditions to determine the constants of integration. Use Eq. (3)
to then find the steady-state current in the cable.
(b) Show that the transient term u(x, t) in Eq. (15)
must satisfy the initial boundary value problem
defined by Eqs. (16), (17), (18).
5. Use the method of separation of variables to solve
the inital boundary value problem defined by Eqs.
(16), (17), (18).
6. Use the relations sin ia = isinh a and
cos ia = cosh a and the trigonometric identities
sin (a b) = sin a cos b cos a sin b
and
2u
2u
+ 2 = 0.
2
x
y
(1)
12
Using Fourier transforms, we can perform the numerical simulation in this problem on a transmission
line of infinite length. We have chosen instants of time where both halves of the initial wave pulse have
coalesced at the center of the finite interval following an even number of reflections from the endpoints.
The shape of the pulse at these times is identical to that of the same initial pulse after it has propagated
along an infinite transmission line for equivalent periods of time.
CONFIRMING PAGES
16:29
P1: KUF/OVY
JWCL374-09-II
P2: OSO/OVY
QC: SCF/OVY
T1: SCF
JWCL374-Brannan-v1
Projects
711
The operator
2 =
2
2
+
x2
y2
is called the Laplacian operator or just the Laplacian. It is often the case that Laplaces
equation has a nonhomogeneous term, say, f (x, y), representing a distributed source13
( f > 0) or sink ( f < 0):
2u =
2u
2u
+ 2 = f (x, y).
2
x
y
(2)
(3)
is prescribed by
2u
2u
+
= f (x, y),
x2
y2
(x, y) R,
(4)
u(x, 0) = p(x),
u(x, b) = q(x),
0 < x < a,
(5)
u(0, y) = r ( y),
u(a, y) = s( y),
0 < y < b.
(6)
Equations (5) specify the values of u along the bottom and top edges of the rectangle,
whereas Eqs. (6) specify the values of u along the left and right edges of the rectangle.
(0, b)
u(0, y) = r(y)
(0, 0)
FIGURE 9.P.3
u(x, b) = q(x)
u(x, 0) = p(x)
u(a, y) = s(y)
(a, 0)
A numerical method for approximating the solution of the Dirichlet problem (4), (5),
(6) is the finite difference method. The finite difference method is based on approximating
13
To see this, for example, in the case of heat transport in a flat plate, the time-dependent heat equation
with a distributed heat source in the interior of the plate is u t = u xx + u yy + f (x, y), where f > 0. Thus
the steady-state equation with a heat source in the interior is u xx + u yy = f (x, y).
CONFIRMING PAGES
16:29
P1: KUF/OVY
JWCL374-09-II
712
P2: OSO/OVY
QC: SCF/OVY
T1: SCF
JWCL374-Brannan-v1
Chapter 9
(7)
where !x is typically a small increment (see Problem 1). We partition the region R into
rectangular elements with mesh point coordinates defined by
x m = m!x,
m = 0, 1, 2, . . . , M + 1,
(8)
yn = n!y,
n = 0, 1, 2, . . . , N + 1,
(9)
and
where
!x =
a
M +1
and
!y =
b
.
N +1
f mn = f (xm , yn ),
pm = p(xm ),
rn = r ( yn ),
0 m M + 1,
qm = q(xm ),
sn = s( yn ),
0 n N + 1,
0 m M + 1,
0 n N + 1.
(10)
(11)
(12)
Applying finite difference approximations to the partial derivatives appearing in Eq. (4) at
the grid point (xm , yn ) yields, using the notation in Eq. (10),
u m,n1 2u mn + u m,n+1
u m1,n 2u mn + u m+1,n
+
= f mn .
2
(!x)
(!y)2
(13)
(14)
Observe that if the point (xm , yn ) at which the discretization is centered is an interior point
adjacent to the boundary, then one or two of the terms on the left-hand side of Eq. (14)
are known from the boundary conditions. For example, the finite difference approximation
applied at the point (x1 , y1 ) may be written as
4u 11 + u 21 + u 12 = h 2 f (x1 , y1 ) p1 r1 ,
(15)
CONFIRMING PAGES
16:29
P1: KUF/OVY
JWCL374-09-II
P2: OSO/OVY
QC: SCF/OVY
T1: SCF
JWCL374-Brannan-v1
Projects
713
grid of interior points shown in Figure 9.P.5, we can write down the following system of six
equations for the unknown values u mn , m = 1, 2, 3, n = 1, 2 at the interior nodes:
4 1 0 1 0 0
u 11
f 11
p1
r1
0
0
1 4 1 0 1 0 u 21
f 21 p2 0 0 0
0 1 4 0 0 1 u 31
p 3 0 0 s 1
2 f 31
= h ,
1 0 0 4 1 0 u 12
f 12 0 q1 r2 0
0 1 0 1 4 1 u 22
f 22 0 q2 0 0
0 0 1 0 1 4
0
s2
u 32
f 32
q3
0
(16)
4 1 0 1 0 0
u 11
f 11
p1
r1
0
0
1 4 1 0 1 0 u 21
f 21 p2 0 0 0
0 1 4 0 0 1 u 31
f 31 p3 0 0 s1
= h 2 + + + + .
1 0 0 4 1 0 u 12
f 12 0 q1 r2 0
0 1 0 1 4 1 u 22
f 22 0 q2 0 0
0 0 1 0 1 4
u 32
f 32
0
q3
0
s2
(17)
(18)
We infer from Eq. (17) the pattern of entries that allow us to easily define, using a computer
algebra system, the required matrix entries for a more densely defined grid:
! The MN MN matrix A is symmetric and banded with 4s along the main diagonal,
1s along the first subdiagonal above and below the main diagonal except for every
Mth entry which is zero, and 1s along the Mth subdiagonal above and below the main
diagonal. All other entries of A are zero.
FIGURE 9.P.4
CONFIRMING PAGES
16:29
P1: KUF/OVY
JWCL374-09-II
714
P2: OSO/OVY
QC: SCF/OVY
T1: SCF
JWCL374-Brannan-v1
Chapter 9
q1
r2
r1
p1
FIGURE 9.P.5
q2
q3
u12
u22
u32
u11
u21
u31
p2
s2
s1
p3
! Beginning with the first entry, each set of M consecutive entries of the vector f corresponds to values of f (x, y) at interior nodal points along the rows of the computational
grid.
! The first M entries of the p vector correspond to p(x) evaluated at the interior bottom
row of grid points, with the remaining entries equal to 0.
! The last M entries of the q vector correspond to q(x) evaluated at the interior top row
of grid points, with the remaining entries equal to 0.
! Beginning with the first entry, each Mth consecutive entry of the r vector is equal to
r ( y) evaluated at a grid point along the left boundary of R.
! Beginning with the Mth entry, each Mth consecutive entry of the s vector is equal to
s( y) evaluated at a grid point along the right boundary of R.
While decreasing the distance h between nodes in the finite difference algorithm decreases the error in the approximate solution of the boundary value problem (4), (5), (6),
it increases the number of unknowns. For example, multiplying internodal distances by a
factor of 12 increases the number of unknowns by 4. However understanding the pattern of
the entries in A and the vectors f, p, q, r, and s allows us to construct a system of equations
that can easily be solved using a computer algebra system, provided that the dimension of
the system is not too large.
The method of finite differences is one of several different types of algorithms used to
compute numerical approximations to solutions of partial differential equations. Numerical
approximation methods enjoy three major advantages over the method of separation of
variables: (1) they generalize to equations with variable coefficients, (2) they can be used
on problems that have domains with irregular geometries, and (3) they can be applied to
nonlinear problems. In all cases, numerical linear algebra plays an important role in the
solution algorithms.
CONFIRMING PAGES
16:29
P1: KUF/OVY
JWCL374-09-II
P2: OSO/OVY
QC: SCF/OVY
T1: SCF
JWCL374-Brannan-v1
Projects
715
Project 3 PROBLEMS
1. If a function F(x) has n continuous derivatives,
the Taylor series expansion of F(x0 + !x) with
remainder about the point x0 is
1
F(x0 + !x) = F(x0 ) + F (1) (x0 )!x
1!
1
1
+ F (2) (x0 )(!x)2 + +
F (n1) (x0 )(!x)n1
2!
(n 1)!
1
+ F (n) (x1 )(!x)n ,
n!
(i)
(x0 )! C(!x) ,
!
x2
In each case, compute the maximum error between
(!x)2
the numerical approximation and the exact solution
where C is a constant. If the increment size !x is
at each of the grid points:
reduced by a factor of 2, by what factor is the local
error reduced?
2. Consider the following Dirichlet problem:
2u
2u
+
= 6 xy,
x2
y2
u(x, 0) = x 2 2x,
0 < x < 2,
0 < y < 1,
(i)
"
u(x, 1) = x x
0 < x < 2,
u(0, y) = 4y(1 y),
E M,N =
u(2, y) = 4y
0 < y < 1.
13
6
,
(ii)
1 y y2
,
12
(iii)
max
1mM, 1nN
|u mn u(xm , yn )|
CONFIRMING PAGES
16:29