load "msh3"

// Parameters
int nn = 20; // Mesh quality

// Mesh
int[int] labs = [1, 2, 2, 1, 1, 2]; // Label numbering
mesh3 Th = cube(nn, nn, nn, label=labs);
// Remove the ]0.5,1[^3 domain of the cube
Th = trunc(Th, (x < 0.5) | (y < 0.5) | (z < 0.5), label=1);

// Fespace
fespace Vh(Th, P1);
Vh u, v;

// Macro
macro Grad(u) [dx(u), dy(u), dz(u)] //

// Define the weak form and solve
solve Poisson(u, v, solver=CG)
    = int3d(Th)(
          Grad(u)' * Grad(v)
          1 * v
    + on(1, u=0)

// Plot
plot(u, nbiso=15);

A high level multiphysics finite element software

FreeFEM offers a fast interpolation algorithm and a language for the manipulation of data on multiple meshes.

Easy to use PDE solver

FreeFEM is a popular 2D and 3D partial differential equations (PDE) solver used by thousands of researchers across the world.

It allows you to easily implement your own physics modules using the provided FreeFEM language. FreeFEM offers a large list of finite elements, like the Lagrange, Taylor-Hood, etc., usable in the continuous and discontinuous Galerkin method framework.

Pre-built physics

Strong mesh and parallel capabilities

FreeFEM has it own internal mesher, called BAMG, and is compatible with the best open-source mesh and visualization software like Tetgen, Gmsh, Mmg and ParaView.

Written in C++ to optimize for speed, FreeFEM is interfaced with the popular mumps, PETSc and HPDDM solvers.

HPC in the cloud integration

7 lines of python code and a Qarnot Computing Logo account is all you need to run a FreeFEM simulation in the cloud.

Thanks to a partnership with Qarnot's advanced HPC platform, you won't have to worry about deploying FreeFEM on the cloud, everything is automated.

Learn how to run FreeFEM with Qarnot's sustainable HPC platform on Qarnot's blog.

Latest Articles

March 30, 2020 | Florian Feppon, Grégoire Allaire, Charles Dapogny, Pierre Jolivet

Topology optimization of thermal fluid-structure systems using body-fitted meshes and parallel computing

An efficient framework is described for the shape and topology optimization of realistic three-dimensional, weakly-coupled fluid-thermal-mechanical systems. At the theoretical level, the proposed methodology relies on the boundary variation of Hadamard for describing the sensitivity of functions with respect to the domain. From the numerical point of view, three key ingredients are used: (i) a level set based mesh evolution method allowing to describe large deformations of the shape while maintaining an adapted, high-quality mesh of the latter at every stage of the optimization process; (ii) an efficient constrained optimization algorithm which is very well adapted to the infinite-dimensional shape optimization context; (iii) efficient preconditioning techniques for the solution of large finite element systems in a reasonable computational time. The performance of our strategy is illustrated with two examples of coupled physics: respectively fluid-structure interaction and convective heat transfer. Before that, we perform three other test cases, involving a single physics (structural, thermal and aerodynamic design), for comparison purposes and for assessing our various tools: in particular, they prove the ability of the mesh evolution technique to capture very thin bodies or shells in 3D.

December 13, 2019 | Lèye Babacar, Tine Léon Matar, Sy Mamadou

Optimal Control of Thermal Pollution Emitted by Power Plants

The coastal areas near thermal or nuclear plants are subject to hot water discharges produced by cooling processes. These activities induce an increase of the temperature near the outlet vicinity, which can extend for miles. The temperature variation affects the metabolic rate of organisms and the level of dissolved oxygen. Cooling by cold water from an additional discharge can be considered in order to limit this thermal pollution. This paper present a methodology based on the implementation of a two-dimensional numerical model to study the dynamic of the temperature originated from the industrial discharges. Moreover the optimal injection rate of cold water is sought to keep the water temperature as close as possible to the survival of the ecosystem. Numerical simulations are performed to illustrate the efficiency approach.

December 12, 2019 | Niall Bootland, Victorita Dolean

On the Dirichlet-to-Neumann coarse space for solving the Helmholtz problem using domain decomposition

We examine the use of the Dirichlet-to-Neumann coarse space within an additive Schwarz method to solve the Helmholtz equation in 2D. In particular, we focus on the selection of how many eigenfunctions should go into the coarse space. We find that wave number independent convergence of a preconditioned iterative method can be achieved in certain special cases with an appropriate and novel choice of threshold in the selection criteria. However, this property is lost in a more general setting, including the heterogeneous problem. Nonetheless, the approach converges in a small number of iterations for the homogeneous problem even for relatively large wave numbers and is robust to the number of subdomains used.


11-13 MAY 2020


Des outils libres et puissants de prototypage pour la simulation multiphysique avec freefem++!
Paris, France

17-19 DECEMBER 2019

FreeFEM Days

Join us for the FreeFEM Days 2019 edition !
Paris, France

16-20 SEPTEMBER 2019


Workshop - Parallel Solution Methods for Systems Arising from PDE!
Marseille, France

You are in good company

Sorbonne université INRIA ANR Genci CNRS