## How about physics of finding a dynamic aperture?

Moderators: cyao, michael_borland

gwei
Posts: 33
Joined: 17 Jul 2015, 07:16

### How about physics of finding a dynamic aperture?

How about physics of finding a dynamic aperture on a line survey in CODE Elegant?

I am a new learner. To my understand, usually we track a particle with (x,y) along a line
in x-y area. When it just loss at a position along the line. The position is defined
as a dynamic aperture point. Is it the same way in CODE Elegant? If it is yes, then a
collimation area limit should decide the survival or loss of the particle. How about the
collimation area limit to define the death of a particle in CODE Elegant?

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

### Re: How about physics of finding a dynamic aperture?

The DA search in elegant looks for the boundary between particle loss and particle survival. Particle loss can occur through various mechanisms
1. Particle loss can occur when a particle hits a physical aperture, which can be defined by the user using MAXAMP, ECOL, RCOL, and SCRAPER elements, as well as using the &aperture_data command.
2. Particle loss can also occur even when no physical apertures are present, if the particle coordinates become very large in the KQUAD, KSEXT, KOCT, or MULT elements. Similarly, losses may occur in CSBEND or CSRCSEND elements if there are numerical problems, such as undefined square roots. In this case, "very large" means positions greater than 10m and slopes greater than 1.
3. Loss can occur if the particle coordinates are equal to the IEEE infinity or not-a-number values.
4. Loss can occur in other special elements when numerical problems are detected or there is some other issue. E.g., when using UKICKMAP, if a particle is outside the map region, it is considered lost.
--Michael

gwei
Posts: 33
Joined: 17 Jul 2015, 07:16

### Re: How about physics of finding a dynamic aperture?

michael_borland wrote:The DA search in elegant looks for the boundary between particle loss and particle survival. Particle loss can occur through various mechanisms
1. Particle loss can occur when a particle hits a physical aperture, which can be defined by the user using MAXAMP, ECOL, RCOL, and SCRAPER elements, as well as using the &aperture_data command.
2. Particle loss can also occur even when no physical apertures are present, if the particle coordinates become very large in the KQUAD, KSEXT, KOCT, or MULT elements. Similarly, losses may occur in CSBEND or CSRCSEND elements if there are numerical problems, such as undefined square roots. In this case, "very large" means positions greater than 10m and slopes greater than 1.
3. Loss can occur if the particle coordinates are equal to the IEEE infinity or not-a-number values.
4. Loss can occur in other special elements when numerical problems are detected or there is some other issue. E.g., when using UKICKMAP, if a particle is outside the map region, it is considered lost.
--Michael
Thank you very much!

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

### Re: How about physics of finding a dynamic aperture?

Michael,

It appears that particles are lost even when there is no limiting aperture in the KQUAD elements. I am tracking a bunched_beam with sampled parameters from a realistic beam. Increasing the N_KICKS reduces the number of lost particles considerably, for instance 316/1000 are lost with N_KICKS=30 and 91/1000 are lost for N_KICKS=50. If I got to N_KICKS=80, however, it reverts to 316/1000. How can one decide the optimum value for N_KICKS? Is there any other parameter that play a role in losing particles in the absence of apertures?

Also, in an optimization procedure, what exactly decides the step_size?
-Neeraj

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

### Re: How about physics of finding a dynamic aperture?

Neeraj,

Particles can be lost inside the KQUAD elements if the coordinates exceed preset limits, defined as |x|>10m, |y|>10m, |x'|>1, and |y'|>1.

The number of kicks is typically selected by looking that the effect on the tunes and closed orbit. Basically, if increasing the number of kicks doesn't change the tunes by a significant amount, it is considered adequate. I usually try to keep the tune error below 1e-4 and closed orbit below 1e-6.

--Michael

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

### Re: How about physics of finding a dynamic aperture?

Michael,

Thanks for the reply. However, I do not completely understand what is going on with my simulations. I have a bunch file that has been filtered with 1 cm cut-off in spatial co-ordinates and 0.5 in the slope. So now the particles should not be lost because of the co-ordinate limits of the elements, right? But I still do lose a lot of them as soon as they enter the first quadrupole without any physical aperture! Please have a look at the attached ".loss" file. The bunch is too big to attach, but I can give you a truncated version if it helps to resolve the issue.
Attachments
doublet.loss.sdds
.loss extension wasn't allowed, so I added a .sdds pseudo extension.
-Neeraj

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

### Re: How about physics of finding a dynamic aperture?

Neeraj,

I suspect that what is happening is that some particles are actually getting turned around inside the magnet. When this happens, the particle is marked as lost but the lost coordinates are not reliable. One way to check this is to decrease the strength of the quadrupole. If the losses don't decrease, then this can't be what's going on.

Code: Select all

``````Q1: KQUAD,L=0.1,N_KICKS=100,K1=1
BL: line=(Q1)
``````
try

Code: Select all

``````Q1K: KQUAD,L=0.001,N_KICKS=1,K1=1
W1: WATCH,FILENAME="%s.w%02ld"
BL: line=(100*(Q1K,W1))
``````
Looking at the coordinates in the .w?? files will give you a clue as to how fast the slopes are growing due to the focusing effect.

Code: Select all

``````sddsplot -column=x,xp *.w?? -graph=dot -split=page -sep=page -same
``````
If you can upload a set of input files that demonstrate the losses, I can look more fully.

--Michael