Professional Documents
Culture Documents
M. Ersoy
Basque Center for Applied Mathematics
12 November 2010
Introduction
HOW TO
solve steady pdes : e.g. Laplace equation
solve unsteady pdes : e.g. Heat equation
M. Ersoy (BCAM)
Freefem++
12 November 2010
2 / 22
Outline
Outline
Introduction
HOW TO
solve steady pdes : e.g. Laplace equation
solve unsteady pdes : e.g. Heat equation
M. Ersoy (BCAM)
Freefem++
12 November 2010
3 / 22
1. in progress
M. Ersoy (BCAM)
Freefem++
12 November 2010
4 / 22
Linux
Windows
Mac
1. in progress
2. Useful documentation available at http://www.freefem.org/ff++/ftp/freefem++doc.
pdf
M. Ersoy (BCAM)
Freefem++
12 November 2010
4 / 22
Linux
Windows
Mac
1. in progress
2. Useful documentation available at http://www.freefem.org/ff++/ftp/freefem++doc.
pdf
M. Ersoy (BCAM)
Freefem++
12 November 2010
4 / 22
Linux
Windows
Mac
1. in progress
2. Useful documentation available at http://www.freefem.org/ff++/ftp/freefem++doc.
pdf
M. Ersoy (BCAM)
Freefem++
12 November 2010
4 / 22
Outline
Outline
Introduction
HOW TO
solve steady pdes : e.g. Laplace equation
solve unsteady pdes : e.g. Heat equation
M. Ersoy (BCAM)
Freefem++
12 November 2010
5 / 22
Outline
Outline
Introduction
HOW TO
solve steady pdes : e.g. Laplace equation
solve unsteady pdes : e.g. Heat equation
M. Ersoy (BCAM)
Freefem++
12 November 2010
6 / 22
The problem
Given f L2 (), find H01 () such that :
= f
(x1 , x2 ) = 0
n := n = 0
M. Ersoy (BCAM)
Freefem++
in
on 1
on 2
12 November 2010
7 / 22
or equivalently
A(, w) = l(w)
where the bilinear form is
Z
w dx
A(, w) =
Z
l(w) =
f w dx
M. Ersoy (BCAM)
Freefem++
12 November 2010
8 / 22
Variational problem
Problem is now to find v H01 () such that, for every w H01 () :
A(, w) = l(w)
where the bilinear form is
Z
w dx
A(, w) =
Z
l(w) =
f w dx
M. Ersoy (BCAM)
Freefem++
12 November 2010
9 / 22
nh
X
)
uk k (x, y), uk R
k=1
M. Ersoy (BCAM)
Freefem++
12 November 2010
10 / 22
Spaces Vh
Spaces Vh = Vh (h , P ) will depend on the mesh :
h =
n
[
Tk
k=1
Freefem++
12 November 2010
11 / 22
With FreeFem++
write the VF
its easy !
M. Ersoy (BCAM)
Freefem++
12 November 2010
12 / 22
if = 1 + 2 + . . . then
FreeFem++ define border commands :
I
I
I
M. Ersoy (BCAM)
Freefem++
12 November 2010
13 / 22
if = 1 + 2 + . . . then
FreeFem++ define border commands :
I
I
I
M. Ersoy (BCAM)
Freefem++
12 November 2010
13 / 22
M. Ersoy (BCAM)
Freefem++
12 November 2010
14 / 22
M. Ersoy (BCAM)
Freefem++
12 November 2010
14 / 22
VF is simply what we write on paper, for instance, for the Laplace equation, we
should have :
Vh phi, w, f ;
problem Laplace(phi,w)
int2d(Omegah)(dx(phi)*dx(w) + dy(phi)*dy(w))
- int2d(Omegah)(f*w)
+ boundary conditions
;
where w, phi belong to FE space Vh.
M. Ersoy (BCAM)
Freefem++
12 November 2010
15 / 22
VF is simply what we write on paper, for instance, for the Laplace equation, we
should have :
Vh phi, w, f ;
problem Laplace(phi,w)
int2d(Omegah)(dx(phi)*dx(w) + dy(phi)*dy(w))
- int2d(Omegah)(f*w)
+ boundary conditions
;
where w, phi belong to FE space Vh.
Next, to solve it, just write :
Laplace ;
M. Ersoy (BCAM)
Freefem++
12 November 2010
15 / 22
VF is simply what we write on paper, for instance, for the Laplace equation, we
should have :
Vh phi, w, f ;
problem Laplace(phi,w)
int2d(Omegah)(dx(phi)*dx(w) + dy(phi)*dy(w))
- int2d(Omegah)(f*w)
+ boundary conditions
;
where w, phi belong to FE space Vh.
M. Ersoy (BCAM)
Freefem++
12 November 2010
15 / 22
Freefem++
12 November 2010
16 / 22
to plot
plot(phi) ;
or
plot([dx(phi),dy(phi)]) ;
Laplace equation
M. Ersoy (BCAM)
Freefem++
12 November 2010
17 / 22
Outline
Outline
Introduction
HOW TO
solve steady pdes : e.g. Laplace equation
solve unsteady pdes : e.g. Heat equation
M. Ersoy (BCAM)
Freefem++
12 November 2010
18 / 22
The problem
t = f
(x1 , x2 ) = z(x1 , x2 )
n := n = 0
in
on 1
on 2
M. Ersoy (BCAM)
Freefem++
12 November 2010
19 / 22
Variational formulation
The Variational formulation for the semi discrete equation is : let w be a test
function, we write :
Z
Z
n+1 n
n+1
w +
w dx =
f n w dx
t
M. Ersoy (BCAM)
Freefem++
12 November 2010
20 / 22
M. Ersoy (BCAM)
Freefem++
example
12 November 2010
21 / 22
Enjoy
Enjoy
yourself
yourself
M. Ersoy (BCAM)
Freefem++
12 November 2010
22 / 22