220 likes | 453 Views
PTC Experience & Developments in CLIC and CTF3. Piotr Skowroński. Intro. CTF3 online model is based on MAD-X-PTC When possible pure MAD-X is used since it is way faster Only when necessary PTC calculation are done
E N D
PTCExperience & Developments in CLIC and CTF3 PiotrSkowroński
Intro • CTF3 online model is based on MAD-X-PTC • When possible pure MAD-X is used since it is way faster • Only when necessary PTC calculation are done • Often an approximate solution is found with MAD-X and only further fine tuning is done with PTC • Also some parts of the CLIC design was done with PTC, for example Drive Beam Recombination Complex • CLIC linacs are done with PLACET • MAD-X is missing some crucial ingredients • Often the only way is to do calculation with PTC • When necessary develop adequate links between PTC and MAD-X • Or use some other program • We have chosen the first option • I will outline the MAD-X-PTC features that we have contributed to • Which is only a small subset of what PTC offers PTC 1/2 day, CERN
Acceleration • MAD-X is missing support for acceleration • Acceleration in sense of changing beam energy along lattice • Travelling Wave Cavities are drifts in MAD • At low energies there is non-negligible focusing from the fringe • PTC has it, however, it must be handled appropriately • Scaling of the Twiss functions and magnets strengths with the beam energy • PTC uses regular (not relative) units • After passing a cavity PTC gives acceleration as dP/P increase • PTC_TWISS was accordingly modified • If cavities are present a test particle is sent through the layout with TOTALPATH flag on (5th coordinate is total time) • It is tracked till the first cavity • The cavity’s phase is adjusted relative to the test particle • Particle is tracked through cavity and dP/P is obtained • The reference energy of all elements till the next cavity is set to the obtained dP/P • The TWISS parameters are scaled appropriately with the beam energy gain PTC 1/2 day, CERN
CTF3 linac model • Each TW cavity is split into 31 pieces to model beam loading effect • In principle it could be also implemented directly in PTC since acceleration gradient could take form of a user defined polynomial • The beam is decelerated in the last pair of cavities because the klystron for the last section is not available PTC 1/2 day, CERN
Tracking • Acceleration in single particle tracking is implemented as a separate function PTC_TRACKLINE • Due to very high complexity of the existing implementation (PTC_TRACK) there was too high chance to put a bug when adding this functionality • The phases of the cavities are adjusted in the same manner as in PTC_TWISS • Using the same subroutine • dP/P represents deviation w.r.t. local reference energy PTC 1/2 day, CERN
rplot pluginSaving tracking data in ROOT file • Saving all the tracking data in text files, which is the way of MADX, is very time and space consuming • Often it is useful to have access to complete data set, and certainly it is handy • ROOT has specialized algorithms for saving and for processing of this kind of data • rplot plugin (loaded on demand) enables fast and compact data saving • Compile MADX with plugin support • Switch in the Makefile, produces dynamically linked executable • Have ROOT installed • Download and compile rplot plugin from MAD-X web page • ptc_trackline, rootntuple, onetable; • It will generate file named rplot.root PTC 1/2 day, CERN
Study of tracking dataEmittance Growth Geometrical emittance (sigma) EX [m rad] Element number [-] DL DL CR1 CR1 CR2 CR2 N [-] Normalized X [-] Element number [-] • 22801 particles tracked through CLIC Drive Beam Recombination Complex • 1.5GB data file • Having all the data in hand a ROOT script gives emittance along the lattice pointing the critical sections PTC 1/2 day, CERN
Control of PTC switches • PTC has several switches that control the way integration is done • PTC_SETSWITCH is the command that allows to set those switches from the MAD-X script level http://mad.web.cern.ch/mad/madx/ptc_auxiliaries/PTC_SetSwitch.html • The switches • debuglevel - sets the level of debugging printout 0 none, 4 everything • maxacceleration - set cavities phases so the reference orbit is always on the crestexact_mis - Switch ensures exact misalignment treatment. • totalpath - If true, the 6th variable of PTC, i.e. 5th of MAD-X is the total path. If false it is deviation from the reference particle, which is normally the closed orbit for closed layouts. • radiation – Sets the radiation switch/internal state of PTC. • fringe - Sets the fringe switch/internal state of PTC. If true the influence of the fringe fields is evaluated for all the elements. Please note that currently fringe fields are always taken to the account for some elements (f.g. traveling wave cavities) even if this flag is set to false. • time - If true, Selects time of flight rather than path length. (cT to be precise) as the 6th variable of PTC, i.e. 5th of MAD-X. PTC 1/2 day, CERN
icase: dimension of calculation • CLIC/CTF3 ring calculations are done with special dimension mode icase=56 • icase=5 does not give results for the bunch length • icase=6 assumes presence of a cavity • In the other case the closed solution can not be found • Even if found it can not be trusted • icase=56 gives 6D result in case no cavity is present PTC 1/2 day, CERN
Access to arbitrary map coeff. • Having calculated arbitrary order maps one needs to use them for matching or plotting • PTC_SELECT command marks the elements to be extracted from PTC and points tables to put them create, table=T2, column=_name,_s,"c566","c555","c655”; ptc_select, table=T2, column="c566", polynomial=5, monomial="000002"; ptc_select, table=T2, column="c555", polynomial=5, monomial="000020"; ptc_select, table=T2, column="c655", polynomial=6, monomial="000020"; • _name and _s make element name and s position to be saved in the table • cXXX are arbitrary names the user choose for the coefficients • Polynomial is row of the transfer map • Monomial marks the element in the row • See the manual in the web page for more detailed description and examples • value(T2,elementname, coeffname); gives a coefficient at a location • It is heavily used feature, f.g. to preserve longitudinal bunch profile (C566, C5666) • At the moment only PTC_TWISS command returns the map coefficient • It is straight forward to extend it to PTC_NORMAL • In fact, my development version already has this feature • It should be easily extended to other interesting parameters • Hamiltonian • Transformation map to normalized coordinates (so called “A-script”) PTC 1/2 day, CERN
Geometry manipulation • PTC allows for very flexible geometry manipulation • PTC_EPLACEMENT is command to move elements or whole sections of the machine • It allows to model arbitrarily complicated layouts very easily and in very intuitive manner • It enables to perform start-to-end simulations and optimizations for complicated systems were connections between section involveotherwise difficult to model transitions • Normally such calculations have to be done bit by bit with cumbersome end/start data manipulation PTC 1/2 day, CERN
Geometry manipulation use case PTC 1/2 day, CERN • Combiner Rings of CTF3 and CLIC use RF Deflectors for the beam recombination • They create time variable bumps • The beam is injected parallel to the ring orbit few centimetres off-axis • Passing quads off their axis the bunches are deviated towards the ring orbit • RF deflector fixes the bunches on the ring orbit
Geometry manipulation use case • Combiner Rings of CTF3 and CLIC use RF Deflectors for the beam recombination • They create time variable bumps • The beam is injected parallel to the ring orbit few centimetres off-axis • Passing quads off their axis the bunches are deviated towards the ring orbit • RF deflector fixes the bunches on the ring orbit • When modeling the injection to the ring command ptc_eplacement, range=injection,x=-0.0364,y=0,z=0,onlyposition, refframe=previouselement, autoplacedownstream=true; shifts injection by 3.64cm and all the elements downstream accordingly • Dispersion and R56 can be easily matched to account for off-axis quadrupole passage PTC 1/2 day, CERN
Geometry inspectionLayout visualization • To verify the layout geometry the user can write all reference frames to a file using ptc_printframes command ptc_printframes, file="frames.txt"; text file with coordinate and rot. matrices ptc_printframes, file="drawlayout.C", format=rootmacro; ROOT macro which executed with root (root drawlayout.C) displays 3D interactive view of the layout • Very useful to check whether • The layout resembles what we intended it to be • It closes • All elements are powered • Not powered elements are grey • Produces nice illustrations for presentations and publications PTC 1/2 day, CERN
CLIC Drive Beam Recombination Complex PTC 1/2 day, CERN
CTF3 Combiner Ring Injection Region PTC 1/2 day, CERN
Knobs • PTC allows to define any element strength and also an initial condition as a parameter of the integration: a knob • It appears as an additional variable in addition to the six canonical ones • All parameters (transfer maps, TWISS parameters) are obtained as polynomials in function of those knobs • Such obtained parameters can be • Printed to a file • Evaluated for a given knob value • Viewed with a dedicated plugin PTC 1/2 day, CERN
Moments • As Rogelio shown in the previous talk, the moments of a particle distribution can be tracked with PTC • The map is initialized assuming given starting distribution with some initial values of moments • This map is tracked and moments are evaluated at every element • The lattice can be than matched to obtain given distribution at given location • The typical use case is initial Gaussian distribution that is also Gaussian at the end of the lattice, i.e. all moments above 2 equal to zero • The cross check with Rogelio’s MAPCLASS displayed • Perfect agreement in 4D case • No agreement in some 5D and 6D cases • Lack of time and low priority for having this feature operational (MAPCLASS does the same) made it left incomplete PTC 1/2 day, CERN
A Standard Script, part 1 • When requested run 6D even if no cavity present • We will need those transfer map elements • resplit,xbend = auto nst; stronger magnet -> bigger nst • Control the switches, do not rely on defaults • Set the ring offset • TWISS with initial conditions • Use “twiss” table, otherwise plot command has problems sometimes • plotting PTC 1/2 day, CERN
A Standard Script, part 2 • Matching sextupoles • With PTC basically one must use “use_macro” mode • Macro 1 with PTC execution • Unfortunately, every time PTC needs to be reinitialized to enforce proper variable changes • Debug printout: calculationis slow – see immediately if it does not converge • Constraints for macro 1 PTC 1/2 day, CERN
A Standard Script, part 3 • Macro 2 with regular TWISS • In this particular case it is work around because PTC_TWISS on a line does not give chromaticities • Constraints for macro 2 • Final plotting PTC 1/2 day, CERN
Conclusions • PTC is extremely powerfuland flexible library • However slow • The existing interface between MAD-X and PTC allows for comfortable use of PTC • But there is still many PTC features uncovered for the MAD-X users • Few things can be still improved • For example PTC_NORMAL and PTC_TWISS could be merged • Often one needs to run both commands one after another • Both require tracking of the transfer map along the lattice which is the time consuming part • ptc_normal can be a special case of ptc_twiss, or vice versa, and transfer map would calculated ones • Never performed any benchmark of PTC results against measurements • CTF3 is not suitable for that PTC 1/2 day, CERN