1
0
This commit is contained in:
Alex_Hubert
2021-11-05 22:58:32 +01:00
parent b2234afeca
commit 6206307f30
4 changed files with 9 additions and 4 deletions

View File

@@ -100,14 +100,16 @@ class System:
def Update_a(self): #update acceleration of bodies in system def Update_a(self): #update acceleration of bodies in system
for body in self.bodylist: for body in self.bodylist:
body.a = np.zeros(3)
for otherbody in self.bodylist: for otherbody in self.bodylist:
if body != otherbody: if body != otherbody:
rij = np.linalg.norm(body.q-otherbody.q) rij = np.linalg.norm(body.q-otherbody.q)
body.a = body.a - (body.q-otherbody.q)*G*otherbody.m/(rij**2) body.a = body.a - (body.q-otherbody.q)*G*otherbody.m/(rij**3)
return 1 return 1
def Update_j(self): #update jerk of bodies in system def Update_j(self): #update jerk of bodies in system
for body in self.bodylist: for body in self.bodylist:
body.j = np.zeros(3)
for otherbody in self.bodylist: for otherbody in self.bodylist:
if body != otherbody: if body != otherbody:
rij = np.linalg.norm(body.q-otherbody.q) rij = np.linalg.norm(body.q-otherbody.q)
@@ -121,18 +123,21 @@ class System:
for body in self.bodylist: for body in self.bodylist:
body.qp = body.q +dt*body.v+((dt**2)*body.a/2.)+((dt**3)*body.j/6.) body.qp = body.q +dt*body.v+((dt**2)*body.a/2.)+((dt**3)*body.j/6.)
body.vp = body.v + dt*body.a + ((dt**2)*body.j/2.) body.vp = body.v + dt*body.a + ((dt**2)*body.j/2.)
#print("v=",body.v," vp=" ,body.vp)
return 1 return 1
def Update_ap(self): #update acceleration of bodies in system def Update_ap(self): #update acceleration of bodies in system
for body in self.bodylist: for body in self.bodylist:
body.ap = np.zeros(3)
for otherbody in self.bodylist: for otherbody in self.bodylist:
if body != otherbody: if body != otherbody:
rij = np.linalg.norm(body.qp-otherbody.qp) rij = np.linalg.norm(body.qp-otherbody.qp)
body.ap = body.ap - (body.qp-otherbody.qp)*G*otherbody.m/(rij**2) body.ap = body.ap - (body.qp-otherbody.qp)*G*otherbody.m/(rij**3)
return 1 return 1
def Update_jp(self): #update jerk of bodies in system def Update_jp(self): #update jerk of bodies in system
for body in self.bodylist: for body in self.bodylist:
body.jp = np.zeros(3)
for otherbody in self.bodylist: for otherbody in self.bodylist:
if body != otherbody: if body != otherbody:
rij = np.linalg.norm(body.qp-otherbody.qp) rij = np.linalg.norm(body.qp-otherbody.qp)

View File

@@ -34,8 +34,8 @@ def main():
dyn_syst.COMShift() dyn_syst.COMShift()
duration, step = 100*3e7, 1e4 duration, step = 100*3e7, 1e4
E, L = frogleap(duration, step, dyn_syst, recover_param=True)#, display=True) #E, L = frogleap(duration, step, dyn_syst, 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)
fig1 = plt.figure(figsize=(30,15)) fig1 = plt.figure(figsize=(30,15))
ax1 = fig1.add_subplot(111) ax1 = fig1.add_subplot(111)

Binary file not shown.

Before

Width:  |  Height:  |  Size: 295 KiB

After

Width:  |  Height:  |  Size: 58 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 126 KiB

After

Width:  |  Height:  |  Size: 57 KiB