Skip to content

Commit 8e23ad3

Browse files
committed
Update dimensions of data
1 parent 1545a60 commit 8e23ad3

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

Examples/Tests/particles_in_pml/analysis_particles_in_pml.py

+9-1
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,16 @@
3030
filename = sys.argv[1]
3131
ds = yt.load( filename )
3232

33+
# When extracting the fields, choose the right dimensions
34+
dimensions = [ n_pts for n_pts in ds.domain_dimensions ]
35+
if ds.max_level == 1:
36+
dimensions[0] *= 2
37+
dimensions[1] *= 2
38+
if ds.dimensionality == 3:
39+
dimensions[2] *= 2
40+
3341
# Check that the field is low enough
34-
ad0 = ds.covering_grid(level=ds.max_level, left_edge=ds.domain_left_edge, dims=ds.domain_dimensions)
42+
ad0 = ds.covering_grid(level=ds.max_level, left_edge=ds.domain_left_edge, dims=dimensions)
3543
Ex_array = ad0[('mesh','Ex')].to_ndarray()
3644
Ey_array = ad0[('mesh','Ey')].to_ndarray()
3745
Ez_array = ad0[('mesh','Ez')].to_ndarray()

0 commit comments

Comments
 (0)