At undulators wigglers and Kick Maps

Implement the kick maps in AT.

The kick maps come from [Radia] and the RadiaToTrack notebook. One loads Radia:
« Radia`;

One defines the potential (see [Elleaume], 1992)

(1)
\begin{align} \Phi(x,z,s) = \left(\int_{-\infty}^s B_x ds\right)^2 + \left(\int_{-\infty}^s B_z ds\right)^2 \end{align}

In eqn. 1, $B_{x,z}$ are the horizontal and vertical magnetic fields, respectively.

The kicks are then given by

(2)
\begin{align} \frac{dx}{ds}(\infty) = -\frac{\alpha^2}{2}\int_{-\infty}^{\infty}\frac{\partial}{\partial x}\Phi(x,z,s)ds + \mathcal{O}(\alpha^3) \end{align}
(3)
\begin{align} \frac{dz}{ds}(\infty) = -\frac{\alpha^2}{2}\int_{-\infty}^{\infty}\frac{\partial}{\partial z}\Phi(x,z,s)ds + \mathcal{O}(\alpha^3) \end{align}

The code Radia allows one to build an insertion device and outputs the horizontal and vertical kick angles as a function of horizontal and vertical position. These are given as two tables.

We would like to put these into Accelerator Toolbox. This requires us to first implement the element so that it may be inserted in the lattice description array. The pass method is called IdTablePass.

Then, build the insertion device you want. The RadiaToTrack notebook has some example undulators and the code for creating the kickmaps. For example, a planar undulator:

(*___ ___ __  Simple vertical field undulator ___ ___ ___ ___ ___ ___ _*)

per = 35;  (* Undulator period in [mm] *)

gap = 10;   (* Magnetic Gap in [mm]*)

br = 1.2;   (* Remanent Field of the material in [T]*)

nper = 3;  (* Number of periods *)

lx = 30; (* Horizontal width of the magnet blocks in [mm]*)

lz = 18; (* Vertical height of the magnet blocks in [mm]*)

airgap = 0.5;(* Airgap between the magnets in [mm]*)

(*___ ___ ___ ___ ___ _  Start Computations ___ ___ ___ ___ ___ ___ _*)

wv = {lx, per/4 - airgap, lz};
wh = wv;
p = {0, 0, 0};
radUtiDelAll[];
g = und[p + {0, 0, gap/2 + lz/2}, wv, wh, nper, per, br, 1];
RadTrfZerPara[g, p, {0, 0, 1}];

x = 0;
z = 0;
Print["Bz = ", harm[g, "bz", per, {x, 0, z}, 1][[1]], " T"];

Running this code using Radia, one finds a maximum vertical magnetic field of 0.76 T.
An undulator has a k value(4)
\begin{align} k=\frac{eB\lambda_u}{2\pi m_0 c^2} = \frac{B[kG] \lambda [cm]}{10.7} \end{align}

or

(5)
\begin{equation} K = 0.934 B_0(T)λ_u(cm) \end{equation}

So this undulator would have a k of 2.49.

Or, for an AppleII undulator, we use:

(*___ ___ __  Apple II undulator ___ ___ ___ ___ ___ ___ _*)

per = 88;                 (* Undulator Period in [mm] *)

lx = 25*2;             (* Total Horizontal width of the magnet array \
in [mm] *)
lz = 
  12;                  (* Vertical height of the magnet blocks *)

gapx = 1;                 (* Horizontal gap between magnet arrays in \
[mm] *)
gap = 16;                 (* Magnetic Gap in[mm] *)
p1 = 
 per*0.5;         (* Antisym.  motion of the girders  : Rotate the \
Linear Pol. *)
p2 = 
 per*0.0;  (* Symmetric L motion of the girders : Linear-> Circular-> \
Linear  *)
br = 1.2;                 (* Remanent field of the magnet \
blocks in [T] *)
nper = 6;                (* Number of periods *)
\
airgap = 0;           (* longitudinal airgap between magnets in [mm] *)
\
(*___ ___ ___ ___ ___ _  Start Computations ___ ___ ___ ___ ___ ___ _*)
\

p = {0, 0, 0};
radUtiDelAll[];
g = apple2G[p, per, gap, gapx, {-p1 + p2/2, -p2/2, -p2/2, p1 + p2/2}, 
   lx, lz, airgap, br, nper];
Print["B (0,0,0) = ", harm[g, "b", per, {0, 0, 0}, 1][[1]], " T"];

Then, construct the kick map and output it, either in matlab format or text format:

Export[file <> ".mat", {"xkick" -> Transpose[resx], 
  "ykick" -> Transpose[resz], "xkick1" -> 0 Transpose[resx], 
  "ykick1" -> 0 Transpose[resz], "xtable" -> {px}, "ytable" -> {pz}, 
  "Len" -> {{N[len/1000]}}}, "LabeledData"]

The first of these is simpVU.mat. The second is APPLEII_VP.mat. We may change the p parameters to change the offset which changes the polarization.

Thus, when we read this into Matlab, one will have the fields xkick, ykick, xkick1, ykick1, xtable, ytable, and Len. We create the element using the function atidtable. It should contain a field for the length, and also for the number of slices. It should also contain the kickmap itself, so this is available to the passmethod.

Here's how to create the table using [atidtable] for these two examples:

simpvu=atidtable('simpVU', 1, 'simpVU.mat', 6.04, 'IDTablePass')
a2vp=atidtable('a2vp', 1, 'APPLEII_VP.mat', 6.04, 'IDTablePass')

And the element looks like:
        FamName: 'simpVU'
         Nslice: 1
       MaxOrder: 3
    NumIntSteps: 10
             R1: [6x6 double]
             R2: [6x6 double]
             T1: [0 0 0 0 0 0]
             T2: [0 0 0 0 0 0]
     PassMethod: 'IDTablePass'
         Length: 1.6000
           NumX: 81
           NumY: 21
         xtable: [81x1 double]
         ytable: [21x1 double]
          xkick: [21x81 double]
          ykick: [21x81 double]
         xkick1: [21x81 double]
         ykick1: [21x81 double]
       PolynomA: [0 0 0 0]
       PolynomB: [0 0 0 0]

Once we have the element, we need to add it to the ring. e.g.
esrf_simpVU=add_ID(esrf,simpVU);

Now we compute the new tunes using

[LinData,nu1, ksi]=atlinopt(esrf_simpVU,0);

Now, by creating the kick map element with different energies, and computing the
resulting tune shifts we can compare to the analytical formulae for the tune shift.

[ dnuz ] = kickmaptest( [2 2.1 2.2 2.5 2.7 2.8 2.9 3 4 5 6], 'simpVU.mat')

The tune shift for a planar undulator is given by(6)
\begin{align} \Delta \nu_y = \frac{<\beta_y>L}{8\pi \rho^2} \end{align}

The tune shift with amplitude is given by

(7)
\begin{align} \frac{d\nu_y}{dJ_y} = \frac{\pi <\beta_y^2> L}{4 \lambda^2 \rho^2} \end{align}

The result is

simpVU_dnuz.png

—-
An undulator may also be entered via an analytic formula for the fields. The element here is created by the atwiggler function

wig = atwiggler('wig1', 1.6, 1.6, .67, 1, 1, [1;0;0;0;0], [1;0;0;0;0], 'GWigSymplecticPass')

with the result:
wig = 

       FamName: 'wig1'
        Length: 1.6000
            Lw: 1.6000
          Bmax: 0.6700
         Nstep: 1
         Nmeth: 1
        NHharm: 1
        NVharm: 1
            By: [5x1 double]
            Bx: [5x1 double]
            R1: [6x6 double]
            R2: [6x6 double]
            T1: [0 0 0 0 0 0]
            T2: [0 0 0 0 0 0]
    PassMethod: 'GWigSymplecticPass'

One may describe the field of an undulator in the so-called Halbach representation as

(8)
\begin{align} B_x = \sum_i \frac{k_{xi}}{k_{yi}}B_i \sinh(k_x x)\sinh(k_y y) \cos(k_i z) \end{align}
(9)
\begin{align} B_y = \sum_i B_i \cosh(k_x x)\cosh(k_y y) \cos(k_i z) \end{align}
(10)
\begin{align} B_z = -\sum_i \frac{k_{i}}{k_{yi}}B_i \cosh(k_x x)\sinh(k_y y) \sin(k_i z) \end{align}

We may look how its done in BMAD also
http://www.lns.cornell.edu/~dcs/bmad/


Besides calculating them, with e.g. Radia, there is also the question of how to measure the effect of the kick map on the beam dynamics. It is similar to the question of how to measure fringe fields in magnets.

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License