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

Diagnostics : EM fields on particles #5637

Open
wants to merge 26 commits into
base: development
Choose a base branch
from

Conversation

grobertdautun
Copy link

@grobertdautun grobertdautun commented Feb 4, 2025

This PR implements the EM option for particles diagnostics output. It is an extension of #4599 and #4839 and works in the same way. It allows the user to output the electromagnetic fields seen by particles.

I added a test case test_2d_particle_EM_diagnostics with its analysis. This case represents a single particle fixed in a box traversed by a laser pulse, and the analysis verifies that the fields are matching the theoretical ones.

I also tested the diagnostics on bigger cases, and I noticed that when writing a lot of timesteps with a lot of particles, reading the diagnostics with adios2 file-based encoding is very slow due to the high number of opening/closing files. Moreover, it appears that openpmd-viewer does not support reading variable-based encoding, so I wrote some scripts to read them directly using the adios2 python API, that I added in Tools/PostProcessing/read_variable_based_adios2.py

There is a small update in the documentation to add the description of both the diagnostics and the script

This diagnostics does not support mesh refinement at the moment, this should be added in a follow up PR

@ax3l ax3l added the component: diagnostics all types of outputs label Feb 4, 2025
Comment on lines +315 to +322
tmp.NewRealComp("Ex");
tmp.NewRealComp("Ey");
tmp.NewRealComp("Ez");
tmp.NewRealComp("Bx");
tmp.NewRealComp("By");
tmp.NewRealComp("Bz");

int const Ex_index = tmp.getParticleComps().at("Ex");
Copy link
Member

Choose a reason for hiding this comment

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

There will be a minimal change we need to add to this PR once we merged #5481 (simplification of named SoA bookkeeping), but it will be easy to update once your PR is ready/out-of-WIP.

@ax3l ax3l requested review from atmyers and RemiLehe February 4, 2025 18:39
@@ -590,6 +590,9 @@ for (const auto & particle_diag : particle_diags) {
if ( particle_diag.m_plot_phi ) {
storePhiOnParticles( tmp, WarpX::electrostatic_solver_id, !use_pinned_pc );
Copy link
Member

Choose a reason for hiding this comment

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

@RemiLehe , do you know why for storePhiOnParticles we pass !use_pinned_pc instead of full_diag ?

@grobertdautun grobertdautun changed the title [WIP] Diagnostics : EM fields on particles Diagnostics : EM fields on particles Feb 6, 2025
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.

3 participants