Since SOFA is working a lot on solid mechanics, this introduction to physics integration using the FEM is applied on continuum mechanics.

# Conservation of linear momentum

The Newton’s second law gives:

the force corresponds to the integration of traction forces and the force corresponds to the body forces. With the Cauchy’s law and Gauss’s theorem, the conservation of linear momentum in the strong (or generalized) form is written:

where is the Cauchy’s stress tensor (as a reminder ), is the density of external forces (force per mass unit), is the mass density and is the acceleration of the body. The conservation of linear momentum equation relates the change of momentum (LHS inertia term) and the equilibrium equation (RHS with the internal and external forces), which must be solved at each time step.

In order to find a solution over the domain of simulation, we need to integrate this momentum equation. However, in much cases, no exact solution can directly be found. To ensure the existence of a solution, this strong form must be converted into a discrete problem, known as the weak or variational formulation. This is done by taking the product of a test function with the momentum equation and integrating over the current configuration. It is equivalent to formulating the problem to require a solution in the sense of a distribution. The test function is also known as weight function or basis functions, noted . Let denote the volume of our domain and *Γ* denote the surface of the domain, the weak form of the momentum equation becomes:

The divergence term can be split as follows:

where appear both a traction boundary condition and an interior traction condition, so that the equation is:

# FEM at a glance

Since no exact integration can be performed on a random domain *Ω*, the Finite Element Method (FEM) relies on the subdivision of the domain into sub-domains: the finite elements. Many different elements can be considered: quads, triangles, tetrahedra, hexahedra etc. The integration of any function *f* over the domain will therefore result in the sum of the integrals over each finite element (*E* being the total number of finite elements) so that:

The FEM will take advantage of the simple shape of these finite elements to compute these integrals. Within an element, any field like the displacement field *u* can be evaluated in any point *P(x)* as a linear combination of interpolation functions (called shape functions) and the values of this field at each vertex *i* of the element (*N* being the total number of vertices in one element):

The shape functions ensures the continuity of any field over the element. Each element type therefore has specific shape functions. In SOFA, linear interpolation functions are used in the open-source core. Note that higher order (non-linear) elements are available in a SOFA plugin: SofaHighOrder.

**Note**: the Galerkin-Ritz method, the test function corresponds to the shape function, noted . In SOFA, we rely here on this method.

The shape functions can be expressed with regards to local coordinates , corresponding to a reference configuration of the element. Even if the elements get distorted during the simulation, each element can always be mapped back to one common reference configuration with local coordinates , as shown in the figure below. In other words, for any point in space inside the element a corresponding point can be found in the reference space of the element .

Therefore, it always exists a transformation which can be defined as:

This transformation is bijective if the determinant of the Jacobian of the transmation is non-null . Moreover, the transformation will allow for the integration of the weak form by change of variables: instead of integrating over , the integration will be reported on the reference element .

#### Example

Let’s consider an example. A density of force that depends linearly on the coordinates : . The integration of this term can be done as follows:

For each finite element, the shape function is defined regarding the local coordinates . The expression of results from it. Finally, using a Gauss quadrature (or Gauss point integration), it is possible to find a numerical solution to this integral over the reference element.

# Integration of physics

In SOFA, the physics will be mainly implemented in Mass components and ForceField. You can have a look at the integration of:

- the mass in MeshMatrixMass
- the integration of linear elasticity in TetrahedronFEMForceField

Last modified: 30 September 2019