FreeFEM
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)
    )
    -int3d(Th)(
          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.

Examples of Associated book:

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

With Qarnot's HPC platform, 7 lines of python code is all you need to run a FreeFEM simulation in the cloud. Learn how to run FreeFEM with Qarnot's sustainable HPC platform on Qarnot's blog.

FreeFEM is also available on Rescale's ScaleX® Pro. Rescale offers academic users up to 500 core hours on their HPC cloud.

Video tutorials

Thanks to Mojtaba Barzegari

Latest Articles

September 23, 2025

Mathematical Aspects of ANM/FEM Numerical Model, Applied to Nonlinear Elastic, and Thermo Elastic Analysis of Wrinkles in Film/Substrate Systems, and a New Implementation in the FreeFEM++ Language

Pascal Ventura, Frédéric Hecht, Michel Potier-Ferry, H. Zahrouni, Fan Xu, Hamza Azzayani, Michael Brun, Anh-Khoa Chau

The main purposes of the present paper are to present the mathematical and algorithmic aspects of the ANM/FEM numerical model and to show how it is applied to analyze elastic and thermo-elastic nonlinear solid mechanical problems. ANM is a robust continuation method based on a perturbation technique for solving nonlinear problems dependent on a loading parameter. Historically, this technique has been successfully applied to problems in various fields of solid and fluid mechanics. This paper shows how ANM is used to solve nonlinear elastic and nonlinear thermo-elastic problems involving elastic behavior and geometrical nonlinearities. The implementation of ANM for FEM in the FreeFEM++ language is then presented. The FEM software development platform, called FreeFEM++, is structured to work with variational formulations and, therefore, is well adapted to implement ANM for instability problems in solid mechanics. In order to illustrate the great efficiency of FreeFEM++, scripts will be presented for computing the different steps of ANM continuation for solid elastic structures, considering simple geometries subjected to conservative loading. For the purpose of validation, the problem of a cantilever subjected to an applied force is presented. Next, the new numerical model is applied to study wrinkles appearing in a planar film/substrate system that is subjected to compressive surface forces at the lateral faces of the film. Finally, the model is applied to a spherical film/substrate system subjected to thermo-elastic shrinkage. In both cases, the ANM/FEM prediction method, together with a Newton–Riks correction (if needed), identifies the equilibrium paths efficiently, especially after the post-buckling regime.

September 22, 2025

ff-bifbox: A scalable, open-source toolbox for bifurcation analysis of nonlinear PDEs

Christopher M. Douglas, Pierre Jolivet

Nonlinear PDEs give rise to complex dynamics that are often difficult to analyze in state space due to their relatively large numbers of degrees of freedom, ill-conditioned operators, and changing spatial and parameter resolution requirements. This work introduces ff-bifbox: a new open-source toolbox for performing numerical branch tracing, stability/bifurcation analysis, resolvent analysis, and time integration of large, time-dependent nonlinear PDEs discretized on adaptively refined meshes in two and three spatial dimensions. Spatial discretization is handled using finite elements in FreeFEM, with the discretized operators manipulated in a distributed framework via PETSc. Following a summary of the underlying theory and numerics, results from three examples are presented to validate the implementation and demonstrate its capabilities. The considered examples, which are provided with runnable ff-bifbox code, include: a 3-D Brusselator system, a 3-D plate buckling system, and a 2-D compressible Navier--Stokes system. In addition to reproducing results from prior studies, novel results are presented for each system.

September 15, 2025

MULTISCALE IN SILICO MODELS OF FRACTURE HEALING: PROVIDING AN INTEGRATIVE FRAMEWORK TO UNDERSTAND THE INFLUENCES OF DEFECT SIZE, SEX DIFFERENCES, AND INFLAMMATION

Laura Lafuente-Gracia, Mojtaba Barzegari, A. Carlier, L. Geris

Bone healing is a well-coordinated process involving numerous biological entities. While successful healing typically occurs within weeks, fracture severity, anatomical location and host factors can lead to delayed or non-healing. Critical-size defects require intervention to promote healing, with healing depending on the defect's location and its surroundings. Among host factors, the role of sex differences remains poorly understood, as most preclinical research has focused primarily on male subjects. Consequently, treatments may affect men and women differently. The use of (sex-specific) in silico models offers an interesting methodology to investigate the biological mechanisms underlying fracture healing and the influences of external factors, as well as to propose patient-specific treatment strategies.Following existing bioregulatory models we developed multiscale in silico models of bone healing to investigate normal and impaired sex-specific healing in long bone, mandibular and calvarial defects. These geometries were derived from in vivo experimental set-ups in rabbits and rodents. Our in silico models describe the spatiotemporal evolution of biochemical factors, cells and tissues, from the early inflammatory response to hard callus formation, incorporating sprouting angiogenesis with lateral inhibition of endothelial cells via Dll4-Notch1 signaling. The models were parameterized with sex-specific values informed by literature, focusing on young males and females of reproductive age. Finally, we explored the influence of a scaffold produced by melt electrowriting (MEW), coated (or not) with cells and/or growth factors (GF) as a treatment strategy. The models were implemented in MATLAB and FreeFEM and validated against in vivo data from the literature and in-house experiments.For normal healing in long bone defects, our model predicted a stronger inflammatory response in females and a stronger repair response in males, in alignment with literature data (results not shown). The predicted healing outcomes were similar between both sexes, matching experimental observations both qualitatively and quantitatively. For critical-sized craniofacial defects, our in silico predictions of a non-union matched the in vivo results at 4 and 12 weeks. We used our models to investigate adequate GF concentrations to load onto the MEW scaffold to achieve (delayed) healing.In summary, our in silico models predict realistic healing patterns that align with experimentally observed behavior, enhancing our understanding of bone defect healing mechanisms under different conditions, a first step towards the implementation of patient-specific in silico models of bone regeneration.

August 28, 2025

Assessment of the Runaway Electrons induced damage to the Tokamak First Wall

L. Singh, M. D. Bastiani, R. Bonifetto, F. Subba, D. Borgogno

The study assessed the damage caused by Runaway Electrons (RE) on First Wall tiles, comparing the effects on Beryllium and Tungsten. This was done by using realistic RE energy distribution functions to replicate RE impacts through the FLUKA code. These energy distribution functions are based on the ASDEX Upgrade experiment # 39012. The parametric analysis carried out with FLUKA in the presence of magnetic fields indicated a clear relationship between the beam impact angle and the material deposited energy, demonstrating that higher impact angles lead to deeper electron penetration and greater deposited energies. A finite element model based on apparent heat capacity formulation in FreeFem++ was developed to analyze the material thermal response to such thermal loads using volumetric energy density profiles from FLUKA simulations as input. Different RE current values were simulated to show its influence on the evolution of the material temperature and melting thickness

July 28, 2025

Some stochastic process techniques applied to deterministic models

E. J. 'Avila-Vales, J. Villa‐Morales

Stochastic mathematical models are essential tools for understanding and predicting complex phenomena. The purpose of this work is to study the exit times of a stochastic dynamical system-specifically, the mean exit time and the distribution of exit times of the stochastic process within a bounded domain. These quantities are obtained by solving elliptic and parabolic partial differential equations (PDEs), respectively. To support practical applications, we propose a numerical scheme implemented in FreeFEM, emphasizing its effectiveness in two- and three-dimensional cases due to the software's limitations in higher dimensions. The examples provided illustrate the theoretical results, which extend known one-dimensional solutions to higher-dimensional settings. This contribution bridges theoretical and computational approaches for analyzing stochastic processes in multidimensional domains, offering insights into their behavior and potential applications.

July 01, 2025

A Novel 3-D-Printed Passive Microfluidic Temperature Sensor for Medical Applications

Issam El Gmati, Yosra Gmati, W. Amara, Ridha Ghayoula, A. Smida, Mohammed Waly, J. Fattahi, Jamil Satouri

The electrical response of a novel passive 3-D-printed temperature sensor could significantly broaden its scope of applications and enhance the integration of microelectro-mechanical system (MEMS) microfluidic-based laboratory-on-a-chip (LOC) technologies. This article introduces an innovative temperature sensor based on the microfluidic technology which is well-suited for medical applications. The sensor’s design and optimization were conducted using multiphysics modeling and finite element method (FEM) simulations, implemented through FreeFEM++ software. Samples were produced using stereolithographic 3-D printing. A metal carrier was constructed to secure the chips during tank heating and the flow visualization with a microscope. X-ray microtomography tests were performed on chips to compare real parts with CAD models. Filling tests were conducted to position the liquid within the microfluidic channel. Furthermore, several types of liquids were tested, and contact angle (CA) measurements were employed to characterize the microfluidic chip’s structural material (DS3000) and various liquids, aiding in discerning the dielectric liquid were applied also. Among the liquids tested, water emerged as the most promising for this type of temperature sensor. Volume expansion calculations for different temperature values were performed, revealing a measured linear thermal expansion exceeding $40~\mu $ m/°C within the range of $20~^{\circ }$ C– $55~^{\circ }$ C. This study paves the way for microfluidic devices capable of measuring low flow rates using a temperature effect, thereby providing access to 16 an electrical response.

April 21, 2025

A Level Set Topology Optimization Theory Based on Hamilton's Principle

Jan Oellerich, T. Yamada

In this article, we propose a unified variational framework for deriving the evolution equation of the level set function in topology optimization, departing from conventional Hamilton–Jacobi‐based formulations. The key idea is the introduction of an auxiliary domain, geometrically identical to the physical design domain, occupied by fictitious matter which is dynamically excited by the conditions prevailing in the design domain. By assigning kinetic and potential energy to this matter and interpreting the level set function as the generalized coordinate to describe its deformation, the governing equation of motion is determined via Hamilton's principle, yielding a modified wave equation. Appropriate combinations of model parameters enable the recovery of classical physical behaviors, including the standard and biharmonic wave equations. The evolution problem is formulated in weak form using variational methods and implemented in the software environment FreeFEM++. The influence of the numerical parameters is analyzed on the example of minimum mean compliance. The results demonstrate that topological complexity and strut design can be effectively controlled by the respective parameters. Notably, the proposed formulation inherently supports the nucleation of new holes and maintains a well‐defined level set function without requiring explicit re‐initialization procedures, both of which emerge naturally from the physically motivated variational framework. The inclusion of a damping term further enhances numerical stability. To showcase the versatility and robustness of our method, we also apply it to compliant mechanism design and a bi‐objective optimization problem involving self‐weight and compliance minimization under local stress constraints.

February 22, 2025

Controle ótimo em equações de ondas via equilíbrios de Nash e Pareto

Pitágoras Pinheiro de Carvalho, Gildenia R. Sousa-Neto

The objective of this work is to making a theoretical and numerical study on bi-objective optimal control for the linear and semi-linear wave equations, via Nash and Pareto equilibrium strategies, in three-dimensional domains. Due to being related to an optimization process, we will use cost functional minimization, formulated in combination with some strategies related to Nash Equilibrium and Pareto Equilibrium. We will use the FreeFem++ software to transcribe the theoretical problems to the C++ programming language, describing the spatial discretization data through the Finite Element Method (FEM), and the discretization of its temporal evolution, with the Finite Difference Method.

January 01, 2025

Modelling Phase Change Material Solidification/Melting for Accurate Thermal Energy Storage Design in Refrigeration Applications

A. Ferraioli, Carotenuto Ternullo, A. Maiorino, F. Giannetti, C. Aprea

Phase Change Materials (PCMs) offer a promising solution for thermal energy storage (TES) in refrigeration, especially for critical applications like medicine and food preservation. This paper presents a new modelling approach to optimise PCM performance in cold storage systems. The research uses the Enthalpy-Porosity Model (EPM) to simulate PCM solidification and melting processes. This model offers a more accurate prediction than simpler methods and accounts for natural convection effects. The FreeFem++ toolbox and Galerkin method are employed for numerical solutions, enabling efficient parallel computing. By precisely modelling the phase change behaviour, the proposed method aids in designing high-efficiency and reliable cold storage systems with PCMs. This research contributes to advancements in PCM technology for sustainable refrigeration solutions.

December 22, 2024

Bounds for higher Steklov and mixed Steklov Neumann eigenvalues on domains with holes

Sagar Basak, Sheela Verma

In this article, we study Steklov eigenvalues and mixed Steklov Neumann eigenvalues on a smooth bounded domain in $\mathbb{R}^{n}$, $n \geq 2$, having a spherical hole. We focus on two main results related to Steklov eigenvalues. First, we obtain explicit expression for the second nonzero Steklov eigenvalue on concentric annular domain. Secondly, we derive a sharp upper bound of the first $n$ nonzero Steklov eigenvalues on a domain $\Omega \subset \mathbb{R}^{n}$ having symmetry of order $4$ and a ball removed from its center. This bound is given in terms of the corresponding Steklov eigenvalues on a concentric annular domain of the same volume as $\Omega$. Next, we consider the mixed Steklov Neumann eigenvalue problem on $4^{\text{th}}$ order symmetric domains in $\mathbb{R}^{n}$ having a spherical hole and obtain upper bound of the first $n$ nonzero eigenvalues. We also provide some examples to illustrate that symmetry assumption in our results is crucial. Finally, We make some numerical observations about these eigenvalues using FreeFEM++ and state them as conjectures.

Events

on last monday of the month

Open Visio discussion

with Zoom form 10h to 11h30h paris time see for detail?

12-13 DECEMBER 2024

FreeFEM Days

Save te date and joint us for the 17th FreeFEM Days 2025 edition !
Paris, France

You are in good company

Sorbonne université INRIA ANR Genci CNRS