!!---------------------------------------------------------------------- !! *** limrst_fdir.h90 *** !!---------------------------------------------------------------------- !! LIM 2.0 , UCL-LODYC-IPSL (2003) !!---------------------------------------------------------------------- SUBROUTINE lim_rst_write( niter ) !!----------------------------------------------------------------------- !! output of binary files !!----------------------------------------------------------------------- !! * Arguments INTEGER :: niter ! number of iteration !- dummy variables : CHARACTER(len=45) :: & ccfile = 'restart_ice_out' INTEGER :: & ji, jj INTEGER :: & inumwrs, it0 REAL(wp),DIMENSION(jpi,jpj,35) :: & zmoment REAL(wp),DIMENSION(2) :: & zinfo !!----------------------------------------------------------------------- inumwrs = 61 OPEN ( UNIT = inumwrs , FILE = ccfile, STATUS = 'unknown', FORM='unformatted' ) it0 = niter zinfo(1) = FLOAT( nfice ) ! iteration number zinfo(2) = FLOAT( it0 ) ! time-step in second ! Write in inumwrs zmoment(:,:,1) = sxice (:,:) zmoment(:,:,2) = syice (:,:) zmoment(:,:,3) = sxxice(:,:) zmoment(:,:,4) = syyice(:,:) zmoment(:,:,5) = sxyice(:,:) zmoment(:,:,6) = sxsn (:,:) zmoment(:,:,7) = sysn (:,:) zmoment(:,:,8) = sxxsn (:,:) zmoment(:,:,9) = syysn (:,:) zmoment(:,:,10) = sxysn (:,:) zmoment(:,:,11) = sxa (:,:) zmoment(:,:,12) = sya (:,:) zmoment(:,:,13) = sxxa (:,:) zmoment(:,:,14) = syya (:,:) zmoment(:,:,15) = sxya (:,:) zmoment(:,:,16) = sxc0 (:,:) zmoment(:,:,17) = syc0 (:,:) zmoment(:,:,18) = sxxc0 (:,:) zmoment(:,:,19) = syyc0 (:,:) zmoment(:,:,20) = sxyc0 (:,:) zmoment(:,:,21) = sxc1 (:,:) zmoment(:,:,22) = syc1 (:,:) zmoment(:,:,23) = sxxc1 (:,:) zmoment(:,:,24) = syyc1 (:,:) zmoment(:,:,25) = sxyc1 (:,:) zmoment(:,:,26) = sxc2 (:,:) zmoment(:,:,27) = syc2 (:,:) zmoment(:,:,28) = sxxc2 (:,:) zmoment(:,:,29) = syyc2 (:,:) zmoment(:,:,30) = sxyc2 (:,:) zmoment(:,:,31) = sxst (:,:) zmoment(:,:,32) = syst (:,:) zmoment(:,:,33) = sxxst (:,:) zmoment(:,:,34) = syyst (:,:) zmoment(:,:,35) = sxyst (:,:) WRITE(inumwrs) zinfo ! restart informations WRITE(inumwrs) hicif ! prognostic variables WRITE(inumwrs) hsnif WRITE(inumwrs) frld WRITE(inumwrs) sist # if defined key_coupled WRITE(inumwrs) albege # endif WRITE(inumwrs) tbif WRITE(inumwrs) u_ice WRITE(inumwrs) v_ice WRITE(inumwrs) gtaux WRITE(inumwrs) gtauy WRITE(inumwrs) qstoif WRITE(inumwrs) fsbbq WRITE(inumwrs) zmoment CLOSE(inumwrs) END SUBROUTINE lim_rst_write SUBROUTINE lim_rst_read(niter ) !!----------------------------------------------------------------------- !! restart from a state defined in a binary file !!----------------------------------------------------------------------- !! * Arguments INTEGER :: niter ! number of iteration !- dummy variables : CHARACTER(len=45) :: & ccfile = 'restart_ice.in' INTEGER :: & ji, jj INTEGER :: & inumrst, it0, it1, ifice REAL(wp),DIMENSION(jpi,jpj,35) :: & zmoment REAL(wp),DIMENSION(2) :: & zinfo !!----------------------------------------------------------------------- !Initialisations inumrst = 71 !Read inumrst OPEN( UNIT = inumrst, FILE = ccfile, STATUS = 'old', FORM = 'unformatted') it0 = nit000 READ(inumrst) zinfo ! restart informations ifice = INT( zinfo(1) ) it1 = INT( zinfo(2) ) WRITE(numout,*) WRITE(numout,*) 'lim_rst_fdir : READ restart file name ', ccfile, ' at time step : ', it1 WRITE(numout,*) '~~~~~~~~~~~~' !Control of date IF( ( it0 - it1 ) /= 1 .AND. ABS( nrstdt ) == 1 ) THEN WRITE(numout,cform_err) WRITE(numout,*) ' ===>>>> : problem with nit000 for the restart' WRITE(numout,*) ' we stop. verify the file or rerun with the value 0 for the' WRITE(numout,*) ' control of time parameter nrstdt' nstop = nstop + 1 ENDIF READ(inumrst) hicif ! prognostic variables READ(inumrst) hsnif READ(inumrst) frld READ(inumrst) sist # if defined key_coupled READ(inumrst) albege # endif READ(inumrst) tbif READ(inumrst) u_ice READ(inumrst) v_ice READ(inumrst) gtaux READ(inumrst) gtauy READ(inumrst) qstoif READ(inumrst) fsbbq READ(inumrst) zmoment CLOSE(inumrst) niter = it1 tsec = ztotsec DO jj = 1, jpj DO ji = 1, jpi sxice(ji,jj) = zmoment(ji,jj,1) syice(ji,jj) = zmoment(ji,jj,2) sxxice(ji,jj) = zmoment(ji,jj,3) syyice(ji,jj) = zmoment(ji,jj,4) sxyice(ji,jj) = zmoment(ji,jj,5) sxsn(ji,jj) = zmoment(ji,jj,6) sysn(ji,jj) = zmoment(ji,jj,7) sxxsn(ji,jj) = zmoment(ji,jj,8) syysn(ji,jj) = zmoment(ji,jj,9) sxysn(ji,jj) = zmoment(ji,jj,10) sxa(ji,jj) = zmoment(ji,jj,11) sya(ji,jj) = zmoment(ji,jj,12) sxxa(ji,jj) = zmoment(ji,jj,13) syya(ji,jj) = zmoment(ji,jj,14) sxya(ji,jj) = zmoment(ji,jj,15) sxc0(ji,jj) = zmoment(ji,jj,16) syc0(ji,jj) = zmoment(ji,jj,17) sxxc0(ji,jj) = zmoment(ji,jj,18) syyc0(ji,jj) = zmoment(ji,jj,19) sxyc0(ji,jj) = zmoment(ji,jj,20) sxc1(ji,jj) = zmoment(ji,jj,21) syc1(ji,jj) = zmoment(ji,jj,22) sxxc1(ji,jj) = zmoment(ji,jj,23) syyc1(ji,jj) = zmoment(ji,jj,24) sxyc1(ji,jj) = zmoment(ji,jj,25) sxc2(ji,jj) = zmoment(ji,jj,26) syc2(ji,jj) = zmoment(ji,jj,27) sxxc2(ji,jj) = zmoment(ji,jj,28) syyc2(ji,jj) = zmoment(ji,jj,29) sxyc2(ji,jj) = zmoment(ji,jj,30) sxst(ji,jj) = zmoment(ji,jj,31) syst(ji,jj) = zmoment(ji,jj,32) sxxst(ji,jj) = zmoment(ji,jj,33) syyst(ji,jj) = zmoment(ji,jj,34) sxyst(ji,jj) = zmoment(ji,jj,35) END DO END DO END SUBROUTINE lim_rst_read