PROGRAM energy c ----------------------------------------------------------------- c c Calculate energy flux from even parity variable (only real part) c c Now copes with having unequally spaced timesteps, it works out c the smallest timestep, and uses this to interpolate to a new c array with equally spaced timesteps. c c ----------------------------------------------------------------- IMPLICIT NONE INTEGER,PARAMETER :: nmax=5000 INTEGER :: i,itotal,it1,it2,Nt 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,*) "---------------------------" WRITE(6,131) 131 FORMAT("Filename containing Q ? ",$) READ(5,*) filename WRITE(6,*) "Filename is ... ",filename OPEN(UNIT=12,FILE=filename,STATUS="old") DO i=1,nmax 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" STOP 101 CLOSE(12) c Give information about the data WRITE(6,*) "We have data from t=",t(1)," to ",t(itotal) c Find minimum time step dtmin = 100000.0 do i=2,itotal dt = t(i)-t(i-1) if (dt t(itotal)) GOTO 301 c Calculate final timeslice do i=1,itotal if (t(i)