Skip to content

Commit

Permalink
Make moving window dimensionality consistent in PICMI (#2721)
Browse files Browse the repository at this point in the history
* Make moving window dimensionality consistent in PICMI

* update PICMI_inputs_plasma_acceleration_1d.py

* two elements for moving window velocity in RZ

* update RZ laser_acceration test

* update PICMI version

* update PICMI Langmuir RZ test
  • Loading branch information
prkkumar authored Jan 12, 2022
1 parent 915d574 commit 652202d
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
upper_boundary_conditions = ['dirichlet'],
lower_boundary_conditions_particles = ['absorbing'],
upper_boundary_conditions_particles = ['absorbing'],
moving_window_velocity = [0., 0., c],
moving_window_velocity = [c],
warpx_max_grid_size = max_grid_size,
warpx_blocking_factor = blocking_factor)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
upper_boundary_conditions = ['dirichlet', 'dirichlet'],
lower_boundary_conditions_particles = ['absorbing', 'absorbing'],
upper_boundary_conditions_particles = ['absorbing', 'absorbing'],
moving_window_zvelocity = c,
moving_window_velocity = [0., c],
warpx_max_grid_size = max_grid_size,
warpx_blocking_factor = blocking_factor)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
zmin = -200.e-6
zmax = +200.e-6

moving_window_velocity = [0., 0., constants.c]
moving_window_velocity = [constants.c]

number_per_cell_each_dim = [10]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@
upper_boundary_conditions = ['none', 'periodic'],
lower_boundary_conditions_particles = ['absorbing', 'periodic'],
upper_boundary_conditions_particles = ['absorbing', 'periodic'],
moving_window_zvelocity = 0.,
moving_window_velocity = [0.,0.],
warpx_max_grid_size=64)

solver = picmi.ElectromagneticSolver(grid=grid, cfl=1.)
Expand Down
20 changes: 10 additions & 10 deletions Python/pywarpx/picmi.py
Original file line number Diff line number Diff line change
Expand Up @@ -444,14 +444,14 @@ def initialize_inputs(self):
pywarpx.boundary.particle_lo = [self.bc_rmin_particles, self.bc_zmin_particles]
pywarpx.boundary.particle_hi = [self.bc_rmax_particles, self.bc_zmax_particles]

if self.moving_window_zvelocity is not None:
if np.isscalar(self.moving_window_zvelocity):
if self.moving_window_zvelocity !=0:
pywarpx.warpx.do_moving_window = 1
pywarpx.warpx.moving_window_dir = 'z'
pywarpx.warpx.moving_window_v = self.moving_window_zvelocity/constants.c # in units of the speed of light
else:
raise Exception('RZ PICMI moving_window_velocity (only available in z direction) should be a scalar')
if self.moving_window_velocity is not None and np.any(np.not_equal(self.moving_window_velocity, 0.)):
pywarpx.warpx.do_moving_window = 1
if self.moving_window_velocity[0] != 0.:
pywarpx.warpx.moving_window_dir = 'r'
pywarpx.warpx.moving_window_v = self.moving_window_velocity[0]/constants.c # in units of the speed of light
if self.moving_window_velocity[1] != 0.:
pywarpx.warpx.moving_window_dir = 'z'
pywarpx.warpx.moving_window_v = self.moving_window_velocity[1]/constants.c # in units of the speed of light

if self.refined_regions:
assert len(self.refined_regions) == 1, Exception('WarpX only supports one refined region.')
Expand Down Expand Up @@ -501,9 +501,9 @@ def initialize_inputs(self):

if self.moving_window_velocity is not None and np.any(np.not_equal(self.moving_window_velocity, 0.)):
pywarpx.warpx.do_moving_window = 1
if self.moving_window_velocity[2] != 0.:
if self.moving_window_velocity[0] != 0.:
pywarpx.warpx.moving_window_dir = 'z'
pywarpx.warpx.moving_window_v = self.moving_window_velocity[2]/constants.c # in units of the speed of light
pywarpx.warpx.moving_window_v = self.moving_window_velocity[0]/constants.c # in units of the speed of light

if self.refined_regions:
assert len(self.refined_regions) == 1, Exception('WarpX only supports one refined region.')
Expand Down
2 changes: 1 addition & 1 deletion Python/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
package_dir = {'pywarpx': 'pywarpx'},
description = """Wrapper of WarpX""",
package_data = package_data,
install_requires = ['numpy', 'picmistandard==0.0.18', 'periodictable'],
install_requires = ['numpy', 'picmistandard==0.0.19', 'periodictable'],
python_requires = '>=3.6',
zip_safe=False
)
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ numpy~=1.15
periodictable~=1.5

# PICMI
picmistandard==0.0.18
picmistandard==0.0.19
# for development against an unreleased PICMI version, use:
#picmistandard @ git+https://github.com/picmi-standard/picmi.git#subdirectory=PICMI_Python

Expand Down

0 comments on commit 652202d

Please sign in to comment.