pynbody.gravity.calc.pm

Contents

pynbody.gravity.calc.pm#

pynbody.gravity.calc.pm(f: SimSnap, ipos: ndarray, ngrid: int = 10, x0=None, x1=None)[source]#

Calculate the potential and acceleration for a set of particles using a Particle-Mesh algorithm.

Parameters:
  • f – The snapshot to calculate the potential and acceleration for

  • ipos – The positions of the particles to calculate the potential and acceleration for

  • x0 – The lower bound of the grid in each dimension. If None, the minimum of the snapshot’s positions will be used.

  • x1 – The upper bound of the grid in each dimension. If None, x0 + f.properties['boxsize'] will be used.

Returns:

  • phi (array.SimArray) – The gravitational potential at the specified positions

  • grad_phi (array.SimArray) – The gravitational acceleration at the specified positions