diff options
author | 2021-06-07 16:45:05 -0700 | |
---|---|---|
committer | 2021-06-07 16:45:05 -0700 | |
commit | f2d6c5d9ffa04b27733987eb2e3124517579cbad (patch) | |
tree | e4e76fc3787e7464a59626da9b99973e600869be /Python/pywarpx/picmi.py | |
parent | 82b1cb5480466cb9ba582f1edbe04389bab9a32a (diff) | |
download | WarpX-f2d6c5d9ffa04b27733987eb2e3124517579cbad.tar.gz WarpX-f2d6c5d9ffa04b27733987eb2e3124517579cbad.tar.zst WarpX-f2d6c5d9ffa04b27733987eb2e3124517579cbad.zip |
Call function ReadBCParams() during python execution (#1972)
* added ReadBCParams() function call to python execution and added a test of the electrostatic solver executing from python
* added separate specification of particle boundary conditions in picmi setup and adjusted the inputs for existing tests to follow the new practice
* updated input for rz PICMI test and renamed the electrostatic test to follow standard practice
* added arguments for particle boundary conditions to Langmuir RZ test
* added dictionary to picmi.py to map from picmistandard field boundary condition specifications to that of WarpX
* fixes for failing unit tests; added key, pair 'none' to picmi dictionary of field BCs
* also using 'none' for upper boundary condition for RZ test Python_Langmuir_rz_multimode
Diffstat (limited to 'Python/pywarpx/picmi.py')
-rw-r--r-- | Python/pywarpx/picmi.py | 30 |
1 files changed, 27 insertions, 3 deletions
diff --git a/Python/pywarpx/picmi.py b/Python/pywarpx/picmi.py index 61f1b6c88..7b67656ca 100644 --- a/Python/pywarpx/picmi.py +++ b/Python/pywarpx/picmi.py @@ -17,6 +17,11 @@ import periodictable codename = 'warpx' picmistandard.register_codename(codename) +# dictionary to map field boundary conditions from picmistandard to WarpX +BC_map = { + 'open':'pml', 'dirichlet':'pec', 'periodic':'periodic', 'none':'none' +} + class constants: # --- Put the constants in their own namespace # --- Values from WarpXConst.H @@ -375,11 +380,16 @@ class CylindricalGrid(picmistandard.PICMI_CylindricalGrid): # Geometry pywarpx.geometry.coord_sys = 1 # RZ - pywarpx.geometry.is_periodic = '0 %d'%(self.bc_zmin=='periodic') # Is periodic? pywarpx.geometry.prob_lo = self.lower_bound # physical domain pywarpx.geometry.prob_hi = self.upper_bound pywarpx.warpx.n_rz_azimuthal_modes = self.n_azimuthal_modes + # Boundary conditions + pywarpx.boundary.field_lo = [BC_map[bc] for bc in [self.bc_rmin, self.bc_zmin]] + pywarpx.boundary.field_hi = [BC_map[bc] for bc in [self.bc_rmax, self.bc_zmax]] + 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: @@ -422,10 +432,15 @@ class Cartesian2DGrid(picmistandard.PICMI_Cartesian2DGrid): # Geometry pywarpx.geometry.coord_sys = 0 # Cartesian - pywarpx.geometry.is_periodic = '%d %d'%(self.bc_xmin=='periodic', self.bc_ymin=='periodic') # Is periodic? pywarpx.geometry.prob_lo = self.lower_bound # physical domain pywarpx.geometry.prob_hi = self.upper_bound + # Boundary conditions + pywarpx.boundary.field_lo = [BC_map[bc] for bc in [self.bc_xmin, self.bc_ymin]] + pywarpx.boundary.field_hi = [BC_map[bc] for bc in [self.bc_xmax, self.bc_ymax]] + pywarpx.boundary.particle_lo = [self.bc_xmin_particles, self.bc_ymin_particles] + pywarpx.boundary.particle_hi = [self.bc_xmax_particles, self.bc_ymax_particles] + 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.: @@ -468,10 +483,19 @@ class Cartesian3DGrid(picmistandard.PICMI_Cartesian3DGrid): # Geometry pywarpx.geometry.coord_sys = 0 # Cartesian - pywarpx.geometry.is_periodic = '%d %d %d'%(self.bc_xmin=='periodic', self.bc_ymin=='periodic', self.bc_zmin=='periodic') # Is periodic? pywarpx.geometry.prob_lo = self.lower_bound # physical domain pywarpx.geometry.prob_hi = self.upper_bound + # Boundary conditions + pywarpx.boundary.field_lo = [BC_map[bc] for bc in [self.bc_xmin, self.bc_ymin, self.bc_zmin]] + pywarpx.boundary.field_hi = [BC_map[bc] for bc in [self.bc_xmax, self.bc_ymax, self.bc_zmax]] + pywarpx.boundary.particle_lo = [ + self.bc_xmin_particles, self.bc_ymin_particles, self.bc_zmin_particles + ] + pywarpx.boundary.particle_hi = [ + self.bc_xmax_particles, self.bc_ymax_particles, self.bc_zmax_particles + ] + 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.: |