Spontaneous and Stimulated Undulator Radiation in Symmetric and Asymmetric Multi-Periodic Magnetic Fields

: In this work, the radiation from electrons in multi-periodic undulator ﬁelds with symmetric and asymmetric harmonics was analyzed using generalized Bessel functions formalism. The asymmetric, symmetric, and anti-symmetric periodic magnetic ﬁelds with harmonics were studied in order to get the enhanced radiation of the high harmonics of undulator radiation (UR). The effect on the spontaneous and stimulated UR was explored. The exact integral forms for the Bessel coefﬁcients were obtained for undulators with general symmetric and asymmetric ﬁeld harmonics. Spectral properties of the radiation from several conﬁgurations of the undulator ﬁelds with harmonics were compared with each other. The resulting spontaneous UR spectrum and harmonic intensities were obtained analytically in the form of integrals and compared with the respective results that were obtained numerically with SPECTRA program. The dimensionless scaling parameter of a free electron laser (FEL)—the Pierce parameter ( ρ )—was computed and compared for the different considered undulators. We studied the differences in the behavior of the high-gain single pass FEL harmonics and the spontaneous UR harmonics in the same undulators. The undulators with variable deﬂection parameter ( k ) were considered. The effect of the k parameter (deﬂection parameter for a common planar undulator) on the spontaneous UR and on the high-gain FEL radiation was explored. In this context, an experiment with variable strength undulators at FLASH 2 FEL was analyzed; the shorter saturated length in high harmonic self-seeding (HHSS) regime vs. self-ampliﬁed spontaneous emission (SASE) is explained.


Introduction
The synchrotron radiation (SR) from electrons was predicted and discovered in the middle of the 20th century [1]. It was followed by the prediction [2] of undulator radiation (UR), which is in fact the SR from relativistic charges in a spatially periodic magnetic field. Both SR and UR are incoherent. Motz built an undulator where UR was produced [3] and, by developing the ideas of Ginzburg, theoretically demonstrated that electrons, grouped in microbunches, can radiate coherently [4]. The coherent radiation is generated in undulators of free electron lasers (FELs) upon the interaction of the radiation with electrons. A theory of interaction between the radiation and the electrons in undulators was developed by Madey [5]. In an FEL, the Lorenz force of the wave field pushes towards the nods of the electromagnetic wave electrons, which are behind or ahead of the nods; in this way, the FEL forms microbunches, separated by the wavelength of the radiation. Moreover, the radiation of the fundamental frequency in an FEL also induces microbunching at the wavelength of the harmonics of the fundamental frequency, although to weaker extent. The emission and gain of FEL harmonics were first calculated in [6,7]. The radiation from microbunches is largely coherent, as already suggested by Ginzburg in 1947 [2]. At the present stage of development of radiation sources, FELs have extended to hard X-ray bands; their radiation bursts have ultra-short femtosecond lengths. Interest in theoretical studies of SR and UR is largely determined by their applications in FELs [8][9][10][11] and their improvements. In fact, Symmetry 2021, 13, 135 3 of 19 the differential density of the radiated photons dN p or the radiated power dP per unit of surface dS in a relative spectral interval dω/ω through the following convolution [46]: where ω 1 is the fundamental UR frequency and N is the number of undulator periods; where Φ = d 2 N p∞ dSdω/ω is the flux density for an infinite number of periods, which reads as follows [46]: (3) where λ u is the undulator period, ϕ is the polar angle and [46] ρ k (ω) = Z 4πγ 2 ck ωλ u − (γβ where σ x and σ y are the horizontal and vertical beam sizes, respectively; γ is the Lorentz factor; c is the speed of light; α ∼ = 1/137 is the fine structure constant; → r = (X, Y, Z); and → r = (x, y, z). The effect of the energy spread and finite beam emittance is described as a beam envelope at the position of observation. Both horizontal and vertical beam envelopes are calculated in SPECTRA; the emittance is taken into account by a convolution of the single electron radiation with a two-dimensional electron distribution function. The energy spread of the electrons in the beam causes spectral broadening. This is accounted for by a convolution with a Gaussian distribution with an root mean square width 2 ωσ ε /E, where ω is the photon energy, E is the electron energy, and σ ε is the spread. The usual approximation for the radiation studies is the far zone, where |Z − z| |X − x|, |Y − y| and the distance between the electron and the observer is much longer than the undulator size; although it is possible to include near zone in the SPECTRA calculations, this noticeably slows down the process. We use the far zone approximation in what follows.
Integration over the frequencies ω' in Equation (1) reduces to the convolution with the typical for the UR studies function S N , which allows for a fast Fourier transform algorithm for the convolution. In SPECTRA code, fast oscillating integrands occur, and they must be computed many times for precision. To help with this task, the whole region of integration over the time of the electron motion in the undulator is divided into several sections, within which the functions are approximated by third order polynomials. If the function g(t) can be approximated by an n-th order polynomial in the region of integration, then its n-th derivative Accounting for d n g/dt n = const, the first term in Equation (6) becomes dt n e iωt 1 − e iωt 2 , where t ∈ [t 1 , t 2 ] is a small interval of time, during which g(t) is well approximated by the third order polynomial. The derivatives up to the third order are determined in SPECTRA by a cubic-spline interpolation method [50]. Thus, the whole integration domain, [t 1 , t m+1 ], consists of m such small intervals of time (see [46]); the integration in G effectively reduces to the summation: where g (k) is the k-th order derivative of g(x).
The above scheme provides fast and accurate numerical results. For the precise integration with finite emittance, the radial and azimuthal integration should be performed; the former is reduced to an energy convolution in SPECTRA. In an energy region of the spectrum where high harmonics dominate, the convolution with the S N of Equation (2) has little effect on the shape of the spectrum. In this case, SPECTRA omits the convolution and saves time without sacrificing accuracy. For our calculations, we used the "Energy Dependence → Angular Flux Density" option, where the above-described integrals were computed. For further details and options of SPECTRA, see [46].

Bessel Factors for UR Harmonics in Multiperiodic Magnetic Fields
The simplest though quite good approximation of the periodic magnetic field in a planar undulator is by the pure sinusoidal function: H = H 0 sin(k λ z), k λ = 2π/λ u , where H 0 is the amplitude of the magnetic field on the undulator axis, directed along z. The above model, complemented by the hyperbolic trigonometric functions (see [51,52]), H y = H 0 sin(k λ z) cosh(k λ y) and H z = H 0 cos(k λ z)sinh(k λ y), describes the magnetic field in the whole gap between the undulator magnets and satisfies Maxwell equations. The off-axis position of electrons in a finite size beam causes betatron oscillations, the split of the radiation lines, and even UR harmonics on the undulator axis. The even UR harmonics also appear due to the off-axis angles, in which the radiation is viewed in the whole section of the beam, and due to the distortions induced by non-periodic magnetic fields. The above-mentioned effects are known; they have recently been readdressed in the context of multi-harmonic undulators in [52][53][54][55][56][57][58][59][60]. Here, we focused on the effect of the field harmonics on the spontaneous UR and high-gain FEL radiation; we analyzed the radiation harmonic intensities and their Bessel factors. The latter determine the universal scaling FEL parameter, the so-called Pierce parameter [15,16]: where λ u is the main undulator period (m), J [A/m 2 ] is the current density, γ is the relativistic factor, i ∼ = 1.7045 × 10 4 is the Alfven current constant (A) , k e f f is the effective undulator parameter that reduces to k = H 0 λ u;x e/2πm e c 2∼ = λ u [cm]H 0 [kG]/10.7 in common planar undulators, and f n is the Bessel factor for the n-th UR harmonic. The increase of the Pierce parameter, defined by Equation (8), shortens the FEL gain length, L n,g ∼ = λ u / 4π √ 3n 1/3 ρ n , the saturation length, and the FEL itself. When the fundamen- tal frequency of a FEL saturates, higher harmonics growth terminates, thus reaching its saturated powers (see, for example, [28,29]): where P e is the power of the electron beam. Higher values of the Pierce parameter ρ yield stronger amplification of harmonics and less strict requirements to the energy spread in an FEL. To maximize ρ for a given electron current and energy, the value of κ n in Equation (8) can be increased by using special undulators with possibly large Bessel factors f n , or by making an undulator with long period λ u and large deflection parameter k. However, the higher the values of λ u and k, the longer the UR harmonic resonance wavelength becomes: where k is the deflection parameter for a common planar undulator and the factor > 1 if there are field harmonics (see (13)). The increase of the radiation wavelength can be compensated for by the increase of the relativistic factor γ, but this, in turn, reduces the Pierce parameter of Equation (8) and yields longer gain and saturation. It follows that in any case, it is favorable to have high values of the harmonic Bessel coefficients (f n ) for high harmonic powers and their fast growth. Moreover, use of UR harmonics allows for lower electron energy than that needed for the fundamental frequency at the same wavelength. This is particularly important for the X-ray band, where all installation parameters are at their extreme values. The n-th harmonic of spontaneous UR from an undulator with N main periods has the following intensity: where S N (x) = (sincπNx) 2 (see Equation (2)), ν n = ν n /2πN = n((ω/ω n ) − 1) is the detuning parameter off UR resonances ω n = 2πc/λ n , k 2 e f f = k 2 , and f n;x,y comprises the Bessel factors for xand y-polarizations of the harmonic n. They depend on the undulator magnetic field and deflection parameter k; f n;x,y is given for each considered field configuration in the following sections. Note that a comparison of the intensity of the radiation of different harmonics from different undulators for the same undulator length L = Nλ u requires renormalization that accounts for different k values. Indeed, 1,e f f /2 2 (see Equation (11)), and the ratio of the intensity of the harmonic n of one undulator to the intensity of the harmonic m of another undulator for the same undulator length is where f 1,n and f 2,m are, respectively, the Bessel factors for the n-th harmonic of the first undulator and for the m-th harmonic of the second undulator with their respective deflection parameters k 1,2 , k 2 i,e f f = k i 2 .
In modern installations, the electron beam energy spread is usually low, and it is analytically accounted for by taking the convolution Numerical calculations account for all beam properties; we verified our results with numerical calculations for real installations with given undulators and electron beams using the SPECTRA program [46,47], and we provide a comparison of the analytical and numerical results in every case. Moreover, we studied the effect of the field harmonics on the FEL radiation via the Pierce parameter (ρ) of Equation (8) and κ, and we studied the differences in the harmonic behavior for the spontaneous and stimulated UR.

Radiation from Elliptic and Planar Undulators with Field Harmonics
The Bessel factors for many bi-harmonic undulators with a single harmonic along each coordinate were reported in [21,24,28,29,32]. They represented particular cases of Formulae (14) and (21) with the Bessel functions that accordingly arise from Formulae (15) and (20) in the proper limiting cases. Next, we consider the UR harmonic intensities from a number of undulator fields and discuss them, paying attention to the symmetry features of these fields.
We first considered the following simple elliptic bi-harmonic undulator field: For certainty, we chose the third field harmonic h = 3 with an amplitude d = 1. A weak harmonic of a magnetic field will be less effective and a stronger harmonic cannot be realized if the main harmonic of the field is close to its maximum strength. In Table 1 and Figure 1, we report the beam and undulator properties and UR harmonic intensities from the undulator with the field 133 Note that in Tables 1 and 2, the values of the deflection parameter are reported from SPECTRA code: k accounts only for the main field harmonic along x-coordinates; k E f fx and k E f fy account for the effective deflection along xand y-coordinates, respectively; and k 2 e f f = k 2 = k 2 E f fx + k 2 E f fy . We used in SPECTRA proper values of d, d 1 , d 2 , h, l, and p, dependently on the considered undulator.
There was very good agreement between the analytical results, obtained straight from the fundamental concept of radiation and averaged over the electron energies of the beam, and the numerical results; for certainty, we assumed a beam energy E = 150 MeV and an undulator with the period λ u = 2.8 cm and k = 2.133. It is worth remembering that the relative spectral distribution of UR is determined by the undulator and not by the beam, which is different from SR, where the electron energies determine the harmonic ratios and the overall spectrum shape. The small beam emittance (see Table 1) mainly affected the even harmonics. The third y-field harmonic in Equation (23) determined the x-polarization of the radiation in Figure 1; there, the fundamental frequency was absent, and the total and relative radiation powers for the third harmonic at the wavelength λ 3 = 183 nm were thus increased. The Bessel factors are f y;n = 1,3,5 ≈ {0.81, 0.33, 0.15} and f x;n=1,3,5 ≈ {0.06, 0.25, 0.18}.
For h = 1 in Equation (22), we evidently got a kind of a planar undulator, viewed in an angle around the axis, so that its deflection parameter was k e f f = k The UR resonances and other properties changed accordingly. Table 2. Parameters of the undulator and the beam for the field of Equation (26) of the helical undulator [53].

Accelerator
Light Source There was very good agreement between the analytical results, obtained straight from the fundamental concept of radiation and averaged over the electron energies of the beam, and the numerical results; for certainty, we assumed a beam energy E = 150 MeV and an undulator with the period λu = 2.8 cm and k = 2.133. It is worth remembering that the relative spectral distribution of UR is determined by the undulator and not by the beam, which is different from SR, where the electron energies determine the harmonic ratios and the overall spectrum shape. The small beam emittance (see Error! Reference source not found.) mainly affected the even harmonics. The third y-field harmonic in Equation Error! Reference source not found. determined the x-polarization of the radiation in Error! Reference source not found.; there, the fundamental frequency was absent, and the total and relative radiation powers for the third harmonic at the wavelength λ3 = 183 nm were thus increased. The Bessel factors are fy;n = 1,3,5 ≈ {0.81, 0.33, 0.15} and fx;n=1,3,5 ≈ {0.06, 0.25, 0.18}.
For h = 1 in Equation Error! Reference source not found., we evidently got a kind of a planar undulator, viewed in an angle around the axis, so that its deflection parameter The UR resonances and other properties changed accordingly.  Consider the following undulator field with the phase-shifted sine-cosine configuration: For the same electron beam, undulator strength, and period as reported in Table 1, we got the radiation spectrum shown in Figure 2. Note that higher harmonics with n = 5,7, . . . , were stronger than those from the field of Equation (23) in Figure 1.   The enhanced radiation of higher UR harmonic from the undulators with the fields of Equations (23) and (24) was due to the additional x-polarization, where the third and fifth harmonics dominated (see Figures 1 and 2). However, one may wonder if it would be worth making an asymmetric elliptic undulator with the fields of Equations (23) and (24), with a short period along one coordinate and longer period along another coordinate. To answer this question, we considered a planar undulator with the same amplitude of the magnetic field H 0 and the only period λ u /3, in contrast with the bi-harmonic undulator with two periods λ u and λ u /3 in Equations (23) and (24). The considered undulator field read as follows: An undulator with the magnetic field of Equation (25) had a three-times-smaller parameter k than the k of the undulators with the fields of Equation (23) and (24); the radiation wavelength (Equation (10)) was much shorter for the field of Equation (25) than for the fields of Equations (23) and (24). Here, we do not discuss a technical possibility to reduce the period by the factor of three for the same field strength; we assumed that the undulator with the short-period field of Equation (25) could be built, and a longperiod undulator (fields of Equations (23) and (24)) could thus be built too. We compared the radiation from the undulator with field of Equation (25) with that with the fields of Equations (23) and (24) in Figures 1 and 2 for the same beam (see Table 1). In this way, we checked whether the additional line of long-period magnets could enhance harmonic radiation compared with the field of Equation (25). Note that since the field strengths and the undulator periods were different in the fields of Equations (25), (23), and (24), we got different values of λ n (Equation (10)), and the comparison could not be done at the same identical wavelengths. Moreover, the shape of the UR spectrum was determined by the effective deflection parameters k; since k was different for Equation (25) from that for Equations (23) and (24), we got different overall spectrum shapes. Thus, we could only estimate, for example, the radiation intensity for the seventh harmonic of the undulator with the field of Equation (24) and compare it with that of the fundamental frequency of the undulator with the field of Equations (25) for some given field amplitude and undulator length.
For certainty, we assumed the data in Table 1. The undulator field of Equation (25) had the period λ u;2 = λ u /3 = 0.933 cm; the k parameter was k 2 = k 1 /3 = 0.711. For the same total length L = 2.1 m (see Table 1), the undulator with the field of Equation (25) had 225 periods. For the electron energy E = 153 MeV (see Table 1), the fundamental wavelength in the magnetic field of Equation (24) Table 1), we computed and show in Figure 3 the spectrum of the UR in the field of Equation (25).  Our numerical and analytical results agreed with each other very well in all cases (see Error! Reference source not found.-Error! Reference source not found.). The agreement was also very good for the even harmonics, as seen in Error! Reference source not found. andError! Reference source not found.. This confirmed the correctness of the account for the off-axis effects in our analytical model. The analytical results for the Bessel factors could be successfully used in the FEL analytical model. Now, let us consider the FEL radiation; for a given electron energy and current A comparison of the intensity of the fundamental tone λ 1 ≈ 65 nm of the planar undulator of Equation (25) (see Figure 3) with that of the ninth harmonic λ 9 ≈ 61 nm of the elliptic undulator of Equation (24) (see Figure 2) showed that the fundamental frequency of the planar undulator of Equation (25) was stronger than the ninth harmonic of the elliptic undulator of Equation (24). The difference was roughly one order of magnitude (compare the height of the red bar in Figure 3 with that of magenta bars in Figure 2); the ratio was higher for the harmonics, radiated in the pure sinusoidal symmetric field of Equation (23).
Our numerical and analytical results agreed with each other very well in all cases (see Figures 1-3). The agreement was also very good for the even harmonics, as seen in Figures 1 and 2. This confirmed the correctness of the account for the off-axis effects in our . For the seventh and ninth UR harmonics of the asymmetric elliptic undulator of Equation (24), we got κ elliptic n=7,9 = {0.042, 0.031}, respectively, for λ 7 = 78 nm and λ 9 = 61 nm, while for the fundamental tone of the planar undulator of Equation (25) at λ = 65 nm, we got κ planar n=1 = 0.034. These values were comparable with each other, and thus we conclude that the fundamental frequency of the planar undulator with the field of Equation (25) was amplified in an FEL approximately as well as the harmonics at close wavelengths of~60-80 nm in the elliptic undulator with the field of Equation (24). We only considered the independent amplification of the harmonics and omitted the nonlinear term induced by the fundamental frequency of the elliptic undulator of Equation (24).
The following anti-symmetric third field harmonic was observed in a helical undulator [53]: where h = 3, λ u = 2.3 cm, and k = 2.216. The amplitude of the third field harmonic was small: d = 0.0825. An experiment KAERI [53] was conducted with low energy electrons with E = 6.5 MeV. The radiation wavelength of the fundamental tone was λ = 0.42 mm. The data of the accelerator and the light source are collected in Table 2. The harmonic intensities for the UR in the field of Equation (26) were reported in [53]; the fifth UR harmonic content on the undulator axis was ≈2% on the background of noise and second harmonic in the asymmetric wide beam. Our numerical calculations with the SPECTRA code had good agreement with the data in [53], especially for odd harmonics both on and off the axis (see Figure 4); we got some weaker even harmonics and a clearer picture with less noise and less split UR lines than in [53]; the analytical results looked similar and are omitted for conciseness.
where h = 3, λu = 2.3 cm, and k = 2.216. The amplitude of the third field harmonic was small: d = 0.0825. An experiment KAERI Error! Reference source not found. was conducted with low energy electrons with E = 6.5 MeV. The radiation wavelength of the fundamental tone was λ = 0.42 mm. The data of the accelerator and the light source are collected in Error! Reference source not found.. The harmonic intensities for the UR in the field of Equation Error! Reference source not found. were reported in Error! Reference source not found.; the fifth UR harmonic content on the undulator axis was ≈2% on the background of noise and second harmonic in the asymmetric wide beam. Our numerical calculations with the SPECTRA code had good agreement with the data in Error! Reference source not found., especially for odd harmonics both on and off the axis (see Error! Reference source not found.); we got some weaker even harmonics and a clearer picture with less noise and less split UR lines than in Error! Reference source not found.; the analytical results looked similar and are omitted for conciseness. In the angle 2° off the undulator axis, we saw very strong second and third harmonics with ~9% content (see blue line in Error! Reference source not found.); the fifth harmonic, visible on the axis with 2% content (see red line in Error! Reference source not found.), vanished in the angle 2° off the axis. In the angle 4° off the axis (see green line in Error! Reference source not found.), the spectrum was wide and consisted of the first six strong harmonics, as well as higher harmonics.
The Bessel functions for the UR in the field of Equation Error! Reference source not found. were reported in Error! Reference source not found. (see also Error! Reference source not found.). The spectrum of the UR in the helical field of Equation Error! Reference source not found. with a field harmonic expectantly had dominant fundamental In the angle 2 • off the undulator axis, we saw very strong second and third harmonics with~9% content (see blue line in Figure 4); the fifth harmonic, visible on the axis with 2% content (see red line in Figure 4), vanished in the angle 2 • off the axis. In the angle 4 • off the axis (see green line in Figure 4), the spectrum was wide and consisted of the first six strong harmonics, as well as higher harmonics.
The Bessel functions for the UR in the field of Equation (26) were reported in [61] (see also [21,54]). The spectrum of the UR in the helical field of Equation (26) with a field harmonic expectantly had dominant fundamental tone; its photon energy ≈0.003 eV corresponded the reported wavelength λ = 0.42 mm in [53]. Interestingly, the second strongest harmonic on the axis was the fifths; it was stronger than the third UR harmonic. We computed the harmonic radiation both analytically and numerically with SPECTRA; the results, shown in Figure 5, demonstrated nearly perfect agreement and confirmed the 2% content of the fifth harmonic radiation for d = 0.0825 in Equation (26). The strong third field harmonic in Equation (26) with the amplitude d = 0.3 yielded a higher content for the fifth UR harmonic: ≈20%; the third UR harmonic remained weak (see Figure 5). Note that due to multiple field components in the undulator field of Equation (26), the radiation wavelength of Equation (10) was much longer than that from a planar undulator with the same k and the same field harmonic along one coordinate. Moreover, the wavelength of the fifth UR harmonic, radiated in the undulator field of Equation (26), equaled that of the third UR harmonic, radiated in the planar magnetic field with only x-(or y-) components of Equation (26).   (26), we got for the undulator field of Equation (26) and the FEL harmonics with n = 1 and n = 5: κ KAERI n=1,5 = { 0.173, 0.037}. The possible performance of an FEL with such helical undulator with the anti-symmetric third field harmonic of Equation (26) was explored analytically in [21,54] and numerically in [61]. For d = 0.3 in Equation (26), the power evolution of the fifth FEL harmonic mainly developed in the nonlinear regime induced by the fundamental frequency towards the end of the FEL; its saturated power was marginally above the initial shot noise. Thus, it was hard to exploit it. The behavior of the spontaneous and stimulated SASE FEL radiation in the case of even stronger third field harmonic with the amplitude d = 1 in Equation (26) was explored in [62]. The fifth and third harmonics of the SASE FEL had roughly equal saturated powers,~0.1% of the fundamental frequency. However, for d = 1 in Equation (26), the terms H 0 (sin(k λ z), cos(k λ z), 0) did not help the harmonic radiation compared with that in the field → H = H 0 (sin(3k λ z), cos(3k λ z), 0), but they radically decreased the radiation frequency, thus annihilating any advantage that the third field harmonic could have given. Thus, the antisymmetric helical undulator field of Equation (26) was inadequate for FEL harmonic generation.
Let us now consider a planar undulator with the following symmetric third field harmonic: The UR spectrum can be regulated to some extent by the third field harmonic [44,45]. We assumed a reasonably strong third field harmonic, h = 3, with an amplitude ±0.3H 0 in Equation (27) and other parameters of the undulator and the beam from Table 1. Then, dependently on the field harmonic phase, h = ±3, we got the results shown in Figure 6. Note that for d = +0.3, the third UR harmonic was enhanced, and for d = −0.3, it was weakened compared with the radiation from a common planar undulator, where d = 0. Evidently, d = +0.3 in Equation (27) enhanced the radiation of the third UR harmonic; the latter had y-polarization. A comparison of the spectrum of the planar undulator with the field of Equation (27) with the spectrum of the elliptic undulator with the field of Equation (26) showed that the third UR harmonic in Equation (27) had approximately the same wavelength as the fifth UR harmonic in Equation (26). However, the third UR harmonic, emitted in the planar field of Equation (27) (see green bars in Figure 6) was much stronger than the fifth UR harmonic emitted in the elliptic field of Equation (26) (see blue bar in Figure 5) for the same amplitude d of the field harmonic.

Harmonic Radiation in Undulators with Variable k Parameter
At some FEL facilities, undulators with variable deflection parameters are used, e.g., FLASH 2, European FEL, SACLA FEL, and SwissFEL. At the FLASH 2 facility Error! Reference source not found., the electron energies are in the range of E = 0.45-1.2 GeV, the absolute energy spread is 0.5 MeV, the electron current is I0 < 2.5 kA, the emittances are εx,y = 1.4 μm × rad, and the Twiss parameters are βx,y = 6 m. The undulator period is λu  = { 0.129, 0.074} for the harmonics n = 1 and n = 3, respectively. Note that in the field of Equation (27), we got for the third UR harmonic twice the value of κ as that for the fifth UR harmonic in the field of Equation (26): κ planar bi−harmonic n=3 = 0.074 ≈ 2 × κ KAERI n=5 = 2 × 0.037; this was for the same radiation wavelength and field amplitude d = 0.3. This strongly showed the advantages of the symmetric planar field of Equation (27) vs. the field of Equation (26).
Thus, the simpler planar undulator with the field of Equation (27) is preferable to the elliptic undulator with the field of Equation (26), which is more complicated and does not give a high enough harmonic intensity. Further discussion of the effect of sign of d and k in Equation (27) on the Bessel factors f n can be found, for example, in [28,31,32,34,40].

Harmonic Radiation in Undulators with Variable k Parameter
At some FEL facilities, undulators with variable deflection parameters are used, e.g., FLASH 2, European FEL, SACLA FEL, and SwissFEL. At the FLASH 2 facility [63,64], the electron energies are in the range of E = 0.45-1.2 GeV, the absolute energy spread is 0.5 MeV, the electron current is I 0 < 2.5 kA, the emittances are ε x,y = 1.4 µm × rad, and the Twiss parameters are β x,y = 6 m. The undulator period is λ u = 3.14 cm, the deflection parameter k varies in the range of k ∈ [0.7 − 2.8], and each undulator section is 2.5 m long. The radiated FEL wavelengths are in the range of λ ∈ 4 − 90 nm. A variable k parameter allows for the use of undulators for the SASE FEL and for harmonic self-seed (HHSS) in the high gain harmonic generation (HGHG) FEL, where the last undulator sections are tuned to the high harmonic of the first sections. The range of variation of k allows for the amplification of the third harmonic of the first sections in the last sections. Consider one of the FEL experiments at FLASH 2 [63] with a beam current I 0 = 600 A, an electron energy E = 757 MeV, an energy spread σ e = 0.66×10 −3 , an undulator parameter for the first sections k = 2.687, and an undulator parameter for the last sections k = 1.032; the fundamental wavelength from the buncher was λ = 33 nm. The undulator cascades of the amplifier with k = 1.032 were tuned to the third harmonic λ 3 = 11 nm of the first sections. We computed the spontaneous and the stimulated UR for it.
The spontaneous UR spectra from the first and last undulator sections are shown in Figure 7. It follows from Figure 7 that the third UR harmonic of the undulator with k = 2.7 (green bar in the left plot) was weaker than the fundamental tone of the undulator with k = 1 (red bar in the right plot). Thus, for the spontaneous UR at λ = 11 nm, it may be favorable to use the fundamental frequency of the undulator with k = 1.0. Now let us evaluate the FEL radiation from FLASH 2 undulators. For the fundamental wavelength λ = 33 nm of the buncher, whose undulators had k = 2.7, we got: 1 ≈ 0.162 and a Pierce parameter ρ k=2.7 n=1 ≈ 0.0022. For the third FEL harmonic λ 3 = 11 nm of the buncher for k = 2.7, the Pierce parameter was practically the same as that for the fundamental frequency at the same wavelength λ = 11 nm of the amplifier, where k = 1: κ k=2.7 cascades was ensured. The fact that the buncher was cut after the fourth section [63] meant that our theoretical estimations agreed with those of the engineers at FLASH 2. weaker than the fundamental tone of the undulator with k = 1 (red bar in the right plot). Thus, for the spontaneous UR at λ = 11 nm, it may be favorable to use the fundamental frequency of the undulator with k = 1.0. . Thus, the independent amplification of the third FEL harmonic of the undulator with k = 2.7 was the same as the amplification of the fundamental frequency of the undulator with k = 1; this was different from the spontaneous UR results in Error! Reference source not found.. In addition to the independent harmonic generation, there was a contribution induced by the fundamental tone on the third harmonic wavelength that helped to amplify the third harmonic at 11 nm in the undulator with k = 2.7, and the radiation power at 11 nm grew faster towards the end of the buncher. However, the saturation of the fundamental frequency did not allow for the further growth of the third FEL harmonic; moreover, the fundamental tone induced the energy spread towards the end of the FEL. To avoid this negative effect, the buncher was cut far from saturation, where 2 / 0.00067 ρ σ ≤ = e and amplification in the following cascades was ensured. The fact that the buncher was cut after the fourth section Error! Reference source not found. meant that our theoretical estimations agreed with those of the engineers at FLASH 2.
The further amplification and radiation of the λ = 11 nm harmonic occurred in the amplifier, whose undulators had k = 1 and whose fundamental frequency resonated with the third harmonic of the buncher. The further amplification and radiation of the λ = 11 nm harmonic occurred in the amplifier, whose undulators had k = 1 and whose fundamental frequency resonated with the third harmonic of the buncher.
In Figure 8, we present the modeling of the harmonic power evolution in the FEL undulators of FLASH 2 in the above-described experiment for harmonic self-seeded HGHG and SASE FEL; in the latter case, all undulators were tuned to k = 1 and the fundamental wavelength of λ 1 = 11 nm was radiated.
The modeling was done with the phenomenological FEL model [55][56][57][58][59], where the exact formulae from Section 3 for the Bessel factors, verified numerically, were used. The model is reliable and has given predictions close to the measured values for the harmonic power evolution in FEL experiments in wide range of parameters and radiated wavelengths [54][55][56][57][58][59][60]. The photon pulse energy, measured after 10th undulator section, was higher for HGHG than for SASE FEL (compare the orange and red dots that denote the respective powers). The results of our analysis (see Figure 8) confirmed that the amplification of the third harmonic in the buncher with k = 2.7 (see Figure 8 at 10 m) was better than that of the fundamental frequency in the SASE FEL at the same length; the proper harmonic gain length was also shorter for HGHG due to the induced contribution from the fundamental frequency. This advocated for buncher use in harmonic amplification and made the self-seeded HGHG FEL preferable to SASE at the same harmonic wavelength. The details of the experiment can be found in [64]. The reported photon pulse energies agreed well with our theoretical results (see colored orange dot and red dot in Figure 8 at 25 m of pure undulator length).
In Error! Reference source not found., we present the modeling of the harmonic power evolution in the FEL undulators of FLASH 2 in the above-described experiment for harmonic self-seeded HGHG and SASE FEL; in the latter case, all undulators were tuned to k = 1 and the fundamental wavelength of λ1 = 11 nm was radiated. The modeling was done with the phenomenological FEL model Error! Reference source not found.-Error! Reference source not found., where the exact formulae from Section 0 for the Bessel factors, verified numerically, were used. The model is reliable and has given predictions close to the measured values for the harmonic power evolution in FEL experiments in wide range of parameters and radiated wavelengths Error! Reference source not found.-Error! Reference source not found.. The photon pulse energy, measured after 10th undulator section, was higher for HGHG than for SASE FEL (compare the orange and red dots that denote the respective powers). The results of our analysis (see Error! Reference source not found.) confirmed that the amplification of the third harmonic in the buncher with k = 2.7 (see Error! Reference source not found. at 10 m) was better than that of the fundamental frequency in the SASE FEL at the same length; the proper harmonic gain length was also shorter for HGHG due to the induced contribution from the fundamental frequency. This advocated for buncher use in harmonic amplification and made the self-seeded HGHG FEL preferable to SASE at the same harmonic wavelength. The details of the experiment can be found in Error! Reference source not found.. The reported photon pulse energies agreed well with our theoretical results (see colored orange dot and red dot in Error! Reference source not found. at 25 m of pure undulator length).

Results and Conclusions
In this work, we studied the spontaneous UR and SASE FEL radiation in undulators with field harmonics. We presented exact analytical expressions for the Bessel factors for the UR harmonics, emitted in multiperiodic magnetic fields. We compared all the analytical results with accurate numerical calculations, performed with the SPECTRA program. We considered examples of real undulators and beams in existing installations and accounted for the emittances, energy spread, focusing, etc. We also theoretically consid-

Results and Conclusions
In this work, we studied the spontaneous UR and SASE FEL radiation in undulators with field harmonics. We presented exact analytical expressions for the Bessel factors for the UR harmonics, emitted in multiperiodic magnetic fields. We compared all the analytical results with accurate numerical calculations, performed with the SPECTRA program. We considered examples of real undulators and beams in existing installations and accounted for the emittances, energy spread, focusing, etc. We also theoretically considered some undulators with strong field harmonics. The agreement between the analytical and numerical results was remarkably good for every studied undulator and electron beam setup. The results for the spontaneous UR harmonic generation in helical, elliptic, and planar undulators with field harmonics are the following:

•
Elliptic undulators with field harmonics are not the best choice for harmonic generation. This includes undulators with both symmetric and asymmetric elliptic fields with third harmonics along with one and two coordinates. These undulators provide elliptic polarizations of the radiation, but their UR harmonic content is inferior to that of a planar undulator with the same harmonic in the magnetic field. Moreover, because of the main field harmonic is present alongside both coordinates in helical undulators, their spectrum is lower than that of a planar UR. • A helical undulator with an antisymmetric third field harmonic has a noticeable fifth UR harmonic and a very weak third harmonic in the spectrum. However, this fifth UR harmonic is not enough strong for practical use. In an FEL, it is mainly induced by the fundamental frequency and barely reaches 0.01-0.1% of content. A planar undulator with the same magnetic field along one axis radiates the third UR harmonic at the wavelength, similar to that of the fifth UR of a helical undulator. However, the third harmonic of the planar undulator is much stronger than the fifth of the helical with field harmonics.

•
The third UR harmonic of a planar undulator with kτ 1.5 can be enhanced by the third field harmonic if the latter comes in phase with the main undulator field.
We applied our results to FEL radiation and estimated the values of the Pierce parameter for the considered undulators. The following results are worth mentioning: • For a fixed radiation wavelength, electron energy, and beam current, the Pierce parameter ρ for the fundamental frequency of an FEL with a planar undulator with kδ 1 was nearly the same as the values of ρ, as computed for the harmonics of an elliptic undulator with the matching wavelengths and kτ 2.5.

•
In an FEL amplifier, there seemed to be little difference when using the fundamental frequency of a common planar undulator with low k, a third harmonic of a planar undulator with higher k, or a fifth or higher UR harmonic with a similar wavelength radiated in an elliptic undulator. The latter is more complicated and has higher costs.

•
For the harmonic radiation, we advocate a planar undulator with symmetric third field harmonic; it gives a larger Pierce parameter for its UR harmonics compared to that of elliptic undulators at the same radiation lengths of matching harmonics.
Moreover, we considered spontaneous and FEL radiation in undulators with a variable k parameter. In particular, we studied radiation from undulators of FLASH 2 FEL, Germany. We computed the spectrum and harmonic intensities for the highest possible undulator parameter k = 2.7 at FLASH 2 and compared it with that for k = 1. Our analytical and numerical results were in agreement and demonstrated the following:

•
At FLASH 2, the third UR harmonic of the undulator with k = 2.7 resonated with the fundamental tone of the undulator with k = 1.

•
Due to the enhanced harmonic radiation from the undulator with k = 2.7, it is best for a buncher in an FEL with harmonic multiplication cascades. For k = 1, the fundamental tone dominated, and k = 1 could be used in the amplifying cascades.
In the experiment at FLASH 2 with the beam energy E = 757 MeV, λ = 11 nm radiation was generated. The first four undulators with k = 2.7 grouped electrons at the wavelength of the third harmonic, λ 3 = 11 nm of the fundamental wavelength of λ buncher = 33 nm. Further amplification occurred in the undulators with k = 1 for the fundamental tone, resonating with the third harmonic of the buncher.

•
The energy spread at the end of the buncher after the fourth cascade was lower than the Pierce parameter values: 2σ e ≤ ρ k=2.7 n=3 ≈ ρ k=1 n=1 ≈ 0.0013.

•
The bunching at the third harmonic wavelength in the undulators with k = 2.7 was more efficient than that at the fundamental wavelength in the undulators with k = 1. This was due to the induced bunching from the fundamental frequency to the third harmonic of the buncher.

•
The radiation pulse energy of the fundamental wavelength λ = 11 nm of the SASE FEL, where all undulators had k = 1, was lower along the FEL compared with the radiation energy of the harmonic self-seeded FEL, where the buncher sections with k = 2.7 grouped electrons at the harmonic wavelength λ 3 = 11 nm.

•
The power of the fundamental frequency in SASE regime rose later than the power of the harmonic from the buncher in the harmonic multiplication regime (HGHG, HHSS, or other). This is a general conclusion that applies to any installation with undulators with a variable k parameter.

•
Our theoretical results for the harmonic radiation at FLASH 2 agreed with the reported values of the photon pulse energies.
The proposed analysis can be easily done for any undulator and FEL with other parameters.