From fef5fa6db67eb81a560ddfaba12236f5bd0e7958 Mon Sep 17 00:00:00 2001
From: Cristian C Lalescu <Cristian.Lalescu@ds.mpg.de>
Date: Fri, 30 Oct 2015 10:28:51 +0100
Subject: [PATCH] add another centered difference approximation

---
 tests/test_base.py | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/tests/test_base.py b/tests/test_base.py
index 95c56fc9..23d1ebf1 100755
--- a/tests/test_base.py
+++ b/tests/test_base.py
@@ -137,19 +137,21 @@ def acceleration_test(c):
     acc = d['particles/tracers4/acceleration'].value
 
     num_acc1 = (- vel[ :-2] + vel[2:])/(2*d['parameters/dt'].value*d['parameters/niter_part'].value)
-    num_vel = (- pos[ :-2] + pos[2:])/(2*d['parameters/dt'].value*d['parameters/niter_part'].value)
     num_acc2 = (pos[ :-2] - 2*pos[1:-1] + pos[2:])/((d['parameters/dt'].value*d['parameters/niter_part'].value)**2)
     num_acc3 = (-vel[4:] + 8*vel[3:-1] - 8*vel[1:-3] + vel[:-4])/(12*d['parameters/dt'].value*d['parameters/niter_part'].value)
+    num_acc4 = (-pos[4:] + 16*pos[3:-1] - 30*pos[2:-2] + 16*pos[1:-3] - pos[:-4])/(12*(d['parameters/dt'].value*d['parameters/niter_part'].value)**2)
+    num_vel = (- pos[ :-2] + pos[2:])/(2*d['parameters/dt'].value*d['parameters/niter_part'].value)
 
     pid = np.unravel_index(np.argmax(np.abs(num_acc3 - acc[2:-2])), dims = num_acc3.shape)[1]
     fig = plt.figure()
     a = fig.add_subplot(111)
     col = ['red', 'green', 'blue']
     for cc in range(3):
-        a.plot(num_acc1[1:, pid, cc], color = col[cc])
-        a.plot(num_acc2[1:, pid, cc], color = col[cc], dashes = (2, 2))
-        a.plot(num_acc3[1:, pid, cc], color = col[cc], dashes = (3, 4))
-        a.plot(acc[2:, pid, cc], color = col[cc], dashes = (1, 1))
+        a.plot(num_acc1[2:, pid, cc], color = col[cc], dashes = (3, 4))
+        a.plot(num_acc2[2:, pid, cc], color = col[cc], dashes = (2, 2))
+        a.plot(num_acc3[1:, pid, cc], color = col[cc])
+        a.plot(num_acc4[1:, pid, cc], color = col[cc], dashes = (3, 5))
+        a.plot(acc[3:, pid, cc], color = col[cc], dashes = (1, 1))
     fig.savefig(os.path.join(c.work_dir, 'acc_test_{0}.pdf'.format(c.simname)))
     return None
 
-- 
GitLab