TREDI test for Photo-injectors L. Giannessi – M. Quattromini C.R. ENEA-Frascati Presented at TREDI … … is a multi-purpose macroparticle 3D Monte Carlo, devoted to the simulation of electron beams through Rf-guns Linacs (TW & SW) Solenoids Bendings Undulators Quads’ … Motivations Three dimensional effects in photo-injectors Inhomogeneities of cathode quantum efficiency Laser misalignments Multipolar terms in accelerating fields “3-D” injector for high aspect ratio beam production …. on the way … … Study of coherent radiation emission in bendings and interaction with beam emittance and energy spread History • 1992-1995 - Start: EU Network on RF-Injectors* Fortran / DOS (PC-386 – 20MHz) Procs: “VII J.D'Etude Sur la Photoem. a Fort Courant” Grenoble 20-22 Septembre 1995 • 1996-1997 - Covariant smoothing of SC Fields Ported to C/Linux (PC-Pentium – 133MHz)FEL 1996 - NIM A393, p.434 (1997) - Procs. of 2nd Melfi works. 2000 - Aracne ed.(2000) • 1998-1999 - Simulation of bunching in low energy FEL** Added Devices (SW Linac – Solenoid - UM) (PC-Pentium – 266MHz) J.B.Rosenzweig & P. Musumeci, PRE 58, 27-37, (1998) – Diamagnetic fields due to finite dimensions of intense beams in high-gain FELs FEL 1998 - NIM A436, p.443 (1999) (not proceedings …) • 2001-2002 - Italian initiative for Short FEL • Today: Many upgrades - First tests of CSR in new version *Contributions from A. Marranca ** Contributions from P. Musumeci Features • • • • • 15000 lines in C language; Scalar & Parallel (MPI 2.0); Unix & Windows versions; Tcl/Tk Gui (pre-processing); Mathematica & MathCad frontends (postprocessing); • Output format in NCSA HDF5 format (solve endian-ness/alignement problems) Start Load configuration & init phase space TREDI FlowChart Charge distribution & external fields known at time t Adaptive algorithm tests accuracy & evaluates step length t Trajectories are intagrated to t+ t Self Fields are evaluated at time t+ t Exit if Z>Zend Particle trajectory 3 Particle trajectory 2 Particle trajectory 1 Node 1 …………………….. Node 2 Node 3 ………… Node n Particle trajectory k Particle trajectory k-1 NOW Particle trajectory k-2 Time Parallelization Present Beam Self Fields Upgrades to be done (six months ago, in Zeuthen): Accomodate more devices (Bends, Linacs, Solenoids …) Load field profiles from files Point2point or Point2grid SC Fields evaluation (NxN NxM) Allowed piecewise simulations Graphical User Interface for Input File preparation (TCL/Tk) Graphical Post Processor for Mathematica / MathCad / IDL Porting to MPI for Parallel Simulations • SDDS support for data exchange with FEL code • Fix Data/Architectural dependences (portability of data) • Introduce radiative energy loss • Smooth (regularize) acceleration fields (for CSR tests) six months later, Chia Laguna… • SDDS support for data exchange with FEL code Fix Data/Architectural depences done, now use HDF5 data format support to fix endian-ness/alignments problems (output portability to different platforms) Introduce radiative energy loss ? Smooth acceleration fields (for CSR tests) done (more work required, no manifestly covariant, CPU consuming) Big speed up (improved retarded time condition routine): Zeuthen: 300 particles 4h on IBM-SP3/16x400MHz) done Chia Laguna: 1000 particles 35m 10000 particles in 27h on a 32CPUs platform! Many improvements and bug fixes (surely many still lurking in the code); recently introduced a “Parmela-like” mode (instantaneous interactions,MUCH faster still experimental) Eqs Of motion… d d d d N.B. : τ = c·t r p mc p mc e E B 2 mc SELF FIELDS… Self Fields are accounted for by means of Lienard-Wiechert retarded potentials Source R(t’) Target Retard Condition tret x r 0 2 EM fields: Accel. term Velocity t erm nˆ nˆ nˆ q E q 3 2 3 2 c 1 nˆ R 1 nˆ R B nˆ E x r t ret Rt ret nˆ x r t ret Rt ret R(t ) Retarded time t t c Problem: fields regularization • Real beam~ 1010 particles • Macroparticles ~ 103-106 huge charges Pseudo-collisional effects Known therapy: • Share charge among vertices of a regular grid (require a fine mesh to reduce noise) Typical problems: • non Lorentz invariant; • assume instantaneous interactions • sensible for quasi-static Coulomb fields, low energy spread etc. Alternative • Get rid of 3-anything (i.e. • Use 4-quantities instead quantities not possessing a definite Lorentz character) q, ( x r ) V V E , B, cos , dR... R 0 ,W (x r) V F Field strength produced by an accelerated charge (covariant form) (see e.g. Classical Electrodynamics, J. D. Jackson) q d x r V x r V F x r V d x r V ret is the (source) proper time and V is the (source) 4-velocity: V , Separation in vel.+accel. terms F V W W q T 3 T 2 S W T 3 S V S V S V Velocity t erm q V T 3 S V terms Accelerati on q q W 3 S W T W 2 T S V S V Separation in vel.+accel. terms (cont’d) • Where: dV W d S U U x r U x r U x r U T S U Note: S U , R e.g. T U T U , R is the 4 - accelerati on is a Lorentz scalar is an antisymmet ric tensor SV R 1 nˆ The natural decomposition of EM fields can be cast in a covariant form! F F V F A Velocity term: R 0 S V 0 Lorentz scalar FV q 3 T V S V Lorentz scalar Smoothing of vel. fields • Solution: source macro particles are given a form factor (i.e. a finite extension in space: Debye screening, Q.E.D. f.f. corrections to current M.E.) • Effective charge Qeff x r lim 0 3 R 0 S V • A scaled replica of the (retarded) beam: • Same aspect ratio mp beam 3 N Boosts change macroparticles’ shape Smoothing of vel. fields (cont’d) • Velocity (static,Coulomb) fields travel at speed of light, too! introduce a covariant (4D) generalization of purely geometric form factor: Rest frame 0 0 0 0 ˆ 1 0 1 0 ˆ 0 Lab frame (primed) 13 11 T 1 T 1 ˆ ˆ ˆ 1 31 3 3 ˆ 1 ˆ 1 Smoothing of vel. fields (cont’d) Rest Frame(3 - vectors) Lab Frame (4 - vectors) T 1 2 T ˆ 1 ˆ R0 x x x x e.g.: gaussian shape: r r Rest Frame (3 - vectors) T 1 x ˆ x q exp 3 2 2 det ˆ Lab Frame (4 - vectors) xT ˆ 1 x q exp 3 2 2 det ˆ Smoothing of vel. fields (cont’d) • Effective charge total charge included by the iso-density surface associated to the value of ρ (ρ’) at observer point: Q eff R xT ˆ 1 x E eff R R R 2 2 q erf R exp 2 2 Q eff R xT ˆ 1 x 2 x Smoothing of vel. fields (cont’d) Eff. Charge Un-smoothed (1/R2) fields Effective vel. field Acceleration term Lorentz scalars FA q q 2 T W 3 S W T W S V S V Lorentz scalars Smoothing of accel. fields • Fields blow up when n̂ (“collinear divergencies) • Solution: target macro particles are given a finite extension in space: • Let be S0 x V x 1 nˆ Smoothing of accel. fields (cont’d) 1 2 S V 1 2 S V Where: 2 2 S d exp G 2 S 0 2 3 2 0 2 2 0 2 2 S 02 d exp G 2 S 0 2 3 2 0 2 S 02 2S0 2 G2 S 0 2 4 S0 2S 02 2 1 2 2 4 and G3 is a too complicated to be worth seeing Effectiveness of smoothing • S0 ~10-5 (“collinear”) Qeff σ vs R Effectiveness of smoothing (cont’d) • S0 ~10-3 (“non collinear”) Qeff σ vs R SPARC INJECTOR SOLENOID RF-GUN LINAC SOLENOID (BNL RfGun+Solenoid+Drift) Gradient 140 MV/m Charge 1nC Pulse length 10 ps (flat top) Spot radius 1 mm Extraction phase ~35º (center) Solenoid field ~0.3 T 104 macro-particles x 3·103 grid points ~13h Energy Spread: Tredi Homdyn Homdyn data: courtesy of M. Ferrario Envelopes Tredi Homdyn Parmela Parmela data: courtesy of C. Ronsivalle The emittance in the Gun+Sol Tredi Homdyn Sol. at standard position Tredi Homdyn Sol. 2cm ahead Tredi Tredi, sol 2cm ahead Homdyn Sol. 1cm ahead Tredi Tredi, B 2cm ahead Tredi, B 1cm ahead Homdyn The emittance in the Gun revisited Tredi Tredi, B 2cm ahead Tredi, B 1cm ahead Homdyn TODO’s • The nature of discrepancies with other codes (Parmela, Homdyn) need to be investigated and/or explained; • Test results obtained in Parmela-like mode; • Speed up the code (Accel. Fields, OpenMP version? 3D runs with 105 -106 particles?) • Make smoothing of Accel. Fields manifestly covariant • Save SC fields onto output to estimate noise CONCLUSIONS • Some internals of the code need to be fully understood but… • TREDI proved to be an usable tool for simulations of quasi-rectilinear set of devices from mildly-to-wildly relativistic regimes (5-5000 MeV): • Start-to-end simulations? Acknoledgements M. Ferrario, P. Musumeci, C.Ronsivalle, J.B. Rosenzweig, L. Serafini For providing results (Homdyn, Parmela), support, hints, feedback or directly partecipating to the development of TREDI. Energy spread (cont’d) Tredi Homdyn