Commit a88b858d authored by Max Capelle's avatar Max Capelle

add kinetic energy

parent 1f121b88
......@@ -216,13 +216,15 @@ def dynamics(bodies, D, h, t_max, barnes_hut, theta):
force1 = force_barneshut(all_pos[i], mass, theta)
velo = velocity(velo, force0, force1, h)
force0 = force1
times.append(h*i)
E_kin = 0.5*mass*(np.linalg.norm(velo, axis=1)**2)
times.append(h*i)
else:
for i in range(1,T+1):
all_pos[i] = position(all_pos[i-1], velo, force0, h)
force1 = force_calc(mass, all_pos[i], D)
velo = velocity(velo, force0, force1, h)
force0 = force1
E_kin = 0.5*mass*(np.linalg.norm(velo, axis=1)**2)
times.append(h*i)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment