20150107.NewPTC.v3

New PTC
Piotr Skowroński
1
MADX Meeting
26 June 2014
Complex Normal Form
Etienne since 2 years works the new code with normal form
calculation in complex space
 Requires complex differential algebra
The old code is not maintained anymore
 The reported bugs that were corrected only in the new version
The switch to the new PTC was claimed to be tricky
 In fact it took 3 days plus 2 weeks finding bugs
2
MADX Meeting
26 June 2014
Changes
The node layout is always created and used in tracking
 Reminder: a node is
Each integration step
Geometric transformation (patch)
Fringe element
PROBE or PROBE_8 object is always used in tracking
 A particle (array of 6 doubles) or a map (array of polynomials)
needs to wrapped in this special object
It contains additional information about time, spin, etc.
 Before ptc_twiss and ptc_normal used the arrays directly
1. track  propagate (interface for track_probe)
2. in the routines extracting dynamic variables
map -> map_probe%x
3. map initialization had to be updated
3
MADX Meeting
26 June 2014
Changes
API for complex normal form has changed w.r.t. the old one
 Instead of
normal=theOneTurnMap:
now it is
complexMap =theOneTurnMap
call c_normal(complexMap,normal)
Also the normal form type is quite different
 a_t: normalizing transformation the same but complex
 a1: linear part of a_t as above
 DHDV: auxiliary map disappeared
contained the tune polynomials + dumping + compaction factor
 ker: kernel of the transformation (c_factored_lie),
i.e. the normalized map in phasor basis
Give access to the tune polynomials:
call flatten_c_factored_lie(ker,vf_kernel) and imaginary part of
vf_kernel (type c_vector_field) is the tune polynomial
All the routines extracting normal form results
had to be updated
4
MADX Meeting
26 June 2014
The tune polynomials
PTC returns the tune as polynomial
example horizontal tune
Damping
Tune value (radians)
x px y py pt
Q
Q’
Anhx (dQ/dJx)
Anhy (dQ/dJy)
Q’’
Anhx/dpp
Q’’’
5
MADX Meeting
26 June 2014
Debugging
In order to work with Etienne implemented PTC stand alone
version of ptc_twiss, i.e. Fortran 90 program(s) that
 Implements in compiled code or reads from file a machine layout
 Performs the calculation
 Prints the output to files with all the intermediate data
I would like to place these examples in the libs/ptc/examples
to profit form SVN fetures (?)
6
MADX Meeting
26 June 2014
Remaining problems
6D normal form buggy
 The issue seems to be related to the routine locating the
independent planes
In case of coupling the planes are distinctive
 Etienne is looking into it using my example
The 6D maps are not identical for PTC stand alone and MADX
 I suspect uninitialized variables in PTC
Used valgrind and sanitizer to trace it
 I corrected initialization in many places in PTC
Files committed to the PTC git repository
Dispersion in 6D is wrong
ptc_normal not yet updated
 Should be no problem as it is copy paste part of ptc_twiss
7
MADX Meeting
26 June 2014
Cleaning of the code
Next step is too simplify and clean the module
 Handling both, regular and node layout made the code
complicated
 Speed-up: currently, in case closed solution is searched, the
one turn map is tracked twice.
I would like to unify ptc_normal with ptc_twiss
 ptc_normal is the first part of ptc_twiss, but stopped after
findig the closed solution
 Already implemented new option ptc_twiss, normal;
It extracts ALL variables of interest to the available order
 Avoids the cumbersome ptc_select command
Puts the results in TFS table called nonlin
 Format suitable to use with MADX table construct
f3000_re = table(“nonlin”,”GNFC_3_0_0_0_0_0”,value)
Added 2 test cases
Used in the online model
8
MADX Meeting
26 June 2014
nonlin table
9
MADX Meeting
26 June 2014