Fundamental Technologies

Cassini MIMI Pages

Numerical Computation of Energy-Dependent Geometric Factors of E and F Electron Detectors of CASSINI/MIMI/LEMMS, Technical Report by Xiaodong Hong and Thomas P. Armstrong, May 10, 1997

 

******************************************************************************
*                                                                            *
*                              PROGRAM I.5                                   *
*                                                                            *
******************************************************************************
*                                                                            *
*                               FDMOD5.FOR                                   *
*      This subroutine compute the the X, Y, and Z component of the magnetic *
*  produced by the magnets                                                   *
*                                                                            *
******************************************************************************  
      SUBROUTINE FDMOD(X,Y,Z,BX,BY,BZ)
C
C     ----- PURPOSE -----
C     THIS ROUTINE COMPUTES THE MAGNETIC FIELD I.E. BX,BY,AND BZ
C     OF GIVEN X,Y,AND Z. THE DETAILS OF THE MAGNTIC FIELD MODEL
C     ARE EXPLAINED IN APPENDICS I OF THE MANUAL. THE ENTIRE PROCEDURE
C     INCLUDES A SUPERPOSITION OF THE DIVIED MAGNETIZED PIECES FOR BOTH
C     LEFT AND RIGHT MAGNETS. FOR EACH A TRANSLATION AND A ROTATION OF 
C     THE COORDINATE SYSTEM AS WELL AS THE USE OF BX,BY,AND BZ FUNCTIONS
C     ARE CARRIED OUT.
C
C     NOTE : X,Y,Z COORDINATES SHOULD BE MEASURED IN CENTIMETER (CM)
C
C     ----- ENTRY -----
C     X,Y,Z       : THE LOCATION WHERE THE MAGNETIC FIELD IS DESERIED 
C     
C     ----- RETURN -----
C     BX,BY,BZ    : THE COMPONENTS OF THE MAGNETIC FIELD 
C
C     ----- OTHERS -----
C     BXX         :FUNCTION TO COMPUTE X-COMPONENT OF THE MAGNETIC FIELD
C     BYY         :FUNCTION TO COMPUTE Y-COMPONENT OF THE MAGNETIC FIELD
C     BZZ         :FUNCTION TO COMPUTE Z-COMPONENT OF THE MAGNTEIC FIELD
C     BX1,BY1,BZ1 :FIELD COMPONENTS DUE TO THE LEFT MAGNET.
C     BX2,BY2,BZ2 :FIELD COMPONENTS DUE TO THE RIGHT MAGNET.
C     XO,YO,ZO    :WORKING AREA
C     X1,Y1,Z1    :WORKING AREA
C     X2,Y2,Z2    :WORKING AREA
C     
       IMPLICIT NONE
       REAL*8 XO,YO,ZO,Y1,Z1,Y2,Z2,YP,YN,XP,XN,x,y,z
       REAL*8 BXX,BYY,BZZ,BX1,BX2,BY1,BY2,BZ1,BZ2      
       REAL*8 BX,BY,BZ,BX10,BY10,BZ10,BX20,BY20,BZ20
       REAL*8 ANG
       INTEGER LX,LY
       INCLUDE '[hong.casbfield]FDMOD5.CMN' 
C
C     INITIALIZATION OF THE FIELD     
C 
      BX=0.0
      BY=0.0 
      BZ=0.0
C
C     PRINT *,'ATTENTION'
C     PRINT *,'PI: ',PI
C     PRINT *,'RAD: ',RAD
C     PRINT *,'ANGLE: ',ANGLE
      ANG=ANGLE/RAD         ! CONVERSION FROM DEGREE TO RADIAL
C	print*,'angle:',ang
      DO LX=1,NX
         DO LY=1,NY
C
C           THE TRANSLATION OF THE COORDINATE SYSTEM
C         
            XO=X-XL(LX)
            YO=Y-YL(LY)
            ZO=Z+ZL(LY)
C
C           THE ROTATION OF THE COORDINATE SYSTEM FOR LEFT MAGNET
C
            Y1=YO*dCOS(ANG)+ZO*dSIN(ANG)
            Z1=-YO*dSIN(ANG)+ZO*dCOS(ANG)
C
C           THE ROTATION OF THE COORDINATE SYSTEM FOR RIGHT MAGNET
C
            Y2=YO*dCOS(ANG)-(ZO-SEPTS(LY))*dSIN(ANG)
            Z2=YO*dSIN(ANG)+(ZO-SEPTS(LY))*dCOS(ANG)
            YP=Y1+WIDTHS(LY)
            YN=Y1-WIDTHS(LY)
            XP=XO+LENGTHS(LX)
            XN=XO-LENGTHS(LX)
            BZ1=BZZ(YP,XP,Z1)-BZZ(YP,XN,Z1)-BZZ(YN,XP,Z1)+BZZ(YN,XN,Z1)
            BY1=BYY(YP,XN,Z1)-BYY(YP,XP,Z1)-BYY(YN,XN,Z1)+BYY(YN,XP,Z1)
            BX1=BXX(YP,XN,Z1)-BXX(YP,XP,Z1)-BXX(YN,XN,Z1)+BXX(YN,XP,Z1)
            YP=Y2+WIDTHS(LY)
            YN=Y2-WIDTHS(LY)
            BZ2=BZZ(YP,XP,Z2)-BZZ(YP,XN,Z2)-BZZ(YN,XP,Z2)+BZZ(YN,XN,Z2)
            BY2=BYY(YP,XN,Z2)-BYY(YP,XP,Z2)-BYY(YN,XN,Z2)+BYY(YN,XP,Z2)
            BX2=BXX(YP,XN,Z2)-BXX(YP,XP,Z2)-BXX(YN,XN,Z2)+BXX(YN,XP,Z2)
C	MODIFIED BYE X. HONG JAN 26TH 1996. THE ABOVE B FIELD COMPONENTS
C		ARE IN THE COORDINATES WITH XY PLANE IN THE MAGNET....
C			AND THEY SHALL BE ROTATED BACK TO THE OLD COORDINATES
	    
	    BX10=BX1
	    BY10=BY1*DCOS(ANG)-BZ1*DSIN(ANG)
	    BZ10=BY1*DSIN(ANG)+BZ1*DCOS(ANG)	
	    BX20=BX2
	    BY20=BY2*DCOS(ANG)+BZ2*DSIN(ANG)
	    BZ20=-BY2*DSIN(ANG)+BZ2*DCOS(ANG)
            BZ=BZ + NC*MAGS(LX,LY)*(BZ20-BZ10)
            BY=BY + NC*MAGS(LX,LY)*(BY20-BY10)
            BX=BX + NC*MAGS(LX,LY)*(BX20-BX10)
D           PRINT *,'BX1: ',BX1,' BX2: ',BX2
D           PRINT *,'BY1: ',BY1,' BY2: ',BY2
D           PRINT *,'BZ1: ',BZ1,' BZ2: ',BZ2
D           PRINT *,'BX: ',BX,' BY: ',BY,' BZ: ',BZ
D           PRINT *,' '
          END DO
       END DO
       BX = 1.1709*BX
       BY = 1.1709*BY
       BZ = 1.1709*BZ		
       RETURN
       END
C
C ****************************************************************
C
      REAL FUNCTION BXX(P1,P2,P3)
C
C     ----- PURPOSE -----
C     THIS ROUTINE COMPUTES THE X-COMPONENT OF THE MAGNEITC FIELD.
C     ITS ANALYTIC EXPRESSION IS GIVEN IN APPENDICS I.
C     
C     ----- ENTRY -----
C     P1,P2,P3   : ARGUMENTS RELATED TO COORDINATES AND GEOMETRIC 
C                  PARAMETERS OF THE MODEL
C     
C     ----- RETURN -----
C     BXX        : CONTAINS X-COMPONENT OF THE MAGNETIC FIELD
C    
C     ----- OTHERS -----
C     TEMP       : WORKING AREA
C
      REAL*8 TEMP,P1,P2,P3
C      
      TEMP=dSQRT(P1**2+P2**2+P3**2)
      
      BXX=dLOG(TEMP+P1)
      RETURN
      END
C
C ******************************************************************
C    
      REAL FUNCTION BYY(P1,P2,P3)
C
C     ----- PURPOSE -----
C     THIS ROUTINE COMPUTES THE Y-COMPONENT OF THE MAGNEITC FIELD.
C     ITS ANALYTIC EXPRESSION IS GIVEN IN APPENDICS I.
C     
C     ----- ENTRY -----
C     P1,P2,P3   : ARGUMENTS RELATED TO COORDINATES AND GEOMETRIC 
C                  PARAMETERS OF THE MODEL
C     
C     ----- RETURN -----
C     BYY        : CONTAINS Y-COMPONENT OF THE MAGNETIC FIELD
C    
C     ----- OTHERS -----
C     TEMP       : WORKING AREA
C
      REAL*8 TEMP,P1,P2,P3
C
      TEMP=dSQRT(P1**2+P2**2+P3**2)
      
      BYY=dLOG(TEMP+P2)
      RETURN
      END
C
C *************************************************************
C
      REAL FUNCTION BZZ(P1,P2,P3)
C
C     ----- PURPOSE -----
C     THIS ROUTINE COMPUTES THE Z-COMPONENT OF THE MAGNEITC FIELD.
C     ITS ANALYTIC EXPRESSION IS GIVEN IN APPENDICS I.
C     
C     ----- ENTRY -----
C     P1,P2,P3   : ARGUMENTS RELATED TO COORDINATES AND GEOMETRIC 
C                  PARAMETERS OF THE MODEL
C     
C     ----- RETURN -----
C     BZZ        : CONTAINS Z-COMPONENT OF THE MAGNETIC FIELD
C    
C     ----- OTHERS -----
C     TEMP       : WORKING AREA
C
C**************************************************************
      REAL*8 TEMP,P1,P2,P3
  
      IF (P3 .NE. 0.0D0) THEN 
	TEMP = (P1*P2)/(P3*DSQRT(P1**2+P2**2+P3**2))
        TEMP = dATAN(TEMP)
      ELSE
	TEMP = 2*1.5708
      END IF
      BZZ = TEMP
      RETURN
      END 
C**************************************************************

Return to Technical Report table of contents.
Return to Cassini MIMI table of contents page.
Return to Fundamental Technologies Home Page.

Updated 6/6/02, T. Hunt-Ward
tizby@ftecs.com