New URL for NEMO forge!   http://forge.nemo-ocean.eu

Since March 2022 along with NEMO 4.2 release, the code development moved to a self-hosted GitLab.
This present forge is now archived and remained online for history.
limrst.F90 in branches/2017/dev_r8183_ICEMODEL/NEMOGCM/NEMO/LIM_SRC_3 – NEMO

source: branches/2017/dev_r8183_ICEMODEL/NEMOGCM/NEMO/LIM_SRC_3/limrst.F90 @ 8411

Last change on this file since 8411 was 8411, checked in by clem, 7 years ago

continue changing names

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