| 31 |
real*8 x,y,z !point of interest |
real*8 x,y,z !point of interest |
| 32 |
real*8 res(3) !interpolated B components: res = (Bx, By, Bz) |
real*8 res(3) !interpolated B components: res = (Bx, By, Bz) |
| 33 |
|
|
| 34 |
|
real*8 zl,zu |
| 35 |
|
real*8 resu(3),resl(3) |
| 36 |
c------------------------------------------------------------------------ |
c------------------------------------------------------------------------ |
| 37 |
c |
c |
| 38 |
c set the field outside the interpolation volume to be 0 |
c set the field outside the interpolation volume to be 0 |
| 43 |
res(ip)=0. |
res(ip)=0. |
| 44 |
enddo |
enddo |
| 45 |
|
|
|
|
|
| 46 |
c------------------------------------------------------------------------ |
c------------------------------------------------------------------------ |
| 47 |
c |
c |
| 48 |
c check if the point falls inside the interpolation volume |
c check if the point falls inside the interpolation volumes |
| 49 |
c |
c |
| 50 |
c------------------------------------------------------------------------ |
c------------------------------------------------------------------------ |
| 51 |
|
|
| 52 |
if((x.ge.edgexmin).and.(x.le.edgexmax) |
* ----------------------- |
| 53 |
|
* INNER MAP |
| 54 |
|
* ----------------------- |
| 55 |
|
if( |
| 56 |
|
$ (x.ge.edgexmin).and.(x.le.edgexmax) |
| 57 |
$ .and.(y.ge.edgeymin).and.(y.le.edgeymax) |
$ .and.(y.ge.edgeymin).and.(y.le.edgeymax) |
| 58 |
$ .and.(z.ge.edgezmin).and.(z.le.edgezmax)) then |
$ .and.(z.ge.edgezmin).and.(z.le.edgezmax) |
| 59 |
|
$ ) then |
| 60 |
|
|
| 61 |
|
|
| 62 |
call inter_B_inner(x,y,z,res) |
call inter_B_inner(x,y,z,res) |
| 63 |
|
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 |
endif |
endif |
| 129 |
|
|
|
c TODO: add inter_B_outer subroutine(s) for the external magnetic field map |
|
| 130 |
|
|
| 131 |
return |
return |
| 132 |
end |
end |