FORCE_NEWTON
Name
FORCE_NEWTON
Purpose
Calculates the gravitational force from a particle distribution
at a list of positions.
Category
Astro
Calling Sequence
Result = FORCE_NEWTON(X, Y, Z, Xpart, Ypart, Zpart, Mass)
Inputs
X: X coordinates at which to calculate forces.
Y: Y coordinates at which to calculate forces.
Z: Z coordinates at which to calculate forces.
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).
Outputs
This function returns the gravitational force at each X,Y,Z position.
If there are NPOS positions, Result is an NPOSx3 matrix.
Example
Calculate the gravitational force 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)
forces = FORCE_NEWTON(xlinepos, ylinepos, zlinepos, xmasspos, ymasspos,
zmasspos, masses)
Modification History
Written by: Jeremy Bailin
10 June 2008 Public release in JBIU