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

- 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

- Seek an equivalent formulation using
*calculus of variations**Minimisation problem*🠒*Variational formulation*- Mathematical advantages (to be stated soon)

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

- Since $u$ is a global minimiser,

- $\Phi_v (\alpha)$ has a global minimum at zero
- If $\Phi_v (\alpha)$ is
*differentiable*, then

- Algebraic manipulations + cancelling high-order terms gives

- The
*weak*or*variational form*of the physical problem $\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) \leq J(u + \alpha v))$

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

- The fundamental lemma of calculus of variations leads to

- Thus,

**Remark.** Point-wise vs weak sense

- $\text{\textsf{\color{brown}(M)}}$, $\text{\textsf{\color{orange}(V)}}$ and $\text{\textsf{\color{pink}(D)}}$: equivalent statements of same
*$\infty$-dim*problem - Note that $\text{\textsf{\color{pink}(D)}}$ assumes
*higher regularity*(classical solutions) - Proving existence and uniqueness of $\text{\textsf{\color{pink}(D)}}$ solutions is often hard
- In contrast, it is
*much easier*to prove it for $\text{\textsf{\color{orange}(V)}}$ solutions **Remark.**Many problems do not have a solution in classical sense,

e.g. clamped elastic L-shaped plate

*Goal:*- State some general
*abstract*existence and uniqueness results

- State some general
- Assume
*minimisation problems*, related to an energy functional $J$, on a space of functions defined in a bounded $\Omega \subset \mathbb{R}^d$, $d = 2,3$.

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

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

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

*for a symmetric bilinear form $a : V \times V \to \mathbb{R}$, a linear form $\ell : V \to \mathbb{R}$ and $c \in \mathbb{R}$. The* quadratic minimisation problem *on $V$ is*

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

- $a(u,v) = \int_0^1 u'(x)v'(x), \enskip \forall u,v \in \mathcal{C}_0^1([0,1])$
- $\ell(v) = \int_0^1 f(x)v(x), \enskip \forall v \in \mathcal{C}_0^1([0,1])$
- $c = 0$

Perturbing (again) around the global minimiser $u \in V$ with $v \in V$ and $\alpha \in \mathbb{R}$,

we obtain a *linear* variational problem.

**Definition.** *A* **linear variational problem** *reads as*

*where $V$ is a vector space, $a : V \times V \to \mathbb{R}$ is a bilinear form and $\ell : V \to \mathbb{R}$ is a linear form.*

**Remark.** More generally, $u \in \tilde{V}$, where $V$ is an affine space.

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

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

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

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

**Theorem. Existence and uniqueness of a minimiser in finite dimension.** *If the space $V$ in $\text{\textsf{\color{brown}(M)}}$ has* finite dimension *and involves a positive definite symmetric bilinear form $a$ 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.

*In infinite dimensions:*

- Choice of functional space $V$ for solution of $\text{\textsf{\color{brown}(M)}}$ is critical
- In general, we seek the largest $V$ for which
- $a$ has sense (i.e., is bounded) and
- $V$
*satisfies suitable boundary conditions*

*In infinite dimensions:*

- If $V$ is too small, there will not exist a solution to $\text{\textsf{\color{brown}(M)}}$
**Example 2.**There is no solution to $J \doteq \frac{1}{2} \int_0^1 u^2(x) - u(x) \mathrm{d}x$ in $\mathcal{C}_0^0([0,1])$ (no continuous fun. minimises $\text{\textsf{\color{brown}(M)}}$*and*satisfies BCs)- The key requirement for $V$ is
*completeness*and, in particular, $V$ is generally a*Hilbert space*(normed, complete + with inner product)

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

has a unique solution.

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

*It is endowed with the inner product*

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

*It is endowed with the inner product*

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

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

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

Models, e.g., the normal displacement $u$ of a membrane under a normal external pressure $f$ and prescribed displacement at $\partial \Omega$.

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

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

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

- Our goal now is to
*approximate*the mathematical model - Map an $\infty$-dimensional $\text{\textsf{\color{brown}(M)}}$ to a numerical approximation
- FEM approximation derived from variational formulation $\text{\textsf{\color{orange}(V)}}$

- The Galerkin method
- Finite elements
- Error analysis

**Definition. Galerkin approximation.** Given the abstract variational formulation

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

Since $V_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 $V_M$, the set $\{\varphi_1,\ldots,\varphi_M\} \subset M \in \mathbb{N}$ is a basis of $V_M$ if, for all $v \in V_M$, there is a unique set of coefficients $\{ v_i \}_{i=1}^M \subset \mathbb{R}$ such that $v = v_1 \varphi_1 + \ldots + v_M \varphi_M$. $M$ is equal to the dimension of $V_M$.*

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

*Find $u_N = \sum_{i=1}^N \mu_i \varphi_i$ with*

- Choice of basis
*dramatically*affects how "easy" and "accurate" we can solve $\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

- A

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

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

*we can define a* mesh *$\mathcal{M}_M$ of $\Omega$ as*

*The $(x_{j-1},x_j)$ are the cells of $\mathcal{M}_M$, w. cell size $h_j \doteq \left| x_j - x_{j-1} \right|$.*

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

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

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

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

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

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

- Since (homogeneous) boundary conditions, we remove the equations for $\mu_0$ and $\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 $N$?

**Proposition. Error estimates for the FE solution.** *Assuming*

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

*then, we have the a priori error estimates*

- Gridap 🠒 Software for FEM 100% in Julia (Why in Julia?)
- Well maintained Gridap 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

- 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 $N$-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

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.**

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

- 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.