Model a gas as collection of circular or spherical elastic billiard balls bouncing off each other (and off elastic boundaries). This has been done many times over, but seems simple (and fun) to reimplement, not requiring too much effort: straight lines and some quadratic equation solving to determine when and where two spheres collide and which way they bounce.
Probably good for GPU.
Previously, modeling a solid.
One should be able to model pressure waves (i.e., sound, regions of high or low density) propagating through a gas.
Once we are modeling a large number of particles, far more than the 16 on a pool table, we probably want some fancy data structure to keep track of upcoming collisions in order of time. Priority queue. When two particles collide, or one particle bounces off a wall, resulting in new velocities, the data structure needs to be updated, ideally without too much work.
Do we reach in (somehow) and delete or update entries in the priority queue (and auxiliary data structures), or do we mark things with epoch and simply discard obsoleted collisions when they bubble to the top? If the latter, be careful not to explode in space usage. Perhaps do garbage collection, periodically, or on demand when space grows beyond a threshold.
Given general initial conditions, does the system evolve toward a Boltzmann distibution of velocities? How can one test or measure how close a system is to a Boltzmann distribution?
Instead of being perfectly reflective, model the walls as having a temperature, able to add or subtract energy to or from a particle colliding with it. Perhaps a wall is a crystal of vibrating balls attached to each other by springs.
Consider walls that move exogenously, inspired by speaker cones. We probably need a way of preventing energy from increasing without bound.
What are some nice ways to display this simulation? Assume 2D for now.
Draw particle paths, but not too long, or else it becomes visually too messy. Draw paths on all particles or just a select few (maybe one)?
Auxiliary windows isolating just the particles in the next few collisions. Incoming particles' actual positions and projected paths. Virtual "simplified" position paths extrapolating backward in time from the point of collision. Actual and virtual differ if particles take a complicated path, with earlier collisions, before reaching the collision in question. "Magnify" in a special way: replace the particles with larger particles with the same velocities but different positions which collide in the same position (i.e., the momentary point of adjacent tangency) and ricochet the same directions as the actual particles.
Annotate each particle with some indication of how soon it will next participate in a collision.
Is the simulation aesthetically interesting?
Perhaps not: it looks random and keeps looking random.
Or perhaps yes: billiard balls are Turing complete. Supersonic stuff might be interesting.
No comments :
Post a Comment