Examples with Polyhedra¶
All the examples with polyhedra are in example/polyhedra/. Timings are given as an indication.
Example 1: Polyhedra generation frequency¶
100 new polyhedra are generated every 45,000 steps and fall into an empty domain. The example shows how to generate a lattice of polyhedra in a confined area, and how to initialize the fields of the newly generated polyhedra with a series of operators.
example/polyhedra/generator/generator.msp: 100, then 200 and 300 octahedra, 10,000 steps, 9.7 s on 8 cores
| Start | End |
|---|---|
![]() |
![]() |
Example 2: Octahedra in a rotating drum¶
125 octahedra fall into a rotating drum. The second case contains 27,000 octahedra (yellow) and 27,000 hexapods (blue).
example/polyhedra/rotating_drum/rotating-drum-mini.msp: 125 octahedra, 10,000 steps, 1 s on 8 coresexample/polyhedra/rotating_drum/rotating-drum-mixte.msp: 27,000 octahedra and 27,000 hexapods- 100,000 steps: 41 min 36 s on 8 cores; 6 min 31 s on an A100 with
rcut_inc = 0.4 - 200,000 steps: 11 min 24 s on an A100 with
rcut_inc = 0.4(the fall is costly: particles move quickly from one cell to another, and the neighbor lists are rebuilt on the CPU) - the pictures correspond to 1,000,000 steps
- 100,000 steps: 41 min 36 s on 8 cores; 6 min 31 s on an A100 with
example/polyhedra/rotating_drum/rotating-drum.msp: 5,520 octahedra, 150,000 steps, 2 min 19 s on 8 coresexample/polyhedra/rotating_drum/rotating-drum-mixte-mini.msp: 125 octahedra and 125 hexapods, 20,000 steps, 2.5 s on 8 cores
| Start | End |
|---|---|
![]() |
![]() |
![]() |
![]() |
Example 3: Hexapods in a ball¶
64 hexapods fall by gravity inside a large sphere of radius 20 centered at (2, 2, 0). On their way, they meet two spherical obstacles: a small yellow ball of radius 3 centered at (2, 2, -5), and a large orange ball of radius 7 centered at (2, 2, -20), which intersects the surface of the blue sphere. The example shows the interactions with several balls, and that drivers can be both boundary conditions and obstacles.
example/polyhedra/balls/balls.msp: 64 hexapods, 150,000 steps, 14.3 s on 8 cores (a 25,000-step version takes 2.7 s)
| Start | End |
|---|---|
![]() |
![]() |
Example 4: Polyhedra with an RShape driver (box)¶
Polyhedra (hexapods, octahedra, or both) fall by gravity into an open box made of an STL mesh until it is full.
example/polyhedra/stl_mesh/stl_mesh_box_hexapod.msp: 7,344 hexapods, 50,000 steps, 2 min 19 s on 8 coresexample/polyhedra/stl_mesh/stl_mesh_box_octahedron.msp: 2,430 octahedra, 50,000 steps, 1 min 6 s on 8 coresexample/polyhedra/stl_mesh/stl_mesh_box_mixte.msp: 5,760 octahedra and 5,760 hexapods, 100,000 steps, 8 min 36 s on 8 cores, 2 min 34 s on an A100 (rcut_inc = 0.2,cell_size = 6,grid_dims = [3,3,10])
These examples have minimal versions (_mini.msp).
| Start | End |
|---|---|
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
Example 5: Funnel¶
1.3 million hexapods fall by gravity into a funnel, a mesh of faces (RShape driver).
example/polyhedra/funnel/funnel.msp
Warning
This example is designed for a supercomputer or recent GPUs: do not run it on a laptop.
| Start | End |
|---|---|
![]() |
![]() |
![]() |
![]() |
Example 6: Rescale shape¶
Two shapes are selected, PolyR and Octahedron, and duplicated with a doubled size (PolyRSize2 and OctahedronSize2,
see read_shape_file). The particles are generated in a rotating drum with two methods, FCC
and RSA. The simulation runs 1,000,000 steps with \(dt = 5\cdot10^{-5}\).
example/polyhedra/rescale_shape/scale_2_shapes_fcc.msp: 2,144 polyhedra (536 of each type), 1 h 23 min on 12 coresexample/polyhedra/rescale_shape/scale_2_shapes_rsa.msp: 3,698 polyhedra, volume fraction 0.055 per type, 38 min on 12 cores
| Start | End |
|---|---|
![]() |
![]() |
![]() |
![]() |
Example 7: Fragmentation with two fragments¶
A grain made of two fragments (see Fragmentation) is projected at high speed onto a
rigid surface. In the first configuration, the grain stays intact because the breakage criterion, set by g, is not
reached. In the second one, a lower g leads to the failure of the interface between the fragments.
example/polyhedra/fragmentation/two_fragments_break.msp: breakage, 1,800,000 steps, 84 s on 1 coreexample/polyhedra/fragmentation/two_fragments_unbreak.msp: no breakage, 1,800,000 steps, 68 s on 1 core
| Start | End |
|---|---|
![]() |
![]() |
Example 8: Impact of a sphere¶
A high-speed projectile hits a wall of cubic particles linked by cohesive bonds (springs) between the vertices of their faces. The wall stands on a surface with a high friction coefficient, so that it does not slide, and the domain is periodic along the wall.
example/polyhedra/basic_shape/impact_with_frag.msp: 1,601 particles, 300,000 steps, 445 s on 12 cores
| Start | End |
|---|---|
![]() |
![]() |
Example 9: Tri-periodic compression¶
125 dodecahedra compressed by the barostat in a tri-periodic cell:
example/polyhedra/triperiodic_compression/triperiodic_compression.msp.

























