Discrete Element Modeling

I've always been interested in simulation, and one of the most accessible forms is discrete element modeling (DEM). A chance on-campus encounter led to a development collaboration with a DEM team at Purdue.
Springthing was developed during one of my last semesters at Purdue. I was playing with it there when a guy next to me mentioned that Professor Wassgren did DEM there. So I teamed up with him and produced a DEM solver capable of containing particles within a triangulated boundary of arbitrary dimension and complexity. Previously their team had used analytical representations of mixing aparatus surfaces, which limited the applicability of their tools.

I'm still working on this code, with a current focus on scalability and performance (both related to threading).

A design review document from the original project can be viewed here.
This is a full view with transparency of a fictitious pharma mixing vat system. Particles show velocity vectors and you can see each geometric entity that has been imported. Thousands of triagular faces, edges and vertices make up the bounding structure.

There is a receiving vat, feed tube, mixing drum, catch path and Archimedes screw feeder. Once particles fall out of the screw they are re-spawned above the receiving vat.

More recently I've been working on a box sorting algorithm. This is the system we see...
And this is the underlying system of boxes designed to reduce the problem from O(N^2) to O(N log N).
From another angle...
... many boxes.
The boxes are self-optimizing to minimize solve time as the solution progresses.

The optimization is very simple: if new box size is slower than previous, reverse box sizing direction, else keep going.

You might note that this logic has no "steady" condition - but it doesn't matter. The box size ends up oscillating tightly about an optimal size. Interestingly, the optimal box size is a function of the density of the particles.

An initial study showed that there was seemingly an optimal box size that was quite big.
However, a simple fixed box size doesn't work, because the density distribution of the particles can vary throughout the analysis.

A simple box size optimization algorithm was implemented:

// Reverse the search direction.
if (time_cycle2 - time_cycle1 / time_cycle1 > 0.02) 
	&& time_cycle2 < time_cycle1)
	boxSizeDelta *= -1.;
// If there is only one box, 1/4 the box dimension.
if (manyBoxes.boxes.size() < 2)
	boxSize /= 4;
// Adjust box size based on search direction
	boxSize *= (1 + boxSizeDelta);	
This resulted in a dynamic box size which tracked the needs of the current system by monitoring performance.
A video of some spheres bouncing around in a vat with texture mapping.
Another video of spheres bouncing around.

Some movies of initial development testing are below.
Other DEM-related work:

I began with the particle applet and then moved on to the SpringThing applet. A short-lived precursor to springthing was an adapted version of the particle applet called "flowthing."