Ariane Robineau
Business developer at Qarnot, specialized in 3D rendering

# FreeFEM and the Finite Element Method on Qarnot

## December 6, 2019 - Numerical simulation

In this article, we’ll introduce FreeFem and the Finite Elements Method. If you’re a FreeFem and a FEM expert, you can jump directly to the Qarnot tutorial part of this article.

# FreeFem and the Finite Elements Method

FreeFem is an open source implementation of the GFEM (Generalized Finite Elements Method) that provides a simple way to solve Partial Differential Equations with automatized functions such as easy mesh generation. The project started in 1987 as MacFem/PCFem though it was rewritten in C++ and renamed FreeFem in 1992. It is now maintained by a team counting a dozen of individuals, and by the FreeFem community.

The Finite Elements Method (FEM), which FreeFem uses, is applied to a physical system by:

### Defining the problem’s variables

The FEM is a method that solves a physical problem on a given physical system. Physical laws (elasticity, electromagnetism, ...) are modeled by a continuous partial differential equations system (PDES) that  describes the whole system's physics. Those PDES are completed with boundary conditions modelizing the problem at the domain boundaries.

### Creating a mesh

This continuous complex system is discretized in small parts forming a mesh, each part called a finite element. Choosing the mesh size is essential as it will affect precision, errors and computing power needs.

### Applying the PDES to the mesh

With each finite element is associated a discretized partial differential equation system (representing the continuous system, adapted for discretized domains) that can be solved numerically. This system can be modeled by a matrix, each finite element's matrix can't be solved on its own as they are interdependent, but put together they form a matrix representing the complete system that can be solved using computers.

### Solving the matrix

The system is solved at the system mesh's nodes, meaning that the solution is not computed on each point of the system, only at the nodes hence “finite elements”. Interpolation, in particular polynomial interpolation, is used to solve the rest of the system. The FEM was originally used to solve mechanical problems such as stiffness analysis of aircraft structures behaviour, but its applications can be found in all areas of computational physics and engineering.