1 | A denotes MPGrav and Ac denotes MPGrav_travel |
2 | Case when i compared to i is not needed as particles dont interact with themselves |
3 | At step k, interact particle i with particle j= 1 + mod((i+k-1),N) |
4 | Accumulate force on i due to j in fixed Ai |
5 | Accumulate negative of this as force on j due to i in circulating Acj |
6 | At the end of the algorithm, add Ai and Aci |
7 | In parallel version, Note that Ai will be calculated in "home processor for particle i but Aci will travel around the machine being accumulated in processor holding particle j |
8 | Thus this violates the owner computes rule and so this parallel algorithm must be implemented by hand -- the compiler will not find it automatically |