| 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 |
|
|
|
| 35 |
|
|
c------------------------------------------------------------------------ |
| 36 |
|
|
c |
| 37 |
|
|
c set the field outside the interpolation volume to be 0 |
| 38 |
|
|
c |
| 39 |
|
|
c------------------------------------------------------------------------ |
| 40 |
|
|
|
| 41 |
|
|
do ip=1,3 |
| 42 |
|
|
res(ip)=0. |
| 43 |
|
|
enddo |
| 44 |
|
|
|
| 45 |
|
|
|
| 46 |
|
|
c------------------------------------------------------------------------ |
| 47 |
|
|
c |
| 48 |
|
|
c check if the point falls inside the interpolation volume |
| 49 |
|
|
c |
| 50 |
|
|
c------------------------------------------------------------------------ |
| 51 |
|
|
|
| 52 |
|
|
if((x.ge.edgexmin).and.(x.le.edgexmax) |
| 53 |
|
|
$ .and.(y.ge.edgeymin).and.(y.le.edgeymax) |
| 54 |
|
|
$ .and.(z.ge.edgezmin).and.(z.le.edgezmax)) then |
| 55 |
|
|
|
| 56 |
|
|
call inter_B_inner(x,y,z,res) |
| 57 |
|
|
|
| 58 |
|
|
endif |
| 59 |
|
|
|
| 60 |
|
|
c TODO: add inter_B_outer subroutine(s) for the external magnetic field map |
| 61 |
|
|
|
| 62 |
|
|
return |
| 63 |
|
|
end |
| 64 |
|
|
|
| 65 |
|
|
|