bmad-sim / bmad-ecosystem

Bmad simulation ecosystem for simulating high energy storage rings.
https://www.classe.cornell.edu/bmad/
11 stars 13 forks source link

No CSR in Tilted SBend Elements #783

Open electronsandstuff opened 7 months ago

electronsandstuff commented 7 months ago

CSR does not seem to be working correctly in SBend elements which are tilted to operate vertically (ie with ref_tilt = pi/2).

I have prepared a minimum working example attached here. It contains two lattices. The first is a horizontal lattice file taken from one of the CSR examples. The second is a copy of that lattice, but with the entire system rotated about z by pi/2. Specifically, the SBend elements are tilted by pi/2 and the initial beam parameters are also correspondingly permuted.

Here is the plot pane for the horizontal lattice.

Here it is for the vertical lattice.

I ran particle tracking through both of them and read out the final particles using pytao. This is the result for the horizontal lattice.

Here is the tracked beam for the vertical lattice.

Here are the files I used. The tracking is done in the notebook track_beam.ipynb. vertical_csr.tar.gz

DavidSagan commented 7 months ago

In general, the 1D CSR calc needs to have all the bends in one plane and for simplicity the code assumes the bend is in the horizontal plane. I will modify the code to issue a warning message if any bend is not in the horizontal plane.

ChristopherMayes commented 7 months ago

@DavidSagan all bends in a lattice? If bends are well-separated, shouldn't it not matter?

DavidSagan commented 7 months ago

It depends upon how well separated and the extent of the wake. So yes if enough separated the calculation will be valid. I can modify the code but it is not a simple one-line fix.

ChristopherMayes commented 7 months ago

Actually the example does have them all in one plane -- the vertical plane.

DavidSagan commented 7 months ago

This is a good project when the expected manpower arrives. At the same time can fix the wiggler tracking so the user does not have to manually slice the element.