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