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

Particle fields in RZ Geometry with openPMD #5659

Open
PhysicsDan opened this issue Feb 11, 2025 · 2 comments
Open

Particle fields in RZ Geometry with openPMD #5659

PhysicsDan opened this issue Feb 11, 2025 · 2 comments
Assignees
Labels
bug: affects latest release Bug also exists in latest release version bug Something isn't working component: diagnostics all types of outputs component: openPMD openPMD I/O geometry: RZ axisymmetric 2D and quasi-3D help wanted Extra attention is needed

Comments

@PhysicsDan
Copy link
Contributor

PhysicsDan commented Feb 11, 2025

Description

Particle Fields do not work when using the openpmd backend in RZ geometry
(Only tested using the precompiled executable from conda)

Minimal Example

When adding the snippet

diag1.particle_fields_to_plot = z
diag1.particle_fields_species = electrons beam
diag1.particle_fields.z(x,y,z,ux,uy,uz) = z

to
inputs_test_rz_laser_acceleration_opmd
The code instantly fails with the error

Initializing AMReX (25.02)...
OMP initialized with 8 OMP threads
AMReX (25.02) initialized
PICSAR (25.01)
WarpX (Unknown)

    __        __             __  __
    \ \      / /_ _ _ __ _ __\ \/ /
     \ \ /\ / / _` | '__| '_ \\  /
      \ V  V / (_| | |  | |_) /  \
       \_/\_/ \__,_|_|  | .__/_/\_\
                        |_|

Level 0: dt = 1.72851157e-16 ; dx = 1.171875e-07 ; dz = 6.640625e-08
0::Assertion `ncomp_from_src == m_varnames.size()' failed, file "/Users/runner/miniforge3/conda-bld/warpx_1738873300730/work/Source/Diagnostics/FullDiagnostics.cpp", line 540 !!!
SIGABRT
See Backtrace.0.0 file for details

Backtrace

 0: amrex::BLBackTrace::print_backtrace_info(__sFILE*) (in libamrex_2d.dylib) + 64

 1: amrex::BLBackTrace::handler(int) (in libamrex_2d.dylib) + 640

 2: amrex::Assert_host(char const*, char const*, int, char const*) (in libamrex_2d.dylib) + 268

 3: FullDiagnostics::InitializeFieldFunctorsRZopenPMD(int) (in warpx.rz) + 7260

 4: Diagnostics::InitData() (in warpx.rz) + 152

 5: MultiDiagnostics::InitData() (in warpx.rz) + 32

 6: WarpX::InitData() (in warpx.rz) + 776

 7: main (in warpx.rz) + 76

 8: start (in dyld) + 2840


===== TinyProfilers ======
main()
WarpX::InitData()

However, when the snippet is added to this file (i.e. the same simulation but using the plotfile output type), there us no error
inputs_test_rz_laser_acceleration

Note, this is also not an issue in cartesian geometry as WarpX/Examples/Tests/particle_fields_diags also runs without any issue.

System information

MacOS 15.3
WarpX 25.02 via Conda

@PhysicsDan PhysicsDan added the bug Something isn't working label Feb 11, 2025
@ax3l ax3l added component: openPMD openPMD I/O component: diagnostics all types of outputs geometry: RZ axisymmetric 2D and quasi-3D labels Feb 14, 2025
@ax3l
Copy link
Member

ax3l commented Feb 14, 2025

Hi @PhysicsDan , thanks for the report!

Did you test if this still worked with 25.01? If yes, it's likely a regression to #5481

@ax3l ax3l self-assigned this Feb 14, 2025
@ax3l ax3l added the bug: affects latest release Bug also exists in latest release version label Feb 24, 2025
@ax3l
Copy link
Member

ax3l commented Feb 25, 2025

Thanks for the report!

I wonder if creating fields from particles for diagnostics is at all supported in RZ yet...

Here is what I see debugging it:
RZ default case, the values of the assert are

ncomp_from_src=29
m_varnames.size()=29

The moment that we add a single particle_fields_to_plot as in the block you posted above:

ncomp_from_src=31
m_varnames.size()=35
0::Assertion `ncomp_from_src == m_varnames.size()' failed, file "/home/axel/src/warpx/Source/Diagnostics/FullDiagnostics.cpp", line 542 !!!

The problem indeed disappears if I remove

diag1.format = openpmd

, which is funny because this is frontend logic throwing the assert, before we go into the I/O backend.

The m_varnames are:

v=Er_0_real
v=Er_1_real
v=Er_1_imag
v=Bt_0_real
v=Bt_1_real
v=Bt_1_imag
v=Bz_0_real
v=Bz_1_real
v=Bz_1_imag
v=jr_0_real
v=jr_1_real
v=jr_1_imag
v=jt_0_real
v=jt_1_real
v=jt_1_imag
v=jz_0_real
v=jz_1_real
v=jz_1_imag
v=rho_0_real
v=rho_1_real
v=rho_1_imag
v=part_per_cell
v=part_per_grid
v=rho_beam_0_real
v=rho_beam_1_real
v=rho_beam_1_imag
v=rho_electrons_0_real
v=rho_electrons_1_real
v=rho_electrons_1_imag
v=z_electrons_0_real
v=z_electrons_1_real
v=z_electrons_1_imag
v=z_beam_0_real
v=z_beam_1_real
v=z_beam_1_imag

@ax3l ax3l changed the title Error when using particle fields , RZ geometry and Openpmd outputs Particle fields in RZ Geometry with openPMD Feb 25, 2025
@ax3l ax3l added the help wanted Extra attention is needed label Feb 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug: affects latest release Bug also exists in latest release version bug Something isn't working component: diagnostics all types of outputs component: openPMD openPMD I/O geometry: RZ axisymmetric 2D and quasi-3D help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

3 participants