computer programs\(\def\hfill{\hskip 5em}\def\hfil{\hskip 3em}\def\eqno#1{\hfil {#1}}\)

Journal logoJOURNAL OF
SYNCHROTRON
RADIATION
ISSN: 1600-5775

SIMPLEX: simulator and postprocessor for free-electron laser experiments

aRIKEN SPring-8 Center, Koto 1-1-1, Sayo, Hyogo 679-5148, Japan
*Correspondence e-mail: ztanaka@spring8.or.jp

(Received 21 May 2015; accepted 3 July 2015; online 5 August 2015)

SIMPLEX is a computer program developed for simulating the amplification process of free-electron lasers (FELs). It numerically solves the so-called FEL equations describing the evolution of the radiation field and growth of microbunching while the electron beam travels along the undulator. In order to reduce the numerical cost, the FEL equations have been reduced to more convenient forms for numerical implementation by applying reasonable approximations. SIMPLEX is equipped with a postprocessor to facilitate the retrieval of desired information from the simulation results, which is crucial for practical applications such as designing the beamline and analyzing the experimental results.

1. Introduction

In synchrotron radiation (SR) experiments, evaluating the light source performances is of great importance not only to design the beamline components but also to analyze the experimental data; several quasi-analytical formulas are available for roughly estimating the source performances of SR such as the brilliance and source size. If more detailed information is required for practical applications, numerical computations should be made to take into account all the relevant effects. This is not a trivial task for those who are not familiar with accelerator and SR physics, and thus a number of computer programs have been developed for this purpose (Walker & Diviacco, 1992[Walker, R. P. & Diviacco, B. (1992). Rev. Sci. Instrum. 63, 392-395.]; Chubar & Elleaume, 1998[Chubar, O. & Elleaume, P. (1998). Proceedings of the 6th European Particle Accelerator Conference (EPAC'98), pp. 1177-1179.]; Tanaka & Kitamura, 2001[Tanaka, T. & Kitamura, H. (2001). J. Synchrotron Rad. 8, 1221-1228.]). This also applies to free-electron lasers (FELs), and many computer programs have been made available (Tran & Wurtele, 1989[Tran, T. M. & Wurtele, J. S. (1989). Comput. Phys. Commun. 54, 263-272.]; Freund, 1995[Freund, H. P. (1995). Phys. Rev. E, 52, 5401-5415.]; Faatz et al., 1997[Faatz, B. et al. (1997). Nucl. Instrum. Methods Phys. Res. A, 393, 277-279.]; Saldin et al., 1999[Saldin, E. L., Schneidmiller, E. A. & Yurkov, M. V. (1999). Nucl. Instrum. Methods Phys. Res. A, 429, 233-237.]; Reiche, 1999[Reiche, S. (1999). Nucl. Instrum. Methods Phys. Res. A, 429, 243-248.]; Fawley, 2002[Fawley, W. M. (2002). Phys. Rev. ST-AB, 5, 070701.]) to compute the light source performances of FELs.

The computation of SR is a straightforward, albeit complicated, numerical process; characteristics of radiation emitted from a single electron are first evaluated (in practice, analytical formulas can be used for this purpose in most cases), which are then convoluted with the electron distribution function. As a result, any target information can be directly computed. On the other hand, the numerical characterization of FEL radiation is inherently different from that of SR, and requires two steps: simulating and postprocessing. To be specific, the laser amplification process is simulated first with the given conditions, and then the target item is retrieved by postprocessing the simulation results.

SIMPLEX, which stands for the SIMulator and Postprocessor for free-electron Laser EXperiments, is a computer program to facilitate the above numerical processes necessary for evaluating the light source performances of FELs. The purpose of this paper is to introduce its capability, basic functions and available options to experimental users of FELs, the number of which is supposed to be drastically increasing because of the recent results achieved in the X-ray FEL facilities (Emma et al., 2010[Emma, P. et al. (2010). Nat. Photon. 4, 641-647.]; Ishikawa et al., 2012[Ishikawa, T. et al. (2012). Nat. Photon. 6, 540-544.]; Allaria et al., 2012[Allaria, E. et al. (2012). Nat. Photon. 6, 699-704.]).

2. Numerical implementation of FEL equations in SIMPLEX

Before describing the details of SIMPLEX, let us review the basic physics behind it. In order to simulate the amplification process of FELs, we need to solve a set of equations that describe the evolution of the radiation field and motion of electrons, which are usually referred to as the FEL equations.

In solving the FEL equations, it is usually assumed that the envelope of the radiation field is a slowly varying function of the longitudinal coordinate z and time t, which is also the case in SIMPLEX. This makes it possible to neglect the second-order derivatives with respect to t and z, and thus significantly simplifies the equations and reduces the numerical cost.

Recently, a simulation code without this assumption has been developed (Campbell & McNeil, 2012[Campbell, L. T. & McNeil, B. W. (2012). Phys. Plasmas, 19, 093119.]) for special applications such as FELs taking advantage of electron beams that can violate the above condition, which are not the scope of SIMPLEX. Instead, we have derived mathematical formulas facilitating the numerical implementation of FEL processes with undulators having an arbitrary field distribution, which can apply to any harmonic numbers. This makes it possible not only to evaluate the effects of the undulator field errors on the FEL gain but also to describe the amplification process of FELs using exotic undulators as well as conventional ones.

In the following sections, a number of mathematical formulas for numerical implementation of FEL equations in SIMPLEX are presented. Note that the details of their derivations are skipped in this paper, and will be presented elsewhere.

2.1. Electron motion

The motion of electrons moving in an undulator along the longitudinal (= z) axis is described in the six-dimensional (6-D) phase space spanned by six coordinate variables: [{\bf{r}}_{\bot}], [{\boldbeta}_{\bot}], γ and ψ, where [{\bf{r}}_{\bot}] and [{\boldbeta}_{\bot}] are the transverse position and relative velocity, γ is the normalized energy, and ψ denotes the longitudinal position. In simulating the FEL process, all the coordinate variables are given by solving the relevant equations at discrete longitudinal positions zm = [m\Delta z], where m is an integer denoting the step number and [\Delta z] is the step interval usually given as an integer multiple of the undulator period [\lambda_{\rm{u}}].

Among the six variables, [{\bf{r}}_{\bot}] and [{\boldbeta}_{\bot}] are given by solving the equation of motion of electrons moving in the magnetic field of the undulator, and can be decomposed into three terms: betatron oscillation, fast wiggling motion and trajectory wander. The first term comes from the focusing magnets and can be computed by means of the transfer matrix representing the lattice function of the undulator beamline. The other two come from the undulator field including errors and can be computed once the undulator field distribution is given. Note that the former basically vanishes when averaged over the electron distribution, while the latter are common to all the electrons if normalized by [\gamma^{-1}].

The longitudinal position ψ satisfies the following equation,

[{{{\rm{d}}\psi}\over{{\rm{d}}z}}= {{2\pi}\over{\lambda_{\rm{u}}}}+{{\omega_1}\over{c}}\left(1-{{1}\over{\beta_{\bot}}}\right),\eqno(1)]

where c is the speed of light and [\omega_1] is the fundamental frequency of undulator radiation emitted from a reference electron with the average energy of [\gamma_0]. Note that ψ denotes the position relative to the reference electron in units of [\lambda_1/2\pi] = [c/\omega_1] and thus is usually referred to as the electron phase.

The remaining variable γ is given by solving the equation describing the energy gain or loss of each electron moving along the undulator axis and interacting with radiation. In order to solve this energy equation, we first expand the electric field of radiation, [{\bf{E}}], into a Fourier series with the fundamental frequency of [\omega_1], namely,

[{\bf{E}}({\bf{r}}_{\bot},z,t)= \sum\limits_{n\,=\,1}^{\infty}\tilde{{\bf{E}}}_n({\bf{r}}_{\bot},z,t) \exp\left[in\omega_1(z/c-t)\right]+{\rm{c.c.}},\eqno(2)]

where [\tilde{{\bf{E}}}_n] is the complex amplitude of the nth harmonic radiation, and is supposed to be a slowly varying function of z and t.

We then introduce a function [{\bf{F}}_n] given by

[\eqalign{ {\bf{F}}_n(z,\Delta z,{\boldtheta})= {}& {{1}\over{\Delta z}}\int\limits_{z}^{z\,+\,\Delta z} \left[{\boldbeta}_{\bot}(z')-{\boldtheta}\right] \cr& \times \exp\left({{i n\omega_1}\over{2\gamma_0^2c}}\int\limits_0^{z'} \left\{1+\left[{\boldbeta}_{\bot}(z'')-{\boldtheta}\right]^2\right\}\,{\rm{d}}z'' \right)\,{\rm{d}}z', }]

where n is an integer. It is worth noting that [{\bf{F}}_n(z,\Delta z,{\boldtheta})] is proportional to the field amplitude of the nth harmonic radiation emitted by a single electron to the observation angle [{\boldtheta}], while it travels from z to [z+\Delta z] (Kim, 1985[Kim, K. J. (1985). AIP Conf. Proc. 184, 565-631.]).

The electrons traveling along the undulator continuously exchange energy with radiation, which can be described by

[{{{\rm{d}}\gamma}\over{{\rm{d}}z}}= {{e}\over{mc^2}}\sum\limits_{n\,=\,1} \left[{\boldbeta}_{\bot}\cdot\tilde{{\bf{E}}}_n\exp\left(-ink_{\rm{u}}z\right)\exp\left(in\psi\right)+{\rm{c.c.}}\right],]

where e and m are the charge and rest mass of an electron, and ku = [2\pi/\lambda_{\rm{u}}]. Averaging over the step interval with taking into account equation (1)[link], we have

[{{{\rm{d}}\gamma}\over{{\rm{d}}z}} = {{e}\over{mc^2}} \sum\limits_{n\,=\,1} \left[{\bf{F}}_n^*(z,\Delta z,0)\cdot\tilde{{\bf{E}}}_n \exp\left(in\psi\right)+{\rm{c.c.}}\right].\eqno(3)]

The coordinate variables of all the electrons in the electron beam are given by solving the equations described above. In most circumstances, it is not numerically effective to simulate with the real number of electrons, and thus the beamlet method (Fawley, 2002[Fawley, W. M. (2002). Phys. Rev. ST-AB, 5, 070701.]) is taken also in SIMPLEX to model the shot noise of the electron beam, which is the source of the self-amplified spontaneous emission (SASE) process, with much fewer macroparticles than the real number of electrons.

2.2. Radiation field evolution

The evolution of the radiation field, i.e. how the radiation is amplified by the microbunched electron beam, can be described by the inhomogeneous wave equation derived from Maxwell's equations given as

[\nabla^2{\bf{E}}-{{1}\over{c^2}} {{\partial^2{\bf{E}}}\over{\partial t^2}} = \mu_0{{\partial{\bf{j}}}\over{\partial t}} + {{1}\over{\varepsilon_0}}\nabla\rho,]

where [{\bf{j}}] and ρ are the current and charge densities of the electron beam, [\mu_0] and [\varepsilon_0] are the permeability and permittivity of vacuum, and c is the speed of light.

Substituting (2)[link], neglecting the second-order derivatives with respect to t and z, multiplying [\exp[-in\omega_1(z/c-t)]] and averaging over the time duration [2\pi/\omega_1], the above wave equation reduces to

[\eqalignno{ \Bigg[\nabla_{\bot}^2+2i{{n\omega_1}\over{c}}&\left({{\partial}\over{\partial z}} + {{1}\over{c}} {{\partial}\over{\partial t}}\right)\Bigg]\, \tilde{{\bf{E}}}_n({\bf{r}}_{\bot},z,t) = \cr& -i\mu_0n\omega_1 I(z,t) \cr& \times \left\langle\left({\boldbeta}_{\bot j}+{{ic}\over{n\omega_1}}\nabla_{\bot}\right)\delta({\bf{r}}_{\bot}-{\bf{r}}_{\bot j})\exp\left(-in\psi_j\right)\right\rangle_{z,t} \cr& \times \exp\left(ink_{\rm{u}}z\right), &(4)}]

with

[\langle\, f_j \rangle_{z,t} = \sum\limits_{j\,=\,1}^{N(t)}f_j(z)]

meaning that the quantity f is averaged over the electron distribution, where the subscript j indicates the jth electron, N(t) is the number of electrons contained in the time interval for averaging, and I(z,t) is the beam current.

In order to solve the wave equation (4)[link], it is convenient to introduce a new independent variable s = [z-\bar{v}_{z0}t] instead of t, where [\bar{v}_{z0}] is the longitudinal velocity of the reference electron averaged over the undulator period. It is obvious that s refers to the relative distance with respect to the reference electron.

Let us assume that the transverse position ([{\bf{r}}_{\bot\, j}]) and phase ([\psi_j]) of individual electrons, and the spatial profile of [\tilde{{\bf{E}}}_n], are known at the longitudinal position z = z0. Then the radiation field at the longitudinal position z = [z_0+\Delta z] is given by a summation of two terms [\tilde{{\bf{E}}}_n^d] and [\tilde{{\bf{E}}}_n^g], i.e. [\tilde{{\bf{E}}}_n({\bf{r}}_{\bot},z_0+\Delta z,s)] = [\tilde{{\bf{E}}}_n^d+\tilde{{\bf{E}}}_n^g], where the argument t has been replaced with s as mentioned above.

The first term [\tilde{{\bf{E}}}_n^d] describes the diffraction of radiation, and is given by

[\tilde{{\bf{E}}}_n^d= {\cal{F}}_{{\!s}}^{\,-1} \left\{\exp[i\delta({\bf{k}})] \,\,{\cal{F}}_{\!{s}} \left[\tilde{{\bf{E}}}_n({\bf{r}}_{\bot},z_0,s-l)\right]\right\},\eqno(5)]

with

[\delta({\bf{k}})= {{c{\bf{k}}^2\Delta z}\over{2n\omega_1}},]

where l = [ck_{\rm{u}}\Delta z/\omega_1] corresponds to the slippage length of radiation while the electron travels the distance [\Delta z] in the undulator. The operator [{\cal{F}}_{\!{s}}] denotes the spatial Fourier transform with respect to [{\bf{r}}_{\bot}], and [{\bf{k}}] denotes the Fourier conjugate of [{\bf{r}}_{\bot}].

The second term [\tilde{{\bf{E}}}_n^g] describes the growth of the radiation field, and is given by

[\eqalignno{ \tilde{{\bf{E}}}^g_n = {}&-{{\mu_0 c\Delta z}\over{2}}\,\, I(z_0,s-l\,) \,\,{\cal{F}}_{\!{s}}^{\,-1}\Bigg\{\exp\left[i\delta({\bf{k}})\right] \cr& \times{\bf{F}}_n\left(z_0,\Delta z,{{c{\bf{k}}}\over{n\omega_1}}\right) \,{\cal{F}}_{\!{s}}\left[b_n({\bf{r}}_{\bot},z_0,s-l) \right]\Bigg\}, &(6)}]

with

[b_n({\bf{r}}_{\bot},z,s) = \left\langle\delta\left({\bf{r}}_{\bot}-{\bf{r}}_{\bot j}\right)\exp\left(-in\psi_j\right)\right\rangle_{z,s}\eqno(7)]

being the bunch factor density at the nth harmonic.

It should be noted that the function [{\bf{F}}_n] is specific to each electron because it depends on the transverse velocity [{\boldbeta}_{\bot}]. From a practical point of view, however, [{\boldbeta}_{\bot}] can be replaced with that of the reference electron and it is not necessary to compute [{\bf{F}}_n] for each electron. As a result, [{\bf{F}}_n] can be factored out of the averaging operation [\langle\ldots\rangle] as shown in equation (6)[link], which significantly reduces the numerical cost. This simplification also applies to the energy equation (3)[link]. In other words, [{\bf{F}}_n] can be computed in advance as a function of z and [{\boldtheta}] once the undulator field distribution is given.

The formulations given in equations (3)[link] and (6)[link], which are implemented in SIMPLEX, make it possible to perform FEL simulations with undulators having a periodic but arbitrary field distribution. Furthermore, it does not have to be completely periodic; the validity of the above equations may not be lost as long as it is roughly periodic so that the fundamental frequency can be defined.

2.3. Slicing and parallel computing

In order to simulate the FEL process with the scheme described above, the whole electron beam is divided into a number of slices with the length of slippage l along the longitudinal axis, and the bunch factor bn is computed for all the slices at each step zm. Then, the radiation field amplitude [\tilde{{\bf{E}}}_n^d] at the next step zm+1 is computed using equations (5)[link] and (6)[link] with the slippage effect taken into account. In addition, the six coordinate variables of each macroparticle are computed with the method described in §2.1[link].

It is obvious that the number of slices to cover the whole electron beam can be large, leading to a significant amount of time to complete a single simulation. SIMPLEX is equipped with a parallel-computing option based on the message passing interface (MPI) protocol for the purpose of reducing the computation time, in which a number of numerical processes run simultaneously in parallel to solve the FEL equations for several slices at each step.

3. Overview of the program

SIMPLEX is composed of two subprograms. One is the graphical user interface (GUI) for preprocessing the simulation conditions (§4[link]) and postprocessing the simulation results (§6[link]), which is built with wxWidgets (Smart et al., 2005[Smart, J., Hock, K. & Csomor, S. (2005). Cross-Platform GUI Programming with wxWidgets. New Jersey: Prentice Hall.]), the cross-platform GUI library and OpenGL (Shreiner et al., 2013[Shreiner, D., Sellers, G., Kessenich, J. & Licea-Kane, B. (2013). OpenGL Programming Guide: The Official Guide to Learning OpenGL, Version 4.3. Indiana: Addison-Wesley Professional.]), the 2-D and 3-D graphics library. The other is the numerical code to actually perform the FEL simulation, in which the numerical methods described in §2[link] are implemented. Both subprograms are written in the standard C++ language, and, thanks to the portability of wxWidgets and OpenGL libraries, SIMPLEX can be compiled on most of the operating systems. The current version (2.1) of SIMPLEX is distributed only in the binary format for Microsoft Windows, Mac OS X and a couple of LINUX distributions. Note that other LINUX distributions are not supported because of the diversity of the LINUX systems. Also note that the user is requested to arrange the MPI environment, i.e. install MS-MPI for Microsoft Windows or MPICH for other operating systems, in order to enable the parallel computing option.

A general procedure to perform FEL simulations and retrieve desired information from the simulation results is as follows. First, the user is requested to define the simulation conditions with the assistance of the preprocessor, which invokes the numerical code with the defined conditions. Then the numerical code starts to simulate the FEL process, and creates two ASCII files and several binary files upon completion. Note that the number of binary files depends on the simulation conditions.

The parameters and options specified in the simulation are stored in one of the two ASCII files, which will be used later for postprocessing (§6[link]). In another ASCII file, the summary of simulation results, i.e. several representative properties such as the pulse energy and bunch factor averaged over the whole electron beam, are stored as a function of the longitudinal position along the undulator axis.

The actual data of simulation results, i.e. six coordinate variables of individual macroparticles [({\bf{r}}_{\bot j},{\boldbeta}_{\bot j},\gamma_j,\psi_j)], and radiation field profiles [\tilde{{\bf{E}}}_n({\bf{r}}_{\bot},z,s)], are stored in the binary files. Once these files are ready, the user can retrieve information, such as the spectrum and temporal profiles of radiation, with the assistance of the postprocessor.

4. Preprocessing

Preprocessing, i.e. defining the numerical and boundary conditions, is an important step for any kind of simulations. In particular, FEL simulations require a huge number of input parameters and computation options to be specified by the user. Also note that the simulation results are so sensitive to some of the configurations that they should be carefully chosen or roughly optimized in advance.

SIMPLEX is equipped with a GUI as shown in Fig. 1[link] to assist the preprocessing, which loads the specified parameters and options, and approximately computes the quantities relevant to the FEL process under the given conditions, so that the user can check the validity of their conditions. For example, the Pierce parameter and 1-D gain length are computed with well known analytical formulas (Bonifacio et al., 1984[Bonifacio, R., Pellegrini, C. & Narducci, L. M. (1984). Opt. Commun. 50, 373-378.]), while the 3-D gain length, saturation length and saturation power are computed with empirical formulas (Xie, 2000[Xie, M. (2000). Nucl. Instrum. Methods Phys. Res. A, 445, 59-66.]). In addition, light source performances such as the source size, angular divergence, bandwidth, photon flux and brightness are roughly estimated based on the assumption that the FEL radiation is spatially coherent.

[Figure 1]
Figure 1
GUI as a preprocessor of SIMPLEX.

The parameters and options required for FEL simulations in SIMPLEX are categorized into three groups: specifications of the FEL system, options to evaluate the effect of various errors, and numerical and boundary conditions to carry out the simulation.

The first group specifies the core parameters of the FEL system, such as the electron beam, undulator, lattice function and seed light if necessary. In addition to standard Gaussian profiles, it is also possible to specify the electron beam by loading the 6-D macroparticle data, which may be probably generated by other programs. Note that SIMPLEX preprocessor offers a function to retrieve the relevant parameters such as the current, energy, slice emittance and slice energy spread as a function of the bunch position, which is useful to check as to whether the format of the input data file is valid. As for the undulator specifications, the device type as well as its standard parameters can be chosen from four possible options: linear, helical, elliptical and multi-harmonic undulators, where the latter denotes an exotic undulator containing multiple harmonic components with the fundamental period of [\lambda_{\rm{u}}].

The second group refers to a number of options to evaluate the effects of possible errors degrading the FEL gain, such as the field errors of the undulator including its misalignment, and the trajectory errors coming from the misaligned quadrupole magnets and beam position monitors.

The third group defines the numerical conditions, such as the step interval, numbers of macroparticles and beamlets, spatial range and grid points to evaluate the radiation field, and settings for the random number generator. Configurations for parallel computing and exporting the simulation results also need to be specified.

Besides the parameter input and option selection described above, the SIMPLEX preprocessor also offers a function to check the specified configurations graphically, i.e. to create a graphical plot that is relevant to specific configurations such as the phase error and trajectory wander to check the field error of the target undulator segment, betatron function along the undulator beamline to check the arrangement of the focusing magnets, and dispersion function in the presence of misaligned components to check the effects of the misalignment.

5. Options for single-pass FELs

SIMPLEX is equipped with a number of options and functions useful for simulating the single-pass FEL, the main FEL scheme currently available in short-wavelength regions, which are explained in the following sections.

5.1. Self-seeding

Self-seeding (Feldhaus et al., 1997[Feldhaus, J., Saldin, E. L., Schneider, J. R., Schneidmiller, E. A. & Yurkov, M. V. (1997). Opt. Commun. 140, 341-352.]) is one of the seeding schemes for short-wavelength FELs, in which the undulator is divided into two sections, and the SASE radiation generated in the first half is monochromated by a monochromator before entering the second half, and effectively works as a coherent seed light. SIMPLEX is equipped with two options necessary to simulate the self-seeding process: creating a magnetic chicane and inserting a monochromator.

5.1.1. Magnetic chicane

This is an option to replace one of the undulator segments with a magnetic chicane composed of four dipole magnets, which makes it possible to retard the electron beam with respect to the radiation. This option can be also used to simulate the pulse length measurement by means of the autocorrelation technique (Geloni et al., 2010[Geloni, G., Kocharyan, V. & Saldin, E. (2010). DESY Report 10-008. DESY, Hamburg, Germany.]) as well as the self-seeding.

5.1.2. Monochromator

This is an option to insert a monochromator in the magnetic chicane described above, in order to monochromate the SASE radiation generated in the first half. In addition to typical monochromator schemes (geometry and crystal) for self-seeding available in the X-ray region, including the forward Bragg diffraction (Geloni et al., 2011[Geloni, G., Kocharyan, V. & Saldin, E. (2011). J. Mod. Optics, 58, 1391-1403.]), the user can specify any monochromator by importing the numerical data to specify the complex reflectance (or transmittance) of the monochromator.

5.2. Redistributing the macroparticles

When the microbunched electron beam passes through a magnetic chicane having a large momentum compaction, the microbunch is usually washed out because the large energy modulation works to smear the density modulation. In FEL simulations based on the beamlet method like SIMPLEX, this phenomena cannot be accurately described because of the finite number of macroparticles and beamlets. This option tries to redistribute the macroparticles to reproduce the bunch factor after the chicane, based on analytical formulas.

5.3. Seeking the betatron matching condition

In the undulator beamline where a number of undulator segments are regularly spaced and focusing magnets are placed in between, the betatron function can be made to be periodic with small deviations, if the initial Twiss parameters are properly optimized, which is usually referred to as the betatron matching. This in turn means that the betatron function can diverge, or at least be modulated, if the betatron matching condition is not satisfied. The SIMPLEX preprocessor offers a function to compute the optimum values of the initial Twiss parameters for a given layout of focusing magnets, so that the user does not have to manually configure these parameters.

5.4. Evaluating the wakefield effects

The wakefield is an electromagnetic field induced by interaction between electrons and the surrounding environment, and gives rise to a correlated energy variation along the electron beam, which eventually leads to a FEL gain reduction. SIMPLEX is equipped with an option to compute the wakefield-induced energy variation while the electron beam travels along the undulator.

6. Postprocessing

After completing the simulations, the user can retrieve desired information from the files that store the simulation results. As mentioned before, the macroparticle distribution [({\bf{r}}_{\bot j},{\boldbeta}_{\bot j},\gamma_j,\psi_j)] and radiation field profile [\tilde{{\bf{E}}}_n] are stored in several binary files, which will be processed and visualized with the assistance of the postprocessor.

6.1. Radiation field

Retrieving the radiation field profile [\tilde{{\bf{E}}}_n({\bf{r}}_{\bot},z,s)] followed by a number of numerical operations gives important information on light source performances such as the radiation power and photon flux. SIMPLEX offers many functions to visualize these items in terms of temporal, spectral, spatial and angular profiles, which are given as a function of the step, slice and photon energy. This makes it possible to graphically investigate the amplification process in FELs, such as the evolution of radiation power, spectral narrowing and optical guiding. If the simulation is performed with undulators other than conventional ones (linear and helical undulators), the radiation field [\tilde{{\bf{E}}}_n] is computed as a vector but not as a scalar, and thus the Stokes parameters can be also retrieved for the purpose of investigating the polarization property of radiation.

In addition to the standard postprocessing methods described above, SIMPLEX offers an option to analyze the radiation properties based on the Wigner function method (Wigner, 1932[Wigner, W. (1932). Phys. Rev. 40, 749-759.]). To be specific, the photon density profile in the transverse phase space [({\bf{r}}_{\bot},{\boldtheta})] is computed using the definition of the Wigner function,

[\eqalign{ W({\bf{r}}_{\bot},{\boldtheta})\,\propto {}& \int \tilde{{\bf{E}}}_n\left({\bf{r}}_{\bot}+{{{\bf{r}}_{\bot}'}\over{2}}\right)\,\tilde{{\bf{E}}}_n\left({\bf{r}}_{\bot}-{{{\bf{r}}_{\bot}'}\over{2}}\right)_{\vphantom{\Big|}} \cr& \times\exp\left[in(\omega_1/c)\,{\boldtheta}\cdot{\bf{r}}_{\bot}'\right]\,{\rm{d}}{\bf{r}}_{\bot}', }]

where other arguments z and s are omitted for simplicity. Note that the above Wigner function is actually projected onto the horizontal or vertical phase spaces in SIMPLEX to facilitate visualization. The photon density profile in the longitudinal phase space [(\omega,t)] is also available using the similar definition.

It is worth mentioning that supplemental information can be computed once the above profiles are retrieved from the simulation results; for example, the beam size and angular divergence are computed from the spatial and angular profiles, the pulse length and bandwidth are computed from the temporal and spectral profiles, and the overall degree of spatial coherence (Bastiaans, 1986[Bastiaans, M. J. (1986). J. Opt. Soc. Am. A, 3, 1227-1238.]) is computed from the transverse Wigner function. SIMPLEX offers an option to show and/or save these numerical data if available.

6.2. Macroparticle

The most straightforward way to visualize the macroparticle distribution is to trace their motion in the phase space while the electron beam travels along the undulator. This enables one to investigate how the energy and density modulations are induced and how the microbunch evolves.

In addition to the above method, SIMPLEX offers two functions to process the macroparticle distribution. One is to retrieve the bunch factor [b_n({\bf{r}}_{\bot},z,s)] using equation (7)[link] and visualize its spatial and temporal profiles. The other is to compute the electron beam properties, such as the energy variation, energy spread and beam current at respective slices, and visualize their temporal profiles.

7. Examples

Now let us show several examples to introduce the capability and available functions of SIMPLEX as a computer program to evaluate the light source performances of FELs. Table 1[link] summarizes common parameters assumed in the examples, which correspond to those found by Ishikawa et al. (2012[Ishikawa, T. et al. (2012). Nat. Photon. 6, 540-544.]), reporting the first lasing of the SPring-8 Angstrom Compact Free-Electron Laser (SACLA). Note that the laser performance available in SACLA has been considerably improved since then, in terms of the pulse energy and gain length, suggesting that the actual beam parameters currently realised in SACLA are much better.

Table 1
Parameters assumed in the simulation example

  Value Unit
Electron beam parameter
 Electron energy 7.05 GeV
 Bunch length (r.m.s.) 2.5 µm
 Bunch charge 0.075 nC
 Normalized emittance 0.7 mm mrad
 Energy spread 10−4  
 Average betatron function 25 m
 
Undulator parameter
 Deflection parameter (K) 1.8  
 Period length 18 mm
 Segment length 5 m
 Drift length 1.15 m
 Number of segments 18  
 Fundamental photon energy 10 keV

7.1. Gain curves for different undulator configurations

One of the important features of SIMPLEX is the flexibility of acceptable undulator configurations. To be specific, undulators with an arbitrary field distribution are accepted thanks to the formulation of FEL equations presented in §2[link]. As an example, let us make a comparison between undulator types and investigate the effects due to undulator field errors in terms of the gain curve, i.e. the FEL pulse energy plotted as a function of the longitudinal coordinate z.

Fig. 2(a)[link] shows a comparison between three different undulator types: linear, elliptical and helical. Note that the effective deflection parameter defined by K = (Kx2+Ky2)1/2 has been kept constant for each case, where Kx,y are the deflection parameters corresponding to the horizontal and vertical field components, respectively, and Ky/Kx = 2 has been assumed for the elliptical undulator.

[Figure 2]
Figure 2
Gain curves for different undulator configurations. (a) Comparison between different undulator types. (b) Effects due to the undulator field error in terms of the phase error and trajectory wander.

It is well known that the FEL performance with the helical undulator is better than that with the linear undulator, in terms of the gain length and saturation power. Thus, the performance with the elliptical undulator is expected to be reasonably between the two undulator types according to Ky/Kx. The results shown in Fig. 2(a)[link] are actually consistent with the above discussion.

Fig. 2(b)[link] shows the effects due to the undulator field errors, in terms of the phase error [\sigma_{\varphi}] and trajectory wander [\sigma_{x,y}] in both directions. Note that the SIMPLEX preprocessor offers a function to generate undulator field errors to reproduce the values of [\sigma_{\varphi,x,y}] specified by the user. In this example, three different conditions have been examined: [(\sigma_{\varphi}], [\sigma_{x,y})] = (10°, 1 µm), (10°, 3 µm) and (30°, 1 µm). We find that the FEL performance is more sensitive to the increase in [\sigma_{\varphi}] than [\sigma_{x,y}] in this example. Note, however, that the above discussion may not be universal and depends on the parameters and conditions.

7.2. Temporal profiles of radiation power and bunch factor

The SIMPLEX postprocessor can visualize the simulation results as an animation by sweeping a relevant variable such as the step, slice or photon energy. One example is shown in Fig. 3[link], in which the temporal profiles of the radiation power and bunch factor computed by integrating over [{\bf{r}}_{\bot}] are plotted as a function of s at a longitudinal position of z = 60.3 m, where the pulse energy almost saturates. Note that this plot just shows a captured image of an animation illustrating the evolution of the temporal profiles while the electron travels along the undulator, which is created by sweeping the step number.

[Figure 3]
Figure 3
Temporal profiles of (a) radiation power and (b) bunch factor at the longitudinal position of z = 60.3 m.

7.3. Transverse Wigner functions

Analysis based on the Winger function is useful especially for investigating the transverse properties of FEL radiation. Fig. 4[link] shows the transverse Wigner function at z = 60.3 m, which is projected on the horizontal phase space [(x,x')] and averaged over the whole electron beam. We find that the photon beam is diverging and thus the source point is located slightly upstream. Also note that the overall degree of spatial coherence, which can be computed from the Wigner function, is indicated.

[Figure 4]
Figure 4
Transverse Wigner function averaged over all the slices and projected on [(x,x')] phase space at the longitudinal position of z = 60.3 m.

7.4. Self-seeding

The last example demonstrates the spectral improvement by means of the self-seeding scheme based on the forward Bragg diffraction. We have assumed that a magnetic chicane is installed in replacement of the ninth undulator segment, where a diamond monocrystal of thickness 0.18 mm is inserted with the (400) Bragg diffraction geometry. Fig. 5[link] shows a comparison of spectra with and without the self-seeding chicane, which well quantifies the spectral difference between the SASE and seeded FELs.

[Figure 5]
Figure 5
Comparison of spectra with (seeded) and without (SASE) the self-seeding chicane.

8. Summary

Besides those presented in this paper, SIMPLEX is equipped with many other functions and options to facilitate the FEL simulations with more practical conditions, such as loading the numerical data describing the temporal profiles of sliced beam parameters (current, mean energy, energy spread, etc.), and importing the undulator field distribution actually measured with a field measurement apparatus. For more specialized applications such as the HGHG (high-gain harmonic generation) FELs, the results of a previous simulation can be loaded to be recursively used in another simulation.

Benchmarking of SIMPLEX was carried out by comparison with GENESIS (Reiche, 1999[Reiche, S. (1999). Nucl. Instrum. Methods Phys. Res. A, 429, 243-248.]), one of the most acknowledged FEL simulation codes, in both the time-dependent and steady-state simulation modes. The agreement was found to be fairly good in terms of the gain length and saturation power.

SIMPLEX is freely available from the Web (Tanaka, 2015[Tanaka, T. (2015). SIMPLEX, http://radiant.harima.riken.go.jp/simplex/index.html.]). It should be emphasized that SIMPLEX does not require any other commercial software or libraries for preprocessing, simulating and postprocessing, except the MPI environment for parallel computing if necessary, which is also available online freely.

References

First citationAllaria, E. et al. (2012). Nat. Photon. 6, 699–704.  Web of Science CrossRef CAS Google Scholar
First citationBastiaans, M. J. (1986). J. Opt. Soc. Am. A, 3, 1227–1238.  CrossRef Google Scholar
First citationBonifacio, R., Pellegrini, C. & Narducci, L. M. (1984). Opt. Commun. 50, 373–378.  CrossRef CAS Web of Science Google Scholar
First citationCampbell, L. T. & McNeil, B. W. (2012). Phys. Plasmas, 19, 093119.  CrossRef Google Scholar
First citationChubar, O. & Elleaume, P. (1998). Proceedings of the 6th European Particle Accelerator Conference (EPAC'98), pp. 1177–1179.  Google Scholar
First citationEmma, P. et al. (2010). Nat. Photon. 4, 641–647.  Web of Science CrossRef CAS Google Scholar
First citationFaatz, B. et al. (1997). Nucl. Instrum. Methods Phys. Res. A, 393, 277–279.  CrossRef CAS Google Scholar
First citationFawley, W. M. (2002). Phys. Rev. ST-AB, 5, 070701.  Google Scholar
First citationFeldhaus, J., Saldin, E. L., Schneider, J. R., Schneidmiller, E. A. & Yurkov, M. V. (1997). Opt. Commun. 140, 341–352.  CrossRef CAS Web of Science Google Scholar
First citationFreund, H. P. (1995). Phys. Rev. E, 52, 5401–5415.  CrossRef CAS Google Scholar
First citationGeloni, G., Kocharyan, V. & Saldin, E. (2010). DESY Report 10-008. DESY, Hamburg, Germany.  Google Scholar
First citationGeloni, G., Kocharyan, V. & Saldin, E. (2011). J. Mod. Optics, 58, 1391–1403.  CrossRef Google Scholar
First citationIshikawa, T. et al. (2012). Nat. Photon. 6, 540–544.  Web of Science CrossRef CAS Google Scholar
First citationKim, K. J. (1985). AIP Conf. Proc. 184, 565–631.  CrossRef Google Scholar
First citationReiche, S. (1999). Nucl. Instrum. Methods Phys. Res. A, 429, 243–248.  Web of Science CrossRef CAS Google Scholar
First citationSaldin, E. L., Schneidmiller, E. A. & Yurkov, M. V. (1999). Nucl. Instrum. Methods Phys. Res. A, 429, 233–237.  CrossRef CAS Google Scholar
First citationShreiner, D., Sellers, G., Kessenich, J. & Licea-Kane, B. (2013). OpenGL Programming Guide: The Official Guide to Learning OpenGL, Version 4.3. Indiana: Addison-Wesley Professional.  Google Scholar
First citationSmart, J., Hock, K. & Csomor, S. (2005). Cross-Platform GUI Programming with wxWidgets. New Jersey: Prentice Hall.  Google Scholar
First citationTanaka, T. (2015). SIMPLEX, http://radiant.harima.riken.go.jp/simplex/index.htmlGoogle Scholar
First citationTanaka, T. & Kitamura, H. (2001). J. Synchrotron Rad. 8, 1221–1228.  Web of Science CrossRef CAS IUCr Journals Google Scholar
First citationTran, T. M. & Wurtele, J. S. (1989). Comput. Phys. Commun. 54, 263–272.  CrossRef CAS Web of Science Google Scholar
First citationWalker, R. P. & Diviacco, B. (1992). Rev. Sci. Instrum. 63, 392–395.  CrossRef Web of Science Google Scholar
First citationWigner, W. (1932). Phys. Rev. 40, 749–759.  CrossRef CAS Google Scholar
First citationXie, M. (2000). Nucl. Instrum. Methods Phys. Res. A, 445, 59–66.  CrossRef CAS Google Scholar

This is an open-access article distributed under the terms of the Creative Commons Attribution (CC-BY) Licence, which permits unrestricted use, distribution, and reproduction in any medium, provided the original authors and source are cited.

Journal logoJOURNAL OF
SYNCHROTRON
RADIATION
ISSN: 1600-5775
Follow J. Synchrotron Rad.
Sign up for e-alerts
Follow J. Synchrotron Rad. on Twitter
Follow us on facebook
Sign up for RSS feeds