Gas Universe Simulator

Mick West

Staff member
It's a fun little toy. One interesting thing was when using gasGravity, and the settings shown, then the blob of molecules would rotate, almost seeming to form spiral arms at one point.

On my Mac it works best on Safari, then on Firefox, and is slowest (by far) on Chrome.
A great fun little toy :) Which language did you use to write it?
Javascript, which isn't optimal of course, but is easiest to share. And it does 20,000 particles at 60 fps in Safari on my Mac, which is quite astounding.

Just added a "Pause" button, which lets you set things up better
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? .

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.

Hah, just spotted a bug:
if (d2>0) {
	var d = Math.sqrt(d2);
	dx /= d;
	dy /= d;
	var a = g / d2;
	p.vx += dx * g;
	p.vy += dy * g;
I thought the gas gravity was a bit boring, fix to come.
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)

Secondly: "multi-ton sections ejected laterally up to 600 feet". Discussed in this thread:

Both of which can be simulated with the addition of some rigid-body physics.
A salutary lesson as to how your empiricism and rational thinking can occasionally get the better of you, which is related to the exam question in #1 (why doesn't atmospheric gas fly off into space?).

I was talking to a good friend (a normally sane and sensible person) and she was berating the widespread use of helium in party balloons and for doing Mickey Mouse voices as we are losing the helium to outer space.

I thought this was probably nonsense as helium would not be able to escape gravity (other than through some cataclysmic explosive event or stellar wind or . . . something). And why would helium escape if hydrogen didn't.

My friend appears to be more sensible than I am and left me with egg on my face feeling very embarrassed when she sent me this:
Atmospheric escape of hydrogen on Earth is due to Jeans escape (~10 - 40%), charge exchange escape (~ 60 - 90%), and polar wind escape (~ 10 - 15%), currently losing about 3 kg/s of hydrogen. The Earth additionally loses approximately 50 g/s of helium primarily through polar wind escape. Escape of other atmospheric constituents is much smaller. A Japanese research team in 2017 found evidence of a small number of oxygen ions on the moon that came from the Earth.
Yes. There is a large “geocorona” of atomic hydrogen gas around the Earth extending quite far out from this escape. When I used to do ultraviolet astronomy we would always see this in resonant scattered sunlight in the hydrogen Lyman alpha line (121.6nm) whenever we looked anywhere that wasn’t down the shadow of the Earth.