/[PAMELA software]/gpamela/gpfield/inter_B.F
ViewVC logotype

Annotation of /gpamela/gpfield/inter_B.F

Parent Directory Parent Directory | Revision Log Revision Log


Revision 3.2 - (hide annotations) (download)
Thu Dec 22 16:25:03 2005 UTC (18 years, 11 months ago) by bottai
Branch: MAIN
CVS Tags: v4r4, v4r5, v4r6, v4r7, v4r8, v4r9, v4r14, v4r12, v4r13, v4r10, v4r11, HEAD
Changes since 3.1: +77 -8 lines
 Decide which magn field map has to be used

1 cafagna 3.1 *************************************************************************
2     *
3     * Subroutine inter_B.f (from tracker software analysis)
4     *
5     * it computes the magnetic field in a chosen point x,y,z inside or
6     * outside the magnetic cavity, using a trilinear interpolation of
7     * B field measurements (read before by means of ./read_B.f)
8     * if the point falls outside the interpolation volume, set the field to 0
9     *
10     * needs:
11     * - ../common/common_B_inner.f common file for the inner magnetic field map
12     * - ./inter_B_inner.f common file for the inner magnetic field map
13     *
14     * to be called after ./read_B.f (magnetic field map reading subroutine)
15     *
16     * input: coordinates in m
17     * output: magnetic field in T
18     *
19     *************************************************************************
20    
21     subroutine inter_B(x,y,z,res) !coordinates in m, magnetic field in T
22     IMPLICIT DOUBLE PRECISION (A-H,O-Z)
23     #include "gpfield.inc"
24    
25     c------------------------------------------------------------------------
26     c
27     c local variables
28     c
29     c------------------------------------------------------------------------
30    
31     real*8 x,y,z !point of interest
32     real*8 res(3) !interpolated B components: res = (Bx, By, Bz)
33    
34 bottai 3.2 real*8 zl,zu
35     real*8 resu(3),resl(3)
36 cafagna 3.1 c------------------------------------------------------------------------
37     c
38     c set the field outside the interpolation volume to be 0
39     c
40     c------------------------------------------------------------------------
41    
42     do ip=1,3
43     res(ip)=0.
44     enddo
45    
46     c------------------------------------------------------------------------
47     c
48 bottai 3.2 c check if the point falls inside the interpolation volumes
49 cafagna 3.1 c
50     c------------------------------------------------------------------------
51 bottai 3.2
52     * -----------------------
53     * INNER MAP
54     * -----------------------
55     if(
56     $ (x.ge.edgexmin).and.(x.le.edgexmax)
57 cafagna 3.1 $ .and.(y.ge.edgeymin).and.(y.le.edgeymax)
58 bottai 3.2 $ .and.(z.ge.edgezmin).and.(z.le.edgezmax)
59     $ ) then
60    
61 cafagna 3.1
62     call inter_B_inner(x,y,z,res)
63 bottai 3.2 c print*,'INNER - ',z,res
64    
65     endif
66    
67     * -----------------------
68     * OUTER MAP
69     * -----------------------
70     if(
71     $ ((x.ge.edgeuxmin).and.(x.le.edgeuxmax)
72     $ .and.(y.ge.edgeuymin).and.(y.le.edgeuymax)
73     $ .and.(z.ge.edgeuzmin).and.(z.le.edgeuzmax))
74     $ .or.
75     $ ((x.ge.edgelxmin).and.(x.le.edgelxmax)
76     $ .and.(y.ge.edgelymin).and.(y.le.edgelymax)
77     $ .and.(z.ge.edgelzmin).and.(z.le.edgelzmax))
78     $ ) then
79    
80    
81     call inter_B_outer(x,y,z,res)
82     c res(2)=res(2)*10
83     c print*,'OUTER - ',z,res
84    
85     endif
86    
87     * --------------------------------
88     * GAP between INNER and OUTER MAPS
89     * --------------------------------
90     if(
91     $ (x.gt.edgexmin).and.(x.lt.edgexmax)
92     $ .and.(y.gt.edgeymin).and.(y.lt.edgeymax)
93     $ .and.(z.gt.edgezmax).and.(z.lt.edgeuzmin)
94     $ )then
95    
96     zu = edgeuzmin
97     zl = edgezmax
98     call inter_B_inner(x,y,zl,resu)
99     call inter_B_outer(x,y,zu,resl)
100    
101     do i=1,3
102     res(i) = z * ((resu(i)-resl(i))/(zu-zl))
103     $ + resu(i)
104     $ - zu * ((resu(i)-resl(i))/(zu-zl))
105     enddo
106     c print*,'GAP U - ',z,res
107    
108     elseif(
109     $ (x.gt.edgexmin).and.(x.lt.edgexmax)
110     $ .and.(y.gt.edgeymin).and.(y.lt.edgeymax)
111     $ .and.(z.gt.edgelzmax).and.(z.lt.edgezmin)
112     $ ) then
113    
114    
115     zu = edgezmin
116     zl = edgelzmax
117     call inter_B_inner(x,y,zu,resu)
118     call inter_B_outer(x,y,zl,resl)
119    
120    
121     do i=1,3
122     res(i) = z * ((resu(i)-resl(i))/(zu-zl))
123     $ + resu(i)
124     $ - zu * ((resu(i)-resl(i))/(zu-zl))
125     enddo
126     c print*,'GAP D - ',z,res
127    
128 cafagna 3.1 endif
129    
130    
131     return
132     end
133    
134    

  ViewVC Help
Powered by ViewVC 1.1.23