- #1
marrvo
- 1
- 0
For $\Omega = (0,1)^2 \subseteq \mathbb R^2, f \in C(\Omega)$ consider the boundary value problem:
$-\Delta u(x,y) + u(x,y) = f(x,y)~ \forall (x,y) \in \Omega \\u(0,y) = u(1,y)~ \forall y \in (0,1) \\ u(x,0) = u(x,1)~ \forall x \in (0,1)$
For discretization let be: $n \in \mathbb N,~ h= \frac{1}{n}, ~ x_i =(i-1) \cdot h, ~ y_j = (j-1) \cdot h, ~ i,j = 1, \ldots, n+1.$
I want to find the linear equation system for the discretized solution: $u_{i,j} = u(x_i,y_j), ~i,j= 1, \ldots, n$.
So I need to find $Au = b$, where $b$ is given by $f_{i,j} = f(x_i,y_j)$ and $u =(u_{1,1}, \ldots, u_{1,n}, u_{2,1}, \ldots, u_{2,n}, \ldots, \ldots, u_{n,1}, \ldots, u_{n,n})$.
I found out that
$\begin{align}
\Delta u_{i,j}=\frac{1}{h^2} [u_{i-1,j}+u_{i+1,j}-4u_{ij}
+u_{i,j-1}+u_{i,j+1}]
\end{align}$,
but now I'm struggeling how to put that in an equation system. The i-th row of A must look like $1/h^2 [0, \ldots, 0, -1, 0, \ldots, 0,-1,4,-1,0, \ldots,0, -1,0, \ldots, 0] + [0, \ldots, 0, 1, 0, \ldots, 0]$, but I don't know how to incorporate the boundary conditions. Can anybody show me what the matrix A looks like with them?
Thanks in advance!
$-\Delta u(x,y) + u(x,y) = f(x,y)~ \forall (x,y) \in \Omega \\u(0,y) = u(1,y)~ \forall y \in (0,1) \\ u(x,0) = u(x,1)~ \forall x \in (0,1)$
For discretization let be: $n \in \mathbb N,~ h= \frac{1}{n}, ~ x_i =(i-1) \cdot h, ~ y_j = (j-1) \cdot h, ~ i,j = 1, \ldots, n+1.$
I want to find the linear equation system for the discretized solution: $u_{i,j} = u(x_i,y_j), ~i,j= 1, \ldots, n$.
So I need to find $Au = b$, where $b$ is given by $f_{i,j} = f(x_i,y_j)$ and $u =(u_{1,1}, \ldots, u_{1,n}, u_{2,1}, \ldots, u_{2,n}, \ldots, \ldots, u_{n,1}, \ldots, u_{n,n})$.
I found out that
$\begin{align}
\Delta u_{i,j}=\frac{1}{h^2} [u_{i-1,j}+u_{i+1,j}-4u_{ij}
+u_{i,j-1}+u_{i,j+1}]
\end{align}$,
but now I'm struggeling how to put that in an equation system. The i-th row of A must look like $1/h^2 [0, \ldots, 0, -1, 0, \ldots, 0,-1,4,-1,0, \ldots,0, -1,0, \ldots, 0] + [0, \ldots, 0, 1, 0, \ldots, 0]$, but I don't know how to incorporate the boundary conditions. Can anybody show me what the matrix A looks like with them?
Thanks in advance!