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

Conversation

RemiLehe
Copy link
Member

@RemiLehe RemiLehe commented Apr 12, 2024

As part of our restructuring from AoS positions to SoA (#4653), it seems that the particles' positions are not written out by default anymore. (But they probably should, since, in my understanding, the particles' positions and ID are required attributes in the openPMD standard.)

This PR writes out the particle positions by default.

Fixes #4841

// to be consistent with always writing out r and z.
// TODO: openPMD does a reconstruction to Cartesian, so we can now skip force-writing this
m_plot_flags[pc->getParticleComps().at("theta")] = 1;
#endif
Copy link
Member Author

@RemiLehe RemiLehe Apr 12, 2024

Choose a reason for hiding this comment

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

My impression is that theta is not useful, since the particles are dumped in Cartesian coordinates anyway. In fact, I think that this flag is not doing anything, since theta is actually not written anymore as of:
#4686

Copy link
Member Author

Choose a reason for hiding this comment

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

Hm, it seems that this is still needed when writing plotfiles.

Copy link
Member

@lucafedeli88 lucafedeli88 left a comment

Choose a reason for hiding this comment

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

Thanks!

@@ -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)

@ax3l
Copy link
Member

ax3l commented May 6, 2024

Replaced by #4914

@ax3l ax3l closed this May 6, 2024
@ax3l ax3l added the component: diagnostics all types of outputs label May 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: diagnostics all types of outputs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Particle diagnostic silently writes zero position if x y z is not explicitly specified
3 participants