*
written by
Kostas Papamichalis *

The Osmosis in 2D JavaScript Model shows a hard disk gas in a container with a semi-permeable barrier in which N particles are moving. The particles are discriminated into two classes: The "red" particles which cannot pass through the barrier and they are always trapped in chamber D1 and the "blue" particles which can pass through the barrier and move everywhere in the container. The number of "red" particles is n_r=N/3 and that of the "blues" is n_b=2N/3. At time t=0, there are equal numbers of particles in D1 an D2: N/3 "reds" and N/6 "blues" in D1 and N/2 "blues" in D2. Hence the pressure of the gas in each chamber is the same. But, because of the inability of the red particles to pass through the barrier, the number of particles in D1 gradually increases, and that of the particles in D2 decreases. As a result, the pressure in D1 increases with time, and the pressure in D2 decreases by the same amount. This process continues until the system reaches in a state of dynamical equilibrium, achieved when the number of "blue" particles is the same in both chambers. In the state of dynamical equilibrium, the total numbers of particles in each chamber are different. This implies that the final pressure in D1 is different than the pressure in D2; their difference is defined as the osmotic pressure of the system.

The simulation records the number of particles in each chamber, at a specific sequence of time moments, and calculates the corresponding pressures, in real time. In parallel, for every time-step of the simulation, the program calculates the theoretical values of the particles' numbers and the pressures in D1 and D2 derived by the theoretical model, and the corresponding graphs are composed.

Last Modified *September 15, 2020*

*
*