vertical dispersion inconsistencies

Moderators: cyao, michael_borland

Post Reply
Andreas_Doblhammer
Posts: 4
Joined: 27 May 2015, 07:21

vertical dispersion inconsistencies

Post by Andreas_Doblhammer » 27 May 2015, 07:50

Hey everyone,

I hope, I'm writing this in the right category. I'm currently comparing different Accelerator Codes like for example Elegant and MADX.
So far everything looks good, but when I try to set some quadrupole misalignments (vertical offsets), the periodical solution I get from Elegant completely differs from that in MADX.
As I'm completely new to elegant, I'm guessing, I made some mistake there. Maybe Elegant calculates the periodical solution somehow differently than MAD does...

I built a simple example ring, where this difference occurs as well. I'd be happy for every clue^^

Thanks in advance,
Andreas
Attachments
ring.lte
(1.32 KiB) Downloaded 228 times
twiss.ele
(554 Bytes) Downloaded 235 times

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

Re: vertical dispersion inconsistencies

Post by michael_borland » 27 May 2015, 08:37

Andreas,

I think the problem is that by default the twiss parameters are computed on a single-pass basis, rather than on the closed orbit. If you want to expand about the closed orbit, you need to delay the twiss parameter calculation until after the closed orbit is computed. You can do this by setting output_at_each_step=1 on the &twiss_output command.

Sorry that this is confusing. Let me know if it doesn't clear up the issue.

--Michael

Andreas_Doblhammer
Posts: 4
Joined: 27 May 2015, 07:21

Re: vertical dispersion inconsistencies

Post by Andreas_Doblhammer » 27 May 2015, 09:06

Dear Michael,

thanks a lot for the fast response. You are right, that solved the problem^^

Best regards,
Andreas

Andreas_Doblhammer
Posts: 4
Joined: 27 May 2015, 07:21

Re: vertical dispersion inconsistencies

Post by Andreas_Doblhammer » 15 Jun 2015, 06:01

Dear Michael,

I'm just writing this question into the same topic, as it also is about vertical dispersion. I just introduced some random vertical misalignments of KQUAD's into my lattice, but the vertical Dispersion I get from the moments_output program is about a factor of 10^5 too big compared to what I get when I just take the TWISS-values and calculate the emittance myself. I use the equilibrium emittance formula (emit=c*(I5y/I2)), which should be fine, as there is no coupling in the lattice.
The lattice file itself if quite long and confusing (it was written by a conversion program), but I basically turned everything off except the bending magnets and the quadrupoles. Could you maybe take a quick look at the file and tell me if you see anything suspicious?

Thanks a lot,
Andreas
Attachments
example_lattice.lte
(2.26 MiB) Downloaded 228 times
example_lattice.ele
(869 Bytes) Downloaded 235 times

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

Re: vertical dispersion inconsistencies

Post by michael_borland » 15 Jun 2015, 16:25

Andreas,

Nothing jumps out at me as obviously wrong here. I'm taking a more detailed look to see if I can find the problem.

Have you done a comparison with tracking (probably would take a long time, I know)?

--Michael

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

Re: vertical dispersion inconsistencies

Post by michael_borland » 15 Jun 2015, 16:54

Andreas,

I tried a similar simulation with the APS lattice and I get good agreement between the horizontal and vertical dispersion provided by twiss_output and derived from the moments_output data (etay=s36/(s6*s6)). I noted in my APS simulations that if I put an rf cavity at the end of every sector, the agreement improved compared to the real case with the cavities on one side of the ring. This is a result of the Twiss calculations using constant beam energy, whereas the moments calculations are self-consistent.

A few suggestions:
* Add N_KICKS=20 on the CSBEND elements. The default of 4 is probably not adequate.
* Fix the closure of the ring. It is off by 1.8mm in X and 38mm in Z. This may explain the difficulty with orbit convergence.

--Michael

Andreas_Doblhammer
Posts: 4
Joined: 27 May 2015, 07:21

Re: vertical dispersion inconsistencies

Post by Andreas_Doblhammer » 23 Jun 2015, 04:04

Dear Mike,
I agree, the vertical closed orbit definitely is the main issue here. The problem is, it is perfectly closed, when I calculate the ring in MADX. I ran the lattice as a transfer line and looked at the TWISS-file. I saw, that, for lengths over 10.000m, the mm-value of some maget locations are cut off. For example, a quadrupole is is located at 24.880,47 instead of 24.880,475. Is this just a rounding error in the output or are the TWISS-functions really calculated at these rounded points? Because the errors in the vertical beta function start at about 24800m, right where the first cutoffs occur...

Best regards,
Andreas

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

Re: vertical dispersion inconsistencies

Post by michael_borland » 23 Jun 2015, 07:19

Andreas,

As a test, I took the APS lattice and scaled all lengths up 100x, while simultaneously scaling K1 values down by 100^2. The resulting ring has a 110.4km circumference. It has the same tunes, with beta functions scaled up by 100x, as expected. The floor coordinates closed to within 10nm (the original lattice also wasn't quite closed). The closed orbit has no problem converging to 0.

I saved the lattice, reloaded, and scaled 100x again, making a 11.4 Mm circumference. Again, no problems.

Calculations in elegant are performed to double precision. There's no deliberate rounding in the output except in a few ASCII SDDS flies such as magnets_output. (You can identify these using sddsquery.) Using sddsprintout -format=double=%21.15e with the floor coordinates output, twiss output, closed orbit output, etc will show you values at full precision.

I suspect something is wrong in your MADX-to-elegant translation. Identifying where in the line things go wrong using transport line calculations is a good way to track it down. Perhaps checking the element definitions in the vicinity of the first discrepancies will reveal something, e.g., an errant comma or similar problem.

--Michael

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

Re: vertical dispersion inconsistencies

Post by michael_borland » 23 Jun 2015, 08:31

Andreas,

I checked that scaling of the emittance and energy agrees with expections from dimensional analysis. In particular, scaling all element lengths by a factor scaleFactor does not change the emittance, but changes the energy spread like 1/sqrt(scaleFactor).

I also made another lattice with 10x as many cells (400 total) and 100x the length for all elements, for a 1.1Mm circumference. Compared to the lattice with 100x scaling only, the emittance dropped a factor of 1000 and the energy spread a factor of sqrt(10), both as expected.

Just to push things beyond reasonable limits, I made a lattice with 100x as many cells (4000 total) and 100x the length for all elements, giving a 11Mm circumference. The geometry was closed to 6 microns, which again is just as expected given that my initial geometry was only closed to 0.6 nm. Emittance and energy spread continue to scale as expected.

--Michael

Post Reply