Commit da11c117 authored by Wouter Kessels's avatar Wouter Kessels
parents a77daf97 0bb91d58
......@@ -83,7 +83,7 @@ def extract_data(bodies, D):
return positions, velocities, masses
def force(mass, positions, D):
def force_calc(mass, positions, D):
"""
Calculates all forces exerted on each body using "brute force" algorithm.
......@@ -203,7 +203,7 @@ def dynamics(bodies, D, h, t_max, barnes_hut, theta):
if barnes_hut and theta != 0:
force0 = force_barneshut(positions, mass, theta)
else:
force0 = force(mass, positions, D)
force0 = force_calc(mass, positions, D)
all_pos = np.zeros((T+1, positions.shape[0], positions.shape[1]))
times = [0]
......@@ -220,7 +220,7 @@ def dynamics(bodies, D, h, t_max, barnes_hut, theta):
else:
for i in range(1,T+1):
all_pos[i] = position(all_pos[i-1], velo, force0, h)
force1 = force(mass, all_pos[i], D)
force1 = force_calc(mass, all_pos[i], D)
velo = velocity(velo, force0, force1, h)
force0 = force1
times.append(h*i)
......
......@@ -5,7 +5,7 @@ import numpy as np
M = 5.972e24 # Earth' mass [kg]
Au = 149597870 # Astronomical unit [km]
Y = 365.25*24*3600 # Year [s]
Y = 365.25*24*3600*11.862 # Year [s]
G = 6.67408e-11*M*(Au*10**(3))**(-3)*Y**2 # Gravitational constant [m**3 * kg**(-1) * s**(-2)]
massSun = 333000 # AU
......
......@@ -5,7 +5,7 @@ from objects import *
""" Natural units """
M = 5.972e24 # Earth' mass [kg]
Au = 149597870 # Astronomical unit [km]
Y = 365.25*24*3600 # Year [s]
Y = 365.25*24*3600*11.862 # Year [s]
G = 6.67408e-11*M*(Au*10**(3))**(-3)*Y**2 # Gravitational constant [m**3 * kg**(-1) * s**(-2)]
......@@ -159,7 +159,7 @@ Asteroid_belt_parameters = {
'id' : 10,
'name' : 'Asteroid Belt'
}
Asteroid_belt = Asteroids(Asteroid_belt_parameters); solar_system.append(Asteroid_belt)
Asteroid_belt = Asteroids(Asteroid_belt_parameters); solar_system.append(Asteroid_belt)
""" Quick writing """
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment