play with IC
This commit is contained in:
@@ -45,7 +45,7 @@ class DynamicUpdate():
|
|||||||
#We need to draw *and* flush
|
#We need to draw *and* flush
|
||||||
self.fig.canvas.draw()
|
self.fig.canvas.draw()
|
||||||
self.fig.canvas.flush_events()
|
self.fig.canvas.flush_events()
|
||||||
if not step is None and step%100==0:
|
if not step is None and step%10==0:
|
||||||
self.fig.savefig("tmp/{0:05d}.png".format(step),bbox_inches="tight")
|
self.fig.savefig("tmp/{0:05d}.png".format(step),bbox_inches="tight")
|
||||||
|
|
||||||
#Example
|
#Example
|
||||||
|
|||||||
12
main.py
12
main.py
@@ -13,8 +13,8 @@ globals()['au'] = 1.5e11 #Astronomical unit in m
|
|||||||
def main():
|
def main():
|
||||||
#initialisation
|
#initialisation
|
||||||
m = np.array([1, 1, 0.1])*Ms # Masses in Solar mass
|
m = np.array([1, 1, 0.1])*Ms # Masses in Solar mass
|
||||||
mu = m[0]*m[1]/(m[0]+m[1])
|
|
||||||
a = np.array([1., 1., 5.])*au # Semi-major axis in astronomical units
|
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., 80.])*np.pi/180. # Inclination of the orbital plane in degrees
|
psi = np.array([0., 0., 80.])*np.pi/180. # Inclination of the orbital plane in degrees
|
||||||
|
|
||||||
x1 = np.array([-1., 0., 0.])*a[0]
|
x1 = np.array([-1., 0., 0.])*a[0]
|
||||||
@@ -22,19 +22,19 @@ def main():
|
|||||||
x3 = np.array([np.cos(psi[2]), 0., np.sin(psi[2])])*a[2]
|
x3 = np.array([np.cos(psi[2]), 0., np.sin(psi[2])])*a[2]
|
||||||
q = np.array([x1, x2, x3])
|
q = np.array([x1, x2, x3])
|
||||||
|
|
||||||
v1 = np.array([0., -np.sqrt(G*mu/np.sqrt(np.sum(x1**2))), 0])
|
v1 = np.array([0., -1./3*np.sqrt(G*(m[0]+m[1])*a[0]*(1-e[0]**2)*(1+e[0])**2/np.sum(q[0]**2)), 0.])
|
||||||
v2 = np.array([0., np.sqrt(G*mu/np.sqrt(np.sum(x2**2))), 0.])
|
v2 = np.array([0., 1./3*np.sqrt(G*(m[0]+m[1])*a[1]*(1-e[1]**2)*(1+e[1])**2/np.sum(q[1]**2)), 0.])
|
||||||
v3 = np.array([0., np.sqrt(G*(m[0]+m[1])*(2./np.sqrt(np.sum(x3**2))-1./a[2])), 0.])
|
v3 = np.array([0., np.sqrt(G*(m[0]+m[1])*(2./np.sqrt(np.sum(x3**2))-1./a[2])), 0.])
|
||||||
v = np.array([v1, v2, v3])
|
v = np.array([v1, v2, v3])
|
||||||
|
|
||||||
bodylist = []
|
bodylist = []
|
||||||
for i in range(m.shape[0]):
|
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 = 0.5*3e7, 1e1
|
duration, step = 10*3e7, 5e5
|
||||||
E, L = frogleap(duration, step, dyn_syst, recover_param=True)#, display=True)
|
E, L = frogleap(duration, step, dyn_syst, recover_param=True, display=True)
|
||||||
|
|
||||||
fig1 = plt.figure(figsize=(30,15))
|
fig1 = plt.figure(figsize=(30,15))
|
||||||
ax1 = fig1.add_subplot(111)
|
ax1 = fig1.add_subplot(111)
|
||||||
|
|||||||
BIN
plots/Em.png
BIN
plots/Em.png
Binary file not shown.
|
Before Width: | Height: | Size: 58 KiB After Width: | Height: | Size: 107 KiB |
BIN
plots/L2.png
BIN
plots/L2.png
Binary file not shown.
|
Before Width: | Height: | Size: 57 KiB After Width: | Height: | Size: 105 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 350 KiB After Width: | Height: | Size: 277 KiB |
Reference in New Issue
Block a user