vary_element for sto variables

Moderators: cyao, michael_borland

Post Reply
Ikpfelix
Posts: 15
Joined: 24 May 2016, 06:50

vary_element for sto variables

Post by Ikpfelix » 01 Mar 2018, 04:26

Hi,
is there a analog for "vary_element" in order to change variables which are used with "sto"?

The following is written in my lattice file:

Code: Select all

% 0.0853541 sto DeltaA
% DeltaA sto DeltaB
% 1.76006 sqr 2 mult sqrt 1.76006 DeltaA - sqr 2 mult sqrt - sto DeltaC

SD5: DRIF,L="0.3035 DeltaA +" 
SD7: DRIF,L="0.2432 DeltaC -" 
SD9: DRIF,L="0.5275 DeltaB +"
The goal is to vary "DeltaA" iteratively from 0 to 0.0853541 in small steps.

Im searching for something like

Code: Select all

&vary_element name=??? item=??? index_limit=1001 initial=0 final=0.0853541 &end
for the command file. But since "DeltaA" isn't an item of an element, I'm not sure if it is possible to change it automatically.

Is there a possibility?

Thanks in advance,
Felix

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

Re: vary_element for sto variables

Post by michael_borland » 01 Mar 2018, 09:12

Felix,

You can't vary the quantities in the element definition directly, but you can performed linked variation of quantities. E.g.,

Code: Select all

&vary_element name=SD5, item=L, index_limit=1001, initial=1 final=1.0853541 &end
&link_elements target=SD7, item=L, source=SD5, equation="2 L -" &end
This would vary the length of SD5 and SD7, keeping a total of 2.

--Michael

Ikpfelix
Posts: 15
Joined: 24 May 2016, 06:50

Re: vary_element for sto variables

Post by Ikpfelix » 02 Mar 2018, 08:54

Hi Michael,

thanks a lot! This method works exactly as intended!

One general question:

Is it possible to use

Code: Select all

SD4: DRIF,L=1
LINE=(...,SD4,SD5,...)

and 

&vary_element name=SD5, item=L, index_limit=1001, initial=-1 final=1 &end
&link_elements target=SD7, item=L, source=SD5, equation="2 L -" &end
instead of

Code: Select all

SD4: DRIF,L=0
LINE=(...,SD4,SD5,...)

and 

&vary_element name=SD5, item=L, index_limit=1001, initial=0 final=2 &end
&link_elements target=SD7, item=L, source=SD5, equation="2 L -" &end
?
In the first case "L" of SD5 becomes negative in half of the cases and in the second case "L" of SD4 is zero. A negative length doesn't make sense physically, but the sum of SD4 and SD5 will be the same (and positive). Is there a problem in getting the correct results downstream? This can save time instead of rebuilding the lattice in more complicated cases.

Thanks in advance,
Felix

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

Re: vary_element for sto variables

Post by michael_borland » 02 Mar 2018, 09:12

Felix,

Although elegant will warn about negative-length drifts, the results are not necessarily unphysical. The only limitation would be that if a negative drift ends up putting an element on the other side of a preceding element. E.g.,

Code: Select all

L1: drift,l=-2
Q1: quad,...
Q2: quad,...
BL: line=(Q1,L1,Q2)
In this case Q2 follows Q1 in the simulation but the drift L1 puts in physically in front of Q1. This isn't modeled correctly.

--Michael

Ikpfelix
Posts: 15
Joined: 24 May 2016, 06:50

Re: vary_element for sto variables

Post by Ikpfelix » 02 Mar 2018, 09:39

Hi Michael,

thanks again! I will take that into account.

Best regards,
Felix

Post Reply