Sand6
(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:
- The original code used to produce the Siggraph paper: sand6-1.0.tar.gz
- The latest version of the code, with a few additional features: sand6-latest.tar.gz
Below is a short manual for the latter archive; feel free to contact us (first-name.last-name@inria.fr) for any further questions.
About
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.
Contents
This archive is organized as follow:
src
Source code of the shared libraryutils
Generic utilities (String and file manipulation, etc)geo
Geometric tools (Meshes, fields, tensors)solve
Tools for solving LCP and DCFPsimu
Generic MPM simulation toolsmono
Proper monophasic granular simulation implementationvisu
Tools for visualizing simulation resultsgl
OpenGL drawing code2d
and3d
Specialized code for each dimension
apps
Source code of individual applicationsscenes
Sample configuration filestests
Unit testscmake
CMake modulesvendor
(tarballs only) Copies of external header-only libraries, Eigen and So-bogus
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/Simu.cc
, and the specialization of he corresponding virtual methods in mono/MonoSimu.cc
.
Methods for reading data from particles, splitting, merging and moving them can be found in simu/DynParticles.cc
.
The code for computing the end-of-step velocities and stresses lies mostly inside
the PhaseSolver::solve()
function from the file mono/PhaseSolver.cc
.
Bindings for the external DCFP solver are in solve/FrictionSolver.cc
.
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
).
Usage
Building the software
Requirements
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:
- Eigen and So-bogus (which might already be included in distributed archives)
- boost_serialization
- libQGLViewer (optional, required for the compilation of the OpenGL viewer)
Compiling
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.
- DIM2=off Compile 2d code
- DG=off Use trilinear discontinuous stress shape functions
- UNSTRUCTURED=off Use particle-based stress shape functions
(By default, the code is built for 3d and uses trilinear continuous stress shape functions)
Applications
Successful compilation should generate the following binaries in the apps
subfolder of the build
directory:
d6
simulation toold62vtk
Transformd6
output to VTK files that can be read with e.g.paraview
d6gl
OpenGL viewer and rendering utility (requires libQGLViewer)d6_solvePrimal
offline DCFP solver, for benchmarking purposesd6_analyze
post-processing tool
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
fps
=240 s^{-1} Number of frames to be generated per SI secondssubsteps
=1 Number of simulation sub-steps per frame.0
means adaptive.nFrames
=1 Number of frames to generatebox
=(1,1,1) m Grid domainres
=(10,10,10) Number of grid cells for each dimensionnSamples
=2 Number of particles to generate per grid cell per dimensionrandomize
=0 Amount of random perturbation to add to initial particle positionsboundary
=cuve Boundary conditions ( stick, slip, ... ) presetscenario
=bed Scene configuration preset
Physical parameters
volMass
=1.5e3 kg.m^{-3} Volumetric mass density of the grainsviscosity
=1.e-3 Pa s Newtonian dynamic viscositygravity
=(0,0,-9.81) m^{-2} Acceleration due to gravityphiMax
= 1 Maximum volume fraction of grainsmu
=0 Grains friction coefficientdelta_mu
=0 Dynamic velocity increase for mu(I) rheologyI0
=0.4 Inertial number for mu(I) rheologygrainDiameter
=1.e-3 m Grain diameter for mu(I) rheologymuRigid
=0 Grain/body friction coefficientcohesion
=0 Pa Grain cohesioncohesion_decay
=0 Cohesion decay rate in shear flowsanisotropy
=0 Amount of friction anisotropyelongation
=0 Tendency of particles to align with flowbrownian
=0 Tendency of particles to return to isotropic orientationinitialOri
=(1/3,1/3,1/3) Initial eigenvalues of orientation tensor in grid-aligned basis
Miscellaneous
enforceMaxFrac
=false Perform geometric volume correction projectionusePG
=false Use a Projected-Gradient algorithm instead of Gauss-SeideluseInfNorm
=false Use the infinity-norm to evaluate the DCFP residualoutput
=true Output simulation states (field and particle data)dumpPrimalData
=0 If non-zero, dump every nth primal problems
License
This software is distributed under the terms of the GNU General Public License Version 3.