# Introduction to finite elements/Solution of Poisson equation

## Construction of Approximate Solutions

If we know that the problem is well-posed but does not have a closed form solution, we can go ahead and try to get an approximate solution. The finite element method is one way of getting at approximate solutions (among many other numerical methods).

The finite element method starts off with the variational form (or the weak form) of the BVP. The method is a special case of a class of methods called Galerkin methods.

## Finite element solution for the Poisson equation

Recall the variational boundary value problem for the Poisson equation:

{\displaystyle {\begin{aligned}&{\mathsf {Variational~BVP~for~Poisson's~Equation}}\\&\\&{\text{Find a function}}~T~{\text{in}}~{\mathcal {X}}~{\text{that satisfies}}\\&\\&\int _{\Omega }{\boldsymbol {\nabla }}T\bullet {\boldsymbol {\nabla }}v~dV=\int _{\Omega }f~v~dV\quad {\text{for all}}~v\in {\mathcal {X}}&\\&{\mathcal {X}}=\{{\text{Continuously differentiable functions on}}~{\bar {\Omega }}~{\text{that vanish on}}~\Gamma _{T}\}\end{aligned}}}


The space ${\displaystyle {\mathcal {X}}}$ is continuous and an infinite number of functions could be chosen from this space of functions. In the finite element method, we choose a trial function from the space of approximate solutions ${\displaystyle {\mathcal {X}}_{h}}$ where ${\displaystyle {\mathcal {X}}_{h}\subset {\mathcal {X}}}$. A defining feature of these approximate trial solutions is that they are associated with a mesh or discretization of the domain ${\displaystyle \Omega }$. These functions also have the feature that they are finite dimensional with each dimension being associated with a node on the mesh.

Assume that we are given ${\displaystyle {\mathcal {X}}_{h}}$. Let us choose a weighting function ${\displaystyle v_{h}\in {\mathcal {X}}_{h}}$ that satisfies ${\displaystyle v_{h}=0}$ on ${\displaystyle \Gamma _{T}}$. We can choose another function ${\displaystyle T_{h}\in {\mathcal {X}}_{h}}$ as our trial solution. Since the boundary condition on ${\displaystyle \Gamma _{T}}$ is ${\displaystyle T=0}$, both ${\displaystyle v_{h}}$ and ${\displaystyle T_{h}}$ can have the same form. In the next section, we will look at the general form of the heat equation where ${\displaystyle T\neq 0}$ on the boundary.

In finite element methods we choose trial solutions ${\displaystyle T_{h}}$ of the form

${\displaystyle T_{h}(\mathbf {x} )=T_{1}N_{1}(\mathbf {x} )+T_{2}N_{2}(\mathbf {x} )+\dots +T_{n}N_{n}(\mathbf {x} )=\sum _{i=1}^{n}T_{i}N_{i}(\mathbf {x} )~.}$

where ${\displaystyle T_{1}}$, ${\displaystyle T_{2}}$, ${\displaystyle \dots }$, ${\displaystyle T_{n}}$ are nodal temperatures which are constant on ${\displaystyle {\bar {\Omega }}}$. The functions ${\displaystyle N_{1},N_{2},\dots ,N_{n}}$ form a basis that spans the subspace ${\displaystyle {\mathcal {X}}_{h}}$ and are known as basis functions or shape functions. Note that ${\displaystyle n}$ is the total number of nodes minus the number of nodes on ${\displaystyle \Gamma _{T}}$ where ${\displaystyle T}$ is specified.

Since the functions ${\displaystyle v_{h}}$ come from the same space of functions, we can represent them as

${\displaystyle v_{h}(\mathbf {x} )=b_{1}N_{1}(\mathbf {x} )+b_{2}N_{2}(\mathbf {x} )+\dots +b_{n}N_{n}(\mathbf {x} )=\sum _{i=1}^{n}b_{i}N_{i}(\mathbf {x} )~.}$

where ${\displaystyle b_{1}}$, ${\displaystyle b_{2}}$, ${\displaystyle \dots }$, ${\displaystyle b_{n}}$ are arbitrary constant on ${\displaystyle {\bar {\Omega }}}$ with the restriction that ${\displaystyle v_{h}=0}$ on ${\displaystyle \Gamma _{T}}$.

If we plug in these finite dimensional forms of ${\displaystyle v}$ and ${\displaystyle T}$ into the variational BVP, we get an approximate form of the variational BVP which can be stated as:

{\displaystyle {\begin{aligned}&{\mathsf {Finite~Element~Variational~BVP~for~Poisson's~Equation}}\\&\\{\text{Find a function}}&~T_{h}~{\text{in}}~{\mathcal {X}}_{h}~{\text{that satisfies}}\\&\\&\int _{\Omega }{\boldsymbol {\nabla }}T_{h}\bullet {\boldsymbol {\nabla }}v_{h}~dV=\int _{\Omega }f~v_{h}~dV\quad {\text{for all}}~v_{h}\in {\mathcal {X}}_{h}~.\end{aligned}}}


After substituting the expressions for ${\displaystyle v_{h}}$ and ${\displaystyle T_{h}}$ in the variational BVP we get

{\displaystyle {\begin{aligned}0&=\int _{\Omega }{\boldsymbol {\nabla }}T_{h}\bullet {\boldsymbol {\nabla }}v_{h}~dV-\int _{\Omega }f~v_{h}~dV\\&=\int _{\Omega }{\boldsymbol {\nabla }}(T_{1}N_{1}+\dots +T_{n}N_{n})\bullet {\boldsymbol {\nabla }}(b_{1}N_{1}+\dots +b_{n}N_{n})~dV-\int _{\Omega }f~(b_{1}N_{1}+\dots +b_{n}N_{n})~dV\\&=\int _{\Omega }(T_{1}{\boldsymbol {\nabla }}N_{1}+\dots +T_{n}{\boldsymbol {\nabla }}N_{n})\bullet (b_{1}{\boldsymbol {\nabla }}N_{1}+\dots +b_{n}{\boldsymbol {\nabla }}N_{n})~dV-\int _{\Omega }f~(b_{1}N_{1}+\dots +b_{n}N_{n})~dV\\&=\sum _{i,j=1}^{n}K_{ij}T_{i}b_{j}-\sum _{j=1}^{n}f_{j}b_{j}\\&=\sum _{j=1}^{n}b_{j}\left[\sum _{i=1}^{n}K_{ij}T_{i}-f_{j}\right]\\\end{aligned}}}

where,

${\displaystyle {K_{ij}=\int _{\Omega }{\boldsymbol {\nabla }}N_{i}\bullet {\boldsymbol {\nabla }}N_{j}~dV~~~~{\text{and}}~~~f_{j}=\int _{\Omega }fN_{j}~dV~.}}$

In matrix form, we have

${\displaystyle {\text{(38)}}\qquad \mathbf {b} ^{T}\left[\mathbf {K} \mathbf {T} -\mathbf {f} \right]=\mathbf {0} }$

where ${\displaystyle \mathbf {b} ^{T}=[b_{1},b_{2},\dots ,b_{n}]}$, ${\displaystyle \mathbf {K} }$ is a ${\displaystyle n\times n}$ symmetric matrix, ${\displaystyle \mathbf {T} =[T_{1},T_{2},\dots ,T_{n}]}$ is a ${\displaystyle n\times 1}$ vector, and ${\displaystyle \mathbf {f} }$ is a ${\displaystyle n\times 1}$ vector.

Since ${\displaystyle \mathbf {b} }$ can be arbitrary, equation (38) can be further simplified to the form

${\displaystyle {\text{(39)}}\qquad {\mathbf {K} \mathbf {T} =\mathbf {f} }}$

This system of equations has a solution since ${\displaystyle \mathbf {K} }$ is positive-definite and therefore has an inverse. Once the ${\displaystyle T_{i}}$s are known, the approximate solution can be found using

${\displaystyle T_{h}(\mathbf {x} )=T_{1}N_{1}(\mathbf {x} )+T_{1}N_{2}(\mathbf {x} )+\dots +T_{n}N_{n}(\mathbf {x} )~.}$

The functions ${\displaystyle N_{1},\dots ,N_{n}}$ have special forms in the finite element method that have the property that the quality of the approximation improves with an increase in the dimension ${\displaystyle n}$ of the basis.