Momentum-conserving self-gravity in the phantom smoothed particle hydrodynamics code. Parallel dual tree traversal for the symmetric fast multipole method
Yann Bernard, Timothée David-Cléris, Daniel J. Price, Mike Y. M. Lau
TL;DR
This work addresses momentum non-conservation and parallelization challenges in self-gravity calculations for SPH with adaptive softening. It implements a parallel, momentum-conserving symmetric fast multipole method by duplicating leaf-node interactions in a dual-tree traversal, preserving Newton's third law while maintaining comparable accuracy to existing methods. The approach yields machine-precision linear momentum conservation, improved angular momentum behavior, and robust orbitalPhase fidelity in binary polytrope and common-envelope tests, with performance scales similar to the previous solver. The method is now the default in Phantom, enabling accurate, scalable gravity calculations for large SPH simulations with adaptive softening.
Abstract
Tree codes that approximate groups of distant particles with multipole expansions are the standard way to accelerate the computation of self-gravity on particles. While momentum-conserving fast multipole methods exist, parallelisation is non-trivial and previous implementations have been limited to self-gravity with fixed softening lengths. We aim for a practical, parallel version of Dehnen's momentum-conserving Cartesian fast multipole method for the computation of the gravitational force in smoothed particle hydrodynamics (SPH) with adaptive gravitational force softening. We parallelise the dual tree walk by replicating the node-node interaction on the parents of each leaf node in the tree. While this duplicates work, it greatly simplifies the parallelisation and can be implemented with relatively minor changes from the previous non-conservative force algorithm in Phantom. We also adapt the tree opening criterion for adaptive softening lengths, such that all interactions within the softening kernel are handled pairwise (as in SPH) rather than with multipole expansions, also allowing the gravity calculation to be performed alongside the SPH force evaluation. We demonstrate that the new code conserves linear momentum to machine precision while giving similar force accuracy and computational performance to the previous (non-symmetric) fast multipole method in Phantom . The new method also gives better conservation of the angular momentum and orbital phase in a binary polytrope evolution. The symmetric fast multipole method is now the default for computing self-gravity in the public code.
