OPTION, ECHO=FALSE; OPTION, INFO=FALSE; //psdump and statdump are in time steps OPTION, PSDUMPFREQ = 300; //How often 6d info is dumped to .h5 OPTION, STATDUMPFREQ = 10; //How often beam stats dumped to .stat. OPTION, BOUNDPDESTROYFQ=10; //Delete lost particles, if any OPTION, AUTOPHASE=4; OPTION, SCAN = TRUE; Title, string="AWA Drive Beamline"; //------------------------------------------------------------------------ // Global Parameters q_e = 1.60217653e-19; // Charge of electrons. (C) e_mass = 9.10938188e-31; // Mass of electrons. (kg) rf_freq = 1.3e9; //RF frequency. (Hz) rf_period = 1.0 / rf_freq; //Rf period. (s) rf_wavelength = clight / rf_freq; //Rf wavelength. (m) rf_degree_time = rf_period / 360.0; //Time of 1 degree of phase. (s) n_particles = 1.0e5; //Number of particles in simulation. beam_bunch_charge = 1e-9; //Charge of bunch. (C) //Initial energy Calc Edes = 1.4e-9; gamma = (Edes+EMASS)/EMASS; beta = sqrt(1-(1/gamma^2)); P0 = gamma*beta*EMASS; value , {Edes, P0}; //------------------------------------------------------------------------------------- // // Gun // // Cavity/RF field. // // L: physical element length (real in m). Length (of field map) (m). // VOLT: field scaling factor (real). RF field magnitude (MV/m). // FMAPFN: field file name (string) // ELEMEDGE: physical start of the element on the floor (real in m) // TYPE: specifies "STANDING" (default), "TRAVELLING" or "SINGLE GAP" structure // FREQ: RF frequency of cavity (real in MHz). Resonance frequency. // LAG: cavity phase (radians) // gun_inj_phase = 6.0; // Rf injection phase with restpect to max phase. GUN: RFCavity, L = 0.2927, VOLT = 60.0, ELEMEDGE = 0.0, TYPE = "STANDING", FMAPFN = "/lcrc/project/AWA-beam-dynamics/FieldFiles/DriveFiles/DriveGun.T7", FREQ = 1300.0, LAG = (gun_inj_phase*Pi)/180.0; //------------------------------------------------------------------------------------- // Solenoids // // L: Physcial element length (m) // ELEMEDGE: Physcial start of element (m) // KS: Solenoid strength (Rad/m) // FMAPFM: Field file (string) // Buck Focusing Solenoid // Max value in BF file = 0.162544398 // I usually run this magnet at 90%-100% // BF: Solenoid, L = 0.5, ELEMEDGE=0.0, KS = 0.162544, FMAPFN = "/lcrc/project/AWA-beam-dynamics/FieldFiles/DriveFiles/BF_550.T7"; // Matching Solenoid // Max value in M file = 1.973966 // Conversion from Current (I) to Scaling factor: // Scaling Factor = (I / Imax) * 1.973966 // // Where Imax for the Matching solenoid = 440 [A] // //I = 255; //------------------------------------------------------------------------------------- // Linacs linac_L = 1.20713; // Length of Linac // NOTE: The physical start of the linac 1 is 0.65 m. However, the field map is // longer than the actual cavity. The measured length is 1.05 m. The // field map is 1.266 m. So dividing the difference, 0.216, by two, // tells us that we must start (0.65-0.108 =) at position 0.54 m. // This method is used for all linacs. L1: RFCavity, L = linac_L, VOLT = 25.0, ELEMEDGE = 0.575, TYPE = "STANDING", FMAPFN = "/lcrc/project/AWA-beam-dynamics/FieldFiles/DriveFiles/DriveLinac.T7", FREQ = 1300.359869, LAG = (0.0) * Pi / 180.0; //Drift Space Before Quads~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ //DR1: DRIFT, L = 0.075, ELEMEDGE = 0.5; //------------------------------------------------------------------------------------- // INITIAL DISTRIBUTION // // Gaussian distribution. // SIGMAX/Y: RMS radius of transverse guassian (m). // CUTOFFX/Y: Radial cut off of guassian sigmax/y. // 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. Definies when to combine bins. // EMISSIONSTEPS: Number of steps during emssion. 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 emission mode. // W: Photocathode work functioin (eV). Used for NONEQUIL emission mode. // FE: Fermi energy of photocathode (eV). Used for NONEQUIL emission mode. // CATHTEMP: Operating temperature of photocathode (K). Used for NONEQUIL emission mode. //NOTE: Transvers size of laser profile is equal to SIGMAX/Y // TRISE/FALL = 1.6869*simgar // Sigmar = FWHM / 2.35 Dist: DISTRIBUTION, DISTRIBUTION = FLATTOP, SIGMAX = 0.00075, // RMS radius in (m) that will get cut SIGMAY = 0.00075, TRISE = 2.0e-12, // (s) TFALL = 2.0e-12, // See notes above for equation of TRISE TPULSEFWHM = 22.0e-12, // FWHM length in time (s) CUTOFFLONG = 4.0, NBIN = 9, DEBIN = 1, EMISSIONSTEPS = 100, EMISSIONMODEL = NONEQUIL, EKIN = 0.2, ELASER = 5.0, W = 3.2, FE = 3.2, CATHTEMP = 321.95, EMITTED = True, WRITETOFILE = False; //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. MINSTEPFORREBIN = 150; FS_SC: Fieldsolver, FSTYPE = FFT, MX = 32, MY = 32, MT = 32, PARFFTX = false, PARFFTY = false, PARFFTT = true, BCFFTX = open, BCFFTY = open, BCFFTT = open, BBOXINCR = 1, GREENSF = INTEGRATED; //------------------------------------------------------------------------------------- I = 200; WHILE (I < 220 ) { SF = (I/440)*1.973966; M: Solenoid, L = 0.5, ELEMEDGE=0.0, KS = SF, FMAPFN = "/lcrc/project/AWA-beam-dynamics/FieldFiles/DriveFiles/M_440.T7"; //------------------------------------------------------------------------------------- // DEFINE BEAM LINE GS: Line = (GUN, BF, M); LINACS: Line = (L1); //Complete accelerator DRIVE: Line = (GS, LINACS); //------------------------------------------------------------------------------------- // Beam Definition BEAM1: BEAM, PARTICLE = ELECTRON, pc = P0, NPART = n_particles, BFREQ = rf_freq, BCURRENT = beam_bunch_charge * rf_freq, CHARGE = -1; // Run beamline TRACK, LINE = DRIVE, BEAM = BEAM1, MAXSTEPS = 1900000, DT = {2.0e-13}, ZSTOP={0.1}; RUN, METHOD = "PARALLEL-T", BEAM = BEAM1, FIELDSOLVER = FS_SC, DISTRIBUTION = Dist; ENDTRACK; value, {I}; SYSTEM, CMD="mkdir -vp scanM"&STRING(I); SYSTEM, CMD="mv -vn 1nC22FWHM2TRTFM.h5 scanM"&STRING(I); SYSTEM, CMD="mv -vn 1nC22FWHM2TRTFM.stat scanM"&STRING(I); I=EVAL(I+10.0); value , {I, SF}; } Stop; Quit;