scispace - formally typeset
Open AccessJournal ArticleDOI

New development in freefem

Frédéric Hecht
- 01 Dec 2012 - 
- Vol. 20, pp 251-266
Reads0
Chats0
TLDR
First the freefem++ software deals with mesh adaptation for problems in two and three dimension, second, it solves numerically a problem with phase change and natural convection, and finally to show the possibilities for HPC the software solves a Laplace equation by a Schwarz domain decomposition problem on parallel computer.
Abstract
This is a short presentation of the freefem++ software. In Section 1, we recall most of the characteristics of the software, In Section 2, we recall how to to build the weak form of a partial differential equation (PDE) from the strong form. In the 3 last sections, we present different examples and tools to illustrated the power of the software. First we deal with mesh adaptation for problems in two and three dimension, second, we solve numerically a problem with phase change and natural convection, and the finally to show the possibilities for HPC we solve a Laplace equation by a Schwarz domain decomposition problem on parallel computer.

read more

Content maybe subject to copyright    Report

HAL Id: hal-01476313
https://hal.sorbonne-universite.fr/hal-01476313
Submitted on 15 Jun 2017
HAL is a multi-disciplinary open access
archive for the deposit and dissemination of sci-
entic research documents, whether they are pub-
lished or not. The documents may come from
teaching and research institutions in France or
abroad, or from public or private research centers.
L’archive ouverte pluridisciplinaire HAL, est
destinée au dépôt et à la diusion de documents
scientiques de niveau recherche, publiés ou non,
émanant des établissements d’enseignement et de
recherche français ou étrangers, des laboratoires
publics ou privés.
New development in freefem++
Frédéric Hecht
To cite this version:
Frédéric Hecht. New development in freefem++. Journal of Numerical Mathematics, De Gruyter,
2012, 20 (3-4), pp.1-14. �10.1515/jnum-2012-0013�. �hal-01476313�

J. Numer. Math., Vol. 0, No. 0, pp. 1–14 (2013)
DOI 10.1515/ JNUM.2013.000
Prepared using jnm.sty [Version: 20.02.2007 v1.3]
New Developments in FreeFem++
F. HECHT
Received May 30, 2012 Communicated by Yu. A. Kuznetsov
Received in revised form March 1, 2012
Abstract This is a short presentation to the capability of the freefem++ software, in section 1, we
recall most of the characteristics of the software, In section 2, we recall how to to build a weak form
form of an partial differential equation (PDE) from the strong form of the PDE. In three last sections,
we present different problem, tools to illustrated the software. First we do mesh adaptation problem in
two and three dimension,, secondly, we solve numerically a Phase change with Natural Convection,
and the finally to show the HPC possibility we show a Schwarz Domain Decomposition problem on
parallel computer.
Keywords: Finite Element
1. Introduction
This paper intends to give a small presentation of the software FreeFem++ .
A partial differential equation is a relation between a function of several vari-
ables and its (partial) derivatives. Many problems in physics, engineering, mathem-
atics and even banking are modeled by one or several partial differential equations.
FreeFem++ is a software to solve these equations numerically in dimensions
two or three. As its name implies, it is a free software based on the Finite Ele-
ment Method; it is not a package, it is an integrated product with its own high
level programming language; it runs on most UNIX, WINDOWS and MacOs
computers. Moreover FreeFem++ is highly adaptive. Many phenomena involve
several coupled systems, for example: fluid-structure interactions, Lorentz forces
for aluminum casting and ocean-atmosphere coupling. Multiphysics problems re-
quire different finite element approximations or different polynomial degrees, pos-
sibly on different meshes. Some algorithms like Schwarz’ domain decomposition
method also require data interpolation on multiple meshes within one program.
FreeFem++ can handle these difficulties, i.e. arbitrary finite element spaces on
arbitrary unstructured and adapted meshes.
UPMC, Univ. Paris 06, UMR 7598, F-75005 Paris, France. E-mail: frederic.hecht@upmc.fr
This work was partially supported by ANR grant No. 01-2345-6789.

2 F. Hecht
The characteristics of FreeFem++ are:
Problem description (real or complex valued) by their variational formula-
tions, with access to the internal vectors and matrices if needed.
Multi-variables, multi-equations, bi-dimensional and three-dimensional static
or time dependent, linear or nonlinear coupled systems; however the user is
required to describe the iterative procedures which reduce the problem to a
set of linear problems.
Easy geometric input by analytic description of boundaries by pieces; how-
ever this part is not a CAD system; for instance when two boundaries inter-
sect, the user must specify the intersection points.
Automatic mesh generator, based on the Delaunay-Voronoi algorithm; the
inner point density is proportional to the density of points on the boundaries
[17].
Metric-based anisotropic mesh adaptation. The metric can be computed auto-
matically from the Hessian of any FreeFem++ function [20].
High level user friendly typed input language with an algebra of analytic or
finite element functions.
Multiple finite element meshes within one application with automatic inter-
polation of data on different meshes and possible storage of the interpolation
matrices.
A large variety of triangular finite elements : linear, quadratic Lagrangian
elements and more, discontinuous P1 and Raviart-Thomas elements, elements
of a non-scalar type, the mini-element,. . . but no quadrangles.
Tools to define discontinuous Galerkin finite element formulations P0, P1dc,
P2dc and keywords: jump, mean, intalledges.
A large variety of linear direct and iterative solvers (LU, Cholesky, Crout,
CG, GMRES, UMFPACK [13], MUMPS [2], SuperLU, ...) and eigenvalue
and eigenvector solvers (ARPARK) [24],and Optimatiztion tools like Ipopt
[33]
Near optimal execution speed (compared with compiled C++ implementa-
tions programmed directly).
Online graphics, generation of ,.txt,.eps,.gnu, mesh files for fur-
ther manipulations of input and output data.
Many examples and tutorials: elliptic, parabolic and hyperbolic problems,
Navier-Stokes flows, elasticity, Fluid structure interactions, Schwarz’s do-
main decomposition method, eigenvalue problem, residual error indicator, ...

FreeFem++ 3
A parallel version using mpi
2. Weak formulation
For the first example consider a Poisson problem on a Domain with a partition of
the boundary in Γ
2
,Γ
e
: Find u such that:
u = 1 in , u = 2 on Γ
2
,
u
~n
= 0 on Γ
e
(2.1)
Denote V
g
= {v H
1
()/v
|Γ
2
= g}, and the weak form of the equation is obtained
by multiplying by v and integrating by parts (2.1). The variational formulation is:
find u V
2
() , such that
v V
0
(),
Z
u.v =
Z
1v+
Z
Γ
u
n
v, (2.2)
Note that due to
u
~n
= 0 on Γ
2
and v = 0 the term
R
Γ
u
n
v disappears on Γ
2
. Finally
the finite method simply replaces V
g
with a finite element space, such as
V
gh
= {v
h
C
0
(
¯
) : K T
h
,v
h
|
K
P
1
and v
h
|
Γ
2
= 0}
in the case of linear elements; for full detail see [10,21].
Below, we give an example of an elaborate mesh for a 3d fish and the Poisson
problem; the FreeFem++ code is below and the results are on Figures 1&2
load "msh3" load "medit" load "tetgen"
mesh3 Ths("Y5177_Fish_cut.mesh"); // read skin fish mesh ..
real hh = 10; // the final mesh size
real[int] domaine = [0,0,0,1,hhˆ3/6.];
mesh3 Th=tetg(Ths,switch="pqaAYY",regionlist=domaine);
fespace Xh(Th,P2);
real x0=-200,y0=0,z0=0;
func ball = sqrt((x-x0)ˆ2+(y-y0)ˆ2+(z-z0)ˆ2) <30;
macro Grad(u) [dx(u),dy(u),dz(u)] // EOM
Xh p,q;
solve laplace(p,q,solver=CG) =
int3d(Th)( ball
*
p
*
q+Grad(p)’
*
Grad(q) )
- int3d(Th) ( 1
*
q) ;
plot(p,fill=1,wait=1,value=0,nbiso=50); // see figure 1
The skin mesh of the 3d fish come from the url
. And the graphics solution of the
problem is 2d and 3d is display figure 2 and 1 respectively.
http://www-roc.inria.fr/gamma/download/counter.php?dir=FISH/
&get_obj=Y5177_Fish_cut.mesh&acces=Y5177_Fish

4 F. Hecht
Figure 1. 3d Poisson solution iso-surface Figure 2. 2d Poisson solution iso-value
3. Mesh adaptation
In FreeFem++ a lot of adaptation tools are implemented; this corresponding to the
work of many people [20,17,26,25,32,19,29,9,6].
All these tools are based a Delaunay-Voronoi algorithm with a distance (or Met-
ric) between two points q
1
,q
2
given by
p
t
(q
1
q
2
)M (q
1
q
2
) where the matrix
M is symmetric positive definite matrix field defined on the mesh T
h
. Consequently
the length `
M
of a curve γ for ]0,1[ R
d
with respect to M is
`
M
=
Z
1
0
p
t
γ
0
(t)M (γ(t))γ
0
(t)dt (3.1)
The computation of M can be implicit of explicit; the tools to compute M , in
isotropic cases are scalar fields h which represent the local mesh size such that
M =
1
h
2
I
d
, where I
d
is the identity matrix.
The idea is to build a meshes with edges of equal length with respect of M , i.e.
the length with respect to M of all the mesh edges should be closed to one so as
to get an equi-repartion of the error close to err in norm L
. So for P
1
continuous
finites elements, The metric can be defined by:
`
M
=
1
err
|
2
h
u
h
| (3.2)
where |
2
h
u
h
| =
q
(
2
h
u
h
)
2
and
2
h
u is an approximation of the Hessian matrix of
u
h
. FreeFem++ does it automatically by default with adaptmesh function (2d) ,
MetricPk (2d) , or with mshmet (2d) .
An example of L
error mesh adaptation with metric for the Poisson problem in
an L-shape domain =]0,1[
2
\[1/2,1[
2
. Find u H
1
() such that
u = (x y) in ,
u
n
n
n
= 0 on ;
Z
u = 0 (3.3)

Citations
More filters
Journal ArticleDOI

Topological defects in epithelia govern cell death and extrusion.

TL;DR: A mechanism for apoptotic cell extrusion is proposed: spontaneously formed topological defects in epithelia govern cell fate, and the ability to control extrusion hotspots by geometrically inducing defects through microcontact printing of patterned monolayers is demonstrated.
Journal ArticleDOI

Firedrake: Automating the Finite Element Method by Composing Abstractions

TL;DR: Firedrake as mentioned in this paper is a tool for automating the numerical solution of partial differential equations with a pure Python runtime-only implementation centered on the composition of existing and new abstractions for particular aspects of scientific computing.
Journal ArticleDOI

Firedrake: automating the finite element method by composing abstractions

TL;DR: Firedrake adopts the domain-specific language for the finite element method of the FEniCS project, but with a pure Python runtime-only implementation centred on the composition of several existing and new abstractions for particular aspects of scientific computing.
MonographDOI

An Introduction to Domain Decomposition Methods: Algorithms, Theory, and Parallel Implementation

TL;DR: The authors present all popular algorithms, both at the PDE level and at the discrete level in terms of matrices, along with systematic scripts for sequential implementation in a free open-source finite element package as well as some parallel scripts.
References
More filters
Journal ArticleDOI

On the implementation of an interior-point filter line-search algorithm for large-scale nonlinear programming

TL;DR: A comprehensive description of the primal-dual interior-point algorithm with a filter line-search method for nonlinear programming is provided, including the feasibility restoration phase for the filter method, second-order corrections, and inertia correction of the KKT matrix.
Journal ArticleDOI

Algorithm 832: UMFPACK V4.3---an unsymmetric-pattern multifrontal method

TL;DR: An ANSI C code for sparse LU factorization is presented that combines a column pre-ordering strategy with a right-looking unsymmetric-pattern multifrontal numerical factorization, and an upper bound on fill-in, work, and memory usage is computed.
Journal ArticleDOI

Hybrid scheduling for the parallel solution of linear systems

TL;DR: This work considers the problem of designing a dynamic scheduling strategy that takes into account both workload and memory information in the context of the parallel multifrontal factorization and shows that a new scheduling algorithm significantly improves both the memory behaviour and the factorization time.
Journal ArticleDOI

Optimized Schwarz Methods

TL;DR: This paper analyzes these new methods for symmetric positive definite problems and shows their relation to other modern domain decomposition methods like the new Finite Element Tearing and Interconnect (FETI) variants.
Journal ArticleDOI

Anisotropic unstructured mesh adaption for flow simulations

TL;DR: In this article, three new ideas for anisotropic adaption of unstructured triangular grids are presented, with particular emphasis on fluid flow computations, and they are used for a variety of applications.
Frequently Asked Questions (2)
Q1. What have the authors contributed in "New development in freefem++" ?

In three last sections, the authors present different problem, tools to illustrated the software. First the authors do mesh adaptation problem in two and three dimension,, secondly, they solve numerically a Phase change with Natural Convection, and the finally to show the HPC possibility they show a Schwarz Domain Decomposition problem on parallel computer. 

In the future the authors expect to include more tools for try dimensional mesh anisotropic meshes adaptive, automatic different ion by operator overloding, seamless integration of parallel tools to free the user off low level programming.