[825] | 1 | MODULE limrst |
---|
[835] | 2 | !!====================================================================== |
---|
| 3 | !! *** MODULE limrst *** |
---|
| 4 | !! Ice restart : write the ice restart file |
---|
| 5 | !!====================================================================== |
---|
[2528] | 6 | !! History: - ! 2005-04 (M. Vancoppenolle) Original code |
---|
| 7 | !! 3.0 ! 2008-03 (C. Ethe) restart files in using IOM interface |
---|
[2715] | 8 | !! 4.0 ! 2011-02 (G. Madec) dynamical allocation |
---|
[2528] | 9 | !!---------------------------------------------------------------------- |
---|
[825] | 10 | #if defined key_lim3 |
---|
[835] | 11 | !!---------------------------------------------------------------------- |
---|
| 12 | !! 'key_lim3' : LIM sea-ice model |
---|
| 13 | !!---------------------------------------------------------------------- |
---|
| 14 | !! lim_rst_opn : open ice restart file |
---|
| 15 | !! lim_rst_write : write of the restart file |
---|
| 16 | !! lim_rst_read : read the restart file |
---|
| 17 | !!---------------------------------------------------------------------- |
---|
[2528] | 18 | USE ice ! sea-ice variables |
---|
| 19 | USE par_ice ! sea-ice parameters |
---|
| 20 | USE dom_oce ! ocean domain |
---|
| 21 | USE sbc_oce ! Surface boundary condition: ocean fields |
---|
| 22 | USE sbc_ice ! Surface boundary condition: ice fields |
---|
| 23 | USE in_out_manager ! I/O manager |
---|
| 24 | USE iom ! I/O library |
---|
[2715] | 25 | USE lib_mpp ! MPP library |
---|
[921] | 26 | |
---|
[835] | 27 | IMPLICIT NONE |
---|
| 28 | PRIVATE |
---|
[921] | 29 | |
---|
[2528] | 30 | PUBLIC lim_rst_opn ! routine called by icestep.F90 |
---|
| 31 | PUBLIC lim_rst_write ! routine called by icestep.F90 |
---|
| 32 | PUBLIC lim_rst_read ! routine called by iceini.F90 |
---|
[825] | 33 | |
---|
[835] | 34 | LOGICAL, PUBLIC :: lrst_ice !: logical to control the ice restart write |
---|
| 35 | INTEGER, PUBLIC :: numrir, numriw !: logical unit for ice restart (read and write) |
---|
[825] | 36 | |
---|
[835] | 37 | !!---------------------------------------------------------------------- |
---|
[2715] | 38 | !! NEMO/LIM3 4.0 , UCL - NEMO Consortium (2011) |
---|
[1156] | 39 | !! $Id$ |
---|
[2528] | 40 | !! Software governed by the CeCILL licence (NEMOGCM/NEMO_CeCILL.txt) |
---|
[835] | 41 | !!---------------------------------------------------------------------- |
---|
| 42 | CONTAINS |
---|
[825] | 43 | |
---|
[835] | 44 | SUBROUTINE lim_rst_opn( kt ) |
---|
| 45 | !!---------------------------------------------------------------------- |
---|
| 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 | ! |
---|
[2528] | 52 | CHARACTER(LEN=20) :: clkt ! ocean time-step define as a character |
---|
[835] | 53 | CHARACTER(LEN=50) :: clname ! ice output restart file name |
---|
| 54 | !!---------------------------------------------------------------------- |
---|
| 55 | ! |
---|
| 56 | IF( kt == nit000 ) lrst_ice = .FALSE. ! default definition |
---|
[921] | 57 | |
---|
[2528] | 58 | ! in order to get better performances with NetCDF format, we open and define the ice restart file |
---|
| 59 | ! one ice time step before writing the data (-> at nitrst - 2*nn_fsbc + 1), except if we write ice |
---|
| 60 | ! restart files every ice time step or if an ice restart file was writen at nitend - 2*nn_fsbc + 1 |
---|
| 61 | IF( kt == nitrst - 2*nn_fsbc + 1 .OR. nstock == nn_fsbc & |
---|
| 62 | & .OR. ( kt == nitend - nn_fsbc + 1 .AND. .NOT. lrst_ice ) ) THEN |
---|
[835] | 63 | ! beware of the format used to write kt (default is i8.8, that should be large enough...) |
---|
| 64 | IF( nitrst > 99999999 ) THEN ; WRITE(clkt, * ) nitrst |
---|
| 65 | ELSE ; WRITE(clkt, '(i8.8)') nitrst |
---|
| 66 | ENDIF |
---|
| 67 | ! create the file |
---|
[1229] | 68 | clname = TRIM(cexper)//"_"//TRIM(ADJUSTL(clkt))//"_"//TRIM(cn_icerst_out) |
---|
[835] | 69 | IF(lwp) THEN |
---|
| 70 | WRITE(numout,*) |
---|
| 71 | SELECT CASE ( jprstlib ) |
---|
| 72 | CASE ( jprstdimg ) ; WRITE(numout,*) ' open ice restart binary file: '//clname |
---|
| 73 | CASE DEFAULT ; WRITE(numout,*) ' open ice restart NetCDF file: '//clname |
---|
| 74 | END SELECT |
---|
[888] | 75 | IF( kt == nitrst - 2*nn_fsbc + 1 ) THEN |
---|
| 76 | WRITE(numout,*) ' kt = nitrst - 2*nn_fsbc + 1 = ', kt,' date= ', ndastp |
---|
| 77 | ELSE ; WRITE(numout,*) ' kt = ' , kt,' date= ', ndastp |
---|
[835] | 78 | ENDIF |
---|
| 79 | ENDIF |
---|
[2528] | 80 | ! |
---|
[835] | 81 | CALL iom_open( clname, numriw, ldwrt = .TRUE., kiolib = jprstlib ) |
---|
| 82 | lrst_ice = .TRUE. |
---|
| 83 | ENDIF |
---|
| 84 | ! |
---|
| 85 | END SUBROUTINE lim_rst_opn |
---|
[825] | 86 | |
---|
[2528] | 87 | |
---|
[835] | 88 | SUBROUTINE lim_rst_write( kt ) |
---|
| 89 | !!---------------------------------------------------------------------- |
---|
| 90 | !! *** lim_rst_write *** |
---|
| 91 | !! |
---|
| 92 | !! ** purpose : output of sea-ice variable in a netcdf file |
---|
| 93 | !!---------------------------------------------------------------------- |
---|
[2715] | 94 | USE wrk_nemo, ONLY: wrk_in_use, wrk_not_released |
---|
| 95 | USE wrk_nemo, ONLY: z2d => wrk_2d_1 ! 2D workspace |
---|
| 96 | ! |
---|
[835] | 97 | INTEGER, INTENT(in) :: kt ! number of iteration |
---|
[2528] | 98 | !! |
---|
| 99 | INTEGER :: ji, jj, jk ,jl ! dummy loop indices |
---|
| 100 | INTEGER :: iter |
---|
| 101 | CHARACTER(len=15) :: znam |
---|
| 102 | CHARACTER(len=1) :: zchar, zchar1 |
---|
[835] | 103 | !!---------------------------------------------------------------------- |
---|
[921] | 104 | |
---|
[2715] | 105 | IF( wrk_in_use(2, 1) ) THEN |
---|
| 106 | CALL ctl_stop( 'lim_rst_write : requested workspace arrays unavailable' ) ; RETURN |
---|
| 107 | END IF |
---|
| 108 | |
---|
[888] | 109 | iter = kt + nn_fsbc - 1 ! ice restarts are written at kt == nitrst - nn_fsbc + 1 |
---|
[825] | 110 | |
---|
[835] | 111 | IF( iter == nitrst ) THEN |
---|
| 112 | IF(lwp) WRITE(numout,*) |
---|
| 113 | IF(lwp) WRITE(numout,*) 'lim_rst_write : write ice restart file kt =', kt |
---|
| 114 | IF(lwp) WRITE(numout,*) '~~~~~~~~~~~~~~' |
---|
| 115 | ENDIF |
---|
[825] | 116 | |
---|
[835] | 117 | ! Write in numriw (if iter == nitrst) |
---|
| 118 | ! ------------------ |
---|
| 119 | ! ! calendar control |
---|
[2528] | 120 | CALL iom_rstput( iter, nitrst, numriw, 'nn_fsbc', REAL( nn_fsbc, wp ) ) ! time-step |
---|
| 121 | CALL iom_rstput( iter, nitrst, numriw, 'kt_ice' , REAL( iter , wp ) ) ! date |
---|
[825] | 122 | |
---|
[835] | 123 | ! Prognostic variables |
---|
| 124 | DO jl = 1, jpl |
---|
| 125 | WRITE(zchar,'(I1)') jl |
---|
| 126 | znam = 'v_i'//'_htc'//zchar |
---|
| 127 | z2d(:,:) = v_i(:,:,jl) |
---|
| 128 | CALL iom_rstput( iter, nitrst, numriw, znam , z2d ) |
---|
| 129 | znam = 'v_s'//'_htc'//zchar |
---|
| 130 | z2d(:,:) = v_s(:,:,jl) |
---|
| 131 | CALL iom_rstput( iter, nitrst, numriw, znam , z2d ) |
---|
| 132 | znam = 'smv_i'//'_htc'//zchar |
---|
| 133 | z2d(:,:) = smv_i(:,:,jl) |
---|
| 134 | CALL iom_rstput( iter, nitrst, numriw, znam , z2d ) |
---|
| 135 | znam = 'oa_i'//'_htc'//zchar |
---|
| 136 | z2d(:,:) = oa_i(:,:,jl) |
---|
| 137 | CALL iom_rstput( iter, nitrst, numriw, znam , z2d ) |
---|
| 138 | znam = 'a_i'//'_htc'//zchar |
---|
| 139 | z2d(:,:) = a_i(:,:,jl) |
---|
| 140 | CALL iom_rstput( iter, nitrst, numriw, znam , z2d ) |
---|
| 141 | znam = 't_su'//'_htc'//zchar |
---|
| 142 | z2d(:,:) = t_su(:,:,jl) |
---|
| 143 | CALL iom_rstput( iter, nitrst, numriw, znam , z2d ) |
---|
| 144 | END DO |
---|
[1471] | 145 | |
---|
[835] | 146 | DO jl = 1, jpl |
---|
| 147 | WRITE(zchar,'(I1)') jl |
---|
| 148 | znam = 'tempt_sl1'//'_htc'//zchar |
---|
| 149 | z2d(:,:) = e_s(:,:,1,jl) |
---|
| 150 | CALL iom_rstput( iter, nitrst, numriw, znam , z2d ) |
---|
| 151 | END DO |
---|
[825] | 152 | |
---|
[835] | 153 | DO jl = 1, jpl |
---|
| 154 | WRITE(zchar,'(I1)') jl |
---|
| 155 | DO jk = 1, nlay_i |
---|
| 156 | WRITE(zchar1,'(I1)') jk |
---|
| 157 | znam = 'tempt'//'_il'//zchar1//'_htc'//zchar |
---|
| 158 | z2d(:,:) = e_i(:,:,jk,jl) |
---|
| 159 | CALL iom_rstput( iter, nitrst, numriw, znam , z2d ) |
---|
| 160 | END DO |
---|
[825] | 161 | END DO |
---|
| 162 | |
---|
[835] | 163 | CALL iom_rstput( iter, nitrst, numriw, 'u_ice' , u_ice ) |
---|
| 164 | CALL iom_rstput( iter, nitrst, numriw, 'v_ice' , v_ice ) |
---|
| 165 | CALL iom_rstput( iter, nitrst, numriw, 'fsbbq' , fsbbq ) |
---|
| 166 | CALL iom_rstput( iter, nitrst, numriw, 'stress1_i' , stress1_i ) |
---|
| 167 | CALL iom_rstput( iter, nitrst, numriw, 'stress2_i' , stress2_i ) |
---|
| 168 | CALL iom_rstput( iter, nitrst, numriw, 'stress12_i', stress12_i ) |
---|
[825] | 169 | |
---|
[835] | 170 | DO jl = 1, jpl |
---|
| 171 | WRITE(zchar,'(I1)') jl |
---|
| 172 | znam = 'sxice'//'_htc'//zchar |
---|
| 173 | z2d(:,:) = sxice(:,:,jl) |
---|
| 174 | CALL iom_rstput( iter, nitrst, numriw, znam , z2d ) |
---|
| 175 | znam = 'syice'//'_htc'//zchar |
---|
| 176 | z2d(:,:) = syice(:,:,jl) |
---|
| 177 | CALL iom_rstput( iter, nitrst, numriw, znam , z2d ) |
---|
| 178 | znam = 'sxxice'//'_htc'//zchar |
---|
| 179 | z2d(:,:) = sxxice(:,:,jl) |
---|
| 180 | CALL iom_rstput( iter, nitrst, numriw, znam , z2d ) |
---|
| 181 | znam = 'syyice'//'_htc'//zchar |
---|
| 182 | z2d(:,:) = syyice(:,:,jl) |
---|
| 183 | CALL iom_rstput( iter, nitrst, numriw, znam , z2d ) |
---|
[838] | 184 | znam = 'sxyice'//'_htc'//zchar |
---|
| 185 | z2d(:,:) = sxyice(:,:,jl) |
---|
| 186 | CALL iom_rstput( iter, nitrst, numriw, znam , z2d ) |
---|
[835] | 187 | znam = 'sxsn'//'_htc'//zchar |
---|
| 188 | z2d(:,:) = sxsn(:,:,jl) |
---|
| 189 | CALL iom_rstput( iter, nitrst, numriw, znam , z2d ) |
---|
| 190 | znam = 'sysn'//'_htc'//zchar |
---|
| 191 | z2d(:,:) = sysn(:,:,jl) |
---|
| 192 | CALL iom_rstput( iter, nitrst, numriw, znam , z2d ) |
---|
| 193 | znam = 'sxxsn'//'_htc'//zchar |
---|
| 194 | z2d(:,:) = sxxsn(:,:,jl) |
---|
| 195 | CALL iom_rstput( iter, nitrst, numriw, znam , z2d ) |
---|
| 196 | znam = 'syysn'//'_htc'//zchar |
---|
| 197 | z2d(:,:) = syysn(:,:,jl) |
---|
| 198 | CALL iom_rstput( iter, nitrst, numriw, znam , z2d ) |
---|
| 199 | znam = 'sxysn'//'_htc'//zchar |
---|
| 200 | z2d(:,:) = sxysn(:,:,jl) |
---|
| 201 | CALL iom_rstput( iter, nitrst, numriw, znam , z2d ) |
---|
| 202 | znam = 'sxa'//'_htc'//zchar |
---|
| 203 | z2d(:,:) = sxa(:,:,jl) |
---|
| 204 | CALL iom_rstput( iter, nitrst, numriw, znam , z2d ) |
---|
| 205 | znam = 'sya'//'_htc'//zchar |
---|
| 206 | z2d(:,:) = sya(:,:,jl) |
---|
| 207 | CALL iom_rstput( iter, nitrst, numriw, znam , z2d ) |
---|
| 208 | znam = 'sxxa'//'_htc'//zchar |
---|
| 209 | z2d(:,:) = sxxa(:,:,jl) |
---|
| 210 | CALL iom_rstput( iter, nitrst, numriw, znam , z2d ) |
---|
| 211 | znam = 'syya'//'_htc'//zchar |
---|
| 212 | z2d(:,:) = syya(:,:,jl) |
---|
| 213 | CALL iom_rstput( iter, nitrst, numriw, znam , z2d ) |
---|
| 214 | znam = 'sxya'//'_htc'//zchar |
---|
| 215 | z2d(:,:) = sxya(:,:,jl) |
---|
| 216 | CALL iom_rstput( iter, nitrst, numriw, znam , z2d ) |
---|
| 217 | znam = 'sxc0'//'_htc'//zchar |
---|
| 218 | z2d(:,:) = sxc0(:,:,jl) |
---|
| 219 | CALL iom_rstput( iter, nitrst, numriw, znam , z2d ) |
---|
| 220 | znam = 'syc0'//'_htc'//zchar |
---|
| 221 | z2d(:,:) = syc0(:,:,jl) |
---|
| 222 | CALL iom_rstput( iter, nitrst, numriw, znam , z2d ) |
---|
| 223 | znam = 'sxxc0'//'_htc'//zchar |
---|
| 224 | z2d(:,:) = sxxc0(:,:,jl) |
---|
| 225 | CALL iom_rstput( iter, nitrst, numriw, znam , z2d ) |
---|
| 226 | znam = 'syyc0'//'_htc'//zchar |
---|
| 227 | z2d(:,:) = syyc0(:,:,jl) |
---|
| 228 | CALL iom_rstput( iter, nitrst, numriw, znam , z2d ) |
---|
| 229 | znam = 'sxyc0'//'_htc'//zchar |
---|
| 230 | z2d(:,:) = sxyc0(:,:,jl) |
---|
| 231 | CALL iom_rstput( iter, nitrst, numriw, znam , z2d ) |
---|
| 232 | znam = 'sxsal'//'_htc'//zchar |
---|
| 233 | z2d(:,:) = sxsal(:,:,jl) |
---|
| 234 | CALL iom_rstput( iter, nitrst, numriw, znam , z2d ) |
---|
| 235 | znam = 'sysal'//'_htc'//zchar |
---|
| 236 | z2d(:,:) = sysal(:,:,jl) |
---|
| 237 | CALL iom_rstput( iter, nitrst, numriw, znam , z2d ) |
---|
| 238 | znam = 'sxxsal'//'_htc'//zchar |
---|
| 239 | z2d(:,:) = sxxsal(:,:,jl) |
---|
| 240 | CALL iom_rstput( iter, nitrst, numriw, znam , z2d ) |
---|
| 241 | znam = 'syysal'//'_htc'//zchar |
---|
| 242 | z2d(:,:) = syysal(:,:,jl) |
---|
| 243 | CALL iom_rstput( iter, nitrst, numriw, znam , z2d ) |
---|
| 244 | znam = 'sxysal'//'_htc'//zchar |
---|
| 245 | z2d(:,:) = sxysal(:,:,jl) |
---|
| 246 | CALL iom_rstput( iter, nitrst, numriw, znam , z2d ) |
---|
| 247 | znam = 'sxage'//'_htc'//zchar |
---|
| 248 | z2d(:,:) = sxage(:,:,jl) |
---|
| 249 | CALL iom_rstput( iter, nitrst, numriw, znam , z2d ) |
---|
| 250 | znam = 'syage'//'_htc'//zchar |
---|
| 251 | z2d(:,:) = syage(:,:,jl) |
---|
| 252 | CALL iom_rstput( iter, nitrst, numriw, znam , z2d ) |
---|
| 253 | znam = 'sxxage'//'_htc'//zchar |
---|
| 254 | z2d(:,:) = sxxage(:,:,jl) |
---|
| 255 | CALL iom_rstput( iter, nitrst, numriw, znam , z2d ) |
---|
| 256 | znam = 'syyage'//'_htc'//zchar |
---|
| 257 | z2d(:,:) = syyage(:,:,jl) |
---|
| 258 | CALL iom_rstput( iter, nitrst, numriw, znam , z2d ) |
---|
| 259 | znam = 'sxyage'//'_htc'//zchar |
---|
| 260 | z2d(:,:) = sxyage(:,:,jl) |
---|
| 261 | CALL iom_rstput( iter, nitrst, numriw, znam , z2d ) |
---|
| 262 | END DO |
---|
[825] | 263 | |
---|
[835] | 264 | CALL iom_rstput( iter, nitrst, numriw, 'sxopw ' , sxopw ) |
---|
| 265 | CALL iom_rstput( iter, nitrst, numriw, 'syopw ' , syopw ) |
---|
| 266 | CALL iom_rstput( iter, nitrst, numriw, 'sxxopw' , sxxopw ) |
---|
| 267 | CALL iom_rstput( iter, nitrst, numriw, 'syyopw' , syyopw ) |
---|
| 268 | CALL iom_rstput( iter, nitrst, numriw, 'sxyopw' , sxyopw ) |
---|
[825] | 269 | |
---|
[835] | 270 | DO jl = 1, jpl |
---|
| 271 | WRITE(zchar,'(I1)') jl |
---|
| 272 | DO jk = 1, nlay_i |
---|
| 273 | WRITE(zchar1,'(I1)') jk |
---|
| 274 | znam = 'sxe'//'_il'//zchar1//'_htc'//zchar |
---|
| 275 | z2d(:,:) = sxe(:,:,jk,jl) |
---|
| 276 | CALL iom_rstput( iter, nitrst, numriw, znam , z2d ) |
---|
[838] | 277 | znam = 'sye'//'_il'//zchar1//'_htc'//zchar |
---|
| 278 | z2d(:,:) = sye(:,:,jk,jl) |
---|
| 279 | CALL iom_rstput( iter, nitrst, numriw, znam , z2d ) |
---|
[835] | 280 | znam = 'sxxe'//'_il'//zchar1//'_htc'//zchar |
---|
| 281 | z2d(:,:) = sxxe(:,:,jk,jl) |
---|
| 282 | CALL iom_rstput( iter, nitrst, numriw, znam , z2d ) |
---|
| 283 | znam = 'syye'//'_il'//zchar1//'_htc'//zchar |
---|
| 284 | z2d(:,:) = syye(:,:,jk,jl) |
---|
| 285 | CALL iom_rstput( iter, nitrst, numriw, znam , z2d ) |
---|
| 286 | znam = 'sxye'//'_il'//zchar1//'_htc'//zchar |
---|
| 287 | z2d(:,:) = sxye(:,:,jk,jl) |
---|
| 288 | CALL iom_rstput( iter, nitrst, numriw, znam , z2d ) |
---|
| 289 | END DO |
---|
| 290 | END DO |
---|
[825] | 291 | |
---|
[835] | 292 | IF( iter == nitrst ) THEN |
---|
| 293 | CALL iom_close( numriw ) ! close the restart file |
---|
| 294 | lrst_ice = .FALSE. |
---|
| 295 | ENDIF |
---|
| 296 | ! |
---|
[2715] | 297 | IF( wrk_not_released(2, 1) ) CALL ctl_stop( 'lim_rst_write : failed to release workspace arrays' ) |
---|
| 298 | ! |
---|
[921] | 299 | END SUBROUTINE lim_rst_write |
---|
| 300 | |
---|
[2528] | 301 | |
---|
[835] | 302 | SUBROUTINE lim_rst_read |
---|
| 303 | !!---------------------------------------------------------------------- |
---|
| 304 | !! *** lim_rst_read *** |
---|
| 305 | !! |
---|
| 306 | !! ** purpose : read of sea-ice variable restart in a netcdf file |
---|
| 307 | !!---------------------------------------------------------------------- |
---|
[2715] | 308 | USE wrk_nemo, ONLY: wrk_in_use, wrk_not_released |
---|
| 309 | USE wrk_nemo, ONLY: z2d => wrk_2d_1 ! 2D workspace |
---|
| 310 | ! |
---|
[888] | 311 | INTEGER :: ji, jj, jk, jl, indx |
---|
[835] | 312 | REAL(wp) :: zfice, ziter |
---|
[2528] | 313 | REAL(wp) :: zs_inf, z_slope_s, zsmax, zsmin, zalpha, zindb ! local scalars used for the salinity profile |
---|
| 314 | REAL(wp), DIMENSION(nlay_i) :: zs_zero |
---|
| 315 | CHARACTER(len=15) :: znam |
---|
| 316 | CHARACTER(len=1) :: zchar, zchar1 |
---|
| 317 | INTEGER :: jlibalt = jprstlib |
---|
| 318 | LOGICAL :: llok |
---|
[835] | 319 | !!---------------------------------------------------------------------- |
---|
[921] | 320 | |
---|
[2715] | 321 | IF( wrk_in_use(2, 1) ) THEN |
---|
| 322 | CALL ctl_stop( 'lim_rst_read : requested workspace arrays unavailable.' ) ; RETURN |
---|
| 323 | ENDIF |
---|
| 324 | |
---|
[825] | 325 | IF(lwp) THEN |
---|
| 326 | WRITE(numout,*) |
---|
[835] | 327 | WRITE(numout,*) 'lim_rst_read : read ice NetCDF restart file' |
---|
[2715] | 328 | WRITE(numout,*) '~~~~~~~~~~~~~' |
---|
[825] | 329 | ENDIF |
---|
| 330 | |
---|
[1473] | 331 | IF ( jprstlib == jprstdimg ) THEN |
---|
| 332 | ! eventually read netcdf file (monobloc) for restarting on different number of processors |
---|
| 333 | ! if {cn_icerst_in}.nc exists, then set jlibalt to jpnf90 |
---|
| 334 | INQUIRE( FILE = TRIM(cn_icerst_in)//'.nc', EXIST = llok ) |
---|
| 335 | IF ( llok ) THEN ; jlibalt = jpnf90 ; ELSE ; jlibalt = jprstlib ; ENDIF |
---|
| 336 | ENDIF |
---|
| 337 | |
---|
[1229] | 338 | CALL iom_open ( cn_icerst_in, numrir, kiolib = jprstlib ) |
---|
[835] | 339 | |
---|
[888] | 340 | CALL iom_get( numrir, 'nn_fsbc', zfice ) |
---|
| 341 | CALL iom_get( numrir, 'kt_ice' , ziter ) |
---|
[835] | 342 | IF(lwp) WRITE(numout,*) ' read ice restart file at time step : ', ziter |
---|
| 343 | IF(lwp) WRITE(numout,*) ' in any case we force it to nit000 - 1 : ', nit000 - 1 |
---|
| 344 | |
---|
[825] | 345 | !Control of date |
---|
[921] | 346 | |
---|
[835] | 347 | IF( ( nit000 - INT(ziter) ) /= 1 .AND. ABS( nrstdt ) == 1 ) & |
---|
| 348 | & CALL ctl_stop( 'lim_rst_read ===>>>> : problem with nit000 in ice restart', & |
---|
| 349 | & ' verify the file or rerun with the value 0 for the', & |
---|
| 350 | & ' control of time parameter nrstdt' ) |
---|
[888] | 351 | IF( INT(zfice) /= nn_fsbc .AND. ABS( nrstdt ) == 1 ) & |
---|
| 352 | & CALL ctl_stop( 'lim_rst_read ===>>>> : problem with nn_fsbc in ice restart', & |
---|
| 353 | & ' verify the file or rerun with the value 0 for the', & |
---|
[835] | 354 | & ' control of time parameter nrstdt' ) |
---|
[825] | 355 | |
---|
[835] | 356 | DO jl = 1, jpl |
---|
| 357 | WRITE(zchar,'(I1)') jl |
---|
| 358 | znam = 'v_i'//'_htc'//zchar |
---|
| 359 | CALL iom_get( numrir, jpdom_autoglo, znam , z2d ) |
---|
| 360 | v_i(:,:,jl) = z2d(:,:) |
---|
| 361 | znam = 'v_s'//'_htc'//zchar |
---|
| 362 | CALL iom_get( numrir, jpdom_autoglo, znam , z2d ) |
---|
| 363 | v_s(:,:,jl) = z2d(:,:) |
---|
| 364 | znam = 'smv_i'//'_htc'//zchar |
---|
| 365 | CALL iom_get( numrir, jpdom_autoglo, znam , z2d ) |
---|
| 366 | smv_i(:,:,jl) = z2d(:,:) |
---|
| 367 | znam = 'oa_i'//'_htc'//zchar |
---|
| 368 | CALL iom_get( numrir, jpdom_autoglo, znam , z2d ) |
---|
| 369 | oa_i(:,:,jl) = z2d(:,:) |
---|
| 370 | znam = 'a_i'//'_htc'//zchar |
---|
| 371 | CALL iom_get( numrir, jpdom_autoglo, znam , z2d ) |
---|
| 372 | a_i(:,:,jl) = z2d(:,:) |
---|
| 373 | znam = 't_su'//'_htc'//zchar |
---|
| 374 | CALL iom_get( numrir, jpdom_autoglo, znam , z2d ) |
---|
| 375 | t_su(:,:,jl) = z2d(:,:) |
---|
| 376 | END DO |
---|
[825] | 377 | |
---|
[919] | 378 | DO jl = 1, jpl |
---|
| 379 | CALL lbc_lnk( smv_i(:,:,jl) , 'T' , 1. ) |
---|
| 380 | CALL lbc_lnk( v_i (:,:,jl) , 'T' , 1. ) |
---|
| 381 | CALL lbc_lnk( a_i (:,:,jl) , 'T' , 1. ) |
---|
| 382 | END DO |
---|
| 383 | |
---|
[825] | 384 | ! we first with bulk ice salinity |
---|
| 385 | DO jl = 1, jpl |
---|
| 386 | DO jj = 1, jpj |
---|
| 387 | DO ji = 1, jpi |
---|
| 388 | zindb = MAX( 0.0 , SIGN( 1.0 , v_i(ji,jj,jl) - 1.0e-4 ) ) |
---|
| 389 | sm_i(ji,jj,jl) = smv_i(ji,jj,jl) / MAX(v_i(ji,jj,jl),1.0e-6) * zindb |
---|
| 390 | ht_i(ji,jj,jl) = v_i(ji,jj,jl) / MAX(a_i(ji,jj,jl),1.0e-6) * zindb |
---|
| 391 | END DO |
---|
| 392 | END DO |
---|
| 393 | END DO |
---|
[921] | 394 | |
---|
[825] | 395 | DO jk = 1, nlay_i |
---|
| 396 | s_i(:,:,jk,:) = sm_i(:,:,:) |
---|
| 397 | END DO |
---|
[921] | 398 | |
---|
[2528] | 399 | IF( num_sal == 2 ) THEN ! Salinity profile |
---|
[825] | 400 | DO jl = 1, jpl |
---|
[835] | 401 | DO jk = 1, nlay_i |
---|
| 402 | DO jj = 1, jpj |
---|
| 403 | DO ji = 1, jpi |
---|
| 404 | zs_inf = sm_i(ji,jj,jl) |
---|
[2528] | 405 | z_slope_s = 2._wp * sm_i(ji,jj,jl) / MAX( 0.01_wp , ht_i(ji,jj,jl) ) |
---|
[921] | 406 | !- slope of the salinity profile |
---|
[2528] | 407 | zs_zero(jk) = z_slope_s * ( REAL(jk,wp) - 0.5_wp ) * ht_i(ji,jj,jl) / REAL(nlay_i,wp) |
---|
| 408 | zsmax = 4.5_wp |
---|
| 409 | zsmin = 3.5_wp |
---|
[835] | 410 | IF( sm_i(ji,jj,jl) .LT. zsmin ) THEN |
---|
[2528] | 411 | zalpha = 1._wp |
---|
[835] | 412 | ELSEIF( sm_i(ji,jj,jl) .LT.zsmax ) THEN |
---|
[2528] | 413 | zalpha = sm_i(ji,jj,jl) / ( zsmin - zsmax ) + zsmax / ( zsmax - zsmin ) |
---|
[835] | 414 | ELSE |
---|
[2528] | 415 | zalpha = 0._wp |
---|
[835] | 416 | ENDIF |
---|
[2528] | 417 | s_i(ji,jj,jk,jl) = zalpha * zs_zero(jk) + ( 1._wp - zalpha ) * zs_inf |
---|
[835] | 418 | END DO |
---|
| 419 | END DO |
---|
| 420 | END DO |
---|
[825] | 421 | END DO |
---|
| 422 | ENDIF |
---|
[921] | 423 | |
---|
[835] | 424 | DO jl = 1, jpl |
---|
| 425 | WRITE(zchar,'(I1)') jl |
---|
| 426 | znam = 'tempt_sl1'//'_htc'//zchar |
---|
| 427 | CALL iom_get( numrir, jpdom_autoglo, znam , z2d ) |
---|
| 428 | e_s(:,:,1,jl) = z2d(:,:) |
---|
[825] | 429 | END DO |
---|
[921] | 430 | |
---|
[835] | 431 | DO jl = 1, jpl |
---|
| 432 | WRITE(zchar,'(I1)') jl |
---|
| 433 | DO jk = 1, nlay_i |
---|
| 434 | WRITE(zchar1,'(I1)') jk |
---|
| 435 | znam = 'tempt'//'_il'//zchar1//'_htc'//zchar |
---|
| 436 | CALL iom_get( numrir, jpdom_autoglo, znam , z2d ) |
---|
| 437 | e_i(:,:,jk,jl) = z2d(:,:) |
---|
| 438 | END DO |
---|
| 439 | END DO |
---|
[825] | 440 | |
---|
[835] | 441 | CALL iom_get( numrir, jpdom_autoglo, 'u_ice' , u_ice ) |
---|
| 442 | CALL iom_get( numrir, jpdom_autoglo, 'v_ice' , v_ice ) |
---|
| 443 | CALL iom_get( numrir, jpdom_autoglo, 'fsbbq' , fsbbq ) |
---|
| 444 | CALL iom_get( numrir, jpdom_autoglo, 'stress1_i' , stress1_i ) |
---|
| 445 | CALL iom_get( numrir, jpdom_autoglo, 'stress2_i' , stress2_i ) |
---|
| 446 | CALL iom_get( numrir, jpdom_autoglo, 'stress12_i', stress12_i ) |
---|
[825] | 447 | |
---|
[835] | 448 | DO jl = 1, jpl |
---|
| 449 | WRITE(zchar,'(I1)') jl |
---|
| 450 | znam = 'sxice'//'_htc'//zchar |
---|
| 451 | CALL iom_get( numrir, jpdom_autoglo, znam , z2d ) |
---|
| 452 | sxice(:,:,jl) = z2d(:,:) |
---|
| 453 | znam = 'syice'//'_htc'//zchar |
---|
| 454 | CALL iom_get( numrir, jpdom_autoglo, znam , z2d ) |
---|
| 455 | syice(:,:,jl) = z2d(:,:) |
---|
| 456 | znam = 'sxxice'//'_htc'//zchar |
---|
| 457 | CALL iom_get( numrir, jpdom_autoglo, znam , z2d ) |
---|
| 458 | sxxice(:,:,jl) = z2d(:,:) |
---|
| 459 | znam = 'syyice'//'_htc'//zchar |
---|
| 460 | CALL iom_get( numrir, jpdom_autoglo, znam , z2d ) |
---|
| 461 | syyice(:,:,jl) = z2d(:,:) |
---|
[838] | 462 | znam = 'sxyice'//'_htc'//zchar |
---|
| 463 | CALL iom_get( numrir, jpdom_autoglo, znam , z2d ) |
---|
| 464 | sxyice(:,:,jl) = z2d(:,:) |
---|
[835] | 465 | znam = 'sxsn'//'_htc'//zchar |
---|
| 466 | CALL iom_get( numrir, jpdom_autoglo, znam , z2d ) |
---|
| 467 | sxsn(:,:,jl) = z2d(:,:) |
---|
| 468 | znam = 'sysn'//'_htc'//zchar |
---|
| 469 | CALL iom_get( numrir, jpdom_autoglo, znam , z2d ) |
---|
| 470 | sysn(:,:,jl) = z2d(:,:) |
---|
| 471 | znam = 'sxxsn'//'_htc'//zchar |
---|
| 472 | CALL iom_get( numrir, jpdom_autoglo, znam , z2d ) |
---|
| 473 | sxxsn(:,:,jl) = z2d(:,:) |
---|
| 474 | znam = 'syysn'//'_htc'//zchar |
---|
| 475 | CALL iom_get( numrir, jpdom_autoglo, znam , z2d ) |
---|
| 476 | syysn(:,:,jl) = z2d(:,:) |
---|
| 477 | znam = 'sxysn'//'_htc'//zchar |
---|
| 478 | CALL iom_get( numrir, jpdom_autoglo, znam , z2d ) |
---|
| 479 | sxysn(:,:,jl) = z2d(:,:) |
---|
| 480 | znam = 'sxa'//'_htc'//zchar |
---|
| 481 | CALL iom_get( numrir, jpdom_autoglo, znam , z2d ) |
---|
| 482 | sxa(:,:,jl) = z2d(:,:) |
---|
| 483 | znam = 'sya'//'_htc'//zchar |
---|
| 484 | CALL iom_get( numrir, jpdom_autoglo, znam , z2d ) |
---|
| 485 | sya(:,:,jl) = z2d(:,:) |
---|
| 486 | znam = 'sxxa'//'_htc'//zchar |
---|
| 487 | CALL iom_get( numrir, jpdom_autoglo, znam , z2d ) |
---|
| 488 | sxxa(:,:,jl) = z2d(:,:) |
---|
| 489 | znam = 'syya'//'_htc'//zchar |
---|
| 490 | CALL iom_get( numrir, jpdom_autoglo, znam , z2d ) |
---|
| 491 | syya(:,:,jl) = z2d(:,:) |
---|
| 492 | znam = 'sxya'//'_htc'//zchar |
---|
| 493 | CALL iom_get( numrir, jpdom_autoglo, znam , z2d ) |
---|
| 494 | sxya(:,:,jl) = z2d(:,:) |
---|
| 495 | znam = 'sxc0'//'_htc'//zchar |
---|
| 496 | CALL iom_get( numrir, jpdom_autoglo, znam , z2d ) |
---|
| 497 | sxc0(:,:,jl) = z2d(:,:) |
---|
| 498 | znam = 'syc0'//'_htc'//zchar |
---|
| 499 | CALL iom_get( numrir, jpdom_autoglo, znam , z2d ) |
---|
| 500 | syc0(:,:,jl) = z2d(:,:) |
---|
| 501 | znam = 'sxxc0'//'_htc'//zchar |
---|
| 502 | CALL iom_get( numrir, jpdom_autoglo, znam , z2d ) |
---|
| 503 | sxxc0(:,:,jl) = z2d(:,:) |
---|
| 504 | znam = 'syyc0'//'_htc'//zchar |
---|
| 505 | CALL iom_get( numrir, jpdom_autoglo, znam , z2d ) |
---|
| 506 | syyc0(:,:,jl) = z2d(:,:) |
---|
| 507 | znam = 'sxyc0'//'_htc'//zchar |
---|
| 508 | CALL iom_get( numrir, jpdom_autoglo, znam , z2d ) |
---|
| 509 | sxyc0(:,:,jl) = z2d(:,:) |
---|
| 510 | znam = 'sxsal'//'_htc'//zchar |
---|
| 511 | CALL iom_get( numrir, jpdom_autoglo, znam , z2d ) |
---|
| 512 | sxsal(:,:,jl) = z2d(:,:) |
---|
| 513 | znam = 'sysal'//'_htc'//zchar |
---|
| 514 | CALL iom_get( numrir, jpdom_autoglo, znam , z2d ) |
---|
| 515 | sysal(:,:,jl) = z2d(:,:) |
---|
| 516 | znam = 'sxxsal'//'_htc'//zchar |
---|
| 517 | CALL iom_get( numrir, jpdom_autoglo, znam , z2d ) |
---|
| 518 | sxxsal(:,:,jl) = z2d(:,:) |
---|
| 519 | znam = 'syysal'//'_htc'//zchar |
---|
| 520 | CALL iom_get( numrir, jpdom_autoglo, znam , z2d ) |
---|
| 521 | syysal(:,:,jl) = z2d(:,:) |
---|
| 522 | znam = 'sxysal'//'_htc'//zchar |
---|
| 523 | CALL iom_get( numrir, jpdom_autoglo, znam , z2d ) |
---|
| 524 | sxysal(:,:,jl) = z2d(:,:) |
---|
| 525 | znam = 'sxage'//'_htc'//zchar |
---|
| 526 | CALL iom_get( numrir, jpdom_autoglo, znam , z2d ) |
---|
| 527 | sxage(:,:,jl) = z2d(:,:) |
---|
| 528 | znam = 'syage'//'_htc'//zchar |
---|
| 529 | CALL iom_get( numrir, jpdom_autoglo, znam , z2d ) |
---|
| 530 | syage(:,:,jl) = z2d(:,:) |
---|
| 531 | znam = 'sxxage'//'_htc'//zchar |
---|
| 532 | CALL iom_get( numrir, jpdom_autoglo, znam , z2d ) |
---|
| 533 | sxxage(:,:,jl) = z2d(:,:) |
---|
| 534 | znam = 'syyage'//'_htc'//zchar |
---|
| 535 | CALL iom_get( numrir, jpdom_autoglo, znam , z2d ) |
---|
| 536 | syyage(:,:,jl) = z2d(:,:) |
---|
| 537 | znam = 'sxyage'//'_htc'//zchar |
---|
| 538 | CALL iom_get( numrir, jpdom_autoglo, znam , z2d ) |
---|
| 539 | sxyage(:,:,jl)= z2d(:,:) |
---|
| 540 | END DO |
---|
[825] | 541 | |
---|
[835] | 542 | CALL iom_get( numrir, jpdom_autoglo, 'sxopw ' , sxopw ) |
---|
| 543 | CALL iom_get( numrir, jpdom_autoglo, 'syopw ' , syopw ) |
---|
| 544 | CALL iom_get( numrir, jpdom_autoglo, 'sxxopw' , sxxopw ) |
---|
| 545 | CALL iom_get( numrir, jpdom_autoglo, 'syyopw' , syyopw ) |
---|
| 546 | CALL iom_get( numrir, jpdom_autoglo, 'sxyopw' , sxyopw ) |
---|
[825] | 547 | |
---|
[835] | 548 | DO jl = 1, jpl |
---|
| 549 | WRITE(zchar,'(I1)') jl |
---|
| 550 | DO jk = 1, nlay_i |
---|
| 551 | WRITE(zchar1,'(I1)') jk |
---|
| 552 | znam = 'sxe'//'_il'//zchar1//'_htc'//zchar |
---|
| 553 | CALL iom_get( numrir, jpdom_autoglo, znam , z2d ) |
---|
| 554 | sxe(:,:,jk,jl) = z2d(:,:) |
---|
[838] | 555 | znam = 'sye'//'_il'//zchar1//'_htc'//zchar |
---|
| 556 | CALL iom_get( numrir, jpdom_autoglo, znam , z2d ) |
---|
| 557 | sye(:,:,jk,jl) = z2d(:,:) |
---|
[835] | 558 | znam = 'sxxe'//'_il'//zchar1//'_htc'//zchar |
---|
| 559 | CALL iom_get( numrir, jpdom_autoglo, znam , z2d ) |
---|
| 560 | sxxe(:,:,jk,jl) = z2d(:,:) |
---|
| 561 | znam = 'syye'//'_il'//zchar1//'_htc'//zchar |
---|
| 562 | CALL iom_get( numrir, jpdom_autoglo, znam , z2d ) |
---|
| 563 | syye(:,:,jk,jl) = z2d(:,:) |
---|
| 564 | znam = 'sxye'//'_il'//zchar1//'_htc'//zchar |
---|
| 565 | CALL iom_get( numrir, jpdom_autoglo, znam , z2d ) |
---|
| 566 | sxye(:,:,jk,jl) = z2d(:,:) |
---|
| 567 | END DO |
---|
| 568 | END DO |
---|
[2528] | 569 | ! |
---|
[835] | 570 | CALL iom_close( numrir ) |
---|
[2528] | 571 | ! |
---|
[2715] | 572 | IF( wrk_not_released(2, 1) ) THEN |
---|
| 573 | CALL ctl_stop( 'lim_rst_read : failed to release workspace arrays.' ) |
---|
| 574 | END IF |
---|
| 575 | ! |
---|
[921] | 576 | END SUBROUTINE lim_rst_read |
---|
| 577 | |
---|
[825] | 578 | #else |
---|
| 579 | !!---------------------------------------------------------------------- |
---|
| 580 | !! Default option : Empty module NO LIM sea-ice model |
---|
| 581 | !!---------------------------------------------------------------------- |
---|
| 582 | CONTAINS |
---|
| 583 | SUBROUTINE lim_rst_read ! Empty routine |
---|
| 584 | END SUBROUTINE lim_rst_read |
---|
| 585 | SUBROUTINE lim_rst_write ! Empty routine |
---|
| 586 | END SUBROUTINE lim_rst_write |
---|
| 587 | #endif |
---|
| 588 | |
---|
| 589 | !!====================================================================== |
---|
| 590 | END MODULE limrst |
---|