## Watch a Million Particles Collide

Article Updated: 30 Dec , 2015

by
Video

What happens when you give 1,000,000 particles their own gravity and spring repulsion and send them out to play? Watch the video above and find out.

This was created by David Moore, a self-taught computer programmer, aspiring physicist and student at San Diego Miramar College. It’s a custom code made with SDL/C++ and 8 days of render time. According to David there’s a bug at the end “where particles can get arbitrarily high energy… but before that it’s very physically accurate!”

It’s fascinating to watch the attraction process take place — one might envision a similar process occurring in the early Universe with the formation of the first galaxies and galactic clusters out of a hot, uniform state. Plus it’s great to see young talented minds like David’s working on such projects for fun!

There just might be hope for us after all.

Video by David Moore

Member
Zoutsteen
February 17, 2013 5:06 PM

interesting, now try it with an initial velocity vector for every partical going left to right. (not random). Pythagoras tells me its relevant.

Member
evanoc
February 18, 2013 10:00 PM

Lorentz tells me its irrelevant (http://en.wikipedia.org/wiki/Lorentz_invariance)

Member
Zoutsteen
February 18, 2013 11:20 PM

Peace to Lorentz, that dude is right with the math.

Lets test it out with 4 planets forming a square with a 10 light seconds to the side. With and without a velocity vector. And for testing’s sake, we stick the planets to their (relative)place with a skewer. (We’re only testing 1 variable.)

.

Without velocity after 5 seconds

Center of mass: center of square

.

With velocity after 5 seconds

Center of mass: …. very close to center of square. Just not quite.

Member
Bobr
February 17, 2013 5:24 PM

For me, it’s ideal to envision the very beginnings of a protoplanetary disk out of a nebula with this.
Excellent!

Member
Lawrence B. Crowell
February 17, 2013 5:35 PM

What is interesting is there seems to be something similar to a collective or statistical behavior similar to a phase change. At a certain point in this evolution there seems to be a sort of bubbling or bursting behavior. This seems to reflect something similar to a phase change from gas to liquid states. The bursting activity also seems to have similarities to latent heat.

LC

Guest
filledout
February 17, 2013 7:05 PM

Hardly remarkable, this is 2D & buggy. Self taught indeed.

Guest
February 17, 2013 10:49 PM

I’m surprised this is news. Any young programmer who is also interested in Physics has written something similar. I was around 16 I think.

Guest
David Moore
February 20, 2013 6:40 AM

It’s pretty basic, yeah, but, you’re aware it’s O(n log(n)), and not O(n^2), right? If you check my channel, you can see a similar simulation I made when I was 16. I only calculated collisions between two particles w/ momentum conservation, and this led to horrible bugs. I also used O(n^2), and so could only do on the order of 1,000 to 2,000 particles. Learning the ins and outs (OOP and quadtrees and using the force method instead of the method I just described) took a little longer

And, come on, eight days of computer time. About 10 GFLOPS processor, 8*24*3600 seconds, that’s a lot of floating point operations! Hell, I’d read a story just about that.

Guest
February 20, 2013 11:40 AM

How did you check for collisions.. on each ‘tick’ of the update/loop or a one that is independent of this?

Member
Dr. Morbius
February 17, 2013 6:45 PM

I wrote a program that does the exact same thing as his and it has the same problem with particles gaining energy when the density becomes too high. That’s what causes the explosion.

Member
Lawrence B. Crowell
February 18, 2013 4:45 PM

I have seen simulations of galaxy collisions run on supercomputers which have similar behavior. If the effect in this code is “real” then it should persist on various scales, such as the number of particles. This though does seem to be a point of controversy with this however.

LC

Member
Dr. Morbius
February 18, 2013 7:04 PM

The problem is with how the simulation works. It’s not emergent behavior. It’s caused by the simulation not being continuous. It’s not a bug in the code. If you decrease the size of the time step the simulation becomes more accurate, because the particles move slower, and the blobs grow larger before they explode but they still wind up exploding. The explosion happens in the core of the blobs where the pressure is highest and the particles get pushed so close together that the collision code tries to force them apart and the particles gain excess energy.

Guest
David Moore
February 20, 2013 6:48 AM
Actually, I thought this at first, but the timestep is really really small, and doesn’t account for the amount of energy gained. It’s actually because I calculated the collision physics pretty naively, as a “close enough” sort of thing. If a large number of particles are within colliding distance/really close together, sometimes the spring force between a pair isn’t calculated. Which one isn’t calculated is arbitrary (meaning, depends on the code), but it changes over time. So basically, a particle might not experience the repulsive force for several frames, so it ignores it, and when the repulsive force kicks back in again, it’s now further up in the spring’s potential! So it’s gained energy randomly, and the spring… Read more »
Member
February 18, 2013 2:02 PM

Interesting how mesoscale fluidic behavior kicks in (at clusters of some tens to hundreds of particles), then the macroscale fluidic behavior becomes visible.

one might envision a similar process occurring in the early Universe with the formation of the first galaxies and galactic clusters out of a hot, uniform state.

As I remember it, it is claimed that a problem with the big bang cosmologies was that they couldn’t predict large scale structures at all, or perhaps the kind we see. Of course all that changed with the inflationary cosmologies and their primordial fluctuations, as seen in the CMB remnants as well.

Guest
February 18, 2013 4:19 PM

it’s like coalescing dust particles

Guest
February 18, 2013 4:22 PM
I calculate the mass of a photon and written in my book Complete Unified Theory (pages – 424, 1998), Lot of application is there. One example is given here that in what way 1000000 photons make Planck constant? We know Planck constant = h / 2 Pi = 6.5821220 x 10^-16 ev-s. We can get this result as Planck Constant = (10^6 photons / root of 2) x energy of a photon = 6.583008021 x 10^-16 ev-s were, 2 = angular quantum number (j = l + ½, l = 0), similarly graviton particles acts to follow this rule. We know the gravitational force between nucleons is F = G mM / r^2 = 1.8667 x 10^-34 Newton,… Read more »
Member
bugzzz
February 18, 2013 6:08 PM

Very cool.

Member
skipdallas
February 18, 2013 6:30 PM

Mesmerizing, and very cool! Good work Mr. Moore!