Skip to content
Projects

Conserving tree code

A tree code that conserves both momentum and energy, with 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 trapped cloud under the conserving scheme, animated, with its energy error.Loading figure…

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

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

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

a tracer crossing leaf edges, animated, with its leaf weights; the dotted boxes are the leaves grown by the smooth band.a tracer crossing leaf edges, animated, with its leaf weights; the dotted boxes are the leaves grown by the smooth band.Loading figure…

a tracer crossing leaf edges, animated, with its leaf weights; the dotted boxes are the leaves grown by the smooth band.

the quadtree rebuilt every frame while the particles move, animated: leaves that split and merge (new leaves green, just removed ones red dashed).the quadtree rebuilt every frame while the particles move, animated: leaves that split and merge (new leaves green, just removed ones red dashed).Loading figure…

the quadtree rebuilt every frame while the particles move, animated: leaves that split and merge (new leaves green, just removed ones red dashed).

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

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 net force of the same runs; the triangle gives roundoff at every order, the rectangle the truncation error.Loading figure…

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).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 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).

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

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.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 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.

the net force over the same runs.the net force over the same runs.Loading figure…

the net force over the same runs.

the particle trajectories of the conserving run over the fixed leaf boxes (red: positive, blue: negative charges, dots: start), and the distance of each variant's trajectories from the direct sum's, which grows exponentially for every variant (N-body chaos).the particle trajectories of the conserving run over the fixed leaf boxes (red: positive, blue: negative charges, dots: start), and the distance of each variant's trajectories from the direct sum's, which grows exponentially for every variant (N-body chaos).Loading figure…

the particle trajectories of the conserving run over the fixed leaf boxes (red: positive, blue: negative charges, dots: start), and the distance of each variant’s trajectories from the direct sum’s, which grows exponentially for every variant (N-body chaos).

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.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.Loading 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]').