program pwtime include 'dirspec.h' include 'openfile.h' character cFile*80 character cSay*6 /'pwtime'/ character cFmt*7 /'(F10.5)'/ logical bOpen, bOpenFile real*8 XCstart real*8 XCdelta real*8 XCend !------- ! ipsg2.time contains three double precison numbers in F12.5 format: ! Start time, increment, and end time, specified as Carrington times i = iFilePath(cEnvi//'temp',0,' ','ipsg2.times',cFile) i = OPN__TEXT+OPN__REOPEN+OPN__UNKNOWN bOpen = bOpenFile(i,iU,cFile,iRec) if (bOpen) then read (iU,cFmt) XCstart read (iU,cFmt) XCdelta read (iU,cFmt) XCend iU = iFreeLun(iU) else call Say(cSay,'W','STOP','error opening time control file for reading') ! Exit code 0 end if !------- ! ipsg2.input receives all the user input data. This file is piped into ipsg2 i = iFilePath(cEnvi//'temp',0,' ','ipsg2.input',cFile) i = OPN__TEXT+OPN__REOPEN+OPN__UNKNOWN bOpen = bOpenFile(i,iU,cFile,iRec) if (bOpen) then !-------- ! Write the input data for ipsg2 to an ascii file. ! Only the Carrington start time is updated using the setting of ! symbol XCstart. write (iU,'(A)') 'NO' write (iU,'(A)') '18' write (iU,'(A)') 'both' write (iU,'(A)') 'Nagoya' write (iU,'(A)') 'Nagoya' write (iU,'(A)') '0.3' write (iU,'(A)') '1.4' !------ ! Velocity section write (iU,'(A)') 'NO' write (iU,'(A)') '4' write (iU,'(A)') '9' write (iU,'(A)') 'all' write (iU,'(A)') '5' write (iU,'(A)') '180' write (iU,'(A)') '90' write (iU,'(A)') '400' write (iU,'(A)') '37' write (iU,'(A)') '19' write (iU,'(A)') '31' write (iU,'(A)') '1' write (iU,'(A)') '0' write (iU,'(A)') '-2.5' write (iU,'(A)') '0.1' !------- ! Start Carrington variable write (iU,cFmt) XCstart write (iU,'(A)') '1' iU = iFreeLun(iU) else call Say(cSay,'W','STOP','Error opening user file') ! Exit code 0 end if !------- ! Update ipsg2.times for the next pass by adding XCdelta to XCstart. i = iFilePath(cEnvi//'temp',0,' ','ipsg2.times',cFile) i = OPN__TEXT+OPN__REOPEN+OPN__UNKNOWN bOpen = bOpenFile(i,iU,cFile,iRec) if (bOpen) then XCstart = XCstart+XCdelta write (iU,cFmt) XCstart write (iU,cFmt) XCdelta write (iU,cFmt) XCend iU = iFreeLun(iU) if (XCstart .gt. XCend) call Say(cSay,'W','STOP','Stepped past end time') ! Exit code 0 else call Say(cSay,'W','STOP','error opening time control file for writing') ! Exit code 0: error end if print *, 'XCstart :', XCStart call Say(cSay,'S','STOP',' ') ! Exit code 1: success end