The problem starts with Brazil nuts. The large edible seeds are a common fixture in mixed nut bags, but they're not to everyone's liking - especially since they get dry and bitter once past the peak of freshness. And to make matters worse, they always rise to the top.

The phenomenon, colloquially known as the Brazil-nut effect, doesn't just affect your otherwise lovely bowl of cashews and peanuts, but has all kinds of implications in materials science. Now, for the first time, scientists have used time-resolved 3D imaging to demonstrate why things like these large nuts inevitably rise to the top.

Called granular convection, this effect also arises in other mixtures of solids, such as muesli or cereals with differently-sized pieces. Both scientists and preschoolers alike are well aware that shaking or vibrating a box of Lucky Charms will give you more delicious charms at the start, and more boring oat cereal at the end.

"Due to its popular appeal and critical importance to many industries, considerable work has been dedicated to investigating the Brazil-nut effect through simulations, modelling and experiments," the team wrote in their new paper.

However, they explain, "data on the motion of irregular particles is very limited and no one has been able to track their behavior over time in three dimensions."

To change this, the team used actual Brazil nuts and peanuts for the experiment.

Using something called a 'shearbox' to tussle a collection of Brazil nuts underneath delicious peanuts (we assume, we didn't eat them), they tracked the nut mixture using time-lapse X-ray computed tomography (CT).

After 45 tussling cycles (which the team calls a shear cycle) a few Brazil nuts started to reach the top of the mixture, and by the 135th shear cycle, their big heads had breached the surface.

"We have found that the Brazil nuts do not start to rise until they have first rotated sufficiently towards the vertical axis and then ultimately return to a flat orientation when they reach the surface," the team explains.

The team found that once the Brazil nuts had been shaken into the vertical position, it was easier for peanuts to travel down past them, pushing the Brazil nuts up like an unwitting crowd surfer.

However, not all Brazil nuts made it to the top of the pile, which the team thinks is due to not enough peanuts moving beneath, to help push the big lumbering nuts to the top.

At first, such research may seem a little unimportant with all the other things we have going on, but the team emphasizes that knowing how this works (and hopefully fixing it) has a myriad of applications.

"Our study highlights the important role of particle shape and orientation in segregation. Further, this ability to track the motion in 3D will pave the way for new experimental studies of segregating mixtures and will open the door to even more realistic simulations and powerful predictive models," lead author, University of Manchester materials scientist Parmesh Gajjar explains.

"This will allow us to better design industrial equipment to minimize size segregation thus leading to more uniform mixtures. This is critical to many industries, for instance ensuring an even distribution of active ingredients in medicinal tablets, but also in food processing, mining and construction."

The research has been published in Scientific Reports.