diff --git a/jobs/tests/test_integrator.py b/jobs/tests/test_integrator.py index 3192c19b2163ad2e26d21807da12792c631605ac..ad4b9e12bf4cd1aba4b7e2c2ff3ef790f36124c4 100644 --- a/jobs/tests/test_integrator.py +++ b/jobs/tests/test_integrator.py @@ -67,7 +67,7 @@ class IntegratorTest(unittest.TestCase): """ system = GravitationalSystem(r0=x0[:4], - v0=x0[:4], + v0=x0[4:], m=np.array([M_E, M_E, M_L, M_L]), t=np.linspace(0, T, int(T // dt)), force=force, @@ -79,13 +79,13 @@ class IntegratorTest(unittest.TestCase): H = np.linalg.norm(p[:,:2], axis=1)**2 / (2 * M_E) + np.linalg.norm(p[:,2:], axis=1)**2 / (2 * M_L) + \ -G * M_S * M_E / np.linalg.norm(q[:,:2], axis=1) - G * M_S * M_L / np.linalg.norm(q[:,2:], axis=1) + \ -G * M_E * M_L / np.linalg.norm(q[:,2:] - q[:,:2], axis=1) - self.assertTrue(np.greater(1e-2 + np.zeros(H.shape[0]), - H - H[0]).all()) #TODO: why is it so badly conserved..., DEBUG another day... + + self.assertTrue(np.greater(1e-10 + np.zeros(H.shape[0]), H - H[0]).all()) ## checking total momentum conservation - L = np.cross(q[:, :2], p[:, :2]) + np.cross(q[:, 2:], p[:, - 2:]) # TODO: strange behaviour..., DEBUG another day... - self.assertTrue(np.array_equal(np.zeros(L.shape[0]), L)) + L = np.cross(q[:, :2], p[:, :2]) + np.cross(q[:, 2:], p[:, 2:]) + + self.assertTrue(np.greater(1e-10 + np.zeros(L.shape[0]), L - L[0]).all()) if __name__ == '__main__':