svenreiche / Genesis-1.3-Version4

Time-dependent, 3D Code to simulate the amplification process of a Free-electron Laser.
GNU General Public License v3.0
55 stars 27 forks source link

Strong field variation for large beamsizes [BUG] #92

Open svenreiche opened 1 year ago

svenreiche commented 1 year ago

Describe the bug If the beam size of the beam is larger than the undulator period, then the extrapolation of aw for transverse position can easily get values which are large enough to cause a full deflection of the beam. This can be avoided by a careful setup of the lattice file with focusing but it should be catched.

To Reproduce

  1. In the benchmark file Aramis.lat, set gamma_ref to 11.3 and xlamdref to 1e-4.
  2. Run the input deck

Expected behavior the natural focusing is so strong in y so that the F quadrupole blows up the beam size in y to more than 6 mm with some particle larger than 1 cm. Compared to 15 mm period length, this causes an enhancement of aw by a factor of 9!

Additional context In older version of Genesis a particle beyond a certain off-axis position (at that time the grid) were marked lost and not further calculated. This was revoke to calculate tilted beams without filling out a large grid. However the check can be done quite efficiently when calculating awloc = undulator->faw(x,y) in BeamSolver to allow only an enhancement of faw by not more than 10%.