29.07.2013 Views

Numerical modeling of waves for a tsunami early warning system

Numerical modeling of waves for a tsunami early warning system

Numerical modeling of waves for a tsunami early warning system

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Appendix C<br />

Thomas algorithm<br />

A tridiagonal <strong>system</strong> <strong>of</strong> equations is characterzied by a matrix which has<br />

non zero elements only in the central diagonal and in its upper and lower<br />

diagonal, an example <strong>of</strong> such a <strong>system</strong> is as follows<br />

⎡<br />

⎢<br />

⎣<br />

b1 c1 0 ... ... ... 0<br />

a2 b2 c2 0 ... ... 0<br />

0 a3 b3 c3 0 ... 0<br />

... ... ... ... ... ... ...<br />

0 ... ... 0 an−1 bn−1 cn−1<br />

0 ... ... ... 0 an bn<br />

⎤ ⎡<br />

⎥ ⎢<br />

⎥ ⎢<br />

⎥ ⎢<br />

⎥ ⎢<br />

⎥ ⎢<br />

⎥ ⎢<br />

⎥ ⎢<br />

⎥ ⎢<br />

⎦ ⎣<br />

x1<br />

x2<br />

x3<br />

...<br />

xn−1<br />

xn<br />

⎤ ⎡<br />

⎥ ⎢<br />

⎥ ⎢<br />

⎥ ⎢<br />

⎥ ⎢<br />

⎥ = ⎢<br />

⎥ ⎢<br />

⎥ ⎢<br />

⎦ ⎣<br />

d1<br />

d2<br />

d3<br />

...<br />

dn−1<br />

dn<br />

⎤<br />

⎥<br />

⎦<br />

(C.1)<br />

where ai, bi and ci are the elements <strong>of</strong> the lower central and upper<br />

diagonals <strong>of</strong> the matrix respectively; xi are the unknowns and di are the<br />

elements <strong>of</strong> the vector known. The Gaussian elimination is an algorithm<br />

which solves a <strong>system</strong> <strong>of</strong> linear equation finding the rank <strong>of</strong> a matrix and<br />

calculating the inverse <strong>of</strong> an invertible square matrix. The simplified case<br />

<strong>of</strong> tridiagonal <strong>system</strong> can be solved by means <strong>of</strong> the Thomas algorithm.<br />

The solution <strong>of</strong> a <strong>system</strong> <strong>of</strong> n equations in n unknowns is obtained in O (n)<br />

operations by using the Thomas algorithm instead <strong>of</strong> O (n 3 ).<br />

The algorithm first eliminates the ai elements <strong>of</strong> the matrix by modifying<br />

the coefficients as follows, denoting the modified coefficients with primes<br />

and<br />

c ′ ⎧<br />

⎨<br />

i =<br />

⎩<br />

c1<br />

b1<br />

ci<br />

bi−c ′ i−1 ai<br />

; i =1<br />

; i =2, 3, ..., n − 1<br />

121<br />

(C.2)

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!