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

Always write the particles' positions #4855

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Docs/source/usage/parameters.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2676,6 +2676,7 @@ In-situ capabilities can be used by turning on Sensei or Ascent (provided they a
* ``<diag_name>.<species_name>.variables`` (list of `strings` separated by spaces, optional)
List of particle quantities to write to output.
Choices are ``w`` for the particle weight and ``ux`` ``uy`` ``uz`` for the particle momenta.
(The positions ``x``, ``y``, ``z``, as well as the particle ID are always written, and thus do not need to be specified in this list.)
When using the lab-frame electrostatic solver, ``phi`` (electrostatic potential, on the macroparticles) is also available.
By default, all particle quantities (except ``phi``) are written.
If ``<diag_name>.<species_name>.variables = none``, no particle data are written, except for particle positions, which are always included.
Expand Down
9 changes: 9 additions & 0 deletions Source/Diagnostics/ParticleDiag/ParticleDiag.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,15 @@ ParticleDiag::ParticleDiag(
m_plot_flags[existing_variable_names.at(var)] = 1;
}
}
// Always write the position
// Note: for WARPX_DIM_RZ, no need to set the flag y: it is always written
Copy link
Member Author

@RemiLehe RemiLehe Apr 13, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In RZ, I observed empirically that:

  • I need to set m_plot_flags[pc->getParticleComps().at("x")] = 1; (otherwise the Cartesian x position is not written correctly with openPMD)
  • I cannot set m_plot_flags[pc->getParticleComps().at("y")] = 1; (otherwise I get an error in at, saying that this property does not exist), but the Cartesian y is automatically reconstructed and written anyway.

@ax3l Do you understand why y is automatically written, but not x? (i.e. why do I need to set the flag for x, but not for y)

#if !defined (WARPX_DIM_1D_Z)
m_plot_flags[pc->getParticleComps().at("x")] = 1;
#endif
#if defined (WARPX_DIM_3D)
m_plot_flags[pc->getParticleComps().at("y")] = 1;
#endif
m_plot_flags[pc->getParticleComps().at("z")] = 1;
}
}

Expand Down
Loading