## Fine Scale Model for the Grains

The main attribute of the solid granular phase is its incompressibility. Indeed, the particles fill a compact and closed volume in space and, although they can deform a bit, they are not able to interpenetrate. Plus, the geometrical microscopic configuration of the granular matrix greatly affects the macroscopic behaviour of the medium: a few grains clog can prevent the whole material from flowing. The granular phase is thus solved with a *Discrete Element Method* that tracks the positions and velocities of the grains in a Lagrangian way.

First, the free velocities of the grains are computed from Newton’s second law, given the external forces acting on the grains such as gravity or drag from the fluid. Second, the collisions between the grains are solved using the *Nonsmooth Contact Dynamics*. This implicit method solves all contacts over the time step at once with a *Non Linear Gauss Seidel* iterative procedure : all contacts are solved after each other over and over again until convergence is reached. The MigFlow software makes use of a queue to speed-up this iterative process. The resolution of a contact is based on a momentum balance so that grain interpenetration is prevented. Friction is taken into account with a Coulomb law. The main advantages of NSCD over smooth DEM are a larger time step and a better incompressibility. With this resolution of the granular phase, it is possible to obtain the force network between the grains as well as the stress tensor inside them.