Skip to content

Array bounds error in XINT in clblm_Spectrum.f90 #8

@rsiddans

Description

@rsiddans

On some runs CLBLM crashes with array bounds error in SUBROUTINE XINT in clblm_Spectrum.f90
This hapenned when A has dimension of 13000 at end of loop (I=IHI) and the calculated value of J+2=130001,

I "fixed" by adding variables JP1=min(J+1,SIZE(A)) and JP2=min(J+2,SIZE(A)) and then using those to evaluate CONTI.
Modified section of code below

   SZA=SIZE(A)
   DO 10 I = ILO, IHI
      VI = VFT+DVR3* REAL(I-1)
      J = (VI-V1A)*RECDVA+ONEPL
! R.S. ensure J+1 and J+2 do not exceed SZA array bound of A
      JP1=MIN(J+1,SZA)
      JP2=MIN(J+2,SZA)   ! R.S. can reach 13001=SZA+1 in some circs 
      VJ = V1A+DVA* REAL(J-1)
      P = RECDVA*(VI-VJ)
      C = (3.-2.*P)*P*P
      B = 0.5*P*(1.-P)
      B1 = B*(1.-P)
      B2 = B*P
      CONTI = -A(J-1)*B1+A(J)*(1.-C+B2)+A(JP1)*(C+B1)-A(JP2)*B2
      R3(I) = R3(I)+CONTI*AFACT
10 END DO

I can provide more details of the run which gives this error if that helps.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions