A simulation of an Atmosphere

Up a level : Thermodynamics
Previous page : A simple Gas simulation
Next page : Colliding non-rotating balls in 2D

On this page, you can see a simulation of an atmosphere. In the next few pages, you will find a more detailed explanation of the program.

Initially, all molecules are confined to the lower part of the simulated atmosphere, and you can reset the simulation to that state by clicking on the restart button below the rectangle surrounding the simulated atmosphere. That would be like releasing a lid over a contained gas.

This simulation was done because it is fun to do, but also to illustrate the answer to a question:

How come we can have a gas, an atmosphere, next to the vacuum of space?

I have heard, and even discussed, with space deniers who think that “gas will fill its container” is some kind of universal law. It isn’t, and this is an attempt to explain why.

First, we must look at a few facts:

  • Atmospheric pressure goes down as we move upward.
  • The temperature (on average, and usually) goes down as we move upward.
  • If you throw a stone upwards it will slow down until the speed is 0, it will then start to accelerate downward. This means that it will move in a parabolic trajectory, or at least close to one.
  • A gas consists of molecules.

The first point is, or at least should be, problematic for a space denier, because if you connect two containers with different pressures, should the pressure not even out? So why isn’t the pressure even out between different altitudes?

A bit of physics

OK, now to some simple physics and science. Say you have some kind of hypothesis, and then you can draw conclusions from your hypothesis. Next say that your conclusion confirms to the reality, i.e. that it can be confirmed in the reality, then that strengthens the hypothesis.

One can, for example, derive the ideal gas law from the hypothesis that a gas consists of small particles (atoms or molecules) that only interact as the particles bounce into each other or the walls of a container and that they, in between collisions are just moving freely following the simple laws of mechanics. The fact that we can derive the gas laws from this hypothesis strengthens the idea that a gas consists of atoms bouncing on each other. We have many other proofs for this, but that is not what this is about.

In this simulation, we can see that the speed of the molecules in a gas with a given temperature will have a range of values.

So, continuing with this idea that the molecules are moving freely between the collisions, then they, as stones or balls, would slow down as they move upward, and then accelerate as they move downward. This indicates that molecules moving upward will slow down and then move back towards the Earth. The faster molecules will move higher up before they fall down again, and the slower ones will fall down earlier. This explains why the pressure is lower higher up, since not only do the particles move slower but there will be fewer of them. It will also explain why the pressure is lower, higher up and why it is colder since the temperature is related to the speed of the molecules.

So how far up would we expect the molecules to go? Now to a bit slightly harder, but not beyond high school, physics.  We have a law relating the kinetic energy (energy due to motion) of particles in a gas with the temperature. We have for an ideal gas that

\overline {{E_k}}  = \frac{3}{2}kT

where the left-hand side is the average kinetic energy per particle (atom or molecule) in joules, and k is the Boltzmann constant,  https://en.wikipedia.org/wiki/Boltzmann_constant, and T is the temperature in kelvin. The constant is actually temperature dependent for nitrogen (but about 5/3) . The number 3 in 3/2 is from the motions in the three spatial dimensions. To get to five we add the rotational kinetic energy as well, be here we only care about the motion along the three spatial dimensions, and therefore we will use 3/2.


{E_k} = \frac{1}{2}m{v^2}

 we get that

\frac{1}{2}m\overline {{v^2}}  = \frac{3}{2}kT


\overline {{v^2}}  = \frac{{3kT}}{m}

To get a reasonable speed of the air molecules (mostly nitrogen) we can substitute in the temperature, say 20°C=68°F=293.15 K, and the mass of a nitrogen molecule, and take the square root of the result. This gives us

v \approx \sqrt {\frac{{5kT}}{m}}  = \sqrt {\frac{{3 \cdot 1.380649 \cdot {{10}^{ - 23}} \cdot 293.15}}{{2 \cdot 2.3258671 \cdot {{10}^{ - 26}}}}}  = 511\;{\rm{m/s}}

Now, if you happen to be a space denier, you are probably not accepting gravity either, but I hope you accept that objects in free fall do accelerate, and that, independently of the reason why, we have an acceleration of free fall of about 9.81 m/s2 or 32.2 ft/s2. Hopefully, you also accept that it will require work to lift something and that the speed of something falling depends on the height from which it was released. We have an equation for the potential energy:

{E_p} = mgh

where g is the above-mentioned acceleration. This can quite easily be verified, independently of the reason why g is what is what it is and why it even is as is.

As an object falls the potential energy turns into kinetic energy. For free fall we have that

\frac{1}{2}m{v^2} = mgh

Here v can be the initial speed upward, and h will then be the maximum height reached. That this works, independently of why, is also something that can easily be verified using rather simple equipment, for example this: https://www.pasco.com/products/sensors/wireless/ps-3219.

We can simplify this to

h = \frac{{{v^2}}}{{2g}}

This is by dividing away m, then dividing by g. If we now substitute into our number for the speed, we get

h = \frac{{{v^2}}}{{2g}} = \frac{{{{511}^2}}}{{2 \cdot 9.81}} = 13300\;{\rm{m}}

A molecule with that initial speed upward will reach a bit over 13 km (about 43000 feet) into the air before it will start to fall back again. OK, so it will collide with other molecules as it moves upward, but the average loss of kinetic energy as it moves upward will be the same. Some molecules will reach a lower altitude, and some a higher, all dependent on their speeds – but the number will give us an idea of what to expect.

In other words, if the molecules behave according to simple mechanical laws, and if they do accelerate downwards as stones, balls, and other objects do, then we don’t need a lid to keep the atmosphere in – and this independently of if one thinks the downward acceleration of objects is due to gravity or not.

I can imagine some objections here:

  • So why are not all air molecules stuck to the ground as stones are?
    Ans: Because they bounce on each other and the ground and the collisions are elastic (meaning you have no energy loss). Stones do not bounce in that way. Imagine a room full of bouncing balls that don’t lose energy as they bounce. They will continue to bounce around forever. I think it makes most sense to look at the simulation.
  • But air does not consist of small particles that behave as stones or balls, or?
    Ans: The very thing that we from that assumption can derive the gas-laws, that can be experimentally confirmed (actually, they were found experimentally before we had any theoretical model of why) indicates that air is like “small balls” bouncing around. Other results, like the Brownian motion of dust particles, are not only possible to explain through the model of air as small “balls” moving around, but can even be used to calculate the mass of the air molecules, which then can be confirmed through other experiments + a gazillion other experiments that confirm the atom model of air.

Anyhow, this simulation might give you some idea of what is going on.

Up a level : Thermodynamics
Previous page : A simple Gas simulation
Next page : Colliding non-rotating balls in 2DLast modified: Jun 6, 2024 @ 07:44