**3. The FE for elliptic PDEs**

Here, we apply the FE method for two-dimensional elliptic problem: Find *u* such that

�∇ � ð Þþ *a*∇*u bu* ¼ *f*ð Þ **x** , **x**∈ Ω, *a*∇*u* � **n** ¼ *κ*ð Þ *g* � *u* , on ∂Ω, (30)

where *a*>0, *b*≥ 0, *κ* ≥ 0, *f* ∈*L*<sup>2</sup> ð Þ <sup>Ω</sup> and *<sup>g</sup>* <sup>∈</sup>*C*0ð Þ <sup>∂</sup><sup>Ω</sup> .

#### **3.1 Meshes**

Let <sup>Ω</sup> <sup>⊂</sup> <sup>2</sup> bounded with <sup>∂</sup><sup>Ω</sup> assumed to be polygonal. A triangulation <sup>T</sup> *<sup>h</sup>* of <sup>Ω</sup> is a set of triangles *<sup>T</sup>* such that <sup>Ω</sup> <sup>¼</sup> <sup>⋃</sup>*<sup>T</sup>* <sup>∈</sup><sup>T</sup> *<sup>h</sup> T*, and two triangles intersect by either a common triangle edge, or a corner, or nothing. Corners will be referred to as nodes. We let *hT* ¼ *diam T*ð Þ the length or the largest edge.

Let T *<sup>h</sup>* have *N* nodes and *M* triangles. The data is stored in two matrices. The matrix *P*∈ <sup>2</sup>�*<sup>N</sup>* describes the nodes ( *x*1, *y*<sup>1</sup> � �, … , *xN*, *yN* � �<sup>Þ</sup> and the matrix *<sup>K</sup>* <sup>∈</sup> <sup>3</sup>�*<sup>M</sup>* describes the triangles, *i:e:*, it describes which nodes (numerated from 1 to *N*) form a triangle *T* and how it is orientated:

$$P = \begin{bmatrix} \varkappa\_1 & \varkappa\_2 & \cdots & \varkappa\_N \\ \\ \mathcal{Y}\_1 & \mathcal{Y}\_2 & \cdots & \mathcal{Y}\_N \end{bmatrix}, \quad K = \begin{bmatrix} n\_1^a & n\_2^a & \cdots & n\_M^a \\ n\_1^\beta & n\_2^\beta & \cdots & n\_M^\beta \\ n\_1^\gamma & n\_2^\gamma & \cdots & n\_M^\gamma \end{bmatrix}.$$

This means that triangle *Ti* is formed by the nodes *n<sup>α</sup> <sup>i</sup>* , *<sup>n</sup><sup>β</sup> <sup>i</sup>* , and *<sup>n</sup><sup>γ</sup> <sup>i</sup>* (enumeration in counter-clockwise direction).

The Delaunay algorithm determine a triangulation with the given points as triangle nodes. Delaunay triangulations are optimal in the sense that the angles of all triangles are maximal.

Matlab has a built in toolbox called PDE Toolbox and includes a mesh generation algorithm.

#### **3.2 Piecewise polynomial spaces**

Let *T* be a triangle with nodes *N*<sup>1</sup> ¼ *x*1, *y*<sup>1</sup> � �, *<sup>N</sup>*<sup>2</sup> <sup>¼</sup> *<sup>x</sup>*2, *<sup>y</sup>*<sup>2</sup> � �, and *<sup>N</sup>*<sup>3</sup> <sup>¼</sup> *<sup>x</sup>*3, *<sup>y</sup>*<sup>3</sup> � �. We define

$$P^1(T) = \left\{ \boldsymbol{\upsilon} \in C^0(T) \, | \, \boldsymbol{\upsilon}(\mathbf{x}, \boldsymbol{y}) = \boldsymbol{c}\_1 + \boldsymbol{c}\_2 \mathbf{x} + \boldsymbol{c}\_3 \mathbf{y}, \, \, \boldsymbol{c}\_1, \, \mathbf{c}\_2, \, \mathbf{c}\_3 \in \mathbb{R} \right\}.$$

Now let *vi* <sup>¼</sup> *v N*ð Þ*<sup>i</sup>* for *<sup>i</sup>* <sup>¼</sup> 1, 2, 3. Note that *<sup>v</sup>*<sup>∈</sup> *<sup>P</sup>*<sup>1</sup> ð Þ *T* is determined by f g *vi* 3 *i*¼1. Given *vi* we compute *ci* by

$$
\begin{bmatrix} \mathbf{1} & \mathbf{x\_1} & \mathbf{y\_1} \\\\ \mathbf{1} & \mathbf{x\_2} & \mathbf{y\_2} \\\\ \mathbf{1} & \mathbf{x\_3} & \mathbf{y\_3} \end{bmatrix} \begin{bmatrix} c\_1 \\\\ c\_2 \\\\ c\_3 \end{bmatrix} = \begin{bmatrix} v\_1 \\\\ v\_2 \\\\ v\_3 \end{bmatrix}.
$$

This is solvable due to

$$\begin{aligned} \det\begin{bmatrix} \mathbf{1} & \mathbf{x}\_1 & \mathbf{y}\_1 \\ \mathbf{1} & \mathbf{x}\_2 & \mathbf{y}\_2 \\ \mathbf{1} & \mathbf{x}\_3 & \mathbf{y}\_3 \end{bmatrix} &= 2|T| \neq \mathbf{0}, & \begin{bmatrix} \mathbf{1} & \mathbf{x}\_1 & \mathbf{y}\_1 \\ \mathbf{1} & \mathbf{x}\_2 & \mathbf{y}\_2 \\ \mathbf{1} & \mathbf{x}\_3 & \mathbf{y}\_3 \end{bmatrix}^{-1} \\ &= \frac{1}{2|T|} \begin{bmatrix} \mathbf{x}\_2\mathbf{y}\_3 - \mathbf{x}\_3\mathbf{y}\_2 & \mathbf{x}\_3\mathbf{y}\_1 - \mathbf{x}\_1\mathbf{y}\_3 & \mathbf{x}\_1\mathbf{y}\_2 - \mathbf{x}\_2\mathbf{y}\_1 \\ \mathbf{y}\_2 - \mathbf{y}\_3 & \mathbf{y}\_3 - \mathbf{y}\_1 & \mathbf{y}\_1 - \mathbf{y}\_2 \\ \mathbf{x}\_3 - \mathbf{x}\_2 & \mathbf{x}\_1 - \mathbf{x}\_3 & \mathbf{x}\_3 - \mathbf{x}\_1 \end{bmatrix}, \end{aligned}$$

where <sup>∣</sup>*T*<sup>∣</sup> <sup>¼</sup> <sup>1</sup> *x*2*y*<sup>3</sup> � *x*3*y*<sup>2</sup> � *x*1*y*<sup>3</sup> þ *x*3*y*<sup>1</sup> þ *x*1*y*<sup>2</sup> � *x*2*y*<sup>1</sup> � �, which is � the area of the triangle *T*.

Let *λ <sup>j</sup>* ∈ *P*<sup>1</sup> ð Þ *T* be given by the nodal values *λ <sup>j</sup>*ð Þ¼ *Ni δij*, where *δij* is the Kronecker symbol. This gives us *v x*ð Þ¼ , *y α*1*λ*1ð Þþ *x*, *y α*2*λ*2ð Þþ *x*, *y α*3*λ*3ð Þ *x*, *y* , where *α<sup>i</sup>* ¼ *v N*ð Þ*<sup>i</sup>* for *i* ¼ 1, 2, 3*:* We can compute *λi*ð Þ *x*, *y* as follows: Let *λi*ð Þ¼ *x*, *y ai* þ *bix* þ *ciy*. Using *λ <sup>j</sup>*ð Þ¼ *Ni δij*, we get

$$
\begin{bmatrix} \mathbf{1} & \mathbf{x}\_1 & \mathbf{y}\_1 \\ \mathbf{1} & \mathbf{x}\_2 & \mathbf{y}\_2 \\ \mathbf{1} & \mathbf{x}\_3 & \mathbf{y}\_3 \end{bmatrix} \begin{bmatrix} a\_1 \\ b\_1 \\ c\_1 \end{bmatrix} = \begin{bmatrix} \mathbf{1} \\ \mathbf{0} \\ \mathbf{0} \end{bmatrix}, \quad \begin{bmatrix} \mathbf{1} & \mathbf{x}\_1 & \mathbf{y}\_1 \\ \mathbf{1} & \mathbf{x}\_2 & \mathbf{y}\_2 \\ \mathbf{1} & \mathbf{x}\_3 & \mathbf{y}\_3 \end{bmatrix} \begin{bmatrix} a\_2 \\ b\_2 \\ c\_2 \end{bmatrix} = \begin{bmatrix} \mathbf{0} \\ \mathbf{1} \\ \mathbf{0} \end{bmatrix}, \quad \begin{bmatrix} \mathbf{1} & \mathbf{x}\_1 & \mathbf{y}\_1 \\ \mathbf{1} & \mathbf{x}\_2 & \mathbf{y}\_2 \\ \mathbf{1} & \mathbf{x}\_3 & \mathbf{y}\_3 \end{bmatrix} \begin{bmatrix} a\_3 \\ b\_3 \\ c\_3 \end{bmatrix} = \begin{bmatrix} \mathbf{0} \\ \mathbf{0} \\ \mathbf{1} \end{bmatrix}.
$$

Solving the systems, we get

$$
\lambda\_1(\mathbf{x}, \mathbf{y}) = \frac{1}{2|T|} \left( \mathbf{x}\_2 \mathbf{y}\_3 - \mathbf{x}\_3 \mathbf{y}\_2 + (\mathbf{y}\_2 - \mathbf{y}\_3) \mathbf{x} + (\mathbf{x}\_3 - \mathbf{x}\_2) \mathbf{y} \right),
$$

$$
\lambda\_2(\mathbf{x}, \mathbf{y}) = \frac{1}{2|T|} \left( \mathbf{x}\_3 \mathbf{y}\_1 - \mathbf{x}\_1 \mathbf{y}\_3 + (\mathbf{y}\_3 - \mathbf{y}\_1) \mathbf{x} + (\mathbf{x}\_1 - \mathbf{x}\_3) \mathbf{y} \right),
$$

$$
\lambda\_3(\mathbf{x}, \mathbf{y}) = \frac{1}{2|T|} \left( \mathbf{x}\_1 \mathbf{y}\_2 - \mathbf{x}\_2 \mathbf{y}\_1 + (\mathbf{y}\_1 - \mathbf{y}\_2) \mathbf{x} + (\mathbf{x}\_3 - \mathbf{x}\_1) \mathbf{y} \right).
$$

Let T *<sup>h</sup>* be a triangulation of Ω, then we let

$$V\_h = \left\{ \boldsymbol{\upsilon} \in \mathcal{C}(\Omega) \, | \, \, \boldsymbol{\upsilon}|\_T \in P^1(T), \,\, \forall \,\, T \in \mathcal{T}\_h \right\}.$$

Functions in *Vh* are piecewise linear and continuous. We know that *v*∈*Vh* is uniquely determined by *v N*ð Þ*<sup>i</sup>* f g , *i* ¼ 1, 2, … , *N* . We let *ϕ<sup>j</sup>* ð Þ¼ *Ni δij* and let *ϕj* , *j* ¼ 1, 2, … , *N* n o⊂*Vh* be a basis for *Vh* (hat functions), *<sup>i</sup>:e:*,

$$v(\mathbf{x}, \mathbf{y}) = \sum\_{i=1}^{N} a\_i \phi\_i(\mathbf{x}, \mathbf{y}), \quad a\_i = v(N\_i), \quad i = 1, 2, \dots, N.$$

#### **3.3 Interpolation**

Given *u* ∈*C T*ð Þ on a single triangle with nodes *Ni* ¼ *xi*, *yi* � �, *<sup>i</sup>* <sup>¼</sup> 1, 2, 3, we let

$$
\pi \mu(\mathbf{x}, \mathbf{y}) = \sum\_{i=1}^{3} \mu(N\_i) \phi\_i(\mathbf{x}, \mathbf{y}),
$$

in particular *πu N*ð Þ¼*<sup>i</sup> u N*ð Þ*<sup>i</sup>* , *i* ¼ 1, 2, … , *N*. We want to estimate the interpolation error *u* � *πu*. Let

*A Brief Summary of the Finite Element Method for Differential Equations DOI: http://dx.doi.org/10.5772/intechopen.95423*

$$\begin{aligned} \|u\|\_{L^2(\Omega)}^2 &= \int\_{\Omega} |u(\mathbf{x})|^2 d\mathbf{x} d\mathbf{y}, \quad \|Du\|\_{L^2(\Omega)}^2 = \|u\_{\mathbf{x}}\|\_{L^2(\Omega)}^2 + \left\|u\_{\mathbf{y}}\right\|\_{L^2(\Omega)}^2, \\ \|\|\mathbf{D}^2 u\|\_{L^2(\Omega)}^2 &= \|u\_{\mathbf{x}\mathbf{x}}\|\_{L^2(\Omega)}^2 + 2\left\|u\_{\mathbf{xy}}\right\|\_{L^2(\Omega)}^2 + \left\|u\_{\mathbf{y}\mathbf{y}}\right\|\_{L^2(\Omega)}^2. \end{aligned}$$

**Theorem 3.1** *Suppose that u* ∈*C*<sup>2</sup> ð Þ *T* . *Then the following hold*

$$\|\|u - \pi u\|\|\_{L^2(T)} \le C h\_T^2 \|\|D^2 u\|\|\_{L^2(T)}, \quad \|\|D(u - \pi u)\|\|\_{L^2(T)} \le C h\_T \|\|D^2 u\|\|\_{L^2(T)},$$

where *C* is a generic constant independent of *hT* and *u*, but it depends on the ratio between smallest and largest interior angle of the triangle *T*.

Now, we consider the piecewise continuous interpolant *<sup>π</sup><sup>u</sup>* <sup>¼</sup> <sup>P</sup>*<sup>N</sup> <sup>i</sup>*¼1*u N*ð Þ*<sup>i</sup> <sup>ϕ</sup>i*. **Theorem 3.2** *Suppose that u* ∈*C*<sup>2</sup> ð Þ *T for all T* ∈ T *<sup>h</sup>*. *Then the following hold*

$$\left\|\|u - \pi u\|\right\|\_{L^2(\Omega)}^2 \le C \sum\_{T \in \mathcal{T}\_k} h\_T^4 \left\|D^2 u\right\|\_{L^2(T)}^2, \quad \left\|D(u - \pi u)\right\|\_{L^2(\Omega)}^2 \le C \sum\_{T \in \mathcal{T}\_k} h\_T^2 \left\|D^2 u\right\|\_{L^2(T)}^2,$$

where *C* is a generic constant independent of *h* and *u*, but it depends on the ratio between smallest and largest interior angle of the triangles of T *<sup>h</sup>*. Here k k *D u*ð Þ � *πu* 2 *<sup>L</sup>*2ð Þ <sup>Ω</sup> <sup>¼</sup> <sup>P</sup> *T* ∈T *<sup>h</sup>* k k *D u*ð Þ � *πu* 2 *<sup>L</sup>*2ð Þ *<sup>T</sup>* .
