Introduction to finite elements

Eric Neiva | TurlierLab | 18-03-2022

 

Acknowledgement of EU funding
This material is part of a project that has received funding from the European Research Council (ERC) under the European Union’s Horizon 2020 research and innovation programme (Grant agreement No. 949267).
Eric Neiva | Intro to FEM | TurlierLab | 18-03-2022

Motivation

  • Scope
    • Mathematical models of minimisation of a potential (energy)
    • Involving partial differential equations (PDEs)
  • Challenges
    • Often impossible to find an analytical solution
    • Infinite-dimensional, cannot be mapped to computers
  • Solution
    • Approximate finite-dimensional models (FEM, FDM, FVM, ...)
 
Eric Neiva | Intro to FEM | TurlierLab | 18-03-2022

Motivation

Naturally,

approximations make sense on well-posed minimisation problems.

In this talk...

  1. How do we study mathematical models of minimisation problems?
  2. How do we approximate them with finite elements?
 
Eric Neiva | Intro to FEM | TurlierLab | 18-03-2022

Contents

  • Motivation
  • Mathematical theory of potential energy minimisation
  • The finite element method (FEM)
  • Gridap FEM tutorial
 
Eric Neiva | Intro to FEM | TurlierLab | 18-03-2022

Mathematical models

  • Minimisation problem
  • Variational formulation
  • Differential equation
  • Abstract theory
 
Eric Neiva | Intro to FEM | TurlierLab | 18-03-2022

Minimisation problem

Example 1. Straight elastic bar under tangential load in Ω=[0,1]\Omega = [0,1]

  • u(0),u(1)0u(0), u(1) \equiv 0 🠒 boundary conditions (clamped)
  • f(x)f(x) 🠒 forcing term
  • k(x)1k(x) \equiv 1 🠒 Young's modulus
 
Eric Neiva | Intro to FEM | TurlierLab | 18-03-2022

Minimisation problem

Example 1. Straight elastic bar under tangential load in Ω=[0,1]\Omega = [0,1]

  • Assume
    • Material in the elastic regime
    • Small displacements (u(x)1)(u(x) \llless 1)
 
Eric Neiva | Intro to FEM | TurlierLab | 18-03-2022

Minimisation problem

Example 1. Straight elastic bar under tangential load in Ω=[0,1]\Omega = [0,1]

  • Assume
    • Material in the elastic regime
    • Small displacements (u(x)1)(u(x) \llless 1)

Question 1.

  • What physical law expresses the elastic energy stored in the bar?
 
Eric Neiva | Intro to FEM | TurlierLab | 18-03-2022

Minimisation problem

Example 1. Straight elastic bar under tangential load in Ω=[0,1]\Omega = [0,1]

  • Hooke's law: E(u)=1201u(x)2 dx\qquad E(u) = \frac{1}{2} \int_0^1 u'(x)^2 \ \mathrm{d}x
  • Total potential: J(u)01(12u(x)2f(x)u(x)) dx\quad J(u) \doteq \int_0^1 \left( \frac{1}{2} u'(x)^2 - f(x)u(x) \right) \ \mathrm{d}x
  • Let C01([0,1])={vC1([0,1]):v(0)=v(1)=0}\mathcal{C}_0^1([0,1]) = \left\{ v \in \mathcal{C}^1([0,1]) : v(0) = v(1) = 0 \right\}
  • Minimum potential energy principle:

uargminvC01([0,1])J(v) u \doteq \underset{{v \in \mathcal{C}_0^1([0,1])}}{\mathrm{argmin}} J(v)

 
Eric Neiva | Intro to FEM | TurlierLab | 18-03-2022

Minimisation problem

Example 1. Straight elastic bar under tangential load in Ω=[0,1]\Omega = [0,1]

uargminvC01([0,1])J(v)(M) u \doteq \underset{{v \in \mathcal{C}_0^1([0,1])}}{\mathrm{argmin}} J(v) \qquad \text{\textsf{\color{brown}(M)}}

  • Same minimisation problem for, e.g.,
    • a fixed elastic cord under transversal load
    • heat conduction on a bar
  • Formulated in an infinite dimensional space of functions
 
Eric Neiva | Intro to FEM | TurlierLab | 18-03-2022

Variational formulation

  • Seek an equivalent formulation using calculus of variations
    • Minimisation problem 🠒 Variational formulation
    • Mathematical advantages (to be stated soon)
 
Eric Neiva | Intro to FEM | TurlierLab | 18-03-2022

Variational formulation

  • Assume there exists a global minimum uu for (M)\text{\textsf{\color{brown}(M)}}
  • Given vC01([0,1])v \in \mathcal{C}_0^1([0,1]) and αR\alpha \in \mathbb{R}, let

Φv(α)J(u+αv)\Phi_v (\alpha) \doteq J(u + \alpha v)

  • Since uu is a global minimiser,

J(u)Φv(α),vC01([0,1]),αR J(u) \leq \Phi_v (\alpha), \quad \forall v \in \mathcal{C}_0^1([0,1]), \quad \forall \alpha \in \mathbb{R}

 
Eric Neiva | Intro to FEM | TurlierLab | 18-03-2022

Variational formulation

J(u)=J(u+0v)Φv(α),vC01([0,1]),αR J(u) = J(u + 0 v) \leq \Phi_v (\alpha), \quad \forall v \in \mathcal{C}_0^1([0,1]), \quad \forall \alpha \in \mathbb{R}

  • Φv(α)\Phi_v (\alpha) has a global minimum at zero
  • If Φv(α)\Phi_v (\alpha) is differentiable, then

Φv(0)=limα0J(u+αv)J(u)α=0 \Phi_v' (0) = \lim_{\alpha \to 0} \frac{J(u + \alpha v) - J(u)}{\alpha} = 0

 
Eric Neiva | Intro to FEM | TurlierLab | 18-03-2022

Variational formulation

  • Algebraic manipulations + cancelling high-order terms gives

01(u(x)v(x)f(x)v(x)) dx=0,vC01([0,1])(V) \int_0^1 \left( u'(x)v'(x) - f(x)v(x) \right) \ \mathrm{d}x = 0, \quad \forall v \in \mathcal{C}_0^1([0,1]) \quad \text{\textsf{\color{orange}(V)}}

  • The weak or variational form of the physical problem (M)\text{\textsf{\color{brown}(M)}}
  • In statics, referred to as principle of virtual work:
    • Any perturbation of the equilibrium configuration requires to supply energy to the system (J(u)J(u+αv))(J(u) \leq J(u + \alpha v))
 
Eric Neiva | Intro to FEM | TurlierLab | 18-03-2022

Differential equation

  • Now, relate (M)\text{\textsf{\color{brown}(M)}} and (V)\text{\textsf{\color{orange}(V)}} with standard differential equations
  • Assume uC2([0,1])u \in \mathcal{C}^2([0,1]) (and also fC0([0,1])f \in \mathcal{C}^0([0,1]))
  • Using extra regularity of uu, integrate (V)\text{\textsf{\color{orange}(V)}} by parts

0=01u(x)v(x) dx01f(x)v(x) dx=01(u(x)+f(x))v(x) dx 0 = \int_0^1 u'(x)v'(x) \ \mathrm{d}x - \int_0^1 f(x)v(x) \ \mathrm{d}x = - \int_0^1 (u''(x)+f(x))v(x) \ \mathrm{d}x

 
Eric Neiva | Intro to FEM | TurlierLab | 18-03-2022

Differential equation

  • The fundamental lemma of calculus of variations leads to

01(u(x)+f(x))v(x) dx=0, vC01([0,1])(u(x)+f(x))0 in [0,1] - \int_0^1 (u''(x)+f(x))v(x) \ \mathrm{d}x = 0, \ \forall v \in \mathcal{C}_0^1([0,1]) \Rightarrow (u''(x) + f(x)) \equiv 0 \ \text{in} \ [0,1]

  • Thus,

u(x)=f(x) in [0,1],u(0),u(1)=0(D) -u''(x) = f(x) \ \text{in} \ [0,1], \quad u(0), u(1) = 0 \quad \text{\textsf{\color{pink}(D)}}

Remark. Point-wise vs weak sense

 
Eric Neiva | Intro to FEM | TurlierLab | 18-03-2022

But is the problem well-posed?

  • (M)\text{\textsf{\color{brown}(M)}}, (V)\text{\textsf{\color{orange}(V)}} and (D)\text{\textsf{\color{pink}(D)}}: equivalent statements of same \infty-dim problem
  • Note that (D)\text{\textsf{\color{pink}(D)}} assumes higher regularity (classical solutions)
  • Proving existence and uniqueness of (D)\text{\textsf{\color{pink}(D)}} solutions is often hard
  • In contrast, it is much easier to prove it for (V)\text{\textsf{\color{orange}(V)}} solutions
  • Remark. Many problems do not have a solution in classical sense,
    e.g. clamped elastic L-shaped plate
 
Eric Neiva | Intro to FEM | TurlierLab | 18-03-2022

Abstract setting

  • Goal:
    • State some general abstract existence and uniqueness results
  • Assume minimisation problems, related to an energy functional JJ, on a space of functions defined in a bounded ΩRd\Omega \subset \mathbb{R}^d, d=2,3d = 2,3.
 
Eric Neiva | Intro to FEM | TurlierLab | 18-03-2022

Abstract setting

Definition. (Bi)linear forms. Given a vector space VV in the field of scalars R\mathbb{R}, a form :VR\ell : V \to \mathbb{R} is linear if it satisfies:

(u+v)=(u)+(v),u,vV,(αu)=α(u),uV,αR \ell(u+v) = \ell(u) + \ell(v), \quad \forall u, v \in V, \quad \ell(\alpha u) = \alpha \ell(u), \quad \forall u \in V, \alpha \in \mathbb{R}

A (two-argument) form a:V×VRa : V \times V \to \mathbb{R} is a bilinear form if it is linear with respect to each of its two arguments separately.

E.g.a(αu+v,βw)=αβa(u,w)+βa(v,w),u,v,wV,α,βR \text{E.g.} \quad a(\alpha u + v, \beta w) = \alpha \beta a(u,w) + \beta a(v,w), \quad \forall u, v, w \in V, \quad \alpha,\beta \in \mathbb{R}

 
Eric Neiva | Intro to FEM | TurlierLab | 18-03-2022

Abstract setting

Definition. Quadratic minimisation problem. Let us consider a functional J:VRJ : V \to \mathbb{R} on a vector space VV expressed as

J(v)12a(v,v)(v)+c J(v) \doteq \frac{1}{2} a(v,v) - \ell(v) + c

for a symmetric bilinear form a:V×VRa : V \times V \to \mathbb{R}, a linear form :VR\ell : V \to \mathbb{R} and cRc \in \mathbb{R}. The quadratic minimisation problem on VV is

uargminvV J(v).(M) u \doteq \underset{v \in V}{\mathrm{argmin}} \ J(v). \quad \text{\textsf{\color{brown}(M)}}

 
Eric Neiva | Intro to FEM | TurlierLab | 18-03-2022

Abstract setting

Example 1. Straight elastic bar under tangential load in Ω=[0,1]\Omega = [0,1]

J(v)=1201v(x)201f(x)v(x) dx=12a(v,v)(v)+c J(v) = \frac{1}{2} \int_0^1 v'(x)^2 - \int_0^1 f(x)v(x) \ \mathrm{d}x = \frac{1}{2} a(v,v) - \ell(v) + c

  • a(u,v)=01u(x)v(x),u,vC01([0,1])a(u,v) = \int_0^1 u'(x)v'(x), \enskip \forall u,v \in \mathcal{C}_0^1([0,1])
  • (v)=01f(x)v(x),vC01([0,1])\ell(v) = \int_0^1 f(x)v(x), \enskip \forall v \in \mathcal{C}_0^1([0,1])
  • c=0c = 0
 
Eric Neiva | Intro to FEM | TurlierLab | 18-03-2022

Abstract setting

Perturbing (again) around the global minimiser uVu \in V with vVv \in V and αR\alpha \in \mathbb{R},

limα0J(u+αv)J(u)α=limα0αa(u,v)+α22a(v,v)α(v)α=a(u,v)(v),vV,\begin{align*} \lim_{\alpha \to 0} \frac{J(u + \alpha v) - J(u)}{\alpha} &= \lim_{\alpha \to 0} \frac{\alpha a(u,v) + \frac{\alpha^2}{2} a(v,v) - \alpha \ell(v)}{\alpha} \\ &= a(u,v) - \ell(v), \quad \forall v \in V, \end{align*}

we obtain a linear variational problem.

 
Eric Neiva | Intro to FEM | TurlierLab | 18-03-2022

Abstract setting

Definition. A linear variational problem reads as

find uV:a(u,v)=l(v),vV(V)\text{find} \ u \in V : a(u,v) = l(v), \quad \forall v \in V \quad \text{\textsf{\color{orange}(V)}}

where VV is a vector space, a:V×VRa : V \times V \to \mathbb{R} is a bilinear form and :VR\ell : V \to \mathbb{R} is a linear form.

Remark. More generally, uV~u \in \tilde{V}, where VV is an affine space.

 
Eric Neiva | Intro to FEM | TurlierLab | 18-03-2022

Abstract setting

Definition. A symmetric bilinear form a:V×VRa : V \times V \to \mathbb{R} on a real vector space VV is positive definite if

a(u,u)>0,uV{0}. a(u,u) > 0, \quad \forall u \in V \setminus{\{0\}}.

Definition. A symmetric positive definite bilinear form a:V×VRa : V \times V \to \mathbb{R} induces the energy norm

uaa(u,u)1/2. \| u \|_a \doteq a(u,u)^{1/2}.

 
Eric Neiva | Intro to FEM | TurlierLab | 18-03-2022

Abstract setting

Definition. Continuity of (bi)linear forms. Given a vector space VV with norm \| \cdot \|, a linear form :VR\ell : V \to \mathbb{R} is continuous or bounded if

C>0:(v)Cv,vV. \exist C > 0 : \left| \ell(v) \right| \leq C \| v \|, \quad \forall v \in V.

A bilinear form a:V×VRa : V \times V \to \mathbb{R} is continuous if

K>0:a(u,v)Kuv,u,vV. \exist K > 0 : \left| a(u,v) \right| \leq K \| u \| \| v \|, \quad \forall u,v \in V.

 
Eric Neiva | Intro to FEM | TurlierLab | 18-03-2022

Abstract setting

Theorem. Existence and uniqueness of a minimiser in finite dimension. If the space VV in (M)\text{\textsf{\color{brown}(M)}} has finite dimension and involves a positive definite symmetric bilinear form aa and a continuous functional \ell, there exists a unique solution for this problem.

Remark. Under finite dimensionality, the variational form can be recast into a solvable square linear system.

 
Eric Neiva | Intro to FEM | TurlierLab | 18-03-2022

Functional spaces

In infinite dimensions:

  • Choice of functional space VV for solution of (M)\text{\textsf{\color{brown}(M)}} is critical
  • In general, we seek the largest VV for which
    • aa has sense (i.e., is bounded) and
    • VV satisfies suitable boundary conditions
 
Eric Neiva | Intro to FEM | TurlierLab | 18-03-2022

Functional spaces

In infinite dimensions:

  • If VV is too small, there will not exist a solution to (M)\text{\textsf{\color{brown}(M)}}
  • Example 2. There is no solution to J1201u2(x)u(x)dxJ \doteq \frac{1}{2} \int_0^1 u^2(x) - u(x) \mathrm{d}x in C00([0,1])\mathcal{C}_0^0([0,1]) (no continuous fun. minimises (M)\text{\textsf{\color{brown}(M)}} and satisfies BCs)
  • The key requirement for VV is completeness and, in particular, VV is generally a Hilbert space (normed, complete + with inner product)
 
Eric Neiva | Intro to FEM | TurlierLab | 18-03-2022

Functional spaces

Theorem. Existence and uniqueness of solutions in Hilbert spaces. Let us consider a Hilbert space VV endowed with the inner product a:V×VRa : V \times V \to \mathbb{R} and a linear functional :VR\ell : V \to \mathbb{R}. The quadratic minimisation problem

u=argminvV J(v),J(v)=12a(v,v)(v) u = \underset{v \in V}{\mathrm{argmin}} \ J(v), \quad J(v) = \frac{1}{2} a(v,v) - \ell(v)

has a unique solution.

 
Eric Neiva | Intro to FEM | TurlierLab | 18-03-2022

Functional spaces

Definition. The L2(Ω)L^2(\Omega) space is the space of square-integrable functions on Ω\Omega:

L2(Ω){v:ΩR:Ωv(x)2dx<}. L^2(\Omega) \doteq \{ v : \Omega \to \mathbb{R} : \int_\Omega \left| v(x) \right|^2 \mathrm{d}x < \infty \}.

It is endowed with the inner product

(u,v)Ωu(x)v(x) dx. \left( u, v \right) \doteq \int_\Omega u(x) v(x) \ \mathrm{d}x.

 
Eric Neiva | Intro to FEM | TurlierLab | 18-03-2022

Functional spaces

Definition. The H1(Ω)H^1(\Omega) space is the space of square-integrable functions with square integrable gradients on Ω\Omega:

H1(Ω){vL2(Ω):vL2(Ω)}. H^1(\Omega) \doteq \{ v \in L^2(\Omega) : \boldsymbol{\nabla} v \in L^2(\Omega) \}.

It is endowed with the inner product

(u,v)H1Ωu(x)v(x) dx+Ωu(x)v(x) dx. \left( u, v \right)_{H^1} \doteq \int_\Omega u(x) v(x) \ \mathrm{d}x + \int_\Omega \boldsymbol{\nabla} u(x) \cdot \boldsymbol{\nabla} v(x) \ \mathrm{d}x.

 
Eric Neiva | Intro to FEM | TurlierLab | 18-03-2022

Functional spaces

Example 1. Straight elastic bar under tangential load in Ω=[0,1]\Omega = [0,1]

J(v)=1201v(x)201f(x)v(x) dx,vV. J(v) = \frac{1}{2} \int_0^1 v'(x)^2 - \int_0^1 f(x)v(x) \ \mathrm{d}x, \quad \forall v \in V.

The previous theorem holds for V=H01([0,1])V = H_0^1([0,1]).

 
Eric Neiva | Intro to FEM | TurlierLab | 18-03-2022

Functional spaces

Example 3. A multidimensional version of Example 1. in ΩRd\Omega \subset \mathbb{R}^d.

Models, e.g., the normal displacement uu of a membrane under a normal external pressure ff and prescribed displacement at Ω\partial \Omega.

J(v)=1201v(x)201f(x)v(x) dx,vV. J(v) = \frac{1}{2} \int_0^1 \| \boldsymbol{\nabla} v (x) \|^2 - \int_0^1 f(x)v(x) \ \mathrm{d}x, \quad \forall v \in V.

Assuming clamped, the previous theorem holds for V=H01(Ω)V = H_0^1(\Omega).

 
Eric Neiva | Intro to FEM | TurlierLab | 18-03-2022

Boundary value problem

Proposition. Green's first formula (integration by parts). For all ψC1(Ω),vC1(Ω)\boldsymbol{\psi} \in \mathcal{C}^1 (\overline{\Omega}), v \in \mathcal{C}^1 (\overline{\Omega}), it holds:

Ωψ(x)v(x) dx=Ω(ψ(x))v(x) dx+Ωψ(s)n(s)v(s) ds \int_\Omega \boldsymbol{\psi}(x) \cdot \boldsymbol{\nabla} v(x) \ \mathrm{d}x = - \int_\Omega ( \boldsymbol{\nabla} \cdot \boldsymbol{\psi}(x)) v(x) \ \mathrm{d}x + \int_{\partial \Omega} \boldsymbol{\psi}(s) \cdot \boldsymbol{n}(s) v(s) \ \mathrm{d}s

Applying the proposition (uC2(Ω))(u \in \mathcal{C}^2 (\overline{\Omega})) and the fundamental lemma of calculus of variations to the variational form (V)\text{\textsf{\color{orange}(V)}} of Example 3....

Δu=f in Ω,u=0 on Ω.(D) - \Delta u = f \quad \ \text{in} \ \Omega, \quad u = 0 \ \text{on} \ \partial \Omega. \quad \text{\textsf{\color{pink}(D)}}

 
Eric Neiva | Intro to FEM | TurlierLab | 18-03-2022

The finite element method

  • Our goal now is to approximate the mathematical model
  • Map an \infty-dimensional (M)\text{\textsf{\color{brown}(M)}} to a numerical approximation
  • FEM approximation derived from variational formulation (V)\text{\textsf{\color{orange}(V)}}
 
Eric Neiva | Intro to FEM | TurlierLab | 18-03-2022

The finite element method

  • The Galerkin method
  • Finite elements
  • Error analysis
 
Eric Neiva | Intro to FEM | TurlierLab | 18-03-2022

The Galerkin method

Definition. Galerkin approximation. Given the abstract variational formulation

uV:a(u,v)=l(v),vV,(V)u \in V : a(u,v) = l(v), \quad \forall v \in V, \quad \text{\textsf{\color{orange}(V)}}

let us consider a finite dimensional vector subspace VNVV_N \subset V, with dim(VN)=N\mathrm{dim}(V_N) = N. The Galerkin approximation of (V)\text{\textsf{\color{orange}(V)}} reads

uNVN:a(uN,vN)=l(vN),vNVN.(G)u_N \in V_N : a(u_N,v_N) = l(v_N), \quad \forall v_N \in V_N. \quad \text{\textsf{\color{yellow}(G)}}

 
Eric Neiva | Intro to FEM | TurlierLab | 18-03-2022

The Galerkin method

Since VNV_N is a real vector space of dim << \infty, we can pick a basis:

Definition. Basis of a finite dimensional vector space. Given a finite dimensional real vector space VMV_M, the set {φ1,,φM}MN\{\varphi_1,\ldots,\varphi_M\} \subset M \in \mathbb{N} is a basis of VMV_M if, for all vVMv \in V_M, there is a unique set of coefficients {vi}i=1MR\{ v_i \}_{i=1}^M \subset \mathbb{R} such that v=v1φ1++vMφMv = v_1 \varphi_1 + \ldots + v_M \varphi_M. MM is equal to the dimension of VMV_M.

 
Eric Neiva | Intro to FEM | TurlierLab | 18-03-2022

The Galerkin method

Lemma. Galerkin system as a linear system. We consider a basis B={φ1,,φN}\mathcal{B} = \{ \varphi_1, \ldots, \varphi_N \} of VNV_N. The Galerkin problem (G)\text{\textsf{\color{yellow}(G)}} is equivalent to the linear system:

Find uN=i=1Nμiφiu_N = \sum_{i=1}^N \mu_i \varphi_i with

μRN:Aμ=f, where(S)ARN×N, Aija(bj,bi),i,j{1,,N},fRN, fi(bi),i{1,,N}. \begin{align*} \boldsymbol{\mu} \in \mathbb{R}^N : \mathbf{A}& \boldsymbol{\mu} = \mathbf{f}, \ \text{where} \qquad \text{\textsf{\color{lime}(S)}} \\ \mathbf{A}& \in \mathbb{R}^{N \times N}, \ \mathbf{A}_{ij} \doteq a(b^j,b^i), \quad i,j \in \{ 1, \ldots, N \}, \\ \mathbf{f}& \in \mathbb{R}^{N}, \ \mathbf{f}_i \doteq \ell(b^i), \quad i \in \{ 1, \ldots, N \}. \end{align*}

 
Eric Neiva | Intro to FEM | TurlierLab | 18-03-2022

Finite elements

  • Choice of basis dramatically affects how "easy" and "accurate" we can solve (S)\text{\textsf{\color{lime}(S)}} in a finite precision machine
  • Finite elements offer good compromise between well-conditioning, memory requirements, ease of implementation...
  • Grounded on two ingredients
    • A partition (or mesh) of Ω\Omega into elements, aka, cells
    • Globally continuous functions that are polynomials in the cells
 
Eric Neiva | Intro to FEM | TurlierLab | 18-03-2022

Finite elements

Example 4. A mesh generated with GMSH. From GridapGMSH.

 
Eric Neiva | Intro to FEM | TurlierLab | 18-03-2022

Finite elements

Definition. 1D mesh. Given a domain Ω[a,b]R\Omega \doteq [a,b] \subset \mathbb{R}, MNM \in \mathbb{N}, and a set of nodes

ΣM{axo<x1<<xM1<xMb}, \Sigma_M \doteq \{ a \equiv x_o < x_1 < \ldots < x_{M-1} < x_M \equiv b \},

we can define a mesh MM\mathcal{M}_M of Ω\Omega as

MM{(xj1,xj), 1jM}. \mathcal{M}_M \doteq \{ (x_{j-1},x_j), \ 1 \leq j \leq M \}.

The (xj1,xj)(x_{j-1},x_j) are the cells of MM\mathcal{M}_M, w. cell size hjxjxj1h_j \doteq \left| x_j - x_{j-1} \right|.

 
Eric Neiva | Intro to FEM | TurlierLab | 18-03-2022

Finite elements

Definition. Hat function in 1D linear finite elements. Given a mesh MN+1\mathcal{M}_{N+1}, for every interior node xjx_j, j=1,,Nj = 1, \ldots, N, we define its hat function φj\varphi_j as

φj(x){xxj1xjxj1,xj1x<xj,1xxjxj+1xj,xjx<xj+1,0,otherwise. \varphi_j(x) \doteq \begin{cases} \frac{x - x_{j-1}}{x_j-x_{j-1}}, & x_{j-1} \leq x < x_j, \\ 1 - \frac{x - x_j}{x_{j+1}-x_j}, & x_j \leq x < x_{j+1}, \\ 0, & \text{otherwise}. \end{cases}

 
Eric Neiva | Intro to FEM | TurlierLab | 18-03-2022

Finite elements

Definition. Hat function in 1D linear finite elements (continues). At the end-points, i.e., j{0,N+1}j \in \{ 0, N + 1 \}, the hat functions are

φ0(x){1xax1a,axx1,0,otherwise,φN+1(x){1bxbxN,xNxb,0,otherwise. \varphi_0(x) \doteq \begin{cases} 1 - \frac{x - a}{x_{1}-a}, & a \leq x \leq x_1, \\ 0, & \text{otherwise}, \end{cases} \\ \varphi_{N+1}(x) \doteq \begin{cases} 1 - \frac{b - x}{b - x_{N}}, & x_N \leq x \leq b, \\ 0, & \text{otherwise}. \end{cases}

 
Eric Neiva | Intro to FEM | TurlierLab | 18-03-2022

Finite elements

 
Eric Neiva | Intro to FEM | TurlierLab | 18-03-2022

Finite elements

Example 1. Straight elastic bar under tangential load in Ω=[0,1]\Omega = [0,1]

uH01([0,1]):01u(x)v(x) dx=01f(x)v(x) dx, vH01([0,1])(V) u \in H_0^1([0,1]) : \int_0^1 u'(x)v'(x) \ \mathrm{d}x = \int_0^1 f(x)v(x) \ \mathrm{d}x, \ \forall v \in H_0^1([0,1]) \quad \text{\textsf{\color{orange}(V)}}

We consider f1f \equiv 1 and a uniform mesh with N+1N+1 cells of size hh (uniform = equidistant nodes). We want to compute the system (S)\text{\textsf{\color{lime}(S)}} with linear finite elements.

 
Eric Neiva | Intro to FEM | TurlierLab | 18-03-2022

Finite elements

Using previous Lemma, the Galerkin approximation (G)\text{\textsf{\color{yellow}(G)}} leads to the linear system Aμ=f\mathbf{A} \boldsymbol{\mu} = \mathbf{f} (S)\text{\textsf{\color{lime}(S)}} with

Aij=01φi(x)φj(x) dxandfj=01φj(x) dx. \mathbf{A}_{ij} = \int_0^1 \varphi_i'(x)\varphi_j'(x) \ \mathrm{d}x \quad \text{and} \quad \mathbf{f}_{j} = \int_0^1 \varphi_j(x) \ \mathrm{d}x.

We generally use a numerical quadrature to integrate Aij\mathbf{A}_{ij} and fj\mathbf{f}_{j}. Assuming a trapezoidal rule to integrate fj\mathbf{f}_{j}, the linear system reads:

 
Eric Neiva | Intro to FEM | TurlierLab | 18-03-2022

Finite elements

[2100121000010012][μ1μN]=h[11] \begin{bmatrix} 2 & -1 & 0 & \ldots & & \ldots & 0 \\ -1 & 2 & -1 & 0 & \ldots & \ldots & 0 \\ 0 & \ddots & \ddots & \ddots & & & \vdots \\ \vdots & & & & & \ddots & 0 \\ \vdots & & & & \ddots & \ddots & -1 \\ 0 & \ldots & & \ldots & 0 & -1 & 2 \end{bmatrix} \begin{bmatrix} \mu_1 \\ \\ \vdots \\ \\ \mu_N \end{bmatrix} = h \begin{bmatrix} 1 \\ \\ \vdots \\ \\ 1 \end{bmatrix}

 
Eric Neiva | Intro to FEM | TurlierLab | 18-03-2022

Finite elements

  • Since (homogeneous) boundary conditions, we remove the equations for μ0\mu_0 and μN+1\mu_{N+1}.
  • The linear system is tridiagonal. In general, FEs yield sparse matrices (reduces memory storage and can use of sparse solvers).
  • Questions.
    • What is the approximation error?
    • How does it depend on NN?
 
Eric Neiva | Intro to FEM | TurlierLab | 18-03-2022

Finite elements

Proposition. Error estimates for the FE solution. Assuming

  • a well-posed (G)\text{\textsf{\color{yellow}(G)}} in ΩRd\Omega \subset \mathbb{R}^d with a FE space VNV_N of order pp,
  • exact imposition of the boundary conditions, and
  • uHq+1(Ω)u \in H^{q+1}(\Omega) for qpq \geq p,

then, we have the a priori error estimates

uuNH1(Ω)hpuHp+1(Ω) and uuNL2(Ω)hp+1uHp+1(Ω). \| u - u_N \|_{H^1(\Omega)} \leq h^p \left| u \right|_{H^{p+1}(\Omega)} \ \text{and} \ \| u - u_N \|_{L^2(\Omega)} \leq h^{p+1} \left| u \right|_{H^{p+1}(\Omega)}.

 
Eric Neiva | Intro to FEM | TurlierLab | 18-03-2022

Gridap FEM tutorials

  $ git clone https://github.com/gridap/Tutorials.git # Clone the repo
  $ cd Tutorials                            # Move to tutorials folder
  $ julia --project                         # Open and activate Julia session
  # Type ] to enter in pkg mode
  (Tutorials) pkg> instantiate              # Download all required packages
  # Type Ctrl+C to get back to command mode
  julia> include("deps/build.jl")           # Build the notebooks
  julia> using IJulia
  julia> notebook(dir=pwd())                # Open the notebooks
 
Eric Neiva | Intro to FEM | TurlierLab | 18-03-2022

Conclusions

  • FEM approximates PDEs related to energy minimisation problems
  • Variational formulation are the best for mathematical analysis
  • Choosing the functional spaces is essential for well-posedness
  • FEM is an NN-dim approximation of an \infty-dim variational problem
  • FEM rely on meshes and cellwise polynomial bases
    • Admits very general geometry and BCs
    • Sparse "well-conditioned" linear systems
 
Eric Neiva | Intro to FEM | TurlierLab | 18-03-2022

References

Material from this lecture adapted from the lecture notes by Prof. Santiago Badia at Monash University, Melbourne, Australia.

1. C. Johnson. Numerical Solution of Partial Differential Equations by the Finite Element Method. Dover Publications, 2009.

  1. O. C. Zienkiewicz, R. L. Taylor, J.Z. Zhu. The Finite Element Method: Its Basis and Fundamentals. Butterworth-Heinemann, 2013.

And that's all! Thank you!

 

This material is part of a project that has received funding from the European Research Council (ERC) under the European Union’s Horizon 2020 research and innovation programme (Grant agreement No. 949267).

Except where otherwise noted, this work and its contents (texts and illustrations) are licensed under the Attribution 4.0 International (CC BY 4.0).

- We are concerned with... - Mathematical models in physics as the minimisation of a potential (energy). - You know they usually involve partial differential equations. - You can probably think of a couple of examples. - You go very far with analytical methods, at least, in biophysics. - Comment on FEM vs FDM vs FDM. Not in the scope. - FEM deals better with complicated geometry, general BCs and variable or non-linear material properties.

- Maybe you are familiar with MP and DE, but not so much with VF - However, VF is the best one for mathematicians to work with - After illustrating them in the most simple example - Revisit the concepts in an abstract way and state general w.p.th.

- 💡 Using physical principles (energy minimisation), we can mathematically state physical problems as minimisation problems in an *infinite dimensional* space of functions.

We can now consider the variation of the functional $J$ at $u$ with respect to a variation of $v \in \mathcal{C}_0^1([0,1])$ times $\alpha \in \mathbb{R}$.

Any perturbation of the equilibrium configuration requires to supply energy to the system

Note that the solution of (BVP) is point-wise, whereas (VF) and (MP) is in the weak sense

The solution of a clamped elastic structure in an L-shaped domain does not have a solution in classical sense, since the stresses in the inner corner are infinite

Stop to ask question.

Cauchy sequence wikipedia

- A symmetric positive definite bilinear form is an inner product. - The proof is done on V, then apply equivalence.

Comment on the hypothesis on f.

- Recasting the problem into a discrete vector subspace - If (V) is well-posed, then (G) is well-posed (previous theorem for finite dim, also)

Piecewise polynomials

Very general geometry

You do not want them to retain this.

You do not want them to retain this.

You do not want them to retain this.

Note that the basis functions are "globally" continuous.

- The model can be smooth? - Split window to associate with mathematical formulation - 3 ways to verify model - Visual inspection - Consistency check - Exact convergence test - Approx. convergence test - Overkill solution - Solution does not change

3. [FEniCS documentation](https://fenicsproject.org/documentation/) 🠒 Check out the books 4. [Wolfgang Bangerth's video lectures](https://www.math.colostate.edu/~bangerth/videos.html) from [deal.ii](www.dealii.org) 5. M. J. Gander and F. Kwok. *Numerical Analysis of PDEs Using Maple and MATLAB*. SIAM, 2018.