## part3d |

- Automatic and adaptive octree 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)
- Hard-sphere contact forces, with contact-axis and contact-plane damping
- Constant-vector gravitation force
- Strand-connectivity forces, compression/tension and bending
- Hard or open boundaries
- 2-d or 3-d density field construction
- Raw and Radiance output for particle locations
- png, gif, pgm output for particle locations and density field
- Time-saving check that runs many more contact time steps than gravitational time steps

Future versions of *part3d* may address the following needs:

- Arbitrary number of dimensions
- Better controls on stability (currently uses a 1st order Euler forward integrator)
- Adaptive time step
- Rotations in N-space caused by contact friction
- Setting for molecular (r^-6 or r^-12) forces
- Spring-like attraction forces
- Electrodynamic forces
- Periodic boundaries
- Read and write a raw binary file

First, create a data structure for your particles. Feel free to include
any rendering parameters you like, because they won't affect the simulation.
Include a three-vector for position and velocity: * x[3], u[3]*, and
floats for mass and radius. Note that the code is easier to write if
you give all of your particles the same radius.

Second, you need to write a routine to march through your particles and
find the forces or accelerations on each one. Remember, the acceleration
is just the force divided by the particle's mass, so one is as good as the
other. This subroutine is where you include forces due to particle gravity (*
F = G * m1 * m2 / d^2*), universal gravity *(F = mg*),
particle contact (*F = -k * penetration*), and others.

Once you determine the accelerations on all of the particles, multiply them by the duration of the time step, and add them to the velocities. Update the positions in a similar manner.

Keep in mind that the naive approach of calculating forces (nested iteration
through the complete particle lists) produces a method that is of order N-squared,
or a doubling of the number of particles makes the code run four times slower.
A good method to use to get around this poor scaling is called *octree space
subdivision*. I won't go into the details on this page, but you should be
able to find many resources on the web describing the technique. The essence of
it is that you clump particles together as one virtual mass when computing
the effect of that clump of particles on a particle or clump of particles far
away. *part3d* uses a method that does this.

part3d_v1.1.tar.gz | minor bug fixes |

part3d_v1.0.tar.gz | correct force calculation, many bug fixes, better output handling, other enhancements |

part3d_v0.9.tar.gz | merged spaghetti and gravitation codes, GPL'd |

Mark Stock, PhD Candidate, University of Michigan, Ann Arbor

Page last modified 2005-02-09