source: PSPA/parmelaPSPA/tags/v0.1/cathode.f @ 447

Last change on this file since 447 was 101, checked in by garnier, 12 years ago

premier tag

File size: 1.4 KB
Line 
1      subroutine cathode(dwtp,iend,ibeg)
2c----------------------------------------------------------------------
3c
4      include 'param_sz.h'
5      include 'bfieldcom.h'
6      include 'constcom.h'
7      include 'pcordcom.h'
8      include 'syscom.h'
9      include 'ucom.h'
10c
11      common/cathcur/rcur
12c--------------------------------------------------------------------------
13c*
14      ne=rne
15      bz=bgz/gamma
16      dz=bz*dcon*dwtp
17c----particle will be moved into next element during this step.
18c----the next element should be a cell of length greater then
19c----the distance this element moves the particles.
20c----the next element in particular must not have zero length!
21c----the location of this element should be at z=0. a zero length
22c----drift could preceed this element.
23      if(dz.ge.0.)iend=1
24c-----allow particle to go backwards
25      if(ne.ge.1.and.dz.lt.0.and.z+dz.le.zloc(ne-1))then
26c----particle will cross into previous element during this step
27      ibeg=1
28      endif
29      r=sqrt(x*x+y*y)
30      if(iend.eq.1.and.rcur.gt.r)then
31      theata=asin(r/rcur)
32      dz=rcur*(1.-cos(theata))
33      z=z+dz
34      bgz=bgz*cos(theata)
35      bgr=-bgz*sin(theata)
36      if(r.ne.0.)then
37      bgx=x/r*bgr
38      bgy=y/r*bgr
39      endif
40      endif
41      if(ibeg.eq.1)z=zloc(ne-1)
42      dwtp=0.
43      return
44      end
45c++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*
Note: See TracBrowser for help on using the repository browser.