Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PICMI Standard example does not work #4355

Closed
szabo137 opened this issue Nov 24, 2022 · 6 comments
Closed

PICMI Standard example does not work #4355

szabo137 opened this issue Nov 24, 2022 · 6 comments

Comments

@szabo137
Copy link

szabo137 commented Nov 24, 2022

Problem

Seems like there is an incompatibility with picmistandard, if one tries to run the intro example for picmi from the picongpu docs.

minimal example

Running a test-file with

from picongpu import picmi

boundary_conditions = ["periodic", "periodic", "periodic"]
grid = picmi.Cartesian3DGrid(
    # note: [x] * 3 == [x, x, x]
    number_of_cells=[192] * 3,
    lower_bound=[0, 0, 0],
    upper_bound=[0.0111152256] * 3,

    # delta {x, y, z} is computed implicitly

    # lower & upper boundary conditions must be equal
    lower_boundary_conditions=boundary_conditions,
    upper_boundary_conditions=boundary_conditions,
)
solver = picmi.ElectromagneticSolver(method="Yee",grid=grid)

sim = picmi.Simulation(
    time_step_size=9.65531e-14,
    max_steps=1024,
    solver=solver,
)

throws

Traceback (most recent call last):
  File "/Users/uwe/Work/tutorials/picmi/picongpu/lib/python/test2.py", line 18, in <module>
    sim = picmi.Simulation(
  File "/Users/uwe/.pyenv/versions/venv_picmi/lib/python3.10/site-packages/typeguard/__init__.py", line 1033, in wrapper
    retval = func(*args, **kwargs)
  File "/Users/uwe/Work/tutorials/picmi/picongpu/lib/python/picongpu/picmi/simulation.py", line 115, in __init__
    self.__yee_compute_cfl_or_delta_t()
  File "/Users/uwe/.pyenv/versions/venv_picmi/lib/python3.10/site-packages/typeguard/__init__.py", line 1033, in wrapper
    retval = func(*args, **kwargs)
  File "/Users/uwe/Work/tutorials/picmi/picongpu/lib/python/picongpu/picmi/simulation.py", line 61, in __yee_compute_cfl_or_delta_t
    delta_x = (self.solver.grid.xmax - self.solver.grid.xmin) \
AttributeError: 'Cartesian3DGrid' object has no attribute 'xmax'

A bit deeper investigation shows, there seems to be an api change between picmistandard==0.0.19 and picmipstandard==0.0.20 with (at least)

grid.xmin = grid.lower_bound[0]
grid.ymin = grid.lower_bound[1]
grid.zmin = grid.lower_bound[2]

grid.xmax = grid.upper_bound[0]
grid.ymax = grid.upper_bound[1]
grid.zmax = grid.upper_bound[2]

grid.bc_xmin = grid.lower_boundary_conditions[0]
grid.bc_ymin = grid.lower_boundary_conditions[1]
grid.bc_zmin = grid.lower_boundary_conditions[2]

grid.bc_xmax = grid.upper_boundary_conditions[0]
grid.bc_ymax = grid.upper_boundary_conditions[1]
grid.bc_zmax = grid.upper_boundary_conditions[2]

grid.nx = grid.number_of_cells[0]
grid.ny = grid.number_of_cells[1]
grid.nz = grid.number_of_cells[2]

I tested the minimal example above with picmistandard==0.0.19 and it works as intended.

System specs

python version: 3.10.6
picongpu branch: dev
pip list output:

attrs           22.1.0
chevron         0.14.0
contourpy       1.0.6
cycler          0.11.0
fonttools       4.38.0
h5py            3.7.0
imageio         2.22.4
jsonschema      4.17.1
kiwisolver      1.4.4
matplotlib      3.6.2
mpmath          1.2.1
numpy           1.23.5
openPMD-api     0.14.5.post1
packaging       21.3
pandas          1.5.2
picmistandard   0.0.22
Pillow          9.3.0
Pint            0.20.1
pip             22.3.1
pyparsing       3.0.9
pyrsistent      0.19.2
python-dateutil 2.8.2
pytz            2022.6
scipy           1.9.3
setuptools      63.2.0
six             1.16.0
sympy           1.11.1
typeguard       2.13.3

Suggested solution

From the top of my head, there are three solutions conceivable

  • Pinning the version of picmistandard to 0.0.19, but new features would be missing
  • Open a PR for picmistandard to include the back-compatibility
  • update the lib/python/picongpu in order to use the new API from picmistandard>=0.0.20
@BrianMarre
Copy link
Member

A student I am supervising is updating the lib/python/piconpgu to the new API of the current pcimistandard==0.0.22
Seems to be mostly done, but the compiling test are not yet done, will prompt him to create a pull request once they are finished.

@BrianMarre
Copy link
Member

I am also going to discuss the breaking changes with the PICMI-standard devs, they were not properly communicated in the changelogs.

@BrianMarre
Copy link
Member

@szabo137 the issue can be closed, the update is complete.

@PrometheusPi
Copy link
Member

I will reopen the issue since #4364 is not yet in the mainline dev

@PrometheusPi PrometheusPi reopened this Dec 1, 2022
@BrianMarre
Copy link
Member

@PrometheusPi ping

@PrometheusPi
Copy link
Member

#4364 was merged

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants