0% found this document useful (0 votes)
1 views

lecture_00_fem_introduction

The document provides an introduction to the Finite Element Method (FEM), detailing its application in discretizing differential equations, including ordinary and partial differential equations. It outlines the transition from partial differential equations to variational problems and then to discrete systems of equations, emphasizing the importance of choosing appropriate function spaces and methods for solving these equations. Additionally, it discusses various numerical methods for solving linear systems arising from FEM, including direct and iterative approaches.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
1 views

lecture_00_fem_introduction

The document provides an introduction to the Finite Element Method (FEM), detailing its application in discretizing differential equations, including ordinary and partial differential equations. It outlines the transition from partial differential equations to variational problems and then to discrete systems of equations, emphasizing the importance of choosing appropriate function spaces and methods for solving these equations. Additionally, it discusses various numerical methods for solving linear systems arising from FEM, including direct and iterative approaches.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 33

FEniCS Course

Lecture 0: Introduction to FEM


Contributors
Anders Logg

1 / 33
What is FEM?

The finite element method is a framework and a recipe for


discretization of differential equations

• Ordinary differential equations

• Partial differential equations

• Integral equations

• A recipe for discretization of PDE

• PDE → Ax = b

• Different bases, stabilization, error control, adaptivity

2 / 33
The FEM cookbook

(i)

Au = f Partial differential equation


(ii)
v
by a(u, v) = L(v) Continuous variational problem
iply
Mult
(iii)
V a(uh , v) = L(v) Discrete variational problem

Vh
ake (iv)
T
φ j
Uj AU = b System of discrete equations
j
P
=
tu
h
Le

3 / 33
The PDE (i)
Consider Poisson’s equation, the Hello World of partial
differential equations:

−∆u = f in Ω
u = u0 on ∂Ω

Poisson’s equation arises in numerous applications:

• heat conduction, electrostatics, diffusion of substances,

twisting of elastic rods, inviscid fluid flow, water waves,


magnetostatics, . . .

• as part of numerical splitting strategies for more

complicated systems of PDEs, in particular the


Navier–Stokes equations
4 / 33
From PDE (i) to variational problem (ii)
The simple recipe is: multiply the PDE by a test function v and
integrate over Ω:
Z Z
− (∆u)v dx = f v dx
Ω Ω

Then integrate by parts and set v = 0 on the Dirichlet


boundary:
Z Z Z
∂u
− (∆u)v dx = ∇u · ∇v dx − v ds
Ω Ω ∂n
| ∂Ω {z }
=0

We find that: Z Z
∇u · ∇v dx = f v dx
Ω Ω

5 / 33
The variational problem (ii)

Find u ∈ V such that


Z Z
∇u · ∇v dx = f v dx
Ω Ω

for all v ∈ V̂

The trial space V and the test space V̂ are (here) given by

V = {v ∈ H 1 (Ω) : v = u0 on ∂Ω}
V̂ = {v ∈ H 1 (Ω) : v = 0 on ∂Ω}

6 / 33
From continuous (ii) to discrete (iii) problem

We approximate the continuous variational problem with a


discrete variational problem posed on finite dimensional
subspaces of V and V̂ :

Vh ⊂ V
V̂h ⊂ V̂

Find uh ∈ Vh ⊂ V such that


Z Z
∇uh · ∇v dx = f v dx
Ω Ω

for all v ∈ V̂h ⊂ V̂

7 / 33
From discrete variational problem (iii) to
discrete system of equations (iv)
Choose a basis for the discrete function space:

Vh = span {φj }N
j=1

Make an ansatz for the discrete solution:


N
X
uh = Uj φj
j=1

Test against the basis functions:


Z N
X Z
∇( Uj φj ) · ∇φi dx = f φi dx
Ω j=1 Ω
| {z }
uh

8 / 33
From discrete variational problem (iii) to
discrete system of equations (iv), contd.
Rearrange to get:
N
X Z Z
Uj ∇φj · ∇φi dx = f φi dx
j=1 |Ω {z } | Ω {z }
Aij bi

A linear system of equations:


AU = b
where
Z
Aij = ∇φj · ∇φi dx (1)
ZΩ
bi = f φi dx (2)

9 / 33
The canonical abstract problem
(i) Partial differential equation:

Au = f in Ω

(ii) Continuous variational problem: find u ∈ V such that

a(u, v) = L(v) for all v ∈ V̂

(iii) Discrete variational problem: find uh ∈ Vh ⊂ V such that

a(uh , v) = L(v) for all v ∈ V̂h

(iv) Discrete system of equations for uh = N


P
j=1 Uj φj :

AU = b
Aij = a(φj , φi )
bi = L(φi )

10 / 33
Important topics

• How to choose Vh ?

• How to compute A and b

• How to solve AU = b?

• How large is the error e = u − uh ?

• Extensions to nonlinear problems

11 / 33
How to choose Vh

12 / 33
Finite element function spaces

uh

13 / 33
The finite element definition (Ciarlet 1975)

A finite element is a triple (T, V, L), where

• the domain T is a bounded, closed subset of Rd (for

d = 1, 2, 3, . . . ) with nonempty interior and piecewise


smooth boundary

• the space V = V(T ) is a finite dimensional function space

on T of dimension n

• the set of degrees of freedom (nodes) L = {`1 , `2 , . . . , `n } is

a basis for the dual space V 0 ; that is, the space of bounded
linear functionals on V

14 / 33
The finite element definition (Ciarlet 1975)

T V L

v(x̄)

v(x̄) · n
R
T v(x)w(x) dx

15 / 33
The linear Lagrange element: (T, V, L)

• T is a line, triangle or tetrahedron

• V is the first-degree polynomials on T

• L is point evaluation at the vertices

16 / 33
The linear Lagrange element: L

17 / 33
The linear Lagrange element: Vh

uh (x, y)

T = {T }

18 / 33
The quadratic Lagrange element: (T, V, L)

• T is a line, triangle or tetrahedron

• V is the second-degree polynomials on T

• L is point evaluation at the vertices and edge midpoints

19 / 33
The quadratic Lagrange element: L

20 / 33
The quadratic Lagrange element: Vh

21 / 33
Families of elements

22 / 33
Families of elements

23 / 33
Computing the sparse matrix A

24 / 33
Naive assembly algorithm

A=0

for i = 1, . . . , N

for j = 1, . . . , N

Aij = a(φj , φi )

end for

end for

25 / 33
The element matrix

The global matrix A is defined by

Aij = a(φj , φi )

The element matrix AT is defined by

AT,ij = aT (φTj , φTi )

26 / 33
The local-to-global mapping
The global matrix ιT is defined by

I = ιT (i)

where I is the global index corresponding to the local index i


4 4

3 3
8
7
5 9 4
4
9 5
1
1
6 2
6
5 2 1 3
6
2 2

27 / 33
The assembly algorithm

A=0

for T ∈ T

Compute the element matrix AT

Compute the local-to-global mapping ιT

Add AT to A according to ιT

end for

28 / 33
Adding the element matrix AT

ι2T (1) ι2T (2) ι2T (3) 1 2 3

ι1T (1) 2

3
ι1T (2)

AT,32
ι1T (3)

29 / 33
Solving AU = b

30 / 33
Direct methods

• Gaussian elimination
• Requires ∼ 2 3
3N operations

• LU factorization: A = LU
• Solve requires ∼ 2 3
3N operations
• Reuse L and U for repeated solves

• Cholesky factorization: A = LL>


• Works if A is symmetric and positive definite

• Solve requires ∼ 1 3
3N operations
• Reuse L for repeated solves

31 / 33
Iterative methods
Krylov subspace methods
• GMRES (Generalized Minimal RESidual method)
• CG (Conjugate Gradient method)
• Works if A is symmetric and positive definite

• BiCGSTAB, MINRES, TFQMR, . . .

Multigrid methods
• GMG (Geometric MultiGrid)

• AMG (Algebraic MultiGrid)

Preconditioners
• ILU, ICC, SOR, AMG, Jacobi, block-Jacobi, additive

Schwarz, . . .
32 / 33
Which method should I use?

Rules of thumb

• Direct methods for small systems

• Iterative methods for large systems

• Break-even at ca 100–1000 degrees of freedom

• Use a symmetric method for a symmetric system

• Cholesky factorization (direct)


• CG (iterative)

• Use a multigrid preconditioner for Poisson-like systems

• GMRES with ILU preconditioning is a good default choice

33 / 33

You might also like