Thomas
Thomas
We explain how systems resulting from implicit schemes with three space points (i−1), i, (i+1)
can be solved. We can write them in the form :
ai ui−1 + bi ui + ci ui+1 = fi ∀ i = 1, · · · , Nx − 1
With boundary conditions: ui=0 = B0 and ui=Nx = BNx What results is the following matrix
system :
1 0 0 . . . . u0 B0
a1 b1 c1 0 . . . u1 f1
0 a2 b2 c2 0 . . . .
. . . . . . . . = .
. . . . . . 0 . .
. . . 0 aNx −1 bNx −1 cNx −1 uNx −1 fNx −1
. . . . 0 0 1 uNx BNx
The boundary conditions can be gathered in the second member as:
b1 c1 0 . . . u1 f1 − a1 B0 F1
a2 b2 c2 0 . . u2 f2 F2
0 . . . . . . . .
= =
. . . . . 0 . . .
. . . . . cNx −2 uNx −2 fNx −2 FNx −2
. . . 0 aNx −1 bNx −1 uNx −1 fNx −1 − cNx −1 BNx FNx −1
The matrix obtained possesses three diagonals, the system is then solved by the Thomas
Algorithm. It is done in two distinct steps. The first consists of ”removing” the coefficients ai s
through a forward sweep. The new system with the coefficient matrix having two diagonals now
looks like: 0
b1 c01 0 . . . u1 F10
0 b0 c0 0 . . u2 F 0
2 2 2
0 . . . . . . .
=
. . . . . 0 . .
0 0
0
. . . 0 bNx −2 cNx −2 uNx −2 FNx −2
. . . 0 0 b0Nx −1 uNx −1 FN0 x −1
And we have a new algebraic system defined by :
b0i ui + c0i ui+1 = Fi0 ∀ i = 1, · · · , Nx − 2
and
b0Nx −1 uNx −1 = F 0 Nx −1 for i = Nx − 1
with the new coefficients :
b01 = b1 , F10 = F1
c0i = ci ∀ i = 1, · · · , Nx − 1
ai
b0i = bi − c0i−1 0 ∀i = 2 · · · Nx − 1
bi−1
ai
Fi0 = Fi − Fi−1
0
∀i = 2 · · · Nx − 1
b0i−1
The second step consists of backward sweep of the new matrix in order to calculate the solution
: We obtain initially
F 0 N −1
uNx −1 = 0 x
bNx −1
then, we calculate the solution as
Fi0 − c0i ui+1
ui = ∀ i = Nx − 2, · · · , 1
b0