source: PSPA/parmelaPSPA/trunk/cellimp.f @ 445

Last change on this file since 445 was 12, checked in by lemeur, 12 years ago

parmela pspa initial

File size: 1.9 KB
Line 
1      subroutine cellimp(wtp,dwtp)
2c---apply impulse of duration dwtp (in degrees) due to linac cell.
3c---if dwtp is larger than dwtmax, set dwtp = dwtmax.
4c----------------------------------------------------------------------
5      save
6c
7      include 'param_sz.h'
8      include 'cfldscom.h'
9      include 'constcom.h'
10      include 'misccom.h'
11      include 'outcom.h'
12      include 'pcordcom.h'
13      include 'tstepcom.h'
14      include 'syscom.h'
15      include 'ucom.h'
16c
17      common/back/bmax,byz0,byzs,pzowmin,pzowmax,iback
18c--------------------------------------------------------------------------
19c*
20      data cp/1./
21      ne=rne
22      if(iback.eq.1) call byfield(dwtp) 
23      nc=el(6,ne)
24      ph=wtp*radian*cellfreq(nc)/freq
25      if(ph.eq.phold)go to 10
26      sp=sin(ph)
27      cp=cos(ph)
28      phold=ph
29   10 continue
30      dwtmax=el(7,ne)
31      if(dwtp.gt.dwtmax)dwtp=dwtmax
32      con=dwtp*dcon/erest
33      zc=z+hcll(nc)-zloc(ne)
34      if (el(8,ne).gt.0.) zc=zc-hcll(nc)
35      rsq=x**2+y**2
36      if (rsq.gt.0.)then
37      r=sqrt(rsq)
38      else
39      r=0.
40      endif
41      call cfield(r,zc,nc,ez,er,bt)
42      s=sp*el(10,ne)+cp*el(9,ne)
43      ezsauv=ez*el(10,ne)
44      if(el(8,ne).eq.-2.) ezsauv=-ezsauv
45      ez=el(5,ne)*ez*s
46      dbgz=ez*con
47      if((ip.eq.999).and.(r.eq.0.))
48     1write(nimp,*) z,zc,ezsauv,ez*1.e02
49      if(rsq.eq.0.)go to 20
50c     bt component of rf magnetic field
51c     bz beta_z
52c     br beta_r
53      bz=bgz/gamma
54      c=cp*el(10,ne)-sp*el(9,ne)
55      fr=el(5,ne)*(er*s-bz*bt*c)
56      br=sqrt(bgx**2+bgy**2)/gamma
57c      dbgz=dbgz+con*el(5,ne)*br*c   !!!
58      dbgz=dbgz+con*el(5,ne)*br*bt*c
59      dbgr=fr*con
60      dbgx=dbgr*x/r
61      dbgy=dbgr*y/r
62      bgx=bgx+dbgx
63      bgy=bgy+dbgy
64   20 continue
65      bgz=bgz+dbgz
66      gamma=sqrt(1.+bgx**2+bgy**2+bgz**2)
67      return
68      end
69c++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*
Note: See TracBrowser for help on using the repository browser.