  We present a new particle-based (discrete element) numerical method for the
simulation of granular dynamics, with application to motions of particles on
small solar system body and planetary surfaces. The method employs the parallel
N-body tree code pkdgrav to search for collisions and compute particle
trajectories. Collisions are treated as instantaneous point-contact events
between rigid spheres. Particle confinement is achieved by combining arbitrary
combinations of four provided wall primitives, namely infinite plane, finite
disk, infinite cylinder, and finite cylinder, and degenerate cases of these.
Various wall movements, including translation, oscillation, and rotation, are
supported. We provide full derivations of collision prediction and resolution
equations for all geometries and motions. Several tests of the method are
described, including a model granular "atmosphere" that achieves correct energy
equipartition, and a series of tumbler simulations that show the expected
transition from tumbling to centrifuging as a function of rotation rate.
