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]").
Animations
Section titled “Animations”Loading interactive figure…
the trapped cloud under the conserving scheme, animated, with its energy error.
Loading interactive figure…
the ring of like charges, tree code over direct sum, animated.
Loading interactive figure…
a tracer crossing leaf edges, animated, with its leaf weights.
Loading interactive figure…
the quadtree rebuilt every frame while the particles move, animated: leaves that split and merge.
Figures
Section titled “Figures”Loading interactive figure…
field error against the expansion order for the rectangle (standard) and triangle (symmetric) M2L truncations.
Loading interactive figure…
the net force of the same runs; the triangle gives roundoff at every order, the rectangle the truncation error.
Loading interactive figure…
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).
Loading interactive figure…
analytic force against finite differences of the energy, for particles blended into several leaves.
Loading interactive figure…
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.
Loading interactive figure…
the net force over the same runs.
Loading interactive figure…
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.
Loading interactive figure…
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]').