aboutsummaryrefslogtreecommitdiff
path: root/Exec/Langmuir/python/Langmuir.py
diff options
context:
space:
mode:
Diffstat (limited to '')
-rwxr-xr-xExec/Langmuir/python/Langmuir.py29
1 files changed, 14 insertions, 15 deletions
diff --git a/Exec/Langmuir/python/Langmuir.py b/Exec/Langmuir/python/Langmuir.py
index 672da52a4..6a6e4f2f6 100755
--- a/Exec/Langmuir/python/Langmuir.py
+++ b/Exec/Langmuir/python/Langmuir.py
@@ -3,23 +3,22 @@
import matplotlib.pyplot as plt
import warpx
-warpx.initialize()
+with warpx.script():
-# run for ten time steps
-warpx.evolve()
+ # run for ten time steps
+ warpx.evolve(10)
-x = warpx.get_particle_x(0)
-y = warpx.get_particle_y(0)
-plt.plot(x[0], y[0], '.')
-plt.savefig("particles.png")
+ x = warpx.get_particle_x(0)
+ y = warpx.get_particle_y(0)
+ plt.plot(x[0], y[0], '.')
+ plt.savefig("particles.png")
-# this returns a list of numpy arrays that hold the magnetic field
-# data in the x-direction on each grid for level 0
-grid_data = warpx.get_mesh_magnetic_field(0, 0, False)
+ # this returns a list of numpy arrays that hold the magnetic field
+ # data in the x-direction on each grid for level 0
+ grid_data = warpx.get_mesh_magnetic_field(0, 0, False)
-# plot a slice through the second grid
-plt.clf()
-plt.pcolormesh(grid_data[1][9,:,:])
-plt.savefig("field.png")
+ # plot a slice through the second grid
+ plt.clf()
+ plt.pcolormesh(grid_data[1][9,:,:])
+ plt.savefig("field.png")
-warpx.finalize()