T(x = 1) =T₁n = 60
(a) Start by discretizing Eq. (1) using the second order central difference method \frac{d^{2} T}{\partial x^{2}} \approx \frac{T_{i+1}-2 T_{i}+T_{i-1}}{\Delta x^{2}} and construct the coefficient matrix and solution vectors. Show these matrices for a domain discretized with M = 8 equidistant elements.
(b) Solve Eq.(1) using a tri diagonal solver coded in Python or MATLAB. A tri-diagonal solver is a simplified Gaussian elemination solver that makes use of the banded nature of the matrix to reduce the amount of storage and computation required. We give you the following pseudo-code to get started:
(I) Store four ID vectors
(II)Elimination
for i = 1 to N do
b(i) = b(i)- c(i-1) *a(i)/b(i-1)
d(i)=d(i)-d(i-1)*a(i)/b(i-1)
end for
III) Back substitution.
d(N) = d(N)/b(N)
for i N-1 to 0 do
d(i) = ((d(i) - c(i)*d(i+1))/b(i))
end for
(c) Plot the numerical solution (i.e. T(x) vs x) for M = 4, 8, 16, 32, and 64 alongside the exact analytical solution to Eq. (1). How does the numerical result change with increasing mesh elements M?
(d) Conduct a performance study on your tri-diagonal solver by solving Eq.(1) with M = 10, 100, 1000, 5000, 10000 elements and plotting mesh size versus time. Briefly discuss your results.
Fig: 1
Fig: 2
Fig: 3
Fig: 4
Fig: 5
Fig: 6
Fig: 7
Fig: 8