|
6 | 6 | "source": [ |
7 | 7 | "# Overview\n", |
8 | 8 | "\n", |
9 | | - "This a notebook that inspects the results of a WarpX simulation.\n", |
10 | | - "\n", |
11 | | - "# Instruction\n", |
12 | | - "\n", |
13 | | - "Enter the path of the data you wish to visualize below. Then execute the cells one by one, by selecting them with your mouse and typing `Shift + Enter`" |
| 9 | + "This a notebook that inspects the results of a WarpX simulation." |
14 | 10 | ] |
15 | 11 | }, |
16 | 12 | { |
|
34 | 30 | "## Read data in the simulation frame" |
35 | 31 | ] |
36 | 32 | }, |
| 33 | + { |
| 34 | + "cell_type": "markdown", |
| 35 | + "metadata": {}, |
| 36 | + "source": [ |
| 37 | + "# Instruction\n", |
| 38 | + "\n", |
| 39 | + "Enter the path of the data you wish to visualize below. Then execute the cells one by one, by selecting them with your mouse and typing `Shift + Enter`" |
| 40 | + ] |
| 41 | + }, |
| 42 | + { |
| 43 | + "cell_type": "code", |
| 44 | + "execution_count": null, |
| 45 | + "metadata": {}, |
| 46 | + "outputs": [], |
| 47 | + "source": [ |
| 48 | + "plotfile = './diags/plotfiles/plt00001'\n", |
| 49 | + "field = 'Ex'\n", |
| 50 | + "species = 'electron'\n", |
| 51 | + "ds = yt.load( plotfile ) # Load the plotfile\n", |
| 52 | + "# ds.field_list # Print all available quantities" |
| 53 | + ] |
| 54 | + }, |
37 | 55 | { |
38 | 56 | "cell_type": "markdown", |
39 | 57 | "metadata": {}, |
|
47 | 65 | "metadata": {}, |
48 | 66 | "outputs": [], |
49 | 67 | "source": [ |
50 | | - "ds = yt.load( '../Examples/Modules/RigidInjection/diags/plotfiles/plt00318/' ) # Create a dataset object\n", |
51 | | - "sl = yt.SlicePlot(ds, 2, 'Ex', aspect=.2) # Create a sliceplot object\n", |
52 | | - "sl.annotate_particles(width=(10.e-6, 'm'), p_size=2, ptype='beam', col='black')\n", |
| 68 | + "sl = yt.SlicePlot(ds, 2, field, aspect=.2) # Create a sliceplot object\n", |
| 69 | + "sl.annotate_particles(width=(10.e-6, 'm'), p_size=2, ptype=species, col='black')\n", |
53 | 70 | "sl.annotate_grids() # Show grids\n", |
54 | | - "sl.show() # Show the plot\n", |
55 | | - "# sl.save('./toto.png')" |
| 71 | + "sl.show() # Show the plot" |
56 | 72 | ] |
57 | 73 | }, |
58 | 74 | { |
|
70 | 86 | "source": [ |
71 | 87 | "# Get field quantities\n", |
72 | 88 | "all_data_level_0 = ds.covering_grid(level=0,left_edge=ds.domain_left_edge, dims=ds.domain_dimensions)\n", |
73 | | - "Bx = all_data_level_0['boxlib', 'Ex'].v.squeeze()\n", |
| 89 | + "Bx = all_data_level_0['boxlib', field].v.squeeze()\n", |
74 | 90 | "Dx = ds.domain_width/ds.domain_dimensions\n", |
75 | 91 | "extent = [ds.domain_left_edge[ds.dimensionality-1], ds.domain_right_edge[ds.dimensionality-1],\n", |
76 | 92 | " ds.domain_left_edge[0], ds.domain_right_edge[0] ]\n", |
77 | 93 | "\n", |
78 | 94 | "# Get particle quantities\n", |
79 | 95 | "ad = ds.all_data()\n", |
80 | | - "x = ad['beam', 'particle_position_x'].v\n", |
81 | | - "z = ad['beam', 'particle_position_y'].v\n", |
| 96 | + "x = ad[species, 'particle_position_x'].v\n", |
| 97 | + "z = ad[species, 'particle_position_y'].v\n", |
82 | 98 | "\n", |
83 | 99 | "# Plot image\n", |
84 | 100 | "plt.figure()\n", |
85 | 101 | "plt.imshow(Bx, extent=extent)\n", |
86 | | - "plt.scatter(z,x,s=.1,c='k')\n", |
87 | | - "\n", |
88 | | - "# Print all available quantities\n", |
89 | | - "ds.field_list" |
| 102 | + "plt.scatter(z,x,s=.1,c='k')" |
90 | 103 | ] |
91 | 104 | }, |
92 | 105 | { |
|
113 | 126 | "metadata": {}, |
114 | 127 | "outputs": [], |
115 | 128 | "source": [ |
116 | | - "species = 'beam'\n", |
117 | 129 | "iteration = 1\n", |
118 | | - "field = 'Ex'\n", |
119 | 130 | "\n", |
120 | 131 | "snapshot = './lab_frame_data/' + 'snapshot' + str(iteration).zfill(5)\n", |
121 | 132 | "header = './lab_frame_data/Header'\n", |
|
0 commit comments