Skip to content

Using a callback to modify particle properties #4402

Closed Answered by dpgrote
archermarx asked this question in Simulation Inputs
Discussion options

You must be logged in to vote

In WarpX, the particles are divided up into the same blocks that the fields are divided up into. Because of this, there is not a single array holding that particle quantities, but many arrays. The thing that is returned by elec_wrapper.get_particle_uz() is a list of those arrays. To set the z velocity, you would need a loop like this, looping over the list of arrays

for uzi in uz:
    uzi[:] = 0.

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@archermarx
Comment options

archermarx Nov 1, 2023
Collaborator Author

Answer selected by archermarx
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants