1
0

debugg integrator

This commit is contained in:
Thibault Barnouin
2021-10-15 18:42:43 +02:00
parent 69f4233ac3
commit 87108df552

10
lib/integrator.py Normal file → Executable file
View File

@@ -12,14 +12,14 @@ def dp_dt(m_array, q_array):
Time derivative of the momentum, given by the position derivative of the Hamiltonian. Time derivative of the momentum, given by the position derivative of the Hamiltonian.
dp/dt = -dH/dq dp/dt = -dH/dq
""" """
dp_array = np.zeros((q_array.shape[0],3)) dp_array = np.zeros(q_array.shape)
for i in range(q_array.shape[0]): for i in range(q_array.shape[0]):
m_j = np.delete(m_array) m_j = np.delete(m_array, i)
q_j = np.delete(q_array) q_j = np.delete(q_array, i, 0)
dp_array[i] = m_array[i]*np.sum(m_j*/(q_j-q_array[i])**2, axis=0) dp_array = m_array[i]*np.sum((m_j/np.sum((q_j-q_array[i])**3, axis=1)).reshape((q_j.shape[0],1))*(q_j-q_array[i]), axis=0)
return dp_array return dp_array
def leapfrog(duration, step, m_array, q_array, p_array): def frogleap(duration, step, m_array, q_array, p_array):
""" """
Leapfrog integrator for first order partial differential equations. Leapfrog integrator for first order partial differential equations.
iteration : half-step drift -> full-step kick -> half-step drift iteration : half-step drift -> full-step kick -> half-step drift