
About GENESIS 1.3GENESIS 1.3 is a timedependent threedimensional FEL code. It is focused to simulate singlepass freeelectron lasers, both FEL amplifier and SASE FEL, although the flexible input can be used to easily extend the capacity of GENESIS 1.3 to cover FEL oscillators or multistage setups. GENESIS 1.3 bears its origin in the steadystate 2D code TDA3D, although they have nothing in common except for some naming convention. GENESIS 1.3 has all the features of TDA3D and is intendent as a replacement, in particular that there is no more support for TDA3D. For an easier transition GENESIS 1.3 adopted most of the input and output format of TDA3D. TDA3D input file will most likely not work. The code was written by Sven Reiche as a part of the Ph.D. thesis at DESY, Germany, and then further extended at UCLA and DESY. The Particle EquationsMacro particles represent the electron beam in all dimension of the 6D phase space. For convenience the longitudinal position is replaced by the ponderomotive phase of the particle and the transverse momenta are normalized to mc. The equations of motion are where _{z} is the electron velocity in z, normalized to the speed of light, k is the radiation wave number, k_{u} is the undulator wave number, f_{c} the coupling factor, a_{r} and a_{u} are the scalar, normalized amplitudes of the radiation and undulator field, is the phase of the radiation field, E_{z} is the electrostatic field, b_{x} and b_{y} are the normalized dipole strengths in x and y, q_{x} and q_{y} are the quadrupole field strengths in x and y and s is the solenoid field strength. The differential equations for energy and phase are solved by a 4th order RungeKutta solver, where the field amplitude of the discretized radiation field and electrostatic field is interpolated to the particle position. Distinct to the main undulator field a_{u}, the quadrupole and dipole fields combines many field sources such as the natural focusing of the undulator, strong focusing quadrupoles, undulator field errors and corrector magnets (steering magnets). Per integration step their strength is fixed and the differential equations for the transverse motion is solved analytically. Because these equations depend on the particle energy, a higher precision requires to split the pushing of the transverse variables into two halfsteps. While the first step relies on the energy value of the previous iteration, the second uses the updated values of the RungeKutta solver for this iteration. The Field EquationsElectrostatic and electromagnetic fields are discretized within GENESIS 1.3. The radiation field is described in the paraxial approximation, where the field is separated into a dominant, fast oscillating term and an amplitude, which slowly varies in magnitude and phase. The partial differential equation is of parabolic type where u = ia_{r}exp[i] is the complex representation of the radiation field. Note that there is no explicit dependence on t in the differential equation. Timedependence effects are discussed below. The transverse profile of the field is discretized on a Cartesian grid with uniform spacing. The Alternating Direction Implicit (ADI) solver guarantees an unconditional stable, fast and memoryefficient method to advance the radiation field one integration step. Only the longitudinal component of the electrostatic field is taken into account within GENESIS 1.3, because it acts as a repulsive force during the formation of the micro bunching. On the scope of a single radiation wavelength the field can be assumed to be periodic in the ponderomotive phase of the electrons. In the Fourier series expansion of the longitudinal field the partial different equation of the l coefficient is where the resonant energy is defined as . With a radial grid centered to the electron beam centroid position and the azimuthal decomposition of the Fourier coefficients E_{z,l} the matrix representation of the partial differential equation is reduced to a tridiagonal matrix, where a fast and memoryefficient solver is applied to. Longterm electrostatic fields (e.g. wake fields) must be calculated externally. They can be imported into GENESIS 1.3 and applied to equations of motion for the macro particles. TimeDependent EffectsGENESIS 1.3 supports two modes of calculations: steadystate and timedependent simulations. Steadystate simulations are base on the assumption of an infinite long electron bunch and radiation field with no longitudinal variation of any parameter. The partial derivative with respect to the time drops out of the field equations resulting in the parabolic equation shown above. The longitudinal description can be reduced to a single wavelength (bucket) with periodic boundary condition in the ponderomotive phase of the macro particles. Timedependent simulations would require to keep the entire radiation field and electron bunch at whole in memory, which easily exceeds the capability of todays best single processor machines. For a solution, which is not bounded to memory constraints, GENESIS 1.3 discretizes the radiation field and electron beam in t, referring to them as slices. Because information on the local electron distribution is carried by the radiation field only in the forward direction (slippage) timedependent simulations rolls over the electron bunch starting from the back. Advancing the radiation field is split into two parts: solving the steadystate field equation and copying the field to the next slice. Using the method only a single slice of an electron beam and the radiation field over the total slippage length, which can be significantly shorter than the bunch length, needs to be kept in memory. Although the spacing of the slices can freely be chosen with GENESIS 1.3, some conditions have to be fulfilled for a valid timedependent simulation. The propagation of the radiation field has to be done frequently to avoid collective instabilities of the steadystate field solver per integration step within a single slice. The characteristic parameter of the FEL interaction is where _{b} is the electron beam radius, I_{p} is the peak current and I_{A} = 17 kA. The resulting limitation for the integration step size, being much smaller than the gain length, is Similar arguments are valid for the separation t of the slices, which is related to the integration step size by the inequity . The constraint for the tdiscretization is therefore On the other hand each slice has a thickness of one radiation wavelength . The time discretization must be to avoid overlapping slices. Conflicts might arise if approaches unity. Anyhow in this case the entire FEL model, on which GENESIS 1.3 is based, is not valid anymore and other simulation tools need to be used to solve this problem. Very often the timewindow T, which is spawn by all slices, covers only a subsection of the electron beam. Because GENESIS 1.3 does not know anything about the field, which slips through the back of the timewindow, it suppresses the output over the first slippage length. To obtain valid output the time window must be at least as long as the slippage length T_{s}, yielding the constraint where L_{u} is the length of the undulator. In practice the timewindow should be significantly larger than the limit given above to allow a frequency analysis of the radiation. The typical width of the FEL spectrum is . To resolve the spectrum the timewindow must fulfill the more stringent constraint Once GENESIS 1.3 has allocated enough memory to hold the radiation field over one slippage length there is no computational limitation imposed on the maximum size of the timewindow. Pre and PostprocessorsOne of GENESIS 1.3 key feature is the extensive support of additional input files as well the import of modified or process output files of GENESIS 1.3. The generation or processing of these files can be done in the simplest case by hand or by external programs. Although the GENESIS 1.3 website offers several programs for pre and postprocessing they do not officially belong to the GENESIS 1.3 distribution. Experience shows that these programs are mostly customized and specifically bound to a given project or experiment. With the description of the GENESIS 1.3 input and output files in this manual and the 3rd party programs it should be fairly easy to write programs which fulfills the individual needs of the user. GENESIS 1.3 does not support the graphical preparation of the output data due to two reasons. First, subroutines and function would rely on graphic libraries, which makes it more difficult to write a platform independent source code. At least for the FORTRAN version, using the original file format, it is the idea to have a code independent on any library. In addition several graphic packages needs to be supported. Otherwise it would force the user to use a graphic package, which does not necessary agree with his choice. Second, timedependent simulations generate typically more data than useful to be plotted. It should be possible for the user to filter out the data, he needs. In addition some data have to be prepared (e.g. Fourier transformation, averaging, binning for histogram plots) for further information on the simulated FEL process. To help the GENESIS 1.3 offers several programs, which can be the base for the users individual postprocessor. 