It's the simplest trick in the pantry - pour sugar into a jar, run out of space, then tap the jar on a table to pack it down so you can fit in the rest of the bag.

'Compaction dynamics', as this trick is called, has lots of uses in industrial settings, and physicists have long studied the best ways to pack various granular materials with the help of gravity. Now it turns out that the coolest material you can pack is dice - but with a slightly different method.

To investigate what happens to a granular material where all particles are identical cubes, a team of physicists from Spain and Mexico turned to plastic gaming dice. They acquired 25,000 of them - the regular kind with six numbers, half a centimetre (0.2 inches) wide on each side.

The team poured their dice in a translucent cylinder with a width of 8.7 cm (3.4 inches) and proceeded to rotate it back and forth about once per second in a movement they describe as a "twist".

Previous work has shown that this method is efficient for reorganising both elongated and 'platy' particles, the latter being a physicist's term for things that come in flakes.

As the dice were agitated in this manner, the researchers noticed the cubes would only move when the direction of the twist changed.

"Of note, the system is only perturbed when the angular velocity is inverted and the cubes remain at rest during the rest of the rotation cycle," the team writes in the study.

As one would expect, the cubes did start packing more closely together through the repeated twists, but not in the chaotic fashion that more irregularly-shaped particles would go through.

Instead, the dice arranged into tidy concentric rings, and the whole lot of them were neatly stacked after just 300,000 twists. The team repeated this with a smaller cylinder and observed the same phenomenon, which is just fascinating to watch. (You can find videos here if the gif below doesn't load.)

(Asencio et al., Phys Rev Lett 2017)

They also played around with the intensity of the twists by changing the speed of the rotation - the faster the cylinder was going, the bigger the jolt would be when the rotation switched.

As one would expect, the gentler the rotation shift, the longer it would take for the dice to pack in a neat fashion. In fact, at the lowest intensity the dice barely moved, and the researchers hypothesised that it would probably take "ten years of twisting" to reach the densest possible configuration for the dice.

So why do dice arrange themselves so neatly when repeatedly twisted? According to the team, it's inevitable that the flat surfaces on the dice will align with each other as the rotation pushes them outwards to the edges of the container under shear forces.

And they say that arranging cubes in this fashion is actually a lot more efficient than when we try to pack granular materials by tapping. That's because unless you tap in a specific way, the material will never properly settle into the densest possible arrangement.

Meanwhile, dice clearly love being twisted back and forth as long as you're not going super-slow.

"Indeed, contrary to the behaviour observed with the standard tapping protocol, the system reaches the same final state regardless of the excitation intensity (provided it is large enough)," they write.

Apart from just being a really cool thing to see in action, this dice trick could also be a stepping stone towards working with materials in places where the gravity assist from tapping a container is not an option - like space.

The team is currently preparing experiments for studying granular materials on the International Space Station, and honestly, we can't wait to see what they will come up with next.

The study was published in Physics Review Letters.