Open RemiLehe opened 9 months ago
Here is an input script that demonstrates the issue: the quantity origZ
is (incorrectly) 0
for all electrons:
inputs_2d.txt
Thanks for the report, analysis and reproducer! attn @atmyers @RevathiJambunathan @hklion - can you help? :)
I think that the solution would be to call the function DefaultInitializeRuntimeAttributes
in the different multi-physics modules (and in particular inside filterCopyTransformParticles
and filterCreateTransformFromFAB
).
However, in order to do so, the function DefaultInitializeRuntimeAttributes
would need to be generalized. In particular:
DefaultInitializeRuntimeAttributes
can only be applied to a pinned particle container (not a regular particle container) ; the function would need to be templated.DefaultInitializeRuntimeAttributes
overwrites the runtime components of all particles in a tile ; it would need to be modified to only modify the last particles in the tile (i.e. the particles that were created at this time step, in the multi-physics module). The function should take a starting particle index in the tile, above which particles' runtime components should be modified.Note that, if DefaultInitializeRuntimeAttributes
is generalized in this way, we can then also use it to simplify the code in AddPlasma
and AddPlasmaFlux
.
In WarpX, the user can define runtime attribute on the particles, that are then tracked during the simulation. (See
addRealAttributes
in the WarpX documentation ; a typical example is tracking the x/y/z position at which a particle was created.)However, these runtime attribute are only correctly set when particles are created via the functions
AddNParticles
,AddPlasma
orAddPlasmaFlux
(see https://github.com/ECP-WarpX/WarpX/pull/3272). This happens when we initialize particles through our various initialization/injection methods, but not when creating particles via multi-physics modules. In particular:filterCopyTransformParticles
: https://github.com/ECP-WarpX/WarpX/blob/development/Source/Particles/ParticleCreation/FilterCopyTransform.H#L64 which includes impact ionization in the MCC process: https://github.com/ECP-WarpX/WarpX/blob/development/Source/Particles/Collision/BackgroundMCC/BackgroundMCCCollision.cpp#L504, field ionization: https://github.com/ECP-WarpX/WarpX/blob/development/Source/Particles/MultiParticleContainer.cpp#L902, Breit-Wheeler: https://github.com/ECP-WarpX/WarpX/blob/development/Source/Particles/MultiParticleContainer.cpp#L1539 and Quantum Synchrotron: https://github.com/ECP-WarpX/WarpX/blob/development/Source/Particles/MultiParticleContainer.cpp#L1619filterCreateTransformFromFAB
: https://github.com/ECP-WarpX/WarpX/blob/development/Source/Particles/ParticleCreation/FilterCreateTransformFromFAB.H#L86 which includes the Schwinger process: https://github.com/ECP-WarpX/WarpX/blob/development/Source/Particles/MultiParticleContainer.cpp#L1619