Genesis Manual
Genesis Manual
Genesis Manual
3
User Manual
Oct-02
Contents
About this Manual
About GENESIS 1.3
The Particle Equations .
The Field Equations . .
Time-Dependent Effects
Pre- and Postprocessors
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
7
7
8
9
10
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
13
13
15
15
15
15
16
16
16
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
Setting-up Simulations
Step I - The Magnetic Lattice . . . . . . . . . .
Step II - The Electron Beam . . . . . . . . . . .
Step III - The Radiation Field . . . . . . . . . .
Step IV - Optimization Using the SCAN-Feature
Step V - Time-dependent Simulation . . . . . .
Step VI - External Input for the Magnetic Field .
General Tips . . . . . . . . . . . . . . . . . . .
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
19
19
19
20
21
21
22
23
Input Parameters
Undulator Parameters . . . .
Electron Beam Parameters .
Radiation Parameters . . . .
Particle Loading Parameters .
Mesh Parameters . . . . . .
Focusing Parameters . . . . .
Time-Dependence Parameters
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
25
25
27
28
28
29
30
31
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
3
.
.
.
.
.
.
.
.
.
.
.
.
.
.
4
Simulation Control Parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Scan Parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Input and Output Control Parameters . . . . . . . . . . . . . . . . . . . . . . . . . .
Input and Output Files
The Main Input File . . . . . . . . . . . . . . . . . . . . . . . .
The Main Output File . . . . . . . . . . . . . . . . . . . . . . .
The Radiation and Particle Output File . . . . . . . . . . . . . .
The Log File . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Reading-in and Dumping the Particle and Radiation Distribution .
The Magnet Description Input and Output File . . . . . . . . . .
The Beam Description File . . . . . . . . . . . . . . . . . . . .
The External Distribution File . . . . . . . . . . . . . . . . . . .
The Time-Record File . . . . . . . . . . . . . . . . . . . . . . .
The SDDS File Format . . . . . . . . . . . . . . . . . . . . . .
The XML File Format . . . . . . . . . . . . . . . . . . . . . . .
The HDF5 File Format . . . . . . . . . . . . . . . . . . . . . .
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
32
33
34
37
38
38
39
40
40
41
44
46
47
47
47
48
49
51
This manual covers the FEL simulation code GENESIS 1.3. It explains how to set-up an
input deck as well as how to extend the capability by using additional input files. The central
part of this document is the reference list of all input parameters, which are accepted by
GENESIS 1.3. Further information about the code can be found at the website
http://pbpl.physics.ucla.edu/genesis
In particular the novice user of GENESIS 1.3 can find there sample input files, which is a
good starting point for setting-up his own input decks. Anyhow a basic understanding of
FEL physics is recommended for a successful operation of GENESIS 1.3.
Throughout this document different fonts are used to distinguish text from the plain text of
the manual. The italic font and Greek symbols refer to mathematical and physical constants
or expression, e.g.
E = mc2
Sample input and output files as well as all names referring directly to GENESIS 1.3 are
written in typewriter-style such as GAMMA0 or XLAMD.
The manual has a short section on the algorithm of GENESIS 1.3. Its purpuse is to let user
understand, what is calculated and what are the capabilities and limits of GENESIS 1.3. It
is not written to encourage people to modify or extend the code. Anyhow the code is not
perfect. If there is a demand to extend the code, please notefy the authors of the code.
d
dz
d
dz
dx
dz
dpx
dz
dy
dz
dpy
dz
1
= k 1
+ ku
z
kfc ar au
=
sin( + ) Ez
z
px
=
z
s
= qx x + bx + py
py
=
z
s
= qy y + by px
(1)
(2)
(3)
(4)
(5)
(6)
where z is the electron velocity in z, normalized to the speed of light, k is the radiation wave
number, ku is the undulator wave number, fc the coupling factor, ar and au are the scalar,
7
normalized amplitudes of the radiation and undulator field, is the phase of the radiation
field, Ez is the electrostatic field, bx and by are the normalized dipole strengths in x and y,
qx and qy 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 Runge-Kutta
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 au , 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 half-steps. While the first step relies on the energy value
of the previous iteration, the second uses the updated values of the Runge-Kutta solver for
this iteration.
e2 0 X
fc au ij
+ 2ik
u=i
(~r ~rj )
e
z
m j
j
#
is of parabolic type where u = -iar exp[i] is the complex representation of the radiation field.
Note that there is no explicit dependence on t in the differential equation. Time-dependence
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 memory-efficient method to advance the radiation field one
integration step.
Only the longitudinal component of the electro-static 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
"
l2 k 2 (1 + a2u )
ec2 0 lk(1 + a2u ) X
+
E
=
i
(~r ~rj )eilj
z,l
R2
R2
j
#
9
q
where the resonant energy is defined as R = k(1 + a2u )/2k. With a radial grid centered
to the electron beam centroid position and the azimuthal decomposition of the Fourier
coefficients Ez,l the matrix representation of the partial differential equation is reduced to
a tridiagonal matrix, where a fast and memory-efficient solver is applied to. Long-term
electro-static 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.
Time-Dependent Effects
GENESIS 1.3 supports two modes of calculations: steady-state and time-dependent simulations. Steady-state 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.
Time-dependent 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) time-dependent simulations rolls over the electron bunch starting
from the back. Advancing the radiation field is split into two parts: solving the steady-state
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 time-dependent simulation.
The propagation of the radiation field has to be done frequently to avoid collective instabilities of the steady-state field solver per integration step within a single slice. The characteristic
parameter of the FEL interaction is
au fc
1
=
4ku b
!2
Ip
IA
where b is the electron beam radius, Ip is the peak current and IA = 17 kA. The resulting
limitation for the integration step size, being much smaller than the gain length, is
z
1
2ku
10
Similar arguments are valid for the separation t of the slices, which is related to the
integration step size by the inequity ct (ku /k)z. The constraint for the t-discretization
is therefore
t
1
2ck
On the other hand each slice has a thickness of one radiation wavelength . The time discretization must be ct 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 time-window 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 time-window, 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 Ts ,
yielding the constraint
T Ts =
k u Lu
k c
where Lu is the length of the undulator. In practice the time-window 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 time-window must fulfill the
more stringent constraint
T
+ Ts
c
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.
11
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, time-dependent 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.
12
14
length, if the slippage filed is stored in memory. If simulation encounters the case that
this size is too small (GENESIS 1.3 will give an error message) NTMAX has to be increased.
Another possible way is to export the slippage field to a file. It is done by setting NOFILE
and NTMAX to unity. The file will be deleted at the end of the run. The default setting has a
time-record, which demands 160 MByte of free memory - equivalent to 700 records of a grid
with 121 times 121 grid points.
The default settings of GENESIS 1.3 is that the external distribution is read from a file
for every slice. Due to the processing of the input file it can be time-consuming. To keep
the distribution in memory after the first processing two parameters in genesis.def have to
be change. KEEPDIST has to be set to unity while NDMAX defines the maximum number of
particles GENESIS 1.3 can hold in memory. Note that 100000 particles correspond to an
additional memory demand of 5 MByte.
The FORTRAN follows in general the F77 standard although it is not fully ANSI-F77
compliant. This requires to set specific flags while invoking the compiler. Because compiler
option and flags are compiler specific the following list of recommended option just gives a
general description. Please refer to the manual of your compiler. The distribution contains a
Makefile, which works with the Absoft FORTRAN compiler under linux. If might be used
as a template for setting up the compiler and linking instruction.
Optimization should be turned on. In addition if the linker supports a library of
optimized mathematical function it should be used
The compiler should warn or preferable generate an error, if variables are not defined
explicitly.
In general it is a good idea that the compiler issues all warning, but due to the function
prototyping in genesis.def the warning of unused variable should be disabled.
GENESIS 1.3 relies on intrinsic double-precision complex numbers for assignment such
as A=DCMPLX(1.d0,0.d0). Most FORTRAN compilers support this by a special VAX
or complex option. As an alternative method the DCMPLX(...,...) statements must
be replaced by CMPLX(...,... kind=8) statements by hand.
It is recommended to generate a symbolic table (debugger option)
Some compilers do not automatically treat variables in DATA blocks as static, but
GENESIS relies on it. Either enable this option or, as an alternative, make all local
variables static (the size of the executable is increased only by a small amount).
GENESIS is not written consistently with the same case of all variables through out
the source code. A compiler option should fold all variable and function names to lower
or upper case letters if the compiler is case-sensitive.
The SDDS extension of GENESIS 1.3 is in the directory extension/SDDS. Compilation requires that the SDDS libraries are installed on the computer. In addition the FORTRAN
wrapper of SDDS must be linked to the executable to make GENESIS 1.3 work. Unfortunately FORTRAN compilers do not support compiler instructions as C++ compiler do. As
15
a consequnce the base source code must be edited to enable calls to the SDDS part of the
program. Which files and where to edit are described in the README.SDDS file in the root
directory of the genesis distribution.
The MPI version is under development. The manual will be updated, when
the source code has been finished.
Installation
The FORTRAN version of GENESIS is a single executable and can be located anywhere.
Under Linux it is preferable in the directory /usr/local/bin.
The C++ version is under development. The manual will be updated,
when the source code has been finished.
Both versions can rely on additional libraries, which have to be installed prior to running
GENESIS 1.3. The following lists all possible extensions and links, where further information
can be obtained.
SDDS
The Self-Describing Data Set (SDDS) is a file format, where a header defines the properties
of the following data section. The SDDS toolkit allows processing and displaying content of
SDDS files. The offical link is
http://www.aps.anl.gov/asd/oag/oagPackages.shtml
XML
The eXtensible Markup Language (XML) is a popular file format for platform independent
data, mainly in ASCII. XML files can be checked with any XML reader (e.g. Internet
Explorer) whether the file does not violates the basic syntax of XML. In addition files can
16
be validated, so that the data has to fulfill user-defined contraints. The standard for XML
and is associated formats can be found at
http://www.w3c.org
GENESIS 1.3 is build with the Xerces XML libraries of the Apache distribution. The libraries
can be downloaded from the Xerces website
http://xml.apache.org
HDF5
The Hirachial Data Format (HDF5) is a standard for platform independent binary data. It is
benefical to GENESIS 1.3 because it also allows parallel computation and data compression.
The offical website is
http://hdf.ncsa.uiuc.edu/HDF5/
MPI
The Message-Passing Interface is a standard for portable code for parralel computer architecture.
http://www-unix.mcs.anl.gov/mpi/
17
where GENINPUT contains line by line all file name, which are normally be prompted for
by GENESIS. Any output and error message will be written to the file GENOUTPUT. If ILOG
is set a log-file is created and GENOUTPUT remains empty.
18
Setting-up Simulations
This section is a guideline for the novice user of GENESIS 1.3 to set up the main input
correctly so that reasonable results can be obtained. It does not cover all aspects of GENESIS
1.3. For a more complete reference please check the sections on the input parameters of the
main input deck and the usage of additional input and output files. Certain parameters are
not mentioned in this section. If they are omitted in the input deck they fall back to their
default values. To obtain a valid input deck in the first place start GENESIS 1.3 and type at
the prompt the filename of a non-existing file. The template file template.in is generated,
which can be edited by any text-editor.
20
if the FODO lattice start with half a quadrupole or the field strength of all quadrupoles is set
to zero than the beam is going through a waist at the undulator entrance for best matching
(ALPHAX, ALPHAY=0). In this case initial runs of GENESIS 1.3 allows for an iterative method
to find the right values for the beam size while ignoring the radiation results.
It is recommended that the number of macro particles (NPART) is at least 2048 (powers of
two numbers allows a better performance). For simulation of wavelengths below 10 nm the
number must be even higher to exclude numerical noise.
u
2
1
+
a
u
2 2
with =XLAMDS, =GAMMA0, u =XLAMD and au =AW0. Anyhow diffraction or emittance effects
might slightly change the resonant wavelength. The Raylength length should be chosen so
that the initial beam size is similar to the beam size of the gain-guided radiation field in
the exponential amplification regime. If the radiation
q waist is at the undulator entrance
(ZWAIST=0) the initial beam size is simply given by zr / with zr =ZRAYL.
While the input radiation power is a well-defined input parameter for an FEL amplifier
its value has to be estimated for steady-state simulation modelling SASE FELs. With the
definition of the FEL parameter
1
au fc u
=
8b
!2
Ip
IA
an approximation of an equivalent input power (shot noise power) of the SASE FEL is
Pin = 6 2
Pb
q
N log(N/)
Setting-up Simulations
21
with fc =FBESS0 or the value GENESIS 1.3 would calculate in the case that FBESS0 is set to
zero in the input deck, b =(RXBEAM + RYBEAM)/2, Ip = CURPEAK, IA = 17 kA, Pb =Ip mc2 /e as
the electron beam power and N=Ip /ce as the number of electronsper radiation wavelength.
With the parameters for the magnetic field, electron beam and radiation field a run of
GENESIS 1.3 should produce some gain. If the results are satisfying the input deck can
be used for more advanced simulation (field errors, time-dependent simulation). Otherwise
further optimization of the input parameters is needed.
22
slices in the output IOTAIL should be set to zero. The number of suppressed slices is simply
the number of undulator periods of the entire undulator divided by ZSEP.
As an example we assume a Gaussian beam profile with an rms length of 1 mm (CURLEN =
1.e-3) and a radiation wavelength of 5 m for an undulator with 200 periods. The spacing
between the slices is ZSEP=2.0. The output should be between -2 mm and 2 mm which
cuts out a part of the bunch (IOTAIL=0). The total number of slices is 400 slice of output
plus 100 suppressed slices (NSLICES=500). The first simulated slices is NTAIL=-300 which is
equivalent to s0 =-3mm.
In this example the time-window is actually very close to cover the entire beam. With s0 =-3
mm the local beam current is only 1% of the peak current. It is a good assumption that
the tail s<s0 will not significantly amplify any radiation. With only 100 more slices the
entire bunch can be simulated. The parameters would be now: NSLICE=600, NTAIL=-300
and IOTAIL=1.
...
AW 8.5000E-01
AW 0.0000E-01
AW 8.5000E-01
AW 0.0000E-01
...
2.0000E-02 100
2.0000E-02 20
2.0000E-02 100
2.0000E-02 20
Example: To remove the gaps and to taper the second module so that the field strength is
5% smaller change the lines to
...
AW 8.5000E-01
AW 8.0750E-01
...
2.0000E-02 120
2.0000E-02 120
Setting-up Simulations
23
The modified file can then be loaded into GENESIS 1.3 for the next run. The filename of the
edited file is assigned to MAGINFILE. It is recommended to remove the parameter MAGOUTFILE
from the input deck or change the assigned filename before running the simulation. Otherwise
the file is overwritten again. In this case it does not matter but there are some cases (e.g.
field errors) where there are subtle difference in the file used for the input and the overwritten
output. For more information refer to the section on input and output files.
General Tips
At the end of this section some general hints and tips are listed. There are in no particular
order or relation to each other.
Time-dependent simulations are very CPU-expensive. To optimize an input deck, try
to do it in steady-state mode (ITDP=0).
The calculation of the diffraction angle of the radiation field as part of the diagnostic
is CPU intensive and not needed for the simulation itself. To speed up the execution
it is better to save the radiation field at various locations along the undulator. The
diffraction angle can then be obtained in a post-processing step.
The output of the particle and field distributions can generate huge output files. Although GENESIS 1.3 warns about large output files it does not check the available
space of the hard disk. Either run GENESIS 1.3, check for warning about large output
files and stop the program (if the space is not available) or reduce the size of the output
file by increasing the value of IPRADI, ISRADI, IPPART and/or ISPART.
Avoid to use the same parameter several times in the input deck. GENESIS 1.3 will
use the last occurrence in the input deck or might even report an error and quit.
Check whether space charge has a significant impact on the result of the steady-state
case. Space charge can be disabled by setting NSCZ to zero. If the results are not
effected by the space charge routine time-dependent simulations excluding the space
charge routine run faster.
For runs with different field errors change the value of ISEED before each run. The
same is valid for the phase fluctuation in SASE simulations where IPSEED has to be
changed.
Although the loading parameters ILDPSI, ILDGAM, ILDX, ILDY, ILDPX and ILDPY need
hardly to be changed at all, do not assign the same number to more than one parameter.
It is recommended to set the VERSION parameter to the latest version number to avoid
unexpected behavior (e.g. IDUMP=1 will not dump the particle distribution if VERSION
is smaller than 1.0).
ZRAYL and ZWAIST are needed to calculated the grid size for the simulation although
their primary meanings are obsolete for SASE simulation. If DGRID is used and PRAD0
is very small than indeed they have no impact on the simulation. Still ZRAYL is required
to be larger than 0.
24
Input Parameters
The main input file of GENESIS 1.3 is controlled by roughly 100 parameters. Some of
them become obsolete if additional input files are used. In the case that the main input file
cannot be found GENESIS 1.3 creates a template for the main input file and terminates.
Parameters, which are not included in the input file, fall back on their default values. All
allowed input parameters and their default values, formats and units are listed below.
Undulator Parameters
AW0 (0.735 float unitless)
The normalized, dimensionless rms undulator parameter, defined by AW0 = (e/mc)(Bu /ku ),
where e is the electron charge, m is electron mass, c is speed of light, ku =2/u is the
undulator wave number, u is the undulator period. Bu is the rms undulator field with Bu
= Bp /2 for a planar undulator and Bu = Bp for a helical undulator, where Bp is the on-axis
peak field.
26
Input Parameters
27
28
Radiation Parameters
XLAMDS (12.852e-6 float meter)
The resonant radiation wavelength. Due to the bandwidth of time-dependent simulation
SASE simulations do not require a very precise value for XLAMDS.
Input Parameters
29
Mesh Parameters
NCAR (151 integer unitless)
The number of grid points for the radiation field along a single axis. The total number for
the mesh is NCAR2 . NCAR must be an odd number to cover the undulator axis with one grid
point. Do not exceed NCMAX defined in the source file genesis.def.
30
Focusing Parameters
QUADF (1.23 float Tesla/meter)
The field strength of (F-)quadrupoles, focusing in the x-plane.
Input Parameters
31
Time-Dependence Parameters
ITDP (0 integer unitless)
A non-zero value enables time-dependent simulation. Time-dependence is not allowed if the
scan-feature is enabled.
32
6 standard deviation for a Gaussian distribution or the absolute value of CURLEN for a step
profile.
Input Parameters
33
Scan Parameters
ISCAN (0 integer unitless)
Selects the parameter for a scan over a certain range of its value:
1. GAMMA0
2. DELGAM
3. CURPEAK
4. XLAMDS
5. AW0
6. ISEED
7. PXBEAM
8. PYBEAM
9. XBEAM
10. YBEAM
11. RXBEAM
12. RYBEAM
13. XLAMD
14. DELAW
15. ALPHAX
16. ALPHAY
17. EMITX
18. EMITY
19. PRAD0
20. ZRAYL
21. ZWAIST
22. AWD
23. BEAMFILE
24. BEAMOPT
25. BEAMGAM
The last two enable a user-defined scan, where a steady-state run is performed for each
entry of the supplied BEAMFILE. BEAMOPT differs from BEAMFILE that it automatically adjust
XLAMDS according to the resonance condition and the beam energy, defined in the BEAMFILE.
The BEAMGAM option is similar to BEAMFILE, but overwrites the value of energy with GAMMA0
from the main input file.
34
SCAN ( string)
By supplying the parameter name to scan over it overrules the setting of ISCAN.
OUTPUTFILE ( string)
The name of the main output file. The prompt for the output filename at the beginning of
a GENESIS 1.3 run will be suppressed.
Input Parameters
35
MAGINFILE ( string)
Defines a file, which contains the magnetic field description, bypassing the interactive request
of MAGIN.
MAGOUTFILE ( string)
Defines the file to which the magnetic field lattice is written to, bypassing the interactive
request of MAGOUT.
BEAMFILE ( string)
Specifying a file containing a lookup table for the electron beam parameters at different
position along the bunch.
DISTFILE ( string)
If DISTFILE is defined, the 6d distribution is imported into GENESIS 1.3 and used to load
the phase space. The quiet start algorithm is bypassed.
FIELDFILE ( string)
Defines the file containing the field distribution. The distribution is directly imported into
the arrays, holding the field and the time-records.
PARTFILE ( string)
Defines the file containing the particle distribution. The distribution is directly imported
into the arrays holding the particle variables.
36
The capability of GENESIS 1.3 can widely be extended by additional input and output files.
In total GENESIS 1.3 depends on up to 14 files including such files containing the magnetic
field or a sample phase space distribution of the electron beam.
For all runs the main input file is mandatory. It contains the vast majority of the information
needed to run the simulation. Besides the main output file, which is always created, the main
input files defines, whether additional input and output files are read or written. All output
files except for the magnetic output file, uses the filename of the main output file as the
root for their filenames and appends a three letter filename extension. Input files can have
independent filenames, which are defined in the main input. The main output file and the
magnetic input and output files are not needed to be specified in the input file. GENESIS
prompts for the name if necessary.
Genesis 1.3 has support for different file formats, depending on the programming language
and built of the executable. The original file format is always supported. Input files are
automatically checked for file formats, which are supported by the executable. If GENESIS
1.3 cannot identify any special format, it assumes the original file format and starts processing
the file. The file format of output files are set by the input parameter FILETYPE. Request
for unsupported file formats will cause an error message and the termination of GENESIS
1.3
Besides the principle support of a specific file format, certain input and output files are not
suitable for all file formats. The following table lists all files and the implicit support for
them. The last column is the default filetype of output files for the C++ version of Genesis
if the filetype is not explicitly defined. If that file format is not supported GENESIS 1.3 falls
back to the original file format as default. The FORTRAN default is the original format for
all output files.
It is strongly recommended that the original file format is not used, because it is of all
formats the least platform-independent format. Also if more than one record of the electron
or field distribution is written, the SDDS and HDF5 file formats yield much smaller file sizes.
The XML output is always ASCII and the base64 encoding is not supported.
In the following all individual file are described for the original file format. All other file
formats share the same content of information as the original but might have also additional
information for more self-consistent sets of data files. The differnece and addition for the
other file formats are explained in the last sections of this chapter.
37
38
39
platform and name of the input file, a namelist repeats all input parameters. It is possible
to rerun GENESIS 1.3 with the output file because the header fulfills the requirement of a
valid input file. Still header part several auxiliary parameters are listed which describes the
following data set as well as some information about additional output for the radiation field
and particle distribution (see below). These information can be used by any postprocessor
to correctly read the output files.
The global parameters are mainly the position along the undulator for each output and the
corresponding undulator and quadrupole field at that position.
For each slice an entire table is written containing a header and the main body. The header
lists the slice number, the local current and the column names. In scan mode the current
is replaced by the value of the scan parameter. The data follows directly the header. The
rows correspond to the z-positions given in the block of the global parameters. The size of
the table is controlled by the LOUT parameter.
40
41
While the first point is obvious the second needs some explanation. Because the radiation
slips through several electron slices the time-window of the radiation field must be larger
than the time-window of the simulated electron beam. It is extended by the slippage length
NSLP, which is the number of radiation slices which slips through a single electron beam slice
over the entire undulator length. The length is the undulator length divided by XLAMD and
ZSEP and rounded to the lower integer. The radiation initially seen by the first beam slice
is the NSLP+1 record of the radiation input file. The records between the first and NSLPth
slice are copied in the time-record. During the integration these slices are pushed into the
location of the simulated electron slice. Generally speaking the time window of the radiation
field is shifted forwards with respect to the time window of the electron beam during the
integration. In the case that the second GENESIS 1.3 run uses a longer undulator than
the first run, which dumped the radiation field and beam distribution, the number of beam
slices has to reduced to match the file length of the input radiation field.
Note that Genesis does not check for consistency. The field dump is associated to a certain
grid size and radiation wavelength. If a field is imported for a simulation, where these values
differs, the energy of the field is not conserved.
42
version 1.0 and earlier versions (<1.0). The version number is defined by an information line
in the header of the file. If omitted GENESIS 1.3 assumes a version prior to 1.0.
Each line hast four elements, where the first two are version independent. The first element
is a two-character string, indicating the type of structure. Following types are supported
AW - Main magnetic field
AD - Drift section
QF - Quadrupole strength
QX - Quadrupole offset in x
QY - Quadrupole offset in y
SL - Solenoid strength
CX - Corrector strength in x
CY - Corrector strength in y
Next the strength/offset value of that structure is specified.
For earlier version the next two numbers define the length of the structure. The first of those
is a unit length, common for all structure. Typically it is the undulator period length. The
second number is the length of the structure in measure of the unit length. As an example
the following lines descibe a 1 m long undulator with an rms strength of 1.30:
AW 1.3 2.e-2 50
Note that for a file version < 1.0 the absence of any structure must be included in the input
file as well. The strength/offset value is zero. Thus a two cell FODO lattice with a 4 cm
quadrupole length and a drift length of 8 cm is defined by
QF 2.5e+1 2.e-2 2
QF 0.0e+0 2.e-2 4
QF -2.5e+1 2.e-2 2
QF 0.0e+0 2.e-2 4
QF 2.5e+1 2.e-2 2
QF 0.0e+0 2.e-2 4
QF -2.5e+1 2.e-2 2
QF 0.0e+0 2.e-2 4
43
For the latest version the unit length is declared once in the header of the file and is mandatory. The third number is the length of the structure in measure of the unit length, while
the last number is the distance to the previous element of the same kind, again inmeasure
of the unit length. The definition of the FODO cell becomes now
? VERSION=1.0
? UNITLENGTH=2.e-2
QF 2.5e+1 2 0
QF -2.5e+1 2 4
QF 2.5e+1 2 4
QF -2.5e+1 2 4
The usage of the lines, starting with the question marks, are explainded below. A comment
line is indicated by a -sign as its first character. The remaining content of the line is ignored.
Similar lines, which do not contain any printable characters (spaces excluded) are treated as
comment lines.
A command line starts with an exclamation mark. For the magnetic field only two commands
are recognized. The first command !LOOP = x marks the beginning of a loop where x is
the number of loops to be performed. Note that there can be an arbitrary number of spaces
on both sides of the equal sign as long as the entire line is no longer than 30 characters. The
end of the loop is indicated by !ENDLOOP. Loops cannot be nested and starting a new loop
before the current loop is not closed will cause an error and the termination of GENESIS
1.3. The following lines define the same FODO lattice as above but this time with 10 cells
? VERSION=1.0
? UNITLENGTH=2.e-2
QF 2.5e+1 2 0
! LOOP=9
QF -2.5e+1 2 4
QF 2.5e+1 2 4
! ENDLOOP
QF -2.5e+1 2 4
The last class of input lines is information lines, which helps GENESIS 1.3 to process the file
correctly. These lines have to start with a question mark. One example is to set the version
number with ?VERSION = n.m for compatibility reason, where m.n is the version number.
Currently only versions below 1.0 and below are supported. The remaining other option is
44
setting the unitlength with ? UNITLENGTH = x, where x is the numeric value of the length
in meter. As for the command line spaces can seperate keyword, equal sign and value.
Note that GENESIS 1.3 stops processing a line, once it obtained all needed information.
This allows, also not recommended, to add comments at the end of each line.
45
Besides ZPOS and TPOS, which refers to the position within the bunch, most of the remaining
parameters correspond to the input parameter of the main input file. If BETAX is defined
instead of RXBEAM the beam size is calculated, using the specified beam energy and emittance.
The same is valid for BETAY.
If a time coordinate specifies the position (TPOS) instead of a space coordinate (ZPOS), Genesis
1.3 enforces the convention that time and space coordinate differ with a relative sign. For
the right order in the beam description file the ZPOS values should increment, while the TPOS
should decremnt
The format of the beam description file is similar to the magnetic field input file. All
numbers are given in ASCII format. The input file can contain content lines, comment lines
and information lines. Commands lines are not needed and thus not supported.
Empty lines and lines starting with a #-sign are treated as comment lines. They are ignored
while processing the beam description file.
A question mark indicates an information line. The VERSION-keyword is the same as in the
magnetic field input file, defining the version of the input file. Note that there is a difference
between earlier versions (<1.0) and the current version 1.0 (see below). The SIZE parameter
is optional. It should contain the number of information lines in the input file. At the end of
processing the file GENESIS 1.3 compares the number of valid lines with the number defined
by SIZE and prints out a warning message if the two numbers differs. If no SIZE statement
is included the check is omitted.
The last information keyword is COLUMNS. It controls the number and order of columns in
the beam description file by simply adding the parameter names after the COLUMNS keyword.
Parameters, which are excluded in the beam description file, fall back to their default value,
defined in the main input deck. Omitting the current results in a step profile. The column
ZPOS is mandatory and GENESIS 1.3 with given an error message when it is not specified
in the COLUMN information line. If no COLUMNS-statement is given all input parameter are
required in the order as they appear in the list above.
As an example the following line describes a 100 m long, uniform beam with an energy
chirp of 1% along the beam.
? VERSION=1.0
? SIZE=2
? COLUMNS ZPOS GAMMA0
-50.0e-6 99.5
50.0e-6 100.5
Any version before 1.0 required that the number of input lines, containing the beam parameters, must be listed in the beginning of the file as the first information line before the actual
46
data lines started. To guarantee backwards compatibility this is still valid if the version is
no defined to be 1.0 and the SIZE-statement is omitted. The example above would be then
Again the specified value (here 2) is only used to check with the number of data lines, which
is processed by GENESIS 1.3 without any error.
The beam description file can also be used for a scan (NSCAN = 23,24). Each line correspond
to a run of the scan. The meaning of the ZPOS column becomes obsolete. However it is still
required for a correct parsing of the file.
47
X - position in x in meters
PX or XPRIME - momentum in x normalized to mc or divergence in x, respectively
Y - position in y in meters
PY or YPRIME - momentum in y normalized to mc or divergence in y, respectively
T or Z - longitudinal position in seconds or meters, respectively
P or GAMMA - total momentum or energy, normalized to mc or mcit2 , respectively.
The longitudinal position has to be defined exclusive either to be T or Z. The same is valid for
the other pairs listed above. If not all 6 dimensions are given GENESIS 1.3 will terminate
and report an error message. Note that GENESIS follows the rule that the longitudinal
position is reversed if a time is specified by the T column. In this case smaller numbers
correspond to particle in the tail of the distribution.
The default behavior of GENESIS 1.3 corresponds to the lines:
? VERSION = 0.1
? COLUMNS X PX Y PY T P
Note that with this default behaviour the first data line must be the number of particles (=
information lines) in the distribution file.
48
Has to be written
49
50
GENESIS 1.3
S. Reiche, Numerical Studies for a Single Pass High Gain Free-Electron Laser, DESY
print, DESY-THESIS-2000-012 (2000)
http://pbpl.physics.ucla.edu/genesis (official website)
FEL Basics
E.L. Saldin, E.A. Schneidmiller and M.V.Yurkov, The Physics of Free Electron Lasers,
Springer, (2000)
J.B. Murphy and C. Pellegrini, Introduction to the Physics of the FEL, Proceedings of
the South Padre Island Conference, Springer (1986) 163
Numeric Basics
W.H. Press, S.A. Teukolsky, W.T. Vetterling and B.P. Flannery, Numerical Recipes in
FORTRAN, Cambridge University Press, (1988)
W.F. Ames, Numerical Methods for Partial Differential Equations, Academic Press (1996)
FORTRAN, C++
J.M. Ortega, An Introduction to FORTRAN for Scientific Computing, Oxford University
Press (1994)
B. Stroustrup, C++ Programming Language, Addison-Wesley (1997)
XML, SDDS
M. Birbeck et al., Professional XML, Wrox (2001)
M. Borland, Users Guide for SDDS Toolkit Version 1.20,
http://www.aps.anl.gov/asd/oag/manuals/SDDStoolkit
51