Page 1 of 1

Misalignment of a tilted csbend

Posted: 29 Dec 2022, 22:33
by duanz
Hi Michael,

In the latest version of elegant, If I set MALIGN_METHOD to 1 or 2, using M. Venturini's modeling approach, but setting the misalignment errors DX, DY, DZ, ETILT, EYAW, EPITCH all to zero, the tracking of initial zero orbit coordinate through a tilted csbend by design (ETILT is zero, while TILT is nonzero) leads to a large, nonzero orbit coordinate. However, tracking a zero orbit (relative to the design orbit) through an ideal tilted bend by design should yield zero orbit. So I think the result is unphysical.

An example:

lat.lte:
MAL: MALIGN
B0: CSBEND,L=1.6,ANGLE=0.08,E1=0.04,E2=0.04,N_SLICES=20, MALIGN_METHOD=1,TILT="pi 2 /" ! a vertical bend
W1: WATCH, MODE="coordinate", FILENAME="test.w1"

RING: LINE=( MAL, B0, W1 )

track.ele:
&run_setup
lattice=lat.lte
use_beamline=RING
p_central_mev=6e3
rootname=test
&end

&run_control &end

&bunched_beam &end

&track &end


The output of test.w1 is:

Printout for SDDS file test.w1

x xp y yp t p dt particleID
m m s m$be$nc s
----------------------------------------------------------------------------------------------------------------------
-6.417111e-02 8.017110e-02 -6.355474e-02 -8.042834e-02 5.319865e-09 1.174170e+04 -1.716077e-11 1


I traced this to the function "offsetParticlesForEntranceCenteredMisalignmentExact" in malign_mat.c, which includes cz=cos(az+tilt) and sz = sin(az + tilt), and couples the ETILT and the TILT in the calculation of the rotation matrix for the misalignment map.

However, I think a more reasonable approach is the following: let's denote the maps of the entrance & exit misalignment as Mm1 and Mm2, the map of the TILT rotation as Mt, the map of a normal csbend including fringe field as Mb, then the total map should be the concatenation of the following maps with the map at the right-hand-side acting on the coordinates first: Mm2, Inverse[Mt], Mb, Mt and Mm1. Care should be taken when concatenating Mt and Mm1, or Mm2 and Inverse[Mt].


Best,

Zhe

Re: Misalignment of a tilted csbend

Posted: 31 Jan 2023, 19:33
by duanz
Hi Michael,


I modified the source files csbend.c and malign_mat.c as attached (based on elegant-2021.1.0), as a potential correction to the bug. Please let me know if these corrections make sense. Thanks!

Best,

Zhe

Re: Misalignment of a tilted csbend

Posted: 31 Jan 2023, 19:54
by michael_borland
Zhe,

Thanks, I'll check it out and let you know.

--Michael

Re: Misalignment of a tilted csbend

Posted: 06 Feb 2023, 11:27
by michael_borland
Zhe,

I think I've fixed these issues, using an approach similar to what you tried, but in a way that applies also to other elements. In the end, I had to disable the "exact" misalignment subroutines used by the tracking routines and use the versions that are linear in the errors. There's a bug in my implementation of the exact method or in the method itself; I'm not sure which, but the linearized version is really sufficient.

The bug fix will appear in the next release, which should be out this week. Thanks again for reporting the bug.

--Michael