Code indexing in gitaly is broken and leads to code not being visible to the user. We work on the issue with highest priority.

Skip to content
Snippets Groups Projects
  • gsell's avatar
    581ec963
    Fix links in gitlab environment · 581ec963
    gsell authored
    All links to `gitlab.psi.ch` and `amas.web.psi.ch` are now defined as attributes in `Manual.attributes`. In a new branch, only this file must be changed to get the right links.
    
    The header for rendering the chapters in `env-gitlab` is now defined in `env-gitlab.attributes`
    581ec963
    History
    Fix links in gitlab environment
    gsell authored
    All links to `gitlab.psi.ch` and `amas.web.psi.ch` are now defined as attributes in `Manual.attributes`. In a new branch, only this file must be changed to get the right links.
    
    The header for rendering the chapters in `env-gitlab` is now defined in `env-gitlab.attributes`
Code owners
Assign users and groups as approvers for specific file changes. Learn more.

1. OPAL-map

1.1. Introduction

OPAL-map is a map tracking beam optics code. This type computes maps for each beam line element to describe the action of the system.

The map creation is done by applying the Lie Operator on the element Hamiltonian and calculated in the Truncated Power Series Algebra (TPSA)[1]. The TPSA is a Differential Algebra (DA), which uses the Taylor expansion as the equivalent function. In OPAL-map the TPSA gets provided from the own OPAL DA package.

In contrast to time t dependent tracking codes, as OPAL-t, map tracking codes use the longitudinal bunch position s as independent variable. Furthermore, map tracking codes do not use numerical integrators for the determination of the particle trajectory, which can be a computationally very expensive.

The main advantage in map tracking codes lies in the ''map'' itself. These do not only contain valuable information about the beam line, but also can be accumulated to reduce the computational effort in the particle tracking.

1.2. Variables in OPAL-map

For in and outputs, the units as in Variables in OPAL-t are used.

OPAL-map uses an Frenet-Serret coordinate system, referring on a reference particle. This particle has the ideal properties, ergo follows the design path. The following canonical variables to describe the motion of particles. The physical units are listed in square brackets.

X

Horizontal position x of a particle relative to the reference particle [m].

PX

\frac{p_x}{P_0} Normalized horizontal canonical momentum [1]. (Where p_x is the momentum of the particle and P_0 is the momentum of the reference particle)

Y

Horizontal position y of a particle relative to the reference particle [m].

PY

\frac{p_y}{P_0} Normalized horizontal canonical momentum [1].

Z

Longitudinal position z of a particle relative to the reference particle [m].

DELTA

\frac{E}{P_0 c}-\frac{1}{\beta_0} Energy derivation [1]. (Where E is the total energy of the particle and \beta_0 = \frac{u}{c} the speed relative to the speed of light c of the reference particle)

The independent variable is position of the reference particle s [m].

1.3. Principle of Map Tracking

The particle motion gets calculated by applying the map on the particle parameter.

mapTracking
Figure 1. Flow chart of map tracking.
v^f = \mathbf{\mathcal{M}} \circ v^i

Where v denotes the final (v^f) and initial (v^i) six dimensional phase space vector of each particle. \mathbf{\mathcal{M}} is the map. This map can represent either a beam element slice, the whole element, a beam line section or the whole system.

1.3.1. Creation of map

The creation of the element map is based on the Hamiltonian Mechanic, more specifically on the Lie Operator.

\begin{aligned}
    H &= T + V\\
    \frac{d\mathbf{q_i}}{ds} &= \frac{\partial H}{\partial p_i} \; , \;  \frac{d\mathbf{p_i}}{ds} = - \frac{\partial H}{\partial q_i}
\end{aligned}

Here H, the time dependent Hamiltonian represents the total energy, consisting of the kinetic T and potential V energy. The lower equations are the Hamiltonian equations of motion, where the momenta p_i and the positions q_i form the canonical pairs. Using canonical transformations, the Hamiltonian can be adjusted to use the path length s as independent and the particle parameters as dependent variable(s).

Introducing the Lie operator, which acts similar to a "waiting" Poisson Bracket:

\begin{aligned}
    :\!f\!:  = \left[ f, \circ \right] = \sum_{i=1}^{n} \left( \frac{\partial f}{\partial q_i}\frac{\partial \circ}{\partial p_i} - \frac{\partial f}{\partial p_i}\frac{\partial \circ}{\partial q_i} \right)
\end{aligned}

If a function f:= f \left( \mathbf{q_{(s)}},\mathbf{p_{(s)}}\right) describes one of the phase space variables v its total derivative to the independent variable, combined with the Hamiltonian equations of motions, is similar to the Lie operator times the indepedent variable, i. e. s.

\begin{aligned}
    \frac{df}{ds}&= \sum_{i=1}^{n} \left( \frac{dq_i}{ds}\frac{\partial f}{\partial q_i} +\frac{dp_i}{ds}\frac{\partial f}{\partial p_i} \right) \\
    \frac{df}{ds}&= \sum_{i=1}^{n} \left( \frac{\partial H}{\partial p_i}\frac{\partial f}{\partial q_i} -\frac{\partial H}{\partial q_i}\frac{\partial f}{\partial p_i} \right)  \equiv -:\!H\!: f
\end{aligned}

The integral over the independent variable \int \cdot ds:

\begin{aligned}
    f(s)&= e^{-:\!H\!: s} f(s_0) \\
        \mathcal{M} &= e^{-:\!H\!: s}
\end{aligned}

Where e^{-:\!H\!: s} is the Lie expansion.

1.3.2. Implementation of map tracking

For the derivative of the Hamiltonian, a Differential Algebra (DA) was used, in particular the Truncated Power Series Algebra (TPSA). This algebra uses the Taylor expansion as the equivalent function, which also is responsible for its name by creating truncated power series. Just form the definition of the Taylor expansion, it can be seen that a finite, to the order \Omega, expansion is an approximation of the actual function, due to the error term \mathcal{O}\left( \mathbf{v}^{\,\Omega +1}\left( \Delta s\right)\right) .

\begin{aligned}
     f = \mathbf{\mathcal{M}} = {\sum_{n=0}^{\Omega} \frac{f^{\left(n\right)}}{n !} \left( \mathbf{v}\left( \Delta s\right) \right)^n} + {\mathcal{O}\left( \mathbf{v}^{\,\Omega +1}\left( \Delta s\right)\right) }
\end{aligned}

In OPAL-map the Hamiltonian gets Taylor expanded and its map derived (Creation of Map) in the TPSA using the OPAL DA package. The truncation length gets defined in TRACK setting the MAP_ORDER attribute.

TRACK, LINE= QUADTEST, BEAM=BEAM1, MAXSTEPS=10000, DT=1.0e-10, ZSTOP=4.0, MAP_ORDER=2;

1.4. Additional Parameter in OPAL-map

Table 1. Additional Parameter.
Attribute Name set in Default Value Units Description

MAP_ORDER

TRACK

1

[ ]

defines the map order ( = order TPSA - 1).

NSlices

beam line element

1

[ ]

defines the number of steps inside the element.

1.4.1. Limitations

OPAL-map is the new flavour of OPAL and currently just contains the fundamental beam line elements:

1.5. Example

FODO lattice: MAP-FODO.in

Input distribution (to be put in directory data): FODO_DIST.dat

To RUN OPAL-map, the METHOD attribute gets set to THICK.

RUN, METHOD = "THICK", BEAM=BEAM1, FIELDSOLVER=FS1, DISTRIBUTION=DIST1;

The maximal order of the beam line maps get defined with the MAP_ORDER attribute.

TRACK, LINE= QUADTEST, BEAM=BEAM1, MAXSTEPS=10000, DT=1.0e-10, ZSTOP=4.0, MAP_ORDER=2;

As an optional parameter for the beam line elements NSlices=<x> provides the opportunity to split one element in <x> smaller steps. Otherwise, the default value is defined with 1.

D1:  DRIFT,             L=1.,                ELEMEDGE=0.000, NSLICES=10;
QP1: QUADRUPOLE,        L=0.3,  K1= 8.64195, ELEMEDGE=1.000, NSLICES=15;

1.6. Output

In addition to the progress report that OPAL-map writes to the standard output (stdout) it also writes different files for various purposes.

1.6.1. <input_file_name >.stat

The file structure is analogous to OPAL-t .stat file.

1.6.2. data/<input_file_name >.dispersion

OPAL-map computes the dispersion of the beam line according to:

\begin{aligned}
  \begin{pmatrix} \eta_{i} \\ \eta_{p_i} \end{pmatrix}_{s_1}
  =
  \begin{pmatrix} R_{11} & R_{12} \\ R_{21} & R_{22} \end{pmatrix}
  \cdot
  \begin{pmatrix} \eta_{i} \\ \eta_{p_i} \end{pmatrix}_{s_0}
  +
  \begin{pmatrix} R_{16} \\ R_{26} \end{pmatrix}
\end{aligned}

where R is the Transfermatrix and \eta is the dispersion.

Column Nr. Name Units Meaning

1

position

m

Longitudinal position

2

\eta_x

m

Spatial dispersion in x

3

\eta_{px}

1

Momentum dispersion in x

4

\eta_y

m

Spatial dispersion in x

5

\eta_{py}

1

Momentum dispersion in y positions

1.6.3. data/<input_file_name >.map

Here the transfer map of the whole beamline gets printed. Its format is analogous to a DA- FVPs (src/Classic/FixedAlgebra), where the polynomials (DA- FTPs) get represented in a 6 dimensional vector. The first number describes the coefficient and the following 6 the variables of the monomial.

Column Nr. Name Units Meaning

1

coefficient

1

coefficient of monomial

2

x

1

x in monomial

3

p_x

1

p_x in monomial

4

y

1

y in monomial

5

p_y

1

p_y in monomial

6

z

1

z in monomial

7

\delta

1

\delta in monomial

1.7. References

[1] Martin Berz. Modern map methods in particle beam physics. eng. ISBN: 978-0-12-014750-2. San Diego: Academic Press, 1999.