close orbit for large momentum offset

Moderators: cyao, michael_borland

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

Re: close orbit for large momentum offset

Post by michael_borland » 18 Nov 2014, 16:31

Yue,

Here's an example of how to do this. I'm not sure what the problem is with your particular files. If you upload them I can have a look.

--Michael
Attachments
offMomentumTwiss.zip
(2.89 KiB) Downloaded 192 times

yuehao
Posts: 40
Joined: 25 Oct 2011, 14:50

Re: close orbit for large momentum offset

Post by yuehao » 18 Nov 2014, 18:26

Hi, Michael

Please see the lte and ele file below, since they are short:
test.lte
(366 Bytes) Downloaded 200 times
cal_cell.ele
(563 Bytes) Downloaded 205 times
Since the delta is large, the closed_orbit is ~5mm deviated from the reference orbit. I expect the optics with respective to the reference orbit and the closed_orbit be quite different. However, I set the flag output_at_each_step=1/0 only make 1e-5 relative difference. I suspect that the twiss_output ignored the result of the calculated closed orbit.

Thank you very much.
Yue

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

Re: close orbit for large momentum offset

Post by michael_borland » 18 Nov 2014, 19:44

Yue,

Here's an example using your lattice file that shows betax and betay changing with momentum offset.

--Michael
betay.png
betax.png
betax.png (11.42 KiB) Viewed 4548 times
Attachments
2014-11-18.zip
(1.5 KiB) Downloaded 212 times

yuehao
Posts: 40
Joined: 25 Oct 2011, 14:50

Re: close orbit for large momentum offset

Post by yuehao » 18 Nov 2014, 20:01

HI, Michael

However, this deviate from the calculation from other codes. We use several codes to benchmark with each other. Madx and elegant cannot give the right result. (MADX_PTC can give the correct result) We narrowed down the reason, and guess that elegant 's result does not consider the closed_orbit. One proof is that the following two cases give the same result:

1. calculate the optics without get the closed_orbit
2. calculate the optics after the closed orbit.

They should be very different since the closed orbit deviates from the reference orbit a lot.

We checked the source code twiss.cc. It seems the flag 'clorb' will do the job, however we don't know how to use this flag.

Thanks agin,
Yue

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

Re: close orbit for large momentum offset

Post by michael_borland » 18 Nov 2014, 20:32

Yue,

I traced the code for the example files I sent you and verified that the closed orbit is indeed used. One reason it doesn't matter much seems to be that the whole system is very linear. The bending radius is nearly 300m and there are no sextupoles. I don't expect the orbit to make any significant difference in such a case.

Another way to check this is with tracking. By tracking off-momentum particles and computing, for example, (max(x)-min(x))/(max(xp)-min(xp)), we can determine the beta function. When I do this, I get the close to the same answer as the twiss_output command gives. Given that elegant only has a second-order matrix for the dipole, this is about the best we can expect with such large momentum deviations.

--Michael
betay.png
betax.png
Attachments
2014-11-18.zip
(1.74 KiB) Downloaded 184 times

yuehao
Posts: 40
Joined: 25 Oct 2011, 14:50

Re: close orbit for large momentum offset

Post by yuehao » 18 Nov 2014, 21:18

Hi Michael,

Thanks a lot for your prompt answer, especially this late.

It is very strange that I get exact same answer with /without the closed_orbit command before twiss_output command. Did I do anything wrong?

elegant file 1 (no close orbit):
&divide_elements
divisions = 100,
type = CSBEND,
name = *,
&end

&run_setup
default_order = 3,
concat_order = 3,
rootname = ffag_cell_10,
lattice = test.lte,
p_central_mev = 17197.9812934,
use_beamline = FFAG_CELL,
&end

&twiss_output
matched = 1,
filename = %s.twi,
&end

elegant file 2:

&divide_elements
divisions = 100,
type = CSBEND,
name = *,
&end

&run_setup
default_order = 3,
concat_order = 3,
rootname = ffag_cell_10,
lattice = test.lte,
p_central_mev = 17197.9812934,
use_beamline = FFAG_CELL,
&end

&closed_orbit
output = %s.clo,
closed_orbit_iterations = 150,
&end

&twiss_output
matched = 1,
filename = %s.twi,
output_at_each_step = 1,
&end

&run_control
&end

&bunched_beam
&end

&track
&end



btw, I used the latest version of elegant.

Best,
Yue
Attachments
ffag_cell_10_compare.twi
(47.95 KiB) Downloaded 199 times
ffag_cell_10.twi
(47.95 KiB) Downloaded 194 times

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

Re: close orbit for large momentum offset

Post by michael_borland » 05 Dec 2014, 05:26

Yue,

Sorry for the delayed reply. I've been traveling.

The output files from those two runs are not identical. If you use sddsdiff, you'll see that they are slightly different.

As a demonstration that elegant does consider the orbit when it is computed, I inserted a thin-lens sextupole into the lattice. I think you'd agree that this will only affect the twiss output if the orbit is included. In this case, the beta functions are different enough to see in a plot.

--Michael
comparison.png
Attachments
2014-12-05.zip
(1.15 KiB) Downloaded 197 times

yuehao
Posts: 40
Joined: 25 Oct 2011, 14:50

Re: close orbit for large momentum offset

Post by yuehao » 05 Dec 2014, 08:13

Hi, Michael

Thank you for your reply. Yes, it is slightly different. But as you said the twiss_output cannot handle large momentum deviation.

I created 8 particles (4 for x-xp phase space, 4 for y-yp) around the closed orbit using SDDS_BEAM, and deduct the map from the tracking result. In this way I got the twiss parameters correctly.

If you are interested, maybe elegant in future can add another twiss calculation command, and track the truncated power series through your elements which uses symplectic integrator. That will make elegant even powerful.

Best,
Yue

Post Reply