Iterative Methods for Solving a PDE

linear algebranumerical linear algebrapartial differential equations

Given the following PDE: $-\Delta u + u = 1$ in the domain $[0,1]^2$ and $u = 0$ as the boundary condition, I want to solve for the solution via an iterative method (Gauss-Seidel / Jacobi, for example).

If I let $h = 1/(n+1)$ the unknowns in the following equation are $x_{i,j}$ for $\space 1, …, n$ that satisfy:
$$(4+h^2)x_{i,j} – x_{i-1,j} – x_{i,j-1} – x_{i+1,j} – x_{i,j+1} = h^2$$ for $i,j = 1, … , n$

and
$$x_{0,j} = x_{n+1,j} = x_{i,0} = x_{i,n+1} = 0, \quad \text{for} \quad i,j = 1, …, n$$

Question:

I believe the unknowns $x$ are a $n \times n$ matrix, which would make $A$ in $Ax = b$ a 4th order tensor, but does $A$ need to be constructed in order to implement an iterative method? If not why? If so, how would $A$ look? Thanks!

Best Answer

This is a partial answer to address what $A$ can look like. I don't know iterative methods. Suppose we arrange the $x_{ij}$ into a column vector with $x_{11},\ldots,x_{1n}$ as the first $n$ entries, followed by $x_{21},\ldots,x_{2n}$ and so forth down to $x_{nn}$. Then most rows of $A$ have $d = 4+h^2$ on the diagonal with a $-1$ to each side, and two more $-1$'s located $n$ places to left and right, as below. But this has to be modified for points $(i,j)$ adjacent to the boundary. The $4\times 4$ case is representative: $$ \begin{smallmatrix} d &-1 & 0 & 0 &-1 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \cr -1 & d &-1 & 0 & 0 &-1 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \cr 0 &-1 & d &-1 & 0 & 0 &-1 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \cr 0 & 0 &-1 & d & 0 & 0 & 0 &-1 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \cr -1 & 0 & 0 & 0 & d &-1 & 0 & 0 &-1 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \cr 0 &-1 & 0 & 0 &-1 & d &-1 & 0 & 0 &-1 & 0 & 0 & 0 & 0 & 0 & 0 \cr 0 & 0 &-1 & 0 & 0 &-1 & d &-1 & 0 & 0 &-1 & 0 & 0 & 0 & 0 & 0 \cr 0 & 0 & 0 &-1 & 0 & 0 &-1 & d & 0 & 0 & 0 &-1 & 0 & 0 & 0 & 0 \cr 0 & 0 & 0 & 0 &-1 & 0 & 0 & 0 & d &-1 & 0 & 0 &-1 & 0 & 0 & 0 \cr 0 & 0 & 0 & 0 & 0 &-1 & 0 & 0 &-1 & d &-1 & 0 & 0 &-1 & 0 & 0 \cr 0 & 0 & 0 & 0 & 0 & 0 &-1 & 0 & 0 &-1 & d &-1 & 0 & 0 &-1 & 0 \cr 0 & 0 & 0 & 0 & 0 & 0 & 0 &-1 & 0 & 0 &-1 & d & 0 & 0 & 0 &-1 \cr 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 &-1 & 0 & 0 & 0 & d &-1 & 0 & 0 \cr 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 &-1 & 0 & 0 &-1 & d &-1 & 0 \cr 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 &-1 & 0 & 0 &-1 & d &-1 \cr 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 &-1 & 0 & 0 &-1 & d \end{smallmatrix} $$ Here in rows 4,5,8,9,12,13, or more generally in matrix rows $kn,(k+1)n$, you omit one $-1$ because you are at the end of a row of nodes adjacent to a zero boundary value. Also in the first $n$ and last $n$ matrix rows you omit one or two $-1$'s because you are on the first and last row of nodes that have zero boundary values adjacent.

That $4\times 4$ can be expressed as $$ A = I\otimes\begin{bmatrix}d & -1 & 0 & 0 \cr -1 & d & -1 & 0 \cr 0 & -1 & d & -1 \cr 0 & 0 & -1 & d\end{bmatrix} +\begin{bmatrix}0 & 1 & 0 & 0 \cr 1 & 0 & 1 & 0 \cr 0 & 1 & 0 & 1 \cr 0 & 0 & 1 & 0 \end{bmatrix}\otimes I. $$