astro/
potential_newton.pro
toppotential_newton
Astro
result = potential_newton(x, y, z, xpart, ypart, zpart, mass [, lengthunit=lengthunit] [, massunit=massunit] [, astro=astro] [, softening=softening] [, lomem=lomem])
Calculates the gravitational potential from a particle distribution at a list of positions.
Return value
This function returns the gravitational potential at each X,Y,Z position. If there are NPOS positions, Result is a vector of length NPOS.
Parameters
- x in required
X coordinates at which to calculate potential.
- y in required
Y coordinates at which to calculate potential.
- z in required
Z coordinates at which to calculate potential.
- xpart in required
X coordinates of particle positions defining the mass distribution.
- ypart in required
Y coordinates of particle positions defining the mass distribution.
- zpart in required
Z coordinates of particle positions defining the mass distribution.
- mass in required
Mass of each particle.
Keywords
- lengthunit in optional
Length unit, in cm (or kpc if /ASTRO is set). Default: 1kpc.
- massunit in optional
Mass unit, in grams (or solar masses if /ASTRO is set). Default: 1 solar mass.
- astro in optional
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).
- softening in optional
Plummer softening length. Default: 0 (no softening).
- lomem in optional
If /LOMEM is set then sacrifice efficiency for lower memory usage
Examples
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)
Author information
| History: | Written by: Jeremy Bailin 10 June 2008 Public release in JBIU |
File attributes
| Modifcation date: | Fri Jun 13 10:51:51 2008 |
| Lines: | 145 |
![[attach.png]](../idldoc-resources/attach.png)