Optimising Phase Advance - error

Moderators: cyao, michael_borland

jgarland
Posts: 5
Joined: 29 May 2018, 08:20

Optimising Phase Advance - error

Post by jgarland » 25 Jun 2018, 05:58

Hi,

I am quite new to Elegant, so I'm still learning. I am trying to optimise a set of quads to realise a given phase advance between two points. I use the following "optimisation_setup":

&optimization_setup
mode = "minimize", method = "simplex",
target = 0,
tolerance = 1e-12, n_passes = 2, n_evaluations = 10, n_restarts = 5, log_file = "/dev/tty",
output_sparsing_factor = 10
log_file = log
&end

A typical "optimization_variable" looks like:

&optimization_variable name = Q1, item=K1, step_size = 0.01, lower_limit = -35, upper_limit = 35, force_inside=1 &end

And a troublesome "optimization_term" looks like:

&optimization_term term = "E2#1.psix E1#1.psix - abs 0.5 - sqr" &end

The problem I have is the following error is given when I run elegant (terminal output):

unknown token: E1#1.psix
unknown token: E2#1.psix
too few items on stack (subtract)
*stop*
too few items on numeric stack (less)
too few items on logical stack (conditional_udf)
*stop*
too few items on stack (subtract)
*stop*
Problem evaluating expression: ENDUBC3#1.psix ENDMBC2#1.psix - abs 0.5 - sqr
RPN expression errors prevent optimization

I have checked and double checked that I haven't made a mistake in the .lte file, the element names are correct. I have a twiss_output definition and I have checked the .twi file when i run without optimisation, the psix variable is contained within it. Can you help?
Cheers,
Jimmy

Neeraj
Posts: 23
Joined: 24 May 2018, 10:42

Re: Optimising Phase Advance - error

Post by Neeraj » 25 Jun 2018, 06:35

Not sure if this helps, but do you have output_at_each step=1 under &twiss_output ?
-Neeraj

jgarland
Posts: 5
Joined: 29 May 2018, 08:20

Re: Optimising Phase Advance - error

Post by jgarland » 25 Jun 2018, 07:08

Hi Neeraj,

Thanks for your reply. Yes I do, it is set to =1.

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

Re: Optimising Phase Advance - error

Post by michael_borland » 25 Jun 2018, 08:19

Jimmy,

To match phase advance, use <elementName>#<occurence>.nux or .nuy, rather than .psix and .psiy. nux = psi/(2pi).

--Michael

jgarland
Posts: 5
Joined: 29 May 2018, 08:20

Re: Optimising Phase Advance - error

Post by jgarland » 25 Jun 2018, 08:23

Hi Michael,

Yes I also tried this (as per the other thread in the forum) but it throws the same error.

I am also a little bit confused as to why nux or nuy would be used in the case of a linac (in my case); surely they are relevant only for circular, or simply periodic machines where the tune can be calculated? Shouln't the phase advance be a more relevant parameter to use for a linac?

Cheers!

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

Re: Optimising Phase Advance - error

Post by michael_borland » 25 Jun 2018, 09:19

Jimmy,

Do your MARK elements have FITPOINT=1 in the definition?

--Michael

jgarland
Posts: 5
Joined: 29 May 2018, 08:20

Re: Optimising Phase Advance - error

Post by jgarland » 25 Jun 2018, 09:21

Yes they do, they looks something like this:

E2: MARK, FITPOINT=1

Cheers,
Jimmy

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

Re: Optimising Phase Advance - error

Post by michael_borland » 25 Jun 2018, 09:23

Jimmy,

Can you upload an example? What you are doing should work.

By the way, using psi or nu is equivalent. Even for linacs and transport lines, some people find it easier to think in terms of the phase advance normalized to 2*pi.

--Michael

jgarland
Posts: 5
Joined: 29 May 2018, 08:20

Re: Optimising Phase Advance - error

Post by jgarland » 25 Jun 2018, 09:36

It is a long, long lattice definition given to me by others, I think it would be hard to wade through it (for sure I'm having trouble!). In order not to waste anymore time (seeing as there isn't a quick/easy answer) I'm going to build a small example from scratch to work out the problem. I will report back the issue. Do you think this is best?

Thanks,
Jimmy

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

Re: Optimising Phase Advance - error

Post by michael_borland » 25 Jun 2018, 09:37

Jimmy,

Absolutely, a compact example that shows the problem is best. Thanks.

--Michael

Post Reply