1. (Double Sweep Method) Generalise the Double Sweep method from one that supports Dirichlet boundary conditions to...
Question:
1. (Double Sweep Method)
Generalise the Double Sweep method from one that supports Dirichlet boundary conditions to one that supports Robin boundary conditions:
⎧⎪⎪⎨⎪⎪⎩
ajUj−1 + bjUj + cjUj+1 = fj, 1≤ j ≤ J − 1 U0 = ????U1 + ????
UJ−1 = ????UJ + ????
where ????, ????, ???? and ???? are given constants. You should get equations similar to those in Section 13.2.1.
Test the new algorithm by discretising the two-point boundary value problem:
⎧⎪⎪⎨⎪⎪⎩
d2u dx2 = f (x), 0 < x < 1 u(0) = ????
du(1)
dx
+ ????u(1) = ????
using the following finite difference scheme:
⎧⎪⎪⎨⎪⎪⎩
Uj+1 − 2Uj + Uj−1 = h2fj, 1≤ j ≤ J − 1 U0 = ????
UJ − UJ−1 h
+ ????
2
(UJ + UJ−1) = ????.
We note that the averaged approximation at the boundary x = 1 is second-order accurate
(see Morton and Mayers, 1994).
Answer the following questions:
a) Modify the Double Sweep algorithm so that it can be applied to problems with Robin boundary conditions.
b) Test the new code on the above two-point boundary value problem. Assemble the system of equations and determine the conditions under which the tridiagonal matrix is diagonally dominant, hence ensuring that the system has a unique solution. When is the matrix an M-matrix?
c) Solve the two-point boundary value problem using the Thomas algorithm and compare the efficiency and accuracy with the results in part b).
d) Consider the first-order approximation at x = 1:
UJ − UJ−1 h
+ ????UJ = ????.
Integrate this option into the code that implements Double Sweep. Test the code on the above two-point boundary value problem. Does first-order accuracy or the boundary affect accuracy elsewhere?
Step by Step Answer: