add description to display, coplanar 3 bodies with test mass
@@ -92,7 +92,7 @@ class DynamicUpdate():
|
|||||||
self.fig.savefig("tmp/{0:06d}.png".format(step),bbox_inches="tight")
|
self.fig.savefig("tmp/{0:06d}.png".format(step),bbox_inches="tight")
|
||||||
|
|
||||||
def close(self):
|
def close(self):
|
||||||
self.fig.close()
|
plt.close()
|
||||||
|
|
||||||
#Example
|
#Example
|
||||||
def __call__(self):
|
def __call__(self):
|
||||||
@@ -117,7 +117,7 @@ def display_parameters(E,L,parameters,savename=""):
|
|||||||
bodies = ""
|
bodies = ""
|
||||||
for body in dyn_syst.bodylist:
|
for body in dyn_syst.bodylist:
|
||||||
bodies += str(body)+" ; "
|
bodies += str(body)+" ; "
|
||||||
title = "Relative difference of the {} "+"for a system composed of {0:s} \nintegrated with {1:s} for a duration of {2:.2f} years with a step of {3:.2e} years.".format(bodies, integrator, duration/yr, step/yr)
|
title = "Relative difference of the {} "+"for a system composed of {0:s}\n integrated with {1:s} for a duration of {2:.2f} years with a step of {3:.2e} years.".format(bodies, integrator, duration/yr, step/yr)
|
||||||
fig1 = plt.figure(figsize=(15,7))
|
fig1 = plt.figure(figsize=(15,7))
|
||||||
ax1 = fig1.add_subplot(111)
|
ax1 = fig1.add_subplot(111)
|
||||||
ax1.plot(np.arange(E.shape[0])*step/yr, np.abs((E-E[0])/E[0]), label=r"$\left|\frac{\delta E_m}{E_m(t=0)}\right|$")
|
ax1.plot(np.arange(E.shape[0])*step/yr, np.abs((E-E[0])/E[0]), label=r"$\left|\frac{\delta E_m}{E_m(t=0)}\right|$")
|
||||||
|
|||||||
8
main.py
@@ -25,16 +25,16 @@ def main():
|
|||||||
v = np.array([v1, v2, v3])
|
v = np.array([v1, v2, v3])
|
||||||
|
|
||||||
bodylist = []
|
bodylist = []
|
||||||
for i in range(2):
|
for i in range(3):
|
||||||
bodylist.append(Body(m[i], q[i], v[i]))
|
bodylist.append(Body(m[i], q[i], v[i]))
|
||||||
dyn_syst = System(bodylist)
|
dyn_syst = System(bodylist)
|
||||||
dyn_syst.COMShift()
|
dyn_syst.COMShift()
|
||||||
|
|
||||||
duration, step = 100*yr, 1e4
|
duration, step = 100*yr, 1e4
|
||||||
#E, L = dyn_syst.leapfrog(duration, step, recover_param=True)#, display=True)
|
#E, L = dyn_syst.leapfrog(duration, step, recover_param=True, display=True)
|
||||||
E, L = dyn_syst.hermite(duration,step, recover_param=True)#, display=True)
|
E, L = dyn_syst.hermite(duration,step, recover_param=True, display=True)
|
||||||
parameters = [duration, step, dyn_syst, "hermite"]
|
parameters = [duration, step, dyn_syst, "hermite"]
|
||||||
display_parameters(E, L, parameters=parameters, savename="2bodies_hermite")
|
display_parameters(E, L, parameters=parameters, savename="3bodies_hermite")
|
||||||
|
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 86 KiB After Width: | Height: | Size: 87 KiB |
|
Before Width: | Height: | Size: 48 KiB After Width: | Height: | Size: 51 KiB |
|
Before Width: | Height: | Size: 73 KiB After Width: | Height: | Size: 100 KiB |
|
Before Width: | Height: | Size: 47 KiB After Width: | Height: | Size: 74 KiB |
|
Before Width: | Height: | Size: 319 KiB After Width: | Height: | Size: 90 KiB |
|
Before Width: | Height: | Size: 320 KiB After Width: | Height: | Size: 53 KiB |
|
Before Width: | Height: | Size: 444 KiB After Width: | Height: | Size: 549 KiB |
|
Before Width: | Height: | Size: 292 KiB |
|
Before Width: | Height: | Size: 307 KiB |
BIN
plots/3bodies_leapfrog_dEm.png
Normal file
|
After Width: | Height: | Size: 103 KiB |
BIN
plots/3bodies_leapfrog_dL2.png
Normal file
|
After Width: | Height: | Size: 76 KiB |
|
Before Width: | Height: | Size: 796 KiB After Width: | Height: | Size: 362 KiB |