rotate element: bug?!

Moderators: michael_borland, soliday

Post Reply
jensschafer
Posts: 2
Joined: 14 May 2019, 09:33

rotate element: bug?!

Post by jensschafer » 14 May 2019, 10:01

Hi guys, hi Michael,

i am in the planning phase of a complex 3d transfer line with multiple different tilts.
The rotate element looks pretty neat and usefull for me, unfortunately i came across a nasty bug:

It rotates the twiss parameter as it should after the description IF it tilts around n times pi/2 .
For any other angle it does not seem to have any influence at all.

I didn't check the behaviour on tracked particles yet, further it works fine for the view3dgeometry tool.

If i apply the TILT parameter to each single element it works fine.

A small example follows.
If the ROTATE element would work correct, the two plots "test_rot" and "test_tilt" should look the same.

I am using elegant 34.4.1
Thanks already :)
####################
test.lte:

D: DRIF,L=1

B: RBEND, L=0.50, ANGLE=0.1
B_TILT: RBEND, L=0.50, ANGLE=0.1, TILT=0.5

ROT1: ROTATE,TILT=0.5
ROT2: ROTATE,TILT=-0.5

TEST: LINE=(D,B)
TEST_ROT: LINE=(D,ROT1,B,ROT2)
TEST_TILT: LINE=(D,B_TILT)

####################
run.ele:

&run_setup
lattice = test.lte
use_beamline = <line>
p_central_mev = 50
magnets=<line>.mg
&end

&run_control
&end

&twiss_output
matched=0
filename = <line>.twi
&end

#####################
run file:

#!/bin/bash

function plt {
sddsplot -graph=line,vary -title="$1" -unsup=y \
-column=s,eta? -yscale=id=1 $1.twi -legend \
-column=s,beta? -yscale=id=2 $1.twi -legend \
-column=s,Profile -overlay=xmode=norm,yfact=0.04 \
-graph=line,type=0 $1.mg
}

elegant run.ele -macro=line=test
plt test

elegant run.ele -macro=line=test_rot
plt test_rot

elegant run.ele -macro=line=test_tilt
plt test_tilt

rm *.twi *.mg

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

Re: rotate element: bug?!

Post by michael_borland » 22 May 2019, 14:45

I think the results are ok. The results at the end of the beamline are essentially identical. The "interior" points (just after ROT1 and before ROT2) shouldn't be compared.

The beta functions are slightly different, but that is probably because twiss_output doesn't perform coupled twiss calculations. Unless the rotations are a multiple of Pi/2, the beta functions can't be trusted. You may want to use the moments_output command instead.

--Michael

jensschafer
Posts: 2
Joined: 14 May 2019, 09:33

Re: rotate element: bug?!

Post by jensschafer » 27 May 2019, 02:06

Hello Michael,

thanks a lot for your answer.
With "the beta functions can't be trusted" i hope you mean, that i cannot trust the interior points but still the results at the end while calculating either, rotated or tilted elements?
This would be sufficient, since i calculate something like this:
[regular horizontal elements] - [some elements rotated (not N*pi/2)] - [regular horizontal elements]
I want to calculate the optics inside and also do tracking through this.

Does the "track" command support the rotate element aswell as tilt parameter at all elements?

I had a look into the moments_output command but i do not understand how to get the start values in z plane from my particle distribution or lattice. Where can i read how to do this?

Thanks a lot,
Jens

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

Re: rotate element: bug?!

Post by michael_borland » 30 May 2019, 22:14

Jens,

Once you've introduced rotations or tilts that are not some multiple of pi/2, the original description of the beam in terms of separate x and y lattice functions and emittances is no longer valid. Elegant doesn't do the coupled twiss parameter computation for transport lines, only rings, which is why I suggest using the moments_output command. That command takes the same parameters as twiss_output for the uncoupled description of the initial phase space; set matched=0 and equilibrium=0. If you have a beam distribution and don't know those parameters, the sddsanalyzebeam command can help (give the -correctedOnly option to avoid confusion).

Tracking with arbitrary tilts and rotations is always fine, it's just that twiss_output is limited to the uncoupled case.

--Michael

Post Reply