[503] | 1 | MODULE trdmld_rst |
---|
| 2 | !!================================================================================= |
---|
| 3 | !! *** MODULE trdmld_rst *** |
---|
| 4 | !! Ocean dynamic : Input/Output files for restart on mixed-layer diagnostics |
---|
| 5 | !!================================================================================= |
---|
| 6 | !! History : 9.0 ! 05-05 (C. Deltel) Original code |
---|
| 7 | !!--------------------------------------------------------------------------------- |
---|
| 8 | #if defined key_trdmld |
---|
| 9 | !!--------------------------------------------------------------------------------- |
---|
| 10 | USE dom_oce ! ocean space and time domain |
---|
| 11 | USE trdmod_oce ! ocean variables for trend diagnostics (i.e. icp/mixed-layer/vorticity) |
---|
| 12 | USE in_out_manager ! I/O manager |
---|
| 13 | USE daymod ! calendar |
---|
[521] | 14 | USE iom ! I/O module |
---|
[576] | 15 | USE restart ! only for lrst_oce |
---|
[503] | 16 | |
---|
| 17 | IMPLICIT NONE |
---|
| 18 | PRIVATE |
---|
| 19 | |
---|
| 20 | PUBLIC trd_mld_rst_read ! routine called by trd_mld_init |
---|
| 21 | PUBLIC trd_mld_rst_write ! routine called by step.F90 |
---|
| 22 | |
---|
| 23 | CHARACTER (len=48) :: crestart = 'initial.nc' ! restart file name |
---|
[580] | 24 | INTEGER :: nummldw ! logical unit for mld restart |
---|
[557] | 25 | |
---|
[503] | 26 | !!--------------------------------------------------------------------------------- |
---|
[557] | 27 | !! OPA 9.0 , LOCEAN-IPSL (2006) |
---|
[719] | 28 | !! $Header: /home/opalod/NEMOCVSROOT/NEMO/OPA_SRC/TRD/trdmld_rst.F90,v 1.7 2007/06/05 10:40:59 opalod Exp $ |
---|
[557] | 29 | !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt) |
---|
[503] | 30 | !!--------------------------------------------------------------------------------- |
---|
| 31 | |
---|
| 32 | CONTAINS |
---|
| 33 | |
---|
| 34 | SUBROUTINE trd_mld_rst_write( kt ) |
---|
| 35 | !!-------------------------------------------------------------------------------- |
---|
| 36 | !! *** SUBROUTINE trd_mld_rst_wri *** |
---|
| 37 | !! |
---|
| 38 | !! ** Purpose : Write mixed-layer diagnostics restart fields. |
---|
[521] | 39 | !!-------------------------------------------------------------------------------- |
---|
[503] | 40 | INTEGER, INTENT( in ) :: kt ! ocean time-step index |
---|
[521] | 41 | ! |
---|
| 42 | CHARACTER (len=35) :: charout |
---|
| 43 | INTEGER :: jk ! loop indice |
---|
[557] | 44 | CHARACTER(LEN=20) :: clkt ! ocean time-step deine as a character |
---|
| 45 | CHARACTER(LEN=50) :: clname ! ice output restart file name |
---|
[521] | 46 | !!-------------------------------------------------------------------------------- |
---|
[557] | 47 | |
---|
| 48 | IF( kt == nitrst-1 ) THEN |
---|
| 49 | IF( nitrst > 1.0e9 ) THEN |
---|
| 50 | WRITE(clkt,*) nitrst |
---|
| 51 | ELSE |
---|
| 52 | WRITE(clkt,'(i8.8)') nitrst |
---|
[503] | 53 | ENDIF |
---|
[557] | 54 | clname = TRIM(cexper)//"_"//TRIM(ADJUSTL(clkt))//"_restart_mld" |
---|
| 55 | IF(lwp) WRITE(numout,*) ' open ocean restart_mld NetCDF file: '//clname |
---|
| 56 | CALL iom_open( clname, nummldw, ldwrt = .TRUE., kiolib = jprstlib ) |
---|
| 57 | ENDIF |
---|
[503] | 58 | |
---|
[557] | 59 | IF( kt == nitrst .AND. lwp ) THEN |
---|
| 60 | WRITE(numout,*) |
---|
| 61 | WRITE(numout,*) 'trdmld_rst: output for ML diags. restart, with trd_mld_rst_write routine' |
---|
| 62 | WRITE(numout,*) '~~~~~~~~~~' |
---|
| 63 | WRITE(numout,*) |
---|
| 64 | ENDIF |
---|
[503] | 65 | |
---|
[557] | 66 | IF( ln_trdmld_instant ) THEN |
---|
| 67 | !-- Temperature |
---|
| 68 | CALL iom_rstput( kt, nitrst, nummldw, 'tmlbb' , tmlbb ) |
---|
| 69 | CALL iom_rstput( kt, nitrst, nummldw, 'tmlbn' , tmlbn ) |
---|
| 70 | CALL iom_rstput( kt, nitrst, nummldw, 'tmlatfb' , tmlatfb ) |
---|
[503] | 71 | |
---|
[557] | 72 | !-- Salinity |
---|
| 73 | CALL iom_rstput( kt, nitrst, nummldw, 'smlbb' , smlbb ) |
---|
| 74 | CALL iom_rstput( kt, nitrst, nummldw, 'smlbn' , smlbn ) |
---|
| 75 | CALL iom_rstput( kt, nitrst, nummldw, 'smlatfb' , smlatfb ) |
---|
| 76 | ELSE |
---|
| 77 | CALL iom_rstput( kt, nitrst, nummldw, 'rmldbn' , rmldbn ) |
---|
[503] | 78 | |
---|
[557] | 79 | !-- Temperature |
---|
| 80 | CALL iom_rstput( kt, nitrst, nummldw, 'tmlbn' , tmlbn ) |
---|
| 81 | CALL iom_rstput( kt, nitrst, nummldw, 'tml_sumb' , tml_sumb ) |
---|
| 82 | DO jk = 1, jpltrd |
---|
| 83 | IF( jk < 10 ) THEN |
---|
| 84 | WRITE(charout,FMT="('tmltrd_csum_ub_', I1)") jk |
---|
| 85 | ELSE |
---|
| 86 | WRITE(charout,FMT="('tmltrd_csum_ub_', I2)") jk |
---|
| 87 | ENDIF |
---|
| 88 | CALL iom_rstput( kt, nitrst, nummldw, charout, tmltrd_csum_ub(:,:,jk) ) |
---|
| 89 | ENDDO |
---|
| 90 | CALL iom_rstput( kt, nitrst, nummldw, 'tmltrd_atf_sumb' , tmltrd_atf_sumb ) |
---|
| 91 | |
---|
| 92 | !-- Salinity |
---|
| 93 | CALL iom_rstput( kt, nitrst, nummldw, 'smlbn' , smlbn ) |
---|
| 94 | CALL iom_rstput( kt, nitrst, nummldw, 'sml_sumb' , sml_sumb ) |
---|
| 95 | DO jk = 1, jpltrd |
---|
| 96 | IF( jk < 10 ) THEN |
---|
| 97 | WRITE(charout,FMT="('smltrd_csum_ub_', I1)") jk |
---|
| 98 | ELSE |
---|
| 99 | WRITE(charout,FMT="('smltrd_csum_ub_', I2)") jk |
---|
| 100 | ENDIF |
---|
| 101 | CALL iom_rstput( kt, nitrst, nummldw, charout , smltrd_csum_ub(:,:,jk) ) |
---|
| 102 | ENDDO |
---|
| 103 | CALL iom_rstput( kt, nitrst, nummldw, 'smltrd_atf_sumb' , smltrd_atf_sumb ) |
---|
[503] | 104 | ENDIF |
---|
[557] | 105 | ! |
---|
[576] | 106 | IF( kt == nitrst ) THEN |
---|
| 107 | CALL iom_close( nummldw ) ! close the restart file (only at last time step) |
---|
| 108 | lrst_oce = .FALSE. |
---|
| 109 | ENDIF |
---|
[557] | 110 | ! |
---|
[503] | 111 | ! |
---|
| 112 | END SUBROUTINE trd_mld_rst_write |
---|
| 113 | |
---|
| 114 | |
---|
| 115 | SUBROUTINE trd_mld_rst_read |
---|
| 116 | !!---------------------------------------------------------------------------- |
---|
| 117 | !! *** SUBROUTINE trd_mld_rst_lec *** |
---|
| 118 | !! |
---|
| 119 | !! ** Purpose : Read file for mixed-layer diagnostics restart. |
---|
| 120 | !!---------------------------------------------------------------------------- |
---|
[521] | 121 | INTEGER :: inum ! temporary logical unit |
---|
| 122 | ! |
---|
| 123 | CHARACTER (len=35) :: charout |
---|
| 124 | INTEGER :: jk ! loop indice |
---|
[503] | 125 | !!----------------------------------------------------------------------------- |
---|
| 126 | |
---|
| 127 | IF(lwp) THEN |
---|
| 128 | WRITE(numout,*) |
---|
| 129 | WRITE(numout,*) ' trd_mld_rst_read : read the NetCDF MLD restart file' |
---|
| 130 | WRITE(numout,*) ' ~~~~~~~~~~~~~~~~' |
---|
| 131 | ENDIF |
---|
| 132 | |
---|
[557] | 133 | CALL iom_open( 'restart_mld', inum, kiolib = jprstlib ) |
---|
[503] | 134 | |
---|
| 135 | IF( ln_trdmld_instant ) THEN |
---|
[521] | 136 | !-- Temperature |
---|
[683] | 137 | CALL iom_get( inum, jpdom_autoglo, 'tmlbb' , tmlbb ) |
---|
| 138 | CALL iom_get( inum, jpdom_autoglo, 'tmlbn' , tmlbn ) |
---|
| 139 | CALL iom_get( inum, jpdom_autoglo, 'tmlatfb' , tmlatfb ) |
---|
[503] | 140 | |
---|
[521] | 141 | !-- Salinity |
---|
[683] | 142 | CALL iom_get( inum, jpdom_autoglo, 'smlbb' , smlbb ) |
---|
| 143 | CALL iom_get( inum, jpdom_autoglo, 'smlbn' , smlbn ) |
---|
| 144 | CALL iom_get( inum, jpdom_autoglo, 'smlatfb' , smlatfb ) |
---|
[503] | 145 | ELSE |
---|
[683] | 146 | CALL iom_get( inum, jpdom_autoglo, 'rmldbn' , rmldbn ) ! needed for rmld_sum |
---|
[503] | 147 | |
---|
| 148 | !-- Temperature |
---|
[683] | 149 | CALL iom_get( inum, jpdom_autoglo, 'tmlbn' , tmlbn ) ! needed for tml_sum |
---|
| 150 | CALL iom_get( inum, jpdom_autoglo, 'tml_sumb' , tml_sumb ) |
---|
[521] | 151 | DO jk = 1, jpltrd |
---|
| 152 | IF( jk < 10 ) THEN |
---|
| 153 | WRITE(charout,FMT="('tmltrd_csum_ub_', I1)") jk |
---|
| 154 | ELSE |
---|
| 155 | WRITE(charout,FMT="('tmltrd_csum_ub_', I2)") jk |
---|
| 156 | ENDIF |
---|
[683] | 157 | CALL iom_get( inum, jpdom_autoglo, charout, tmltrd_csum_ub(:,:,jk) ) |
---|
[521] | 158 | ENDDO |
---|
[683] | 159 | CALL iom_get( inum, jpdom_autoglo, 'tmltrd_atf_sumb' , tmltrd_atf_sumb) |
---|
[503] | 160 | |
---|
| 161 | !-- Salinity |
---|
[683] | 162 | CALL iom_get( inum, jpdom_autoglo, 'smlbn' , smlbn ) ! needed for sml_sum |
---|
| 163 | CALL iom_get( inum, jpdom_autoglo, 'sml_sumb' , sml_sumb ) |
---|
[521] | 164 | DO jk = 1, jpltrd |
---|
| 165 | IF( jk < 10 ) THEN |
---|
| 166 | WRITE(charout,FMT="('smltrd_csum_ub_', I1)") jk |
---|
| 167 | ELSE |
---|
| 168 | WRITE(charout,FMT="('smltrd_csum_ub_', I2)") jk |
---|
| 169 | ENDIF |
---|
[683] | 170 | CALL iom_get( inum, jpdom_autoglo, charout, smltrd_csum_ub(:,:,jk) ) |
---|
[521] | 171 | ENDDO |
---|
[683] | 172 | CALL iom_get( inum, jpdom_autoglo, 'smltrd_atf_sumb' , smltrd_atf_sumb) |
---|
[503] | 173 | |
---|
[521] | 174 | CALL iom_close( inum ) |
---|
[503] | 175 | ENDIF |
---|
| 176 | |
---|
| 177 | END SUBROUTINE trd_mld_rst_read |
---|
| 178 | |
---|
| 179 | #else |
---|
| 180 | !!================================================================================= |
---|
| 181 | !! *** MODULE trdmld_rst *** |
---|
| 182 | !! Ocean dynamic : Input/Output files for restart on mixed-layer diagnostics |
---|
| 183 | !!================================================================================= |
---|
| 184 | CONTAINS |
---|
| 185 | SUBROUTINE trd_mld_rst_write( kt ) ! No ML diags ==> empty routine |
---|
| 186 | WRITE(*,*) 'trd_mld_rst_wri: You should not have seen this print! error?', kt |
---|
| 187 | END SUBROUTINE trd_mld_rst_write |
---|
| 188 | SUBROUTINE trd_mld_rst_read ! No ML Diags ==> empty routine |
---|
| 189 | END SUBROUTINE trd_mld_rst_read |
---|
| 190 | #endif |
---|
| 191 | |
---|
| 192 | !!================================================================================= |
---|
| 193 | END MODULE trdmld_rst |
---|