Misalignment of a tilted csbend

Moderators: michael_borland, soliday

Post Reply
duanz
Posts: 50
Joined: 30 May 2009, 01:50

Misalignment of a tilted csbend

Post by duanz » 29 Dec 2022, 22:33

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

duanz
Posts: 50
Joined: 30 May 2009, 01:50

Re: Misalignment of a tilted csbend

Post by duanz » 31 Jan 2023, 19:33

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
Attachments
csbend.c
(209.81 KiB) Downloaded 70 times
malign_mat.c
(52.56 KiB) Downloaded 68 times

michael_borland
Posts: 1927
Joined: 19 May 2008, 09:33
Location: Argonne National Laboratory
Contact:

Re: Misalignment of a tilted csbend

Post by michael_borland » 31 Jan 2023, 19:54

Zhe,

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

--Michael

michael_borland
Posts: 1927
Joined: 19 May 2008, 09:33
Location: Argonne National Laboratory
Contact:

Re: Misalignment of a tilted csbend

Post by michael_borland » 06 Feb 2023, 11:27

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

Post Reply