diff options
Diffstat (limited to 'src/energy.f')
-rw-r--r-- | src/energy.f | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/src/energy.f b/src/energy.f index 19ef5e2..2466e83 100644 --- a/src/energy.f +++ b/src/energy.f @@ -1,3 +1,4 @@ + PROGRAM energy c ----------------------------------------------------------------- @@ -17,7 +18,7 @@ c ----------------------------------------------------------------- CHARACTER*50 filename REAL*8 t(nmax),Qplus(nmax),dEdt(nmax),E,ddQ(nmax),Qnew(nmax) REAL*8 Dtnew,fac,time,t1,t2,dQdt_l,dQdt_r,dtmin,dt - + INTEGER :: ioerror WRITE(6,*) WRITE(6,*) "Starting PROGRAM energy ..." WRITE(6,*) "---------------------------" @@ -30,7 +31,8 @@ c ----------------------------------------------------------------- OPEN(UNIT=12,FILE=filename,STATUS="old") DO i=1,nmax - READ(12,*,ERR=101) t(i),Qplus(i) + READ(12,*,ERR=101, IOSTAT=ioerror) t(i),Qplus(i) + if(ioerror /= 0) goto 101 itotal = i END DO WRITE(6,*) "Didn't read all of data file" @@ -101,12 +103,12 @@ c Calculate energy flux dEdt(Nt) = fac*((Qnew(Nt)-Qnew(Nt-1))/Dtnew)**2 c Write results to file - OPEN(UNIT=101,FILE="dEdt",STATUS="unknown") + OPEN(UNIT=21,FILE="dEdt",STATUS="unknown") DO i = 1,Nt time = t1+DBLE(i-1)*Dtnew - WRITE(101,*) time,dEdt(i) + WRITE(21,*) time,dEdt(i) END DO - CLOSE(101) + CLOSE(21) c Use Simpsons rule to calculate integral IF ( MOD(Nt,2) /= 0) THEN @@ -202,4 +204,3 @@ c Write out total energy END - |