I’m running a Fortran visual studio 2022 console application and the Fortran code crashes with “A breakpoint instruction (__debugbreak() statement or a similar call) was executed” and when I press continue it gives me " forrtl: severe (408): fort: (11): Subscript #3 of the array XT has value 0 which is less than the lower bound of 1 ", when I back to the breakpoint I didn’t see in value 0
I don’t know where is the problem here ?
When kk = 1, the third subscript in the expression xt(1, nj, kk-1)
has the value 0, which is less than the lower bound of 1 (I am guessing that the default lower bound of 1 applies, since you did not show the declaration of xt). When the breakpoint on the line has been hit, note the value of kk. Is it equal to 1 then?
Lines of code, when relevant, are more useful than screen shots.
c May have a problem with Rint if the difference between
c cur and curold becomes too small. However, the bounds
c from curlow and curhigh should still give valid answers.
Rint=-(vv-vvold)/(cur-curold)+RG ! internal resistance
OCP=vv+(Rint-RG)cur
curmax=OCP/Rint/2.d0 ! estimate of current at max power
pwrmax=OCP**2/Rint/4.d0 ! estimate of max power
if(Lcount.eq.2) curhigh=2.d0curmax
endif
curold=cur
cur=cur-1.d0
if(Lcount.gt.1) then
if(curmax.gt.1.2d0*cur) curmax=1.2d0*cur
cur=curmax
if(cur.lt.curlow .or. cur.gt.curhigh) cur=0.5d0*(curlow+curhigh)
endif
if(Lcount.lt.18 .and. dabs(cur-curold).gt.1.d-5*dabs(cur)) go to 3
if(Lcount.lt.5) go to 3
cur=curold
endif
if ((xx(1,nj)/xt(1,nj,kk-1)).lt.0.75d0.and.xx(1,nj).lt.100.0d0)
1rr=rr/2.0d0