[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 | !!---------------------------------------------------------------------- |
---|
[3625] | 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 |
---|
[835] | 17 | !!---------------------------------------------------------------------- |
---|
[3625] | 18 | USE ice ! sea-ice variables |
---|
[4205] | 19 | USE oce , ONLY : snwice_mass, snwice_mass_b |
---|
[3625] | 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 |
---|
| 25 | USE lib_mpp ! MPP library |
---|
| 26 | USE wrk_nemo ! work arrays |
---|
| 27 | USE lib_fortran ! Fortran utilities (allows no signed zero when 'key_nosignedzero' defined) |
---|
[5123] | 28 | USE limctl |
---|
[921] | 29 | |
---|
[835] | 30 | IMPLICIT NONE |
---|
| 31 | PRIVATE |
---|
[921] | 32 | |
---|
[2528] | 33 | PUBLIC lim_rst_opn ! routine called by icestep.F90 |
---|
| 34 | PUBLIC lim_rst_write ! routine called by icestep.F90 |
---|
[5123] | 35 | PUBLIC lim_rst_read ! routine called by sbc_lim_init |
---|
[825] | 36 | |
---|
[835] | 37 | LOGICAL, PUBLIC :: lrst_ice !: logical to control the ice restart write |
---|
| 38 | INTEGER, PUBLIC :: numrir, numriw !: logical unit for ice restart (read and write) |
---|
[825] | 39 | |
---|
[835] | 40 | !!---------------------------------------------------------------------- |
---|
[4161] | 41 | !! NEMO/LIM3 4.0 , UCL - NEMO Consortium (2011) |
---|
[8540] | 42 | !! $Id: limrst.F90 7814 2017-03-20 16:21:42Z clem $ |
---|
[2528] | 43 | !! Software governed by the CeCILL licence (NEMOGCM/NEMO_CeCILL.txt) |
---|
[835] | 44 | !!---------------------------------------------------------------------- |
---|
| 45 | CONTAINS |
---|
[825] | 46 | |
---|
[835] | 47 | SUBROUTINE lim_rst_opn( kt ) |
---|
| 48 | !!---------------------------------------------------------------------- |
---|
| 49 | !! *** lim_rst_opn *** |
---|
| 50 | !! |
---|
| 51 | !! ** purpose : output of sea-ice variable in a netcdf file |
---|
| 52 | !!---------------------------------------------------------------------- |
---|
| 53 | INTEGER, INTENT(in) :: kt ! number of iteration |
---|
| 54 | ! |
---|
[2528] | 55 | CHARACTER(LEN=20) :: clkt ! ocean time-step define as a character |
---|
[835] | 56 | CHARACTER(LEN=50) :: clname ! ice output restart file name |
---|
[5341] | 57 | CHARACTER(len=256) :: clpath ! full path to ice output restart file |
---|
[835] | 58 | !!---------------------------------------------------------------------- |
---|
| 59 | ! |
---|
| 60 | IF( kt == nit000 ) lrst_ice = .FALSE. ! default definition |
---|
[921] | 61 | |
---|
[2528] | 62 | ! in order to get better performances with NetCDF format, we open and define the ice restart file |
---|
| 63 | ! one ice time step before writing the data (-> at nitrst - 2*nn_fsbc + 1), except if we write ice |
---|
| 64 | ! restart files every ice time step or if an ice restart file was writen at nitend - 2*nn_fsbc + 1 |
---|
| 65 | IF( kt == nitrst - 2*nn_fsbc + 1 .OR. nstock == nn_fsbc & |
---|
| 66 | & .OR. ( kt == nitend - nn_fsbc + 1 .AND. .NOT. lrst_ice ) ) THEN |
---|
[5341] | 67 | IF( nitrst <= nitend .AND. nitrst > 0 ) THEN |
---|
| 68 | ! beware of the format used to write kt (default is i8.8, that should be large enough...) |
---|
| 69 | IF( nitrst > 99999999 ) THEN ; WRITE(clkt, * ) nitrst |
---|
| 70 | ELSE ; WRITE(clkt, '(i8.8)') nitrst |
---|
[835] | 71 | ENDIF |
---|
[5341] | 72 | ! create the file |
---|
| 73 | clname = TRIM(cexper)//"_"//TRIM(ADJUSTL(clkt))//"_"//TRIM(cn_icerst_out) |
---|
| 74 | clpath = TRIM(cn_icerst_outdir) |
---|
| 75 | IF( clpath(LEN_TRIM(clpath):) /= '/' ) clpath = TRIM(clpath)//'/' |
---|
| 76 | IF(lwp) THEN |
---|
| 77 | WRITE(numout,*) |
---|
| 78 | SELECT CASE ( jprstlib ) |
---|
| 79 | CASE ( jprstdimg ) |
---|
| 80 | WRITE(numout,*) ' open ice restart binary file: ',TRIM(clpath)//clname |
---|
| 81 | CASE DEFAULT |
---|
| 82 | WRITE(numout,*) ' open ice restart NetCDF file: ',TRIM(clpath)//clname |
---|
| 83 | END SELECT |
---|
| 84 | IF( kt == nitrst - 2*nn_fsbc + 1 ) THEN |
---|
| 85 | WRITE(numout,*) ' kt = nitrst - 2*nn_fsbc + 1 = ', kt,' date= ', ndastp |
---|
| 86 | ELSE ; WRITE(numout,*) ' kt = ' , kt,' date= ', ndastp |
---|
| 87 | ENDIF |
---|
| 88 | ENDIF |
---|
| 89 | ! |
---|
| 90 | CALL iom_open( TRIM(clpath)//TRIM(clname), numriw, ldwrt = .TRUE., kiolib = jprstlib ) |
---|
| 91 | lrst_ice = .TRUE. |
---|
[835] | 92 | ENDIF |
---|
| 93 | ENDIF |
---|
| 94 | ! |
---|
[5128] | 95 | IF( ln_icectl ) CALL lim_prt( kt, iiceprt, jiceprt, 1, ' - Beginning the time step - ' ) ! control print |
---|
[835] | 96 | END SUBROUTINE lim_rst_opn |
---|
[825] | 97 | |
---|
[2528] | 98 | |
---|
[835] | 99 | SUBROUTINE lim_rst_write( kt ) |
---|
| 100 | !!---------------------------------------------------------------------- |
---|
| 101 | !! *** lim_rst_write *** |
---|
| 102 | !! |
---|
| 103 | !! ** purpose : output of sea-ice variable in a netcdf file |
---|
| 104 | !!---------------------------------------------------------------------- |
---|
| 105 | INTEGER, INTENT(in) :: kt ! number of iteration |
---|
[2528] | 106 | !! |
---|
| 107 | INTEGER :: ji, jj, jk ,jl ! dummy loop indices |
---|
| 108 | INTEGER :: iter |
---|
| 109 | CHARACTER(len=15) :: znam |
---|
[8540] | 110 | CHARACTER(len=2) :: zchar, zchar1 |
---|
[3294] | 111 | REAL(wp), POINTER, DIMENSION(:,:) :: z2d |
---|
[835] | 112 | !!---------------------------------------------------------------------- |
---|
[921] | 113 | |
---|
[3294] | 114 | CALL wrk_alloc( jpi, jpj, z2d ) |
---|
[2715] | 115 | |
---|
[888] | 116 | iter = kt + nn_fsbc - 1 ! ice restarts are written at kt == nitrst - nn_fsbc + 1 |
---|
[825] | 117 | |
---|
[835] | 118 | IF( iter == nitrst ) THEN |
---|
| 119 | IF(lwp) WRITE(numout,*) |
---|
| 120 | IF(lwp) WRITE(numout,*) 'lim_rst_write : write ice restart file kt =', kt |
---|
| 121 | IF(lwp) WRITE(numout,*) '~~~~~~~~~~~~~~' |
---|
| 122 | ENDIF |
---|
[825] | 123 | |
---|
[835] | 124 | ! Write in numriw (if iter == nitrst) |
---|
| 125 | ! ------------------ |
---|
| 126 | ! ! calendar control |
---|
[2528] | 127 | CALL iom_rstput( iter, nitrst, numriw, 'nn_fsbc', REAL( nn_fsbc, wp ) ) ! time-step |
---|
| 128 | CALL iom_rstput( iter, nitrst, numriw, 'kt_ice' , REAL( iter , wp ) ) ! date |
---|
[825] | 129 | |
---|
[835] | 130 | ! Prognostic variables |
---|
| 131 | DO jl = 1, jpl |
---|
[8540] | 132 | WRITE(zchar,'(I2)') jl |
---|
| 133 | znam = 'v_i'//'_htc'//TRIM(ADJUSTL(zchar)) |
---|
[835] | 134 | z2d(:,:) = v_i(:,:,jl) |
---|
| 135 | CALL iom_rstput( iter, nitrst, numriw, znam , z2d ) |
---|
[8540] | 136 | znam = 'v_s'//'_htc'//TRIM(ADJUSTL(zchar)) |
---|
[835] | 137 | z2d(:,:) = v_s(:,:,jl) |
---|
| 138 | CALL iom_rstput( iter, nitrst, numriw, znam , z2d ) |
---|
[8540] | 139 | znam = 'smv_i'//'_htc'//TRIM(ADJUSTL(zchar)) |
---|
[835] | 140 | z2d(:,:) = smv_i(:,:,jl) |
---|
| 141 | CALL iom_rstput( iter, nitrst, numriw, znam , z2d ) |
---|
[8540] | 142 | znam = 'oa_i'//'_htc'//TRIM(ADJUSTL(zchar)) |
---|
[835] | 143 | z2d(:,:) = oa_i(:,:,jl) |
---|
| 144 | CALL iom_rstput( iter, nitrst, numriw, znam , z2d ) |
---|
[8540] | 145 | znam = 'a_i'//'_htc'//TRIM(ADJUSTL(zchar)) |
---|
[835] | 146 | z2d(:,:) = a_i(:,:,jl) |
---|
| 147 | CALL iom_rstput( iter, nitrst, numriw, znam , z2d ) |
---|
[8540] | 148 | znam = 't_su'//'_htc'//TRIM(ADJUSTL(zchar)) |
---|
[835] | 149 | z2d(:,:) = t_su(:,:,jl) |
---|
| 150 | CALL iom_rstput( iter, nitrst, numriw, znam , z2d ) |
---|
[8540] | 151 | znam = 'tempt_sl1'//'_htc'//TRIM(ADJUSTL(zchar)) |
---|
[835] | 152 | z2d(:,:) = e_s(:,:,1,jl) |
---|
| 153 | CALL iom_rstput( iter, nitrst, numriw, znam , z2d ) |
---|
| 154 | DO jk = 1, nlay_i |
---|
[8540] | 155 | WRITE(zchar1,'(I2)') jk |
---|
| 156 | znam = 'tempt'//'_il'//TRIM(ADJUSTL(zchar1))//'_htc'//TRIM(ADJUSTL(zchar)) |
---|
[835] | 157 | z2d(:,:) = e_i(:,:,jk,jl) |
---|
| 158 | CALL iom_rstput( iter, nitrst, numriw, znam , z2d ) |
---|
| 159 | END DO |
---|
[825] | 160 | END DO |
---|
| 161 | |
---|
[4205] | 162 | CALL iom_rstput( iter, nitrst, numriw, 'u_ice' , u_ice ) |
---|
| 163 | CALL iom_rstput( iter, nitrst, numriw, 'v_ice' , v_ice ) |
---|
| 164 | CALL iom_rstput( iter, nitrst, numriw, 'stress1_i' , stress1_i ) |
---|
| 165 | CALL iom_rstput( iter, nitrst, numriw, 'stress2_i' , stress2_i ) |
---|
| 166 | CALL iom_rstput( iter, nitrst, numriw, 'stress12_i' , stress12_i ) |
---|
[5123] | 167 | CALL iom_rstput( iter, nitrst, numriw, 'snwice_mass' , snwice_mass ) |
---|
| 168 | CALL iom_rstput( iter, nitrst, numriw, 'snwice_mass_b', snwice_mass_b ) |
---|
[825] | 169 | |
---|
[835] | 170 | DO jl = 1, jpl |
---|
[8540] | 171 | WRITE(zchar,'(I2)') jl |
---|
| 172 | znam = 'sxice'//'_htc'//TRIM(ADJUSTL(zchar)) |
---|
[835] | 173 | z2d(:,:) = sxice(:,:,jl) |
---|
| 174 | CALL iom_rstput( iter, nitrst, numriw, znam , z2d ) |
---|
[8540] | 175 | znam = 'syice'//'_htc'//TRIM(ADJUSTL(zchar)) |
---|
[835] | 176 | z2d(:,:) = syice(:,:,jl) |
---|
| 177 | CALL iom_rstput( iter, nitrst, numriw, znam , z2d ) |
---|
[8540] | 178 | znam = 'sxxice'//'_htc'//TRIM(ADJUSTL(zchar)) |
---|
[835] | 179 | z2d(:,:) = sxxice(:,:,jl) |
---|
| 180 | CALL iom_rstput( iter, nitrst, numriw, znam , z2d ) |
---|
[8540] | 181 | znam = 'syyice'//'_htc'//TRIM(ADJUSTL(zchar)) |
---|
[835] | 182 | z2d(:,:) = syyice(:,:,jl) |
---|
| 183 | CALL iom_rstput( iter, nitrst, numriw, znam , z2d ) |
---|
[8540] | 184 | znam = 'sxyice'//'_htc'//TRIM(ADJUSTL(zchar)) |
---|
[838] | 185 | z2d(:,:) = sxyice(:,:,jl) |
---|
| 186 | CALL iom_rstput( iter, nitrst, numriw, znam , z2d ) |
---|
[8540] | 187 | znam = 'sxsn'//'_htc'//TRIM(ADJUSTL(zchar)) |
---|
[835] | 188 | z2d(:,:) = sxsn(:,:,jl) |
---|
| 189 | CALL iom_rstput( iter, nitrst, numriw, znam , z2d ) |
---|
[8540] | 190 | znam = 'sysn'//'_htc'//TRIM(ADJUSTL(zchar)) |
---|
[835] | 191 | z2d(:,:) = sysn(:,:,jl) |
---|
| 192 | CALL iom_rstput( iter, nitrst, numriw, znam , z2d ) |
---|
[8540] | 193 | znam = 'sxxsn'//'_htc'//TRIM(ADJUSTL(zchar)) |
---|
[835] | 194 | z2d(:,:) = sxxsn(:,:,jl) |
---|
| 195 | CALL iom_rstput( iter, nitrst, numriw, znam , z2d ) |
---|
[8540] | 196 | znam = 'syysn'//'_htc'//TRIM(ADJUSTL(zchar)) |
---|
[835] | 197 | z2d(:,:) = syysn(:,:,jl) |
---|
| 198 | CALL iom_rstput( iter, nitrst, numriw, znam , z2d ) |
---|
[8540] | 199 | znam = 'sxysn'//'_htc'//TRIM(ADJUSTL(zchar)) |
---|
[835] | 200 | z2d(:,:) = sxysn(:,:,jl) |
---|
| 201 | CALL iom_rstput( iter, nitrst, numriw, znam , z2d ) |
---|
[8540] | 202 | znam = 'sxa'//'_htc'//TRIM(ADJUSTL(zchar)) |
---|
[835] | 203 | z2d(:,:) = sxa(:,:,jl) |
---|
| 204 | CALL iom_rstput( iter, nitrst, numriw, znam , z2d ) |
---|
[8540] | 205 | znam = 'sya'//'_htc'//TRIM(ADJUSTL(zchar)) |
---|
[835] | 206 | z2d(:,:) = sya(:,:,jl) |
---|
| 207 | CALL iom_rstput( iter, nitrst, numriw, znam , z2d ) |
---|
[8540] | 208 | znam = 'sxxa'//'_htc'//TRIM(ADJUSTL(zchar)) |
---|
[835] | 209 | z2d(:,:) = sxxa(:,:,jl) |
---|
| 210 | CALL iom_rstput( iter, nitrst, numriw, znam , z2d ) |
---|
[8540] | 211 | znam = 'syya'//'_htc'//TRIM(ADJUSTL(zchar)) |
---|
[835] | 212 | z2d(:,:) = syya(:,:,jl) |
---|
| 213 | CALL iom_rstput( iter, nitrst, numriw, znam , z2d ) |
---|
[8540] | 214 | znam = 'sxya'//'_htc'//TRIM(ADJUSTL(zchar)) |
---|
[835] | 215 | z2d(:,:) = sxya(:,:,jl) |
---|
| 216 | CALL iom_rstput( iter, nitrst, numriw, znam , z2d ) |
---|
[8540] | 217 | znam = 'sxc0'//'_htc'//TRIM(ADJUSTL(zchar)) |
---|
[835] | 218 | z2d(:,:) = sxc0(:,:,jl) |
---|
| 219 | CALL iom_rstput( iter, nitrst, numriw, znam , z2d ) |
---|
[8540] | 220 | znam = 'syc0'//'_htc'//TRIM(ADJUSTL(zchar)) |
---|
[835] | 221 | z2d(:,:) = syc0(:,:,jl) |
---|
| 222 | CALL iom_rstput( iter, nitrst, numriw, znam , z2d ) |
---|
[8540] | 223 | znam = 'sxxc0'//'_htc'//TRIM(ADJUSTL(zchar)) |
---|
[835] | 224 | z2d(:,:) = sxxc0(:,:,jl) |
---|
| 225 | CALL iom_rstput( iter, nitrst, numriw, znam , z2d ) |
---|
[8540] | 226 | znam = 'syyc0'//'_htc'//TRIM(ADJUSTL(zchar)) |
---|
[835] | 227 | z2d(:,:) = syyc0(:,:,jl) |
---|
| 228 | CALL iom_rstput( iter, nitrst, numriw, znam , z2d ) |
---|
[8540] | 229 | znam = 'sxyc0'//'_htc'//TRIM(ADJUSTL(zchar)) |
---|
[835] | 230 | z2d(:,:) = sxyc0(:,:,jl) |
---|
| 231 | CALL iom_rstput( iter, nitrst, numriw, znam , z2d ) |
---|
[8540] | 232 | znam = 'sxsal'//'_htc'//TRIM(ADJUSTL(zchar)) |
---|
[835] | 233 | z2d(:,:) = sxsal(:,:,jl) |
---|
| 234 | CALL iom_rstput( iter, nitrst, numriw, znam , z2d ) |
---|
[8540] | 235 | znam = 'sysal'//'_htc'//TRIM(ADJUSTL(zchar)) |
---|
[835] | 236 | z2d(:,:) = sysal(:,:,jl) |
---|
| 237 | CALL iom_rstput( iter, nitrst, numriw, znam , z2d ) |
---|
[8540] | 238 | znam = 'sxxsal'//'_htc'//TRIM(ADJUSTL(zchar)) |
---|
[835] | 239 | z2d(:,:) = sxxsal(:,:,jl) |
---|
| 240 | CALL iom_rstput( iter, nitrst, numriw, znam , z2d ) |
---|
[8540] | 241 | znam = 'syysal'//'_htc'//TRIM(ADJUSTL(zchar)) |
---|
[835] | 242 | z2d(:,:) = syysal(:,:,jl) |
---|
| 243 | CALL iom_rstput( iter, nitrst, numriw, znam , z2d ) |
---|
[8540] | 244 | znam = 'sxysal'//'_htc'//TRIM(ADJUSTL(zchar)) |
---|
[835] | 245 | z2d(:,:) = sxysal(:,:,jl) |
---|
| 246 | CALL iom_rstput( iter, nitrst, numriw, znam , z2d ) |
---|
[8540] | 247 | znam = 'sxage'//'_htc'//TRIM(ADJUSTL(zchar)) |
---|
[835] | 248 | z2d(:,:) = sxage(:,:,jl) |
---|
| 249 | CALL iom_rstput( iter, nitrst, numriw, znam , z2d ) |
---|
[8540] | 250 | znam = 'syage'//'_htc'//TRIM(ADJUSTL(zchar)) |
---|
[835] | 251 | z2d(:,:) = syage(:,:,jl) |
---|
| 252 | CALL iom_rstput( iter, nitrst, numriw, znam , z2d ) |
---|
[8540] | 253 | znam = 'sxxage'//'_htc'//TRIM(ADJUSTL(zchar)) |
---|
[835] | 254 | z2d(:,:) = sxxage(:,:,jl) |
---|
| 255 | CALL iom_rstput( iter, nitrst, numriw, znam , z2d ) |
---|
[8540] | 256 | znam = 'syyage'//'_htc'//TRIM(ADJUSTL(zchar)) |
---|
[835] | 257 | z2d(:,:) = syyage(:,:,jl) |
---|
| 258 | CALL iom_rstput( iter, nitrst, numriw, znam , z2d ) |
---|
[8540] | 259 | znam = 'sxyage'//'_htc'//TRIM(ADJUSTL(zchar)) |
---|
[835] | 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 |
---|
[8540] | 271 | WRITE(zchar,'(I2)') jl |
---|
[835] | 272 | DO jk = 1, nlay_i |
---|
[8540] | 273 | WRITE(zchar1,'(I2)') jk |
---|
| 274 | znam = 'sxe'//'_il'//TRIM(ADJUSTL(zchar1))//'_htc'//TRIM(ADJUSTL(zchar)) |
---|
[835] | 275 | z2d(:,:) = sxe(:,:,jk,jl) |
---|
| 276 | CALL iom_rstput( iter, nitrst, numriw, znam , z2d ) |
---|
[8540] | 277 | znam = 'sye'//'_il'//TRIM(ADJUSTL(zchar1))//'_htc'//TRIM(ADJUSTL(zchar)) |
---|
[838] | 278 | z2d(:,:) = sye(:,:,jk,jl) |
---|
| 279 | CALL iom_rstput( iter, nitrst, numriw, znam , z2d ) |
---|
[8540] | 280 | znam = 'sxxe'//'_il'//TRIM(ADJUSTL(zchar1))//'_htc'//TRIM(ADJUSTL(zchar)) |
---|
[835] | 281 | z2d(:,:) = sxxe(:,:,jk,jl) |
---|
| 282 | CALL iom_rstput( iter, nitrst, numriw, znam , z2d ) |
---|
[8540] | 283 | znam = 'syye'//'_il'//TRIM(ADJUSTL(zchar1))//'_htc'//TRIM(ADJUSTL(zchar)) |
---|
[835] | 284 | z2d(:,:) = syye(:,:,jk,jl) |
---|
| 285 | CALL iom_rstput( iter, nitrst, numriw, znam , z2d ) |
---|
[8540] | 286 | znam = 'sxye'//'_il'//TRIM(ADJUSTL(zchar1))//'_htc'//TRIM(ADJUSTL(zchar)) |
---|
[835] | 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 | ! |
---|
[3294] | 297 | CALL wrk_dealloc( jpi, jpj, z2d ) |
---|
[2715] | 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 | !!---------------------------------------------------------------------- |
---|
[5128] | 308 | INTEGER :: ji, jj, jk, jl |
---|
[835] | 309 | REAL(wp) :: zfice, ziter |
---|
[3294] | 310 | REAL(wp), POINTER, DIMENSION(:,:) :: z2d |
---|
[2528] | 311 | CHARACTER(len=15) :: znam |
---|
[8540] | 312 | CHARACTER(len=2) :: zchar, zchar1 |
---|
[2528] | 313 | INTEGER :: jlibalt = jprstlib |
---|
| 314 | LOGICAL :: llok |
---|
[835] | 315 | !!---------------------------------------------------------------------- |
---|
[921] | 316 | |
---|
[3294] | 317 | CALL wrk_alloc( jpi, jpj, z2d ) |
---|
[2715] | 318 | |
---|
[825] | 319 | IF(lwp) THEN |
---|
| 320 | WRITE(numout,*) |
---|
[835] | 321 | WRITE(numout,*) 'lim_rst_read : read ice NetCDF restart file' |
---|
[2715] | 322 | WRITE(numout,*) '~~~~~~~~~~~~~' |
---|
[825] | 323 | ENDIF |
---|
| 324 | |
---|
[1473] | 325 | IF ( jprstlib == jprstdimg ) THEN |
---|
| 326 | ! eventually read netcdf file (monobloc) for restarting on different number of processors |
---|
| 327 | ! if {cn_icerst_in}.nc exists, then set jlibalt to jpnf90 |
---|
[5341] | 328 | INQUIRE( FILE = TRIM(cn_icerst_indir)//'/'//TRIM(cn_icerst_in)//'.nc', EXIST = llok ) |
---|
[1473] | 329 | IF ( llok ) THEN ; jlibalt = jpnf90 ; ELSE ; jlibalt = jprstlib ; ENDIF |
---|
| 330 | ENDIF |
---|
| 331 | |
---|
[5341] | 332 | CALL iom_open ( TRIM(cn_icerst_indir)//'/'//cn_icerst_in, numrir, kiolib = jprstlib ) |
---|
[835] | 333 | |
---|
[888] | 334 | CALL iom_get( numrir, 'nn_fsbc', zfice ) |
---|
| 335 | CALL iom_get( numrir, 'kt_ice' , ziter ) |
---|
[835] | 336 | IF(lwp) WRITE(numout,*) ' read ice restart file at time step : ', ziter |
---|
| 337 | IF(lwp) WRITE(numout,*) ' in any case we force it to nit000 - 1 : ', nit000 - 1 |
---|
| 338 | |
---|
[825] | 339 | !Control of date |
---|
[921] | 340 | |
---|
[4161] | 341 | IF( ( nit000 - NINT(ziter) ) /= 1 .AND. ABS( nrstdt ) == 1 ) & |
---|
[835] | 342 | & CALL ctl_stop( 'lim_rst_read ===>>>> : problem with nit000 in ice restart', & |
---|
| 343 | & ' verify the file or rerun with the value 0 for the', & |
---|
| 344 | & ' control of time parameter nrstdt' ) |
---|
[4161] | 345 | IF( NINT(zfice) /= nn_fsbc .AND. ABS( nrstdt ) == 1 ) & |
---|
[888] | 346 | & CALL ctl_stop( 'lim_rst_read ===>>>> : problem with nn_fsbc in ice restart', & |
---|
| 347 | & ' verify the file or rerun with the value 0 for the', & |
---|
[835] | 348 | & ' control of time parameter nrstdt' ) |
---|
[825] | 349 | |
---|
[8540] | 350 | ! Prognostic variables |
---|
[835] | 351 | DO jl = 1, jpl |
---|
[8540] | 352 | WRITE(zchar,'(I2)') jl |
---|
| 353 | znam = 'v_i'//'_htc'//TRIM(ADJUSTL(zchar)) |
---|
[835] | 354 | CALL iom_get( numrir, jpdom_autoglo, znam , z2d ) |
---|
| 355 | v_i(:,:,jl) = z2d(:,:) |
---|
[8540] | 356 | znam = 'v_s'//'_htc'//TRIM(ADJUSTL(zchar)) |
---|
[835] | 357 | CALL iom_get( numrir, jpdom_autoglo, znam , z2d ) |
---|
| 358 | v_s(:,:,jl) = z2d(:,:) |
---|
[8540] | 359 | znam = 'smv_i'//'_htc'//TRIM(ADJUSTL(zchar)) |
---|
[835] | 360 | CALL iom_get( numrir, jpdom_autoglo, znam , z2d ) |
---|
| 361 | smv_i(:,:,jl) = z2d(:,:) |
---|
[8540] | 362 | znam = 'oa_i'//'_htc'//TRIM(ADJUSTL(zchar)) |
---|
[835] | 363 | CALL iom_get( numrir, jpdom_autoglo, znam , z2d ) |
---|
| 364 | oa_i(:,:,jl) = z2d(:,:) |
---|
[8540] | 365 | znam = 'a_i'//'_htc'//TRIM(ADJUSTL(zchar)) |
---|
[835] | 366 | CALL iom_get( numrir, jpdom_autoglo, znam , z2d ) |
---|
| 367 | a_i(:,:,jl) = z2d(:,:) |
---|
[8540] | 368 | znam = 't_su'//'_htc'//TRIM(ADJUSTL(zchar)) |
---|
[835] | 369 | CALL iom_get( numrir, jpdom_autoglo, znam , z2d ) |
---|
| 370 | t_su(:,:,jl) = z2d(:,:) |
---|
[8540] | 371 | znam = 'tempt_sl1'//'_htc'//TRIM(ADJUSTL(zchar)) |
---|
[835] | 372 | CALL iom_get( numrir, jpdom_autoglo, znam , z2d ) |
---|
| 373 | e_s(:,:,1,jl) = z2d(:,:) |
---|
| 374 | DO jk = 1, nlay_i |
---|
[8540] | 375 | WRITE(zchar1,'(I2)') jk |
---|
| 376 | znam = 'tempt'//'_il'//TRIM(ADJUSTL(zchar1))//'_htc'//TRIM(ADJUSTL(zchar)) |
---|
[835] | 377 | CALL iom_get( numrir, jpdom_autoglo, znam , z2d ) |
---|
| 378 | e_i(:,:,jk,jl) = z2d(:,:) |
---|
| 379 | END DO |
---|
| 380 | END DO |
---|
[825] | 381 | |
---|
[835] | 382 | CALL iom_get( numrir, jpdom_autoglo, 'u_ice' , u_ice ) |
---|
| 383 | CALL iom_get( numrir, jpdom_autoglo, 'v_ice' , v_ice ) |
---|
| 384 | CALL iom_get( numrir, jpdom_autoglo, 'stress1_i' , stress1_i ) |
---|
| 385 | CALL iom_get( numrir, jpdom_autoglo, 'stress2_i' , stress2_i ) |
---|
| 386 | CALL iom_get( numrir, jpdom_autoglo, 'stress12_i', stress12_i ) |
---|
[5123] | 387 | CALL iom_get( numrir, jpdom_autoglo, 'snwice_mass' , snwice_mass ) |
---|
| 388 | CALL iom_get( numrir, jpdom_autoglo, 'snwice_mass_b', snwice_mass_b ) |
---|
[825] | 389 | |
---|
[835] | 390 | DO jl = 1, jpl |
---|
[8540] | 391 | WRITE(zchar,'(I2)') jl |
---|
| 392 | znam = 'sxice'//'_htc'//TRIM(ADJUSTL(zchar)) |
---|
[835] | 393 | CALL iom_get( numrir, jpdom_autoglo, znam , z2d ) |
---|
| 394 | sxice(:,:,jl) = z2d(:,:) |
---|
[8540] | 395 | znam = 'syice'//'_htc'//TRIM(ADJUSTL(zchar)) |
---|
[835] | 396 | CALL iom_get( numrir, jpdom_autoglo, znam , z2d ) |
---|
| 397 | syice(:,:,jl) = z2d(:,:) |
---|
[8540] | 398 | znam = 'sxxice'//'_htc'//TRIM(ADJUSTL(zchar)) |
---|
[835] | 399 | CALL iom_get( numrir, jpdom_autoglo, znam , z2d ) |
---|
| 400 | sxxice(:,:,jl) = z2d(:,:) |
---|
[8540] | 401 | znam = 'syyice'//'_htc'//TRIM(ADJUSTL(zchar)) |
---|
[835] | 402 | CALL iom_get( numrir, jpdom_autoglo, znam , z2d ) |
---|
| 403 | syyice(:,:,jl) = z2d(:,:) |
---|
[8540] | 404 | znam = 'sxyice'//'_htc'//TRIM(ADJUSTL(zchar)) |
---|
[838] | 405 | CALL iom_get( numrir, jpdom_autoglo, znam , z2d ) |
---|
| 406 | sxyice(:,:,jl) = z2d(:,:) |
---|
[8540] | 407 | znam = 'sxsn'//'_htc'//TRIM(ADJUSTL(zchar)) |
---|
[835] | 408 | CALL iom_get( numrir, jpdom_autoglo, znam , z2d ) |
---|
| 409 | sxsn(:,:,jl) = z2d(:,:) |
---|
[8540] | 410 | znam = 'sysn'//'_htc'//TRIM(ADJUSTL(zchar)) |
---|
[835] | 411 | CALL iom_get( numrir, jpdom_autoglo, znam , z2d ) |
---|
| 412 | sysn(:,:,jl) = z2d(:,:) |
---|
[8540] | 413 | znam = 'sxxsn'//'_htc'//TRIM(ADJUSTL(zchar)) |
---|
[835] | 414 | CALL iom_get( numrir, jpdom_autoglo, znam , z2d ) |
---|
| 415 | sxxsn(:,:,jl) = z2d(:,:) |
---|
[8540] | 416 | znam = 'syysn'//'_htc'//TRIM(ADJUSTL(zchar)) |
---|
[835] | 417 | CALL iom_get( numrir, jpdom_autoglo, znam , z2d ) |
---|
| 418 | syysn(:,:,jl) = z2d(:,:) |
---|
[8540] | 419 | znam = 'sxysn'//'_htc'//TRIM(ADJUSTL(zchar)) |
---|
[835] | 420 | CALL iom_get( numrir, jpdom_autoglo, znam , z2d ) |
---|
| 421 | sxysn(:,:,jl) = z2d(:,:) |
---|
[8540] | 422 | znam = 'sxa'//'_htc'//TRIM(ADJUSTL(zchar)) |
---|
[835] | 423 | CALL iom_get( numrir, jpdom_autoglo, znam , z2d ) |
---|
| 424 | sxa(:,:,jl) = z2d(:,:) |
---|
[8540] | 425 | znam = 'sya'//'_htc'//TRIM(ADJUSTL(zchar)) |
---|
[835] | 426 | CALL iom_get( numrir, jpdom_autoglo, znam , z2d ) |
---|
| 427 | sya(:,:,jl) = z2d(:,:) |
---|
[8540] | 428 | znam = 'sxxa'//'_htc'//TRIM(ADJUSTL(zchar)) |
---|
[835] | 429 | CALL iom_get( numrir, jpdom_autoglo, znam , z2d ) |
---|
| 430 | sxxa(:,:,jl) = z2d(:,:) |
---|
[8540] | 431 | znam = 'syya'//'_htc'//TRIM(ADJUSTL(zchar)) |
---|
[835] | 432 | CALL iom_get( numrir, jpdom_autoglo, znam , z2d ) |
---|
| 433 | syya(:,:,jl) = z2d(:,:) |
---|
[8540] | 434 | znam = 'sxya'//'_htc'//TRIM(ADJUSTL(zchar)) |
---|
[835] | 435 | CALL iom_get( numrir, jpdom_autoglo, znam , z2d ) |
---|
| 436 | sxya(:,:,jl) = z2d(:,:) |
---|
[8540] | 437 | znam = 'sxc0'//'_htc'//TRIM(ADJUSTL(zchar)) |
---|
[835] | 438 | CALL iom_get( numrir, jpdom_autoglo, znam , z2d ) |
---|
| 439 | sxc0(:,:,jl) = z2d(:,:) |
---|
[8540] | 440 | znam = 'syc0'//'_htc'//TRIM(ADJUSTL(zchar)) |
---|
[835] | 441 | CALL iom_get( numrir, jpdom_autoglo, znam , z2d ) |
---|
| 442 | syc0(:,:,jl) = z2d(:,:) |
---|
[8540] | 443 | znam = 'sxxc0'//'_htc'//TRIM(ADJUSTL(zchar)) |
---|
[835] | 444 | CALL iom_get( numrir, jpdom_autoglo, znam , z2d ) |
---|
| 445 | sxxc0(:,:,jl) = z2d(:,:) |
---|
[8540] | 446 | znam = 'syyc0'//'_htc'//TRIM(ADJUSTL(zchar)) |
---|
[835] | 447 | CALL iom_get( numrir, jpdom_autoglo, znam , z2d ) |
---|
| 448 | syyc0(:,:,jl) = z2d(:,:) |
---|
[8540] | 449 | znam = 'sxyc0'//'_htc'//TRIM(ADJUSTL(zchar)) |
---|
[835] | 450 | CALL iom_get( numrir, jpdom_autoglo, znam , z2d ) |
---|
| 451 | sxyc0(:,:,jl) = z2d(:,:) |
---|
[8540] | 452 | znam = 'sxsal'//'_htc'//TRIM(ADJUSTL(zchar)) |
---|
[835] | 453 | CALL iom_get( numrir, jpdom_autoglo, znam , z2d ) |
---|
| 454 | sxsal(:,:,jl) = z2d(:,:) |
---|
[8540] | 455 | znam = 'sysal'//'_htc'//TRIM(ADJUSTL(zchar)) |
---|
[835] | 456 | CALL iom_get( numrir, jpdom_autoglo, znam , z2d ) |
---|
| 457 | sysal(:,:,jl) = z2d(:,:) |
---|
[8540] | 458 | znam = 'sxxsal'//'_htc'//TRIM(ADJUSTL(zchar)) |
---|
[835] | 459 | CALL iom_get( numrir, jpdom_autoglo, znam , z2d ) |
---|
| 460 | sxxsal(:,:,jl) = z2d(:,:) |
---|
[8540] | 461 | znam = 'syysal'//'_htc'//TRIM(ADJUSTL(zchar)) |
---|
[835] | 462 | CALL iom_get( numrir, jpdom_autoglo, znam , z2d ) |
---|
| 463 | syysal(:,:,jl) = z2d(:,:) |
---|
[8540] | 464 | znam = 'sxysal'//'_htc'//TRIM(ADJUSTL(zchar)) |
---|
[835] | 465 | CALL iom_get( numrir, jpdom_autoglo, znam , z2d ) |
---|
| 466 | sxysal(:,:,jl) = z2d(:,:) |
---|
[8540] | 467 | znam = 'sxage'//'_htc'//TRIM(ADJUSTL(zchar)) |
---|
[835] | 468 | CALL iom_get( numrir, jpdom_autoglo, znam , z2d ) |
---|
| 469 | sxage(:,:,jl) = z2d(:,:) |
---|
[8540] | 470 | znam = 'syage'//'_htc'//TRIM(ADJUSTL(zchar)) |
---|
[835] | 471 | CALL iom_get( numrir, jpdom_autoglo, znam , z2d ) |
---|
| 472 | syage(:,:,jl) = z2d(:,:) |
---|
[8540] | 473 | znam = 'sxxage'//'_htc'//TRIM(ADJUSTL(zchar)) |
---|
[835] | 474 | CALL iom_get( numrir, jpdom_autoglo, znam , z2d ) |
---|
| 475 | sxxage(:,:,jl) = z2d(:,:) |
---|
[8540] | 476 | znam = 'syyage'//'_htc'//TRIM(ADJUSTL(zchar)) |
---|
[835] | 477 | CALL iom_get( numrir, jpdom_autoglo, znam , z2d ) |
---|
| 478 | syyage(:,:,jl) = z2d(:,:) |
---|
[8540] | 479 | znam = 'sxyage'//'_htc'//TRIM(ADJUSTL(zchar)) |
---|
[835] | 480 | CALL iom_get( numrir, jpdom_autoglo, znam , z2d ) |
---|
| 481 | sxyage(:,:,jl)= z2d(:,:) |
---|
| 482 | END DO |
---|
[825] | 483 | |
---|
[835] | 484 | CALL iom_get( numrir, jpdom_autoglo, 'sxopw ' , sxopw ) |
---|
| 485 | CALL iom_get( numrir, jpdom_autoglo, 'syopw ' , syopw ) |
---|
| 486 | CALL iom_get( numrir, jpdom_autoglo, 'sxxopw' , sxxopw ) |
---|
| 487 | CALL iom_get( numrir, jpdom_autoglo, 'syyopw' , syyopw ) |
---|
| 488 | CALL iom_get( numrir, jpdom_autoglo, 'sxyopw' , sxyopw ) |
---|
[825] | 489 | |
---|
[835] | 490 | DO jl = 1, jpl |
---|
[8540] | 491 | WRITE(zchar,'(I2)') jl |
---|
[835] | 492 | DO jk = 1, nlay_i |
---|
[8540] | 493 | WRITE(zchar1,'(I2)') jk |
---|
| 494 | znam = 'sxe'//'_il'//TRIM(ADJUSTL(zchar1))//'_htc'//TRIM(ADJUSTL(zchar)) |
---|
[835] | 495 | CALL iom_get( numrir, jpdom_autoglo, znam , z2d ) |
---|
| 496 | sxe(:,:,jk,jl) = z2d(:,:) |
---|
[8540] | 497 | znam = 'sye'//'_il'//TRIM(ADJUSTL(zchar1))//'_htc'//TRIM(ADJUSTL(zchar)) |
---|
[838] | 498 | CALL iom_get( numrir, jpdom_autoglo, znam , z2d ) |
---|
| 499 | sye(:,:,jk,jl) = z2d(:,:) |
---|
[8540] | 500 | znam = 'sxxe'//'_il'//TRIM(ADJUSTL(zchar1))//'_htc'//TRIM(ADJUSTL(zchar)) |
---|
[835] | 501 | CALL iom_get( numrir, jpdom_autoglo, znam , z2d ) |
---|
| 502 | sxxe(:,:,jk,jl) = z2d(:,:) |
---|
[8540] | 503 | znam = 'syye'//'_il'//TRIM(ADJUSTL(zchar1))//'_htc'//TRIM(ADJUSTL(zchar)) |
---|
[835] | 504 | CALL iom_get( numrir, jpdom_autoglo, znam , z2d ) |
---|
| 505 | syye(:,:,jk,jl) = z2d(:,:) |
---|
[8540] | 506 | znam = 'sxye'//'_il'//TRIM(ADJUSTL(zchar1))//'_htc'//TRIM(ADJUSTL(zchar)) |
---|
[835] | 507 | CALL iom_get( numrir, jpdom_autoglo, znam , z2d ) |
---|
| 508 | sxye(:,:,jk,jl) = z2d(:,:) |
---|
| 509 | END DO |
---|
| 510 | END DO |
---|
[2528] | 511 | ! |
---|
[4688] | 512 | ! clem: I do not understand why the following IF is needed |
---|
[5123] | 513 | ! I suspect something inconsistent in the main code with option nn_icesal=1 |
---|
| 514 | IF( nn_icesal == 1 ) THEN |
---|
[4688] | 515 | DO jl = 1, jpl |
---|
[5123] | 516 | sm_i(:,:,jl) = rn_icesal |
---|
[4688] | 517 | DO jk = 1, nlay_i |
---|
[5123] | 518 | s_i(:,:,jk,jl) = rn_icesal |
---|
[4688] | 519 | END DO |
---|
| 520 | END DO |
---|
| 521 | ENDIF |
---|
| 522 | ! |
---|
[4205] | 523 | !CALL iom_close( numrir ) !clem: closed in sbcice_lim.F90 |
---|
[2528] | 524 | ! |
---|
[3294] | 525 | CALL wrk_dealloc( jpi, jpj, z2d ) |
---|
[2715] | 526 | ! |
---|
[921] | 527 | END SUBROUTINE lim_rst_read |
---|
| 528 | |
---|
[825] | 529 | #else |
---|
| 530 | !!---------------------------------------------------------------------- |
---|
| 531 | !! Default option : Empty module NO LIM sea-ice model |
---|
| 532 | !!---------------------------------------------------------------------- |
---|
| 533 | CONTAINS |
---|
| 534 | SUBROUTINE lim_rst_read ! Empty routine |
---|
| 535 | END SUBROUTINE lim_rst_read |
---|
| 536 | SUBROUTINE lim_rst_write ! Empty routine |
---|
| 537 | END SUBROUTINE lim_rst_write |
---|
| 538 | #endif |
---|
| 539 | |
---|
| 540 | !!====================================================================== |
---|
| 541 | END MODULE limrst |
---|