part-nd is a Unix-based, ANSI C, arbitrary-dimensional, stand-alone particle system and fast gravitational simulator. It uses a 2^D-tree system for heirarchical space subdivision and can simulate a variety of forces and boundary conditions including self-gravitation, uniform gravitation, self-contact, wall contact, and spaghetti.
It won't plug in to Maya, there is nothing to click on, you have to type stuff, and it won't use multiple processors, but it can simulate 1 million particles in 100 MB and do a full gravitational velocity evaluation in just a few seconds.
2011-06-08 Version 1.5 includes some corrections and preliminary support for multithreading. Please see the README file in the distribution below for more information.
Part-nd is an extension and rewrite of part3d, which is itself a complete rewrite of an older 2D/3D gravitation code, which is a rewrite of a bouncing-balls code that I wrote back when writing programs was easy but seemed hard. The file you'd download if you want to play with part-nd is called part-nd_v1.5.tar.gz.
Just download the file, unzip and untar it (tar -xzf part-nd_v1.5.tar.gz), change to the new directory (cd part-nd_v1.5) and make it (make).
part-nd supports the following features
- Automatic, persistent, adaptive 2^D-tree space subdivision allowing O(NlogN) long-range force computations
- N-body gravitational forces (Barnes and Hut opening criterion) with delta-smoothing (Krasny's delta parameter) and center-of-mass (effectively 2 terms in the multipole expansion)
- Hard-sphere contact forces, with contact-axis and contact-plane damping
- Constant-vector gravitation force
- Strand-connectivity forces, compression/tension and bending (2D and 3D only)
- Hard or open boundaries
- 2-d or 3-d density field construction
- Raw and Radiance output for particle locations
- Native png and ASCII pgm output for particle locations and density field
- Time-saving option to run many more contact time steps than gravitational time steps, as contact steps run faster
- Restart from an old simulation, or merge multiple simulations using raw .part files
100k particles in 3D under self-gravitation; from random distribution in a 10:1 disc with solid-body rotation; looking down on the the disk
Movie at YouTube
10k particles in 2D under self-gravitation, uniform gravitation, wall contact, and self-contact; from random distribution in a disc
Movie at YouTube
For more simulations possible with part-nd, see the part3d page.
Future versions of part-nd may address the following needs:
- Better controls on stability (currently uses a 1st order Euler forward integrator)
- Adaptive time step (ideally adaptive Runge-Kutta)
- Rotations in N-space caused by contact friction (what's a rotation is 4D?)
- Setting for molecular/Lennard-Jones (r^-6 or r^-12) forces
- Spring-like attraction forces
- Electrodynamic forces (negative sign in place of positive gravitational sign)
- Periodic boundaries (either naive or Ewald summation)
- Read and write a raw binary file
Please e-mail me if you'd like to see some particular feature in part-nd, or if you use it to make something creative.
There are many references online to ongoing research in N-body simulation. When I find good ones, I'll link them here.
J.E. Barnes and P. Hut, A heirarchical O(N log N) force calculations algorithm, Nature 324, 446 (1986)
R. Krasny, Desingularization of periodic vortex sheet roll-up, Journal of Computational Physics 65, 292-313 (1986)