diff options
author | 2017-03-24 16:47:52 -0700 | |
---|---|---|
committer | 2017-03-24 16:47:52 -0700 | |
commit | de2018160a850900e3a285620ad216cd848c5c3b (patch) | |
tree | 835b658a358e3eb1635202dfab0eec3049b8c4ca /Exec/Langmuir/python/Langmuir.py | |
parent | bebcc15bb1f920672edf6f159983367abf4acc94 (diff) | |
download | WarpX-de2018160a850900e3a285620ad216cd848c5c3b.tar.gz WarpX-de2018160a850900e3a285620ad216cd848c5c3b.tar.zst WarpX-de2018160a850900e3a285620ad216cd848c5c3b.zip |
make the python driver usable from the interpreter.
Diffstat (limited to 'Exec/Langmuir/python/Langmuir.py')
-rwxr-xr-x | Exec/Langmuir/python/Langmuir.py | 29 |
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() |