diff options
author | 2021-12-09 10:17:36 -0800 | |
---|---|---|
committer | 2021-12-09 10:17:36 -0800 | |
commit | f322cfc064e44588dc2548ebe9d9e000cfb34b12 (patch) | |
tree | 3459130d47628b1eedc911725c8a3898bb90a5c3 /Python/pywarpx/picmi.py | |
parent | a7ef28c432b9eda09d10c9682b2596e44b193e69 (diff) | |
download | WarpX-f322cfc064e44588dc2548ebe9d9e000cfb34b12.tar.gz WarpX-f322cfc064e44588dc2548ebe9d9e000cfb34b12.tar.zst WarpX-f322cfc064e44588dc2548ebe9d9e000cfb34b12.zip |
1D tests for plasma acceleration (#2593)
* modify requirements.txt and add input file for 1D Python pwfa
* add 1D Python plasma acceleration test to CI
* picmi version
* USE_PSATD=OFF for 1D
* Update Examples/Physics_applications/plasma_acceleration/PICMI_inputs_plasma_acceleration_1d.py
Co-authored-by: Axel Huebl <axel.huebl@plasma.ninja>
* Update Regression/WarpX-tests.ini
Co-authored-by: Axel Huebl <axel.huebl@plasma.ninja>
* Cartesian1D class in pywarpx/picmi.py
* requirements.txt: update picmistandard
* update picmi version
* requirements.txt: revert unintended changes
* 1D Laser Acceleration Test
* Update Examples/Physics_applications/laser_acceleration/inputs_1d
Co-authored-by: Axel Huebl <axel.huebl@plasma.ninja>
* Update Examples/Physics_applications/plasma_acceleration/PICMI_inputs_plasma_acceleration_1d.py
Co-authored-by: Axel Huebl <axel.huebl@plasma.ninja>
* add data_list to PICMI laser_acceleration test
* increase max steps and fix bug in pywarpx/picmi.py 1DCartesian moving window direction
* add data_lust to Python laser acceleration test
* picmistandard update
Co-authored-by: Prabhat Kumar <prabhatkumar@kraken.dhcp.lbl.gov>
Co-authored-by: Axel Huebl <axel.huebl@plasma.ninja>
Diffstat (limited to 'Python/pywarpx/picmi.py')
-rw-r--r-- | Python/pywarpx/picmi.py | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/Python/pywarpx/picmi.py b/Python/pywarpx/picmi.py index 460b21602..2efe6c1d4 100644 --- a/Python/pywarpx/picmi.py +++ b/Python/pywarpx/picmi.py @@ -463,6 +463,57 @@ class CylindricalGrid(picmistandard.PICMI_CylindricalGrid): pywarpx.amr.max_level = 0 +class Cartesian1DGrid(picmistandard.PICMI_Cartesian1DGrid): + def init(self, kw): + self.max_grid_size = kw.pop('warpx_max_grid_size', 32) + self.max_grid_size_x = kw.pop('warpx_max_grid_size_x', None) + self.blocking_factor = kw.pop('warpx_blocking_factor', None) + self.blocking_factor_x = kw.pop('warpx_blocking_factor_x', None) + + self.potential_xmin = None + self.potential_xmax = None + self.potential_ymin = None + self.potential_ymax = None + self.potential_zmin = kw.pop('warpx_potential_lo_z', None) + self.potential_zmax = kw.pop('warpx_potential_hi_z', None) + + def initialize_inputs(self): + pywarpx.amr.n_cell = self.number_of_cells + + # Maximum allowable size of each subdomain in the problem domain; + # this is used to decompose the domain for parallel calculations. + pywarpx.amr.max_grid_size = self.max_grid_size + pywarpx.amr.max_grid_size_x = self.max_grid_size_x + pywarpx.amr.blocking_factor = self.blocking_factor + pywarpx.amr.blocking_factor_x = self.blocking_factor_x + + # Geometry + pywarpx.geometry.coord_sys = 0 # Cartesian + 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]] + pywarpx.boundary.field_hi = [BC_map[bc] for bc in [self.bc_xmax]] + pywarpx.boundary.particle_lo = [self.bc_xmin_particles] + pywarpx.boundary.particle_hi = [self.bc_xmax_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[2] != 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 + + 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') + pywarpx.amr.max_level = 1 + pywarpx.warpx.fine_tag_lo = self.refined_regions[0][1] + pywarpx.warpx.fine_tag_hi = self.refined_regions[0][2] + # The refinement_factor is ignored (assumed to be [2,2]) + else: + pywarpx.amr.max_level = 0 + class Cartesian2DGrid(picmistandard.PICMI_Cartesian2DGrid): def init(self, kw): self.max_grid_size = kw.pop('warpx_max_grid_size', 32) |