aboutsummaryrefslogtreecommitdiff
path: root/Exec/Langmuir/python/Langmuir.py
blob: 6a6e4f2f616e8b0990418b5b2982cfc1e96e45fd (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
#!/usr/bin/env python

import matplotlib.pyplot as plt
import warpx

with warpx.script():

    # 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")

    # 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")