Skip to content

Optimization of the undulator period in the K vs period with flux vs energy spaces.

Notifications You must be signed in to change notification settings

hidecode221b/U4Opt

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

74 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

U4Opt: Undulator plot for the period optimization

Introduction

The undulator is an insertion device used to generate the synchrotron radiation at a higher flux density than that from the bending magnet radiation. The photon energy ($hc/\lambda$) from the undulator depends on the electron beam energy ($0.000511\gamma$ GeV), harmonic number ($n$), undulator period ($\lambda_u$), polar angle from the undulator axis ($\theta$), and $K$ parameter which is based on the $\lambda_u$ and peak magnetic field ($B_0$; in the sinusoidal field approximation).

$$\lambda_n = {\lambda_u \over 2 n \gamma^2}\left( 1 + {K^2 \over 2} + \gamma^2 \theta^2 \right)$$

$$K = {e B_0 \lambda_u \over 2 \pi m c} = 93.36 B_0 \lambda_u$$

$$\mbox{($B_0$ in Tesla, $\lambda_u$ in m)}$$

$B_0$ can be designed in the magnet height ($h$) and magnetization ($B_r$), and tuned in the magnetic gap ($g$) and temperature. The minimum gap is basically limited in the dynamic aperture of the storage ring lattice, and the maximum gap is limited in the mechanical structure of the undulator. Various magnetic types and structures are available in the advanced synchrotron facilities.

The deviation from the sinusoidal field appears owing to the finite number of trapezoidal magnet blocks in a period ($M$). In particular, the hybrid short period undulator deforms the sinusoidal field because the high peak field strength at the small pole materials. The photon radiative field can be analyzed in the Fourier transform as described in elsewhere by Takashi Tanaka.

$$\beta_{x,y} (z) = \pm {e \over \gamma m c} \int_0^z B_{y,x} (z') dz'$$

$$K = \sqrt{2 \langle (\gamma \beta)^2 \rangle}$$

$$\langle (\gamma \beta)^2 \rangle = {1 \over \lambda_u} \int_0^{\lambda_u} \lbrack(\gamma \beta_x)^2+(\gamma \beta_y)^2 \rbrack dz$$

Undulator peak field at 1 Tesla in a period of 20 mm

Here, even if $\beta (z)$ is not sinusoidal, the effective $K$ should be obtained in either the numerical integration of the field as shown above or the discrete Fourier transform (DFT) analysis within a period $\lambda_u$. For a simplity in the DFT analysis, assume $B_x$=0, so $\beta_x$ is formulated as below.

$$\beta_x (z) = {e \over \gamma m c} \sum_{n=1}^{n_{\mbox{odd}}} {\beta_n} \sin(2 \pi n z / \lambda_u)$$

$K_n$ is described in terms of $\beta_n$, and effective $K$ can be evaluated.

$$K_n = {e \over m c} {\beta_n} $$

$$K_{\mbox{eff}} = \sqrt{ K_1^2 + K_3^2 + K_5^2 + \cdot \cdot \cdot }$$

The effective field can also be evaluated by using $\beta_n$.

$$B_{\mbox{eff}} = {2 \pi mc \over e} {K_{\mbox{eff}} \over \lambda_u } $$

The flux ($F$) from the undulator depends on the the electron beam current ($I$ amps), total length ($L$), $\lambda_u$, $n$, and $K$. The flux over the central cone ($\sqrt{\lambda/L}$) at the harmonic $n$ and number of periods $N$ ($=L/\lambda_u$) in the band width ($\Delta \omega/\omega=0.1$ %) is

$${\partial F \over \partial (\Delta \omega/\omega)} = 1.431 \cdot 10^{14} \cdot N \cdot Q_n(K) \cdot I$$

$$Q_n(K) = (1+K^2/2) \cdot F_n(K)/n$$

$$F_n(K) = {K^2n^2 \over (1 + K^2/2)^2} \cdot \left[ \ J_{n-1 \over 2}(\zeta) - J_{n+1 \over 2}(\zeta) \right]^2$$

$$\zeta = {nK^2 \over 4 (1 + K^2/2)}$$

$J$ represents the Bessel junction of the first kind.

The maximum $K$ value is correlated with the lowest energy as well as highest $F$ at a particular $n$. The photon energy extends toward a high energy as the $n$ increases at every odd $n$. However, the energy is not tunable between 1st and 3rd harmonics if $K$ is less than 2, because the wavelength of radiation $\lambda_1$ at $K=0$ is equal to $\lambda_3$ at $K=2$ on axis $\theta = 0$ as shown below.

$$\lambda_{1, K=0} = {\lambda_u \over 2 \cdot 1 \gamma^2} \left( 1 + {0^2 \over 2} \right) = {\lambda_u \over 2 \gamma^2}$$

$$\lambda_{3, K=2} = {\lambda_u \over 2 \cdot 3 \gamma^2} \left( 1 + {2^2 \over 2} \right) = {\lambda_u \over 2 \gamma^2}$$

U4Opt discloses these complex relationship among the parameters above. Users comprehend the principle of the undulator at a glance in two plots and tune the periodic length interactively.

Background

The undulator period can be optimized in the plot based on the magnet type, gap, flux. To design the undulator specification in the synchrotron facility, U4Opt has been developed. The first prototype of the program is based on the Excel spreadsheet, and transfered to the macro in Igor Pro. Python code is now available. The coding is in progress, not well documented, but open for public for review.

The first concept of K-period space analysis originates from the talk of Dr. Markus Tischer (DESY) in the ID23 workshop.

Magnet

The magnetic configuration can be selected in the pop down list. Users can tune the parameters from the default values in either ($a, b, c$) or ($B_r, M, h$) configuration. APPLE-II is based on the $B_r = 0.62$ expirically. The magnetic field can be approximated in the following equations;

$$B_0 = a \cdot \exp \left[{g \over \lambda_u} \left( b + {g \over \lambda_u}c \right) \right]$$

by K. Halbach, J. Phys. Colloques 44, C1-211-C1-216 (1983) for a hybrid magnet (HYB), and

$$B (z) = 2 B_r \sum_{\nu=0} \cos(2 \pi n z/ \lambda_u) {\sin(n\pi\epsilon/M) \over (n\pi/M)} \left( 1 - e^{-2 n\pi h/\lambda_u} \right) e^{-\pi ng/\lambda_u}$$

$$n=1+M\nu, (\nu=0,1,2,...)$$

$$\epsilon={1 \over (1+1/M)}$$

by K. Halbach, Nucl. Instrum. Methods 187, 109 (1981) for a pure permanent magnet (PPM). $M$ represents the number of magnets in a priod, and $h$ the height of magnet. The higher order magnetic field appears upon $M$. The effective magnetic field or K can be evaluated in the Fourier transform of the field simulation in the Radia or in-situ measurement in magnet arrays.

Preset

Users can import and export the parameters as a preset (.dat) in Python version.

Non-linear effects

No emittance or energy spread are taken into account resulting in the single electron and Gaussian beam approximation. Further optimization including the end-magnet, phase error, and betatron function should be conducted in SPECTRA or SRW. Takashi Tanaka formulates the universal representation of phase errors.

Jui-Che Huang describes the average brilliance by using electron beam emittance ($\epsilon$), radiation emittance ($\epsilon_r = \lambda /4\pi$), radiation wavelength ($\lambda$), undulator length ($L$), betatron function ($\beta$), and $\zeta = 2\pi \beta/L$.

$$B_{r0} = {F_n \over 4 \pi^2 \sqrt{\epsilon^2_r + \epsilon^2_x + \epsilon_r \epsilon_x (\zeta_x + \zeta^{-1}_x)} \sqrt{\epsilon^2_r + \epsilon^2_y + \epsilon_r \epsilon_y (\zeta_y + \zeta^{-1}_y)}}$$

Here, $F_n$ is the flux over the central cone described above. The practical brilliance is also approximates as

$$B_r = f_{n,N} B_{r0}$$

$$f_{n,N} = 1 / \sqrt{1+ \left[ 5nN \left( \sigma_{\gamma} \over \gamma \right) \right]^2}$$

Here, $\sigma_{\gamma} / \gamma$ represents the energy spread.

Limitations

No warranty of U4Opt without errors. Python and Igor Pro work in the same manner, but Igor Pro runs faster than Python does. The data can be handled in Igor as a wave within the program and transformed in further analysis.

Setup

Python (tested in Windows and macOS)

Install Python3 and pip3 install numpy, scipy, PyQt5, matplotlib, and reliability.

pip3 install numpy
pip3 install scipy
pip3 install pyqt5
pip3 install matplotlib
pip3 install reliability

Download this repository and run the main.py under the Python folder.

python3 main.py

Igor Pro version 8 or 9 (tested in Windows and macOS)

Open the procedure file, then compile it. Undulator is available in the macro menu. Select the plot in the popup menu of U4Opt interface.

MPW and BM radiations

The flux of multi-pole wiggler (MPW) and bending magnet (BM) radiation can be added in Igor version. The flux of MPW is limited at the horizontal acceptance angle of 1 mrad. The magnet type and periodic length of MPW are equivalent to those used in the undulator. The magnetic field of BM is evaluated from the beam energy because the circumarence is roughly proportional to the beam energy (Lightsources2018.csv). The on-axis angular flux density of BM is caluclated in

$${\partial F \over \partial (\Delta \omega/\omega)}= 1.33 \cdot 10^{13} E^2 I \left( {\omega \over \omega_c} \right)^2 K^2_{2/3} \left( {\omega \over 2 \omega_c} \right)$$

and MPW generates its $2N$ times https://www.cockcroft.ac.uk/wp-content/uploads/2014/12/Lecture-1.pdf.

Usage

  • Setup the basic parameters like the energy, current, length, and harmonic number.
  • Choose the magnet type like PPM, hybrid, cryogenic, superconducting, and APPLE-II.
  • Setup the plot ranges like the period, K, gap, flux, and energy.
  • Adjust the period at the maximum K (minimum gap) in the variable or slider.

References

Basic principles

Magnet parameters

Interface

Python (adjustable period shown as a pink marker)

Python_u4opt.PNG

Igor Pro (2D plot can be either contour or image, not only energy but also flux, etc.)

IgorPro_undulator.PNG

Igor Pro (adjustable period shown as a cross hair)

IgorPro_undulator.PNG

About

Optimization of the undulator period in the K vs period with flux vs energy spaces.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published