3375 small cubes, placed on a grid with random orientations, fall into a box
of 25 cm. Nothing is written by hand: the shapes, the walls, the cubes and the
whole input file are produced by the application generator, from short
command files.
- The application
generatorand its commandsgenerateShape:...,generatePacking:...(generator). - Its commands
open,print,closeandParticles:placeHolder, which write a complete input file. - Several shape files, or several pieces of an input file, put together.
| File | Content |
|---|---|
genCube.txt |
Command of generator that writes the shape of a cube |
genBox.txt |
Command that writes the shapes of the walls of a box |
genPacking.txt |
Commands that place the 6 walls and the 3375 cubes |
input_head.txt |
The beginning of the input file, without the particles |
genAll.txt |
All of the above in a single command file |
Either step by step:
generator genCube.txt > shapes.txt
generator genBox.txt >> shapes.txt
generator genPacking.txt > sample.txt
sed 's/^Particles XXXX/Particles 3381/' input_head.txt > input.txt
cat sample.txt >> input.txt
rockable input.txt -j 4 # about 15 minutes on one thread, less with -j 4
seeor all at once:
generator genAll.txt # writes shapes.txt and input.txt
rockable input.txt -j 4The cube. genCube.txt holds a single command:
generateShape:cube Cube 0.0005 0.01
a cube named Cube, of side 1 cm (the outer size, the rounding included),
with a Minkowski radius of 0.5 mm. generator writes the shape on its
standard output, with its volume and inertia (preCompDone y).
The walls. genBox.txt,
generateShape:xyz_walls 0.25 0.25 0.25 0.0005
writes three wall shapes, x-wall, y-wall and z-wall, normal to x, y
and z, for a box of 25 cm, with a radius (half-thickness) of 0.5 mm. >>
appends them to shapes.txt.
The packing. genPacking.txt holds two commands, whose arguments are
given on the following lines:
generatePacking:wallBox
1 group of the walls
0.25 0.25 0.25 inner size of the box
0.0005 half-thickness (the radius of the wall shapes)
generatePacking:grid
Cube shape
0 0 0 corner of the grid
0.25 0.25 0.25 size of the grid
15 15 15 number of particles along x, y, z
0 group
0 cluster
1.0 homothety
1 1: random orientations, 0: all aligned
The six walls come first: with nDriven 6, they are the driven bodies, and
since nothing drives them, they stay fixed. The cubes, on a grid of
15 × 15 × 15, are 1.67 cm apart. generator tells how many bodies each command
added (on the error output, so that it does not end up in the file):
@generatePacking:wallBox, Number of added bodies: 6
@generatePacking:grid, Number of added bodies: 3375
The input file. input_head.txt holds the parameters of the computation
and ends with Particles XXXX: sed puts the number of particles, 3381, in
its place, and the lines of sample.txt are appended.
All at once. genAll.txt does the same in a single file. open shapes.txt
sends what follows into shapes.txt until close; print writes a line as it
is; Particles:placeHolder writes Particles and leaves room for the number,
which generator fills in at close with the count of the particles added in
between.
The computation. There is no gravity line: the default gravity,
(0, -9.81, 0), applies. The cubes fall, pile up at the bottom of the box,
and are at rest from about t = 0.5 s. With 3375 particles, the computation
takes about 15 minutes on one thread; -j 4 runs it on 4 threads.
-
In
see, the keydhides the walls. -
The kinetic energy,
kineticEnergy.txt, which drops once the cubes are piled up:gnuplot -p -e "set logscale y; plot 'kineticEnergy.txt' using 1:2 with lines title 'translation'" -
shapes.txt: the shapes written bygenerator.
- Replace the cube by an elongated cuboid:
generateShape:cuboid Cube 0.0005 0.015 0.005 0.005(the name is kept, so that nothing else has to change). - Put fewer cubes, aligned (
5 5 5and a last0ingeneratePacking:grid). The number of particles is then 131: change it in the commandsed, or usegenAll.txt, which counts them. - Make the box twice as high:
0.25 0.5 0.25ingenBox.txt, and for the size of the box and of the grid ingenPacking.txt. - Look at the other commands of
generator(spheres, polyhedra, random close packings, transformations) on the page generator.
DominoFun: a whole system written bygenerator, with clusters of glued particles.- The C++ functions behind
generator, inprepro/genesis/cpptools, can be used directly in a program.
