This repository is a fork of sand6 code including diphasic developments and other new features (collapses scenarios with a frictional door, hysteresis, python binding with pybind11,...).
This code has been developed and used for modelling experimental granular collapses for the article entitled: "Nonsmooth simulations of 3D Drucker-Prager granular flows and validation against experimental column collapses" by Gauthier Rousseau, Thibaut Métivet, Hugo Rousseau, Gilles Daviet, and Florence Bertails-Descoubes, 2022.
Python usage is explained after sand6 description in the python binding section.
A maintained version of sand6 is available on the gitlab Inria.
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 follows:
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 So-boguspython
python scripts, d6py package and pybind11 libraries
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 the 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
).
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:
- So-bogus, pybind11 and Eigen
- boost_serialization
- libQGLViewer (optional, required for the compilation of the OpenGL viewer)
The standard compilation procedure consists in typing the following commands from the archive's root directory
mkdir build
cd build
cmake ..
make
make install (optional for installing python binding)
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)
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
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
.
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
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
I0_start
=5e-3 Start Inertial number for the hysteresis rheologydelta_mu_start
=0.0 Satic friction coefficient increase mu+delta_mu_start is the friciton coefficient at I=0
A typical example of collapse scenario line is given by:
scenario collapselhedoor taudoor
: 0.13 veldoor
: 0.7 ts
: 0.20 frac_h
: 0.8 column_length
: 0.234 wsw
: 0.01 mud
: 0.23
-
taudoor
is the decay time andveldoor
is the door velocity a$t \rightarrow \infty$ such that the door velocity as a function of time is$U_d (t)=\text{veldoor}(1-\exp(-t/\text{taudoor}))$ -
frac_h
is the initial height occupied by the material over the box height -
mud
is the door friction -
wsw
are the side wall width
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
Providing make install
has been launched, a typical python script to run a scenario is performed as following:
import d6py
from d6py.d6python3D import * # python must be reload if d6python2D was imported
# from d6py.d6python2D import * # if 2D
d6run(d6OutFolder,configFile)
See run_and_analyse_collapse_example.py file for a simple example.
This software is distributed under the terms of the GNU General Public License Version 3.