research papers
SPECTRA: a synchrotron radiation calculation code
aCoherent Synchrotron Light Source Physics Laboratory, The Institute of Physical and Chemical Research, Koto 1-1-1, Mikazuki-cho, Sayo-gun, Hyogo 679-5148, Japan
*Correspondence e-mail: ztanaka@spring8.or.jp
An application program to calculate various characteristics of synchrotron radiation, called SPECTRA, is described. The program does not need any other commercial software and is equipped with a full graphical user interface which makes data input quite easy. Equations on synchrotron radiation from arbitrary-field sources in a near-field region are derived, as are simplified expressions for ideal devices using a far-field approximation. Effective numerical methods implemented in SPECTRA to reduce computation time are explained, and several examples are presented.
Keywords: computer code; synchrotron radiation sources; numerical methods.
1. Introduction
In the construction of a beamline at a synchrotron radiation (SR) facility, the understanding of the light source is important in order to design various components to be installed in the beamline. The power distribution of SR is important for the design of the front-end components. A knowledge of the photon-beam emittance (size and divergence) is necessary for ray-tracing of optical elements such as monochromators and mirrors. Spectral evaluation up to very high energy (300 keV) regions is necessary for designing components for radiation shielding.
In addition to information on the light source necessary for construction of the beamline, other photon-beam properties should be estimated for an accurate analysis of experimental data recorded at the beamline. For example, the degree of polarization should be known in order to analyze experimental data obtained using a polarized photon beam, and a profile of the energy spectrum of the undulator radiation (UR) provides information on electron-beam performances such as the emittance and coupling constant.
We have developed a computer code called SPECTRA to calculate the SR properties mentioned above. It can calculate properties of SR emitted from devices with arbitrary magnetic fields. For wigglers and bending magnets, the well known SR expressions are used. For UR, the so-called far-field approximation can be used for fast computation. For more accurate evaluation of SR, expressions on SR in a near-field region are used for numerical computation. In this case, properties of SR emitted from both the ideal- and arbitrary-field devices can be calculated.
To compute SR properties, many parameters concerning the electron beam, SR source and sampling range on the photon energy and observation position should be specified. In SPECTRA, a graphical user interface is adopted to help the user to specify the many parameters to be used in the computation.
The purpose of this article is to inform the SR users of the details and usefulness of SPECTRA. In the following sections, analytical expressions on SR, numerical methods implemented in SPECTRA and examples of computation obtained for various sources are described.
2. Equations on SR
In this section, analytical expressions on SR are derived. All equations are written using SI units.
2.1. SR in the near-field region
The scalar and vector potentials generated by an electron moving along an arbitrary trajectory (Liénard–Wiechert potential) are given by (Landau & Lifshits, 1971; Jackson, 1975)
with
where is the vector directing from the origin to the observer (electron), is the velocity of the electron, e is the c is the speed of light and is the permittivity of a vacuum. The subscript `ret' denotes that the values in the square bracket should be calculated at the retarded time determined by the equation
Using the relation between the potentials and the electric field,
we have
where
Using this expression, a power density, or radiated power (dP) per unit surface area (dS) is calculated as
with
where and are the Lorentz factor and the relative velocity of the moving electron, respectively.
In order to calculate the spectral dNp) in a relative spectral interval () per unit surface area, the Fourier components of should be calculated. It is more convenient to use the Fourier transformation of (2) instead of (3) as (Chubar, 1995; Chubar & Smolyakov, 1993)
or the number of photons (Substituting (7) and (8) into (6), we have
with
The spectral
is calculated aswhere is the
The specifying the polarization properties of the radiation are calculated asUsing (4) and (11), most of the radiation characteristics, such as the power distribution, energy spectra and degree of polarization, can be calculated for an electron moving in arbitrary magnetic fields.
Let the origin of the coordinates be at the midpoint of the device generating the magnetic fields. In this case, the distance between the electron and observer, R, is rewritten as
with
where we have used approximations
being usually satisfied in general radiation processes.
The retarded time is expressed in terms of the electron longitudinal position z as
The time t in (10) is therefore expressed in terms of z as
where t0 is a constant independent of z and can be omitted when performing the integration in (10).
2.2. UR in the far-field region
Let us consider radiation emitted from an electron moving in an undulator with completely periodic magnetic fields (ideal undulator). The periodic length and number of periods are assumed to be and N, respectively. If the distance between the electron and observer, R, is much longer than the length of the undulator, we can apply a far-field approximation to simplify the expressions on SR. In this case, is regarded as constant and R is simplified to
The above equation is used to derive a simplified expression of t as
with
being angles of observation. In the far-field approximation, R is regarded as a constant except when it is used to calculate t (z).
Because the magnetic field is completely periodic, the velocity and position of the moving electron is also periodic. The time t therefore satisfies the condition
with
Assuming that R is much longer than the wavelength of radiation , is simplified to
with
where is the period in the rest frame of the electron.
Expanding the function H(t) in a Fourier series between t (0) = 0 and = T, we have
with
where we have made a partial integration to derive (20).
Substituting (19) and (20) into (18), we have
with
For convenience, we change the variable of integration from to z to obtain
In order to calculate the
and products of components of vector should be calculated. For example, the product is calculated asOther products are calculated in the same manner.
3. Electron-beam convolution
All equations described in the previous section concern the radiation emitted by a single electron, or a monochromatic electron beam with zero emittance. In order to evaluate practical properties of SR, the effects caused by an energy spread and finite emittance of the electron beam should be taken into account.
3.1. Phase ellipse transfer
The effect due to the finite electron-beam emittance and energy spread is described as a beam envelope at the position of observation. The electron, after emitting radiation, is in general deflected by bending magnets. It is important, however, to know the beam envelope at the position of observation if the electron beam travels without any magnetic field, or in a drift space. Assuming the distance between the light source and observer to be l, the beam envelope at the observation position is calculated as
with
where , , and are the betatron and dispersion functions and their derivatives at the position of the light source, respectively. Both horizontal and vertical beam envelopes are calcuated using (23). The finite beam emittance is taken into account by a convolution of the result for a single electron with a two-dimensional electron distribution function.
3.2. Energy spread
The effect due to the energy spread of the electron beam has already been described in the previous section. There is another important effect for the UR calculation: because the energy of the first harmonic is proportional to , the energy spread of the electron beam causes a spectral broadening. Its effect is therefore taken into account by an energy convolution with a Gaussian distribution function with an root mean square (r.m.s.) width of 2, where is the photon energy. The effect is pronounced especially for UR energy spectra when the number of periods is very large, e.g. for those of the 25 m in-vacuum undulator installed at SPring-8, and/or when the spectral energy range includes very high harmonics.
3.3. General case
Let us consider a function F as functions of X and Y, or the transverse positions of observation. Assuming the electron distribution function to be Gaussian, convolution of F with the electron beam, Fc, is expressed as
where is the horizontal and vertical r.m.s. beam envelope calculated using (23).
In order to obtain a quantity passing though a slit , Fc(X,Y) should be integrated over the slit area S,
If the slit has a rectangular shape, the above equation is simplified to
with
where the slit has a horizontal and vertical aperture and located at (Xc,Yc), and erf(x) is an error function defined as
SPECTRA is applicable to slits with rectangular, circular or doughnut-shaped apertures. All the radiation properties are calculated with the schemes described above. For an energy spectrum of UR in the far-field region, however, the scheme described in the following section is applied to speed up the computation.
3.4. UR spectra in the far-field region
If N is much larger than unity, the second term in (22) can be neglected and the radiation can be expanded into harmonics with multiple energies of as
with
Introducing a delta function, we can modify the above equation as
with
The convolution of with the electron beam is expressed as
By using (27), (29) is simplified to
with
The integration along has been replaced by that along .
The function PN in the integrand of the above equation has a sharp peak at = and a width proportional to . In other words, the width is dependent on the integration variable . In SPECTRA, a replacement of the function PN, i.e.
is made for fast computation. The coefficient is multiplied to avoid a discrepancy in area. Equation (30) therefore reduces to
with
As is easily understood, is the N. Using this scheme, integration along in (30) reduces to a convolution with a function SN, which enables us to apply a convolution scheme with a fast Fourier transform algorithm.
for an infinite number of4. Numerical method
In SPECTRA, several numerical methods are implemented to save computation time, which are briefly explained in this section.
4.1. Fast computation of Fω
Let us consider an integration of the form
Both and can be reduced to the above form by changing the integration variable from z to t. When is much larger than unity, the integrand oscillates rapidly and should be computed many times for an accurate integration. By integrating (32) by parts n times, we have
Let us consider the integration over the range between t1 and t2. If g(t) can be approximated by an nth-order polynomial in this range, d ng/dt n becomes a constant; therefore the first term in the above equation reduces to
which means that the integration reduces to a simple summation. It is expected that the time taken to compute based on the above expression is independent of or the photon energy, which is a great advantage for high-energy regions.
In SPECTRA, the whole region of integration is divided into several sections within which g(t) is well approximated by a third-order polynomial. The derivatives up to the third order are determined by a cubic-spline interpolation method (Stoer & Bulirsch, 1991). The integration G is therefore reduced to
where t1 and tm+1 show boundaries of the whole integration range, g(k) is the kth-order derivative of g, and g(3)j shows the third-order derivative of g between tj and tj+1.
4.2. Facile evaluation of the total flux
By integrating (11) over the whole solid angle, the total or the total number of photons emitted per unit time in a relative spectral interval is obtained. This quantity is frequently used to design radiation shielding of an experimental hutch. In this case, the spectral data up to an extremely high energy is necessary, which imposes calculation of quite high harmonic radiation such as or higher, resulting in much computation time. It should be noted, however, that a sharp peak specific to UR is no longer observed in such a high-energy region and the spectrum is similar to that of bending-magnet radiation (BR). Therefore, it is expected that evaluation of the total based on an expression on BR will be a good approximation of that of UR. The linear of BR, a quantity obtained by integrating the over Y, or the vertical position of observation, is analytically expressed as
where is a critical frequency defined as
with
where is a bending radius and B is the uniform magnetic field of the bending magnet.
If the magnetic field is not uniform, then (33) cannot be applied. We have to divide the whole length into many regions and regard the magnetic field as constant in each region. The emitted by an electron passing through the ith region is expressed as
where Bi and are the magnetic field and change of relative velocity in the ith region. Summation of reduces to the total The factor corresponds to a length of the region over which the radiation from the ith bending magnet is emitted.
It is easy to show that the above equation can be expressed in an integral form as
with
Substituting (33) and considering the reaction between and , we have
where is the critical frequency calculated with B(z).
4.3. Omission of radial integration
In order to obtain a precise spectrum of UR with finite beam emittance, two-dimensional integration along an azimuthal () and radial () direction is necessary. As shown in §3.3, the radial integration can be reduced to an energy convolution. For a precise calculation, should be calculated with fine steps of . In an energy region of the spectrum composed of high harmonics, however, the convolution with the SN function changes little the shape of the spectrum. In such a case, the convolution, or the radial integration, can be omitted. In SPECTRA, the energy region to omit the radial integration can be specified to save computation time without sacrificing the accuracy of the calculation.
5. Program details
5.1. Types of SR sources
In SPECTRA, SR sources can be classified into four types, i.e. bending magnets, wigglers, undulators and arbitrary-field devices. The numerical method to be applied depends on the type of the SR source.
If the SR source is regarded as a bending magnet, the well known expressions on SR (Schwinger, 1949; Kim, 1986) are applied. In the case of wigglers, the magnetic fields are varied according to the horizontal observation angle. The undulator includes familiar devices, such as planar, helical, elliptical and figure-8 undulators. In addition, a device with arbitrary but periodic magnetic fields is also regarded as an undulator.
In fact, the magnetic field of a practical device is not completely periodic. In such a case, SPECTRA calculates SR properties in the near-field region without any approximation and assumption. Using this scheme, degradation of peak intensity at each harmonic of UR can be calculated. Edge radiation, i.e. SR emitted from fringing fields of bending magnets, can also be characterized. Evaluation of edge radiation is important for estimating performances of an X-ray beam-position monitor installed in the undulator beamline because it causes a significant background.
Radiation properties can be calculated as functions of photon energy and observation position. In the case of undulators, the K-value (deflection parameter) dependence can also be obtained.
5.2. Graphical user interface
In addition to the numerical methods implemented in a computer code, the user interface which helps the user to input their desired parameters is very important. SPECTRA adopts a graphical user interface (GUI) with which the user can specify computation parameters, as shown in Fig. 1. Storage-ring, SR-source and sampling parameters can be edited by the GUI. The storage-ring parameters include the electron energy, average current, emittance, twiss parameters and so forth. The SR-source parameters include a strength and periodic length of the magnetic field, or the field profile data for arbitrary-field devices. The sampling parameters include a computation range of the photon energy or observation positions, harmonic numbers of UR and so forth.
For operating-system portability, a Tcl/Tk programming language has been adopted for building the GUI. Because the main code for numerical computation is written in a simple C language, SPECTRA can be executed on almost all of the platforms which Tcl/Tk supports, such as MS Windows, Macintosh, Linux and other kinds of UNIX.
6. Examples
In this section, examples of computation of various properties of SR are presented to show the usefulness of SPECTRA. The storage-ring parameters are shown in Table 1.
|
6.1. Energy spectrum
First of all, energy-spectrum computations are shown. As an example, a planar undulator with a periodic length of 32 mm and number of periods 140 is considered.
Fig. 2 shows spectra of the total on-axis and partial passing through a slit with dimensions of 1 mm × 1 mm located 30 m from the source. The far-field approximations are used in this example. The K value is assumed to be 2.56. The dotted line is the total spectrum evaluated by the scheme described in §4.2. The difference between the two total-flux spectra is small above 10 keV, indicating the validity of the scheme.
Fig. 3 shows the near-field effect on spectra of UR. The K value is assumed to be 1.34 for the first-harmonic energy to be at 10 keV. Fig. 3(a) shows on-axis spectra of the angular i.e. the normalized by the square of the distance between the light source and observer, while Fig. 3(b) shows off-axis spectra observed at = 0 and 60 µrad. Comparing the two figures, the near-field effect is found to be more remarkable for the off-axis spectra, as is described by Hirai et al. (1984) and Walker (1988).
Fig. 4 shows effects due to magnetic field errors, which are inevitable for a practical device. Fig. 4(a) shows electron orbits in both transverse directions assuming a permanent-magnet device composed of magnet blocks whose r.m.s. magnetization error is 1% in magnitude and 1° in angle. An on-axis spectrum calculated with the orbit data is shown in Fig. 4(b) together with an ideal case (without error). The peak, corresponding to harmonics up to the 11th, are found in each case. The difference is larger for higher harmonics. For example, the 11th-harmonic (= 49 keV) peak intensity for the error-field case is about half of that of the ideal.
6.2. Spatial distribution
Next, spatial-distribution computations are shown. As an example, the so-called edge radiation from fringe fields of bending magnets is considered. Fig. 5 shows a typical magnetic field distribution along the longitudinal direction generated by two bending magnets. The calculated with the field distribution is shown as functions of the horizontal and vertical observation positions in Figs. 6(a) and 6(b), respectively. The photon energy and the distance between the observer and midpoint of the straight section are assumed to be 5 eV and 20 m, respectively. The dotted line shows a zero-emittance case. A clear interference pattern is seen in each direction, while the effect due to the finite emittance is more pronounced for the horizontal case. The power density, also shown in Figs. 6(a) and 6(b), is found to have an asymmetry in the horizontal direction due to the difference in distance from the two bending magnets to the observer.
6.3. Filtering effect
In SR beamlines, several kinds of filters are used for various purposes. SPECTRA can calculate an energy spectrum and power after passing through a filter made of various materials (filtering). As an example, let us consider a filter made of copper with a thickness of 10 µm. Fig. 7 shows on-axis power densities before and after filtering as functions of the first-harmonic energy when the magnetic field is varied in order to tune the photon energy. The light source is the same as that described in §6.1. The dip found at 8.9 keV is due to the K-absorption edge of Cu. Figs. 8(a) and 8(b) show power densities as functions of the horizontal and vertical observation positions when the first-harmonic energy is set at 10 keV. The difference of profile within the range < 0.03 mrad is also caused by the Cu K-edge. The first-harmonic energy observed at = 0.03 mrad is equal to 8.9 keV in this case.
In SPECTRA, filtering material frequently used in SR beamlines, such as aluminium, carbon and beryllium, are implemented. Other materials are also available by creating a new parameter set specifying its density and mass ratio.
7. Summary
We have described the details of SPECTRA and shown several examples of computation. It is freely available from the SPECTRA homepage (https://radiant.harima.riken.go.jp/spectra/index_e.html ) on the SPring-8 web site. It does not require any other commercial software or libraries. In other words, it is a stand-alone application program.
Besides several numerical methods described in §4, the expansion of by Bessel functions (Motz, 1951; Kincaid, 1977; Yamamoto & Kitamura, 1987) are implemented for a planar, helical and elliptical undulator in the far-field region. Spatial symmetries of radiation from these devices are also considered, while no symmetries are assumed for arbitrary-field devices because they are not ensured generally.
The computation time depends on the type of the computer and calculation. For example, the partial-flux spectrum calculation shown in Fig. 2 is performed with 10000 points of photon energy in 17 s using a computer with a Pentium 750 MHz processor. The calculation of the on-axis spectrum observed at the point 30 m from the source shown in Fig. 3 takes about 2 min with 5000 points of photon energy. The spatial dependence of the power density after filtering, as shown in Fig. 8, is calculated in 11 s with 100 points of observation position.
Finally, let us make a short comparison with other programs. According to our experiences, the computation time of SPECTRA is almost equal to those of other programs such as SRW (Chubar & Elleaume, 1998). It should be noted, however, that SPECTRA is more user-friendly, especially in the near-field computation including the electron-beam effects. In the case of SRW, the user must try many sets of parameters such as grid points and spatial range and use post-processing to obtain a reasonable result, while SPECTRA does not require such trial and error.
References
Chubar, O. V. (1995). Rev. Sci. Instrum. 66, 1872–1874. CrossRef CAS Web of Science
Chubar, O. V. & Elleaume, P. (1998). Proceedings of the 1998 European Particle Accelerator Conference, Stockholm, Sweden, pp. 1177–1179.
Chubar, O. V. & Smolyakov, N. V. (1993). Proceedings of the 1993 Particle Accelerator Conference, Washington DC, USA, pp. 1626–1628.
Hirai, Y., Luccio, A. & Yu, L. (1984). J. Appl. Phys. 55, 25–32. CrossRef Web of Science
Jackson, J. D. (1975). Classical Electrodynamics. New York: Wiley.
Kim, K. J. (1986). Proceedings of the 1986 US Particle Accelerator Summer School. Berlin: Springer.
Kincaid, B. M. (1977). J. Appl. Phys. 48, 2684–2691. CrossRef Web of Science
Landau, L. D. & Lifshits, E. M. (1971). The Classical Theory of Fields. Oxford: Pergamon.
Motz, H. (1951). J. Appl. Phys. 22, 527–535. CrossRef Web of Science
Schwinger, J. (1949). Phys. Rev. 75, 1912–1925. CrossRef Web of Science
Stoer, J. & Bulirsch, R. (1991). Introduction to Numerical Analysis. New York: Springer-Verlag.
Walker, R. P. (1988). Nucl. Instrum. Methods, A267, 537–546. CrossRef CAS
Yamamoto, S. & Kitamura, H. (1987). Jpn. J. Appl. Phys. 26, L1613–L1615. CrossRef
© International Union of Crystallography. Prior permission is not required to reproduce short quotations, tables and figures from this article, provided the original authors and source are cited. For more information, click here.