diff --git a/lib/objects.py b/lib/objects.py index 7b3546e..7136541 100755 --- a/lib/objects.py +++ b/lib/objects.py @@ -132,13 +132,13 @@ class System: E[j] = self.Eval() L[j] = self.Lval() - if display and j%100==0: + if display and (j+1)%100==0: # display progression q_array = self.get_positions() if len(self.bodylist) == 1: - d.on_running(q_array[0], q_array[1], q_array[2], step=j, label="step {0:d}/{1:d}".format(j,N)) + d.on_running(q_array[0], q_array[1], q_array[2], step=j, label="step {0:d}/{1:d}".format(j+1,N)) else: - d.on_running(q_array[:,0], q_array[:,1], q_array[:,2], step=j, label="step {0:d}/{1:d}".format(j,N)) + d.on_running(q_array[:,0], q_array[:,1], q_array[:,2], step=j, label="step {0:d}/{1:d}".format(j+1,N)) if display: system("convert -delay 5 -loop 0 tmp/??????.png tmp/temp.gif && rm tmp/??????.png") system("convert tmp/temp.gif -fuzz 30% -layers Optimize plots/dynsyst.gif && rm tmp/temp.gif") @@ -228,13 +228,13 @@ class System: E[j] = self.Eval() L[j] = self.Lval() - if display and j%100==0: + if display and (j+1)%100==0: # display progression q_array = self.get_positions() if len(self.bodylist) == 1: - d.on_running(q_array[0], q_array[1], q_array[2], step=j, label="step {0:d}/{1:d}".format(j,N)) + d.on_running(q_array[0], q_array[1], q_array[2], step=j, label="step {0:d}/{1:d}".format(j+1,N)) else: - d.on_running(q_array[:,0], q_array[:,1], q_array[:,2], step=j, label="step {0:d}/{1:d}".format(j,N)) + d.on_running(q_array[:,0], q_array[:,1], q_array[:,2], step=j, label="step {0:d}/{1:d}".format(j+1,N)) if display: system("convert -delay 5 -loop 0 tmp/??????.png tmp/temp.gif && rm tmp/??????.png") system("convert tmp/temp.gif -fuzz 30% -layers Optimize plots/dynsyst.gif && rm tmp/temp.gif") diff --git a/main.py b/main.py index 76a187a..45025a1 100755 --- a/main.py +++ b/main.py @@ -16,13 +16,13 @@ def main(): e = np.array([0., 0., 1./4.]) # Eccentricity psi = np.array([0., 0., 80.])*np.pi/180. # Inclination of the orbital plane in degrees - x1 = np.array([-1., 0., 0.])*a[0] - x2 = np.array([1., 0., 0.])*a[1] + x1 = np.array([0., -1., 0.])*a[0] + x2 = np.array([0., 1., 0.])*a[1] x3 = np.array([np.cos(psi[2]), 0., np.sin(psi[2])])*a[2] q = np.array([x1, x2, x3]) - v1 = np.array([0., -np.sqrt(G*m[1]**2/((m[0]+m[1])*np.sqrt(np.sum((q[0]-q[1])**2)))), 0.]) - v2 = np.array([0., np.sqrt(G*m[0]**2/((m[0]+m[1])*np.sqrt(np.sum((q[0]-q[1])**2)))), 0.]) + v1 = np.array([-np.sqrt(G*m[1]**2/((m[0]+m[1])*np.sqrt(np.sum((q[0]-q[1])**2)))), 0., 0.]) + v2 = np.array([np.sqrt(G*m[0]**2/((m[0]+m[1])*np.sqrt(np.sum((q[0]-q[1])**2)))), 0., 0.]) v3 = np.array([0., np.sqrt(G*(m[0]+m[1])*(2./np.sqrt(np.sum(q[2]**2))-1./a[2])), 0.]) v = np.array([v1, v2, v3]) diff --git a/plots/Em.png b/plots/Em.png new file mode 100644 index 0000000..cda35e4 Binary files /dev/null and b/plots/Em.png differ diff --git a/plots/L2.png b/plots/L2.png new file mode 100644 index 0000000..be8b545 Binary files /dev/null and b/plots/L2.png differ