MODULE trdmld_rst !!================================================================================= !! *** MODULE trdmld_rst *** !! Ocean dynamic : Input/Output files for restart on mixed-layer diagnostics !!================================================================================= !! History : 9.0 ! 05-05 (C. Deltel) Original code !!--------------------------------------------------------------------------------- #if defined key_trdmld !!--------------------------------------------------------------------------------- USE dom_oce ! ocean space and time domain USE trdmod_oce ! ocean variables for trend diagnostics (i.e. icp/mixed-layer/vorticity) USE in_out_manager ! I/O manager USE daymod ! calendar USE iom ! I/O module USE restart ! only for lrst_oce IMPLICIT NONE PRIVATE PUBLIC trd_mld_rst_read ! routine called by trd_mld_init PUBLIC trd_mld_rst_write ! routine called by step.F90 CHARACTER (len=48) :: crestart = 'initial.nc' ! restart file name INTEGER :: nummldw ! logical unit for mld restart !!--------------------------------------------------------------------------------- !! OPA 9.0 , LOCEAN-IPSL (2006) !! $Header: /home/opalod/NEMOCVSROOT/NEMO/OPA_SRC/TRD/trdmld_rst.F90,v 1.7 2007/06/05 10:40:59 opalod Exp $ !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt) !!--------------------------------------------------------------------------------- CONTAINS SUBROUTINE trd_mld_rst_write( kt ) !!-------------------------------------------------------------------------------- !! *** SUBROUTINE trd_mld_rst_wri *** !! !! ** Purpose : Write mixed-layer diagnostics restart fields. !!-------------------------------------------------------------------------------- INTEGER, INTENT( in ) :: kt ! ocean time-step index ! CHARACTER (len=35) :: charout INTEGER :: jk ! loop indice CHARACTER(LEN=20) :: clkt ! ocean time-step deine as a character CHARACTER(LEN=50) :: clname ! ice output restart file name !!-------------------------------------------------------------------------------- IF( kt == nitrst-1 ) THEN IF( nitrst > 1.0e9 ) THEN WRITE(clkt,*) nitrst ELSE WRITE(clkt,'(i8.8)') nitrst ENDIF clname = TRIM(cexper)//"_"//TRIM(ADJUSTL(clkt))//"_restart_mld" IF(lwp) WRITE(numout,*) ' open ocean restart_mld NetCDF file: '//clname CALL iom_open( clname, nummldw, ldwrt = .TRUE., kiolib = jprstlib ) ENDIF IF( kt == nitrst .AND. lwp ) THEN WRITE(numout,*) WRITE(numout,*) 'trdmld_rst: output for ML diags. restart, with trd_mld_rst_write routine' WRITE(numout,*) '~~~~~~~~~~' WRITE(numout,*) ENDIF IF( ln_trdmld_instant ) THEN !-- Temperature CALL iom_rstput( kt, nitrst, nummldw, 'tmlbb' , tmlbb ) CALL iom_rstput( kt, nitrst, nummldw, 'tmlbn' , tmlbn ) CALL iom_rstput( kt, nitrst, nummldw, 'tmlatfb' , tmlatfb ) !-- Salinity CALL iom_rstput( kt, nitrst, nummldw, 'smlbb' , smlbb ) CALL iom_rstput( kt, nitrst, nummldw, 'smlbn' , smlbn ) CALL iom_rstput( kt, nitrst, nummldw, 'smlatfb' , smlatfb ) ELSE CALL iom_rstput( kt, nitrst, nummldw, 'rmldbn' , rmldbn ) !-- Temperature CALL iom_rstput( kt, nitrst, nummldw, 'tmlbn' , tmlbn ) CALL iom_rstput( kt, nitrst, nummldw, 'tml_sumb' , tml_sumb ) DO jk = 1, jpltrd IF( jk < 10 ) THEN WRITE(charout,FMT="('tmltrd_csum_ub_', I1)") jk ELSE WRITE(charout,FMT="('tmltrd_csum_ub_', I2)") jk ENDIF CALL iom_rstput( kt, nitrst, nummldw, charout, tmltrd_csum_ub(:,:,jk) ) ENDDO CALL iom_rstput( kt, nitrst, nummldw, 'tmltrd_atf_sumb' , tmltrd_atf_sumb ) !-- Salinity CALL iom_rstput( kt, nitrst, nummldw, 'smlbn' , smlbn ) CALL iom_rstput( kt, nitrst, nummldw, 'sml_sumb' , sml_sumb ) DO jk = 1, jpltrd IF( jk < 10 ) THEN WRITE(charout,FMT="('smltrd_csum_ub_', I1)") jk ELSE WRITE(charout,FMT="('smltrd_csum_ub_', I2)") jk ENDIF CALL iom_rstput( kt, nitrst, nummldw, charout , smltrd_csum_ub(:,:,jk) ) ENDDO CALL iom_rstput( kt, nitrst, nummldw, 'smltrd_atf_sumb' , smltrd_atf_sumb ) ENDIF ! IF( kt == nitrst ) THEN CALL iom_close( nummldw ) ! close the restart file (only at last time step) lrst_oce = .FALSE. ENDIF ! ! END SUBROUTINE trd_mld_rst_write SUBROUTINE trd_mld_rst_read !!---------------------------------------------------------------------------- !! *** SUBROUTINE trd_mld_rst_lec *** !! !! ** Purpose : Read file for mixed-layer diagnostics restart. !!---------------------------------------------------------------------------- INTEGER :: inum ! temporary logical unit ! CHARACTER (len=35) :: charout INTEGER :: jk ! loop indice !!----------------------------------------------------------------------------- IF(lwp) THEN WRITE(numout,*) WRITE(numout,*) ' trd_mld_rst_read : read the NetCDF MLD restart file' WRITE(numout,*) ' ~~~~~~~~~~~~~~~~' ENDIF CALL iom_open( 'restart_mld', inum, kiolib = jprstlib ) IF( ln_trdmld_instant ) THEN !-- Temperature CALL iom_get( inum, jpdom_autoglo, 'tmlbb' , tmlbb ) CALL iom_get( inum, jpdom_autoglo, 'tmlbn' , tmlbn ) CALL iom_get( inum, jpdom_autoglo, 'tmlatfb' , tmlatfb ) !-- Salinity CALL iom_get( inum, jpdom_autoglo, 'smlbb' , smlbb ) CALL iom_get( inum, jpdom_autoglo, 'smlbn' , smlbn ) CALL iom_get( inum, jpdom_autoglo, 'smlatfb' , smlatfb ) ELSE CALL iom_get( inum, jpdom_autoglo, 'rmldbn' , rmldbn ) ! needed for rmld_sum !-- Temperature CALL iom_get( inum, jpdom_autoglo, 'tmlbn' , tmlbn ) ! needed for tml_sum CALL iom_get( inum, jpdom_autoglo, 'tml_sumb' , tml_sumb ) DO jk = 1, jpltrd IF( jk < 10 ) THEN WRITE(charout,FMT="('tmltrd_csum_ub_', I1)") jk ELSE WRITE(charout,FMT="('tmltrd_csum_ub_', I2)") jk ENDIF CALL iom_get( inum, jpdom_autoglo, charout, tmltrd_csum_ub(:,:,jk) ) ENDDO CALL iom_get( inum, jpdom_autoglo, 'tmltrd_atf_sumb' , tmltrd_atf_sumb) !-- Salinity CALL iom_get( inum, jpdom_autoglo, 'smlbn' , smlbn ) ! needed for sml_sum CALL iom_get( inum, jpdom_autoglo, 'sml_sumb' , sml_sumb ) DO jk = 1, jpltrd IF( jk < 10 ) THEN WRITE(charout,FMT="('smltrd_csum_ub_', I1)") jk ELSE WRITE(charout,FMT="('smltrd_csum_ub_', I2)") jk ENDIF CALL iom_get( inum, jpdom_autoglo, charout, smltrd_csum_ub(:,:,jk) ) ENDDO CALL iom_get( inum, jpdom_autoglo, 'smltrd_atf_sumb' , smltrd_atf_sumb) CALL iom_close( inum ) ENDIF END SUBROUTINE trd_mld_rst_read #else !!================================================================================= !! *** MODULE trdmld_rst *** !! Ocean dynamic : Input/Output files for restart on mixed-layer diagnostics !!================================================================================= CONTAINS SUBROUTINE trd_mld_rst_write( kt ) ! No ML diags ==> empty routine WRITE(*,*) 'trd_mld_rst_wri: You should not have seen this print! error?', kt END SUBROUTINE trd_mld_rst_write SUBROUTINE trd_mld_rst_read ! No ML Diags ==> empty routine END SUBROUTINE trd_mld_rst_read #endif !!================================================================================= END MODULE trdmld_rst