MODULE limrst !!====================================================================== !! *** MODULE limrst *** !! Ice restart : write the ice restart file !!====================================================================== !! History : 2.0 ! 01-04 (C. Ethe, G. Madec) Original code !! ! 06-07 (S. Masson) use IOM for restart read/write !!---------------------------------------------------------------------- #if defined key_ice_lim !!---------------------------------------------------------------------- !! 'key_ice_lim' : LIM sea-ice model !!---------------------------------------------------------------------- !!---------------------------------------------------------------------- !! lim_rst_opn : open ice restart file !! lim_rst_write : write of the ice restart file !! lim_rst_read : read the ice restart file !!---------------------------------------------------------------------- USE ice USE dom_oce USE ice_oce ! ice variables USE daymod USE in_out_manager USE iom IMPLICIT NONE PRIVATE PUBLIC lim_rst_opn ! routine called by ??? module PUBLIC lim_rst_write ! routine called by ??? module PUBLIC lim_rst_read ! routine called by ??? module LOGICAL, PUBLIC :: lrst_ice !: logical to control the ice restart write INTEGER, PUBLIC :: numrir, numriw !: logical unit for ice restart (read and write) !!---------------------------------------------------------------------- !! LIM 2.0, UCL-LOCEAN-IPSL (2006) !! $Header: /home/opalod/NEMOCVSROOT/NEMO/LIM_SRC/limrst.F90,v 1.15 2007/06/29 14:54:06 opalod Exp $ !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt) !!---------------------------------------------------------------------- CONTAINS SUBROUTINE lim_rst_opn( kt ) !!---------------------------------------------------------------------- !! *** lim_rst_opn *** !! !! ** purpose : output of sea-ice variable in a netcdf file !!---------------------------------------------------------------------- INTEGER, INTENT(in) :: kt ! number of iteration ! CHARACTER(LEN=20) :: clkt ! ocean time-step deine as a character CHARACTER(LEN=50) :: clname ! ice output restart file name !!---------------------------------------------------------------------- ! IF( kt == nit000 ) lrst_ice = .FALSE. IF( kt == nitrst - 2*nfice + 1 .OR. nitend - nit000 + 1 <= nfice ) THEN ! beware if model runs less than nfice + 1 time step ! beware of the format used to write kt (default is i8.8, that should be large enough) IF( nitrst > 1.0e9 ) THEN WRITE(clkt,*) nitrst ELSE WRITE(clkt,'(i8.8)') nitrst ENDIF ! create the file IF(lwp) WRITE(numout,*) clname = TRIM(cexper)//"_"//TRIM(ADJUSTL(clkt))//"_restart_ice" IF(lwp) WRITE(numout,*) ' open ice restart.output NetCDF file: '//clname CALL iom_open( clname, numriw, ldwrt = .TRUE., kiolib = jprstlib ) lrst_ice = .TRUE. ENDIF ! END SUBROUTINE lim_rst_opn SUBROUTINE lim_rst_write( kt ) !!---------------------------------------------------------------------- !! *** lim_rst_write *** !! !! ** purpose : output of sea-ice variable in a netcdf file !!---------------------------------------------------------------------- INTEGER, INTENT(in) :: kt ! number of iteration !! INTEGER :: iter ! kt + nfice -1 !!---------------------------------------------------------------------- iter = kt + nfice -1 IF( iter == nitrst ) THEN IF(lwp) WRITE(numout,*) IF(lwp) WRITE(numout,*) 'lim_rst_write : write ice restart.output NetCDF file kt =', kt IF(lwp) WRITE(numout,*) '~~~~~~~' ENDIF ! Write in numriw (if iter == nitrst) ! ------------------ ! ! calendar control CALL iom_rstput( iter, nitrst, numriw, 'nfice' , REAL( nfice, wp) ) ! time-step CALL iom_rstput( iter, nitrst, numriw, 'kt_ice', REAL( iter, wp) ) ! date CALL iom_rstput( iter, nitrst, numriw, 'hicif' , hicif (:,:) ) ! prognostic variables CALL iom_rstput( iter, nitrst, numriw, 'hsnif' , hsnif (:,:) ) CALL iom_rstput( iter, nitrst, numriw, 'frld' , frld (:,:) ) CALL iom_rstput( iter, nitrst, numriw, 'sist' , sist (:,:) ) # if defined key_coupled CALL iom_rstput( iter, nitrst, numriw, 'albege', albege(:,:) ) # endif CALL iom_rstput( iter, nitrst, numriw, 'tbif1' , tbif (:,:,1) ) CALL iom_rstput( iter, nitrst, numriw, 'tbif2' , tbif (:,:,2) ) CALL iom_rstput( iter, nitrst, numriw, 'tbif3' , tbif (:,:,3) ) CALL iom_rstput( iter, nitrst, numriw, 'u_ice' , u_ice (:,:) ) CALL iom_rstput( iter, nitrst, numriw, 'v_ice' , v_ice (:,:) ) CALL iom_rstput( iter, nitrst, numriw, 'gtaux' , gtaux (:,:) ) CALL iom_rstput( iter, nitrst, numriw, 'gtauy' , gtauy (:,:) ) CALL iom_rstput( iter, nitrst, numriw, 'qstoif', qstoif(:,:) ) CALL iom_rstput( iter, nitrst, numriw, 'fsbbq' , fsbbq (:,:) ) CALL iom_rstput( iter, nitrst, numriw, 'sxice' , sxice (:,:) ) CALL iom_rstput( iter, nitrst, numriw, 'syice' , syice (:,:) ) CALL iom_rstput( iter, nitrst, numriw, 'sxxice', sxxice(:,:) ) CALL iom_rstput( iter, nitrst, numriw, 'syyice', syyice(:,:) ) CALL iom_rstput( iter, nitrst, numriw, 'sxyice', sxyice(:,:) ) CALL iom_rstput( iter, nitrst, numriw, 'sxsn' , sxsn (:,:) ) CALL iom_rstput( iter, nitrst, numriw, 'sysn' , sysn (:,:) ) CALL iom_rstput( iter, nitrst, numriw, 'sxxsn' , sxxsn (:,:) ) CALL iom_rstput( iter, nitrst, numriw, 'syysn' , syysn (:,:) ) CALL iom_rstput( iter, nitrst, numriw, 'sxysn' , sxysn (:,:) ) CALL iom_rstput( iter, nitrst, numriw, 'sxa' , sxa (:,:) ) CALL iom_rstput( iter, nitrst, numriw, 'sya' , sya (:,:) ) CALL iom_rstput( iter, nitrst, numriw, 'sxxa' , sxxa (:,:) ) CALL iom_rstput( iter, nitrst, numriw, 'syya' , syya (:,:) ) CALL iom_rstput( iter, nitrst, numriw, 'sxya' , sxya (:,:) ) CALL iom_rstput( iter, nitrst, numriw, 'sxc0' , sxc0 (:,:) ) CALL iom_rstput( iter, nitrst, numriw, 'syc0' , syc0 (:,:) ) CALL iom_rstput( iter, nitrst, numriw, 'sxxc0' , sxxc0 (:,:) ) CALL iom_rstput( iter, nitrst, numriw, 'syyc0' , syyc0 (:,:) ) CALL iom_rstput( iter, nitrst, numriw, 'sxyc0' , sxyc0 (:,:) ) CALL iom_rstput( iter, nitrst, numriw, 'sxc1' , sxc1 (:,:) ) CALL iom_rstput( iter, nitrst, numriw, 'syc1' , syc1 (:,:) ) CALL iom_rstput( iter, nitrst, numriw, 'sxxc1' , sxxc1 (:,:) ) CALL iom_rstput( iter, nitrst, numriw, 'syyc1' , syyc1 (:,:) ) CALL iom_rstput( iter, nitrst, numriw, 'sxyc1' , sxyc1 (:,:) ) CALL iom_rstput( iter, nitrst, numriw, 'sxc2' , sxc2 (:,:) ) CALL iom_rstput( iter, nitrst, numriw, 'syc2' , syc2 (:,:) ) CALL iom_rstput( iter, nitrst, numriw, 'sxxc2' , sxxc2 (:,:) ) CALL iom_rstput( iter, nitrst, numriw, 'syyc2' , syyc2 (:,:) ) CALL iom_rstput( iter, nitrst, numriw, 'sxyc2' , sxyc2 (:,:) ) CALL iom_rstput( iter, nitrst, numriw, 'sxst' , sxst (:,:) ) CALL iom_rstput( iter, nitrst, numriw, 'syst' , syst (:,:) ) CALL iom_rstput( iter, nitrst, numriw, 'sxxst' , sxxst (:,:) ) CALL iom_rstput( iter, nitrst, numriw, 'syyst' , syyst (:,:) ) CALL iom_rstput( iter, nitrst, numriw, 'sxyst' , sxyst (:,:) ) IF( iter == nitrst ) THEN CALL iom_close( numriw ) ! close the restart file lrst_ice = .FALSE. ENDIF ! END SUBROUTINE lim_rst_write SUBROUTINE lim_rst_read !!---------------------------------------------------------------------- !! *** lim_rst_read *** !! !! ** purpose : read of sea-ice variable restart in a netcdf file !!---------------------------------------------------------------------- ! REAL(wp) :: zfice, ziter !!---------------------------------------------------------------------- IF(lwp) THEN WRITE(numout,*) WRITE(numout,*) 'lim_rst_read : read ice NetCDF restart file' WRITE(numout,*) '~~~~~~~~' ENDIF CALL iom_open ( 'restart_ice_in', numrir, kiolib = jprstlib ) CALL iom_get( numrir, 'nfice' , zfice ) CALL iom_get( numrir, 'kt_ice', ziter ) IF(lwp) WRITE(numout,*) ' read ice restart file at time step : ', ziter IF(lwp) WRITE(numout,*) ' in any case we force it to nit000 - 1 : ', nit000 - 1 !Control of date IF( ( nit000 - INT(ziter) ) /= 1 .AND. ABS( nrstdt ) == 1 ) & & CALL ctl_stop( 'lim_rst_read ===>>>> : problem with nit000 in ice restart', & & ' verify the file or rerun with the value 0 for the', & & ' control of time parameter nrstdt' ) IF( INT(zfice) /= nfice .AND. ABS( nrstdt ) == 1 ) & & CALL ctl_stop( 'lim_rst_read ===>>>> : problem with nfice in ice restart', & & ' verify the file or rerun with the value 0 for the', & & ' control of time parameter nrstdt' ) CALL iom_get( numrir, jpdom_autoglo, 'hicif' , hicif ) CALL iom_get( numrir, jpdom_autoglo, 'hsnif' , hsnif ) CALL iom_get( numrir, jpdom_autoglo, 'frld' , frld ) CALL iom_get( numrir, jpdom_autoglo, 'sist' , sist ) # if defined key_coupled CALL iom_get( numrir, jpdom_autoglo, 'albege', albege ) # endif CALL iom_get( numrir, jpdom_autoglo, 'tbif1' , tbif(:,:,1) ) CALL iom_get( numrir, jpdom_autoglo, 'tbif2' , tbif(:,:,2) ) CALL iom_get( numrir, jpdom_autoglo, 'tbif3' , tbif(:,:,3) ) CALL iom_get( numrir, jpdom_autoglo, 'u_ice' , u_ice ) CALL iom_get( numrir, jpdom_autoglo, 'v_ice' , v_ice ) CALL iom_get( numrir, jpdom_autoglo, 'gtaux' , gtaux ) CALL iom_get( numrir, jpdom_autoglo, 'gtauy' , gtauy ) CALL iom_get( numrir, jpdom_autoglo, 'qstoif', qstoif ) CALL iom_get( numrir, jpdom_autoglo, 'fsbbq' , fsbbq ) CALL iom_get( numrir, jpdom_autoglo, 'sxice' , sxice ) CALL iom_get( numrir, jpdom_autoglo, 'syice' , syice ) CALL iom_get( numrir, jpdom_autoglo, 'sxxice', sxxice ) CALL iom_get( numrir, jpdom_autoglo, 'syyice', syyice ) CALL iom_get( numrir, jpdom_autoglo, 'sxyice', sxyice ) CALL iom_get( numrir, jpdom_autoglo, 'sxsn' , sxsn ) CALL iom_get( numrir, jpdom_autoglo, 'sysn' , sysn ) CALL iom_get( numrir, jpdom_autoglo, 'sxxsn' , sxxsn ) CALL iom_get( numrir, jpdom_autoglo, 'syysn' , syysn ) CALL iom_get( numrir, jpdom_autoglo, 'sxysn' , sxysn ) CALL iom_get( numrir, jpdom_autoglo, 'sxa' , sxa ) CALL iom_get( numrir, jpdom_autoglo, 'sya' , sya ) CALL iom_get( numrir, jpdom_autoglo, 'sxxa' , sxxa ) CALL iom_get( numrir, jpdom_autoglo, 'syya' , syya ) CALL iom_get( numrir, jpdom_autoglo, 'sxya' , sxya ) CALL iom_get( numrir, jpdom_autoglo, 'sxc0' , sxc0 ) CALL iom_get( numrir, jpdom_autoglo, 'syc0' , syc0 ) CALL iom_get( numrir, jpdom_autoglo, 'sxxc0' , sxxc0 ) CALL iom_get( numrir, jpdom_autoglo, 'syyc0' , syyc0 ) CALL iom_get( numrir, jpdom_autoglo, 'sxyc0' , sxyc0 ) CALL iom_get( numrir, jpdom_autoglo, 'sxc1' , sxc1 ) CALL iom_get( numrir, jpdom_autoglo, 'syc1' , syc1 ) CALL iom_get( numrir, jpdom_autoglo, 'sxxc1' , sxxc1 ) CALL iom_get( numrir, jpdom_autoglo, 'syyc1' , syyc1 ) CALL iom_get( numrir, jpdom_autoglo, 'sxyc1' , sxyc1 ) CALL iom_get( numrir, jpdom_autoglo, 'sxc2' , sxc2 ) CALL iom_get( numrir, jpdom_autoglo, 'syc2' , syc2 ) CALL iom_get( numrir, jpdom_autoglo, 'sxxc2' , sxxc2 ) CALL iom_get( numrir, jpdom_autoglo, 'syyc2' , syyc2 ) CALL iom_get( numrir, jpdom_autoglo, 'sxyc2' , sxyc2 ) CALL iom_get( numrir, jpdom_autoglo, 'sxst' , sxst ) CALL iom_get( numrir, jpdom_autoglo, 'syst' , syst ) CALL iom_get( numrir, jpdom_autoglo, 'sxxst' , sxxst ) CALL iom_get( numrir, jpdom_autoglo, 'syyst' , syyst ) CALL iom_get( numrir, jpdom_autoglo, 'sxyst' , sxyst ) CALL iom_close( numrir ) ! END SUBROUTINE lim_rst_read #else !!---------------------------------------------------------------------- !! Default option : Empty module NO LIM sea-ice model !!---------------------------------------------------------------------- #endif !!====================================================================== END MODULE limrst