In this simulation we consider a gas composed of N (1 ≤ N ≤ 1000)
molecules of mass m (1u ≤ m ≤ 1000u)
contained in a cube of volume V = L³,
where 150 nm ≤ L ≤ 600 nm.
At the beginning of the simulation, the molecules are at rest in the center of the cube.
We then determined the distribution of the initial velocities of each of the molecules by rolling 10 10-sided dice.
Once the values of N, m, L and the most likely speed v_p (1 m/s ≤ v_p ≤ 700) have been chosen,
the simulation determines the temperature T of the gas through the velocities of the molecules and their masses.
When starting the simulation, the molecules depart randomly in all directions and the movement of each molecule is determined,
at each instant, considering that the molecules collide only with the walls of the cube elastically.
Although the simulation is three-dimensional, only the xy plane of the edge cube L is shown.
The pressure exerted by the gas molecules on the faces of the cube is determined in time
real by the sum of the impulses transmitted by each molecule on the faces of the cube, through the equation:
$$
P = \dfrac{m}{3L^2\Delta t},
$$
where $\Delta t$ is the time interval between two beats.
Read more: