[3] | 1 | MODULE limrst |
---|
| 2 | !!====================================================================== |
---|
| 3 | !! *** MODULE limrst *** |
---|
| 4 | !! Ice restart : write the ice restart file |
---|
| 5 | !!====================================================================== |
---|
[508] | 6 | !! History : 2.0 ! 01-04 (C. Ethe, G. Madec) Original code |
---|
| 7 | !! ! 06-07 (S. Masson) use IOM for restart read/write |
---|
| 8 | !!---------------------------------------------------------------------- |
---|
[3] | 9 | #if defined key_ice_lim |
---|
| 10 | !!---------------------------------------------------------------------- |
---|
| 11 | !! 'key_ice_lim' : LIM sea-ice model |
---|
| 12 | !!---------------------------------------------------------------------- |
---|
| 13 | !!---------------------------------------------------------------------- |
---|
[508] | 14 | !! lim_rst_opn : open ice restart file |
---|
| 15 | !! lim_rst_write : write of the ice restart file |
---|
| 16 | !! lim_rst_read : read the ice restart file |
---|
| 17 | !!---------------------------------------------------------------------- |
---|
[3] | 18 | USE ice |
---|
[719] | 19 | USE dom_oce |
---|
| 20 | USE ice_oce ! ice variables |
---|
[3] | 21 | USE daymod |
---|
| 22 | |
---|
[508] | 23 | USE in_out_manager |
---|
| 24 | USE iom |
---|
| 25 | |
---|
[3] | 26 | IMPLICIT NONE |
---|
| 27 | PRIVATE |
---|
| 28 | |
---|
[508] | 29 | PUBLIC lim_rst_opn ! routine called by ??? module |
---|
[719] | 30 | PUBLIC lim_rst_write ! routine called by ??? module |
---|
| 31 | PUBLIC lim_rst_read ! routine called by ??? module |
---|
[3] | 32 | |
---|
[544] | 33 | LOGICAL, PUBLIC :: lrst_ice !: logical to control the ice restart write |
---|
[508] | 34 | INTEGER, PUBLIC :: numrir, numriw !: logical unit for ice restart (read and write) |
---|
| 35 | |
---|
[3] | 36 | !!---------------------------------------------------------------------- |
---|
[508] | 37 | !! LIM 2.0, UCL-LOCEAN-IPSL (2006) |
---|
[719] | 38 | !! $Header: /home/opalod/NEMOCVSROOT/NEMO/LIM_SRC/limrst.F90,v 1.15 2007/06/29 14:54:06 opalod Exp $ |
---|
[508] | 39 | !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt) |
---|
[3] | 40 | !!---------------------------------------------------------------------- |
---|
| 41 | |
---|
| 42 | CONTAINS |
---|
| 43 | |
---|
[508] | 44 | SUBROUTINE lim_rst_opn( kt ) |
---|
[3] | 45 | !!---------------------------------------------------------------------- |
---|
[508] | 46 | !! *** lim_rst_opn *** |
---|
| 47 | !! |
---|
| 48 | !! ** purpose : output of sea-ice variable in a netcdf file |
---|
| 49 | !!---------------------------------------------------------------------- |
---|
| 50 | INTEGER, INTENT(in) :: kt ! number of iteration |
---|
| 51 | ! |
---|
| 52 | CHARACTER(LEN=20) :: clkt ! ocean time-step deine as a character |
---|
| 53 | CHARACTER(LEN=50) :: clname ! ice output restart file name |
---|
| 54 | !!---------------------------------------------------------------------- |
---|
| 55 | ! |
---|
| 56 | IF( kt == nit000 ) lrst_ice = .FALSE. |
---|
| 57 | |
---|
[719] | 58 | IF( kt == nitrst - 2*nfice + 1 .OR. nitend - nit000 + 1 <= nfice ) THEN |
---|
| 59 | ! beware if model runs less than nfice + 1 time step |
---|
[508] | 60 | ! beware of the format used to write kt (default is i8.8, that should be large enough) |
---|
| 61 | IF( nitrst > 1.0e9 ) THEN |
---|
| 62 | WRITE(clkt,*) nitrst |
---|
| 63 | ELSE |
---|
| 64 | WRITE(clkt,'(i8.8)') nitrst |
---|
| 65 | ENDIF |
---|
| 66 | ! create the file |
---|
| 67 | IF(lwp) WRITE(numout,*) |
---|
| 68 | clname = TRIM(cexper)//"_"//TRIM(ADJUSTL(clkt))//"_restart_ice" |
---|
| 69 | IF(lwp) WRITE(numout,*) ' open ice restart.output NetCDF file: '//clname |
---|
[547] | 70 | CALL iom_open( clname, numriw, ldwrt = .TRUE., kiolib = jprstlib ) |
---|
[508] | 71 | lrst_ice = .TRUE. |
---|
| 72 | ENDIF |
---|
| 73 | ! |
---|
| 74 | END SUBROUTINE lim_rst_opn |
---|
| 75 | |
---|
| 76 | SUBROUTINE lim_rst_write( kt ) |
---|
| 77 | !!---------------------------------------------------------------------- |
---|
[3] | 78 | !! *** lim_rst_write *** |
---|
| 79 | !! |
---|
| 80 | !! ** purpose : output of sea-ice variable in a netcdf file |
---|
[508] | 81 | !!---------------------------------------------------------------------- |
---|
[719] | 82 | INTEGER, INTENT(in) :: kt ! number of iteration |
---|
| 83 | !! |
---|
| 84 | INTEGER :: iter ! kt + nfice -1 |
---|
[3] | 85 | !!---------------------------------------------------------------------- |
---|
| 86 | |
---|
[719] | 87 | iter = kt + nfice -1 |
---|
[3] | 88 | |
---|
[508] | 89 | IF( iter == nitrst ) THEN |
---|
| 90 | IF(lwp) WRITE(numout,*) |
---|
| 91 | IF(lwp) WRITE(numout,*) 'lim_rst_write : write ice restart.output NetCDF file kt =', kt |
---|
[719] | 92 | IF(lwp) WRITE(numout,*) '~~~~~~~' |
---|
[3] | 93 | ENDIF |
---|
| 94 | |
---|
[719] | 95 | ! Write in numriw (if iter == nitrst) |
---|
[508] | 96 | ! ------------------ |
---|
| 97 | ! ! calendar control |
---|
[719] | 98 | CALL iom_rstput( iter, nitrst, numriw, 'nfice' , REAL( nfice, wp) ) ! time-step |
---|
| 99 | CALL iom_rstput( iter, nitrst, numriw, 'kt_ice', REAL( iter, wp) ) ! date |
---|
[3] | 100 | |
---|
[508] | 101 | CALL iom_rstput( iter, nitrst, numriw, 'hicif' , hicif (:,:) ) ! prognostic variables |
---|
| 102 | CALL iom_rstput( iter, nitrst, numriw, 'hsnif' , hsnif (:,:) ) |
---|
| 103 | CALL iom_rstput( iter, nitrst, numriw, 'frld' , frld (:,:) ) |
---|
| 104 | CALL iom_rstput( iter, nitrst, numriw, 'sist' , sist (:,:) ) |
---|
[3] | 105 | # if defined key_coupled |
---|
[508] | 106 | CALL iom_rstput( iter, nitrst, numriw, 'albege', albege(:,:) ) |
---|
[3] | 107 | # endif |
---|
[508] | 108 | CALL iom_rstput( iter, nitrst, numriw, 'tbif1' , tbif (:,:,1) ) |
---|
| 109 | CALL iom_rstput( iter, nitrst, numriw, 'tbif2' , tbif (:,:,2) ) |
---|
| 110 | CALL iom_rstput( iter, nitrst, numriw, 'tbif3' , tbif (:,:,3) ) |
---|
[719] | 111 | CALL iom_rstput( iter, nitrst, numriw, 'u_ice' , u_ice (:,:) ) |
---|
| 112 | CALL iom_rstput( iter, nitrst, numriw, 'v_ice' , v_ice (:,:) ) |
---|
| 113 | CALL iom_rstput( iter, nitrst, numriw, 'gtaux' , gtaux (:,:) ) |
---|
| 114 | CALL iom_rstput( iter, nitrst, numriw, 'gtauy' , gtauy (:,:) ) |
---|
[508] | 115 | CALL iom_rstput( iter, nitrst, numriw, 'qstoif', qstoif(:,:) ) |
---|
| 116 | CALL iom_rstput( iter, nitrst, numriw, 'fsbbq' , fsbbq (:,:) ) |
---|
| 117 | CALL iom_rstput( iter, nitrst, numriw, 'sxice' , sxice (:,:) ) |
---|
| 118 | CALL iom_rstput( iter, nitrst, numriw, 'syice' , syice (:,:) ) |
---|
| 119 | CALL iom_rstput( iter, nitrst, numriw, 'sxxice', sxxice(:,:) ) |
---|
| 120 | CALL iom_rstput( iter, nitrst, numriw, 'syyice', syyice(:,:) ) |
---|
| 121 | CALL iom_rstput( iter, nitrst, numriw, 'sxyice', sxyice(:,:) ) |
---|
| 122 | CALL iom_rstput( iter, nitrst, numriw, 'sxsn' , sxsn (:,:) ) |
---|
| 123 | CALL iom_rstput( iter, nitrst, numriw, 'sysn' , sysn (:,:) ) |
---|
| 124 | CALL iom_rstput( iter, nitrst, numriw, 'sxxsn' , sxxsn (:,:) ) |
---|
| 125 | CALL iom_rstput( iter, nitrst, numriw, 'syysn' , syysn (:,:) ) |
---|
| 126 | CALL iom_rstput( iter, nitrst, numriw, 'sxysn' , sxysn (:,:) ) |
---|
| 127 | CALL iom_rstput( iter, nitrst, numriw, 'sxa' , sxa (:,:) ) |
---|
| 128 | CALL iom_rstput( iter, nitrst, numriw, 'sya' , sya (:,:) ) |
---|
| 129 | CALL iom_rstput( iter, nitrst, numriw, 'sxxa' , sxxa (:,:) ) |
---|
| 130 | CALL iom_rstput( iter, nitrst, numriw, 'syya' , syya (:,:) ) |
---|
| 131 | CALL iom_rstput( iter, nitrst, numriw, 'sxya' , sxya (:,:) ) |
---|
| 132 | CALL iom_rstput( iter, nitrst, numriw, 'sxc0' , sxc0 (:,:) ) |
---|
| 133 | CALL iom_rstput( iter, nitrst, numriw, 'syc0' , syc0 (:,:) ) |
---|
| 134 | CALL iom_rstput( iter, nitrst, numriw, 'sxxc0' , sxxc0 (:,:) ) |
---|
| 135 | CALL iom_rstput( iter, nitrst, numriw, 'syyc0' , syyc0 (:,:) ) |
---|
| 136 | CALL iom_rstput( iter, nitrst, numriw, 'sxyc0' , sxyc0 (:,:) ) |
---|
| 137 | CALL iom_rstput( iter, nitrst, numriw, 'sxc1' , sxc1 (:,:) ) |
---|
| 138 | CALL iom_rstput( iter, nitrst, numriw, 'syc1' , syc1 (:,:) ) |
---|
| 139 | CALL iom_rstput( iter, nitrst, numriw, 'sxxc1' , sxxc1 (:,:) ) |
---|
| 140 | CALL iom_rstput( iter, nitrst, numriw, 'syyc1' , syyc1 (:,:) ) |
---|
| 141 | CALL iom_rstput( iter, nitrst, numriw, 'sxyc1' , sxyc1 (:,:) ) |
---|
| 142 | CALL iom_rstput( iter, nitrst, numriw, 'sxc2' , sxc2 (:,:) ) |
---|
| 143 | CALL iom_rstput( iter, nitrst, numriw, 'syc2' , syc2 (:,:) ) |
---|
| 144 | CALL iom_rstput( iter, nitrst, numriw, 'sxxc2' , sxxc2 (:,:) ) |
---|
| 145 | CALL iom_rstput( iter, nitrst, numriw, 'syyc2' , syyc2 (:,:) ) |
---|
| 146 | CALL iom_rstput( iter, nitrst, numriw, 'sxyc2' , sxyc2 (:,:) ) |
---|
| 147 | CALL iom_rstput( iter, nitrst, numriw, 'sxst' , sxst (:,:) ) |
---|
| 148 | CALL iom_rstput( iter, nitrst, numriw, 'syst' , syst (:,:) ) |
---|
| 149 | CALL iom_rstput( iter, nitrst, numriw, 'sxxst' , sxxst (:,:) ) |
---|
| 150 | CALL iom_rstput( iter, nitrst, numriw, 'syyst' , syyst (:,:) ) |
---|
| 151 | CALL iom_rstput( iter, nitrst, numriw, 'sxyst' , sxyst (:,:) ) |
---|
[3] | 152 | |
---|
[508] | 153 | IF( iter == nitrst ) THEN |
---|
| 154 | CALL iom_close( numriw ) ! close the restart file |
---|
| 155 | lrst_ice = .FALSE. |
---|
| 156 | ENDIF |
---|
| 157 | ! |
---|
[3] | 158 | END SUBROUTINE lim_rst_write |
---|
| 159 | |
---|
| 160 | |
---|
[508] | 161 | SUBROUTINE lim_rst_read |
---|
| 162 | !!---------------------------------------------------------------------- |
---|
| 163 | !! *** lim_rst_read *** |
---|
| 164 | !! |
---|
| 165 | !! ** purpose : read of sea-ice variable restart in a netcdf file |
---|
| 166 | !!---------------------------------------------------------------------- |
---|
[719] | 167 | ! |
---|
| 168 | REAL(wp) :: zfice, ziter |
---|
[508] | 169 | !!---------------------------------------------------------------------- |
---|
[3] | 170 | |
---|
[508] | 171 | IF(lwp) THEN |
---|
| 172 | WRITE(numout,*) |
---|
| 173 | WRITE(numout,*) 'lim_rst_read : read ice NetCDF restart file' |
---|
[719] | 174 | WRITE(numout,*) '~~~~~~~~' |
---|
[508] | 175 | ENDIF |
---|
[3] | 176 | |
---|
[547] | 177 | CALL iom_open ( 'restart_ice_in', numrir, kiolib = jprstlib ) |
---|
[3] | 178 | |
---|
[719] | 179 | CALL iom_get( numrir, 'nfice' , zfice ) |
---|
| 180 | CALL iom_get( numrir, 'kt_ice', ziter ) |
---|
| 181 | IF(lwp) WRITE(numout,*) ' read ice restart file at time step : ', ziter |
---|
[508] | 182 | IF(lwp) WRITE(numout,*) ' in any case we force it to nit000 - 1 : ', nit000 - 1 |
---|
[391] | 183 | |
---|
[3] | 184 | !Control of date |
---|
| 185 | |
---|
[508] | 186 | IF( ( nit000 - INT(ziter) ) /= 1 .AND. ABS( nrstdt ) == 1 ) & |
---|
| 187 | & CALL ctl_stop( 'lim_rst_read ===>>>> : problem with nit000 in ice restart', & |
---|
| 188 | & ' verify the file or rerun with the value 0 for the', & |
---|
| 189 | & ' control of time parameter nrstdt' ) |
---|
[719] | 190 | IF( INT(zfice) /= nfice .AND. ABS( nrstdt ) == 1 ) & |
---|
| 191 | & CALL ctl_stop( 'lim_rst_read ===>>>> : problem with nfice in ice restart', & |
---|
| 192 | & ' verify the file or rerun with the value 0 for the', & |
---|
| 193 | & ' control of time parameter nrstdt' ) |
---|
[3] | 194 | |
---|
[683] | 195 | CALL iom_get( numrir, jpdom_autoglo, 'hicif' , hicif ) |
---|
| 196 | CALL iom_get( numrir, jpdom_autoglo, 'hsnif' , hsnif ) |
---|
| 197 | CALL iom_get( numrir, jpdom_autoglo, 'frld' , frld ) |
---|
| 198 | CALL iom_get( numrir, jpdom_autoglo, 'sist' , sist ) |
---|
[3] | 199 | # if defined key_coupled |
---|
[683] | 200 | CALL iom_get( numrir, jpdom_autoglo, 'albege', albege ) |
---|
[3] | 201 | # endif |
---|
[683] | 202 | CALL iom_get( numrir, jpdom_autoglo, 'tbif1' , tbif(:,:,1) ) |
---|
| 203 | CALL iom_get( numrir, jpdom_autoglo, 'tbif2' , tbif(:,:,2) ) |
---|
| 204 | CALL iom_get( numrir, jpdom_autoglo, 'tbif3' , tbif(:,:,3) ) |
---|
[719] | 205 | CALL iom_get( numrir, jpdom_autoglo, 'u_ice' , u_ice ) |
---|
| 206 | CALL iom_get( numrir, jpdom_autoglo, 'v_ice' , v_ice ) |
---|
| 207 | CALL iom_get( numrir, jpdom_autoglo, 'gtaux' , gtaux ) |
---|
| 208 | CALL iom_get( numrir, jpdom_autoglo, 'gtauy' , gtauy ) |
---|
[683] | 209 | CALL iom_get( numrir, jpdom_autoglo, 'qstoif', qstoif ) |
---|
| 210 | CALL iom_get( numrir, jpdom_autoglo, 'fsbbq' , fsbbq ) |
---|
| 211 | CALL iom_get( numrir, jpdom_autoglo, 'sxice' , sxice ) |
---|
| 212 | CALL iom_get( numrir, jpdom_autoglo, 'syice' , syice ) |
---|
| 213 | CALL iom_get( numrir, jpdom_autoglo, 'sxxice', sxxice ) |
---|
| 214 | CALL iom_get( numrir, jpdom_autoglo, 'syyice', syyice ) |
---|
| 215 | CALL iom_get( numrir, jpdom_autoglo, 'sxyice', sxyice ) |
---|
| 216 | CALL iom_get( numrir, jpdom_autoglo, 'sxsn' , sxsn ) |
---|
| 217 | CALL iom_get( numrir, jpdom_autoglo, 'sysn' , sysn ) |
---|
| 218 | CALL iom_get( numrir, jpdom_autoglo, 'sxxsn' , sxxsn ) |
---|
| 219 | CALL iom_get( numrir, jpdom_autoglo, 'syysn' , syysn ) |
---|
| 220 | CALL iom_get( numrir, jpdom_autoglo, 'sxysn' , sxysn ) |
---|
| 221 | CALL iom_get( numrir, jpdom_autoglo, 'sxa' , sxa ) |
---|
| 222 | CALL iom_get( numrir, jpdom_autoglo, 'sya' , sya ) |
---|
| 223 | CALL iom_get( numrir, jpdom_autoglo, 'sxxa' , sxxa ) |
---|
| 224 | CALL iom_get( numrir, jpdom_autoglo, 'syya' , syya ) |
---|
| 225 | CALL iom_get( numrir, jpdom_autoglo, 'sxya' , sxya ) |
---|
| 226 | CALL iom_get( numrir, jpdom_autoglo, 'sxc0' , sxc0 ) |
---|
| 227 | CALL iom_get( numrir, jpdom_autoglo, 'syc0' , syc0 ) |
---|
| 228 | CALL iom_get( numrir, jpdom_autoglo, 'sxxc0' , sxxc0 ) |
---|
| 229 | CALL iom_get( numrir, jpdom_autoglo, 'syyc0' , syyc0 ) |
---|
| 230 | CALL iom_get( numrir, jpdom_autoglo, 'sxyc0' , sxyc0 ) |
---|
| 231 | CALL iom_get( numrir, jpdom_autoglo, 'sxc1' , sxc1 ) |
---|
| 232 | CALL iom_get( numrir, jpdom_autoglo, 'syc1' , syc1 ) |
---|
| 233 | CALL iom_get( numrir, jpdom_autoglo, 'sxxc1' , sxxc1 ) |
---|
| 234 | CALL iom_get( numrir, jpdom_autoglo, 'syyc1' , syyc1 ) |
---|
| 235 | CALL iom_get( numrir, jpdom_autoglo, 'sxyc1' , sxyc1 ) |
---|
| 236 | CALL iom_get( numrir, jpdom_autoglo, 'sxc2' , sxc2 ) |
---|
| 237 | CALL iom_get( numrir, jpdom_autoglo, 'syc2' , syc2 ) |
---|
| 238 | CALL iom_get( numrir, jpdom_autoglo, 'sxxc2' , sxxc2 ) |
---|
| 239 | CALL iom_get( numrir, jpdom_autoglo, 'syyc2' , syyc2 ) |
---|
| 240 | CALL iom_get( numrir, jpdom_autoglo, 'sxyc2' , sxyc2 ) |
---|
| 241 | CALL iom_get( numrir, jpdom_autoglo, 'sxst' , sxst ) |
---|
| 242 | CALL iom_get( numrir, jpdom_autoglo, 'syst' , syst ) |
---|
| 243 | CALL iom_get( numrir, jpdom_autoglo, 'sxxst' , sxxst ) |
---|
| 244 | CALL iom_get( numrir, jpdom_autoglo, 'syyst' , syyst ) |
---|
| 245 | CALL iom_get( numrir, jpdom_autoglo, 'sxyst' , sxyst ) |
---|
[473] | 246 | |
---|
[508] | 247 | CALL iom_close( numrir ) |
---|
| 248 | ! |
---|
[3] | 249 | END SUBROUTINE lim_rst_read |
---|
| 250 | |
---|
| 251 | #else |
---|
| 252 | !!---------------------------------------------------------------------- |
---|
| 253 | !! Default option : Empty module NO LIM sea-ice model |
---|
| 254 | !!---------------------------------------------------------------------- |
---|
| 255 | #endif |
---|
| 256 | |
---|
| 257 | !!====================================================================== |
---|
| 258 | END MODULE limrst |
---|