This is mesmerizing science! The above GIF was generated from this DEM Research Group video, ‘Damage prediction on pears during transportation.’
The Discrete Element Method models the movement and interaction between solid individual particles. It does so by explicitly calculating the interaction forces between the indivdual particles using a contact model. This contact model translates the overlap (or strain) between two particles into a corresponding contact force. A famous contacctmodel is the Hertz model. All interaction forces on a single particle can be summed into a single force and moment working on the center of mass of that particle, and be translated into a translational and rotational acceleration. The acceleration is in turn integrated into a new velocity and finally a new position.
The DEM Research Group does a lot of amazing things in addition to discrete element simulations, including cell mechanics and liquid simulations! Check them out for a bunch of science and computer stuff that is a bit beyond my expertise! Super cool and fun science!