Information Technology Reference
In-Depth Information
We have in previous parts of the chapter seen that the ratio t=x 2 appears fre-
quently, so we use our ˛ parameter to represent this ratio. The equation above then
reads
˛ u i1
C .1 C 2˛/ u i
˛ u iC1
D u `1
i
C t f `
i
:
(7.119)
Let us write down what (7.119) implies in the case we have five grid points
(n D 4)onŒ0; 1 and f D 0:
˛ u 0
C .1 C 2˛/ u 1
˛ u 2
D u `1
1
;
˛ u 1
C .1 C 2˛/ u 2
˛ u 3
D u `1
2
;
˛ u 2
C .1 C 2˛/ u 3
˛ u 4
D u `1
3
:
We can assume Dirichlet boundary conditions, say, u 0
D u 4
D 0 for simplicity.
Then we have
.1 C 2˛/ u 1
˛ u 2
D u `1
1
;
(7.120)
˛ u 1
C .1 C 2˛/ u 2
˛ u 3
D u `1
2
;
(7.121)
˛ u 2
C .1 C 2˛/ u 3
D u `1
3
:
(7.122)
This is nothing but a linear system of three equations for u 1
, u 2
,and u 3
. We can
write this system in matrix form,
A u D b ;
where
0
1
1 C ˛ 0
˛1 C ˛
0 ˛1 C
@
A ;
A D
0
1
0
1
u `1
1
u `1
2
u `1
3
u 1
u 2
u 3
@
A ;
@
A :
b D
u D
To find the new u i
values we need to solve such a 3 3 system of linear equations,
which can be done by Gaussian elimination, hopefully known from a linear algebra
course.
As an alternative to forming a linear system where only the u i
values at the inner
grid are unknowns in the system, we can include the boundary points as well. That
is, we treat u i
, i D 0; 1; 2; 3; 4, as unknowns and add the boundary conditions as
equations:
u 0
D 0;
˛ u 0 C .1 C 2˛/ u 1 ˛ u 2 D u `1
;
1
˛ u 1
C .1 C 2˛/ u 2
˛ u 3
D u `1
2
;
˛ u 2
C .1 C 2˛/ u 3
˛ u 4
D u `1
3
;
u 4
D 0:
Search WWH ::




Custom Search