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