Commit a1f73587 authored by kraus's avatar kraus
Browse files

adding AWAGun-TrackBack-1 test

parent c7793cbc
OPTION, PSDUMPFREQ = 300000; // 6d data written every 300000 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=10900;
Title, string="AWA Photoinjector";
//----------------------------------------------------------------------------
//Global Parameters
REAL rf_freq = 1.3e3; //RF frequency. (Hz)
REAL n_particles = 1E4; //Number of particles in simulation.
REAL beam_bunch_charge = 1e-9; //Charge of bunch. (C)
//Initial Momentum Calculation
REAL Edes = 1.4e-9; //initial energy in GeV
REAL gamma = (Edes+EMASS)/EMASS;
REAL beta = sqrt(1-(1/gamma^2));
REAL P0 = gamma*beta*EMASS; //inital z momentum
//Printing initial energy and momentum to terminal output.
value , {Edes, P0, OPALVERSION};
//----------------------------------------------------------------------------
// RF photoinjector (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: 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).
GUNSOURCE: SOURCE, ELEMEDGE = 0.0;
GUN: RFCavity, L = 0.2927, VOLT = 60.0, ELEMEDGE = 0.0, TYPE = "STANDING",
FMAPFN = "DriveGun.T7", FREQ = rf_freq, LAG = (gun_inj_phase*Pi)/180.0;
//LAG (phase) is converted to radians
//----------------------------------------------------------------------------
// Solenoids
//
// L: Physcial element length (m)
// ELEMEDGE: Physcial start of element (m)
// KS: Solenoid strength (Rad/m)
// FMAPFM: Field file (string)
// Note: OPAL scales the field file based on the max magnetic
// field value in the file, not Bz on axis. The max field
// value is normalized to 1 [T], and scaled with KS.
// i.e. The max value in the BF_559 file = 0.162544398 [T].
// Therefore, setting KS = 0.162544398 runs the magnet at max current.
REAL KSBF = 0.162544398;
if (OPALVERSION>10500)
KSBF = KSBF/1.3528;
// Buck and Focusing Solenoid
BF: Solenoid, L = 0.5, ELEMEDGE=0.0, KS = KSBF,
FMAPFN = "BF_550.T7";
// Matching Solenoid
// Max value in the M_440 file = 1.973966
// Conversion from Current (I) to Scaling factor:
// Scaling Factor (KS) = (I / Imax) * 1.973966
// Where Imax for this Matching solenoid = 440 [A]
REAL I = 273; //[A]
REAL SF = (I/440)*1.973966;
if (OPALVERSION>10500)
SF = SF/3.2306;
M: Solenoid, L = 0.5, ELEMEDGE=0.0, KS = SF,
FMAPFN = "M_440.T7";
value,{KSBF,SF};
//----------------------------------------------------------------------------
//Drift after gun.
DR1: DRIFT, L = 10.0, ELEMEDGE = 0.5;
//----------------------------------------------------------------------------
// DEFINE BEAM LINE
GS: Line = (GUNSOURCE, GUN, BF, M);
// Complete accelerator
DRIVE: Line = (GS, DR1);
//----------------------------------------------------------------------------
// 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.
// 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.
// Note, If you want a Gaussian, in the longitudinal direction:
// TRISE/FALL = 1.6869*simgar
// Sigmar = FWHM / 2.35 (this equation is only valid for 1.3 GHz)
Dist: DISTRIBUTION, TYPE = FROMFILE,
FNAME = "DistAt2m.dat";
// 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 = 16, MY = 16, MT = 16, // 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 = beam_bunch_charge * rf_freq * 1e6, 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 0.4 m,
// and 3.0e-12 is used from 0.4 to 5 m.
TRACK, LINE = DRIVE, BEAM = BEAM1, MAXSTEPS = {17200, 1800},
DT = {1.0e-13, 3.0e-12}, ZSTART = 2.0, ZSTOP = {0.0, 0.4};
RUN, METHOD = "PARALLEL-T", BEAM = BEAM1,
FIELDSOLVER = FS_SC, DISTRIBUTION = Dist, TRACKBACK = TRUE;
ENDTRACK;
Stop;
Quit;
\ No newline at end of file
#!/bin/bash
mpirun -np 4 $OPAL_EXE_PATH/opal AWAGun-TrackBack-1.in --info 2 2>&1
"Track AWAGun-1 backward"
stat "rms_x" avg 1E-5 #this is a comment
stat "rms_y" avg 1E-5 #this is a comment
stat "rms_s" avg 1E-5 #this is a comment
stat "emit_x" avg 1E-5 #this is a comment
stat "emit_y" avg 1E-5 #this is a comment
stat "emit_s" avg 1E-5 #this is a comment
stat "energy" avg 1E-5 #this is a comment
#!/bin/bash
#$ -cwd
#$ -j y
#$ -pe orte 1
#$ -N BeamLine-1-RT
#$ -v LD_LIBRARY_PATH,OPAL_EXE_PATH,OPENMPI,REG_TEST_DIR
MACHINE_FILE=$TMPDIR/machinefile
awk '/^merlin/ {print $1" slots="$2}' $PE_HOSTFILE > $MACHINE_FILE
cp $MACHINE_FILE machinefile.last
cd $REG_TEST_DIR
OPAL="$OPAL_EXE_PATH/opal AWAGun-TrackBack-1.in --commlib mpi --info 3 --warn 0 2>&1"
CMD="$OPENMPI/bin/mpirun -x LD_LIBRARY_PATH -machinefile $MACHINE_FILE -np $NSLOTS $OPAL "
$CMD
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
301e8dbd0c939a820d42b2ed4c883c6a AWAGun-TrackBack-1.lbal
fefa0fc4d5261ea05ddcfe7ce09cbdaa AWAGun-TrackBack-1.out
72b6426f68f8700ae5cfff985df41e7d AWAGun-TrackBack-1.stat
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment