Information Technology Reference
In-Depth Information
Usingsuchanaveragefor
u
`1=2
i1
,
u
`1=2
i
,and
u
`1=2
iC1
leads to the finite difference
approximation
@
2
u
@x
2
`1=2
u
`1
i1
2
u
`1
i
C
u
`1
iC1
u
i1
2
u
i
C
u
iC1
x
2
1
2
C
1
2
:
x
2
i
Setting the first-derivative in time equal to the second-derivative in space plus the
source term f.x
i
;t
`1=2
/ yields the resulting finite difference scheme:
u
i1
2
u
i
C
u
iC1
u
`1
i1
2
u
`1
i
C
u
`1
iC1
u
i
u
`1
i
D
1
2
C
1
2
C
f
`1=2
i
: (7.134)
t
x
2
x
2
The quantities at time level `
1 are considered known. There are then three coupled
unknown quantities at time level `, just as in the implicit backward Euler scheme.
We reorder the equation so that the unknowns appear on the left-hand side and the
known quantities on the right-hand side:
˛
˛
D
˛
C
˛
C
t f
`1=2
i
2
u
i1
C
.1
C
˛/
u
i
2
u
iC1
2
u
`1
C
.1
˛/
u
`1
i
2
u
`1
:
(7.135)
The new unknown quantities are coupled to each other, as in the previous implicit
scheme. We must therefore compute the new unknowns by solving a linear system.
The coefficient matrix of this system has the same form as in (7.123), but the matrix
entries and right-hand side entries have different formulas:
i1
iC1
A
0;0
D
1;
(7.136)
A
0;1
D
0;
(7.137)
A
n1;n
D
0;
(7.138)
A
n;n
D
1;
(7.139)
A
i;i1
D
˛
2
;
(7.140)
A
i;iC1
D
˛
2
;
(7.141)
A
i;i
D
1
C
˛;
(7.142)
b
0
D
D
0
.t
`
/;
(7.143)
b
n
D
D
1
.t
`
/;
(7.144)
b
i
D
˛
u
`1
C
.1
2˛/
u
`1
i
C
˛
u
`1
iC1
C
t f
`1=2
i
:
(7.145)
i1
In these formulas, the index i runs from 1 to n
1.
Algorithms
7.4
and
7.6
can again be used to solve the problem. Only the formulas
for the matrix and right-hand side entries need to be changed.
Like the backward Euler scheme, the Crank-Nicolson scheme just derived is
unconditionally stable, i.e., the solution does not exhibit large non-physical oscilla-
tions if t exceeds a critical value. But is the Crank-Nicolson scheme more efficient