aryafallahi / mithra

MITHRA is a full-wave numerical solver for free-electron lasers.
17 stars 7 forks source link

General question about the bunch initialisation with non-zero bunching factor #68

Open rl3418 opened 1 year ago

rl3418 commented 1 year ago

I'm a bit confused by the offset introduced for a non-zero bunching factor. Equation 3.78 in the manual defines the spatial offset. I don't understand why the offset in 3.79 is xik_u instead of xi/k_u as in 3.78. Also, the bunching factor is defined as B=<e^ik_u*z> in the manual. Is this the undulator wavenumber as in 3.78? Shouldn't this k value correspond to the first harmonic of the radiation or something?

I've attached a python program I wrote trying to understand how the beam is initialised in Mithra. Without the offset, the bunching factor agrees with the theoretical value for a uniform bunch. However, when the offset is introduced according to 3.79, the bunching factor doesn't agree with the b_f defined. Also, the bunching factor seems to change with the number of macro-particles. It would be great if you could clarify how is the offset introduced.

particle initialisation.txt