Freefem+: Tutorial
F. Hecht, O. Pironneau
December 5, 2000
Contents
1 file = a tutorial.edp 2
2 file = adapt.edp 3
3 file = blackScholes.edp 5
3.1 Two-dimensional Black-Scholes equation . . . . . . . . . . . . . . 5
4 file = cavity.edp 7
5 file = convect.edp 10
5.1 The Rotating Hill . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
6 file = fictitiousdomain.edp 11
7 file = fitmesh.edp 12
8 file = fluidstruct.edp 13
9 file = jump.edp 14
10 file = naca.edp 16
11 file = optdes.edp 17
12 file = optshape.edp 19
13 file = readmesh.edp 20
14 file = region.edp 21
15 file = schwarz.edp 22
16 file = subroutine.edp 23
17 file = turekstep.edp 23
118 file = verifs.edp 24
19 file = verifss.edp 25
20 file = verifvs.edp 26
1 file = a tutorial.edp
Aremarktostart: noticethatinthisfiletheprogramisputbetweenanopening
brace { and an ending brace }.
The effect is to force syntax checking of the entire program before starting its
execution. Freefem+ is basically an interpreter but a statement between braces
is a compound instruction so it is scanned as only one instruction. Thus this
forces freefem+ to ”compile” the program rather than interpret it.
Consider the problem
2 2 2
−Δv = 1 in Ω ={(x,y)∈R :x +y ≤ 1}, v = 0 on Γ =∂Ω.
The problem is solved by the finite element method, namely:
Findu∈V thespaceofcontinuouspiecewiselinearfunctionsonatriangulation
of Ω which are zero on the boundary ∂Ω such that
Z Z
∇u·∇w = w ∀w∈V
Ω Ω
Thefirstthingtodoistopreparethemesh(i.e. thetriangulation); thatisdone
by first defining the ...
Voir