blob: 0d9fc24c5c419704c6b3f9f6186cad8a0a43476f (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
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)
|