I'd like to know if a loop can be created, inside which I can call a subroutine in which there are arrays to be defined whose size varies as a function of loop variable. I tried as following, but got error "array bound is not scalar integer". How to solve this issue?
.
.
.
iloop: do i=5,24,0.5
jloop: do j=5,20
call check(i,j,divlen,Machexit,final)
if (final.eq.1) exit iloop
enddo jloop
enddo iloop
.
.
end program
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Subroutine check(i,j,divlen,Machexit,final)
INTEGER, PARAMETER :: IVLpts=10
real :: i,divlen,Machexit
integer :: final,j
integer :: exppts,intstrtpts,contourstrtpts,totalpts,P1,P2,P3,P4,P5,P6,P7
exppts=((j*IVLpts)+((j-1)*(IVLpts-1)))
P2=(exppts-IVLpts)
P3=(IVLpts-1)
P6=(exppts-P2)
call check2(IVLpts,i,j,divlen,Machexit,final,exppts,P2,P3,P6)
End subroutine check
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Subroutine check2(IVLpts,i,j,divlen,Machexit,final,exppts,P2,P3,P6)
Real, PARAMETER :: gamma=1.4d0,Mini=1.02d0
integer,allocatable :: expcontourpts(:),M(:),x(:),y(:)
real,allocatable :: AoverAstar(:),Mvariance(:)
allocate(expcontourpts(exppts))
allocate(M(exppts))
allocate(x(exppts))
allocate(y(exppts))
allocate(AoverAstar(P6))
allocate(Mvariance(P6))
.
.
.
End subroutine check2
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!