Skip to content
Projects

A tree code that conserves both momentum and energy: the evidence, as figures.

Runs the experiments behind tree_d_3d.smooth and saves one figure per claim:

Source: examples/conserving_tree_code.py. Run it yourself with python examples/conserving_tree_code.py [--output examples/output] [--quick] (needs pip install "tree-d-3d[examples]").

the trapped cloud under the conserving scheme, animated, with its energy error.

the ring of like charges, tree code over direct sum, animated.

a tracer crossing leaf edges, animated, with its leaf weights.

the quadtree rebuilt every frame while the particles move, animated: leaves that split and merge.

field error against the expansion order for the rectangle (standard) and triangle (symmetric) M2L truncations.

the net force of the same runs; the triangle gives roundoff at every order, the rectangle the truncation error.

the leaf boxes of an adaptive tree and the weight of one leaf with its smooth band, plus the sum of all weights (one everywhere).

analytic force against finite differences of the energy, for particles blended into several leaves.

relative energy error over a Verlet run for the direct sum, hard membership (fixed boxes and rebuilt every step), smooth membership, and smooth membership with co-moving boxes.

the net force over the same runs.

the particle trajectories of the conserving run over the fixed leaf boxes, and the distance of each variant’s trajectories from the direct sum’s.

a small ring of like charges orbiting in the trap, where the orbits are recognisable: the conserving tree code’s trajectories over the direct sum’s, and the energy error of both.

--quick uses fewer particles and steps (about 20 s instead of a few minutes). Needs Plotly (pip install 'tree-d-3d[examples]').