Commit 9795d80a authored by Max Capelle's avatar Max Capelle

add resonance asteroids

parent e7520e78
......@@ -156,8 +156,99 @@ class Body:
"""Add axes of ellipsoid fitted on trajectory"""
self.ellfit_axes = axes
class Resonance_astroids:
"""Class with all information, settings and results of resonance astroid belt."""
def __init__(self, par):
# Total number of asteroids
try:
self.N = par['N']
except:
self.N = 10
print("Total number of particles not given, set to {}".format(self.N))
# Total mass of all asteroids combined
try:
self.mass = par['mass']
except:
self.mass = 0.012
print("Total mass of belt not given, set to mass of Moon: {} AU".format(self.mass))
# Individual masses
self.masses = (self.mass/self.N*np.ones(self.N)).tolist()
# Mass of center object
try:
self.masscenter = pas['masscenter']
except:
self.masscenter = massSun
print("Center mass of belt not given, set to mass of Sun: {} AU".format(self.masscenter))
# Belt radius
try:
self.R = par['R']
except:
self.R = 3.1
print("Belt radius not given, set to {}".format(self.R))
# Colour when visualizing
try:
self.colour = par['colour']
except:
self.colour = None
# ID (integer value)
try:
ID = par['id']
except:
ID = random.choice(range(10000,100000)) # give random integer as id
if isinstance(ID, int):
self.id = ID
else:
raise TypeError("ID must be int")
# Name
try:
self.name = par['name']
except:
self.name = "Anonymous resonance asteroid belt"
# Reference period
try:
self.T_ref = par['T_ref']
except:
self.T_ref = 12*365.25*24*3600/Y
print("Belt reference period not given, set to period of Jupiter {}".format(self.T_ref))
# Determine periods of asteroids
self.T = np.linspace(1,self.N,self.N)*self.T_ref
# Determine positions of asteroids
r = (self.T*np.sqrt(G*self.masscenter)/(2*np.pi))**(2/3)
x = r*np.cos(self.theta)
y = r*np.sin(self.theta)
self.poss = np.transpose(np.asarray([x, y])).tolist()
# Determine velocities of asteroids
v = np.sqrt(G*self.masscenter/r)
vx = np.cos(theta+np.pi/2)*v
vy = np.sin(theta+np.pi/2)*v
self.velos = np.transpose(np.asarray([vx, vy])).tolist()
# Define some parameters that the Bodies class needs
self.pos = [0, 0]
self.velo = [0, 0]
self.geo = 'cartesian'
def add_trajectories(self, trajs):
"""Add trajectories of all asteroids"""
self.trajectories = trajs
def add_velocities(self, velocities):
"""Add velocities of all asteroids"""
self.velocities = velocities
class Asteroids:
"""Class with all information, settings and results of an asteroid belt."""
......
......@@ -161,6 +161,16 @@ Asteroid_belt_parameters = {
}
Asteroid_belt = Asteroids(Asteroid_belt_parameters); solar_system.append(Asteroid_belt)
# Resonance Astroid belt
Resonance_belt_parameters = {
'N' : 10, # number of asteroids
'mass' : 0.012, # total mass of all asteroids combined
'R' : 3.1, # orbital radius from the Sun
'colour' : 'lightgray',
'id' : 10,
'name' : 'Resonance Asteroid Belt'
}
Resonance_belt = Resonance_astroids(Resonance_belt_parameters); solar_system.append(Resonance_belt)
""" Quick writing """
All = 'all'
......
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