! $Id: main.f,v 1.9 2001/02/01 15:54:36 aake Exp $ ************************************************************************ program main * * Note that, due to a peculiarity in the CM compiler, one MUST include * all common blocks in the main program, even those that are not used * here. * include 'cparam.inc' include 'cdata.inc' include 'cwork.inc' include 'ctime.inc' include 'stagger.ifc' * character*(mfile) case, infile, outfile, chkfile, scrfile integer iread, iwrite *----------------------------------------------------------------------- * * Case and file names * open(10,file='job.in',form='formatted') read(10,'(a)') case ! initialization case read(10,'(a)') infile ! in datafile, *.cm->datavault read(10,'(a)') outfile ! out datafile read(10,'(a)') scrfile ! scratch file read(10,'(a)') chkfile ! check file * * Read parameters, first from .com file, then from stdin * read (10,*) iread, iwrite ! not in /cdata/ call read_cdata (infile, iread+1) include 'cread.inc' include 'cprint.inc' close(10) * * Read or construct initial state, initialize derivative factors * call start_data (case, infile, iread+1) call oflush * * Open output file, print shape info * call open_write_file (outfile, max0(1,iwrite)) * * Take `nt' timesteps, writing ascii check file every time step, * front end scratch file every `nscr' step, and snap shot data * each `nsnap' timesteps * tsnap = dtsnap*(ifix(t/dtsnap)) tscr = dtscr*(ifix(t/dtscr)) sec = 0. zones = 0 do it=1,nstep * * Scratch file, front end * if (t .ge. tscr) then ! call bound iscr = ifix(t/dtscr)+1 tscr = dtscr*iscr call aver (outfile, iscr) if (scrfile(1:1) .ne. ' ') then call write_data (scrfile, 1) write (*,'(1x,a,i6,f10.5,f8.5,2x,a)') & 'scratch: it,t,dt',it,t,dt,scrfile endif endif * * Snapshot file * if (t .ge. tsnap) then if (t-dt .le. tsnap) then ! call bound if (iwrite .ge. 0 .and. outfile(1:1) .ne. ' ') then call write_data (outfile, iwrite+1) write (*,'(1x,a,i7,i5,f10.5,f8.5,2x,a)') & 'snapshot: it,iwrite,t,dt',it,iwrite,t,dt,outfile endif iwrite = iwrite + 1 endif tsnap = dtsnap*(ifix(t/dtsnap)+1) endif call oflush call timestep * * Check file, time step info * open (13, file=chkfile, status='unknown') write (13,*) 'it=',it,' snap=',iwrite-1,' t=',t,' dt=',dt & ,' zones/s=', mw/cpu, nflop*1e-6*mw/sec close (13) call oflush if (t .gt. tstop+dt) go to 99 * end do * 99 call close_write_file(outfile) print *, zones*1e-3/sec, ' kz/s, ', nflop*1e-6*mw/sec, ' Mfl/s, & ',ifix(nflop/zones*mw), ' fl/z' * end