[WIP] Self gravity (Barnes-Hut version)
First iteration of the gravity solver. This is a copy of the BH code in the Quickhed examples. Compute forces up to quadrupole order.
Comes with the following limitations:
- Not MPI
- Not periodic
- Only fixdt
- Gravity is not softened
The last 2 points are trivial to implement and won't affect the logic.
At the moment there is little logic in scheduler_splittask()
, everything is in the tasks themselves. Obvious improvements to the logic would be to not lock a cell when only its multipole is required.
This should not be merged in as it is but it is here for you to look at.
There are three types of task (besides the multipole construction):
-
pair
: interacts two cells that are neighbours of each others (potentially by recursing). -
self
: interacts one cell with itself (potentially by recursing). -
mm
: interacts two cells that are NOT neighbours (using particle-multipole interactions, no recursion).
When we are happy, the mm
tasks can be replaced by a multipole-multipole interaction to make the algorithm FMM and not Barnes-Hut any more.