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 @ 1699

Last change on this file since 1699 was 1473, checked in by smasson, 15 years ago

for dimgout: allow changing the number of proc for restart, see ticket:442

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