next up previous contents
Next: Beam Beam Kick Up: Invariant Spin field with Previous: Spin field Lattice Funcions   Contents


Stroboscopic Average

One can check the spin normal form against a numerical average. In fact, the existence of a normal form is directly connected to one-turn averages. The word ``Stroboscopic Average'', in the context of a map based theory, is an unfortunate locution introduced by Hoffstätter and Heinemann. It is a simple turn by turn average.

Here is that code that does it:

9 format('(a20,3(1x,E15.8))')
2001 call  stroboscopic_average(als,xs0,xst,1,STATE,n,nh,N_AXIS_avep)
2002 call  stroboscopic_average(als,xs0m,xstm,1,STATE,n,nh,N_AXIS_avem)
write(6,*)" $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ "
WRITE(6,9) "   Numerical dn/dy =",(N_AXIS_avep%x(:)-N_AXIS_avem%x(:))/dx/2.d0
WRITE(6,9) "  Analytical dn/dy =", DN0_DX
WRITE(6,9) " Numerical d2n/dy2 =",(N_AXIS_avep%x(:)+N_AXIS_avem%x(:)-2*n0(:))/dx**2
WRITE(6,9) "Analytical d2n/dy2 =", DN0_DX2
write(6,*) " more -> 1 for yes"
read(5,*)i 
if(i==1) goto 2001

The routine that performs this average (a toy routine really) is located in the Sr_spin.f90 file.

   SUBROUTINE stroboscopic_average(ring,xs0,xst,pos,mstate0,nturn,kp,n)
    IMPLICIT NONE
    TYPE(layout),target,INTENT(INOUT):: RING
    type(probe) , intent(inout) :: xs0,xst
    TYPE(INTERNAL_STATE) mstate0,mstate
    integer, intent(in) :: kp,pos,nturn
    integer i,k,imax,nd2
    type(spinor) n
    real(dp) norm,norm0,n0(3),theta0

    mstate=mstate0+spin0
    nd2=6
    if(mstate%nocavity) nd2=4
    do k=1,nturn
       call track_probe(ring,xs0,mstate,node1=pos)  !,fibre2=3)

       do i=1,3
          xst%s(i)%x=xs0%s(i)%x+xst%s(i)%x  ! <---- Stroboscopic average
       enddo

       if(mod(k,kp)==0) then  ! kp
          write(6,*) k,"$$$$$$$$$$$$$$$$$$$$$$$$$"
          do i=1,3
             norm=root(xst%s(1)%x(i)**2+xst%s(2)%x(i)**2+xst%s(3)%x(i)**2)
             if(norm>=zero) then
                norm=1.d0/norm
             endif
             write(6,*) 1.d0/norm
             write(6,*) xst%s(1)%x(i)*norm,xst%s(2)%x(i)*norm,xst%s(3)%x(i)*norm
          enddo
       endif ! kp
    enddo

    norm0=zero
    do i=1,3
       norm=root(xst%s(1)%x(i)**2+xst%s(2)%x(i)**2+xst%s(3)%x(i)**2)
       if(norm>=norm0) then
          imax=1
          n%x(1)=xst%s(1)%x(i)/norm
          n%x(2)=xst%s(2)%x(i)/norm
          if(abs(n%x(2))>=abs(n%x(1))) imax=2
          n%x(3)=xst%s(3)%x(i)/norm
          if(abs(n%x(3))>=abs(n%x(2))) imax=3
          if(n%x(imax)<0) n%x=-n%x
          norm0=norm
       endif
    enddo

  end SUBROUTINE stroboscopic_average



Frank Schmidt 2010-10-15