SUBROUTINE rst_write( kt ) !!--------------------------------------------------------------------- !! *** ROUTINE rst_write *** !! !! ** Purpose : Write restart fields in direct access format !! !! ** Method : restart.output file, each nstock time step , save !! fields which are necessary for restart !! !! History : !! ! 91-03 () original code !! ! 91-11 (G. Madec) !! ! 92-06 (M. Imbard) correction restart file !! ! 92-07 (M. Imbard) split into diawri and rstwri !! ! 98-02 (M. Guyon) FETI method !! ! 98-05 (G. Roullet) free surface !! ! 99-11 (M. Imbard) NetCDF FORMAT with ioipsl !! 8.5 ! 02-08 (G. Madec) F90: Free form !!---------------------------------------------------------------------- !! * Arguments INTEGER, INTENT( in ) :: kt ! ocean time-step !! * Local declarations INTEGER :: ino0, it0, ipcg0, isor0, itke0 INTEGER :: ibloc, ilglo !!---------------------------------------------------------------------- !! OPA 8.5, LODYC-IPSL (2002) !!---------------------------------------------------------------------- IF( kt == nit000 ) THEN IF(lwp) WRITE(numout,*) IF(lwp) WRITE(numout,*) 'rst_write : write restart.output direct access file' IF(lwp) WRITE(numout,*) '~~~~~~~~~' ibloc = 4096 ilglo = ibloc*((jpiglo*jpjglo*jpbyt-1 )/ibloc+1) CALL ctlopn( numwrs,'restart.output', 'UNKNOWN','UNFORMATTED','DIRECT', ilglo, numout, lwp, 1 ) ENDIF IF( MOD( kt, nstock ) == 0 .OR. kt == nitend ) THEN ! 0. Initializations ! ------------------ IF(lwp) THEN WRITE(numout,*) ' output done in numwrs = ', numwrs,' at it= ',kt,' date= ',ndastp ENDIF ino0 = no it0 = kt ipcg0 = 0 isor0 = 0 itke0 = 0 isor0 = nsolv - 1 ipcg0 = 2 - nsolv IF( lk_zdftke ) itke0 = 1 ! FETI method IF (nsolv == 3) THEN isor0 = 2 ipcg0 = 2 ENDIF ! 1. Write in numwrs ! ------------------ IF(lwp) WRITE(numwrs,REC=1) & ! first record ino0, it0, isor0, ipcg0, itke0, ndastp ! ! prognostic variables CALL write3(numwrs,ub ,2 ) ! before fields CALL write3(numwrs,vb ,3 ) CALL write3(numwrs,tb ,5 ) CALL write3(numwrs,sb ,6 ) CALL write3(numwrs,rotb ,7 ) CALL write3(numwrs,hdivb,8 ) CALL write3(numwrs,un ,9 ) ! now fields CALL write3(numwrs,vn ,10) CALL write3(numwrs,tn ,12) CALL write3(numwrs,sn ,13) CALL write3(numwrs,rotn ,14) CALL write3(numwrs,hdivn,15) CALL write2(numwrs,gcx ,jpk,17) ! Read elliptic solver arrays CALL write2(numwrs,gcxb,jpk,18) #if defined key_dynspg_fsc CALL write2(numwrs,sshb,jpk,4 ) ! free surface formulation (ssh) CALL write2(numwrs,sshn,jpk,11) #else CALL write2(numwrs,bsfb,jpk,4 ) ! Rigid-lid formulation (bsf) CALL write2(numwrs,bsfn,jpk,11) CALL write2(numwrs,bsfd,jpk,16) #endif IF( lk_zdftke ) CALL write3(numwrs,en,19) ! TKE arrays ENDIF END SUBROUTINE rst_write SUBROUTINE rst_read !!---------------------------------------------------------------------- !! *** ROUTINE rst_read *** !! !!---------------------------------------------------------------------- !! * Local declarations INTEGER :: ino0, it0, ipcg0, isor0, itke0 INTEGER :: ino1, it1, isor1, ipcg1, itke1, idast1 INTEGER :: ibloc, ilglo INTEGER :: inum ! temporary logical unit !!---------------------------------------------------------------------- !! OPA 8.5, LODYC-IPSL (2002) !!---------------------------------------------------------------------- ! open restart file ibloc = 4096 ilglo = ibloc*((jpiglo*jpjglo*jpbyt-1 )/ibloc+1) CALL ctlopn(inum,'restart','OLD','UNFORMATTED','DIRECT', & ilglo,numout,lwp,1) ! restart options IF(nrstdt == 0) THEN IF(lwp) WRITE(numout,*) ' nrstdt = 0 no control of nit000' ELSE IF(nrstdt == 1) THEN IF(lwp) WRITE(numout,*) ' nrstdt = 1 we control the date' ELSE IF(lwp) WRITE(numout,*) ' ===>>>> nrstdt not equal 0 or 1' IF(lwp) WRITE(numout,*) ' ======= ======' IF(lwp) WRITE(numout,*) ' we dont control the date' ENDIF ! 0. Initialisations ! ------------------ ino0 = no it0 = nit000 ipcg0 = 0 isor0 = 0 itke0 = 0 isor0 = nsolv-1 ipcg0 = 2-nsolv IF( lk_zdftke ) itke0 = 1 ! FETI method IF( nsolv == 3 ) THEN isor0=2 ipcg0=2 ENDIF IF(lwp) THEN WRITE(numout,*) WRITE(numout,*) ' *** dtrlec: beginning of restart' WRITE(numout,*) ' ' WRITE(numout,*) ' the present run :' WRITE(numout,*) ' job number : ', no WRITE(numout,*) ' with nit000 : ', nit000 WRITE(numout,*) ' with pcg option ipcg0 : ', ipcg0 WRITE(numout,*) ' with sor option isor0 : ', isor0 WRITE(numout,*) ' with FETI solver option ipcg0 & isor0 : ', ipcg0,' & ',isor0 WRITE(numout,*) ' with tke option itke0 : ', itke0 ENDIF ! 1. Read inum ! -------------- ! First record READ(inum,REC=1) ino1, it1, isor1, ipcg1, itke1, idast1 IF(lwp) THEN WRITE(numout,*) WRITE(numout,*) ' READ inum with ' WRITE(numout,*) ' job number : ', ino1 WRITE(numout,*) ' with time step it : ', it1 WRITE(numout,*) ' with pcg option ipcg1 : ', ipcg1 WRITE(numout,*) ' with sor option isor1 : ', isor1 WRITE(numout,*) ' with tke option itke1 : ', itke1 WRITE(numout,*) ' with FETI solver option ipcg1 + isor1 : ', ipcg1 + isor1 WRITE(numout,*) ENDIF ! Control of date IF( (it0-it1) /= 1 .AND. ABS(nrstdt) == 1 ) THEN IF(lwp) THEN WRITE(numout,*) ' ===>>>> : problem with nit000 for the restart' WRITE(numout,*) ' ======= =======' WRITE(numout,*) ' we stop. verify the file' WRITE(numout,*) ' or rerun with the value 0 for the' WRITE(numout,*) ' control of time parameter nrstdt' WRITE(numout,*) ENDIF STOP 'dtrlec' ENDIF CALL read3(inum,ub ,2 ) ! Read prognostic variables CALL read3(inum,vb ,3 ) CALL read3(inum,tb ,5 ) CALL read3(inum,sb ,6 ) CALL read3(inum,rotb ,7 ) CALL read3(inum,hdivb,8 ) CALL read3(inum,un ,9 ) CALL read3(inum,vn ,10) CALL read3(inum,tn ,12) CALL read3(inum,sn ,13) CALL read3(inum,rotn ,14) CALL read3(inum,hdivn,15) CALL read2(inum,gcx ,jpk,17) ! Read elliptic solver arrays CALL read2(inum,gcxb,jpk,18) # if defined key_dynspg_fsc CALL read2(inum,sshb ,jpk,4 ) ! free surface formulation (ssh) CALL read2(inum,sshn ,jpk,11) # else CALL read2(inum,bsfb ,jpk,4 ) ! Rigid-lid formulation (bsf) CALL read2(inum,bsfn ,jpk,11) CALL read2(inum,bsfd ,jpk,16) # endif IF( lk_zdftke ) THEN IF( itke1 == 1 ) THEN ! Read tke arrays CALL read3(inum,en,19) ELSE IF(lwp) WRITE(numout,*) ' ===>>>> : the previous restart file didnot used tke scheme' IF(lwp) WRITE(numout,*) ' ======= =======' nrstdt = 2 ENDIF ENDIF CLOSE( inum ) END SUBROUTINE rst_read