// This is Single EEX beamline for 50 MeV 6D gaussian beam OPTION, PSDUMPFREQ = 50000000; //How often 6d info is dumped to .h5 OPTION, STATDUMPFREQ = 10; //How often beam stats dumped to .stat. OPTION, AUTOPHASE=0; //Always leave this on, unless doing a phase scan OPTION, REPARTFREQ=5; OPTION, VERSION=10900; Title, string="6D Gaussian beam EEX beamline"; // ------------------------------------------------------------------------ // Global Parameters REAL field_maps = 2.0; //Either 2D or 3D field maps REAL rf_freq = 1300.0; //[MHz] RF frequency REAL n_particles = 1e3; //Number of particles in simulation. REAL beam_bunch_charge = 4e-9; //[C] Charge of bunch REAL beam_current = rf_freq*beam_bunch_charge*1e6; //[A] Avg. beam current REAL fs_decomp = 3; // // Injected energy Cal. // REAL Edes = 0.0488; //[GeV] bunch reference energy REAL gamma = (Edes+EMASS)/EMASS; //[] relativistic gamma REAL beta = sqrt(1-(1/gamma^2)); //[] relativistic beta REAL P0 = gamma*beta*EMASS; //[GeV/c] bunch reference momentum value , {Edes, P0}; // Dipole positions REAL beamline_start = 1.0; REAL dipole_x_offset = 0.618744; //[m] x-axis (global) dipole center offset in single dogleg Note: beam bends in negitive direction REAL dipole_z_offset = 1.69926; //[m] z-axis (global) dipole center offset in single dogleg REAL dipole_to_TCAV = 0.995578; //[m] z-axis (global) dipole center to TCAV center REAL dogleg_to_dogleg = 1.710944; //[m] z-axis (global) dipole to dipole center between doglegs REAL EEX_to_EEX = 2.0; //[m] central distance between EEX lines REAL bend_angle = ATAN(dipole_x_offset/dipole_z_offset); REAL bend_radius = 0.78913; //Element Properties REAL dipole_length = 0.27; REAL dipole_Edes = Edes*1e3; //[MeV] Necessary conversion for dipole def REAL TCAV_length = 0.47903; //Element Floor Coordinates VECTOR B1_ORG = {0.0,0.0,beamline_start}; VECTOR B2_ORG = B1_ORG + {dipole_x_offset,0.0,dipole_z_offset}; //Wakefield Properties FFT_FILTER:FILTER, TYPE="FixedFFTLowPass",NFREQ = 20; CSR_WAKE:WAKE, TYPE="1D-CSR",NBIN=50,FILTERS=FFT_FILTER; value, {dipole_x_offset, dipole_z_offset}; //-------------------------------------------------------------------------------- //DEEX dipole // // L: Effective Length of magnet (m). // Gap: Gap size of magnet (m). // ANGLE: bend angle in radians // FMAPFN: A file with coefficients for the fringe field (default is provided by OPAL) // DESIGNENERGY: Energy you want to bend // First EEX B1: RBend, ANGLE = bend_angle, Z = beamline_start, PSI = PI, HAPERT = 0.1, FMAPFN = "hard_edge_map.txt", //WAKEF = CSR_WAKE, DESIGNENERGY = dipole_Edes,L = dipole_length, GAP = 0.1; B2: RBend, ANGLE = bend_angle, Z = beamline_start + dipole_z_offset, X = dipole_x_offset - (1.0 - cos(bend_angle)) * bend_radius, // THETA = bend_angle, E1 = bend_angle, FMAPFN = "hard_edge_map.txt", //WAKEF = CSR_WAKE, HAPERT = 0.1, DESIGNENERGY = dipole_Edes,L = dipole_length, GAP = 0.1; //------------------------------------------------------------------------------------- // DEFINE BEAM LINE DEEX: Line = (B1,B2); //------------------------------------------------------------------------------------- // INITIAL DISTRIBUTION: FLATTOP // // SIGMAX/Y: RMS radius of transverse (m). // TRISE/FALL: Rise time and fall time of longitudinal guassian (s). // TPULSEFWHM: FWHM of longitudinal guassian (s). // CUTOFFLONG: Longitudinal cuttoff in units of sigma. // NBIN: Number of energy bins to use during emission. // DEBIN: Min energy band for a bin in KeV. Defines when to combine bins. // EMISSIONMODEL: NOEQUIL emission mode simulates photoinjector. // EMISSIONSTEPS: Number of steps during emission. // Emission time step is adjusted to fit this number. // EKIN: Kinetic energy of electrons at emission (eV). Used for emission model. // ELASER: Energy of laser (eV). Used for NONEQUIL mode. // W: Photocathode work function (eV). Used for NONEQUIL mode. // FE: Fermi energy of photocathode (eV). Used for NONEQUIL mode. // CATHTEMP: Temperature of photocathode (K). Used for NONEQUIL mode. //NOTE: Transvers size of laser profile is equal to SIGMAX/Y // TRISE/FALL = 1.6869*simgar // Sigmar = FWHM / 2.35 //Dist: DISTRIBUTION, DISTRIBUTION = fromfile, FNAME="N5.dat"; Dist: DISTRIBUTION, TYPE = GAUSS, SIGMAX = 0.001, SIGMAY = 0.001, SIGMAZ = 0.001, SIGMAPX = 0.001, SIGMAPY = 0.001, SIGMAPZ = 1.0, CUTOFFLONG = 3, NBIN = 100, WRITETOFILE = True; //NOTE: FWHM pulse width divided by emission steps gives the time step for the // emissions process. i.e 2e-12 / 100 gives a time step of 0.2e-13 (s) // during emission.This is the not the same as the time step used in rest of the file. //------------------------------------------------------------------------------------- // Define Field solvers // The mesh sizes should be a factor of 2 for most efficient space charge (SC) calculation. if (fs_decomp == 1.0){ BOOL decx = true; BOOL decy = true; BOOL decz = false; } else if (fs_decomp == 2.0){ BOOL decx = false; BOOL decy = false; BOOL decz = true; } else if (fs_decomp == 3.0){ BOOL decx = true; BOOL decy = true; BOOL decz = true; } FS_SC: Fieldsolver, FSTYPE = NONE, MX = 16,MY = 16,MT = 32, //MX = 8, MY = 8, MT = 16, //MX = 1, MY = 1, MT = 1, PARFFTX = true, PARFFTY = true, PARFFTT = true, BCFFTX = open, BCFFTY = open, BCFFTT = open, BBOXINCR = 1, GREENSF = INTEGRATED; //------------------------------------------------------------------------------------- // Beam Definition BEAM1: BEAM, PARTICLE = ELECTRON, pc = P0, NPART = n_particles, BFREQ = rf_freq, BCURRENT = beam_current, CHARGE = -1; //------------------------------------------------------------------------------------- // Run beamline // Run to some specified distance. // LINE: The combination of elements defined earlier. // BEAM: Beam defined earlier, tells what kind of particles and charge. // MAXSTEPS: Sets a boundary on the number of simulation steps. This should be a large number. // DT: time steps you want to use through out the beam line. // ZSTOP: tells opal when to switch between time steps, and what Z location to run to. REAL DRF = 1e-12; REAL DIP = 0.05e-12; REAL L_FR = 0.3; TRACK, LINE = DEEX, BEAM = BEAM1, MAXSTEPS = 1900000, DT ={DRF,DIP,DRF,DIP,DRF}, ZSTOP = {B1_ORG[3]-L_FR, B1_ORG[3]+dipole_length+L_FR, B2_ORG[3]-L_FR, B2_ORG[3]+dipole_length+L_FR, B2_ORG[3]+dipole_length+L_FR+0.5}; RUN, METHOD = "PARALLEL-T", BEAM = BEAM1, FIELDSOLVER = FS_SC, DISTRIBUTION = Dist; ENDTRACK; Stop; Quit;