Hi-PACE / hipace

Highly efficient Plasma Accelerator Emulation, quasistatic particle-in-cell code
https://hipace.readthedocs.io
Other
54 stars 15 forks source link

Discrepancy between fields driven in first and subsequent timesteps for `from_file` injection #1116

Closed jameschappell closed 6 months ago

jameschappell commented 6 months ago

Hi,

I've noticed that the fields driven by a particle bunch injected via the from_file option differs significantly in its first timestep compared to subsequent timesteps. The same behaviour is not true for the fixed_weight_pdf or fixed_weight injection options and I attach plots below to illustrate this behaviour. In the attached minimal example input decks I purposely make dt very small to minimise evolution of the bunch between timesteps, but have seen the same behaviour for much larger timesteps (both fixed and adaptive).

Thanks in advance for your help. Please let me know if there is any other information you need from me.

input_files.zip

from_file: inj_type_from_file

fixed_weight_pdf: inj_type_fixed_weight_pdf

fixed_weight: inj_type_fixed_weight

AlexanderSinn commented 6 months ago

Thanks for reporting this and providing the input scripts. It looks like when initializing a beam from a file, the MR level tag was not initialized, causing some beam particles to not deposit their current. The MR level tag is re-initialized before each subsequent time step, which worked. I added proper initialization in #1117 which fixed the issue in my testing.

jameschappell commented 6 months ago

Thanks for the speedy fix! Can confirm this has fixed it in my testing too.