n-Body Problem

Download Report

Transcript n-Body Problem

Two of Newton’s Law of Motions
1) In the absence of any forces applied, an object at rest will
stay at rest, and a body moving at a constant velocity in
straight line continues doing so indefinitely.
2) When a force is applied to an object, it accelerates. The
acceleration is in the direction of the force and proportional
to its strength, and is also inversely proportional to the mass
(m) of the object. In suitable units:


F  m A
1
Newton’s Law of Gravitation
Gravitational force: an attractive force that exists between all objects
with mass; an object with mass attracts another object with mass; the
magnitude of the force is directly proportional to the masses of the two
objects and inversely proportional to the square of the distance between
the two objects.
m1  m 2
Fg  G
2
r
Where:
m1 & m2 are the masses of the two objects
r is the distance between the objects
G is the universal gravitation constant
( G = 6.67259 x 10-11 newton-meters2/kg2 )
2
The following equations
apply:
Consider a single object
t = time
m = mass of object
F = force on object (vector)
a = acceleration object (vector)
x = location of object (vector)
v = velocity of object (vector)
Note: F, a, v and x are all vectors
and are functions of t.


F  ma
2
d x 
a
2
dt

dx 
v
dt


dv
a
dt
3
Two Gravitating Particle Masses
m2
m1
Each particle has a scalar mass quantity
4
Particle Positions
Each particle has a vector position
relative to the origin:
x2
x1
(0,0)
5
Particle Velocities
Each particle has a vector velocity
v1
v2
6
Particle Accelerations
Each particle has a vector acceleration
a1
a2
7
Vector Operations
• In two dimensions, vectors can be represented by two signed
floats (or doubles):

A  ( Ax, Ay )
• The length or magnitude of a vector is a scalar quantity and can

be computed as:
2
2
A  Ax  Ay
• A unit length vector U with the same direction as a non-unit
length vector A can be computed as:

Ax Ay
U (  ,  )
A A
8
More Vector Ops
• A unit vector U can be given a known magnitude (length) as
follows:

F  ( force  Ux, force  Uy )
Where U is a unit vector and force is a scalar
quantity which is to be the magnitude of F.
• Vector addition and subtraction consist of adding and
subtracting the vectors’ x and y components:
 
A  B  ( Ax  Bx, Ay  By )
 
A  B  ( Ax  Bx, Ay  By )
9
Two-body Newtonian Gravitation
• Two objects of mass m1 and m2 with position vectors X1 and X2 exert a
gravitational force on each other. The magnitude of the force is given
by:
m1  m2
Fg  G 
 2
X 2  X1
• The vector F21, representing the gravitational force exerted by m2 on
m1 is then:



( X 2  X 1)
U 21  

X 2  X1


F 21  U 21  Fg
• The net resulting force vector on any mass is the vector sum of all the
force vectors generated by masses other than itself.
10
Newtonian Gravitation
• Newton’s second law (F = mA) can be applied to the two body
scenario:


F 21  m1  A1

2

d X1
U 21  Fg  m1  2
dt





2
d X 1 ( X 2  X 1)
m2
( X 2  X 1)  m 2  G
 
 G 
 2 

 3
2
dt
X 2  X1
X 2  X1
X 2  X1
11
Newtonian Gravitation
• Using velocity:



dV 1 ( X 2  X 1)  m 2  G


 3
dt
X 2  X1
Where :

dX 1 
V1
dt
12
N-Body Gravitation
•
Generalizing to N bodies from two bodies we must sum gravitational
force vectors induced by all N bodies except the one we are computing
the acceleration for:

dXn 
 Vn
dt



dVn i  N ( Xi  Xn)  mi  G
 
  3
dt i 1,i  n
Xi  Xn
13
N-Body Newtonian
Gravitation Simulation
• Problem: Plot the position of the bodies
as a function of time.
• We need to specify the initial velocity and
positions of the objects.
• Next we need a numerical scheme to
advance the equations in time.
• Can use Euler’s Method …. as a first
approach.
14
Numerical Approach
For m=1 to FinalTime/dt
For n=1 to number of objects


i N
 m 1  m
( Xi  Xn)  mi  G
Vn  Vn  dt  
  3
i 1, i  n
Xi  Xn
 m1  m
m
X n  X n  dt Vn
End
End
15
Initial Conditions
Planetary
Body
Sun
Mercury
Venus
Earth
Mars
Jupiter
Saturn
Uranus
Neptune
Pluto
Mass
(in kilograms)
1.989E+30
3.300E+23
4.870E+24
5.970E+24
6.420E+23
1.899E+27
5.680E+26
8.680E+25
1.020E+26
1.250E+22
Position
(in meters)
Xx
0.0
5.790E+10
1.082E+11
1.496E+11
2.279E+11
7.786E+11
1.434E+12
2.873E+12
4.495E+12
5.870E+12
Xy
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
Velocity
(in meters per second)
Vx
Vy
0.0
0.0
0.0
4.789E+04
0.0
3.503E+04
0.0
2.979E+04
0.0
2.413E+04
0.0
1.306E+04
0.0
9.640E+03
0.0
6.800E+03
0.0
5.400E+03
0.0
4.700E+03
16