Periodic gravity calculation

Matthieu Schaller requested to merge mesh_force_task into master

This is a large re-write of the periodic gravity calculation in the light of the inaccuracies spotted in high-redshift test cases.

The main changes are:

  • Decouple the mesh on which the gravity forces are computed from the top-level grid.
  • Interpolate the mesh forces directly to the particles rather than to the multipoles.
  • Correct the long-range M2L kernel in the case of periodic BCs.
  • Correct the way we compute the exact solution with periodic BCs.
  • Add a cosmological term to the potential to reflect the normalisation at infinity.
  • Only create pair tasks and recurse in them only if the distance between them is above the scale where forces are 0.
  • Help the compiler vectorize more of the gravity code by flagging so-called const functions as such.
  • Updates to the theory documents.
  • Ignore the co-moving softening when not running with cosmology (implements #439 (closed)).
  • Add an option to undo the 1/sqrt(a) factor in the velocities of Gadget ICs (implements #438 (closed)).
  • Adds a cosmology test case with a correct parameter file (fixes #429 (closed)).

One important thing is that I have disabled the use of MPI for periodic gravity for now. I still need to work on this aspect but I'd like the rest to be tested first and secured in the master branch.

Edited by Matthieu Schaller

Merge request reports