(granular simulation software)

This page is about the source code associated to the continuum simulation method for granular materials described in the article: A Semi-Implicit Material Point Method for the Continuum Simulation of Granular Materials by Gilles Daviet and Florence Bertails-Descoubes (Proceedings of the ACM SIGGRAPH 2016 Conference).

You may want to check out:

Below is a short manual for the latter archive; feel free to contact us ( for any further questions.



This software contains a C++ implementation of the algorithms described in the document A Semi-Implicit Material Point Method for the Continuum Simulation of Granular Materials.


This archive is organized as follow:

Relevant files

At this stage, the documentation is still very scarce; however, sections that are the most relevant to the article have been more thoroughly annotated.

The reader interested in the implementation of the main simulation loop should start with the method Simulation::step() defined in the file src/simu/, and the specialization of he corresponding virtual methods in mono/ Methods for reading data from particles, splitting, merging and moving them can be found in simu/ The code for computing the end-of-step velocities and stresses lies mostly inside the PhaseSolver::solve() function from the file mono/ Bindings for the external DCFP solver are in solve/

Concerning the geo library, shape functions derive from the ShapeFunctionBase class and are used to define scalar, vector and tensor fields deriving from FieldBase. The two main classes of shape functions are UnstructuredShapeFunction, which is particle-based, and the subclasses of MeshShapeFunction (e.g. Linear), which define Lagrange polynomials on implementations of MeshBase (e.g. Grid).


Building the software


Building this software requires CMake and a C++11 compiler, and has only be tested on GNU/Linux with recent versions of g++ and clang++.

Other dependencies are:


The standard compilation procedure consists in typing the following commands from the archive's root directory

> mkdir build
> cd build
> cmake ..
> make
> ./tests/testd6

Configuration options

A few configuration options may be defined at compile time as cmake arguments, using the syntax cmake .. -D{NAME}={VALUE}. Defaults are given in italics.

(By default, the code is built for 3d and uses trilinear continuous stress shape functions)


Successful compilation should generate the following binaries in the apps subfolder of the build directory:

Usage information for these applications can be obtained with the -? flag.

In a typical workflow, the simulator would be run by typing e.g.

> ./apps/d6 -i ../scenes/collapse.conf

This creates an 'out' directory, with one subdirectory per simulation frame. If the d6gl application was compiled, it can be used to visualize the results:

> ./apps/d6gl
> ./apps/d6gl -s 16 -g .2    #Render grain samples instead of particules

Pressing 'H' inside the viewer triggers an help window listing libQGLViewer mouse and keyboard commands. A useful yet unintuitive shortcut is the 'double-middle-click' which centers the scene.

Configuration fields

Here is a list of the various configuration options that can be passed to the d6 application, with their default values. Configuration files corresponding to the simulations presented in the article are also provided in the scenes directory, and can be used as e.g. ./apps/d6 -i ../scenes/scene_file.conf.

Simulation size and resolution

Physical parameters



This software is distributed under the terms of the GNU General Public License Version 3.