# EulerExplicitSolver

The EulerExplicitSolver component belongs to the category of integration schemes or ODE Solver. This scheme allows to solve dynamic systems explicitely: all forces will be computed based on the state information at the current time step .

Looking at continuum mechanics, the linear system arises from the dynamic equation. This dynamic is written as follows but other physics (like heat transfer) result in a similar equation:

where is the degrees of freedom, the mass matrix and a function of (and possibly its derivatives) acting on our system. In the case of the EulerExplicitSolver, this equation can be written:

since forces only depend on known state (at our current time step). These forces are computed by the ForceField in the `addForce()`

function. The system matrix is only equal to the mass matrix .

Depending on whether the mass matrix is diagonal or not, SOFA supports two cases:

- The mass matrix is diagonal. It makes the resolution of the linear system trivial (best performances). In this case, the system matrix equals a diagonal mass matrix which is diagonal and it can be stored as a vector . Moreover, its inverse can directly be obtained as: . The solution finally corresponds to a division operation of by the mass. This computation is actually performed by the Mass component in the
`accFromF()`

function. Therefore, no LinearSolver is needed to compute directly or iteratively a solution. - The mass matrix is not diagonal. Solving the system requires a linear solver.

## Sequence diagram

## Data

The data **symplectic** allows to modify the scheme to make it symplectic, i.e. velocities are updated before the positions. It allows to update the positions from the newly computed velocities, instead of velocities from the previous time step. This option makes the scheme more robust in time. EulerExplicitSolver is symplectic by default.

## Usage

The EulerExplicitSolver **requires** a MechanicalObject to store the state vectors. However, as explained above, no LinearSolver is needed and the EulerExplicitSolver is **only working using a UniformMass or DiagonalMass**, which ensures to have a diagonal system matrix.

## Example

This component is used as follows in XML format:

or using SofaPython3:

Examples of scenes involving a EulerExplicitSolver are available in *examples/Components/solver/EulerExplicitSolver*:

- EulerExplicitSolver.scn: non-symplectic and non-diagonal mass matrix
- EulerExplicitSolver_diagonal.scn: non-symplectic and diagonal mass matrix
- EulerSymplecticSolver.scn: symplectic and non-diagonal mass matrix
- EulerSymplecticSolver_diagonal.scn: symplectic and diagonal mass matrix

Last modified: 13 July 2021