Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
28385 Discussions

Program Exception - array bounds exceeded

YenShih_C_
Beginner
793 Views

Hello,

I have a problem while running a fixed format Fortran program.

I use IMSL to calculate a integral equation: F(T)=exp(-Ea/T) dT, where Ea is a 5*3 matrix of random number.

Somehow the integral equation in the real function F(T) can't read the value Ea which is defined in main program.

When I execute the program, it shows "forrtl : severe <161> : Program Exception - array bounds exceeded"

Therefore, I would like to ask how to read the value from main program and execute successfully.

Thank you!

 

Here is the entire program,

program main
    use imsl
    implicit real*8 (a-h,o-z)
    integer NOUT
      
    real, external :: F
    real D,U
    real, parameter :: errabs = 1E-5
    real, parameter :: errrel = 1E-5
    real ans, err
    real Ea(12,12)
    common Ea,i,k
    namelist/limit/No_of_agen,No_of_comp

    D=0
    U=3
    No_of_agen=5
    No_of_comp=3

!-----------------------------------------------------
! initail random Ea
!-----------------------------------------------------
    Do k=1,No_of_agen
      Do i=1,No_of_comp  

        call random_number(rn01)
        Ea(k,i)=10*rn01

        write(*,*) Ea(k,i)
      end do
    end do

!-----------------------------------------------------
! integral of each Ea
!-----------------------------------------------------
    Do 10 k=1,No_of_agen
      Do 20 i=1,No_of_comp
    
        ans=0

        Call QDAGS (F, D, U, errabs, errrel, ans, err)

        write(*,*) ans

20   continue
10  continue

    end 

    real function F(T)
    implicit real*8 (a-h,o-z)
    real Ea(12,12)
    real T
    common /part1/ Ea,i,k
    
    F = EXP(-Ea(k,i)/T)
      write(*,*) Ea(k,i)

    return
    end function

 

0 Kudos
6 Replies
mecej4
Honored Contributor III
793 Views

You posted the same message in the Intel Fortran for Windows forum. I replied there.

0 Kudos
YenShih_C_
Beginner
793 Views

Yes, I posted here first and found that it's wrong zone.

However, I don't know how to delete.

Therefore, I post again in the windows zone.

Sorry and thank you all!

0 Kudos
mecej4
Honored Contributor III
793 Views

What you did is not uncommon among new users, who may be unfamiliar with the organization of these forums.

If you want a post of your deleted, add a comment at the end addressed to MODERATOR or, if that is not allowed (typical for the first post in a thread), add a new "response" simply requesting that the thread be moved or removed, as appropriate. Alternatively, you may send a private message to Kevin D. or one of the other Intel people (their name usually contains a "(Intel)" suffix.

0 Kudos
Kevin_D_Intel
Employee
793 Views

I intentionally did not delete this post earlier because it has value in this forum too (its not Windows specific) and given some may only search this forum. I just added the cross reference for convenience of others.

mecej4 is correct, we'll happily remove posts as requested. I think this one is fine though.

0 Kudos
YenShih_C_
Beginner
793 Views

Thank you! Now I know how to deal with it.

Sincerely, thank you all!

0 Kudos
Reply