************************************************************************* * * Subroutine inter_B.f (from tracker software analysis) * * it computes the magnetic field in a chosen point x,y,z inside or * outside the magnetic cavity, using a trilinear interpolation of * B field measurements (read before by means of ./read_B.f) * if the point falls outside the interpolation volume, set the field to 0 * * needs: * - ../common/common_B_inner.f common file for the inner magnetic field map * - ./inter_B_inner.f common file for the inner magnetic field map * * to be called after ./read_B.f (magnetic field map reading subroutine) * * input: coordinates in m * output: magnetic field in T * ************************************************************************* subroutine inter_B(x,y,z,res) !coordinates in m, magnetic field in T IMPLICIT DOUBLE PRECISION (A-H,O-Z) #include "gpfield.inc" c------------------------------------------------------------------------ c c local variables c c------------------------------------------------------------------------ real*8 x,y,z !point of interest real*8 res(3) !interpolated B components: res = (Bx, By, Bz) c------------------------------------------------------------------------ c c set the field outside the interpolation volume to be 0 c c------------------------------------------------------------------------ do ip=1,3 res(ip)=0. enddo c------------------------------------------------------------------------ c c check if the point falls inside the interpolation volume c c------------------------------------------------------------------------ if((x.ge.edgexmin).and.(x.le.edgexmax) $ .and.(y.ge.edgeymin).and.(y.le.edgeymax) $ .and.(z.ge.edgezmin).and.(z.le.edgezmax)) then call inter_B_inner(x,y,z,res) endif c TODO: add inter_B_outer subroutine(s) for the external magnetic field map return end