OPTION, PSDUMPFREQ = 100; // 6d data written every 300 time steps (h5). OPTION, STATDUMPFREQ = 10; // Beam Stats written every 10 time steps (stat). OPTION, BOUNDPDESTROYFQ=10; // Delete lost particles, if any OPTION, AUTOPHASE = 4; // Autophase is on, and phase of max energy // gain will be found automatically for cavities. Option, VERSION = 20000; Title, string="LINAC v1"; //---------------------------------------------------------------------------- //Global Parameters REAL rf_freq = 2856e6;// RF frequency in Hz not MHZ! 2856; //RF frequency (MHz) REAL n_particles = 5E4; //Number of particles in simulation. REAL beam_bunch_charge = 0.33/rf_freq; //Charge of bunch. (C) //Initial Momentum Calculation REAL Edes = 10e-12*beam_bunch_charge*6.242e18; //initial energy in GeV REAL gamma = (Edes+EMASS)/EMASS; REAL beta = sqrt(1-(1/gamma^2)); REAL P0 = gamma*beta*EMASS; //initial z momentum //Printing initial energy and momentum to terminal output. value , {Edes, P0, OPALVERSION}; // //---------------------------------------------------------------------------- // HDR LINAC Cavities // // 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: file name, or full path name to file (string) // ELEMEDGE: physical start of the element on the floor (m) // TYPE: specifies "STANDING", "TRAVELLING" or "SINGLE GAP" structure // FREQ: RF frequency of cavity (real in MHz). Resonance frequency. // LAG: cavity phase (radians) // REAL gun_inj_phase = 0.0; // Rf injection phase (in degrees) with restpect // to max phase. i.e. 0.0 inj phase corresponds // to running on crest (max energy). BUNCHERCAV: RFCavity, L = 2.32400e-02, VOLT = 10, ELEMEDGE = 0, TYPE = "STANDING", FMAPFN = "FMapEB1D1.dat", FREQ = 2856, LAG = (gun_inj_phase*Pi)/180.0; //LAG (phase) is converted to radians CAV1: RFCavity, L = 4.648e-02, VOLT = 12, ELEMEDGE = 2.3248e-02, TYPE = "STANDING", FMAPFN = "FMapEB1D2.dat", FREQ = 2856, LAG = Pi; CENTCAV: RFCavity, L = 5.247e-02, VOLT = 12, ELEMEDGE = 6.9730e-02, TYPE = "STANDING", FMAPFN = "FMapEB1D3.dat", FREQ = 2856, LAG = 0; CAV2: RFCavity, L = 5.247e-02, VOLT = 12, ELEMEDGE = 1.2120e-01, TYPE = "STANDING", FMAPFN = "FMapEB1D4.dat", FREQ = 2856, LAG = Pi; LASTCAV: RFCavity, L = 6.231e-02, VOLT = 12, ELEMEDGE = 1.737e-01, TYPE = "STANDING", FMAPFN = "FMapEB1D5.dat", FREQ = 2856, LAG = 0; //---------------------------------------------------------------------------- // DEFINE BEAM LINE GS: Line = (BUNCHERCAV, CAV1, CENTCAV, CAV2, LASTCAV); //GS: Line = (BUNCHERCAV); // Complete accelerator DRIVE: Line = (GS); //---------------------------------------------------------------------------- // INITIAL DISTRIBUTION // // Flattop distribution. // SIGMAX/Y: RMS radius of transverse beam size (Laser radius in m). // TRISE/FALL: Rise time/fall time in longitudinal direction (s). // TPULSEFWHM: FWHM in longitudinal direction (s). // CUTOFFLONG: Longitudinal cuttoff in units of sigma. // NBIN: Number of energy bins to use during emission. // DEBIN: Defines when to combine bins (Min energy difference in KeV). // EMISSIONSTEPS: Number of steps during emssion. // Emission time step is adjusted to fit this number. // EKIN: Kinetic energy of electrons at emission (eV). // ELASER: Energy of laser (eV). // W: Photocathode work functioin (eV). // FE: Fermi energy of photocathode (eV). // CATHTEMP: Operating temperature of photocathode (K). // Note, ELASER, W, FE, and CATHTEMP are used for the NONEQUIL emission model. // These values are not necessary when using other models. Dist: DISTRIBUTION, TYPE = FLATTOP, SIGMAR = 4e-03, TRISE = 0.25e-6, TFALL = 0.25e-6, TPULSEFWHM = 4.5e-6, //CUTOFFLONG = 0.5, NBIN = 9, //EKIN = 0.55, EMITTED = False, WRITETOFILE = True; //Saves the distribution to a text file // Note on emission time step: FWHM pulse width divided by emission // steps gives the time step for the emissions process. // i.e 20.0e-12 / 100 gives a time step of 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 calculation. FS_SC: Fieldsolver, FSTYPE = FFT, MX = 32, MY = 32, MT = 32, // SC grid size is 32^3 PARFFTX = false, PARFFTY = false, PARFFTT = true, // parallel in the z direction only BCFFTX = open, BCFFTY = open, BCFFTT = open, BBOXINCR = 1, GREENSF = INTEGRATED; //---------------------------------------------------------------------------- // Electron Beam Definition BEAM1: BEAM, PARTICLE = ELECTRON, pc = P0, NPART = n_particles, BFREQ = rf_freq, BCURRENT = 0.33, CHARGE = -1; //beam_bunch_charge * rf_freq, CHARGE = -1; // //---------------------------------------------------------------------------- // Simulate the beamline using TRACK and RUN. // Note, different time steps are set based on the z location in the beam line. // In the case below, 1.0e-13 is used for 0.0 to 2.324e-02 m, // and 3.0e-12 is used from 2.324e-02e-01 to 2.5e-01 m. TRACK, LINE = DRIVE, BEAM = BEAM1, MAXSTEPS = 1900000, DT = 1e-13, ZSTART = 0.0, ZSTOP = 0.5; RUN, METHOD = "PARALLEL-T", BEAM = BEAM1, FIELDSOLVER = FS_SC, DISTRIBUTION = Dist; ENDTRACK; Stop; Quit;