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
close orbit for large momentum offset
Moderators: cyao, michael_borland
-
- Posts: 1951
- Joined: 19 May 2008, 09:33
- Location: Argonne National Laboratory
- Contact:
Re: close orbit for large momentum offset
- Attachments
-
- offMomentumTwiss.zip
- (2.89 KiB) Downloaded 216 times
Re: close orbit for large momentum offset
Hi, Michael
Please see the lte and ele file below, since they are short:
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
Please see the lte and ele file below, since they are short:
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
-
- Posts: 1951
- Joined: 19 May 2008, 09:33
- Location: Argonne National Laboratory
- Contact:
Re: close orbit for large momentum offset
Yue,
Here's an example using your lattice file that shows betax and betay changing with momentum offset.
--Michael
Here's an example using your lattice file that shows betax and betay changing with momentum offset.
--Michael
- Attachments
-
- 2014-11-18.zip
- (1.5 KiB) Downloaded 238 times
Re: close orbit for large momentum offset
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
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
-
- Posts: 1951
- Joined: 19 May 2008, 09:33
- Location: Argonne National Laboratory
- Contact:
Re: close orbit for large momentum offset
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
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
- Attachments
-
- 2014-11-18.zip
- (1.74 KiB) Downloaded 204 times
Re: close orbit for large momentum offset
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):
÷_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:
÷_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
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):
÷_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:
÷_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 222 times
-
- ffag_cell_10.twi
- (47.95 KiB) Downloaded 219 times
-
- Posts: 1951
- Joined: 19 May 2008, 09:33
- Location: Argonne National Laboratory
- Contact:
Re: close orbit for large momentum offset
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
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
- Attachments
-
- 2014-12-05.zip
- (1.15 KiB) Downloaded 220 times
Re: close orbit for large momentum offset
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
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