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 trunk/NEMO/LIM_SRC_3 – NEMO

source: trunk/NEMO/LIM_SRC_3/limrst.F90 @ 838

Last change on this file since 838 was 838, checked in by ctlod, 16 years ago

Add sxyice(:,:,:) and sye(:,:,:,:) missing fields in sea-ice restart files to ensure the restartability, see ticket:#75

File size: 32.6 KB
Line 
1MODULE limrst
2   !!======================================================================
3   !!                     ***  MODULE  limrst  ***
4   !! Ice restart :  write the ice restart file
5   !!======================================================================
6#if defined key_lim3
7   !!----------------------------------------------------------------------
8   !!   'key_lim3' :                                   LIM sea-ice model
9   !!----------------------------------------------------------------------
10   !!   lim_rst_opn     : open ice restart file
11   !!   lim_rst_write   : write of the restart file
12   !!   lim_rst_read    : read  the restart file
13   !!----------------------------------------------------------------------
14   !! * Modules used
15   USE ice
16   USE par_ice
17   USE in_out_manager
18   USE dom_oce
19   USE ice_oce         ! ice variables
20   USE daymod
21   USE iom
22   
23   IMPLICIT NONE
24   PRIVATE
25   
26   !! * Accessibility
27   PUBLIC lim_rst_opn    ! routine called by icestep.F90
28   PUBLIC lim_rst_write  ! routine called by icestep.F90
29   PUBLIC lim_rst_read   ! routine called by iceinit.F90
30
31   LOGICAL, PUBLIC ::   lrst_ice         !: logical to control the ice restart write
32   INTEGER, PUBLIC ::   numrir, numriw   !: logical unit for ice restart (read and write)
33
34   !!----------------------------------------------------------------------
35   !!   LIM 2.0,  UCL-LOCEAN-IPSL (2005)
36   !! $Id:$
37   !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt)
38   !!----------------------------------------------------------------------
39
40CONTAINS
41
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 deine as a character
51      CHARACTER(LEN=50)   ::   clname   ! ice output restart file name
52      !!----------------------------------------------------------------------
53      !
54      IF( kt == nit000 )   lrst_ice = .FALSE.   ! default definition
55     
56      ! to get better performances with NetCDF format:
57      ! we open and define the ice restart file one ice time step before writing the data (-> at nitrst - 2*nfice + 1)
58      ! except if we write ice restart files every ice time step or if an ice restart file was writen at nitend - 2*nfice + 1
59      IF( kt == nitrst - 2*nfice + 1 .OR. nstock == nfice .OR. ( kt == nitend - nfice + 1 .AND. .NOT. lrst_ice ) ) THEN
60         ! beware of the format used to write kt (default is i8.8, that should be large enough...)
61         IF( nitrst > 99999999 ) THEN   ;   WRITE(clkt, *       ) nitrst
62         ELSE                           ;   WRITE(clkt, '(i8.8)') nitrst
63         ENDIF
64         ! create the file
65         clname = TRIM(cexper)//"_"//TRIM(ADJUSTL(clkt))//"_restart_ice"
66         IF(lwp) THEN
67            WRITE(numout,*)
68            SELECT CASE ( jprstlib )
69            CASE ( jprstdimg )   ;   WRITE(numout,*) '             open ice restart binary file: '//clname
70            CASE DEFAULT         ;   WRITE(numout,*) '             open ice restart NetCDF file: '//clname
71            END SELECT
72            IF( kt == nitrst - 2*nfice + 1 ) THEN   
73               WRITE(numout,*)         '             kt = nitrst - 2*nfice + 1 = ', kt,' date= ', ndastp
74            ELSE   ;   WRITE(numout,*) '             kt = '                       , kt,' date= ', ndastp
75            ENDIF
76         ENDIF
77
78         CALL iom_open( clname, numriw, ldwrt = .TRUE., kiolib = jprstlib )
79         lrst_ice = .TRUE.
80      ENDIF
81      !
82   END SUBROUTINE lim_rst_opn
83
84   SUBROUTINE lim_rst_write( kt )
85      !!----------------------------------------------------------------------
86      !!                    ***  lim_rst_write  ***
87      !!
88      !! ** purpose  :   output of sea-ice variable in a netcdf file
89      !!
90      !!----------------------------------------------------------------------
91      ! Arguments :
92      INTEGER, INTENT(in) ::   kt     ! number of iteration
93
94      ! Local variables :
95      REAL(wp), DIMENSION(jpi,jpj) :: z2d
96      INTEGER :: ji, jj, jk ,jl
97      INTEGER :: iter
98      CHARACTER(len=15) :: znam
99      CHARACTER(len=1)  :: zchar, zchar1
100      !!----------------------------------------------------------------------
101   
102      iter = kt + nfice - 1   ! ice restarts are written at kt == nitrst - nfice + 1
103
104      IF( iter == nitrst ) THEN
105         IF(lwp) WRITE(numout,*)
106         IF(lwp) WRITE(numout,*) 'lim_rst_write : write ice restart file  kt =', kt
107         IF(lwp) WRITE(numout,*) '~~~~~~~~~~~~~~'         
108      ENDIF
109
110      ! Write in numriw (if iter == nitrst)
111      ! ------------------
112      !                                                                        ! calendar control
113      CALL iom_rstput( iter, nitrst, numriw, 'nfice' , REAL( nfice, wp) )      ! time-step
114      CALL iom_rstput( iter, nitrst, numriw, 'kt_ice', REAL( iter , wp) )      ! date
115
116      ! Prognostic variables
117      DO jl = 1, jpl 
118         WRITE(zchar,'(I1)') jl
119         znam = 'v_i'//'_htc'//zchar
120         z2d(:,:) = v_i(:,:,jl)
121         CALL iom_rstput( iter, nitrst, numriw, znam , z2d )
122         znam = 'v_s'//'_htc'//zchar
123         z2d(:,:) = v_s(:,:,jl)
124         CALL iom_rstput( iter, nitrst, numriw, znam , z2d )
125         znam = 'smv_i'//'_htc'//zchar
126         z2d(:,:) = smv_i(:,:,jl)
127         CALL iom_rstput( iter, nitrst, numriw, znam , z2d )
128         znam = 'oa_i'//'_htc'//zchar
129         z2d(:,:) = oa_i(:,:,jl)
130         CALL iom_rstput( iter, nitrst, numriw, znam , z2d )
131         znam = 'a_i'//'_htc'//zchar
132         z2d(:,:) = a_i(:,:,jl)
133         CALL iom_rstput( iter, nitrst, numriw, znam , z2d )
134         znam = 't_su'//'_htc'//zchar
135         z2d(:,:) = t_su(:,:,jl)
136         CALL iom_rstput( iter, nitrst, numriw, znam , z2d )
137      END DO
138# if defined key_coupled
139      CALL iom_rstput( iter, nitrst, numriw, 'albege', albege(:,:) )
140# endif
141      DO jl = 1, jpl 
142         WRITE(zchar,'(I1)') jl
143         znam = 'tempt_sl1'//'_htc'//zchar
144         z2d(:,:) = e_s(:,:,1,jl)
145         CALL iom_rstput( iter, nitrst, numriw, znam , z2d )
146      END DO
147
148      DO jl = 1, jpl 
149         WRITE(zchar,'(I1)') jl
150         DO jk = 1, nlay_i 
151            WRITE(zchar1,'(I1)') jk
152            znam = 'tempt'//'_il'//zchar1//'_htc'//zchar
153            z2d(:,:) = e_i(:,:,jk,jl)
154            CALL iom_rstput( iter, nitrst, numriw, znam , z2d )
155         END DO
156      END DO
157
158      CALL iom_rstput( iter, nitrst, numriw, 'u_ice'     , u_ice      )
159      CALL iom_rstput( iter, nitrst, numriw, 'v_ice'     , v_ice      )
160      CALL iom_rstput( iter, nitrst, numriw, 'gtaux'     , gtaux      )
161      CALL iom_rstput( iter, nitrst, numriw, 'gtauy'     , gtauy      )
162      CALL iom_rstput( iter, nitrst, numriw, 'fsbbq'     , fsbbq      )
163      CALL iom_rstput( iter, nitrst, numriw, 'stress1_i' , stress1_i  )
164      CALL iom_rstput( iter, nitrst, numriw, 'stress2_i' , stress2_i  )
165      CALL iom_rstput( iter, nitrst, numriw, 'stress12_i', stress12_i )
166
167      DO jl = 1, jpl 
168         WRITE(zchar,'(I1)') jl
169         znam = 'sxice'//'_htc'//zchar
170         z2d(:,:) = sxice(:,:,jl)
171         CALL iom_rstput( iter, nitrst, numriw, znam , z2d )
172         znam = 'syice'//'_htc'//zchar
173         z2d(:,:) = syice(:,:,jl)
174         CALL iom_rstput( iter, nitrst, numriw, znam , z2d )
175         znam = 'sxxice'//'_htc'//zchar
176         z2d(:,:) = sxxice(:,:,jl)
177         CALL iom_rstput( iter, nitrst, numriw, znam , z2d )
178         znam = 'syyice'//'_htc'//zchar
179         z2d(:,:) = syyice(:,:,jl)
180         CALL iom_rstput( iter, nitrst, numriw, znam , z2d )
181         znam = 'sxyice'//'_htc'//zchar
182         z2d(:,:) = sxyice(:,:,jl)
183         CALL iom_rstput( iter, nitrst, numriw, znam , z2d )
184         znam = 'sxsn'//'_htc'//zchar
185         z2d(:,:) = sxsn(:,:,jl)
186         CALL iom_rstput( iter, nitrst, numriw, znam , z2d )
187         znam = 'sysn'//'_htc'//zchar
188         z2d(:,:) = sysn(:,:,jl)
189         CALL iom_rstput( iter, nitrst, numriw, znam , z2d )
190         znam = 'sxxsn'//'_htc'//zchar
191         z2d(:,:) = sxxsn(:,:,jl)
192         CALL iom_rstput( iter, nitrst, numriw, znam , z2d )
193         znam = 'syysn'//'_htc'//zchar
194         z2d(:,:) = syysn(:,:,jl)
195         CALL iom_rstput( iter, nitrst, numriw, znam , z2d )
196         znam = 'sxysn'//'_htc'//zchar
197         z2d(:,:) = sxysn(:,:,jl)
198         CALL iom_rstput( iter, nitrst, numriw, znam , z2d )
199         znam = 'sxa'//'_htc'//zchar
200         z2d(:,:) = sxa(:,:,jl)
201         CALL iom_rstput( iter, nitrst, numriw, znam , z2d )
202         znam = 'sya'//'_htc'//zchar
203         z2d(:,:) = sya(:,:,jl)
204         CALL iom_rstput( iter, nitrst, numriw, znam , z2d )
205         znam = 'sxxa'//'_htc'//zchar
206         z2d(:,:) = sxxa(:,:,jl)
207         CALL iom_rstput( iter, nitrst, numriw, znam , z2d )
208         znam = 'syya'//'_htc'//zchar
209         z2d(:,:) = syya(:,:,jl)
210         CALL iom_rstput( iter, nitrst, numriw, znam , z2d )
211         znam = 'sxya'//'_htc'//zchar
212         z2d(:,:) = sxya(:,:,jl)
213         CALL iom_rstput( iter, nitrst, numriw, znam , z2d )
214         znam = 'sxc0'//'_htc'//zchar
215         z2d(:,:) = sxc0(:,:,jl)
216         CALL iom_rstput( iter, nitrst, numriw, znam , z2d )
217         znam = 'syc0'//'_htc'//zchar
218         z2d(:,:) = syc0(:,:,jl)
219         CALL iom_rstput( iter, nitrst, numriw, znam , z2d )
220         znam = 'sxxc0'//'_htc'//zchar
221         z2d(:,:) = sxxc0(:,:,jl)
222         CALL iom_rstput( iter, nitrst, numriw, znam , z2d )
223         znam = 'syyc0'//'_htc'//zchar
224         z2d(:,:) = syyc0(:,:,jl)
225         CALL iom_rstput( iter, nitrst, numriw, znam , z2d )
226         znam = 'sxyc0'//'_htc'//zchar
227         z2d(:,:) = sxyc0(:,:,jl)
228         CALL iom_rstput( iter, nitrst, numriw, znam , z2d )
229         znam = 'sxsal'//'_htc'//zchar
230         z2d(:,:) = sxsal(:,:,jl)
231         CALL iom_rstput( iter, nitrst, numriw, znam , z2d )
232         znam = 'sysal'//'_htc'//zchar
233         z2d(:,:) = sysal(:,:,jl)
234         CALL iom_rstput( iter, nitrst, numriw, znam , z2d )
235         znam = 'sxxsal'//'_htc'//zchar
236         z2d(:,:) = sxxsal(:,:,jl)
237         CALL iom_rstput( iter, nitrst, numriw, znam , z2d )
238         znam = 'syysal'//'_htc'//zchar
239         z2d(:,:) = syysal(:,:,jl)
240         CALL iom_rstput( iter, nitrst, numriw, znam , z2d )
241         znam = 'sxysal'//'_htc'//zchar
242         z2d(:,:) = sxysal(:,:,jl)
243         CALL iom_rstput( iter, nitrst, numriw, znam , z2d )
244         znam = 'sxage'//'_htc'//zchar
245         z2d(:,:) = sxage(:,:,jl)
246         CALL iom_rstput( iter, nitrst, numriw, znam , z2d )
247         znam = 'syage'//'_htc'//zchar
248         z2d(:,:) = syage(:,:,jl)
249         CALL iom_rstput( iter, nitrst, numriw, znam , z2d )
250         znam = 'sxxage'//'_htc'//zchar
251         z2d(:,:) = sxxage(:,:,jl)
252         CALL iom_rstput( iter, nitrst, numriw, znam , z2d )
253         znam = 'syyage'//'_htc'//zchar
254         z2d(:,:) = syyage(:,:,jl)
255         CALL iom_rstput( iter, nitrst, numriw, znam , z2d )
256         znam = 'sxyage'//'_htc'//zchar
257         z2d(:,:) = sxyage(:,:,jl)
258         CALL iom_rstput( iter, nitrst, numriw, znam , z2d )
259      END DO
260
261      CALL iom_rstput( iter, nitrst, numriw, 'sxopw ' ,  sxopw  )
262      CALL iom_rstput( iter, nitrst, numriw, 'syopw ' ,  syopw  )
263      CALL iom_rstput( iter, nitrst, numriw, 'sxxopw' ,  sxxopw )
264      CALL iom_rstput( iter, nitrst, numriw, 'syyopw' ,  syyopw )
265      CALL iom_rstput( iter, nitrst, numriw, 'sxyopw' ,  sxyopw )
266
267      DO jl = 1, jpl 
268         WRITE(zchar,'(I1)') jl
269         DO jk = 1, nlay_i 
270            WRITE(zchar1,'(I1)') jk
271            znam = 'sxe'//'_il'//zchar1//'_htc'//zchar
272            z2d(:,:) = sxe(:,:,jk,jl)
273            CALL iom_rstput( iter, nitrst, numriw, znam , z2d )
274            znam = 'sye'//'_il'//zchar1//'_htc'//zchar
275            z2d(:,:) = sye(:,:,jk,jl)
276            CALL iom_rstput( iter, nitrst, numriw, znam , z2d )
277            znam = 'sxxe'//'_il'//zchar1//'_htc'//zchar
278            z2d(:,:) = sxxe(:,:,jk,jl)
279            CALL iom_rstput( iter, nitrst, numriw, znam , z2d )
280            znam = 'syye'//'_il'//zchar1//'_htc'//zchar
281            z2d(:,:) = syye(:,:,jk,jl)
282            CALL iom_rstput( iter, nitrst, numriw, znam , z2d )
283            znam = 'sxye'//'_il'//zchar1//'_htc'//zchar
284            z2d(:,:) = sxye(:,:,jk,jl)
285            CALL iom_rstput( iter, nitrst, numriw, znam , z2d )
286         END DO
287      END DO
288
289      IF( iter == nitrst ) THEN
290         CALL iom_close( numriw )                         ! close the restart file
291         lrst_ice = .FALSE.
292      ENDIF
293      !
294   
295   !+++++++++++ CHECK EVERYTHING ++++++++++
296               WRITE(numout,*)
297               WRITE(numout,*) ' lim_rst_write : CHUKCHI SEA POINT '
298               WRITE(numout,*) ' ~~~~~~~~~~'
299               WRITE(numout,*) ' ~~~ Arctic'
300   
301               ji = jiindex
302               jj = jjindex
303   
304               WRITE(numout,*) ' ji, jj ', ji, jj
305               WRITE(numout,*) ' ICE VARIABLES '
306               WRITE(numout,*) ' open water ', ato_i(ji,jj)
307               DO jl = 1, jpl
308                  WRITE(numout,*) ' *** CATEGORY NUMBER *** ', jl
309                  WRITE(numout,*) ' '
310                  WRITE(numout,*) ' a_i        : ', a_i(ji,jj,jl)     
311                  WRITE(numout,*) ' v_i        : ', v_i(ji,jj,jl) 
312                  WRITE(numout,*) ' v_s        : ', v_s(ji,jj,jl)   
313                  WRITE(numout,*) ' e_s        : ', e_s(ji,jj,1,jl)/1.0e9
314                  WRITE(numout,*) ' e_i1       : ', e_i(ji,jj,1,jl)/1.0e9     
315                  WRITE(numout,*) ' e_i2       : ', e_i(ji,jj,2,jl)/1.0e9     
316                  WRITE(numout,*) ' smv_i      : ', smv_i(ji,jj,jl) 
317                  WRITE(numout,*) ' oa_i       : ', oa_i(ji,jj,jl)
318                  WRITE(numout,*) ' t_su       : ', t_su(ji,jj,jl)
319               END DO
320   
321               WRITE(numout,*) ' MOMENTS OF ADVECTION '
322   
323               WRITE(numout,*) ' open water '
324               WRITE(numout,*) ' sxopw  ', sxopw(ji,jj)
325               WRITE(numout,*) ' syopw  ', syopw(ji,jj)
326               WRITE(numout,*) ' sxxopw ', sxxopw(ji,jj)
327               WRITE(numout,*) ' syyopw ', syyopw(ji,jj)
328               WRITE(numout,*) ' sxyopw ', sxyopw(ji,jj)
329               DO jl = 1, jpl
330                  WRITE(numout,*) ' jl, ice volume content ', jl
331                  WRITE(numout,*) ' sxice  ', sxice(ji,jj,jl)
332                  WRITE(numout,*) ' syice  ', syice(ji,jj,jl)
333                  WRITE(numout,*) ' sxxice ', sxxice(ji,jj,jl)
334                  WRITE(numout,*) ' syyice ', syyice(ji,jj,jl)
335                  WRITE(numout,*) ' sxyice ', sxyice(ji,jj,jl)
336                  WRITE(numout,*) ' jl, snow volume content ', jl
337                  WRITE(numout,*) ' sxsn   ', sxsn(ji,jj,jl)
338                  WRITE(numout,*) ' sysn   ', sysn(ji,jj,jl)
339                  WRITE(numout,*) ' sxxsn  ', sxxsn(ji,jj,jl)
340                  WRITE(numout,*) ' syysn  ', syysn(ji,jj,jl)
341                  WRITE(numout,*) ' sxysn  ', sxysn(ji,jj,jl)
342                  WRITE(numout,*) ' jl, ice area in category ', jl
343                  WRITE(numout,*) ' sxa    ', sxa (ji,jj,jl)
344                  WRITE(numout,*) ' sya    ', sya (ji,jj,jl)
345                  WRITE(numout,*) ' sxxa   ', sxxa (ji,jj,jl)
346                  WRITE(numout,*) ' syya   ', syya (ji,jj,jl)
347                  WRITE(numout,*) ' sxya   ', sxya (ji,jj,jl)
348                  WRITE(numout,*) ' jl, snow temp ', jl
349                  WRITE(numout,*) ' sxc0   ', sxc0(ji,jj,jl)
350                  WRITE(numout,*) ' syc0   ', syc0(ji,jj,jl)
351                  WRITE(numout,*) ' sxxc0  ', sxxc0(ji,jj,jl)
352                  WRITE(numout,*) ' syyc0  ', syyc0(ji,jj,jl)
353                  WRITE(numout,*) ' sxyc0  ', sxyc0(ji,jj,jl)
354                  WRITE(numout,*) ' jl, ice salinity ', jl
355                  WRITE(numout,*) ' sxsal  ', sxsal(ji,jj,jl)
356                  WRITE(numout,*) ' sysal  ', sysal(ji,jj,jl)
357                  WRITE(numout,*) ' sxxsal ', sxxsal(ji,jj,jl)
358                  WRITE(numout,*) ' syysal ', syysal(ji,jj,jl)
359                  WRITE(numout,*) ' sxysal ', sxysal(ji,jj,jl)
360                  WRITE(numout,*) ' jl, ice age      ', jl
361                  WRITE(numout,*) ' sxage  ', sxage(ji,jj,jl)
362                  WRITE(numout,*) ' syage  ', syage(ji,jj,jl)
363                  WRITE(numout,*) ' sxxage ', sxxage(ji,jj,jl)
364                  WRITE(numout,*) ' syyage ', syyage(ji,jj,jl)
365                  WRITE(numout,*) ' sxyage ', sxyage(ji,jj,jl)
366               END DO
367               DO jl = 1, jpl
368                  DO jk = 1, nlay_i
369                     WRITE(numout,*) ' jk, jl, ice heat content', jk, jl
370                     WRITE(numout,*) ' sxe    ', sxe(ji,jj,jk,jl)
371                     WRITE(numout,*) ' sye    ', sye(ji,jj,jk,jl)
372                     WRITE(numout,*) ' sxxe   ', sxxe(ji,jj,jk,jl)
373                     WRITE(numout,*) ' syye   ', syye(ji,jj,jk,jl)
374                     WRITE(numout,*) ' sxye   ', sxye(ji,jj,jk,jl)
375                  END DO
376               END DO
377   
378   !+++++++++++ END CHECK +++++++++++++++++
379   
380      END SUBROUTINE lim_rst_write
381   
382   SUBROUTINE lim_rst_read
383      !!----------------------------------------------------------------------
384      !!                    ***  lim_rst_read  ***
385      !!
386      !! ** purpose  :   read of sea-ice variable restart in a netcdf file
387      !!----------------------------------------------------------------------
388      ! Local variables
389      INTEGER :: ji, jj, jk, jl, index
390      REAL(wp) ::   zfice, ziter
391      REAL(wp) :: & !parameters for the salinity profile
392         zs_inf, z_slope_s, zsmax, zsmin, zalpha, zindb
393      REAL(wp), DIMENSION(nlay_i) :: zs_zero 
394      REAL(wp), DIMENSION(jpi,jpj) :: z2d
395      CHARACTER(len=15) :: znam
396      CHARACTER(len=1) :: zchar, zchar1
397      !!----------------------------------------------------------------------
398   
399      IF(lwp) THEN
400         WRITE(numout,*)
401         WRITE(numout,*) 'lim_rst_read : read ice NetCDF restart file'
402         WRITE(numout,*) '~~~~~~~~~~~~~~'
403      ENDIF
404
405      CALL iom_open ( 'restart_ice_in', numrir, kiolib = jprstlib )
406
407      CALL iom_get( numrir, 'nfice' , zfice )
408      CALL iom_get( numrir, 'kt_ice', ziter )   
409      IF(lwp) WRITE(numout,*) '   read ice restart file at time step    : ', ziter
410      IF(lwp) WRITE(numout,*) '   in any case we force it to nit000 - 1 : ', nit000 - 1
411
412      !Control of date
413     
414      IF( ( nit000 - INT(ziter) ) /= 1 .AND. ABS( nrstdt ) == 1 )   &
415         &     CALL ctl_stop( 'lim_rst_read ===>>>> : problem with nit000 in ice restart',  &
416         &                   '   verify the file or rerun with the value 0 for the',        &
417         &                   '   control of time parameter  nrstdt' )
418      IF( INT(zfice) /= nfice          .AND. ABS( nrstdt ) == 1 )   &
419         &     CALL ctl_stop( 'lim_rst_read ===>>>> : problem with nfice in ice restart',  &
420         &                   '   verify the file or rerun with the value 0 for the',        &
421         &                   '   control of time parameter  nrstdt' )
422
423      DO jl = 1, jpl 
424         WRITE(zchar,'(I1)') jl
425         znam = 'v_i'//'_htc'//zchar
426         CALL iom_get( numrir, jpdom_autoglo, znam , z2d )
427         v_i(:,:,jl) = z2d(:,:)
428         znam = 'v_s'//'_htc'//zchar
429         CALL iom_get( numrir, jpdom_autoglo, znam , z2d )
430         v_s(:,:,jl) = z2d(:,:) 
431         znam = 'smv_i'//'_htc'//zchar
432         CALL iom_get( numrir, jpdom_autoglo, znam , z2d )
433         smv_i(:,:,jl) = z2d(:,:)
434         znam = 'oa_i'//'_htc'//zchar
435         CALL iom_get( numrir, jpdom_autoglo, znam , z2d )
436         oa_i(:,:,jl) = z2d(:,:)
437         znam = 'a_i'//'_htc'//zchar
438         CALL iom_get( numrir, jpdom_autoglo, znam , z2d )
439         a_i(:,:,jl) = z2d(:,:)
440         znam = 't_su'//'_htc'//zchar
441         CALL iom_get( numrir, jpdom_autoglo, znam , z2d )
442         t_su(:,:,jl) = z2d(:,:)
443      END DO
444
445      ! we first with bulk ice salinity
446      DO jl = 1, jpl
447         DO jj = 1, jpj
448            DO ji = 1, jpi
449               zindb          = MAX( 0.0 , SIGN( 1.0 , v_i(ji,jj,jl) - 1.0e-4 ) ) 
450               sm_i(ji,jj,jl) = smv_i(ji,jj,jl) / MAX(v_i(ji,jj,jl),1.0e-6) * zindb
451               ht_i(ji,jj,jl) = v_i(ji,jj,jl)   / MAX(a_i(ji,jj,jl),1.0e-6) * zindb
452            END DO
453         END DO
454      END DO
455   
456      DO jk = 1, nlay_i
457         s_i(:,:,jk,:) = sm_i(:,:,:)
458      END DO
459   
460      ! Salinity profile
461      !-----------------
462      WRITE(numout,*) ' num_sal - will restart understand salinity profile ', num_sal
463   
464      num_sal = 2
465      IF(num_sal.eq.2) THEN
466   !     CALL lim_var_salprof
467         DO jl = 1, jpl
468            DO jk = 1, nlay_i
469               DO jj = 1, jpj
470                  DO ji = 1, jpi
471                     zs_inf        = sm_i(ji,jj,jl)
472                     z_slope_s     = 2.0*sm_i(ji,jj,jl)/MAX(0.01,ht_i(ji,jj,jl))
473                                     !- slope of the salinity profile
474                     zs_zero(jk)   = z_slope_s * ( FLOAT(jk)-1.0/2.0 ) * &
475                                                  ht_i(ji,jj,jl) / FLOAT(nlay_i)
476                     zsmax = 4.5
477                     zsmin = 3.5
478                     IF( sm_i(ji,jj,jl) .LT. zsmin ) THEN
479                        zalpha = 1.0
480                     ELSEIF( sm_i(ji,jj,jl) .LT.zsmax ) THEN
481                        zalpha = sm_i(ji,jj,jl) / (zsmin-zsmax) + zsmax / (zsmax-zsmin)
482                     ELSE
483                        zalpha = 0.0
484                     ENDIF
485                     s_i(ji,jj,jk,jl) = zalpha*zs_zero(jk) + ( 1.0 - zalpha )*zs_inf
486                  END DO
487               END DO
488            END DO
489         END DO
490      ENDIF
491         
492# if defined key_coupled 
493      CALL iom_get( numrir, jpdom_autoglo, 'albege'   , albege )
494# endif
495      DO jl = 1, jpl 
496         WRITE(zchar,'(I1)') jl
497         znam = 'tempt_sl1'//'_htc'//zchar
498         CALL iom_get( numrir, jpdom_autoglo, znam , z2d )
499         e_s(:,:,1,jl) = z2d(:,:)
500      END DO
501   
502      DO jl = 1, jpl 
503         WRITE(zchar,'(I1)') jl
504         DO jk = 1, nlay_i 
505            WRITE(zchar1,'(I1)') jk
506            znam = 'tempt'//'_il'//zchar1//'_htc'//zchar
507            CALL iom_get( numrir, jpdom_autoglo, znam , z2d )
508            e_i(:,:,jk,jl) = z2d(:,:)
509         END DO
510      END DO
511
512      CALL iom_get( numrir, jpdom_autoglo, 'u_ice'     , u_ice      )
513      CALL iom_get( numrir, jpdom_autoglo, 'v_ice'     , v_ice      )
514      CALL iom_get( numrir, jpdom_autoglo, 'gtaux'     , gtaux      )
515      CALL iom_get( numrir, jpdom_autoglo, 'gtauy'     , gtauy      )
516      CALL iom_get( numrir, jpdom_autoglo, 'fsbbq'     , fsbbq      )
517      CALL iom_get( numrir, jpdom_autoglo, 'stress1_i' , stress1_i  )
518      CALL iom_get( numrir, jpdom_autoglo, 'stress2_i' , stress2_i  )
519      CALL iom_get( numrir, jpdom_autoglo, 'stress12_i', stress12_i )
520
521      DO jl = 1, jpl 
522         WRITE(zchar,'(I1)') jl
523         znam = 'sxice'//'_htc'//zchar
524         CALL iom_get( numrir, jpdom_autoglo, znam , z2d )
525         sxice(:,:,jl) = z2d(:,:)
526         znam = 'syice'//'_htc'//zchar
527         CALL iom_get( numrir, jpdom_autoglo, znam , z2d )
528         syice(:,:,jl) = z2d(:,:)
529         znam = 'sxxice'//'_htc'//zchar
530         CALL iom_get( numrir, jpdom_autoglo, znam , z2d )
531         sxxice(:,:,jl) = z2d(:,:)
532         znam = 'syyice'//'_htc'//zchar
533         CALL iom_get( numrir, jpdom_autoglo, znam , z2d )
534         syyice(:,:,jl) = z2d(:,:)
535         znam = 'sxyice'//'_htc'//zchar
536         CALL iom_get( numrir, jpdom_autoglo, znam , z2d )
537         sxyice(:,:,jl) = z2d(:,:)
538         znam = 'sxsn'//'_htc'//zchar
539         CALL iom_get( numrir, jpdom_autoglo, znam , z2d )
540         sxsn(:,:,jl) = z2d(:,:)
541         znam = 'sysn'//'_htc'//zchar
542         CALL iom_get( numrir, jpdom_autoglo, znam , z2d )
543         sysn(:,:,jl) = z2d(:,:)
544         znam = 'sxxsn'//'_htc'//zchar
545         CALL iom_get( numrir, jpdom_autoglo, znam , z2d )
546         sxxsn(:,:,jl) = z2d(:,:)
547         znam = 'syysn'//'_htc'//zchar
548         CALL iom_get( numrir, jpdom_autoglo, znam , z2d )
549         syysn(:,:,jl) = z2d(:,:)
550         znam = 'sxysn'//'_htc'//zchar
551         CALL iom_get( numrir, jpdom_autoglo, znam , z2d )
552         sxysn(:,:,jl) = z2d(:,:)
553         znam = 'sxa'//'_htc'//zchar
554         CALL iom_get( numrir, jpdom_autoglo, znam , z2d )
555         sxa(:,:,jl) = z2d(:,:)
556         znam = 'sya'//'_htc'//zchar
557         CALL iom_get( numrir, jpdom_autoglo, znam , z2d )
558         sya(:,:,jl) = z2d(:,:)
559         znam = 'sxxa'//'_htc'//zchar
560         CALL iom_get( numrir, jpdom_autoglo, znam , z2d )
561         sxxa(:,:,jl) = z2d(:,:)
562         znam = 'syya'//'_htc'//zchar
563         CALL iom_get( numrir, jpdom_autoglo, znam , z2d )
564         syya(:,:,jl) = z2d(:,:)
565         znam = 'sxya'//'_htc'//zchar
566         CALL iom_get( numrir, jpdom_autoglo, znam , z2d )
567         sxya(:,:,jl) = z2d(:,:)
568         znam = 'sxc0'//'_htc'//zchar
569         CALL iom_get( numrir, jpdom_autoglo, znam , z2d )
570         sxc0(:,:,jl) = z2d(:,:)
571         znam = 'syc0'//'_htc'//zchar
572         CALL iom_get( numrir, jpdom_autoglo, znam , z2d )
573         syc0(:,:,jl) = z2d(:,:)
574         znam = 'sxxc0'//'_htc'//zchar
575         CALL iom_get( numrir, jpdom_autoglo, znam , z2d )
576         sxxc0(:,:,jl) = z2d(:,:)
577         znam = 'syyc0'//'_htc'//zchar
578         CALL iom_get( numrir, jpdom_autoglo, znam , z2d )
579         syyc0(:,:,jl) = z2d(:,:)
580         znam = 'sxyc0'//'_htc'//zchar
581         CALL iom_get( numrir, jpdom_autoglo, znam , z2d )
582         sxyc0(:,:,jl) = z2d(:,:)
583         znam = 'sxsal'//'_htc'//zchar
584         CALL iom_get( numrir, jpdom_autoglo, znam , z2d )
585         sxsal(:,:,jl) = z2d(:,:)
586         znam = 'sysal'//'_htc'//zchar
587         CALL iom_get( numrir, jpdom_autoglo, znam , z2d )
588         sysal(:,:,jl) = z2d(:,:)
589         znam = 'sxxsal'//'_htc'//zchar
590         CALL iom_get( numrir, jpdom_autoglo, znam , z2d )
591         sxxsal(:,:,jl) = z2d(:,:)
592         znam = 'syysal'//'_htc'//zchar
593         CALL iom_get( numrir, jpdom_autoglo, znam , z2d )
594         syysal(:,:,jl) = z2d(:,:)
595         znam = 'sxysal'//'_htc'//zchar
596         CALL iom_get( numrir, jpdom_autoglo, znam , z2d )
597         sxysal(:,:,jl) = z2d(:,:)
598         znam = 'sxage'//'_htc'//zchar
599         CALL iom_get( numrir, jpdom_autoglo, znam , z2d )
600         sxage(:,:,jl) = z2d(:,:)
601         znam = 'syage'//'_htc'//zchar
602         CALL iom_get( numrir, jpdom_autoglo, znam , z2d )
603         syage(:,:,jl) = z2d(:,:)
604         znam = 'sxxage'//'_htc'//zchar
605         CALL iom_get( numrir, jpdom_autoglo, znam , z2d )
606         sxxage(:,:,jl) = z2d(:,:)
607         znam = 'syyage'//'_htc'//zchar
608         CALL iom_get( numrir, jpdom_autoglo, znam , z2d )
609         syyage(:,:,jl) = z2d(:,:)
610         znam = 'sxyage'//'_htc'//zchar
611         CALL iom_get( numrir, jpdom_autoglo, znam , z2d )
612         sxyage(:,:,jl)= z2d(:,:)
613      END DO
614
615      CALL iom_get( numrir, jpdom_autoglo, 'sxopw ' ,  sxopw  )
616      CALL iom_get( numrir, jpdom_autoglo, 'syopw ' ,  syopw  )
617      CALL iom_get( numrir, jpdom_autoglo, 'sxxopw' ,  sxxopw )
618      CALL iom_get( numrir, jpdom_autoglo, 'syyopw' ,  syyopw )
619      CALL iom_get( numrir, jpdom_autoglo, 'sxyopw' ,  sxyopw )
620
621      DO jl = 1, jpl 
622         WRITE(zchar,'(I1)') jl
623         DO jk = 1, nlay_i 
624            WRITE(zchar1,'(I1)') jk
625            znam = 'sxe'//'_il'//zchar1//'_htc'//zchar
626            CALL iom_get( numrir, jpdom_autoglo, znam , z2d )
627            sxe(:,:,jk,jl) = z2d(:,:)
628            znam = 'sye'//'_il'//zchar1//'_htc'//zchar
629            CALL iom_get( numrir, jpdom_autoglo, znam , z2d )
630            sye(:,:,jk,jl) = z2d(:,:)
631            znam = 'sxxe'//'_il'//zchar1//'_htc'//zchar
632            CALL iom_get( numrir, jpdom_autoglo, znam , z2d )
633            sxxe(:,:,jk,jl) = z2d(:,:)
634            znam = 'syye'//'_il'//zchar1//'_htc'//zchar
635            CALL iom_get( numrir, jpdom_autoglo, znam , z2d )
636            syye(:,:,jk,jl) = z2d(:,:)
637            znam = 'sxye'//'_il'//zchar1//'_htc'//zchar
638            CALL iom_get( numrir, jpdom_autoglo, znam , z2d )
639            sxye(:,:,jk,jl) = z2d(:,:)
640         END DO
641      END DO
642
643      CALL iom_close( numrir )
644
645   !+++++++++++ CHECK EVERYTHING ++++++++++
646   
647               WRITE(numout,*)
648               WRITE(numout,*) ' lim_rst_read  : CHUKCHI SEA POINT '
649               WRITE(numout,*) ' ~~~~~~~~~~'
650               WRITE(numout,*) ' ~~~ Arctic'
651   
652               index = 1
653               ji = 24
654               jj = 24
655               WRITE(numout,*) ' ji, jj ', ji, jj
656               WRITE(numout,*) ' ICE VARIABLES '
657               WRITE(numout,*) ' open water ', ato_i(ji,jj)
658   
659               DO jl = 1, jpl
660                  WRITE(numout,*) ' *** CATEGORY NUMBER *** ', jl
661                  WRITE(numout,*) ' '
662                  WRITE(numout,*) ' a_i        : ', a_i(ji,jj,jl)     
663                  WRITE(numout,*) ' v_i        : ', v_i(ji,jj,jl) 
664                  WRITE(numout,*) ' v_s        : ', v_s(ji,jj,jl)   
665                  WRITE(numout,*) ' e_i1       : ', e_i(ji,jj,1,jl)/1.0e9     
666                  WRITE(numout,*) ' e_i2       : ', e_i(ji,jj,2,jl)/1.0e9     
667                  WRITE(numout,*) ' e_s        : ', e_s(ji,jj,1,jl)     
668                  WRITE(numout,*) ' smv_i      : ', smv_i(ji,jj,jl) 
669                  WRITE(numout,*) ' oa_i       : ', oa_i(ji,jj,jl)
670                  WRITE(numout,*) ' t_su       : ', t_su(ji,jj,jl)
671               END DO
672   
673               WRITE(numout,*) ' open water '
674               WRITE(numout,*) ' sxopw  ', sxopw(ji,jj)
675               WRITE(numout,*) ' syopw  ', syopw(ji,jj)
676               WRITE(numout,*) ' sxxopw ', sxxopw(ji,jj)
677               WRITE(numout,*) ' syyopw ', syyopw(ji,jj)
678               WRITE(numout,*) ' sxyopw ', sxyopw(ji,jj)
679               DO jl = 1, jpl
680                  WRITE(numout,*) ' jl, ice volume content ', jl
681                  WRITE(numout,*) ' sxice  ', sxice(ji,jj,jl)
682                  WRITE(numout,*) ' syice  ', syice(ji,jj,jl)
683                  WRITE(numout,*) ' sxxice ', sxxice(ji,jj,jl)
684                  WRITE(numout,*) ' syyice ', syyice(ji,jj,jl)
685                  WRITE(numout,*) ' sxyice ', sxyice(ji,jj,jl)
686                  WRITE(numout,*) ' jl, snow volume content ', jl
687                  WRITE(numout,*) ' sxsn   ', sxsn(ji,jj,jl)
688                  WRITE(numout,*) ' sysn   ', sysn(ji,jj,jl)
689                  WRITE(numout,*) ' sxxsn  ', sxxsn(ji,jj,jl)
690                  WRITE(numout,*) ' syysn  ', syysn(ji,jj,jl)
691                  WRITE(numout,*) ' sxysn  ', sxysn(ji,jj,jl)
692                  WRITE(numout,*) ' jl, ice area in category ', jl
693                  WRITE(numout,*) ' sxa    ', sxa (ji,jj,jl)
694                  WRITE(numout,*) ' sya    ', sya (ji,jj,jl)
695                  WRITE(numout,*) ' sxxa   ', sxxa (ji,jj,jl)
696                  WRITE(numout,*) ' syya   ', syya (ji,jj,jl)
697                  WRITE(numout,*) ' sxya   ', sxya (ji,jj,jl)
698                  WRITE(numout,*) ' jl, snow temp ', jl
699                  WRITE(numout,*) ' sxc0   ', sxc0(ji,jj,jl)
700                  WRITE(numout,*) ' syc0   ', syc0(ji,jj,jl)
701                  WRITE(numout,*) ' sxxc0  ', sxxc0(ji,jj,jl)
702                  WRITE(numout,*) ' syyc0  ', syyc0(ji,jj,jl)
703                  WRITE(numout,*) ' sxyc0  ', sxyc0(ji,jj,jl)
704                  WRITE(numout,*) ' jl, ice salinity ', jl
705                  WRITE(numout,*) ' sxsal  ', sxsal(ji,jj,jl)
706                  WRITE(numout,*) ' sysal  ', sysal(ji,jj,jl)
707                  WRITE(numout,*) ' sxxsal ', sxxsal(ji,jj,jl)
708                  WRITE(numout,*) ' syysal ', syysal(ji,jj,jl)
709                  WRITE(numout,*) ' sxysal ', sxysal(ji,jj,jl)
710                  WRITE(numout,*) ' jl, ice age      ', jl
711                  WRITE(numout,*) ' sxage  ', sxage(ji,jj,jl)
712                  WRITE(numout,*) ' syage  ', syage(ji,jj,jl)
713                  WRITE(numout,*) ' sxxage ', sxxage(ji,jj,jl)
714                  WRITE(numout,*) ' syyage ', syyage(ji,jj,jl)
715                  WRITE(numout,*) ' sxyage ', sxyage(ji,jj,jl)
716               END DO
717               DO jl = 1, jpl
718                  DO jk = 1, nlay_i
719                     WRITE(numout,*) ' jk, jl, ice heat content', jk, jl
720                     WRITE(numout,*) ' sxe    ', sxe(ji,jj,jk,jl)
721                     WRITE(numout,*) ' sye    ', sye(ji,jj,jk,jl)
722                     WRITE(numout,*) ' sxxe   ', sxxe(ji,jj,jk,jl)
723                     WRITE(numout,*) ' syye   ', syye(ji,jj,jk,jl)
724                     WRITE(numout,*) ' sxye   ', sxye(ji,jj,jk,jl)
725                  END DO
726               END DO
727   
728   !+++++++++++ END CHECK +++++++++++++++++
729   
730      END SUBROUTINE lim_rst_read
731   
732   
733#else
734   !!----------------------------------------------------------------------
735   !!   Default option :       Empty module            NO LIM sea-ice model
736   !!----------------------------------------------------------------------
737CONTAINS
738   SUBROUTINE lim_rst_read             ! Empty routine
739   END SUBROUTINE lim_rst_read
740   SUBROUTINE lim_rst_write            ! Empty routine
741   END SUBROUTINE lim_rst_write
742#endif
743
744   !!======================================================================
745END MODULE limrst
Note: See TracBrowser for help on using the repository browser.