Optimising Phase Advance - error
Moderators: cyao, michael_borland
Optimising Phase Advance - error
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
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
Re: Optimising Phase Advance - error
Not sure if this helps, but do you have output_at_each step=1 under &twiss_output ?
-Neeraj
Re: Optimising Phase Advance - error
Hi Neeraj,
Thanks for your reply. Yes I do, it is set to =1.
Thanks for your reply. Yes I do, it is set to =1.
-
- Posts: 1959
- Joined: 19 May 2008, 09:33
- Location: Argonne National Laboratory
- Contact:
Re: Optimising Phase Advance - error
Jimmy,
To match phase advance, use <elementName>#<occurence>.nux or .nuy, rather than .psix and .psiy. nux = psi/(2pi).
--Michael
To match phase advance, use <elementName>#<occurence>.nux or .nuy, rather than .psix and .psiy. nux = psi/(2pi).
--Michael
Re: Optimising Phase Advance - error
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!
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!
-
- Posts: 1959
- Joined: 19 May 2008, 09:33
- Location: Argonne National Laboratory
- Contact:
Re: Optimising Phase Advance - error
Jimmy,
Do your MARK elements have FITPOINT=1 in the definition?
--Michael
Do your MARK elements have FITPOINT=1 in the definition?
--Michael
Re: Optimising Phase Advance - error
Yes they do, they looks something like this:
E2: MARK, FITPOINT=1
Cheers,
Jimmy
E2: MARK, FITPOINT=1
Cheers,
Jimmy
-
- Posts: 1959
- Joined: 19 May 2008, 09:33
- Location: Argonne National Laboratory
- Contact:
Re: Optimising Phase Advance - error
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
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
Re: Optimising Phase Advance - error
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
Thanks,
Jimmy
-
- Posts: 1959
- Joined: 19 May 2008, 09:33
- Location: Argonne National Laboratory
- Contact:
Re: Optimising Phase Advance - error
Jimmy,
Absolutely, a compact example that shows the problem is best. Thanks.
--Michael
Absolutely, a compact example that shows the problem is best. Thanks.
--Michael