1. UNIVERSITÀ DEGLI STUDI DI ROMA
TOR VERGATA
Dipartimento di Matematica
Laurea in Matematica pura e applicata
Laurea in Mathematical Engineering
Laboratorio di calcolo
Finite Element Method with Freefem++
Filingeri Giuseppe
Peluso Fabio
Zenelanska Alexandra
Prof.ssa Pelosi Francesca
Prof. Baldi Paolo
1
2. Contents
1 Introduction 3
2 Case study 4
2.1 Poisson problem in (0, 1)2
. . . . . . . . . . . . . . . . . . . . 4
2.2 Poisson problem in the circle . . . . . . . . . . . . . . . . . . . 6
2
3. 1 Introduction
In mathematics, a partial dierential equation (PDE) is a dierential
equation that contains unknown multivariable functions and their partial
derivatives. (A special case are ordinary dierential equations (ODEs), which
deal with functions of a single variable and their derivatives.) PDEs are used
to formulate problems involving functions of several variables, and are either
solved by hand, or used to create a relevant computer model. In this paper
we will consider a time independent PDE given by a 2-dimensional Poisson
problem with Dirichlet boundary condition.
−∆u = f on Ω
u = g on ∂Ω
where as usually we denote ∆ the Laplacian operator and f ∈ L2
(Ω). In
most general case a PDE closed form solution in not quite easy to obtain.
For this reason several discretization method were developed such as Finite
Dierence Method (FDM) and Finite Element one (FEM). According to
FEM, strong formulation could be redened weakly applying test functions
in Sobolev space. Thanks to Divergence Theorem and Green one thus we
obtain weak formulation for our problem:
Ω
u · vdΩ = Ω
fvdΩ
with test function v choosen in {v : Ω → R|v, ∂v
∂xi
∈ L2
(Ω), v = 0 su ∂Ω}.
The above term, seen as bilinear form a(u, v) and a linear function F(v)
can be espressed as
a(u, v) = F(v)
Thus, considering the approximated solution as the right solution for
every basis function in the space ϕi, we obtain
a(ui, ϕi) = F(ϕi)
from which we obtain the linear system
Au = f
for every v belonging to the space above dened where u is still the
solution we are looking for.
3
4. 2 Case study
Using Freefem++ to approximate the Poisson problem according to Galerkin
method with C0
the space of linear stepwise function. In our case, recalling
that in
−∆u = f on Ω
u = g on ∂Ω
the equation is not homogeneus, the formulation becomes:
Ω
u · vdΩ − dΩ
∂u
∂n
vdγ = Ω
fvdΩ
2.1 Poisson problem in (0, 1)2
let us dene Ω = (0, 1)2
, g(x, y) = y cos(2πx) on ∂Ω as the right solution
u(x, y). f(x, y) = 4(π2
)y cos(2πx) as −∆U(x, y)
In this case the set Ω is the square (0, 1)2
thus boundaries are splitted
in four region. In the Freefem++ code we use triangulated mesh with poly-
nomials P1. Then, setting laplace in the source code the program solves
weak formulation problem generating u function isovalued plot and its trian-
gulated domain Th. Finally, we obtain the discretized surface for dierent
number of points discretization.
The error behaviour in L2
norm and the order of convergence are the
following:
4
5. (a) n = 4 (b) n = 8.
(c) n = 16. (d) n = 32.
Figure 1: Poisson discretization for dierent number of mesh points
5
6. 2.2 Poisson problem in the circle
let us dene Ω = (x, y) ∈ R2
: x2
+ y2
9, g(x, y) = x2
+ y2
− 9 on ∂Ω as
the right solution u(x, y), f(x, y) = −4 as −∆U(x, y) In this case the set Ω
is the circle of radius 3 thus boundaries are equal. In the Freefem++ code
we use triangulated mesh with polynomials P1. Then, setting laplace in
the source code the program solves weak formulation problem generating u
function isovalued plot and its triangulated domain Th. Finally, we obtain
the discretized surface for dierent number of points discretization.
Per il problema i) b otteniamo i risultati seguenti. In questo caso, essendo
il bordo un cerchio, viene parametrizzato.
The error behaviour in L2
norm and the order of convergence are the fol-
lowing:
6
7. (a) n = 4 (b) n = 8.
(c) n = 16. (d) n = 32.
Figure 2: Poisson discretization for dierent number of mesh points
7
8. Considering another polynomial space for basis function with another one
of higher order we expect a higher order of accuracy and a lower error in L2
norm for xed number of discretization points. Using polynomial belong-
ing to P2, thus the error decrease for xed mesh points. Note that in the
second case the error does not decrease since we are near to the maximum
representation error in C++.
8