Re: N Body Algorithm Comparison

Chris Mihos (
26 Aug 1994 17:33:40 -0500

In article <33kvl3$>,
Paul Fishwick <> wrote:
> Also, I have
>had replies (to an earlier post to another group) to the effect
>that tree algorithms are sometimes better to use than potential
>field algorithms. Thoughts?

This kind of question basically depends on a) what your problem
is and b) what your computational facilities are. I'll make a
couple of comments about a) and leave b) to those who are more
hardware-oriented than I...

Field codes and their like are good if you have some sort of
symmetry involved in the system, such that the number of terms
in the force expansion can be kept small, and if collisional
effects are not important. These codes are often used to describe
evolution of spherical -- or spheroidal -- galaxies and clusters,
for example. Also, for some applications concerning disk galaxy
evolution they can be used, although a 3D disk expansion is tough!

Tree codes are good if there is no symmetry involved, like my
favorite example -- galaxy collisions. Since you are doing a force
sum, rather than expanding a potential, no geometry is assumed.
Treecodes also offer more efficient scaling with particle number
than do direct-sum methods, provided they are used intelligently.
Also, the resolution in tree codes is basically set by the softening
length used in the force calculation, so collisional effects can
be incorporated at some level.

There are, of course, approaches which combine the two methods,
like P3M. These would be good for problems which have different
scales, like cosmology simulations.

No code is the best in all situations -- you have to first decide
what your problem is, then decide which approach best suits it.

Chris Mihos