An Introduction to ELEctron Generation ANd Tracking ELEGANT
Advantages of ELEGANT
Support by Michael Borland (forum)
ELEGANT is continuously being developed further
SDDS Toolkit → read data produced by other programs
Used by groups at SLAC, DESY, SOLEIL, DELTA ...
Uses a variant of the MAD input format ...
Simulation Capabilities
Tracking of rings, linacs, and transport lines (6D)
Computation of s-dependent and final properties (e.g. Twiss parameters)
Optimization of results of computations and tracking
...
Setting up a Simulation
Setup and action commands Lattice description
run.ele lat.lte
Macros
<tag1> will be replaced by value1 before simulation
→ bash scripts, python, matlab, ….
example: change the strength of one quadrupole
run.ele: General Command Syntax
&<namelist-name>
<variable-name> = <variable-value>;
. . .
&end
Exmaple:
&run_setup
lattice = "lat.lte",
use_beamline = "DBA", p_central_mev= 1500, default_order = 1,
&end
lat.lte: General Command Syntax
ElementName: <Element>, <property1>=value1, …
BeamlineName: LINE=(ElementName1,ElementName2,...)
Exmaple:
D1: DRIFT,L=2.340700 D2: DRIFT,L=0.25
DBA: LINE=(B,D1,Q1,D2,Q2,D2,Q1,D1,B)
Triplet Achromat: lat.lte
! Drifts
D1: DRIFT,L=2.340700 D2: DRIFT,L=0.25
! Quads
Q1: KQUAD,L=0.25,K1=0.5 Q2: KQUAD,L=0.25,K1=-1.0
! Bending Magnet
B: RBEN,L=0.25,ANGLE="3.0 180.0 / pi *"
! Marker
S: MARK, fitpoint=1
! Beamline
DBA: LINE=(S,B,D1,Q1,D2,Q2,D2,Q1,D1,B) RETURN
Triplet Achromat: run.ele
! Run Setup with Elements
&run_setup
lattice = "lat.lte",
use_beamline = "DBA", p_central_mev= 1500, default_order = 1,
&end
! Calcualte Twiss Parameter for Beamline
&twiss_output
filename = "%s.twi", matched=1,
statistics = 1,
&end
Triplet Achromat: Simulation
elegant run.ele → start simulation sddsquery run.twi →
17 columns of data:
NAME UNITS SYMBOL FORMAT TYPE FIELD DESCRIPTION s m NULL NULL double 0 Distance
betax m $gb$r$bx$n NULL double 0 Horizontal beta-function alphax NULL $ga$r$bx$n NULL double 0 Horizontal alpha-function psix rad $gy$r$bx$n NULL double 0 Horizontal phase advance etax m $gc$r$bx$n NULL double 0 Horizontal dispersion
etaxp NULL $gc$r$bx$n$a'$n NULL double 0 Slope of horizontal dispersion xAperture m a$bx,eff$n NULL double 0 Effective horizontal aperture betay m $gb$r$by$n NULL double 0 Vertical beta-function
alphay NULL $ga$r$by$n NULL double 0 Vertical alpha-function psiy rad $gy$r$by$n NULL double 0 Vertical phase advance etay m $gc$r$by$n NULL double 0 Vertical dispersion
etayp NULL $gc$r$by$n$a'$n NULL double 0 Slope of vertical dispersion ...
Triplet Achromat: Simulation
sddsplot run.twi -col=s,betax →
Triplet Achromat: Simulation
sddsplot run.twi -col=s,etax →
Triplet Achromat: run.ele optimization
&run_control n_steps = 1 &end
! set up lattice optimization
&optimization_setup
mode = minimize, method = simplex, n_passes = 100,
n_evaluations = 100, n_restarts = 100,
&end
! optimization term
&optimization_term term = "S#1.etax abs" &end
Triplet Achromat: run.ele optimization
! optimization parameters
&optimization_variable name=Q1, item=K1, lower_limit=-5, upper_limit=5, step_size=10.0 &end
&optimization_variable name=Q2, item=K1, lower_limit=-5, upper_limit=5, step_size=10.0 &end
&optimization_variable name=D1, item=L, lower_limit=0.00, upper_limit=3.0, step_size=0.05 &end
&optimization_variable name=D2, item=L, lower_limit=0.00, upper_limit=1.0, step_size=0.05 &end
Triplet Achromat: run.ele optimization
! start optimization
&bunched_beam n_particles_per_bunch=1 &end
&optimize summarize_setup=1 &end
&save_lattice filename = %s_optimized.lte &end
Triplet Achromat: run.ele optimization
&run_control n_steps = 1 &end
! set up lattice optimization
&optimization_setup
mode = minimize, method = simplex, n_passes = 100,
n_evaluations = 100, n_restarts = 100,
&end
! optimization term
&optimization_term term = "S#1.etax abs" &end
Triplet Achromat: run.ele optimization
Optimization results:
optimization function has value 0.00654441482207175 Terms of equation:
S#1.etax abs: 6.544414822071749e-03
A total of 10698 function evaluations were made.
Optimum values of variables and changes from initial values:
Q1.K1: 2.334229754519380e+00 1.8342297545193e+00 Q2.K1: -3.125142643677447e+00 -2.1251426436774e+00 D1.L: 2.946343708813805e+00 6.0564370881380e-01 D2.L: 9.961497476644054e-01 7.4614974766440e-01 End of input data encountered.
Triplet Achromat: run.ele optimization
sddsplot run_optimzed.twi -col=s,etax →
Particle Tracking: run.ele
&run_setup
lattice = "lat.lte",
use_beamline = "TEST", p_central_mev= 1500, default_order = 1,
&end
&run_control
n_steps = 1
&end
Particle Tracking: run.ele
&bunched_beam
n_particles_per_bunch =10000, one_random_bunch=0,
sigma_dp = 6.8e-4, sigma_s = 3e-4, emit_x=15e-9, emit_y=1.5e-9, beta_x=10,
beta_y=10, alpha_x=0,
alpha_y=0, eta_x=0, eta_y=0, etap_x=0, etap_y=0,
distribution_type[0] = "gaussian","gaussian","gaussian", distribution_cutoff[0] = 5,5,5,
&end
Particle Tracking: lat.lte
! Drifts
D1: DRIFT,L=2.340700
! Watch
W1: WATCH,FILENAME="%s-%03ld.w1"
! Laser-electron interaction
UA:LSRMDLTR,l=2.25,periods=9,Bu=0.44,accuracy=1e-3,&
method="non-adaptive",n_steps=100,&
LASER_PEAK_POWER=15.5e10,LASER_Z0=0.0,&
LASER_W0=15.65685424949238e-04,&
field_expansion="ideal",&
LASER_WAVELENGTH=800e-9,&
time_offset=0,&
time_profile="laserProfile.sdds=t+A"&
! Beamline
TEST: LINE=(W1,UA,D1,W1)
Particle Tracking: lat.lte
sddsplot run-001.w1 -col=t,p -graph=dots
Particle Tracking: lat.lte
sddsplot run-002.w1 -col=t,p -graph=dots
Reference
http://www.aps.anl.gov/Accelerator_Systems_Divisio n/Accelerator_Operations_Physics/software.shtml