POTENTIAL_NEWTON
Name
POTENTIAL_NEWTON
Purpose
Calculates the gravitational potential from a particle distribution
at a list of positions.
Category
Astro
Calling Sequence
Result = POTENTIAL_NEWTON(X, Y, Z, Xpart, Ypart, Zpart, Mass)
Inputs
X: X coordinates at which to calculate potential.
Y: Y coordinates at which to calculate potential.
Z: Z coordinates at which to calculate potential.
Xpart: X coordinates of particle positions defining the mass
distribution.
Ypart: Y coordinates of particle positions defining the mass
distribution.
Zpart: Z coordinates of particle positions defining the mass
distribution.
Mass: Mass of each particle.
Keyword Parameters
LENGTHUNIT: Length unit, in cm (or kpc if /ASTRO is set). Default: 1kpc.
MASSUNIT: Mass unit, in grams (or solar masses if /ASTRO is
set). Default: 1 solar mass.
SOFTENING: Plummer softening length. Default: 0 (no softening).
ASTRO: If /ASTRO is set then LENGTHUNIT and MASSUNIT are given
in kpc and solar masses respectively, otherwise they are
in CGS (Lengthunit in cm, Massunit in grams).
LOMEM: If /LOMEM is set then sacrifice efficiency for
lower memory usage
Outputs
This function returns the gravitational potential at each X,Y,Z position.
If there are NPOS positions, Result is a vector of length NPOS.
Example
Calculate the gravitational potential on a line along the x-axis from
6 point masses placed at the vertices of a cube:
xmasspos = [-1,-1,-1,-1,1,1,1,1]
ymasspos = [-1,-1,1,1,-1,-1,1,1]
zmasspos = [-1,1,-1,1,-1,1,-1,1]
masses = REPLICATE(1.,8)
xlinepos = 0.1*FINDGEN(20)
ylinepos = REPLICATE(0.,20)
zlinepos = REPLICATE(0.,20)
potentials = POTENTIAL_NEWTON(xlinepos, ylinepos, zlinepos, xmasspos, ymasspos,
zmasspos, masses)
Modification History
Written by: Jeremy Bailin
10 June 2008 Public release in JBIU