Numerical Analysis Home

## Elliptic PDE: Laplace Equation

The steady-state heat distribution on a rectangular plate $$R=[0,a]\times [0,b]$$ is modeled by Laplace equation: \begin{align*} &\frac{\partial^2 u}{\partial x^2}(x,y)+\frac{\partial^2 u}{\partial y^2}(x,y)=0,\; 0 < x < a,\; 0 < y < b,\\ &u(x,y)=g(x,y) \text{ on the boundary of } R. \end{align*} First we make a grid on $$R=[0,a]\times [0,b]$$ with step size $$h$$ and $$k$$: \begin{align*} &x_i=ih,\; i=0,1,\ldots,m.\;\; (m=a/h)\\ &y_j=jk,\; j=0,1,\ldots,n.\;\; (n=b/k) \end{align*}

Now we approximate $$u(x_i,y_j)$$ by $$u_{i,j}$$ using the Difference Method:
By the CDF in variable $$x$$, we get $\frac{\partial^2 u}{\partial x^2}(x_i,y_j)=\frac{u(x_i+h,y_j)-2u(x_i,y_j)+u(x_i-h,y_j)}{h^2}-O(h^2) \approx \frac{u_{i+1,j}-2u_{i,j}+u_{i-1,j}}{h^2}.$ Similarly for variable $$y$$, we get $\frac{\partial^2 u}{\partial y^2}(x_i,y_j)=\frac{u(x_i,y_j+k)-2u(x_i,y_j)+u(x_i,y_j-k)}{k^2}-O(k^2) \approx \frac{u_{i,j+1}-2u_{i,j}+u_{i,j-1}}{k^2}.$ Plugging these $$u_{xx}(x_i,y_j)$$ and $$u_{yy}(x_i,y_j)$$ into Laplace equation, we get \begin{align*} &\frac{u_{i+1,j}-2u_{i,j}+u_{i-1,j}}{h^2}+\frac{u_{i,j+1}-2u_{i,j}+u_{i,j-1}}{k^2}=0\\ \implies & u_{i+1,j}-2u_{i,j}+u_{i-1,j}+\frac{h^2}{k^2}\left(u_{i,j+1}-2u_{i,j}+u_{i,j-1}\right)=0\\ \implies & -2\left[1+\left(\frac{h}{k}\right)^2 \right]u_{i,j}+u_{i+1,j}+u_{i-1,j}+\left(\frac{h}{k}\right)^2[u_{i,j+1}+u_{i,j-1}]=0\\ \implies & \boxed{2\left[1+\left(\frac{h}{k}\right)^2 \right]u_{i,j}-u_{i+1,j}-u_{i-1,j}-\left(\frac{h}{k}\right)^2[u_{i,j+1}+u_{i,j-1}]=0,\;i=1,\ldots,m-1,\;j=1,\ldots,n-1.} \end{align*} By the initial condition $$u(x,y)=g(x,y)$$, we have $u_{i,0}=u(x_i,0),u_{i,n}=u(x_i,b),\;i=0,1,\ldots,m,$ $u_{0,j}=u(0,y_j),u_{m,j}=u(a,y_j),\;j=0,1,\ldots,n.$ Using $$u_{i,0},u_{i,n},u_{0,j},u_{m,j}$$, we can find $$u_{i,j}$$ from $$(m-1)\times(n-1)$$ equations in $$(m-1)\times(n-1)$$ variables corresponding to $$(m-1)\times(n-1)$$ inner mesh points. We simplify the equations by introducing variables $$w_k=u(i,j)$$ for $$k=i+(n-1-j)(m-1)$$ where $$i=1,2,\ldots,m-1$$ and $$j=1,2,\ldots,n-1$$.

Example. Use $$h=k=1$$ to approximate the steady-state heat distribution on a thin rectangular $$4$$ m by $$3$$ m plate modeled by the following PDE: \begin{align*} &\frac{\partial^2 u}{\partial x^2}+\frac{\partial^2 u}{\partial y^2}=0,\; 0 < x < 4,\; 0< y < 3,\\ &u(x,0)=0,\; u(x,3)=1.5x,\; 0\leq x\leq 4, \text{ and } u(0,y)=0,\; u(4,y)=2y,\; 0\leq y\leq 3. \end{align*} Compare the results with the actual solution $$u(x,y)=xy/2$$.
Solution. $$h=k=1\implies (h/k)^2=1$$, $$m=a/h=4$$, and $$n=b/k=3$$. $x_0=0,x_1=1,x_2=2,x_3=3,x_4=4$ $y_0=0,y_1=1,y_2=2,y_3=3$

Suppose $$u_{i,j}\approx u(x_i,y_j)$$ for all $$i,j$$. By the boundary conditions, $u_{0,0}=u_{1,0}=u_{2,0}=u_{3,0}=u_{4,0}=u_{0,1}=u_{0,2}=u_{0,3}=0.$ $u_{1,3}=1.5,u_{2,3}=3,u_{3,3}=4.5,u_{4,3}=6,u_{4,1}=2,u_{4,2}=4.$ By the Difference Method, \begin{align*} & 2\left[1+\left(\frac{h}{k}\right)^2 \right]u_{i,j}-u_{i+1,j}-u_{i-1,j}-\left(\frac{h}{k}\right)^2[u_{i,j+1}+u_{i,j-1}]=0\\ \implies & 4u_{i,j}-u_{i+1,j}-u_{i-1,j}-u_{i,j+1}-u_{i,j-1}=0,\;i=1,2,3,\;j=1,2. \end{align*} Suppose $$w_1=u_{1,2},w_2=u_{2,2},w_3=u_{3,2},w_4=u_{1,1}, w_5=u_{2,1},w_6=u_{3,1}.$$ \begin{aligned} &\text{At } (x_1,y_2): 4u_{1,2}-u_{2,2}-u_{0,2}-u_{1,3}-u_{1,1}=0 &&\implies 4w_1-w_2-w_4=1.5\\ &\text{At } (x_2,y_2): 4u_{2,2}-u_{3,2}-u_{1,2}-u_{2,3}-u_{2,1}=0 &&\implies -w_1+4w_2-w_3-w_5=3\\ &\text{At } (x_3,y_2): 4u_{3,2}-u_{4,2}-u_{2,2}-u_{3,3}-u_{3,1}=0 &&\implies -w_2+4w_3-w_6=8.5\\ &\text{At } (x_1,y_1): 4u_{1,1}-u_{2,1}-u_{0,1}-u_{1,2}-u_{1,0}=0 &&\implies -w_1+4w_4-w_5=0\\ &\text{At } (x_2,y_1): 4u_{2,1}-u_{3,1}-u_{1,1}-u_{2,2}-u_{2,0}=0 &&\implies -w_2-w_4+4w_5-w_6=0\\ &\text{At } (x_3,y_1): 4u_{3,1}-u_{4,1}-u_{2,1}-u_{3,2}-u_{3,0}=0 &&\implies -w_3-w_5+4w_6=2. \end{aligned} In matrix form, \begin{align*} A\overrightarrow{w}=\overrightarrow{b}, \text{ i.e., } & \left[ \begin{array}{rrrrrr} 4 &-1 &0 &-1 &0 &0\\ -1 &4 &-1 &0 &-1 &0\\ 0 &-1 &4 &0 &0 &-1\\ -1 &0 &0 &4 &-1 &0\\ 0 &-1 &0 &-1 &4 &-1\\ 0 &0 &-1 &0 &-1 &4 \end{array} \right] \left[ \begin{array}{l} w_1\\w_2\\w_3\\w_4\\w_5\\w_6\end{array} \right] =\left[ \begin{array}{l} 1.5\\3\\8.5\\0\\0\\2\end{array} \right]. \end{align*} Solving we get, $$\overrightarrow{w}=[1,2,3,0.5,1,1.5]^T$$. $\begin{array}{|c|c|l|l|} \hline (x_i,y_j) & k & w_k & u(x_i,y_j)=x_iy_j/2 \\ \hline (1,2) & 1 & 1 &1\\ \hline (2,2) & 2 & 2 &2\\ \hline (3,2) & 3 & 3 &3\\ \hline (1,1) & 4 & 0.5 &0.5\\ \hline (2,1) & 5 & 1 &1\\ \hline (3,1) & 6 & 1.5 &1.5\\ \hline \end{array}$

Last edited