1 | subroutine zout |
---|
2 | c---print a list of elements and their locations. |
---|
3 | c---------------------------------------------------------------------- |
---|
4 | save |
---|
5 | c |
---|
6 | include 'param_sz.h' |
---|
7 | include 'bfieldcom.h' |
---|
8 | include 'constcom.h' |
---|
9 | include 'flagcom.h' |
---|
10 | include 'pfieldcom.h' |
---|
11 | include 'phizoutcom.h' |
---|
12 | include 'syscom.h' |
---|
13 | include 'ucom.h' |
---|
14 | c |
---|
15 | parameter (nbcd=16) |
---|
16 | character*10 bcd(nbcd) |
---|
17 | c-------------------------------------------------------------------------- |
---|
18 | c* |
---|
19 | data (bcd(j),j=1,nbcd) /'drift','solenoid','quad','bend', |
---|
20 | 1 'buncher','chopper','cell','tank','trwave','sbload', |
---|
21 | 2 'rotate','dpout','cathode','wiggler','alpham','sextupol'/ |
---|
22 | if(ifld.ne.0 .or. poiflag)then |
---|
23 | write(nnout, 11) |
---|
24 | write(nnout, 12) |
---|
25 | else |
---|
26 | write(nnout, 10) |
---|
27 | write(nnout,13) |
---|
28 | endif |
---|
29 | 10 format(3x,'n',8x,'z1',2x,'element ',8x,'z2',8x,'dz',5x,'phase') |
---|
30 | 13 format(3x,1x,8x,'cm',2x,8x,8x,'cm',8x,'cm',4x,'degres') |
---|
31 | 11 format(3x,'n',8x,'z1',2x,'element ',8x,'z2',8x,'dz',5x, |
---|
32 | 1 'Bz(z2,r=0.)',4x,'phase') |
---|
33 | 12 format(3x,1x,8x,'cm',2x,8x,8x,'cm',8x,'cm',7x,'Gauss',7x,'degres') |
---|
34 | z1=0. |
---|
35 | do 30 n=1,nel |
---|
36 | z2=zloc(n) |
---|
37 | dz=z2-z1 |
---|
38 | nt=ntype(n) |
---|
39 | if(nt.eq.26)nt=11 |
---|
40 | if(nt.eq.27)nt=10 |
---|
41 | if(nt.eq.29)nt=12 |
---|
42 | if(nt.eq.30)nt=13 |
---|
43 | if(nt.eq.35)nt=14 ! wiggler |
---|
44 | if(nt.eq.36)nt=15 ! alpha magnet |
---|
45 | if(ifld.ne.0 .or. poiflag)then |
---|
46 | if(nt.eq.7) then |
---|
47 | angle=atan2(el(9,n),el(10,n))/radian |
---|
48 | c the range of the result for atan2 is -pi < result <= pi |
---|
49 | if(abs(angle).eq.180.) angle=-angle |
---|
50 | c si l'on veut l'angle entre sur la carte cell |
---|
51 | c angle=phideg(n) |
---|
52 | write(nnout, 40)n,z1,bcd(nt),z2,dz,bfld(z2,0.,brfld), |
---|
53 | * angle |
---|
54 | elseif(nt.eq.9) then |
---|
55 | angle=el(4,n)/radian |
---|
56 | write(nnout, 40)n,z1,bcd(nt),z2,dz,bfld(z2,0.,brfld), |
---|
57 | * angle |
---|
58 | else |
---|
59 | |
---|
60 | c for solenoid nt = 2 |
---|
61 | if(nt.eq.2) then |
---|
62 | write(nnout, 40)n,z1,bcd(nt),z2,dz,el(4,n) |
---|
63 | else |
---|
64 | write(nnout, 40)n,z1,bcd(nt),z2,dz,bfld(z2,0.,brfld) |
---|
65 | endif |
---|
66 | endif |
---|
67 | else |
---|
68 | if(nt.eq.7) then |
---|
69 | angle=atan2(el(9,n),el(10,n))/radian |
---|
70 | if(abs(angle).eq.180.) angle=-angle |
---|
71 | c si l'on veut l'angle entre sur la carte cell |
---|
72 | c angle=phideg(n) |
---|
73 | write(nnout, 20)n,z1,bcd(nt),z2,dz,angle |
---|
74 | elseif(nt.eq.9) then |
---|
75 | angle=el(4,n)/radian |
---|
76 | write(nnout, 20)n,z1,bcd(nt),z2,dz,angle |
---|
77 | else |
---|
78 | write(nnout, 20)n,z1,bcd(nt),z2,dz |
---|
79 | endif |
---|
80 | endif |
---|
81 | 20 format(i4,f10.1,2x,a10,f8.1,f10.3,f10.3) |
---|
82 | 40 format(i4,f10.1,2x,a10,f8.1,f10.2,f12.2,3x,f10.3) |
---|
83 | z1=z2 |
---|
84 | 30 continue |
---|
85 | if(ifld.ne.0.or.poiflag)then |
---|
86 | open(unit=nfield,file='pmbfield',access='sequential', |
---|
87 | * status='unknown',form='formatted') |
---|
88 | write(nfield,*)'z(cm) b(gauss)' |
---|
89 | if(ifld.ne.0) then |
---|
90 | zz=zmin |
---|
91 | zpas=dzz |
---|
92 | else |
---|
93 | zz=pzmin |
---|
94 | div=nptcbu |
---|
95 | cbm28/09/09 zpas=(pzmax-pzmin)/1000. |
---|
96 | zpas=(pzmax-pzmin)/div |
---|
97 | endif |
---|
98 | cbm28/09/09 do 50 i=1,1001 |
---|
99 | do 50 i=1,nptcbu+1 |
---|
100 | write(nfield,150)zz,bfld(zz,0.,br),br,bfld(zz,.5,br),br |
---|
101 | zz=zz+zpas |
---|
102 | 50 continue |
---|
103 | close(nfield) |
---|
104 | endif |
---|
105 | 150 format(f8.3,f10.2,3f10.2) |
---|
106 | return |
---|
107 | end |
---|
108 | c++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++* |
---|