From cfe63efaaf3f8e6e624d1a680655fed42d0f8236 Mon Sep 17 00:00:00 2001 From: "L. Diana Amorim" Date: Wed, 18 Dec 2019 09:55:00 -0800 Subject: Fix to RZ scalar moving window Tried to make exception message clearer --- Python/pywarpx/picmi.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'Python/pywarpx/picmi.py') diff --git a/Python/pywarpx/picmi.py b/Python/pywarpx/picmi.py index 6e9c9153b..2dc08bf37 100644 --- a/Python/pywarpx/picmi.py +++ b/Python/pywarpx/picmi.py @@ -326,13 +326,14 @@ class CylindricalGrid(picmistandard.PICMI_CylindricalGrid): pywarpx.geometry.prob_hi = self.upper_bound pywarpx.warpx.n_rz_azimuthal_modes = self.n_azimuthal_modes - 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.: - raise Exception('In cylindrical coordinates, a moving window in r can not be done') - 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.moving_window_velocity is not None: + if np.isscalar(self.moving_window_velocity): + if self.moving_window_velocity !=0: + pywarpx.warpx.do_moving_window = 1 + pywarpx.warpx.moving_window_dir = 'z' + pywarpx.warpx.moving_window_v = self.moving_window_velocity/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.refined_regions: assert len(self.refined_regions) == 1, Exception('WarpX only supports one refined region.') -- cgit v1.2.3 From 32d00398e92821f093a6dd573e789d64457540df Mon Sep 17 00:00:00 2001 From: "L. Diana Amorim" Date: Wed, 18 Dec 2019 13:41:28 -0800 Subject: Corrected WarpX RZ to use PICMI moving_window_zvelocity --- Python/pywarpx/picmi.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'Python/pywarpx/picmi.py') diff --git a/Python/pywarpx/picmi.py b/Python/pywarpx/picmi.py index 2dc08bf37..ce0f1f0e6 100644 --- a/Python/pywarpx/picmi.py +++ b/Python/pywarpx/picmi.py @@ -326,15 +326,18 @@ class CylindricalGrid(picmistandard.PICMI_CylindricalGrid): pywarpx.geometry.prob_hi = self.upper_bound pywarpx.warpx.n_rz_azimuthal_modes = self.n_azimuthal_modes - if self.moving_window_velocity is not None: - if np.isscalar(self.moving_window_velocity): - if self.moving_window_velocity !=0: + 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_velocity/constants.c # in units of the speed of light + 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: + raise Exception('PICMI RZ geometry uses moving_window_zvelocity (scalar) instead of moving_window_velocity (vector)') + if self.refined_regions: assert len(self.refined_regions) == 1, Exception('WarpX only supports one refined region.') assert self.refined_regions[0][0] == 1, Exception('The one refined region can only be level 1') -- cgit v1.2.3 From c26e7d89449586a17c9d2db1e20b916f3a484c49 Mon Sep 17 00:00:00 2001 From: "L. Diana Amorim" Date: Wed, 18 Dec 2019 13:53:10 -0800 Subject: moving_window_velocity does not exist in PICMI RZ --- Python/pywarpx/picmi.py | 3 --- 1 file changed, 3 deletions(-) (limited to 'Python/pywarpx/picmi.py') diff --git a/Python/pywarpx/picmi.py b/Python/pywarpx/picmi.py index ce0f1f0e6..a21775732 100644 --- a/Python/pywarpx/picmi.py +++ b/Python/pywarpx/picmi.py @@ -334,9 +334,6 @@ class CylindricalGrid(picmistandard.PICMI_CylindricalGrid): 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: - raise Exception('PICMI RZ geometry uses moving_window_zvelocity (scalar) instead of moving_window_velocity (vector)') if self.refined_regions: assert len(self.refined_regions) == 1, Exception('WarpX only supports one refined region.') -- cgit v1.2.3