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
2DMagnetoStatic ZX
0.00000000E+00 5.00000000 19
0.00000000E+00 50.0000000 199
0.00000000 0.713863651
40.2905228 0.713951851
80.7321910 0.714193206
121.475957 0.714612870
162.675062 0.715211776
204.485813 0.715969588
247.068512 0.716901562
290.588503 0.717989927
335.217187 0.719210256
381.133069 0.720569807
428.522812 0.722042063
477.582280 0.723618462
528.517613 0.725265257
581.546203 0.726960403
636.897624 0.728669327
694.814490 0.730327748
755.553096 0.731928082
819.383863 0.733393975
886.591347 0.734653838
957.473974 0.735657306
0.00000000 -76.1164479
40.1993715 -76.2129087
80.5494156 -76.5005671
121.200456 -76.9810255
162.305197 -77.6571922
204.019389 -78.5332239
246.502784 -79.6143453
289.920155 -80.9068260
334.442327 -82.4182570
380.247225 -84.1573859
427.520925 -86.1341866
476.458728 -88.3597736
527.266219 -90.8465436
580.160250 -93.6079997
635.369929 -96.6586681
693.137457 -100.014020
753.718861 -103.690285
817.384426 -107.704078
884.418911 -112.071991
955.121129 -116.810004
0.00000000 -152.599189
39.9262535 -152.791663
80.0017287 -153.365148
120.374894 -154.322862
161.196859 -155.670955
202.621733 -157.417621
244.807585 -159.573019
287.917491 -162.149937
332.120557 -165.163491
377.592958 -168.631025
424.519036 -172.572509
473.092381 -177.010285
523.516879 -181.969111
576.007790 -187.475961
630.792763 -193.560075
688.112789 -200.252582
748.223002 -207.586059
811.393325 -215.594135
877.908787 -224.310632
948.069554 -233.768301
0.00000000 -228.389145
39.4731475 -228.675996
79.0933310 -229.531330
119.005189 -230.959577
159.357993 -232.969889
200.302814 -235.574499
241.995015 -238.788935
284.594631 -242.632094
328.268087 -247.126479
373.188635 -252.298349
419.537586 -258.177513
467.505728 -264.797482
517.294065 -272.195465
569.115155 -280.412216
623.194068 -289.491787
679.769701 -299.481298
739.095555 -310.430411
801.440636 -322.390525
867.090271 -335.413603
936.346336 -349.550757
0.00000000 -303.145789
38.8442282 -303.525132
77.8299541 -304.656044
117.101412 -306.544486
156.801921 -309.202566
197.079318 -312.646539
238.084879 -316.897013
279.975120 -321.979081
322.911975 -327.922660
367.064680 -334.762704
412.610682 -342.538929
459.736361 -351.296050
508.638730 -361.083815
559.526350 -371.956858
612.620765 -383.974454
668.157426 -397.200183
726.387230 -411.701474
787.577613 -427.548674
852.013499 -444.813461
919.998458 -463.567508
0.00000000 -376.536545
38.0424806 -377.005683
76.2219961 -378.403726
114.676919 -380.738543
153.546808 -384.025257
192.974179 -388.284046
233.105395 -393.539965
274.091619 -399.824591
316.089856 -407.175348
359.263998 -415.635386
403.785972 -425.254485
449.836901 -436.088582
497.608363 -448.200078
547.303651 -461.657476
599.139174 -476.535685
653.345882 -492.915440
710.170679 -510.882686
769.878072 -530.527716
832.751708 -551.944399
899.095827 -575.227015
0.00000000 -448.237836
37.0742488 -448.793295
74.2800200 -450.448517
111.749453 -453.213367
149.616270 -457.104828
188.017046 -462.147165
227.092044 -468.370929
266.986208 -475.813046
307.850167 -484.518222
349.841307 -494.538302
393.124906 -505.932773
437.875338 -518.768523
484.277380 -533.120590
532.527602 -549.071872
582.835796 -566.712903
635.426691 -586.142018
690.541630 -607.464701
748.440546 -630.792826
809.403852 -656.243345
873.734968 -683.936925
0.00000000 -517.939260
35.9467718 -518.577648
72.0185339 -520.477978
108.340258 -523.651783
145.038831 -528.119744
182.243813 -533.909517
220.088322 -541.055590
258.709966 -549.601428
298.251841 -559.598650
338.863582 -571.107006
380.702519 -584.195624
423.934895 -598.942593
468.737219 -615.435461
515.297667 -633.771043
563.817770 -654.056144
614.514195 -676.407075
667.620604 -700.949370
723.390116 -727.817544
782.097817 -757.154097
844.043338 -789.107752
0.00000000 -585.345649
34.6682026 -586.060830
69.4540435 -588.192371
104.474235 -591.752960
139.847866 -596.764648
175.696513 -603.258964
212.145115 -611.275700
249.322846 -620.863020
287.364119 -632.079390
326.409603 -644.992821
366.607364 -659.681660
408.114071 -676.234444
451.096379 -694.751092
495.732450 -715.342709
542.213564 -738.131821
590.746181 -763.253031
641.554048 -790.852695
694.880868 -821.088481
750.992939 -854.129893
810.183070 -890.155835
0.00000000 -650.176688
33.2478915 -650.964291
66.6053767 -653.311377
100.179731 -657.231406
134.081400 -662.750119
168.423084 -669.901988
203.320498 -678.730033
238.893360 -689.288595
275.266277 -701.642383
312.569734 -715.866553
350.941212 -732.048395
390.526372 -750.287019
431.480435 -770.694149
473.969651 -793.394379
518.173125 -818.526163
564.284840 -846.242220
612.515839 -876.709299
663.097224 -910.109697
716.283413 -946.639864
772.355617 -986.511156
0.00000000 -712.171808
31.6964720 -713.025622
63.4934789 -715.570928
95.4883042 -719.822840
127.781892 -725.807784
160.477039 -733.563709
193.679572 -743.138394
227.498190 -754.590402
262.047163 -767.990065
297.445454 -783.420119
333.818671 -800.976064
371.300011 -820.766397
410.031616 -842.914202
450.166081 -867.557422
491.868126 -894.849449
535.316747 -924.960538
580.707619 -958.078241
628.255815 -994.407967
678.199439 -1034.17466
730.803827 -1077.62181
0.00000000 -771.091919
30.0274363 -772.005955
60.1413061 -774.731229
90.4351143 -779.282437
120.996153 -785.689422
151.917353 -793.992383
183.293107 -804.242597
215.221845 -816.502983
247.804820 -830.849187
281.148804 -847.370444
315.366626 -866.169580
350.577297 -887.364217
386.908417 -911.087810
424.496971 -937.490461
463.491410 -966.739977
504.053076 -999.023050
546.359171 -1034.54667
590.605411 -1073.53985
637.009364 -1116.25388
685.815005 -1162.96468
0.00000000 -826.720318
28.2489436 -827.688113
56.5745417 -830.572230
85.0565584 -835.389253
113.773848 -842.170930
142.807033 -850.959817
172.239002 -861.809171
202.155373 -874.786446
232.645190 -889.972285
263.801665 -907.460798
295.723020 -927.361882
328.513460 -949.801166
362.284308 -974.921437
397.155277 -1002.88354
433.256102 -1033.86833
470.728420 -1068.07794
509.727846 -1105.73730
550.427036 -1147.09644
593.018907 -1192.43278
637.720433 -1242.05231
0.00000000 -878.863747
26.3759023 -879.877790
52.8177679 -882.899953
79.3929486 -887.948330
106.168778 -895.054336
133.213987 -904.262988
160.599027 -915.631297
188.396568 -929.228650
216.682066 -945.139769
245.534355 -963.463973
275.036373 -984.316717
305.275973 -1007.83000
336.346913 -1034.15467
368.350021 -1063.46137
401.394478 -1095.94197
435.599629 -1131.81194
471.096920 -1171.31223
508.032537 -1214.71206
546.570071 -1262.31149
586.894874 -1314.44498
0.00000000 -927.355713
24.4224767 -928.409830
48.8995655 -931.547782
73.4860697 -936.788614
98.2372889 -944.166593
123.209477 -953.727732
148.460144 -965.529693
174.048432 -979.645600
200.035529 -996.163054
226.485133 -1015.18455
253.464020 -1036.83011
281.042685 -1061.23745
309.296140 -1088.56378
338.304795 -1118.98702
368.155658 -1152.70850
398.943741 -1189.95480
430.773605 -1230.97996
463.761712 -1276.06921
498.039043 -1325.54254
533.753920 -1379.75769
0.00000000 -972.057887
22.4028439 -973.141997
44.8487198 -976.372775
67.3794423 -981.769336
90.0379424 -989.364871
112.867642 -999.206944
135.912716 -1011.35584
159.218326 -1025.88506
182.830880 -1042.88447
206.798361 -1062.45966
231.170700 -1084.73369
256.000208 -1109.84765
281.342155 -1137.96353
307.255441 -1169.26508
333.803378 -1203.96018
361.054834 -1242.28347
389.085459 -1284.49962
417.979428 -1330.90593
447.831219 -1381.83721
478.748587 -1437.67016
0.00000000 -1012.85654
20.3316755 -1013.96399
40.6948155 -1017.26411
61.1177607 -1022.77534
81.6309200 -1030.53314
102.264726 -1040.58503
123.049731 -1052.99058
144.016825 -1067.82549
165.197321 -1085.18053
186.623082 -1105.16209
208.326714 -1127.89503
230.341787 -1153.52296
252.703141 -1182.21035
275.447233 -1214.14396
298.612688 -1249.53599
322.240920 -1288.62627
346.376904 -1331.68557
371.070335 -1379.01948
396.377019 -1430.97248
422.360394 -1487.93430
0.00000000 -1049.66720
18.2242030 -1050.78964
36.4678916 -1054.13538
54.7463670 -1059.72349
73.0774130 -1067.58736
91.4782422 -1077.77509
109.966007 -1090.34745
128.556497 -1105.37925
147.266481 -1122.96090
166.111293 -1143.19961
185.105984 -1166.22029
204.265069 -1192.16645
223.602552 -1221.20315
243.132001 -1253.51831
262.866627 -1289.32494
282.819545 -1328.86476
303.004068 -1372.41072
323.434015 -1420.27178
344.124505 -1472.79764
365.092736 -1530.38334
0.00000000 -1082.43543
16.0979329 -1083.56525
32.1981014 -1086.93359
48.3109687 -1092.55696
64.4392455 -1100.47143
80.5864043 -1110.72270
96.7559574 -1123.37119
112.950794 -1138.49079
129.171056 -1156.17084
145.416153 -1176.51740
161.684021 -1199.65363
177.969684 -1225.72183
194.266405 -1254.88525
210.564643 -1287.32997
226.852257 -1323.26723
243.113547 -1362.93662
259.329710 -1406.60950
275.478267 -1454.59324
291.532833 -1507.23535
307.463074 -1564.93066
0.00000000 -1111.13427
13.9624584 -1112.26410
27.9164804 -1115.63047
41.8572484 -1121.25107
55.7767201 -1129.16017
69.6660211 -1139.40358
83.5150436 -1152.03864
97.3118920 -1167.13828
111.042492 -1184.79003
124.690179 -1205.09651
138.235205 -1228.17836
151.654239 -1254.17449
164.919810 -1283.24426
177.999723 -1315.56893
190.856344 -1351.35510
203.445874 -1390.83679
215.717584 -1434.27923
227.612754 -1481.98245
239.063762 -1534.28687
249.992964 -1591.57915
0.00000000 -1135.76452
11.8347813 -1136.88613
23.6502633 -1140.22833
35.4286832 -1145.80889
47.1501137 -1153.65894
58.7933697 -1163.82323
70.3353505 -1176.35836
81.7505314 -1191.33318
93.0103925 -1208.83217
104.082781 -1228.95464
114.931231 -1251.81656
125.514241 -1277.55111
135.784404 -1306.31172
145.687474 -1338.27293
155.161360 -1373.63301
164.134833 -1412.61681
172.526208 -1455.47905
180.241678 -1502.50801
187.173675 -1554.03039
193.198458 -1610.41690
0.00000000 -1156.35522
9.72949700 -1157.46274
19.4290348 -1160.75878
29.0688312 -1166.26066
38.6175495 -1173.99989
48.0421096 -1184.01852
57.3070532 -1196.36897