next up previous
Next: Derivation of Collision Equations Up: Maxwell's Demon and the Previous: Conclusions

Derivation of Collision Time Equations

In the hard disk gas program, the state of the gas is stored in an array. This array includes x and y positions as velocities for each molecule. For any time before the next collision, the position of a given molecule can be expressed as a function of time. Each molecule has a diameter of 1, so collisions occur when the distance between the midpoints of two molecules is 1. The time at which any two molecules collide is therefore given by the solution of the following set of equations:






where tex2html_wrap_inline393 and tex2html_wrap_inline395 are the coordinates of the molecules at the time of collision, t is the time until the next collision, tex2html_wrap_inline399 and tex2html_wrap_inline401 are the velocities of the molecules before the collision, and tex2html_wrap_inline403 and tex2html_wrap_inline405 are the current positions of the molecules. These equations reduce to a quadratic,






If the solution for t is negative or imaginary, the molecules will not collide at all.

All walls are stationary, and either horizontal or vertical. Therefore, if there is any collision between a molecule and a wall at all, it will occur when the edge of the molecule crosses the line of the wall. For example, if the wall is vertical,


where t is the time of collision, tex2html_wrap_inline421 and tex2html_wrap_inline423 are the x coordinates of the wall and molecule. If the value of t calculated is positive, the y position of the molecule at the time of collision can then be calculated to see if the molecule misses the wall.

Separate collision time calculations are necessary for cases when the molecule collides with the end of a wall. This calculation is very similar to the calculation of the time of collision between molecules, except that the end of the wall is stationary, and the collision occurs when the molecule is 0.5 units away from the end, not 1.0.

next up previous
Next: Derivation of Collision Equations Up: Maxwell's Demon and the Previous: Conclusions

Eric H. Neilsen
Mon Jun 16 13:53:44 EDT 1997