
























Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!

























Introduction
In the second part of these notes we presented basic numerical analysis expressions and
showed how they could be used to solve a boundary value problem in an ordinary differential
equation. Here we seek to extend our use of numerical analysis to apply to partial differential
equations with a time derivative. We will show that the numerical equations that we obtain have
limits based on stability. That is, there are step size limits that are required not only for accuracy,
but also to make sure that the finite-difference equations do not give erroneous solutions.
The conduction (diffusion) equation
The one-dimensional equation for heat conduction in a solid with constant properties and no
source term is a useful example of a partial differential equation. Although it has no velocity
terms, it does have the transient and diffusion terms that we have seen in our general transport
equation. This equation may be written as follows.
2
2
x
k t
cv
If you are not familiar with this equation, you can derive it from equation [1-71], shown below, by
setting all velocities, dissipation and dilatation to zero. The constant property assumption allows
the properties to be brought outside the differential operators. For the one-dimensional case, we
have spatial derivatives only with respect to x 1 or, more simply, x.
T
P
i i i
i v
x
k x x
uT
t
c
Φ (^) D [1-71]
In the conduction equation, we define the thermal diffusivity, = k/(ρ c (^) v) and write equation [3-14]
with the single property value, .
2
2
x
t
Equation [3-2] is sometimes called the diffusion equation since it represents species diffusion in a
solid if is the species diffusion coefficient (usually represented by the symbol D). Equation [3-2]
has an open boundary in time; we do not have to specify the conditions at a future time. We
need an initial condition for the temperature at all points in the region. We can write a general
initial condition as T(x,0) = T 0 (x). Similarly we can write arbitrary boundary conditions for the
boundaries at x (^) min and xmax: T(xmin,t) = T (^) L(t) and T(xmax,t) = TR (t). These conditions, as well as
values for the geometry and the thermal diffusivity must be specified before we can solve the
differential equation.
We can construct finite-difference grids in space and time. For simplicity, we will assume
constant step sizes, ∆t and ∆x. We define our time and space coordinates on this grid by the
integers n and i, so that we can write
t (^) n t 0 n t and xi x 0 i t [3-3]
We can obtain a solution process, known as the explicit method , if we use a forward difference
for the time derivative and a central difference for the space derivatives.^1 These are given by the
following equations.
2 2
1 1 2
1 2 O x x
x
O t and t
t
n i
n i
n i
n
i
n i
n i
n
i
[3-4]
These equations are modifications of equations [2-19] and [2-29] from the introductory notes on
numerical methods. In those notes we dealt with ordinary derivatives and needed only one
subscript for the dependent grid variable. Here, in a multidimensional case, we have temperature
as a function of time and distance, T(x,t). Thus we define T in^ = T(xi , tn). We use differences
between variables like Tin, Tni+1, and T ni-1 to give differences in the x-direction that are used to
compute spatial derivatives. The constant n superscript in the space derivative is an indication
that we are holding time constant and varying distance. Similarly, the time derivatives are
reflected in the finite-difference form by using variations in the superscript n while holding the
subscript i constant.
The forward difference for the time derivative is chosen over the more accurate central difference
to provide a simple algorithm for solving this problem. There are other problems with the use of
the central difference expression for the time derivative that we will discuss later.
If we substitute the finite-difference expressions in [3-4] into equation [3-2], we get the following
result.
2
1 1
1 O t x x
t
n i
n i
n i
n i
n i
We have written the combined error term to show the order of the error for both ∆x and ∆t. We
have not written these as separate terms since O() notation simply shows how the error depends
on the power of the step size. If we neglect the truncation error, we can obtain a simple equation
for the value of the temperature at the new time step.
n i
n i
n i
n i
n i T T T T x
t T
2 ( )
2 1 1
[3-6]
We see that the grid spacings and the thermal diffusivity appear in a single term. We can define
this as a single term to save writing.
2 ( x )
t f
[3-7]
With this definition, equation [3-6] may be written as follows.
(^1) This approach is sometimes called the forward-time, central-space (FTCS) differencing scheme.
affect our ability to obtain an analytical solution. We must treat it explicitly in the numerical
solution.
In addition to the modified initial condition row, where we know all the temperatures, we have the
boundary condition columns. For all time points at x = 0 and x = L = 1, we set the table entries to
the known boundary temperatures. Although the initial and boundary conditions are particularly
simple in this example, we could handle initial conditions that were arbitrary functions of x and
boundary conditions that were arbitrary conditions of time by placing the appropriate results for
the initial and boundary temperatures at the correct places in the table.
Once the modified initial condition row and the boundary condition columns are set, the solution
for the remaining temperatures, using equation [3-8] is straightforward. We first use equation [3-
7] to compute the value of f.
x
t f
[3-10]
Once the value of f is known, we can apply equation [3-8] to each node, in successive rows. The
calculations below are for the first time step.
0 3
0 4
0 2
1 3
0 2
0 3
0 1
1 2
0 1
0 2
0 0
1 1
T fT T f T
T fT T f T
T fT T f T
[3-11]
These are the results shown in the “n = 1” row of the table. The numerical results are symmetric
in x as would be expected from the uniform initial condition and the symmetric boundary
condition. The process illustrated in equation [3-11] is used to calculate the remaining results in
the table. The final two entries in the table are the exact results, calculated for the different
values of x at the final time t = 0.2, and the error. The latter is the absolute value of the difference
between the numerical and analytical solution.
Table 3- Numerical solution of the Conduction Equation = 1, ∆x = 0.25, ∆t = 0.01, t max = 0. i = 0 i = 1 i = 2 i = 3 i = 4
x = 0.00 x = 0.25 x = 0.50 x = 0.75 x = 1.
t = 0 1000 1000 1000 1000 1000 n = 0 t = 0+ 0 1000 1000 1000 0 n = 1 t = 0.01 0 840 1000 840 0 n = 2 t = 0.02 0 731.2 948.8 731.2 0 n = 3 t = 0.03 0 649.0 879.2 649.0 0 n = 4 t = 0.04 0 582.0 805.5 582.0 0 n = 5 t = 0.05 0 524.6 734.0 524.6 0 n = 6 t = 0.06 0 474.2 667.0 474.2 0 n = 7 t = 0.07 0 429.2 605.3 429.2 0 n = 8 t = 0.08 0 388.7 548.9 388.7 0 n = 9 t = 0.09 0 352.1 497.7 352.1 0 n = 10 t = 0.10 0 319.1 451.1 319.1 0 n = 11 t = 0.11 0 289.2 408.9 289.2 0 n = 12 t = 0.12 0 262.0 370.5 262.0 0
Table 3- Numerical solution of the Conduction Equation = 1, ∆x = 0.25, ∆t = 0.01, t (^) max = 0. i = 0 i = 1 i = 2 i = 3 i = 4
x = 0.00 x = 0.25 x = 0.50 x = 0.75 x = 1.
n = 13 t = 0.13 0 237.5 335.8 237.5 0 n = 14 t = 0.14 0 215.2 304.4 215.2 0 n = 15 t = 0.15 0 195.0 275.8 195.0 0 n = 16 t = 0.16 0 176.8 250.0 176.8 0 n = 17 t = 0.17 0 160.2 226.5 160.2 0 n = 18 t = 0.18 0 145.2 205.3 145.2 0 n = 19 t = 0.19 0 131.6 186.1 131.6 0 n = 20 t = 0.20 0 119.2 168.6 119.2 0 Exact t = 0.20 0 125.1 176.9 125.1 0 Error t = 0.20 0 5.8 8.2 5.8 0
The numerical calculation of the final temperatures for an end time of = 0.2 can be repeated for
time steps of 0.02 and 0.04. These results are shown in the Tables 3-2 and 3-3 below. When the
time step is doubled from 0.01 to 0.02 the solution results are similar. However, the error in the
temperatures at the final time step has increased by about a factor of three.
Table 3- Numerical solution of the Conduction Equation = 1, ∆x = 0.25, ∆t = 0.02, t max = 0. i = 0 i = 1 i = 2 i = 3 i = 4 x = 0.00 x = 0.25 x = 0.50 x = 0.75 x = 1.
t = 0 1000 1000 1000 1000 1000 n = 0 t = 0+ 0 1000 1000 1000 0 n = 1 t = 0.02 0 680 1000 680 0 n = 2 t = 0.04 0 564.8 795.2 564.8 0 n = 3 t = 0.06 0 457.9 647.7 457.9 0 n = 4 t = 0.08 0 372.1 526.2 372.1 0 n = 5 t = 0.10 0 302.3 427.6 302.3 0 n = 6 t = 0.12 0 245.7 347.4 245.7 0 n = 7 t = 0.14 0 199.6 282.3 199.6 0 n = 8 t = 0.16 0 162.2 229.4 162.2 0 n = 9 t = 0.18 0 131.8 186.4 131.8 0 n = 10 t = 0.20 0 107.1 151.4 107.1 0 Exact t = 0.20 0 125.1 176.9 125.1 0 Error t = 0.20 0 18.0 25.4 18.0 0
When the time step is increases to 0.04, the results are completely different, and these results do
not match our ideas of physical reality. We expect that the region will eventually reach a constant
temperature equal to the two boundary temperatures of zero. As this cooling takes place, we do
not expect to see any temperatures outside the range bounded by the initial temperature of 1000
and the boundary temperature of 0. However, the solutions with a time step of 0.04 have some
negative temperatures in the solution. You can verify that these unexpected negative
temperatures are correctly computed from the finite difference equation.
obtain a desired accuracy, however we cannot use a step size that violates the stability condition
in equation [3-12] if use the explicit method.
The appendix to this section of notes contains a derivation for the truncation error for this
approach. There are two equivalent equations for this truncation error. Both of these are written
as an infinite series in equation [3-13].
2
2
2
1 2
2
1 2 2 2 2
!
k
n
i
k
k
k
k
k
n
i
k
k k n k i x
k f
k
k
t
x
k k
f
We see that the truncation error depends in a complex way on the two finite-difference grid
spacings, ∆t and ∆x. Choosing f = 1/6 eliminates the first (k = 2) term in the truncation error and
gives a higher order truncation error.
The method just described is called the explicit method because all temperatures at the new
time step can be written as an explicit function of temperatures at the old time step. Alternative,
implicit approaches use the value of the temperature at the new time step. The Crank-Nicholson
method is the most popular implicit method. This method uses a finite-difference representation
of the conduction equation at a time point midway between the two specified time grid lines.
Although there is no computational point there, we can write this time derivative as follows, using
a central-difference approximation. In this expression the step size is ∆t/2, the distance from the
location of the derivative to the location of each of the two points used in its computation.
2
1
2
2 2
1 2 2 1
1
^
n
i
n i
n i
n i
n i
n
i x
O t t
O t t
t
Although this midpoint location gives us an easy way to compute the time derivative, there is no
such easy way to compute the space derivative. We can use an average of the finite difference
expression for the space derivative at the two time points, n and n+1. Such an average produces
a truncation error that can be seen by adding the Taylor series for fi+1 and fi-1 from equations [2-
15] and [2-18].
4 ''''
2 ''' 1 1
3 '''
2 ' '' 1
3 '''
2 ' '' 1
h f
h f f f f
h f
h f f fh f
h f
h f f fh f
i i i i i
i i i i i
i i i i i
[3-15]
When we solve the last equation above for f i , we get the truncation error that arises when we use
the arithmetic average of two neighboring points (fi+1 and fi-1) to approximate the value at the
midpoint.
1 1 2
4 ''''
2 1 1 '' Oh
h f f f
h f
f f f
i i i i
i i i
[3-16]
Applying this result to the
2
1
2
2
n
i
x
term gives the following result.
1
2
2
2
2 2
1
2
2 O t x
x
x
n
i
n
i
n
i
[3-17]
In this case the truncation error is proportional to [(∆t)^2 ] because we are taking an average of this
derivative at two time points to represent the derivative at the midpoint. We can use the second-
order equation for the second derivative for each term in this average. Doing this and combining
equations [3-17] and [3-14] gives
2 2 2
1 1 2
1 1 1
1 1
1
2
1
2
2 2
1
O t x x
x
t
x
t
n i
n i
n i
n i
n i
n i
n i
n i
n
i
n
i
[3-18]
The finite difference that we obtain from equation [3-18] contains three temperatures at the new
time point. We can rewrite this equation, introducing the factor f defined in equation [3-7] and
ignoring the truncation error.
n i
n i
n i
n i
n i
n i T T f T
f T
f T f T
f ( 1 ) 2 2
1 1
1 1
1 1 1
[3-19]
This equation describes a tridiagonal system of simultaneous linear algebraic equations. As we
saw in the numerical analysis notes, this set of equations is easily solved by the Thomas
algorithm, presented in the notes on numerical analysis.
A final approach, known as the fully implicit approach, uses we use a backward difference for
the time derivative and a central difference for the space derivatives at the point (xi,, t n+1). In this
approach we write the two derivatives as follows.
2 2
1 1 1
1 1
1
2
(^112)
O x x
x
O t and t
t
n i
n i
n i
n
i
n i
n i
n
i
[3-20]
Substituting these finite difference expressions into the differential equation gives the following
result.
2
1 1 1
1 1
(^11)
2
(^12)
O t x x
t
x
t
n i
n i
n i
n i
n i
n
i
n
i
Rearranging the finite-difference terms (ignoring the truncation error) and using our usual
definition of f = α∆t/(∆x) 2 , gives the following result, after some algebra.
n i
n i
n i
n fTi f T fT T
1 1
1 1 1 (^1 2 ) [3-22]
Table 3- Crank-Nicholson Solution of the Conduction Equation = 1, ∆x = 0.01, ∆t = 0.0005, t (^) max = 0. i = 0 i = 1 i = 2 i = 3 i = 4
x = 0 x = 0.01 x = 0.02 x = 0.03 x = 0.
n = 10 t = 0.005 0 90.79 148.20 237.92 311.
n = 11 t = 0.0055 0 67.50 159.07 222.68 296. n = 12 t = 0.006 0 78.99 138.51 217.76 285.
n = 13 t = 0.0065 0 65.08 144.07 205.56 273. n = 14 t = 0.007 0 70.94 130.31 201.68 264.
n = 15 t = 0.0075 0 62.29 132.69 192.04 255. n = 16 t = 0.008 0 65.10 123.21 188.58 247.
n = 17 t = 0.0085 0 59.50 123.75 180.95 241. n = 18 t = 0.009 0 60.65 117.00 177.71 234.
n = 19 t = 0.0095 0 56.86 116.50 171.59 228. n = 20 t = 0.01 0 57.10 111.53 168.52 222.
n = 21 t = 0.0105 0 54.43 110.47 163.53 217. n = 22 t = 0.011 0 54.19 106.68 160.64 212.
n = 23 t = 0.0115 0 52.22 105.35 156.49 208. n = 24 t = 0.012 0 51.73 102.36 153.78 203.
n = 25 t = 0.0125 0 50.21 100.93 150.27 199. Exact t = 0.0125 0 50.43 100.66 150.48 199.
Error t = 0.0125 0 0.216 0.272 0.212 0.
For the first time step in Table 3-4, the node nearest the border has a negative temperature. This
leads to severe oscillations in the temperatures at this spatial node. These die out by the time
step, n = 25. There are slight oscillations in the second node in from the border as well. The
third node in from the border does not have any oscillations, but the temperature change between
the time steps n = 2 and n = 3 is very small compared to the temperature changes for the
previous and subsequent time steps. This is a sign that the effects of the temperature oscillations
near the border are penetrating into the body of the Crank-Nicholson calculation. (These same
results are also present in the symmetric border at x = L.) The Crank-Nicholson calculation is
stable because these initial oscillations die out. If the method were not stable, these oscillations
would grow without bound.
Table 3-5 shows the partial results for the fully implicit method for the same set of nodes used in
Table 3-4. Here there are no physically unrealistic oscillations. Although these results are more
realistic, the error in this method is greater than the error in the Crank-Nicholson method, even for
a small maximum time of 0.0125. The error in the boundary gradient at the final time step (n =
about 1.7 times the error using the Crank-Nicholson method.
In addition to providing an accuracy comparison, these example calculations in Table 3-4 show
that there is no inherent link between stability and physical reality. In these notes we derived the
stability criterion for the explicit method by using arguments of physical reality. However, we see
that the Crank-Nicholson method can produce intermediate results that are unrealistic physically,
but the method still is stable. The fully implicit method does not produce such unrealistic results,
but its accuracy is less than that of the Crank-Nicholson method.
Table 3- Fully-implicit Solution of the Conduction Equation = 1, ∆x = 0.01, ∆t = 0.0005, t (^) max = 0. i = 0 i = 1 i = 2 i = 3 i = 4 x = 0 x = 0.01 x = 0.02 x = 0.03 x = 0.
t = 0 1000 1000 1000 1000 1000 n = 0 t = 0+ 0 1000 1000 1000 1000
n = 1 t = 0.0005 0 358.26 588.17 735.71 830. n = 2 t = 0.001 0 218.22 408.43 562.69 682.
n = 3 t = 0.0015 0 166.26 322.13 460.74 578. n = 4 t = 0.002 0 139.05 272.65 396.35 507.
n = 5 t = 0.0025 0 121.84 240.25 352.17 455. n = 6 t = 0.003 0 109.75 217.08 319.77 415.
n = 7 t = 0.0035 0 100.65 199.49 294.81 385. n = 8 t = 0.004 0 93.50 185.57 274.85 360.
n = 9 t = 0.0045 0 87.68 174.19 258.43 339. n = 10 t = 0.005 0 82.82 164.67 244.62 321.
n = 11 t = 0.0055 0 78.69 156.56 232.81 306. n = 12 t = 0.006 0 75.13 149.54 222.55 293.
n = 13 t = 0.0065 0 72.00 143.38 213.53 281. n = 14 t = 0.007 0 69.24 137.93 205.52 271.
n = 15 t = 0.0075 0 66.77 133.05 198.35 262. n = 16 t = 0.008 0 64.55 128.66 191.88 253.
n = 17 t = 0.0085 0 62.54 124.67 186.01 246. n = 18 t = 0.009 0 60.70 121.03 180.64 239.
n = 19 t = 0.0095 0 59.02 117.70 175.71 232. n = 20 t = 0.01 0 57.47 114.62 171.16 226.
n = 21 t = 0.0105 0 56.03 111.78 166.95 221. n = 22 t = 0.011 0 54.70 109.13 163.04 216.
n = 23 t = 0.0115 0 53.46 106.67 159.38 211. n = 24 t = 0.012 0 52.30 104.36 155.96 206.
n = 25 t = 0.0125 0 51.21 102.20 152.76 202. Exact t = 0.0125 0 50.43 100.66 150.48 199.
Error t = 0.0125 0 0.779 1.542 2.273 2.
The differences in the accuracy of the two methods increase as the calculation is run for a longer
maximum time. Table 3-6 shows some overall results for the final time step when the
calculations are done for a maximum time of 1. The errors in the fully implicit method, with its
truncation error that is O[∆t, (∆x) 2 ] are significantly higher than those in the Crank-Nicholson
calculation, which has a truncation error that is O[(∆t) 2 , (∆x) 2 ]. Both calculations took 2000 time
steps with f = 5.0. Table 3-6 also shows the results of an explicit calculation that used 20,
time steps to achieve the same maximum time. These time steps were the minimum allowed with
the maximum value of f = 0.50. (If we wanted to use f = 1/6 to get the higher order truncation
error from the explicit method, we would need 60,000 time steps to reach the same maximum
time.)
Table 3-6 also shows the execution time for calculations done on a 700 MHz Pentium III
computer using a C++ program. The measured execution times are so short that they may not
be meaningful. In general, solutions for this problem took about 0.5 to 0.6 microseconds per
node per time step for the implicit and Crank Nicholson method and about 0.06 to 0.
We start by writing the computed solution, T, as the sum of a hypothetical exact solution to the
difference equation D, plus an error term, ε.
n k
n k
n
If we substitute equation [3-24] into equation [3-21] we get the following result.
n k
n k
n k
n k
n k
n k
n k
n
1 1 1 1 (^12 )
1 1 [3-25]
Now the exact solution, D, must satisfy the original difference equation [3-8], copied below with
the i subscript replaced by k.
n k
n k
n k
n Dk f D 1 D 1 ( 1 2 f ) D
1 (^)
[3-26]
Subtracting equation [3-26] from equation [3-25] gives us the finite-difference equation for the
error growth.
n k
n k
n k
n
1 (^)
[3-27]
We now make the assumption that the solution to the finite-difference equation for the error can
be written as a Fourier series with the following general term.
at i x m
With this general Fourier series term, we can write the error as a function of x and t by the
following sum.
M
m
at imx x t e e 1
Here i 2 = -1, and M is the number of intervals on the grid. Each interval has the width, ∆x = L/M.
On this grid we can represent the sine-cosine waves that are equivalent to the imaginary
exponential for wave numbers, βm defined as follows.
m M L
m m ^0 ,^1 ,^2 ,
We see that βm is a real quantity; the exponent, a, that multiplies time can be complex, in general.
The values of t and x in equations [3-28] and [3-29] are limited to the discrete values on the grid.
That is t (^) n = n∆t and xk = x 0 + k∆x. Because the difference equation is linear, we can examine
only the typical term shown in equation [3-28]. If we substitute this term into equation [3-27], the
finite difference equation for error growth gives the following.
n at i x ant i ( x 0 kx ) m
Substituting equation [3-31] for the error into the finite-difference equation for the error, [3-27]
gives the following result.
( 1 ) ( 0 ) [ 0 ( 1 ) ] [ 0 ( 1 ) ] ( 0 ) ( 1 2 )
a n t im x kx ant imx k x ant imx k x ant imx kx e e f e e e e f e e
[3-32]
We can divide equation [3-32] by the common term
an t im (^ x 0 kx ) e e
^ to obtain the following result.
] e f e e f
a t im x imx
^ [3-33]
From the relationship between complex exponentials and trigonometric functions, we can write
e e 2 cos( m x )
i (^) m x imx
so that equation [3-33] may be rewritten as follows.
2 cos( )( 1 2 ) 2 [cos( ) 1 ] 1
e f mx f f mx
at
For the final step, we can use the trigonometric identity that (^)
cos( ) 1 2 sin
2
1 4 sin
2 x e f
Equation [3-35] is our stability condition for the explicit finite difference equation used to analyze
the conduction equation. To apply this equation we recall that the typical error term in equation
[3-28] is
at imx e e
. Since βm is real the term,
i (^) mx e
, will not grow with time. The term,
at e , could
lead to a growth with time. The growth factor, G, for a typical error is simply the ratio of the
typical error term at time steps n and n+1. Using equation [3-28] we find that this error term is
given by the following equation.
a t at i x
at t i x
m n
m n e e e
e e
xt
xt G m
m
^
( ) 1 ( , )
[3-36]
We use the absolute value in equation [3-36] because we want to constrain the magnitude of the
growth factor. If this magnitude is less than (or equal to) one, for each time step, we can be
assured that the error will not grow. That is, we require the following.
a t G e [3-37]
But, from equation [3-35], we have a relationship between
at e
and other grid parameters.
Substituting equation [3-35] into the inequality, [3-37] gives the following result.
1 4 sin
2
x G e f
[3-38]
Because of the absolute value sign, equation [3-38] actually contains two constraints:
1 4 sin
2
x f m
[3-39]
4 sin
2
x f m
[3-40]
The first constraint, in [3-39], is always satisfied because f and sin 2 are both greater than zero.
The inequality in [3-40] is satisfied for all values of βm x/2 if it is satisfied for the values of βm x/
1 2 sin
1 2 sin
2
2
x f
x f
G e m
m
at
[3-45]
With some thought we can see that G will always be less or equal to 1 for any possible
combination of f, x, or βm. To see this, recall that f and the sin 2 term are always positive. We thus
have the ratio of (one minus a positive quantity) to (one plus the same positive quantity). This
ration will always be positive and less than one. This shows that the Crank Nicholson method is
unconditionally stable. (By unconditionally table, we mean that any errors in the solution will
damp out eventually. This does one mean that we will always obtain physically realistic results.
Taking too large a value of f, ( i.e ., too large a time step for the given space step and thermal
diffusivity) can produce physically unrealistic results.
Stability analysis for convection equations
The simplest convection case we can analyze is shown below. This is the first-order wave
equation with no diffusion term and a constant convection velocity, c.
x
u c t
u [3-46]
Consideration of this equation 5 allows us to focus on the convection terms, while ignoring, for the
time being, the nonlinear effects. Using a forward difference in time and a central difference in
space, we can define the following finite difference expressions.
1 1 2
1 O x x
u u
x
u O t and t
u u
t
u
n i
n i
n
i
n i
n i
n
i
[3-47]
This approximate is often called a Forward-Time, Central-Space (FTCS) differencing.
Substituting these into our differential equation [3-26] gives the following finite difference
equation, after some algebra.
2 1 1
1 u u O t x x
c t u u
n i
n i
n i
n i
[3-48]
The stability of this finite-difference equation (ignoring the truncation error) can be found by the
von Neumann analysis used previously. We substitute the general error term of equation [3-31]
into the finite-difference expression, [3-48].
n i
a n t i x kx ant i x kx ant i x k x ant i x k x e e e e u x
c t e e m e e m m m 1
( 1 ) ( 0 ) ( 0 ) [ 0 ( 1 ) ] [ 0 ( 1 ) ]
2
[3-49]
(^5) We can see the relationship between this equation and the usual second-order wave equation by taking
the time derivative of equation [4-46]. This gives the following sequence of terms where we use equation [3-
26] to substitute terms.
2
2
2
2
x
u c x
u c x
c t
u
x
c x
u
t
c t
u
t t
u
The first and last terms in this equation form the usual second-order wave equation.
Proceeding in the usual way, we divide by the common term of
an t im [^ x 0 ( k^1 ) x ] e e
^ and use the
same trigonometric identities used previously to obtain.
2
1 cos( ) 1 1 2 sin 2
( 0 ) ( 0 ) 2 x
x
c t x x
c t e e x
c t e (^) m m
[3-50]
We gave our usual growth factor, G =
at e
, which must be less than one.
1 1 2 sin
2
x
x
c t G e
When the term inside the absolute value sign is positive, we must have the following condition.
1 2 sin 2
1 1 2 sin
2 2
x
x
c t or
x
x
[3-52]
For positive wave speeds, c, it is not possible to satisfy this inequality for arbitrary values of ∆x
and ∆t. Thus, we conclude that this equation is unstable , and we need to find other approaches.
An alternative approach, first suggested by Lax, replaces the term
n ui in the time-derivate, finite-
n i
n ui (^) u . We thus
write,
(^111)
O x x
u u
x
u O t x and t
u u u
t
u
n i
n i
n
i
n i
n n i n i
i
[3-53]
In this case, the time derivative has an error term that is O[(∆x) 2 ] from the averaging process.
Substituting these finite difference expressions into the differential equation, [3-46] gives.
2 1 1
(^1 ) u u O t x x
u u c t u
n i
n i
n i
n n i i
(^) [3-54]
Ignoring the truncation error, we then have the following finite-difference expression for this
method.
n i
n i
n i u x
c t u x
c t u (^) 1 1
1
2
[3-55]
Applying the von Neumann stability analysis to this equation gives the following result for the first
step of substituting the error in equation [3-31] into the finite-difference expression. [3-55].
( 1 ) ( 0 ) 1 [ 0 ( 1 )] [ 0 ( 1 )] 1 1 2
n^1 ant i x k x ant i x k x i
a n t im x kx m m e e x
c t e e x
c t e e u
[3-56]
Appendix
Truncation Error in the Numerical Solutions of the Conduction Equation
To analyze the truncation error for the conduction equation, we start by writing the truncation
error as an infinite series. To derive this result we start with equation [2-28], which we used in the
derivation of the finite-difference expression for the second-order derivative.
4 ''''
2 '' 1 ^ 1
h f
h f (^) i fi fi fi i [2-28]
We can rewrite this equation for the temperature on the usual two-dimensional grid to obtain a
finite-difference equation for the second derivative in the conduction equation. We will write all
the terms in the infinite series for the truncation error.
2
2
2
2 2
2
2
1 1 k
x
x
x T
x
n k
k i
k
n k
i
n i
n i
n i
[3A-1]
Solving for the second derivative gives the usual second-order finite-difference equation with the
truncation error expressed as an infinite series.
2 2
2
2
2
2
1 1 2
2
k
x
x
x
x
k
k
n
i
k
n k i
n i
n i
n
i
[3A-2]
Similarly, we can start with the equation used to derive the first order forward difference
derivative.
3 '''
2 ' '' 1
h f
h f (^) i fi fih fi i [2-15]
Next, we rewrite this equation for temperature as a series expansion in time, holding the spatial
coordinate constant.
2
1
k
t
t
t t
n k
k i
k
n k
i
n i
n i
[3A-3]
We can solve this equation for the first derivative.
1
2
1
k
t
t
t
t
n k
k i
k
n k i
n i
n
i
^
[3A-4]
We can substitute equation [3A-2] and [3A-4] into the conduction equation to get the overall
truncation error for replacing the differential equation by a finite-difference equation.
2 2
2
2
1 2
2
2
1 1
1
2
2
k
x
x
k
t
t
x
t
x
t
k
k
n
i
k
n k k
k i
k
k
n i
n i
n i
n i
n i
n
i
n
i
[3A-5]
In equation [3A-5], the top row is the differential equation and the finite difference representation.
The terms in the second row (except for the “=0”) are the truncation. We can write this truncation
error, denoted by the symbol, TE, at the given (i,n) grid point.
2 2
2
2
1 2
2 k
x
x
k
t
t
k
k
n
i
k
n k k
k i
k
k n i
^
(^) [3A-6]
By using the conduction equation and the independence of the order of differentiation in mixed
partial derivatives, we can derive the following result for higher order derivatives of temperature.
4
4 2 2
2
2
2
2
2
2
2
2
2
x
x
t x
x x
t t
t t
This leads to the following general result, which can be proved by induction.
k
k k k
k
x
t
2
2
We can use this result to simplify equation [3A-6] for the truncation error.
2
2
(^12)
2
2 2
2
2
2 2 1 2
k
n
i
k
k k k
k
n
i
k
k k k k n i x
x k k
t
k
x x
k
t
k
x TE
This equation shows that the final truncation error involves a relationship between the steps in
space and time and the infinite series for the truncation error contains the same (^2) ( x )
t f
term
that appears in the finite-difference equation. We can write equation [3A-9] in terms of this ratio.
2
2
1 2 2 2
( 2 )!!
k
n
i
k
k k n k i x
k
f
k
This equation hides the dependence of the truncation error on the time step in the f term. We
could have done the second step in equation above analysis to obtain a result that uses only the
time step and the f term. That would have given the following equation for the truncation error.
2
2
2
1 !
k
n
i
k
k
k
k n i x
k
k
k f
t