I plan to add walls (and hence containers). The video above was before I added the "floor" controls, and the ability to add and remove molecules with left and right clicking. (tip - set "Start Speed" to zero when adding).

Nice simulation Mick! I gave a quick glance at your code to see what you did. From what I understand you created a grid and calculated collisions/ gravity between particles found only in the same partition is that correct? I have created my own N-body code but it's a direct particle-particle method which is accurate but slow for a large number of particles (I use it to simulation the solar system). I'd like to try something on this scale sometime using a space partitioning method like this.

From what I understand you created a grid and calculated collisions/ gravity between particles found only in the same partition is that correct? .

Click to expand...

Only for the collisions, and it checks for collisions in the same partition (cell) and in the up, down, left, and right cells. It does not check diagonal cells, so occasionally misses a few (leading to temporary overlaps). It also only does a simple radius overlap check for collisions, so will also miss quite a few at higher speeds (not leading to overlaps). However that's acceptable for simulating gasses, as the individual collision are not each important, just that you get a bunch of them.

For gravity it does the full N*N calculations, which is why it's slow with lots of particles. The math is simpler though.

It occurs to me that (with much additional work) I can use this to demonstrate various aspects of 9/11. Two in particular:

Firstly: "squibs", where overpressure from the falling internal structure has blasted debris out of individual window openings. This is quite understandable in the normal model, but in the 9/11 Controlled Demolition model it is used as evidence of explosives. (The word "squib" does not mean anything like this, and has taken on an entirely new meaning in 9/11 culture)