Discrete Element Method
Discrete Element Method
Daniel Queteschiner*
Christoph Kloss**
*daniel.queteschiner@gmx.at
**christoph.kloss@cfdem.com
Discrete Element Method
Principles
• DEM manages information about each individual particle (mass, velocity, ...)
and the forces acting on it.
• Each particle is tracked in Lagrangian Frame, the force balance
..
mpxp = i Fi
• Gravity
v1 v2 v1 v2 v1 v2
Before impact
Hertz: Fn ~ 3/2k
v1* = -e v1 v2* = -e v2 Cundall & Strack (1979): Fn ~ k
At/During impact F F F F
• Respa
Verlet integration
which yields:
3. Derive a(t + t) from the interaction (e.g. particle collision force).
Integrators such as standard Runge-Kutta are not symplectic, and are thus
less frequently used for Molecular Dynamics / DEM.
Check all right and bottom neighbour cells of the cell a particle has its centre in.
Check all right and bottom neighbour cells of the cell a particle has its centre in.
Check all right and bottom neighbour cells of the cell a particle has its centre in.
Check all right and bottom neighbour cells of the cell a particle has its centre in.
Check all right and bottom neighbour cells of the cell a particle has its centre in.
Check all right and bottom neighbour cells of the cell a particle has its centre in.
• Collision detection is based on this list for the next NVerlet time-steps
(Walther, 2009)
NVerlet = c / (2 vmax t)
LIGGGHTS
LAMMPS Improved for General Granular and
Granular Heat Transfer Simulations
Daniel Queteschiner*
Christoph Kloss**
*daniel.queteschiner@gmx.at
**christoph.kloss@cfdem.com
The MD Code LAMMPS
LIGGGHTS
LAMMPS - Open Source MD + DEM
• LAMMPS =
Large Atomic and Molecular Massively Parallel Simulator
• It is very fast and also used on huge clusters (e.g. on Sandia Red Storm with 16k
Quadcore nodes, simulations with 2 billion particles performed)
Introduction to dynamical particle simulations www.cfdem.com 3
LIGGGHTS
Why take LAMMPS?
• Type
git clone git://cfdem.git.sourceforge.net/gitroot/cfdem/lpp
“Thermo” Info about time-step, number of particles in domain, translatory and rotational
energy, and total simulation box volume
Step Atoms KinEng 1 Volume
1 963 0.0391011 0 0.0015
1000 963 0.05064266 0 0.0015
2000 963 0.063711413 0 0.0015
3000 963 0.078296562 0 0.0015
4000 1800 0.13582887 0 0.0015
5000 1800 0.16448873 0 0.0015
5001 1800 0.16451881 0 0.0015
Loop time of 1.05419 on 1 procs for 5000 steps with 1800 atoms
Statistics – how much time was needed for which parts of the algorithms?
Pair time (%) = 0.218345 (20.712)
Neigh time (%) = 0.0682487 (6.47402)
Comm time (%) = 0.00209141 (0.198389)
Outpt time (%) = 0.0375419 (3.56119)
Other time (%) = 0.727967 (69.0543)
Statistics – how was the particle distribution and neighbor distribution among the processors
Nlocal: 1800 ave 1800 max 1800 min
Histogram: 1 0 0 0 0 0 0 0 0 0
Nghost: 0 ave 0 max 0 min
Histogram: 1 0 0 0 0 0 0 0 0 0
Neighs: 3623 ave 3623 max 3623 min
Histogram: 1 0 0 0 0 0 0 0 0 0
• Simulation setup
• Optimization loops
• Definition of variables
• An & at the end of a line means that the command continues on the next line
• The first word is the command name, the rest are arguments
Introduction to dynamical particle simulations www.cfdem.com 13
LIGGGHTS
Input Script Structure
A LIGGGHTS input script typically has 4 parts
• Initialization
• Atom definition
• Settings
• Run a simulation
The last 2 parts can be repeated as many times as desired, i.e. run a simulation,
change some settings, run some more, etc.
atom_style granular
atom_modify map array
boundary f f f
newton off
units si
region domain block -0.5 0.1 -0.2 0.2 -0.4 0.15 units box
create_box 1 domain
units si
region domain block -0.5 0.1 -0.2 0.2 -0.4 0.15 units box
create_box 1 domain
units si
region domain block -0.5 0.1 -0.2 0.2 -0.4 0.15 units box
create_box 1 domain
units si
region domain block -0.5 0.1 -0.2 0.2 -0.4 0.15 units box
create_box 1 domain
#pair style
pair_style gran/hertz/history
pair_coeff * *
timestep 0.00001
#pair style
pair_style gran/hertz/history
pair_coeff * *
timestep 0.00001
#pair style
Define the model to be used for pairwise
pair_style gran/hertz/history interaction; pair_coeff statements can be
pair_coeff * * used to describe different interactions
between different particle types
timestep 0.00001
#pair style
Define the model to be used for pairwise
pair_style gran/hertz/history interaction; pair_coeff statements can be
pair_coeff * * used to describe different interactions
between different particle types
timestep 0.00001
command name
#pair style
Define the model to be used for pairwise
pair_style gran/hertz/history interaction; pair_coeff statements can be
pair_coeff * * used to describe different interactions
between different particle types
timestep 0.00001
command ID
#pair style
Define the model to be used for pairwise
pair_style gran/hertz/history interaction; pair_coeff statements can be
pair_coeff * * used to describe different interactions
between different particle types
timestep 0.00001
group ID
#pair style
Define the model to be used for pairwise
pair_style gran/hertz/history interaction; pair_coeff statements can be
pair_coeff * * used to describe different interactions
between different particle types
timestep 0.00001
fix style
#the chute
fix cad all mesh/surface/stress file simple_chute.stl type 1 wear finnie
fix inface all mesh/surface file insertion_face.stl type 1
fix granwalls all wall/gran/hertz/history mesh n_meshes 1 meshes cad
#particle insertion
fix ins all insert/stream seed 5330 distributiontemplate pdd1 &
nparticles 6000 massrate 0.1 insert_every 1000 overlapcheck yes &
all_in no vel constant 0.0 0.0 -1.0 insertion_face inface
#particle insertion
fix ins all insert/stream seed 5330 distributiontemplate pdd1 &
nparticles 6000 massrate 0.1 insert_every 1000 overlapcheck yes &
all_in no vel constant 0.0 0.0 -1.0 insertion_face inface
#the chute
fix cad all mesh/surface/stress file simple_chute.stl type 1 wear finnie
fix inface all mesh/surface file insertion_face.stl type 1
fix granwalls all wall/gran/hertz/history mesh n_meshes 1 meshes cad
Geometry actually used as wall
#particle distributions for insertion
fix pts1 all particletemplate/sphere 1 atom_type 1 density constant 2500 &
radius constant 0.0015
fix pts2 all particletemplate/sphere 1 atom_type 1 density constant 2500 &
radius constant 0.0025
fix pdd1 all particledistribution/discrete 1 2 pts1 0.3 pts2 0.7
#particle insertion
fix ins all insert/stream seed 5330 distributiontemplate pdd1 &
nparticles 6000 massrate 0.1 insert_every 1000 overlapcheck yes &
all_in no vel constant 0.0 0.0 -1.0 insertion_face inface
#the chute
fix cad all mesh/surface/stress file simple_chute.stl type 1 wear finnie
fix inface all mesh/surface file insertion_face.stl type 1
fix granwalls all wall/gran/hertz/history mesh n_meshes 1 meshes cad
Geometry actually used as wall
#particle distributions for insertion
fix pts1 all particletemplate/sphere 1 atom_type 1 density constant 2500 &
radius constant 0.0015
fix pts2 all particletemplate/sphere 1 atom_type 1 density constant 2500 &
radius constant 0.0025
fix pdd1 all particledistribution/discrete 1 2 pts1 0.3 pts2 0.7
#particle insertion
fix ins all insert/stream seed 5330 distributiontemplate pdd1 &
nparticles 6000 massrate 0.1 insert_every 1000 overlapcheck yes &
all_in no vel constant 0.0 0.0 -1.0 insertion_face inface
#the chute
fix cad all mesh/surface/stress file simple_chute.stl type 1 wear finnie
fix inface all mesh/surface file insertion_face.stl type 1
fix granwalls all wall/gran/hertz/history mesh n_meshes 1 meshes cad
Geometry actually used as wall
#particle distributions for insertion
fix pts1 all particletemplate/sphere 1 atom_type 1 density constant 2500 &
radius constant 0.0015
fix pts2 all particletemplate/sphere 1 atom_type 1 density constant 2500 &
radius constant 0.0025
fix pdd1 all particledistribution/discrete 1 2 pts1 0.3 pts2 0.7
#particle insertion
fix ins all insert/stream seed 5330 distributiontemplate pdd1 &
nparticles 6000 massrate 0.1 insert_every 1000 overlapcheck yes &
all_in no vel constant 0.0 0.0 -1.0 insertion_face inface
#run simulation
run 100000 upto
write_restart restart/chute.restart
#run simulation
run 100000 upto
write_restart restart/chute.restart
#run simulation
run 100000 upto
write_restart restart/chute.restart
#run simulation
run 100000 upto
write_restart restart/chute.restart
#run simulation
run 100000 upto
write_restart restart/chute.restart
#run simulation
run 100000 upto
write_restart restart/chute.restart
write_restart restart/chute.restart
www.cfdem.com | www.particulate-flow.at
christoph.kloss@cfdem.com
Introduction to Dynamical Particle Simulations
Extending LIGGGHTS
How to modify LIGGGHTS for your own needs
Daniel Queteschiner*
Christoph Kloss**
*daniel.queteschiner@gmx.at
**christoph.kloss@cfdem.com
Extending LIGGGHTS
General Hints and Guidelines
Pair Styles
pair-wise (particle-particle) interaction
Computes
mainly used for diagnostics and to gather data for post-processing
Fixes
a “fix” is an operation that is applied to the system during timestepping, e.g.,
time integration, applying constraint forces to atoms, enforcing boundary
conditions, computing diagnostics
Identify any existing mechanism in LIGGGHTS to compute per atom variables, e.g.
Intermediate step: read velocity field in physical space from formatted file
Intermediate step: read velocity field in physical space from unformatted file
Read ft12 files and transform data into velocity field in physical space
Multidimensional Arrays
• Indexing starts with 1 (Fortran) or 0 (C++)
(source of off-by-one errors)
• No negative indexes in C++ (e.g. bordering of grid for interpolation)
• Storage:
• Column-major order vs. Row-major order
INTEGER A(2,3) A(1,1) A(2,1) A(1,2) A(2,2) A(1,3) A(2,3)
int a[2][3]; a[0][0] a[0][1] a[0][2] a[1][0] a[1][1] a[1][2]
• Ensure contiguous memory in C++ (array of arrays vs. array of pointers; MPI)
• Redimensioning
www.cfdem.com | www.particulate-flow.at
christoph.kloss@cfdem.com