1
0

Add E and L outputsfor hermite integrator

This commit is contained in:
Thibault Barnouin
2021-11-05 22:40:33 +01:00
parent 04a4dd6e6a
commit b2234afeca
3 changed files with 11 additions and 7 deletions

View File

@@ -163,7 +163,7 @@ class System:
for body in self.bodylist:
body.p = body.v*body.m
def hermite(self, duration, dt, display=False):
def hermite(self, duration, dt, recover_param=False, display=False):
if display:
try:
system("mkdir tmp")
@@ -173,9 +173,14 @@ class System:
d.on_launch()
N = np.ceil(duration/dt).astype(int)
E = np.zeros(N)
L = np.zeros((N,3))
for j in range(N):
self.HPC(dt)
E[j] = self.Eval()
L[j] = self.Lval()
if display:
# display progression
q_array = self.get_positions()
@@ -183,7 +188,7 @@ class System:
d.on_running(q_array[0], q_array[1], q_array[2], step=j, label="step {0:d}/{1:d}".format(j,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))
#time.sleep(1e-5)
return 1
if recover_param:
return E, L