# Finite elements/Finite element basis functions

## Finite Element Basis Functions

The Finite Element Method provides a general and systematic technique for constructing basis functions for Galerkin's approximation of boundary value problems.

The idea of finite elements is to choose ${\displaystyle N_{i}}$ piecewise over subregions of the domain called finite elements. Such functions can be very simple, for example, polynomials of low degree. We measure the size of each subregion with a parameter ${\displaystyle h}$. As ${\displaystyle h}$ decreases more elements are introduced and more basis functions are needed. The square integrability condition implies that jumps in the value of the function are not allowed at the nodes.

The simplest basis functions are piecewise linear functions and the corresponding elements are line segments in 1D, triangles and quadrilaterals in 2D, and tetrahedra, prisms and hexahedra in 3D.

These basis functions have to be chosen from the space ${\displaystyle {\mathcal {H}}_{0}^{n}}$. Let ${\displaystyle \Omega _{n}}$ be the space of piecewise linear functions. It can be shown that ${\displaystyle \Omega _{n}\subset {\mathcal {H}}_{0}^{n}}$.

Let

${\displaystyle 0=x_{0}

be a partition of ${\displaystyle [0,1]}$ into subintervals ${\displaystyle I_{j}=x_{j},x_{j+1}}$ of length

${\displaystyle \Delta x_{j}=x_{j+1}-x_{j},\qquad j=1,2,\dots ,N+1}$

Let ${\displaystyle h=\max(h_{j})}$ be a measure of overall fineness of the grid. Let us choose as basis functions the set of triangular functions shown in Figure 1.

 Figure 1. Finite element basis functions.

In algebraic form, these basis functions are defined as

${\displaystyle {\text{(25)}}\qquad {N_{j}(x)={\begin{cases}{\cfrac {x-x_{j-1}}{x_{j}-x_{j-1}}},&x_{j-1}\leq x\leq x_{j}\\{\cfrac {x_{j+1}-x}{x_{j+1}-x_{j}}},&x_{j}\leq x\leq x_{j+1}\\0&{\text{otherwise}}\end{cases}}}}$

Note that the shape functions also satisfy the following,

${\displaystyle {N_{i}(x_{j})=\delta _{ij}={\begin{cases}1,&{\text{at nodes }}i=j.\\0,&{\text{at nodes }}i\neq j.\end{cases}}}}$

The first derivatives of the basis functions are

${\displaystyle {\text{(26)}}\qquad {{\frac {dN_{j}(x)}{dx}}={\begin{cases}{\cfrac {1}{x_{j}-x_{j-1}}},&x_{j-1}\leq x\leq x_{j}\\-{\cfrac {1}{x_{j+1}-x_{j}}},&x_{j}\leq x\leq x_{j+1}\\0&{\text{otherwise}}\end{cases}}}}$

So there are discontinuities in the first derivatives at ${\displaystyle x=x_{j}}$ as you can see in Figure 2.

 Figure 2. Derivatives of finite element basis functions.

The Galerkin trial solution is

${\displaystyle u_{h}=N_{0}+\sum _{i=1}^{n}a_{i}N_{i}}$

where ${\displaystyle n}$ is the number of nodes in an element. If we have two nodes per element as shown in Figure 2, then within each element we have

${\displaystyle {u_{h}^{e}=a_{1}N_{1}^{e}+a_{2}N_{2}^{e}~.}}$

The basis functions ${\displaystyle N_{i}^{e}}$ are the element (or local) basis functions and are to be distinguished from the global basis functions centered around nodes.

If you look at the element that joins node ${\displaystyle x_{j}}$ to node ${\displaystyle x_{j+1}}$ you will see that there are two functions ${\displaystyle N_{j}}$ and ${\displaystyle N_{j+1}}$ that describe this element. The local basis functions for the element are therefore

${\displaystyle N_{1}^{e}={\frac {x_{j+1}-x}{x_{j+1}-x_{j}}}\qquad {\text{and}}\qquad N_{2}^{e}={\frac {x-x_{j}}{x_{j+1}-x_{j}}}~.}$

Hence we can write

${\displaystyle u_{h}^{e}=a_{1}\left({\frac {x_{j+1}-x}{x_{j+1}-x_{j}}}\right)+a_{2}\left({\frac {x-x_{j}}{x_{j+1}-x_{j}}}\right)}$

If we force the solution ${\displaystyle u_{h}^{e}}$ to be equal to ${\displaystyle u_{j}}$ at ${\displaystyle x=x_{j}}$ and ${\displaystyle u_{j+1}}$ at ${\displaystyle x=x_{j+1}}$, we get ${\displaystyle a_{1}=u_{j}}$ and ${\displaystyle a_{2}=u_{j+1}}$.

Therefore, the solution is approximated by the piecewise linear function,

${\displaystyle {u_{h}^{e}=u_{j}\left({\frac {x_{j+1}-x}{x_{j+1}-x_{j}}}\right)+u_{j+1}\left({\frac {x-x_{j}}{x_{j+1}-x_{j}}}\right)}}$

We could also write

${\displaystyle u_{h}^{e}=(1-t)~u_{j}+t~u_{j+1}\qquad {\text{where}}~t=\left({\frac {x-x_{j}}{x_{j+1}-x_{j}}}\right)~.}$

This a parametric representation of a line and shows very clearly that ${\displaystyle u_{h}^{e}}$ is a linear approximation. Figure 3 shows a schematic of a FE solution using linear shape functions.

 Figure 3. Schematic of a finite element solution computed using linear shape functions.