diff --git a/lib/python/picongpu/picmi/grid.py b/lib/python/picongpu/picmi/grid.py index 098f00625f..2797d87ee5 100644 --- a/lib/python/picongpu/picmi/grid.py +++ b/lib/python/picongpu/picmi/grid.py @@ -59,26 +59,35 @@ def get_as_pypicongpu(self): "periodic": grid.BoundaryCondition.PERIODIC, } - assert self.bc_xmin in picongpu_boundary_condition_by_picmi_id, \ + assert self.lower_boundary_conditions[0] in \ + picongpu_boundary_condition_by_picmi_id, \ "X: boundary condition not supported" - assert self.bc_ymin in picongpu_boundary_condition_by_picmi_id, \ + assert self.lower_boundary_conditions[1] in \ + picongpu_boundary_condition_by_picmi_id, \ "Y: boundary condition not supported" - assert self.bc_zmin in picongpu_boundary_condition_by_picmi_id, \ + assert self.lower_boundary_conditions[2] in \ + picongpu_boundary_condition_by_picmi_id, \ "Z: boundary condition not supported" g = grid.Grid3D() - g.cell_size_x_si = (self.xmax - self.xmin) / self.nx - g.cell_size_y_si = (self.ymax - self.ymin) / self.ny - g.cell_size_z_si = (self.zmax - self.zmin) / self.nz - g.cell_cnt_x = self.nx - g.cell_cnt_y = self.ny - g.cell_cnt_z = self.nz + g.cell_size_x_si = (self.upper_bound[0] - self.lower_bound[0]) \ + / self.number_of_cells[0] + g.cell_size_y_si = (self.upper_bound[1] - self.lower_bound[1]) \ + / self.number_of_cells[1] + g.cell_size_z_si = (self.upper_bound[2] - self.lower_bound[2]) \ + / self.number_of_cells[2] + g.cell_cnt_x = self.number_of_cells[0] + g.cell_cnt_y = self.number_of_cells[1] + g.cell_cnt_z = self.number_of_cells[2] g.boundary_condition_x = \ - picongpu_boundary_condition_by_picmi_id[self.bc_xmin] + picongpu_boundary_condition_by_picmi_id[ + self.lower_boundary_conditions[0]] g.boundary_condition_y = \ - picongpu_boundary_condition_by_picmi_id[self.bc_ymin] + picongpu_boundary_condition_by_picmi_id[ + self.lower_boundary_conditions[1]] g.boundary_condition_z = \ - picongpu_boundary_condition_by_picmi_id[self.bc_zmin] + picongpu_boundary_condition_by_picmi_id[ + self.lower_boundary_conditions[2]] # gpu distribution # convert input to 3 integer list @@ -100,7 +109,10 @@ def get_as_pypicongpu(self): # check if gpu distribution fits grid # TODO: super_cell_size still hard coded super_cell_size = [8, 8, 4] - cells = [self.nx, self.ny, self.nz] + cells = [ + self.number_of_cells[0], + self.number_of_cells[1], + self.number_of_cells[2]] dim_name = ["x", "y", "z"] for dim in range(3): assert (((cells[dim] // g.n_gpus[dim]) // super_cell_size[dim]) diff --git a/lib/python/picongpu/picmi/simulation.py b/lib/python/picongpu/picmi/simulation.py index bd5d03a1ee..1e9ca99ad1 100644 --- a/lib/python/picongpu/picmi/simulation.py +++ b/lib/python/picongpu/picmi/simulation.py @@ -58,12 +58,15 @@ def __yee_compute_cfl_or_delta_t(self) -> None: assert "Yee" == self.solver.method assert isinstance(self.solver.grid, Cartesian3DGrid) - delta_x = (self.solver.grid.xmax - self.solver.grid.xmin) \ - / self.solver.grid.nx - delta_y = (self.solver.grid.ymax - self.solver.grid.ymin) \ - / self.solver.grid.ny - delta_z = (self.solver.grid.zmax - self.solver.grid.zmin) \ - / self.solver.grid.nz + delta_x = ((self.solver.grid.upper_bound[0] + - self.solver.grid.lower_bound[0]) + / self.solver.grid.number_of_cells[0]) + delta_y = ((self.solver.grid.upper_bound[1] + - self.solver.grid.lower_bound[1]) + / self.solver.grid.number_of_cells[1]) + delta_z = ((self.solver.grid.upper_bound[2] + - self.solver.grid.lower_bound[2]) + / self.solver.grid.number_of_cells[2]) if self.time_step_size is not None and \ self.solver.cfl is not None: diff --git a/lib/python/picongpu/pypicongpu/species/operation/densityprofile/densityprofile.py b/lib/python/picongpu/pypicongpu/species/operation/densityprofile/densityprofile.py index 396eb1ef3c..3caf22545f 100644 --- a/lib/python/picongpu/pypicongpu/species/operation/densityprofile/densityprofile.py +++ b/lib/python/picongpu/pypicongpu/species/operation/densityprofile/densityprofile.py @@ -35,8 +35,8 @@ def get_generic_profile_rendering_context(self) -> dict: retrieve a context valid for "any profile" Problem: Every profile has its respective schema, and it is difficult - in JSON (particularly in a mustache-compatible way) the type of the - schema. + in JSON (particularly in a mustache-compatible way) to get the type + of the schema. Solution: The normal rendering of profiles get_rendering_context() provides **only their parameters**, i.e. there is **no meta diff --git a/lib/python/picongpu/requirements.txt b/lib/python/picongpu/requirements.txt index 9449d2853b..363525ca9c 100644 --- a/lib/python/picongpu/requirements.txt +++ b/lib/python/picongpu/requirements.txt @@ -1,8 +1,8 @@ typeguard >= 2.12 sympy >= 1.9 chevron >= 0.13.1 -jsonschema >= 4.4.0 +jsonschema >= 4.17.3 scipy >= 1.7.1 -picmistandard >= 0.0.18 +picmistandard >= 0.0.22 -r extra/requirements.txt diff --git a/test/python/picongpu/compiling/distribution.py b/test/python/picongpu/compiling/distribution.py index 8b8da4c245..7d392aa223 100644 --- a/test/python/picongpu/compiling/distribution.py +++ b/test/python/picongpu/compiling/distribution.py @@ -46,16 +46,8 @@ def test_uniform(self): uniform_dist = picmi.UniformDistribution(density=8e24) self._compile_distribution(uniform_dist) - def test_analytic(self): - analytic_dist = picmi.AnalyticDistribution( - density_expression="a * sin(x) + z - sqrt(y)", - a=42) - self._compile_distribution(analytic_dist) - - def test_gaussian_bunch(self): - gaussian_dist = picmi.GaussianBunchDistribution( - 1283, 0.3e-7, centroid_position=[-1321, -4e-3, 0]) - self._compile_distribution(gaussian_dist) +# tests for analytic distribution and gaussian-bunch distribution have been +# removed for now, see issue #4367 for the test cases def test_temperature(self): uniform_dist = picmi.UniformDistribution( diff --git a/test/python/picongpu/compiling/simulation.py b/test/python/picongpu/compiling/simulation.py index 80f70f0b74..746264b839 100644 --- a/test/python/picongpu/compiling/simulation.py +++ b/test/python/picongpu/compiling/simulation.py @@ -33,13 +33,14 @@ def test_minimal(self): sim = pypicongpu.Simulation() sim.delta_t_si = 1.39e-16 sim.time_steps = 1 - sim.grid = pypicongpu.Grid3D() + sim.grid = pypicongpu.grid.Grid3D() sim.grid.cell_size_x_si = 1.776e-07 sim.grid.cell_size_y_si = 4.43e-08 sim.grid.cell_size_z_si = 1.776e-07 sim.grid.cell_cnt_x = 1 sim.grid.cell_cnt_y = 1 sim.grid.cell_cnt_z = 1 + sim.grid.n_gpus = (1, 1, 1) sim.grid.boundary_condition_x = \ pypicongpu.grid.BoundaryCondition.PERIODIC sim.grid.boundary_condition_y = \ diff --git a/test/python/picongpu/compiling/species.py b/test/python/picongpu/compiling/species.py index 9b78af4867..e6df428387 100644 --- a/test/python/picongpu/compiling/species.py +++ b/test/python/picongpu/compiling/species.py @@ -28,6 +28,7 @@ def setUp(self): laser = picmi.GaussianLaser(0.8e-6, 5.0e-6 / 1.17741, 5.0e-15, a0=8, propagation_direction=[0, 1, 0], + polarization_direction=[1, 0, 0], centroid_position=[ 0.5*grid.upper_bound[0], 0, diff --git a/test/python/picongpu/quick/picmi/gaussian_laser.py b/test/python/picongpu/quick/picmi/gaussian_laser.py index a97f747f18..32170f7225 100644 --- a/test/python/picongpu/quick/picmi/gaussian_laser.py +++ b/test/python/picongpu/quick/picmi/gaussian_laser.py @@ -55,6 +55,7 @@ def test_values_focal_pos(self): focal_position=[0, 7, .5], centroid_position=[.5, 0, .5], propagation_direction=[0, 1, 0], + polarization_direction=[1, 0, 0], E0=1) with self.assertRaisesRegex(Exception, ".*foc(us|al).*[xX].*"): picmi_laser.get_as_pypicongpu() @@ -65,6 +66,7 @@ def test_values_focal_pos(self): focal_position=[.5, 2, 500], centroid_position=[.5, 0, .5], propagation_direction=[0, 1, 0], + polarization_direction=[1, 0, 0], E0=1) with self.assertRaisesRegex(Exception, ".*foc(us|al).*[zZ].*"): picmi_laser.get_as_pypicongpu() @@ -75,6 +77,7 @@ def test_values_focal_pos(self): focal_position=[.5, -5, .5], centroid_position=[.5, 0, .5], propagation_direction=[0, 1, 0], + polarization_direction=[1, 0, 0], E0=1) self.assertEqual(-5, picmi_laser.get_as_pypicongpu().focus_pos) @@ -83,6 +86,7 @@ def test_values_focal_pos(self): focal_position=[.5, 0, .5], centroid_position=[.5, 0, .5], propagation_direction=[0, 1, 0], + polarization_direction=[1, 0, 0], E0=1) self.assertEqual(0, picmi_laser.get_as_pypicongpu().focus_pos) @@ -103,6 +107,7 @@ def test_values_propagation_direction(self): focal_position=[.5, 0, .5], centroid_position=[.5, 0, .5], propagation_direction=invalid_propagation_vector, + polarization_direction=[1, 0, 0], E0=1) with self.assertRaisesRegex(Exception, ".*propagation.*"): picmi_laser.get_as_pypicongpu() @@ -113,6 +118,7 @@ def test_values_propagation_direction(self): focal_position=[.5, 0, .5], centroid_position=[.5, 0, .5], propagation_direction=[0, 1, 0], + polarization_direction=[1, 0, 0], E0=1) def test_values_polarization(self): @@ -127,6 +133,8 @@ def test_values_polarization(self): for invalid_polarization in invalid_polarizations: picmi_laser = picmi.GaussianLaser( 1, 2, 3, + focal_position=[0, 0, 0], + centroid_position=[0, 0, 0], propagation_direction=[0, 1, 0], polarization_direction=invalid_polarization, E0=1) @@ -136,6 +144,8 @@ def test_values_polarization(self): # valid examples: picmi_laser = picmi.GaussianLaser( 1, 2, 3, + focal_position=[0, 0, 0], + centroid_position=[0, 0, 0], propagation_direction=[0, 1, 0], polarization_direction=[1, 0, 0], E0=1) @@ -146,6 +156,8 @@ def test_values_polarization(self): picmi_laser = picmi.GaussianLaser( 1, 2, 3, + focal_position=[0, 0, 0], + centroid_position=[0, 0, 0], propagation_direction=[0, 1, 0], polarization_direction=[0, 0, 1], E0=1) @@ -158,7 +170,10 @@ def test_minimal(self): """mimimal possible initialization""" # does not throw, normal usage process works picmi_laser = picmi.GaussianLaser(1, 2, 3, + focal_position=[0, 0, 0], + centroid_position=[0, 0, 0], propagation_direction=[0, 1, 0], + polarization_direction=[1, 0, 0], E0=1) pypic_laser = picmi_laser.get_as_pypicongpu() self.assertNotEqual({}, pypic_laser.get_rendering_context()) @@ -171,6 +186,7 @@ def test_values_centroid_position_y_is_zero(self): centroid_position=[1, 1, 1], focal_position=[1, 1, 1], propagation_direction=[0, 1, 0], + polarization_direction=[1, 0, 0], E0=1).get_as_pypicongpu() # valid example: @@ -180,6 +196,7 @@ def test_values_centroid_position_y_is_zero(self): centroid_position=[12, 0, 7], focal_position=[12, 0, 7], propagation_direction=[0, 1, 0], + polarization_direction=[1, 0, 0], E0=1) .get_as_pypicongpu().get_rendering_context()) @@ -213,7 +230,8 @@ def test_laguerre_modes_optional(self): focal_position=[0, 0, 0], centroid_position=[0, 0, 0], E0=5, - propagation_direction=[0, 1, 0]) + propagation_direction=[0, 1, 0], + polarization_direction=[1, 0, 0]) pypic_laser = picmi_laser.get_as_pypicongpu() self.assertEqual([1.0], pypic_laser.laguerre_modes) self.assertEqual([0.0], pypic_laser.laguerre_phases) @@ -227,6 +245,7 @@ def test_laguerre_modes_optional(self): centroid_position=[0, 0, 0], E0=5, propagation_direction=[0, 1, 0], + polarization_direction=[1, 0, 0], picongpu_laguerre_modes=None, picongpu_laguerre_phases=None) pypic_laser = picmi_laser.get_as_pypicongpu()