1 | subroutine scheff3(dist,mt,wtsauv) |
---|
2 | c |
---|
3 | c point to point space charge calculations by Bourat |
---|
4 | c ref : thesis Bourat 1988 - orsay |
---|
5 | c |
---|
6 | c---- |
---|
7 | c dist = distance travelled by light since last call to scheff |
---|
8 | c sce(1)=beam current in amperes. |
---|
9 | c sce(2)=3 program number |
---|
10 | c sce(3)=opt particle size factor |
---|
11 | c sce(4)=no. of adjacent bunches |
---|
12 | c sce(5)=distance between bunches. |
---|
13 | c |
---|
14 | c------------------------------------------------------------------------- |
---|
15 | save |
---|
16 | c |
---|
17 | include 'param_sz.h' |
---|
18 | include 'constcom.h' |
---|
19 | include 'coordcom.h' |
---|
20 | include 'fldcom.h' |
---|
21 | include 'misccom.h' |
---|
22 | include 'ncordscom.h' |
---|
23 | include 'pipecom.h' |
---|
24 | include 'psizescom.h' |
---|
25 | include 'sccom.h' |
---|
26 | include 'ucom.h' |
---|
27 | c |
---|
28 | common/intype/intype |
---|
29 | c---- |
---|
30 | data cte/1.758804786/ ! e/m0 in cgs units |
---|
31 | c |
---|
32 | if (dist) 20,10,20 |
---|
33 | c intialization |
---|
34 | 10 continue |
---|
35 | beami=sce(1) |
---|
36 | opt=abs(sce(3)) |
---|
37 | if (opt.le.0.)opt=1. |
---|
38 | nip=sce(4) |
---|
39 | pl=sce(5) |
---|
40 | if(pl.le.0)pl=wavel |
---|
41 | xnp=float(npoints-1) |
---|
42 | qmacro=beami/(freq*xnp) |
---|
43 | rmacro=opt*(qmacro**.33333333333)*1.e-8 |
---|
44 | facq=qmacro*cte |
---|
45 | c |
---|
46 | write(nnout,*) ' Space charge subroutine number ',iprog |
---|
47 | if (ip.eq.1 .or. ip.eq.2 .or. ip.eq.4) then |
---|
48 | qmacroprint=qmacro*1.e+03 |
---|
49 | write (nnout,410) qmacroprint |
---|
50 | 410 format (' point to point space charge calculation'/ |
---|
51 | . ' qmacro = ',1pg11.3,' nC per superparticle') |
---|
52 | abeami = abs(beami) |
---|
53 | if (beami.gt.0.) write (nnout,420) abeami |
---|
54 | 420 format (' beam current = ',1pg12.3,' amps') |
---|
55 | write (nnout,450) opt |
---|
56 | 450 format (' particle size factor =',t40,1pg12.3) |
---|
57 | endif |
---|
58 | c |
---|
59 | return |
---|
60 | c |
---|
61 | c space charge calculation |
---|
62 | c |
---|
63 | 20 continue |
---|
64 | do 30 j=2,ngood |
---|
65 | c calcul of impuls of j |
---|
66 | xj=cord(1,j) |
---|
67 | gbxj=cord(2,j) |
---|
68 | yj=cord(3,j) |
---|
69 | gbyj=cord(4,j) |
---|
70 | zj=cord(5,j) |
---|
71 | if(zj.le.0)goto 30 ! jg (zj.le.z0) |
---|
72 | gbzj=cord(6,j) |
---|
73 | gamj=gam(j) |
---|
74 | bxj=gbxj/gamj |
---|
75 | byj=gbyj/gamj |
---|
76 | bzj=gbzj/gamj |
---|
77 | c |
---|
78 | do 40 i=2,ngood |
---|
79 | c field create by i |
---|
80 | if(i.eq.j)goto 40 |
---|
81 | xi=cord(1,i) |
---|
82 | gbxi=cord(2,i) |
---|
83 | yi=cord(3,i) |
---|
84 | gbyi=cord(4,i) |
---|
85 | gbzi=cord(6,i) |
---|
86 | gami=gam(i) |
---|
87 | bxi=gbxi/gami |
---|
88 | byi=gbyi/gami |
---|
89 | bzi=gbzi/gami |
---|
90 | c |
---|
91 | do 50 ni=-nip,nip |
---|
92 | c adjacent bunches |
---|
93 | zi=cord(5,i)+ni*pl |
---|
94 | c |
---|
95 | xij=xj-xi |
---|
96 | yij=yj-yi |
---|
97 | zij=zj-zi |
---|
98 | rijbi=xij*bxi+yij*byi+zij*bzi |
---|
99 | gi2=gami*gami/(gami+1.) |
---|
100 | grb=gi2*rijbi |
---|
101 | c |
---|
102 | xpij=xij+bxi*grb |
---|
103 | ypij=yij+byi*grb |
---|
104 | zpij=zij+bzi*grb |
---|
105 | rpij=sqrt(xpij*xpij+ypij*ypij+zpij*zpij) |
---|
106 | if(rpij.le.rmacro)rpij=rmacro |
---|
107 | rp3=rpij**3 |
---|
108 | c |
---|
109 | epxin=xpij/rp3 |
---|
110 | epyin=ypij/rp3 |
---|
111 | epzin=zpij/rp3 |
---|
112 | c |
---|
113 | biep=bxi*epxin+byi*epyin+bzi*epzin |
---|
114 | bjep=bxj*epxin+byj*epyin+bzj*epzin |
---|
115 | bjbi=bxj*bxi+byj*byi+bzj*bzi |
---|
116 | bjbi1=1.-bjbi |
---|
117 | ggi=gami/(gami+1.) |
---|
118 | facbi=bjep-ggi*biep |
---|
119 | c |
---|
120 | fdp=facq*dist |
---|
121 | c |
---|
122 | dgbxj=fdp*gami*(epxin*bjbi1+bxi*facbi) |
---|
123 | dgbyj=fdp*gami*(epyin*bjbi1+byi*facbi) |
---|
124 | dgbzj=fdp*gami*(epzin*bjbi1+bzi*facbi) |
---|
125 | c |
---|
126 | cord(2,j)=cord(2,j)+dgbxj |
---|
127 | cord(4,j)=cord(4,j)+dgbyj |
---|
128 | cord(6,j)=cord(6,j)+dgbzj |
---|
129 | gam(j)=sqrt(1.+cord(2,j)**2+cord(4,j)**2+cord(6,j)**2) |
---|
130 | c |
---|
131 | 50 continue |
---|
132 | 40 continue |
---|
133 | 30 continue |
---|
134 | c |
---|
135 | return |
---|
136 | end |
---|
137 | c++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++* |
---|