diff options
Diffstat (limited to 'Examples/Tests/particle_pusher/analysis_pusher.py')
-rwxr-xr-x | Examples/Tests/particle_pusher/analysis_pusher.py | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/Examples/Tests/particle_pusher/analysis_pusher.py b/Examples/Tests/particle_pusher/analysis_pusher.py new file mode 100755 index 000000000..0d9fc24c5 --- /dev/null +++ b/Examples/Tests/particle_pusher/analysis_pusher.py @@ -0,0 +1,30 @@ +#! /usr/bin/env python + +# This script tests the particle pusher (HC) +# using a force-free field, +# in which position x should remain 0. +# An initial velocity Vy corresponding to +# Lorentz factor = 20 is used. +# Bz is fixed at 1 T. +# Ex = -Vy*Bz. + +# Possible errors: +# Boris: 2321.3958529 +# Vay: 0.00010467 +# HC: 0.00011403 +# tolerance: 0.001 +# Possible running time: ~ 4.0 s + +import sys +import yt + +tolerance = 0.001 + +filename = sys.argv[1] +ds = yt.load( filename ) +ad = ds.all_data() +x = ad['particle_position_x'].to_ndarray() + +print('error = ', abs(x)) +print('tolerance = ', tolerance) +assert(abs(x) < tolerance) |