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

November 01, 2024

Magnetohydrodynamic mixed convection of nanofluid flow in a split lid driven cavity using finite element method

Ankita Dubey, B. Vasu, R. Gorla, M. H. Borbora, A. Chamkha

A computational study on the effect of magnetohydrodynamic mixed convection of nanofluid flow in a square split lid driven cavity with a block placed near the bottom wall is undertaken. Two different nanoparticles gold and alumina are considered for the study. The observations for the study are obtained by solving the non-dimensionalized governing equations by Finite Element Method with variational approach as accessible with the FreeFEM++ software. The results for different Prandtl numbers ( Pr), Richardson number ( Ri), volume fractions of nanoparticles [Formula: see text], Reynolds number (Re), and MHD parameters (M) are displayed through graphs and figures. It has been observed that the pressure distribution significantly increases with the increment in Reynolds number but both the nanoparticles behave differently. The magnetic field enhancement ( M = 0.1, 0.2, 0.5 and 0.9) decreases the velocity within the cavity. The convective heat transfer is faster in the case of Reynolds number ( Re) = 100 than in the case of Reynolds number ( Re) = 14 or 21. And also increasing the Richardson Number from 0.1 to 1.0, the average Nusselt number shows increment of ∼9.5% and with Ri = 1.0 to 10.0, an increment of ∼3% whereas decrement with higher Reynolds Number ( Re = 21, 100) for Gold and Allumina nanoparticles respectively. The present simulations have various applications for the study of natural phenomenon like climate control, meteorological and geophysical activities and industrial applications like cooling of electronics equipment, heat exchanger.

October 22, 2024

Optimal Control of a Domestic Frost-Free Refrigerator Inlet Freezer from the Perspective of Reducing Energy Consumption

Nacer Sellila, Waleed Mouhali, M. Louaked, Houari Mechkour

This study is dedicated to the development of a mathematical model based on shape optimal control of the inlet domestic frost-free refrigerator in the context of energy consumption reduction. A three-dimensional thermofluid model is established for the numerical studies. As the physical system (with shelves and fruits) can be seen as a porous medium, the coupled state equations of the transport mechanism (for velocity and temperature fields) are governed by Navier–Stokes–Forchheimer/Fourier equations. Then, based on the finite element method, the numerical scheme computation is made with FreeFem++ software (Version 4.6). Numerical results are shown for three different cases: empty without shelves, empty with shelves, and loaded with foods. For each case, the velocity and temperature fields’ results are discussed for the optimal configurations. The characterization of these physical parameters would help engineers in domestic frost-free refrigerator design.

October 04, 2024

Far-field sound field estimation using robotized measurements and the boundary elements method

Caroline Pascal, Pierre Marchand, Alexandre Chapoutot, Olivier Doaré

Sound Field Estimation (SFE) is a numerical technique widely used to identify and reconstruct the acoustic fields radiated by unknown structures. In particular, SFE proves to be useful when data is only available close to the source, but information in the whole space is required. However, the practical implementation of this method is still hindered by two major drawbacks: the lack of efficient implementation of existing numerical methodologies, and the time-consuming and tedious roll-out of acoustic measurements. This paper aims to provide a solution to both issues. First, the measurements step is fully automated by using a robotic arm, able to accurately gather geometric and acoustic data without any human assistance. In this matter, a particular attention has been paid to the impact of the robot on the acoustic pressure measurements. The sound field prediction is then tackled using the Boundary Element Method (BEM), and implemented using the FreeFEM++ BEM library. Numerically simulated measurements have allowed us to assess the method accuracy, and the overall solution has been successfully tested using actual robotized measurements of an unknown loudspeaker.

August 07, 2024

Investigation of the Output Voltage of a Piezoresistive MEMS Pressure Sensor Using Finite Element Modelling

Yuqing Xia, Peng Zhou, Chunming Zhou, Yubao Zhen, Xiyao Du

In this paper, based on a 3D finite element model of a piezoresistive MEMS pressure sensor developed previously using FreeFem++, the output voltage of the device is calculated via three approaches. In the first approach, the output voltage is calculated using the widely used empirical formula for the Wheatstone bridge circuits, and thus, it is called the empirical result. In the second approach, firstly, the mean stresses are obtained within the four P-type resistors and the resistivity of the resistors is calculated using the constitutive relation of piezoresistivity. Then a steady state equation of the electric potential is solved and the electric potentials are extracted at the corner of the Cu interconnects. Thus, their difference yields the output voltage and it is called the semi-empirical result. However, within the resistors, the distribution of stresses are in fact quite inhomogeneous and thus their resistivity is also inhomogeneous. Hence, in the third approach, the resistivity of the four resistors are determined as functions of the stresses within the resistors using the constitutive relation of piezoresistivity. Then the electrical potential is also obtained numerically and the output voltages are extracted. The result obtained using the third approach is thus called the numerical result, which is the accurate output voltage of the pressure sensor determined numerically. During the simulations, the influences of different thicknesses of the silicon diaphragm, different widths of the P-type silicon resistor, and different distances between the center of the diaphragm and the midpoint of the P-type silicon resistor, are studied. The three results mentioned above are compared. Simulations show that the three results qualitatively agree with each other with the output voltage from the third approach being 30% higher. We argue, though the widely used empirical result leads to a less accurate output voltage, but it can still achieve the purpose of aiding the design of a piezoresistive MEMS pressure sensor satisfactorily.

July 16, 2024

AutoFreeFem: Automatic code generation with FreeFEM++ and LaTex output for shape and topology optimization of non-linear multi-physics problems

Gr'egoire Allaire, M. Gfrerer

For an educational purpose we develop the Python package AutoFreeFem which generates all ingredients for shape optimization with non-linear multi-physics in FreeFEM++ and also outputs the expressions for use in LaTex. As an input, the objective function and the weak form of the problem have to be specified only once. This ensures consistency between the simulation code and its documentation. In particular, AutoFreeFem provides the linearization of the state equation, the adjoint problem, the shape derivative, as well as a basic implementation of the level-set based mesh evolution method for shape optimization. For the computation of shape derivatives we utilize the mathematical Lagrangian approach for differentiating PDE-constrained shape functions. Differentiation is done symbolically using Sympy. In numerical experiments we verify the accuracy of the computed derivatives. Finally, we showcase the capabilities of AutoFreeFem by considering shape optimization of a non-linear diffusion problem, linear and non-linear elasticity problems, a thermo-elasticity problem and a fluid-structure interaction problem.

June 02, 2024

A Domain Decomposition Finite Element Method for the Magneto-Thermal Field Analysis of Electric Machines

Yunpeng Zhang, Jinpeng Cheng, Xinsheng Yang, Qibin Zhou, Weinong Fu

In this paper, a domain decomposition finite element method is proposed for the magneto-thermal field analysis of electric machines. 2-D and 3-D numerical models are built for the magnetic field and thermal field of electric machines, respectively. The computational domains of these two fields are decomposed into subdomains based on the discretized meshes to balance the computation work between processors. With the decomposed subdomains, the additive Schwarz method is developed to solve the forming numerical problems of these two fields using the open source platform freefem++, and a significant improvement in efficiency can be observed from the numerical results of single field analysis of a permanent magnet synchronous machine (PMSM). The coupling between these two fields is modelled with the electromagnetic losses and temperature dependent properties, and a two-step searching algorithm is developed for the data mapping between field solvers, which employ different dimensional models and inconsistent meshes. The counterpart subdomain is determined before searching the counterpart element to reduce the computation effort of searching. The magneto-thermal field analysis of the studied PMSM is finally conducted with the proposed method to showcase its effectiveness.

May 30, 2024

МІКРОСЕРВІСНА АРХІТЕКТУРА СИСТЕМ СКІНЧЕННО-ЕЛЕМЕНТНОГО АНАЛІЗУ

Я. В. Кривий, Антон Лісняк

У світі швидкого технологічного розвитку ефективність і гнучкість архітектур програмної інженерії відіграють ключову роль у створенні масштабованих і відмовостійких систем. Це набуває критичного значення для систем скінченно-елементного аналізу (FEA-систем), які використовуються для моделювання складних фізичних процесів в інженерії та часто повинні обробляти великі обсяги даних. Більшість сучасних FEA-систем використовують монолітну архітектуру – традиційну модель із єдиною кодовою базою для виконання різних функцій. Такий підхід має переваги, такі як єдине середовище розробки та легше налагодження взаємодії компонентів, і суттєві недоліки: складність масштабування, низьку відмовостійкість, погане балансування навантаження, зростання часу відповіді при збільшенні обсягів даних і складність впровадження нових функцій/технологій. Одним із можливих рішень є концепція мікросервісної архітектури, яка передбачає розбиття програмного забезпечення на невеликі незалежні компоненти (сервіси). Кожен сервіс виконує одну функцію і взаємодіє з іншими через чітко визначені інтерфейси. Оскільки вони працюють незалежно, їх можна оновлювати, змінювати, розгортати або масштабувати окремо. Це надає низку переваг: швидке розгортання, незалежність сервісів, гнучке окреме масштабування, стійкість до збоїв, технологічну гнучкість, кращу організацію та простоту тестування, переваги у хмарних середовищах. У статті порівнюються монолітні (Elmer FEM, FreeFEM), мікросервісні (SimScale) і хмарно-монолітні (ANSYS Cloud) FEA- системи за критеріями архітектури, масштабованості, відмовостійкості, розгортання та модифікації. Обґрунтовується перевага мікросервісного підходу та пропонується архітектура FEA-системи на основі патернів API Gateway, Aggregator, Database per Service, Event-Driven, Publisher/ Subscriber, Backend for Frontend.

May 15, 2024

Accurate 3D modeling of laser-matter interaction in the AFP process by a conductive-radiative FEM approach

Bruno A. Storti

Abstract. Mainly driven by aeronautical demands, the Automated Fiber Placement (AFP) process has become pivotal in the in-situ manufacturing of intricate, high-performance composite components. AFP relies on robotic systems to meticulously lay continuous fiber-reinforced materials, employing controlled pressure and precise laser heating. Accurate thermal modeling is imperative to predict thermal effects impacting contact, adhesion, crystallinity, and residual constraints. This work introduces a novel numerical approach for efficient modeling the transient heat transfers in the AFP process using a coupled conductive-radiative finite element method (FEM) scheme. Radiative density from the laser-matter interaction is determined through an in-house parallelized FreeFEM++ code. Heat transfer at the micro-scale is assessed by using an artificial computational geometry based on fiber distributions obtained from tape micrograph. A parametric study with varying absorption coefficients of the carbon fibers is performed to accurately compute the radiative volumetric heat source. The proposed approach investigates various 2D and 3D scenarios involving different laser parameters. Results exhibit strong agreement with experimentally obtained data, showing a maximum temperature difference of 5-6°C at the end of the heating phase. Furthermore, a 3D case demonstrates the potential of this approach for modeling complex micro-scale geometries.

April 02, 2024

Topology optimization of three-dimensional structures subject to self-weight loading

Jorge Morvan Marotte Luz Filho, Antonio Andre Novotny

PurposeTopology optimization of structures under self-weight loading is a challenging problem which has received increasing attention in the past years. The use of standard formulations based on compliance minimization under volume constraint suffers from numerous difficulties for self-weight dominant scenarios, such as non-monotonic behaviour of the compliance, possible unconstrained character of the optimum and parasitic effects for low densities in density-based approaches. This paper aims to propose an alternative approach for dealing with topology design optimization of structures into three spatial dimensions subject to self-weight loading.Design/methodology/approachIn order to overcome the above first two issues, a regularized formulation of the classical compliance minimization problem under volume constraint is adopted, which enjoys two important features: (a) it allows for imposing any feasible volume constraint and (b) the standard (original) formulation is recovered once the regularizing parameter vanishes. The resulting topology optimization problem is solved with the help of the topological derivative method, which naturally overcomes the above last issue since no intermediate densities (grey-scale) approach is necessary.FindingsA novel and simple approach for dealing with topology design optimization of structures into three spatial dimensions subject to self-weight loading is proposed. A set of benchmark examples is presented, showing not only the effectiveness of the proposed approach but also highlighting the role of the self-weight loading in the final design, which are: (1) a bridge structure is subject to pure self-weight loading; (2) a truss-like structure is submitted to an external horizontal force (free of self-weight loading) and also to the combination of self-weight and the external horizontal loading; and (3) a tower structure is under dominant self-weight loading.Originality/valueAn alternative regularized formulation of the compliance minimization problem that naturally overcomes the difficulties of dealing with self-weight dominant scenarios; a rigorous derivation of the associated topological derivative; computational aspects of a simple FreeFEM implementation; and three-dimensional numerical benchmarks of bridge, truss-like and tower structures.

March 29, 2024

Stationary Flow of Incompressible Viscous Fluid Through a Two-Dimensional Branched Channel

Elena V. Shiryaeva, Alina S. Shokareva, Valentina P. Sibil

The results of a numerical experiment for the problem of an incompressible viscous fluid stationary flow through a branched planar (two-dimensional) channel are presented. The region in which the flow occurs simulates either blood vessels or a river delta. The finite element method and a modification of the penalty method, as well as the splitting method, are used for calculations. The implementation of the calculation algorithm is using with the help the package FreeFem++. The main goal, in addition, of course, to study the properties and structure of the stationary flow, is to demonstrate the effectiveness of the proposed modification of the penalty method. It is assumed that the region has one input boundary section through which the liquid flows into the region, and several (five) boundary sections through which the liquid flows out of the region. The remaining sections of the region boundary are considered impermeable to liquid. The boundary condition corresponding to the Poiseuille flow in a plane rectilinear channel is set at the input section. Three types of boundary conditions are considered on the output boundary secctions. 1. The boundary conditions correspond to the conditions of conservation of motion of luid particles i. e. the material derivative of the velocity is zero. 2. The boundary conditions correspond to the setting of the flow velocity. 3. The boundary conditions correspond to the setting of the same pressure. The stationary solution is constructed by the relaxation method. In fact, a non-stationary problem is solved over a sufficiently large time interval. As an initial condition for a non-stationary problem, a flow is chosen that is a Poiseuille flow in some region near the input boundary. The dependence of the convergence rate of the relaxation method on the initial data is investigated. It is found that the Poiseuille flow, given at the input section of the boundary of the region, induces similar Poiseuille flows at the output boundaries sections of the region in all these cases of boundary conditions. For a region with five sections of the output boundaries for some configuration of the region, the presence of stationary vortex flows (‘maelstorm’) is found.

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 16th FreeFEM Days 2024 edition !
Paris, France

You are in good company

Sorbonne université INRIA ANR Genci CNRS