16.6cm -2.8cm -2.8cm parameternote begin {}note--note noteend parameterlist begin {} 60pt 60pt end August 20, 1996 EEEELLLLFFFFIIIINNNN UUUUsssseeeerrrrssss MMMMaaaannnnuuuuaaaallll Takeshi Nakamura SPring-8 Kamigori-cho, Ako-gun, Hyogo 678-12 JAPAN nakamura@spring8.or.jp ELFIN is the code which simulates three dimensional time-independent free electron lasers. ELFIN assume input and output are standard input and standard output, respectively. To run ELFIN with 'inputfile' for input and 'outputfile' for output type _1. _S_t_r_u_c_t_u_r_e _o_f _I_n_p_u_t _F_i_l_e_s A input file is composed of three parts. Those are .IP o+ 2 Part 1 : Numerical constants. The numerical constants used in ELFIN are defined. Those are the number of grid points and the number of superpar- ticles. .IP o+ 2 Part 2 : A configuration of an FEL system. The configuration of the FEL system is defined. This is the list of names of elements which the component an FEL system, such as amplifiers, mirrors, free spaces for the laser field, etc. .IP o+ 2 Part 3 : The definitions of element Elements used in part 2 are defined with their parameters. For example, if the element name 'FELAMP' is used in part 2 as an FEL amplifier, then in part 3, the element 'FELAMP' should has type 'FEL' which is an FEL amplifier. The parameters for the FEL amplifier 'FELAMP', such as length, period, strength of the wiggler, are also given in this part. The strings written with typewriting characters are a part of an input file. Input files are read with list input READ(*,*) in Fortran77. COMMENT is a line which ELFIN ignores. Hence this line can be used as comment lines. _2. _P_a_r_t _1 : _N_u_m_e_r_i_c_a_l _c_o_n_s_t_a_n_t_s The numerical constants are defined. Those are the number of grid points in a transverse space (x,y) and the number of superparticles which are used instead of a huge number of electrons in real FEL systems. _2._1. _F_o_r_m_a_t COMMENT COMMENT Na Np _2._2. _P_a_r_a_m_e_t_e_r_s _a_n_d _V_a_r_i_a_b_l_e _T_y_p_e_s INTEGER ELFIN uses Na Na square grid points in the transverse space (x,y). Na must be 2^n where n is positive integer, and must not exceed the value nam which is defined in the file paramsv.inc. INTEGER The number of superparticles. This value must not exceed the value npm which is defined in the file paramsv.inc. If users want to change nam and npm , change the values nam and npm in the file 'paramsv.inc' and complile ELFIN. _3. _P_a_r_t _2 : _C_o_n_f_i_g_u_r_a_t_i_o_n _o_f _a_n _F_E_L _s_y_s_t_e_m The configuration of an FEL system is defined. .NH 2 Format COMMENT COMMENT Nrep COMMENT COMMENT 'name1 name2 name3 ... ' _3._1. _P_a_r_a_m_e_t_e_r_s _a_n_d _V_a_r_i_a_b_l_e _T_y_p_e INTEGER If there exist BEGIN and END in the configuration list shown below, ELFIN repeats the elements between them Nrep times. This can be used in a case for oscillators. CHARACTER*1024 The list of element names which compose an FEL system. The order of the element names is along the propagation of the laser field and the electron beam. This list is read as single string which surrounded with Each element name is delimited with spaces. The length of element names must be less than 6 characters. The last element name in the list must be of the type TERM ELFIN notices that this element is the last element in the list. _4. _P_a_r_t _3 : _D_e_f_i_n_i_t_i_o_n_s _o_f _T_y_p_e_s _a_n_d _P_a_r_a_m_e_t_e_r_s _f_o_r _E_l_e_m_e_n_t_s For each element name used in part 2, its type and parameters are defined. The type of the last element in this part must be TERM The order of the name is not restricted except the type TERM Each definition of elements has the format below. _4._1. _F_o_r_m_a_t COMMENT COMMENT 'name' 'type' COMMENT COMMENT parameter11 parameter12 ... COMMENT COMMENT parameter21 parameter22 ... . . . _4._2. _P_a_r_a_m_e_t_e_r_s _a_n_d _V_a_r_i_a_b_l_e _T_y_p_e CHARACTER*6 a name of the element CHARACTER*6 a type of the element data type is depends on parameter parameters for the element _5. _T_y_p_e_s _a_n_d _P_a_r_a_m_e_t_e_r_s _o_f _E_l_e_m_e_n_t_s The types which can be used in part3 are listed below. tab(&); L L . FEL A free electron laser amplifier ESOURC An electron source which creates superparticles AINIT An initial laser field AFREE,ADRIFT A free space for a laser field MIRROR A mirror EDRIFT A drift space for an electron beam TERM Terminator of the element list The formats for the parameters of these types are mentioned below. ELFIN uses SI units for the parameters. The widths of calculation areas of the elements which are neighborhood each other must have the same values. _6. _T_y_p_e : _F_E_L A free electron laser amplifier is simulated. The output is the laser power, gain and the histogram of the laser field and the electron beam. _6._1. _F_o_r_m_a_t ================================================================================ 'Name' 'FEL' -------------------------------------------------------------------------------- Width -------------------------------------------------------------------------------- <# of sampling to z axis> <# of steps to z axis> Nsmp Nz ---------wiggler parameters----------------------------------------------------- Length lw (Re(aw0),Im(aw0)) (Re(hx),Im(hx)) (Re(hy),Im(hy)) WigType -------------------------------------------------------------------------------- ---------------- WigNum wigpar(1) wigpar(2) wigpar(3) wigpar(4) -------Spatial filter parameter------------------------------------------------- <# of times of splining> fltwid Nspln -------- Laser Field ----------->|<---- Particles ---------------------------- -------|-------- ahswx ahswy ameswx ameswy phswx phswy parsw _6._2. _A_b_o_u_t _P_a_r_a_m_e_t_e_r_s REAL Width of the calculation area [m] in (x,y) space. INTEGER Sampling step to output. ELFIN outputs every Nz / Nsmp step. INTEGER The number of step to divide an FEL system along z axis. The wiggler is equally divided to N_z peacies. REAL The length of the wiggler [m]. REAL The Period of the wiggler [m]. COMPLEX The amplitude of a complex dimensionless vector potential of the wiggler ( 99.8 B_W[T](r.m.s.)_L[m] ). For an usual wiggler, Im(aw0) = 0. REAL The coefficient of the x dependence of the wiggler field [m^-1]. REAL The coefficient of the y dependence of the wiggler field [m^-1]. CHARACTER*6 A type of the wiggler For the static field wiggler, it is set to be and for an electromagnetic wiggler, it is set to be INTEGER It is used to specify which subroutine for a wiggler field is to be used in this element. In this version, an usual planer wiggler is assigned to be 1. REAL Data for wigglers. Users can use these data in their own subroutine for a wiggler specified in WigNum REAL The width for a spatial filtering [m] . INTEGER The order of the splining of the spatial filtering. INTEGER Switches to control the output of the histograms of the strength of the laser field along the x axis and the y axis,respectively. 1 is on and 0 is off. INTEGER Switches to contorol numerical output of the laser field along the x axis and the y axis , respectively. 1 is on and 0 is off. INTEGER Switches to control the histogram of the distribution of the particles along the x axis and the y axis, respectively. 1 is on and 0 is off. INTEGER Switch to controls numerical output of the parameters of the parti- cles. 1 is on and 0 is off. _6._3. _A_b_o_u_t _P_a_r_a_m_e_t_e_r_s o+ aw0 , hx , hy It is assumed that the dimensionless vector potential of the wiggler field has the form of a_W(x,y,z) = a_W0(1 + 12h_x^2 x^2 + 12h_y^2 y^2 ) o+ fltwid , Nspln fltwid is the size for the spatial filtering which is applied to the laser field at each step. Nspln is the order of splining at the spatial filtering. The spatial filtering is off. if fltwid is larger than width or Nspln is 0, WigNum : user subroutine wiggl# and bexf# is called for the wiggler and the external magnetic field, respectively. # is the number specified by WigNum. For example, if t Wignum = 1, then subroutines wiggl1 and bexf1 is called and wiggl1 and bexf1 are preinstalled in ELFIN as a planer and constant field undulator and no exteranl magnetic field. _7. _T_y_p_e : _E_S_O_U_R_C An initial electron beam is simulated. This module generate superparticles according to the assumed distribution. ELFIN treats small number of the superparticles instead of huge number of the real electrons which interact with the laser field in actual FEL because of the limitation of cpu time and memory. .NH 2 Format ================================================================================ 'Name' 'ESOURC' -------------------------------------------------------------------------------- icurr -------------------------------------------------------------------------------- gmave0 gmspd0 gmdst -------------------------------------------------------------------------------- xpave0 xpspd0 bxave0 bxspd0 -------------------------------------------------------------------------------- ypave0 ypspd0 byave0 byspd0 trsdst -------------------------------------------------------------------------------- <# of points on zeta axis> NL -------------------------------------------------------------------------------- parnr nrupdt -------------------------------------------------------------------------------- sptfct _7._1. _P_a_r_a_m_e_t_e_r_s _a_n_d _V_a_r_i_a_b_l_e _T_y_p_e REAL The peak current[A] of the electron beam. REAL The average of . REAL The spread of . REAL The form of the distribution of . REAL The average of x [m]. REAL The spread of y [m]. REAL The average of _x. REAL The spread of _x. REAL The average of y [m]. REAL The spread of y [m]. REAL The average of _x. REAL The spread of _y. REAL The distribution form of (x,_x,y,_y) INTEGER The number of the points in space to place the superparticles. INTEGER The seed for random number generations. INTEGER The switch which specifies if the random series is reset with the seed defined with parnr , when this element was called. REAL Set to be 0 on usual usage. _7._2. _A_b_o_u_t _P_a_r_a_m_e_t_e_r_s and _x, _y are the Lorents factor of the electron beam. .RS o+ gmdst , trdst They specify the distribution form of and (x,_x,y,_y), respec- tively. If they are set to 0 then the distribution is aumed to be Gaussian and gmspd0 , xpspd0 , ypspd0 , bxspd0 , byspd0 are root mean squares. If they are set to be positive values, then the distribution form is assumed to be f(x,_x,y,_y) dx d_xdy d_y = N_n (-B^n) dx d_xdy d_y B= ( x-x_x )^2 + ( _x-_x__x )^2 + ( y-y_y )^2 + ( _y-_y__y )^2 . The values of gmspd0 , xpspd0 , ypspd0 , bxspd0 , byspd0 are _x, __x, _y, __y. If they are set to -1, then the distribu- tion is uniform in 4-dimensional sphere. In this case, gmspd0 , xpspd0 , ypspd0 , bxspd0 , byspd0 is the values of the crossing point of the sphere at each axis. If they are set to -2, the distribution is uniform in |x| < x_bound and x_bound are gmspd0 , xpspd0 , ypspd0 , bxspd0 , byspd0 for each directions. .IP o+ 2 gmspd0 , xpspd0 , ypspd0 , bxspd0 , byspd0 The parameters which define the scale of the distribution for each axis, respectively. o+ parnr The random seed which is used to generate superparticles. o+ nrupdt If parnr is set to 0 then this element reset the random series with the seed parnr but if parnr is set to 1, then this element does not update the random series and uses the next value of this series. .NH 1 Type : AINIT An initial laser field is generated. This element assumes the laser field to be Gaussian( TEM_00 mode). _7._3. _F_o_r_m_a_t ================================================================================ 'Name' 'AINIT' -------------------------------------------------------------------------------- width -------------------------------------------------------------------------------- --------- ll Pin w0 lfa _7._4. _P_a_r_a_m_e_t_e_r_s _a_n_d _V_a_r_i_a_b_l_e _T_y_p_e_s REAL The width[m] of the calculation area in (x,y) space. REAL The wave length of the laser field [m]. REAL The input power of the laser field [W]. REAL The waist size of the laser field when it propagates in free space. This define the width of 1/e point of the laser field [m]. REAL The distance to the waist point in free space [m]. _8. _T_y_p_e : _M_I_R_R_O_R A reflection of a laser field by a circular spherical mirror is simulated. _8._1. _F_o_r_m_a_t ================================================================================ 'Name' 'MIRROR' -------------------------------------------------------------------------------- width ------------------ Mirror parameter----------------------------------------------- -------- - --- Diam Rho Ref ThetaX ThetaY DeltaX DeltaY _8._2. _P_a_r_a_m_e_t_e_r_s _a_n_d _V_a_r_i_a_b_l_e _T_y_p_e REAL The width[m] of the calculation area in (x,y) space. REAL The diameter of the mirror [m]. REAL The curvature of the mirror [m]. REAL The reflectance of the mirror. REAL The x component of the normal vector of the mirror axis. REAL The y component of the normal vector of the mirror axis. REAL The shift of the mirror center to x direction [m]. REAL The shift of the mirror center to y direction [m]. _9. _T_y_p_e : _A_F_R_E_E A free space for a laser field is simulated. _9._1. _F_o_r_m_a_t ================================================================================ 'Name' 'AFREE' -------------------------------------------------------------------------------- Width_In Width_Out -------------------------------------------------------------------------------- Length _9._2. _P_a_r_a_m_e_t_e_r_s _a_n_d _V_a_r_i_a_b_l_e _T_y_p_e REAL The width of the calculation area at the entrance to the drift space [m]. REAL The width of the calculation area at the exit from drift space [m]. REAL The length of the drift space [m]. _1_0. _T_y_p_e : _A_D_R_I_F_T A drift space for a laser field is simulated. Completely same as type AFREE except differece of names of types. _1_0._1. _F_o_r_m_a_t ================================================================================ 'Name' 'ADRIFT' -------------------------------------------------------------------------------- Width_In Width_Out -------------------------------------------------------------------------------- Length _1_0._2. _P_a_r_a_m_e_t_e_r_s _a_n_d _V_a_r_i_a_b_l_e _T_y_p_e REAL The width of the calculation area at the entrance to the drift space [m]. REAL The width of the calculation area at the exit from drift space [m]. REAL The length of the drift space [m]. _1_1. _T_y_p_e : _E_D_R_I_F_T A drift space for electrons is simulated. _1_1._1. _F_o_r_m_a_t ================================================================================ 'Name' 'EDRIFT' -------------------------------------------------------------------------------- Length _1_1._2. _P_a_r_a_m_e_t_e_r_s _a_n_d _V_a_r_i_a_b_l_e _T_y_p_e REAL The length of drift space [m]. _1_2. _T_y_p_e : _D_S_P_S_C_T A dispersive section for bunching like used in optical klystrons. _1_2._1. _F_o_r_m_a_t ================================================================================ 'Name' 'DSPSCT' -------------------------------------------------------------------------------- Width_In Width_Out -------------------------------------------------------------------------------- Length Lengthd REAL The width of the calculation area at the entrance to the dispersive section [m]. REAL The width of the calculation area at the exit from the dispersive section [m]. REAL The physicsl length of the dispersive section [m]. REAL The effective length of the dispersive section [m]. LengthD is related to , the difference of the phase of a laser between the entrance and the exit of the dispersive section. If we use L_d for LengthD, is = k_L (L_d - cv L_d) = -k_L L_d2^2 and if we define N_d as = -2 N_d then N_d= k_L L_d4 ^2 _1_2._2. _P_a_r_a_m_e_t_e_r_s _a_n_d _V_a_r_i_a_b_l_e _T_y_p_e REAL The length of drift space [m]. _1_3. _t_y_p_e : _T_E_R_M This shows ELFIN that this is the last element of the list of elements which defined in part 2. This also shows ELFIN that this is the end of part 3. _1_3._1. _F_o_r_m_a_t ================================================================================ 'Name' 'TERM' _1_4. _U_S_E_R _R_O_U_T_I_N_E_S Users can integrate your subroutine to ELFIN. and sample subroutines are pre-installed in ELFIN. The type of a sample user element is 'new'. Assume that the element name for a sample element is 'newname'. The parameters for the element 'newname' are read from file with the soubroutine 'innew' then these data are saved to a buffer for element name 'newname' with subroutine 'ptnew'. When this element was called in main with call rnnew' with element name 'new', then rnnew call gtnew first to load data from the buffer for element name 'new' then the data was passwd to subroutine new which is the main routine of element type new. new runs with the data for element name 'new'.