Twiss output in the absence of &track command

Moderators: cyao, michael_borland

Post Reply
LouisEmery
Posts: 4
Joined: 12 Jun 2008, 09:20

Twiss output in the absence of &track command

Post by LouisEmery » 20 Jun 2008, 17:25

Just a curiosity I ran into.
I ran elegant four times, with the essential namelist commands:

&run_control
steps = 20
...
&end

&twiss
output_at_each_step = 0 or 1
...
&end

&track &end
or
!&track &end i.e. no track command


I get different sets of output

Code: Select all

output
each step  track   twiss file content
0          0       single twiss page
0          1       single twiss page
1          0       nuttin' (0-row file)
1          1       20 twiss pages
Obviously the track command is needed to generate the various pages.
But without the track command we get one twiss calculation
for unperturbed lattice, but only when we set output_at_each_step=0.

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

Re: Twiss output in the absence of &track command

Post by michael_borland » 20 Jun 2008, 17:32

Louis,

This happens because twiss_output is a "setup/action" command. When output_at_each_step=0, it is in "action" mode: it does the calculation immediately. When output_at_each_step=1, twiss_output is in "setup" mode: it only sets up for twiss computations and output later. "Later" means when a major command like "track", "optimize", etc. is seen.

Other commands that behave this way are matrix_output, moments_output, and coupled_twiss_output.

--Michael

tiefenback
Posts: 3
Joined: 11 Aug 2009, 09:09
Location: Thomas Jefferson National Accelerator Facility

Re: Twiss output in the absence of &track command

Post by tiefenback » 11 Aug 2009, 09:24

As a n00b to this forum and to elegant, but catching up with help, I found this kind of problem confusing in this way: I tried to use the error_element command, having enabled twiss output. I found that the twiss output was unchanged, and gave me no indication at all that any errors had been folded into the settings. Yves Roblin pointed out what was wrong in my elegant file. The default setting output_at_each_step=0 resulted in the twiss output being generated immediately but not after the incorporation of errors into the set points. What was confusing to me is that the stdout from elegant included information and warnings about proportional errors (I used fractional=1) on zero set points, so I knew the error_element command was being processed. Setting output_at_each_step=1 made the twiss file contain not two, but still only one "step" of data, but for the final step after error incorporation. I had &track &end in the file all along, and had no indication of what was going wrong.

Is there any tutorial material, even a few paragraphs, which explains what it means for a command to be dual function ("setup/action")? and how this translates into what happens when in elegant execution? To use terminology I have borrowed from an ex-Navy airframe mechanic I know, this seems to be an example of instruction terminology which is "clear only if [already] known".

Michael Tiefenback

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

Re: Twiss output in the absence of &track command

Post by michael_borland » 11 Aug 2009, 09:52

Michael,

The setup/action command distinction is admittedly confusing and not well explained in the manual. An "action" command causes elegant to immediately perform a specific computation or set of computations. In contrast, a "setup" command tells elegant how to perform computations when it later encounters a relevant action command (typically track or optimize).

The intention for twiss_output in particular is to give the user the choice between computing the twiss parameters for the unperturbed lattice and for each perturbed lattice. Most of the commands that can run in both "action" and "setup" mode have the "output_at_each_step" parameter, which is used to switch between the modes. Action mode is always the default.

A number of the examples in the examples file, particularly the PAR subdirectory, make use of various commands in setup mode. Try
% find . -name '*.ele' -print | xargs fgrep -il output_at_each_step
to locate the relevant files.

I'll add something about this to the next version of the manual.

--Michael

Post Reply