Page 1 of 1

Optimizer Error Using Input Matrix Files

Posted: 21 May 2018, 03:50
by Zamank
Hi Michael,

I am revisting this topic because I wanted to vary the phase advance for a section of beamline but I am having issues doing so. I created a beamline using oscillation orbit data from BPMs and quads. The sections between quds are defined by a matrix txt file and the quad strengths are only to be varied.

I tried using the optimizer (simplex) to find the K1 values for the quads to satisfy the phase advance I wanted in the section, but even for the smallest phase advance, the optimizer is not finding solutions.

I think it may be the matrix txt files that is giving the optimizer problems but it may also be that I've been looking at this code for too long and can't see the mistake I have possibly made.

I attached a zip file of the *ele, *lte and *matrix.txt files. Any advice/help would be greatly appreciated!

help_optimizer.zip
(27.38 KiB) Downloaded 233 times

Re: Optimizer Error Using Input Matrix Files

Posted: 22 May 2018, 16:46
by michael_borland
I see two problems with this run:
1. The optimization_covariable commands result in inverting the sign of at least one quadrupole: Q25701_776. This (and possibly others like it) makes the matrix elements grow very large.
2. The lattice has strong x-y coupling, so the computations of phase advance, beta functions, etc, are not correct. The twiss_output command assumes that the beamline is uncoupled.

After fixing 1, you might try matrix-element-based fitting instead.

--Michael

Re: Optimizer Error Using Input Matrix Files

Posted: 23 May 2018, 10:55
by Zamank
Awesome, thanks for the help Michael. I fixed 1 as you mentioned and I am testing around matching the matrix elements. I've been looking at the matrices and I think the coupling is weak enough in the (z, deltaP) coordinates that they can be ignored and just fit 4x4 Rxy matrix.

Re: Optimizer Error Using Input Matrix Files

Posted: 13 Jun 2018, 12:18
by Zamank
Michael,

Just curious: How are the twiss function at the end computed? I tried using the "uncoupled" equations:

betax = R11^2*betax0 - 2*R11*R12*alphax0 + R12^2 gammax0

And do not get the same values calculated by Elegant.

Thanks in advance.