trend

- 4

Trapped Radiation ENvironment model Development

Bug Report

[ Signature | Diagnostic | Solution | History ]

Signature

    R.01 - Anomalous return of subroutine UD310 with error code -41108

Diagnostic

    When the subroutine UD310 is called several times with a fixed value of the shell parameter (argument flm0) and increasing value of the magnetic field intensity at the mirror points (argument fbm0), sometimes the subroutine returns with an error flag set to -41108. The problem is illustrated below where L is fixed at 3.05 and Bm is varying from 0.15 to 0.17. The error occurs when Bm is equal to 0.15825.

    The error code -41108 is produced by the subroutine UF411 (search a local magnetic equator) when an error has occured in the subroutines UF426 (interpolating an extremum of B), UF427 (interpolating a value of B) or UF428 (interpolating an altitude). These three subroutines are used to determine the location of the local magnetic equator, the mirror points and the foot points, respectively. In the case of the illustration, the error occurs in subroutine UF427 with the error code -42702 (too many iterations). In version 1.05, the subroutine stops with an error after 10 iterations.

Source

      PROGRAM prob_01
C
      INCLUDE 'structure.h'
C
      INTEGER*4       kunit, kinit, ifail, kint, kext, noprint
      CHARACTER*32    lbint, lbext
      REAL*8          year, dst, fkp, swd, swv, amjd
      REAL*8          gm, bb0(5), fbm, flm, falt
      INTEGER*4       knfl, ktyplus, i
C
      COMMON /UC190/  prop, stepx, stpmin, umsq, upsq, uk2, uk3, 
     :                epskm, epsrel, stplst, xclat, kmflg, nxstp       
      REAL*8          prop, stepx, stpmin, umsq, upsq, uk2, uk3, 
     :                epskm, epsrel, stplst, xclat
      INTEGER*4       kmflg, nxstp
C
      DATA kunit, kinit, kint, kext, noprint/ 6, 1, 0, 0, -6/
      DATA year, dst, fkp, swd, swv, amjd/ 1995.0d0, 5*0.0d0/
      DATA gm, flm, falt/ 0.311653d0, 3.05d0, -999.9d0/
      DATA ktyplus, knfl/ 3, 60/
      DATA bb0/ 13.70163d0, 14.05445d0, 14.40727d0, 14.76010d0,
     :          15.11292d0/
C
      CALL UT990 (kunit, kinit, ifail)
      IF( ifail .LT. 0 )STOP
      CALL UM510 (kint, year, lbint, noprint, ifail)
      IF( ifail .LT. 0 )STOP
      CALL UM520 (kext, amjd, dst, fkp, swd, swv,
     :           lbext, noprint, ifail)
C     Be aware thar the synopsis of subroutine UM520 has changed.
      IF( ifail .LT. 0 )STOP
C
      WRITE (kunit,1020)epsrel*100
      WRITE (kunit,1000)
      DO i=1,5
        fbm   = bb0(i) * gm / flm**3
        ifail = 0
        CALL UD310 (fbm, flm, falt, knfl, ktyplus, ifail)
        WRITE (kunit,1010) i, flm, bb0(i), fbm, ifail
      ENDDO
C
      epsrel  = epsrel*2
      WRITE (kunit,1020)epsrel*100
      WRITE (kunit,1000)
      DO i=1,5
        fbm   = bb0(i) * gm / flm**3
        ifail = 0
        CALL UD310 (fbm, flm, falt, knfl, ktyplus, ifail)
        WRITE (kunit,1010) i, flm, bb0(i), fbm, ifail
      ENDDO
C
 1000 FORMAT(' #   L     B/B0    B      IFAIL')
 1010 FORMAT(i2,f5.2,f9.5,f8.5,i7)
 1020 FORMAT(/' Magnetic field precision set to',f11.4,' %')
C
      END

Result

                                UNILIB Library
                                 Version  1.05
                        Developed by BIRA/IASB for ESA

                               0500-002000-0500


--- Main control parameters ---

     UC160 (general constants):
                     Geoid major axis = 6378.16     km
                     Geoid minor axis = 6356.77     km
               Mean Earth radius (Re) = 6371.20     km
                 Ecliptic inclination =   23.441512 deg
                McIlwain Earth dipole =    0.311653 G/Re^3

     UC190 (field line tracing):
                    Maximum step size = 2548.5      km at one Re
             Maximum "last" step size =   25.0      km
                    Minimum step size =    5.0      km
                   Altitude precision =  250.       m
             Magnetic field precision =    0.00     %
                  Maximum step number =  400

     UC192 (magnetic field evaluation):
            Max. geomagnetic latitude =   80.0      deg
                       Minimum radius =    0.157    Re
           (drift shell tracing):
                       Precision on L =    0.10000  %
           Precision on the longitude =    0.05     deg

Magnetic field precision set to     0.0006 %
#   L     B/B0    B      IFAIL
1 3.05 13.70163 0.15050      1
2 3.05 14.05445 0.15438      1
3 3.05 14.40727 0.15825 -41108
4 3.05 14.76010 0.16213      1
5 3.05 15.11292 0.16600      1

Magnetic field precision set to     0.0012 %
#   L     B/B0    B      IFAIL
1 3.05 13.70163 0.15050      1
2 3.05 14.05445 0.15438      1
3 3.05 14.40727 0.15825      1
4 3.05 14.76010 0.16213      1
5 3.05 15.11292 0.16600      1

Solution

    The iterations in subroutine UF427 are controlled by the precision on the magnetic field intensity defined by the argument epsrel of the common block UC190. Increasing the value of the argument epsrel can solve the problem.

    Note that the argument epskm of the common block UC190 is used to control the iterations of subroutine UF428 in the same way.

    The maximum number of iterations in the subroutines UF426, UF427 and UF428 will be increased to 20 in future versions.

History

    August 26, 1997 - Bug reported by D. Heynderickx
    September 4, 1997 - Bug fixed in version 1.06