revert with old dimensions
This commit is contained in:
@@ -23,10 +23,10 @@ class Body:
|
||||
self.vp = np.zeros(3)
|
||||
|
||||
def __repr__(self): # Called upon "print(body)"
|
||||
return r"Body of mass: {0:.2f} $M_\odot$, position: {1}, velocity: {2}".format(self.m, self.q, self.v)
|
||||
return r"Body of mass: {0:.2f} $M_\odot$, position: {1}, velocity: {2}".format(self.m/Ms, self.q, self.v)
|
||||
|
||||
def __str__(self): # Called upon "str(body)"
|
||||
return r"Body of mass: {0:.2f} $M_\odot$".format(self.m)
|
||||
return r"Body of mass: {0:.2f} $M_\odot$".format(self.m/Ms)
|
||||
|
||||
class System(Body):
|
||||
|
||||
|
||||
@@ -110,12 +110,12 @@ def display_parameters(E,L,parameters,savename=""):
|
||||
bodies = ""
|
||||
for body in dyn_syst.bodylist:
|
||||
bodies += str(body)+" ; "
|
||||
title = "Relative difference of the {0:s} "+"for a system composed of {0:s}\n integrated with {1:s} for a duration of {2:.2f} years ".format(bodies, integrator, duration)
|
||||
title = "Relative difference of the {0:s} "+"for a system composed of {0:s}\n integrated with {1:s} for a duration of {2:.2f} years ".format(bodies, integrator, duration/yr)
|
||||
|
||||
fig1 = plt.figure(figsize=(15,7))
|
||||
ax1 = fig1.add_subplot(111)
|
||||
for i in range(len(E)):
|
||||
ax1.plot(np.arange(E[i].shape[0])*step[i], np.abs((E[i]-E[i][0])/E[i][0]), label="step of {0:.2e}yr".format(step[i]))
|
||||
ax1.plot(np.arange(E[i].shape[0])*step[i]/yr, np.abs((E[i]-E[i][0])/E[i][0]), label="step of {0:.2e}yr".format(step[i]/yr))
|
||||
ax1.set(xlabel=r"$t (yr)$", ylabel=r"$\left|\frac{\delta E_m}{E_m(t=0)}\right|$", yscale='log')
|
||||
ax1.legend()
|
||||
fig1.suptitle(title.format("mechanical energy"))
|
||||
@@ -126,7 +126,7 @@ def display_parameters(E,L,parameters,savename=""):
|
||||
for i in range(len(L)):
|
||||
dL = ((L[i]-L[i][0])/L[i][0])
|
||||
dL[np.isnan(dL)] = 0.
|
||||
ax2.plot(np.arange(L[i].shape[0])*step[i], np.abs(np.sum(dL,axis=1)), label="step of {0:.2e}yr".format(step[i]))
|
||||
ax2.plot(np.arange(L[i].shape[0])*step[i]/yr, np.abs(np.sum(dL,axis=1)), label="step of {0:.2e}yr".format(step[i]/yr))
|
||||
ax2.set(xlabel=r"$t (yr)$", ylabel=r"$\left|\frac{\delta \vec{L}}{\vec{L}(t=0)}\right|$",yscale='log')
|
||||
ax2.legend()
|
||||
fig2.suptitle(title.format("kinetic moment"))
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
Units used in the project.
|
||||
"""
|
||||
|
||||
globals()['G'] = 6.67e-11 #Gravitational constant in SI units
|
||||
globals()['Ms'] = 2e30 #Solar mass in kg
|
||||
globals()['au'] = 1.5e11 #Astronomical unit in m
|
||||
globals()['yr'] = 3.15576e7 #year in seconds
|
||||
globals()['G'] = 6.67e-11*yr**2 #Gravitational constant in SI units
|
||||
8
main.py
8
main.py
@@ -9,8 +9,8 @@ from lib.units import *
|
||||
|
||||
def main():
|
||||
#initialisation
|
||||
m = np.array([1., 1., 1e-5])*Ms/Ms # Masses in Solar mass
|
||||
a = np.array([1., 1., 5.])*au/au # Semi-major axis in astronomical units
|
||||
m = np.array([1., 1., 1e-5])*Ms # Masses in Solar mass
|
||||
a = np.array([1., 1., 5.])*au # Semi-major axis in astronomical units
|
||||
e = np.array([0., 0., 1./4.]) # Eccentricity
|
||||
psi = np.array([0., 0., 0.])*np.pi/180. # Inclination of the orbital plane in degrees
|
||||
|
||||
@@ -25,10 +25,10 @@ def main():
|
||||
v = np.array([v1, v2, v3])
|
||||
|
||||
#integration parameters
|
||||
duration, step = 100*yr/yr, np.array([1./(365.25*2.), 1./365.25])*yr/yr #integration time and step in years
|
||||
duration, step = 100*yr, np.array([1./(365.25*2.), 1./365.25])*yr #integration time and step in years
|
||||
integrator = "leapfrog"
|
||||
n_bodies = 2
|
||||
display = True
|
||||
display = False
|
||||
savename = "{0:d}bodies_{1:s}".format(n_bodies, integrator)
|
||||
|
||||
#simulation start
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 54 KiB After Width: | Height: | Size: 118 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 109 KiB After Width: | Height: | Size: 104 KiB |
Reference in New Issue
Block a user