limrst.F90 25 KB

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