-
Notifications
You must be signed in to change notification settings - Fork 39
PTC_TWISS GlobalRingParams
Implemented in subroutine oneTurnSummary.
The global parameters of a ring are extracted from the normal form decomposition of the obtained one turn map.
First, one turn map is converted to type c_damap, which is complex DA map, using simple assign operation
c_Map = oneTurnMapThe normal form is done using PTC Subroutine
call c_normal(c_Map,theNormalForm)The type c_normal_form contains several fields
TYPE c_normal_form
type(c_damap) a1 !@1 brings to fix point at least linear
type(c_damap) a2 !@1 linear normal form
type(c_factored_lie) g !@1 nonlinear part of a in phasors
type(c_factored_lie) ker !@1 kernel i.e. normal form in phasors
type(c_damap) a_t !@1 transformation a (m=a n a^-1)
type(c_damap) n !@1 transformation n (m=a n a^-1)
type(c_damap) As !@1 For Spin (m = As a n a^-1 As^-1)
type(c_damap) Atot !@1 For Spin (m = Atot n Atot^-1)
integer NRES,M(NDIM2t/2,NRESO),ms(NRESO) !@1 stores resonances to be left in the map, including spin (ms)
real(dp) tune(NDIM2t/2),damping(NDIM2t/2),spin_tune !@1 Stores simple information
logical positive ! forces positive tunes (close to 1 if <0)
!!!Envelope radiation stuff to normalise radiation (Sand's like theory)
complex(dp) s_ij0(6,6) !@1 equilibrium beam sizes
complex(dp) s_ijr(6,6) !@1 equilibrium beam sizes in resonance basis
real(dp) emittance(3) !@1 Equilibrium emittances as defined by Chao (computed from s_ijr(2*i-1,2*i) i=1,2,3 )
END TYPE c_normal_form-
Dispersion is calculated the identical way as in
equaltwissusing the fielda_t, which is simplyA_ofequaltwiss -
Compaction factor and phase slip factor plus gamma transition.
Here, depending on the flagTIME, one of these parameters is directly obtained and the other one needs to be calculated from it.-
TIME = true: phase slip factor directly in the one turn map:- 5D
! 5/6 swap MADX/PTC sd = -1.0*(oneTurnMap%x(6).sub.fo(5,:)) do i=1,4 sd = sd - (oneTurnMap%x(6).sub.fo(i,:))*dispersion(i) enddo ! suml == circumference eta_c = -sd * betaRelativistic**2 / suml alpha_c = one / gammaRelativistic**2 + eta_c
* 56Dtype(c_damap) :: yy yy%n = 6 do i=1,6 yy%v(i) = oneTurnMap%x(i)%t enddo
-
! takes away all dispersion dependency yy = theNormalForm%A_t**(-1) * yy * theNormalForm%A_t t1 = yy%v(6).sub.'000010' b = betaRelativistic ! 1st order alpha_c = (suml - b2*suml + b2t1)/suml ! 2nd order t2 = yy%v(6).sub.'000020' alpha_c_p = b**2(3*(-1 + b2)suml - 3(-1 + b2)t1 + 2bt2) alpha_c_p = alpha_c_p / suml ! 3rd order t3 = yy%v(6).sub.'000030' alpha_c_p2 = 3b2*((-1 + 6*b2 - 5b4)suml + t1 - 6b2t1 + 5b**4t1 + 4bt2 - 4b**3t2 + 2b**2t3) alpha_c_p2 = alpha_c_p2 / suml ! 4th order t4 = yy%v(6).sub.'000040' alpha_c_p3 = 3b**3(35b**5(suml - t1) + 10t2 + 30b4t2 - 10b3*(5suml - 5t1 + 2t3) + 5b*(3suml - 3t1 + 4t3) + 8b**2*(-5*t2 + t4))
* ```TIME = false```
* 5D and 6D
```Fortran
! 5/6 swap MADX/PTC
sd = -1.0*(oneTurnMap%x(6).sub.fo(5,:))
do i=1,4
sd = sd - (oneTurnMap%x(6).sub.fo(i,:))*dispersion(i)
enddo
alpha_c = -sd/suml
eta_c = alpha_c - one / gammaRelativistic**2
```
* 56D
```Fortran
yy%n = 6
do i=1,6
yy%v(i) = oneTurnMap%x(i)%t
enddo
! takes away all dispersion dependency
yy = theNormalForm%A_t**(-1) * yy * theNormalForm%A_t
alpha_c = (yy%v(6).sub.'000010')/suml
eta_c = alpha_c - one / gammaRelativistic**2
!higher orders
alpha_c_p = 2.0*(yy%v(6).sub.'000020')/suml
alpha_c_p2 = 6.0*(yy%v(6).sub.'000030')/suml
alpha_c_p3 = 24.0*(yy%v(6).sub.'000040')/suml
gamma_tr = one / sqrt(alpha_c)
```
* Tunes
They are extracted from `ker` field of the normal form.
First, it needs to be flattened, because `ker` is factorised, meaning that each order is stored as a separate map.
vf_kernel=0 call flatten_c_factored_lie(theNormalForm%ker,vf_kernel)
that is Vector Field Kernel. This complex map and its
* complex part is tune (amplitude dependent rotation)
* damping coefficients
The monomials are peculiar because they have extra order for the variable they correspond to. So horizontal tune is
vf_kernel%v(1).sub.'1000'
The vertical one
vf_kernel%v(1).sub.'0010'
And chromaticities
vf_kernel%v(1).sub.'10001' vf_kernel%v(3).sub.'00101'
The variables have units of radians, so the code takes minus imaginary part and divides by 2π. It is implemented in function `tuneFromComplexVF`.
*Note that chromaticities can not be calculated in 6D because
`deltap` is a phase-space variable and not an external parameter.*