bmad-sim / bmad-ecosystem

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

Improving symplecticity of an electric bend and odd plotting issue #883

Open vsmorozov opened 8 months ago

vsmorozov commented 8 months ago

Hello,

I was wandering if it is possible to improve the symplecticity of electric bends. In the attached lattice file, they are implemented as sbend's with b0_elec attributes. There are 80 of them in the entire lattice: tao_pEDM.zip The symplectic error of the whole lattice is 1.35E-3. It causes problems, for example, with closed orbit calculations with RF cavities. It does not converge unless symplectificaiton is forced with *[symplectify] = T.

The only unusual elements in the lattice are electric bends. They are the cause of the non-symplecticity. They each individually contribute a symplectic error of 6.03E-6, which is high compared to other elements.

There is also an odd plotting issue with this lattice. When run with the attached init file as "tao -init tao_pEDM.init", the plot looks fine: image However, if the lattice is run as "tao -lat pEDM.bmad", the default plots look odd: image It is probably a plotting issue because printing out the lattice functions with "show ele end" in both cases gives the same result consistent with the top figure: Twiss at end of element: A B Cbar C_mat Beta (m) 2.03292453 0.37371225 | 0.00000000 0.00000000 0.00000000 0.00000000 Alpha -2.42614277 0.50702408 | 0.00000000 0.00000000 0.00000000 0.00000000 Gamma (1/m) 3.38732139 3.36374686 | Gamma_c = 1.00000000 Mode_Flip = F Phi (rad) 66.14193641 65.32027156 X Y Z Eta (m) -0.00005782 0.00000000 -0.00005782 0.00000000 48.94424337 Etap -0.00007808 0.00000000 -0.00007808 0.00000000 1.00000145 dEta/ds -0.00007830 0.00000000 -0.00007830 0.00000000 1.00000145 Sigma 0.00000001 0.00000000 0.00000000 0.00000000

Thanks, Vasiliy

DavidSagan commented 8 months ago

@vsmorozov The plotting difference is due to one plot plotting eta.x and the other plot eta.a which are not the same if there is any coupling.

DavidSagan commented 8 months ago

@vsmorozov I just noticed that the coupling is zero so this does not explain the problem. Am investigating further...

eiad-hamwi commented 6 months ago

@vsmorozov Have you tried making the plot use more points? set plot_page n_curve_pts = 2000