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.
iceistate.F90 in NEMO/branches/UKMO/NEMO_4.0_init_ice/src/ICE – NEMO

source: NEMO/branches/UKMO/NEMO_4.0_init_ice/src/ICE/iceistate.F90 @ 11585

Last change on this file since 11585 was 11585, checked in by dancopsey, 5 years ago

Make nn_iceini_file public

File size: 30.0 KB
Line 
1MODULE iceistate
2   !!======================================================================
3   !!                     ***  MODULE  iceistate  ***
4   !!   sea-ice : Initialization of ice variables
5   !!======================================================================
6   !! History :  2.0  !  2004-01  (C. Ethe, G. Madec) Original code
7   !!            3.0  !  2007     (M. Vancoppenolle)  Rewrite for ice cats
8   !!            4.0  !  2018     (many people)       SI3 [aka Sea Ice cube]
9   !!----------------------------------------------------------------------
10#if defined key_si3
11   !!----------------------------------------------------------------------
12   !!   'key_si3'                                       SI3 sea-ice model
13   !!----------------------------------------------------------------------
14   !!   ice_istate       :  initialization of diagnostics ice variables
15   !!   ice_istate_init  :  initialization of ice state and namelist read
16   !!----------------------------------------------------------------------
17   USE phycst         ! physical constant
18   USE oce            ! dynamics and tracers variables
19   USE dom_oce        ! ocean domain
20   USE sbc_oce , ONLY : sst_m, sss_m, ln_ice_embd 
21   USE sbc_ice , ONLY : tn_ice, snwice_mass, snwice_mass_b
22   USE eosbn2         ! equation of state
23   USE domvvl         ! Variable volume
24   USE ice            ! sea-ice variables
25   USE icevar         ! ice_var_salprof
26   !
27   USE in_out_manager ! I/O manager
28   USE iom            ! I/O manager library
29   USE lib_mpp        ! MPP library
30   USE lib_fortran    ! fortran utilities (glob_sum + no signed zero)
31   USE fldread        ! read input fields
32
33   IMPLICIT NONE
34   PRIVATE
35
36   PUBLIC   ice_istate        ! called by icestp.F90
37   PUBLIC   ice_istate_init   ! called by icestp.F90
38
39   INTEGER , PARAMETER ::   jpfldi = 6           ! maximum number of files to read
40   INTEGER , PARAMETER ::   jp_hti = 1           ! index of ice thickness (m)    at T-point
41   INTEGER , PARAMETER ::   jp_hts = 2           ! index of snow thicknes (m)    at T-point
42   INTEGER , PARAMETER ::   jp_ati = 3           ! index of ice fraction (%) at T-point
43   INTEGER , PARAMETER ::   jp_tsu = 4           ! index of ice surface temp (K)    at T-point
44   INTEGER , PARAMETER ::   jp_tmi = 5           ! index of ice temp at T-point
45   INTEGER , PARAMETER ::   jp_smi = 6           ! index of ice sali at T-point
46   TYPE(FLD), ALLOCATABLE, DIMENSION(:) ::   si  ! structure of input fields (file informations, fields read)
47   !
48   !                             !! ** namelist (namini) **
49   LOGICAL  ::   ln_iceini        ! initialization or not
50   INTEGER, PUBLIC  ::   nn_iceini_file   ! Ice initialization:
51                                  !        0 = Initialise sea ice based on SSTs
52                                  !        1 = Initialise sea ice from single category netcdf file
53                                  !        2 = Initialise sea ice from multi category restart file
54   REAL(wp) ::   rn_thres_sst     ! threshold water temperature for initial sea ice
55   REAL(wp) ::   rn_hts_ini_n     ! initial snow thickness in the north
56   REAL(wp) ::   rn_hts_ini_s     ! initial snow thickness in the south
57   REAL(wp) ::   rn_hti_ini_n     ! initial ice thickness in the north
58   REAL(wp) ::   rn_hti_ini_s     ! initial ice thickness in the south
59   REAL(wp) ::   rn_ati_ini_n     ! initial leads area in the north
60   REAL(wp) ::   rn_ati_ini_s     ! initial leads area in the south
61   REAL(wp) ::   rn_smi_ini_n     ! initial salinity
62   REAL(wp) ::   rn_smi_ini_s     ! initial salinity
63   REAL(wp) ::   rn_tmi_ini_n     ! initial temperature
64   REAL(wp) ::   rn_tmi_ini_s     ! initial temperature
65   
66   !!----------------------------------------------------------------------
67   !! NEMO/ICE 4.0 , NEMO Consortium (2018)
68   !! $Id$
69   !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt)
70   !!----------------------------------------------------------------------
71CONTAINS
72
73   SUBROUTINE ice_istate
74      !!-------------------------------------------------------------------
75      !!                    ***  ROUTINE ice_istate  ***
76      !!
77      !! ** Purpose :   defined the sea-ice initial state
78      !!
79      !! ** Method  :   This routine will put some ice where ocean
80      !!                is at the freezing point, then fill in ice
81      !!                state variables using prescribed initial
82      !!                values in the namelist           
83      !!
84      !! ** Steps   :   1) Set initial surface and basal temperatures
85      !!                2) Recompute or read sea ice state variables
86      !!                3) Fill in the ice thickness distribution using gaussian
87      !!                4) Fill in space-dependent arrays for state variables
88      !!                5) snow-ice mass computation
89      !!                6) store before fields
90      !!
91      !! ** Notes   : o_i, t_su, t_s, t_i, sz_i must be filled everywhere, even
92      !!              where there is no ice (clem: I do not know why, is it mandatory?)
93      !!--------------------------------------------------------------------
94      INTEGER  ::   ji, jj, jk, jl         ! dummy loop indices
95      INTEGER  ::   i_hemis, i_fill, jl0   ! local integers
96      REAL(wp) ::   ztmelts, zdh
97      REAL(wp) ::   zarg, zV, zconv, zdv, zfac
98      INTEGER , DIMENSION(4)           ::   itest
99      REAL(wp), DIMENSION(jpi,jpj)     ::   z2d
100      REAL(wp), DIMENSION(jpi,jpj)     ::   zswitch    ! ice indicator
101      REAL(wp), DIMENSION(jpi,jpj)     ::   zht_i_ini, zat_i_ini, zvt_i_ini            !data from namelist or nc file
102      REAL(wp), DIMENSION(jpi,jpj)     ::   zts_u_ini, zht_s_ini, zsm_i_ini, ztm_i_ini !data from namelist or nc file
103      REAL(wp), DIMENSION(jpi,jpj,jpl) ::   zh_i_ini , za_i_ini                        !data by cattegories to fill
104      !--------------------------------------------------------------------
105
106      IF(lwp) WRITE(numout,*)
107      IF(lwp) WRITE(numout,*) 'ice_istate: sea-ice initialization '
108      IF(lwp) WRITE(numout,*) '~~~~~~~~~~'
109
110      !--------------------------------------------------------------------
111      ! 1) Set surface and bottom temperatures to initial values
112      !--------------------------------------------------------------------
113      !
114      ! init surface temperature
115      DO jl = 1, jpl
116         t_su   (:,:,jl) = rt0 * tmask(:,:,1)  ! temp at the surface
117         cnd_ice(:,:,jl) = 0._wp               ! initialisation of the effective conductivity at the top of ice/snow (ln_cndflx=T)
118      END DO
119      !
120      ! init basal temperature (considered at freezing point)   [Kelvin]
121      CALL eos_fzp( sss_m(:,:), t_bo(:,:) )
122      t_bo(:,:) = ( t_bo(:,:) + rt0 ) * tmask(:,:,1) 
123
124      IF( ln_iceini ) THEN
125         !-----------------------------------------------------------
126         ! 2) Compute or read sea ice variables ===> single category
127         !-----------------------------------------------------------
128         !
129         !                             !---------------!
130         IF( nn_iceini_file == 1 )THEN      ! Read a file   !
131            !                          !---------------!
132            !
133            zht_i_ini(:,:)  = si(jp_hti)%fnow(:,:,1)
134            zht_s_ini(:,:)  = si(jp_hts)%fnow(:,:,1)
135            zat_i_ini(:,:)  = si(jp_ati)%fnow(:,:,1)
136            zts_u_ini(:,:)  = si(jp_tsu)%fnow(:,:,1)
137            ztm_i_ini(:,:)  = si(jp_tmi)%fnow(:,:,1)
138            zsm_i_ini(:,:)  = si(jp_smi)%fnow(:,:,1)
139            !
140            WHERE( zat_i_ini(:,:) > 0._wp ) ; zswitch(:,:) = tmask(:,:,1) 
141            ELSEWHERE                       ; zswitch(:,:) = 0._wp
142            END WHERE
143            zvt_i_ini(:,:) = zht_i_ini(:,:) * zat_i_ini(:,:)
144            !
145            !                          !---------------!
146         ELSE                          ! Read namelist !
147            !                          !---------------!
148            ! no ice if sst <= t-freez + ttest
149            WHERE( ( sst_m(:,:) - (t_bo(:,:) - rt0) ) * tmask(:,:,1) >= rn_thres_sst )   ;   zswitch(:,:) = 0._wp 
150            ELSEWHERE                                                                    ;   zswitch(:,:) = tmask(:,:,1)
151            END WHERE
152            !
153            ! assign initial thickness, concentration, snow depth and salinity to an hemisphere-dependent array
154            WHERE( ff_t(:,:) >= 0._wp )
155               zht_i_ini(:,:) = rn_hti_ini_n * zswitch(:,:)
156               zht_s_ini(:,:) = rn_hts_ini_n * zswitch(:,:)
157               zat_i_ini(:,:) = rn_ati_ini_n * zswitch(:,:)
158               zts_u_ini(:,:) = rn_tmi_ini_n * zswitch(:,:)
159               zsm_i_ini(:,:) = rn_smi_ini_n * zswitch(:,:)
160               ztm_i_ini(:,:) = rn_tmi_ini_n * zswitch(:,:)
161            ELSEWHERE
162               zht_i_ini(:,:) = rn_hti_ini_s * zswitch(:,:)
163               zht_s_ini(:,:) = rn_hts_ini_s * zswitch(:,:)
164               zat_i_ini(:,:) = rn_ati_ini_s * zswitch(:,:)
165               zts_u_ini(:,:) = rn_tmi_ini_s * zswitch(:,:)
166               zsm_i_ini(:,:) = rn_smi_ini_s * zswitch(:,:)
167               ztm_i_ini(:,:) = rn_tmi_ini_s * zswitch(:,:)
168            END WHERE
169            zvt_i_ini(:,:) = zht_i_ini(:,:) * zat_i_ini(:,:)
170            !
171         ENDIF
172         
173         !------------------------------------------------------------------
174         ! 3) Distribute ice concentration and thickness into the categories
175         !------------------------------------------------------------------
176         ! a gaussian distribution for ice concentration is used
177         ! then we check whether the distribution fullfills
178         ! volume and area conservation, positivity and ice categories bounds
179
180         IF( jpl == 1 ) THEN
181            !
182            zh_i_ini(:,:,1) = zht_i_ini(:,:)
183            za_i_ini(:,:,1) = zat_i_ini(:,:)           
184            !
185         ELSE
186            zh_i_ini(:,:,:) = 0._wp 
187            za_i_ini(:,:,:) = 0._wp
188            !
189            DO jj = 1, jpj
190               DO ji = 1, jpi
191                  !
192                  IF( zat_i_ini(ji,jj) > 0._wp .AND. zht_i_ini(ji,jj) > 0._wp )THEN
193
194                     ! find which category (jl0) the input ice thickness falls into
195                     jl0 = jpl
196                     DO jl = 1, jpl
197                        IF ( ( zht_i_ini(ji,jj) >  hi_max(jl-1) ) .AND. ( zht_i_ini(ji,jj) <= hi_max(jl) ) ) THEN
198                           jl0 = jl
199                           CYCLE
200                        ENDIF
201                     END DO
202                     !
203                     itest(:) = 0
204                     i_fill   = jpl + 1                                            !------------------------------------
205                     DO WHILE ( ( SUM( itest(:) ) /= 4 ) .AND. ( i_fill >= 2 ) )   ! iterative loop on i_fill categories
206                        !                                                          !------------------------------------
207                        i_fill = i_fill - 1
208                        !
209                        zh_i_ini(ji,jj,:) = 0._wp 
210                        za_i_ini(ji,jj,:) = 0._wp
211                        itest(:) = 0
212                        !
213                        IF ( i_fill == 1 ) THEN      !-- case very thin ice: fill only category 1
214                           zh_i_ini(ji,jj,1) = zht_i_ini(ji,jj)
215                           za_i_ini(ji,jj,1) = zat_i_ini(ji,jj)
216                        ELSE                         !-- case ice is thicker: fill categories >1
217                           ! thickness
218                           DO jl = 1, i_fill-1
219                              zh_i_ini(ji,jj,jl) = hi_mean(jl)
220                           END DO
221                           !
222                           ! concentration
223                           za_i_ini(ji,jj,jl0) = zat_i_ini(ji,jj) / SQRT(REAL(jpl))
224                           DO jl = 1, i_fill - 1
225                              IF( jl /= jl0 )THEN
226                                 zarg               = ( zh_i_ini(ji,jj,jl) - zht_i_ini(ji,jj) ) / ( 0.5_wp * zht_i_ini(ji,jj) )
227                                 za_i_ini(ji,jj,jl) = za_i_ini(ji,jj,jl0) * EXP(-zarg**2)
228                              ENDIF
229                           END DO
230
231                           ! last category
232                           za_i_ini(ji,jj,i_fill) = zat_i_ini(ji,jj) - SUM( za_i_ini(ji,jj,1:i_fill-1) )
233                           zV = SUM( za_i_ini(ji,jj,1:i_fill-1) * zh_i_ini(ji,jj,1:i_fill-1) )
234                           zh_i_ini(ji,jj,i_fill) = ( zvt_i_ini(ji,jj) - zV ) / MAX( za_i_ini(ji,jj,i_fill), epsi10 ) 
235
236                           ! correction if concentration of upper cat is greater than lower cat
237                           !   (it should be a gaussian around jl0 but sometimes it is not)
238                           IF ( jl0 /= jpl ) THEN
239                              DO jl = jpl, jl0+1, -1
240                                 IF ( za_i_ini(ji,jj,jl) > za_i_ini(ji,jj,jl-1) ) THEN
241                                    zdv = zh_i_ini(ji,jj,jl) * za_i_ini(ji,jj,jl)
242                                    zh_i_ini(ji,jj,jl    ) = 0._wp
243                                    za_i_ini(ji,jj,jl    ) = 0._wp
244                                    za_i_ini(ji,jj,1:jl-1) = za_i_ini(ji,jj,1:jl-1)  &
245                                       &                     + zdv / MAX( REAL(jl-1) * zht_i_ini(ji,jj), epsi10 )
246                                 END IF
247                              ENDDO
248                           ENDIF
249                           !
250                        ENDIF
251                        !
252                        ! Compatibility tests
253                        zconv = ABS( zat_i_ini(ji,jj) - SUM( za_i_ini(ji,jj,1:jpl) ) )           ! Test 1: area conservation
254                        IF ( zconv < epsi06 ) itest(1) = 1
255                        !
256                        zconv = ABS(       zat_i_ini(ji,jj)       * zht_i_ini(ji,jj)   &         ! Test 2: volume conservation
257                           &        - SUM( za_i_ini (ji,jj,1:jpl) * zh_i_ini (ji,jj,1:jpl) ) )
258                        IF ( zconv < epsi06 ) itest(2) = 1
259                        !
260                        IF ( zh_i_ini(ji,jj,i_fill) >= hi_max(i_fill-1) ) itest(3) = 1           ! Test 3: thickness of the last category is in-bounds ?
261                        !
262                        itest(4) = 1
263                        DO jl = 1, i_fill
264                           IF ( za_i_ini(ji,jj,jl) < 0._wp ) itest(4) = 0                        ! Test 4: positivity of ice concentrations
265                        END DO
266                        !                                                          !----------------------------
267                     END DO                                                        ! end iteration on categories
268                     !                                                             !----------------------------
269                     IF( lwp .AND. SUM(itest) /= 4 ) THEN
270                        WRITE(numout,*)
271                        WRITE(numout,*) ' !!!! ALERT itest is not equal to 4      !!! '
272                        WRITE(numout,*) ' !!!! Something is wrong in the SI3 initialization procedure '
273                        WRITE(numout,*)
274                        WRITE(numout,*) ' *** itest_i (i=1,4) = ', itest(:)
275                        WRITE(numout,*) ' zat_i_ini : ', zat_i_ini(ji,jj)
276                        WRITE(numout,*) ' zht_i_ini : ', zht_i_ini(ji,jj)
277                     ENDIF
278                     !
279                  ENDIF
280                  !
281               END DO
282            END DO
283         ENDIF
284         
285         !---------------------------------------------------------------------
286         ! 4) Fill in sea ice arrays
287         !---------------------------------------------------------------------
288         !
289         ! Ice concentration, thickness and volume, ice salinity, ice age, surface temperature
290         DO jl = 1, jpl ! loop over categories
291            DO jj = 1, jpj
292               DO ji = 1, jpi
293                  a_i(ji,jj,jl)  = zswitch(ji,jj) * za_i_ini(ji,jj,jl)                       ! concentration
294                  h_i(ji,jj,jl)  = zswitch(ji,jj) * zh_i_ini(ji,jj,jl)                       ! ice thickness
295                  s_i(ji,jj,jl)  = zswitch(ji,jj) * zsm_i_ini(ji,jj)                         ! salinity
296                  o_i(ji,jj,jl)  = 0._wp                                                     ! age (0 day)
297                  t_su(ji,jj,jl) = zswitch(ji,jj) * zts_u_ini(ji,jj) + ( 1._wp - zswitch(ji,jj) ) * rt0 ! surf temp
298                  !
299                  IF( zht_i_ini(ji,jj) > 0._wp )THEN
300                    h_s(ji,jj,jl)= h_i(ji,jj,jl) * ( zht_s_ini(ji,jj) / zht_i_ini(ji,jj) )  ! snow depth
301                  ELSE
302                    h_s(ji,jj,jl)= 0._wp
303                  ENDIF
304                  !
305                  ! This case below should not be used if (h_s/h_i) is ok in namelist
306                  ! In case snow load is in excess that would lead to transformation from snow to ice
307                  ! Then, transfer the snow excess into the ice (different from icethd_dh)
308                  zdh = MAX( 0._wp, ( rhos * h_s(ji,jj,jl) + ( rhoi - rau0 ) * h_i(ji,jj,jl) ) * r1_rau0 ) 
309                  ! recompute h_i, h_s avoiding out of bounds values
310                  h_i(ji,jj,jl) = MIN( hi_max(jl), h_i(ji,jj,jl) + zdh )
311                  h_s(ji,jj,jl) = MAX( 0._wp, h_s(ji,jj,jl) - zdh * rhoi * r1_rhos )
312                  !
313                  ! ice volume, salt content, age content
314                  v_i (ji,jj,jl) = h_i(ji,jj,jl) * a_i(ji,jj,jl)              ! ice volume
315                  v_s (ji,jj,jl) = h_s(ji,jj,jl) * a_i(ji,jj,jl)              ! snow volume
316                  sv_i(ji,jj,jl) = MIN( s_i(ji,jj,jl) , sss_m(ji,jj) ) * v_i(ji,jj,jl) ! salt content
317                  oa_i(ji,jj,jl) = o_i(ji,jj,jl) * a_i(ji,jj,jl)               ! age content
318               END DO
319            END DO
320         END DO
321         !
322         IF( nn_icesal /= 2 )  THEN         ! for constant salinity in time
323            CALL ice_var_salprof
324            sv_i = s_i * v_i
325         ENDIF
326         
327         ! Snow temperature and heat content
328         DO jk = 1, nlay_s
329            DO jl = 1, jpl ! loop over categories
330               DO jj = 1, jpj
331                  DO ji = 1, jpi
332                     t_s(ji,jj,jk,jl) = zswitch(ji,jj) * ztm_i_ini(ji,jj) + ( 1._wp - zswitch(ji,jj) ) * rt0
333                     ! Snow energy of melting
334                     e_s(ji,jj,jk,jl) = zswitch(ji,jj) * rhos * ( rcpi * ( rt0 - t_s(ji,jj,jk,jl) ) + rLfus )
335                     !
336                     ! Mutliply by volume, and divide by number of layers to get heat content in J/m2
337                     e_s(ji,jj,jk,jl) = e_s(ji,jj,jk,jl) * v_s(ji,jj,jl) * r1_nlay_s
338                  END DO
339               END DO
340            END DO
341         END DO
342         !
343         ! Ice salinity, temperature and heat content
344         DO jk = 1, nlay_i
345            DO jl = 1, jpl ! loop over categories
346               DO jj = 1, jpj
347                  DO ji = 1, jpi
348                     t_i (ji,jj,jk,jl) = zswitch(ji,jj) * ztm_i_ini(ji,jj) + ( 1._wp - zswitch(ji,jj) ) * rt0 
349                     sz_i(ji,jj,jk,jl) = zswitch(ji,jj) * zsm_i_ini(ji,jj) + ( 1._wp - zswitch(ji,jj) ) * rn_simin
350                     ztmelts          = - rTmlt * sz_i(ji,jj,jk,jl) + rt0 !Melting temperature in K
351                     !
352                     ! heat content per unit volume
353                     e_i(ji,jj,jk,jl) = zswitch(ji,jj) * rhoi * (   rcpi    * ( ztmelts - t_i(ji,jj,jk,jl) )           &
354                        &             + rLfus * ( 1._wp - (ztmelts-rt0) / MIN( (t_i(ji,jj,jk,jl)-rt0) , -epsi20 )  )   &
355                        &             - rcp  * ( ztmelts - rt0 ) )
356                     !
357                     ! Mutliply by ice volume, and divide by number of layers to get heat content in J/m2
358                     e_i(ji,jj,jk,jl) = e_i(ji,jj,jk,jl) * v_i(ji,jj,jl) * r1_nlay_i
359                  END DO
360               END DO
361            END DO
362         END DO
363         !
364         tn_ice (:,:,:) = t_su (:,:,:)
365         t1_ice (:,:,:) = t_i (:,:,1,:)   ! initialisation of 1st layer temp for coupled simu
366
367         ! Melt pond volume and fraction
368         IF ( ln_pnd_CST .OR. ln_pnd_H12 ) THEN   ;   zfac = 1._wp
369         ELSE                                     ;   zfac = 0._wp
370         ENDIF
371         DO jl = 1, jpl
372            a_ip_frac(:,:,jl) = rn_apnd * zswitch(:,:) * zfac
373            h_ip     (:,:,jl) = rn_hpnd * zswitch(:,:) * zfac
374         END DO
375         a_ip(:,:,:) = a_ip_frac(:,:,:) * a_i (:,:,:) 
376         v_ip(:,:,:) = h_ip     (:,:,:) * a_ip(:,:,:)
377         !
378      ELSE ! if ln_iceini=false
379         a_i  (:,:,:) = 0._wp
380         v_i  (:,:,:) = 0._wp
381         v_s  (:,:,:) = 0._wp
382         sv_i (:,:,:) = 0._wp
383         oa_i (:,:,:) = 0._wp
384         h_i  (:,:,:) = 0._wp
385         h_s  (:,:,:) = 0._wp
386         s_i  (:,:,:) = 0._wp
387         o_i  (:,:,:) = 0._wp
388         !
389         e_i(:,:,:,:) = 0._wp
390         e_s(:,:,:,:) = 0._wp
391         !
392         DO jl = 1, jpl
393            DO jk = 1, nlay_i
394               t_i(:,:,jk,jl) = rt0 * tmask(:,:,1)
395            END DO
396            DO jk = 1, nlay_s
397               t_s(:,:,jk,jl) = rt0 * tmask(:,:,1)
398            END DO
399         END DO
400
401         tn_ice (:,:,:) = t_i (:,:,1,:)
402         t1_ice (:,:,:) = t_i (:,:,1,:)   ! initialisation of 1st layer temp for coupled simu
403         
404         a_ip(:,:,:)      = 0._wp
405         v_ip(:,:,:)      = 0._wp
406         a_ip_frac(:,:,:) = 0._wp
407         h_ip     (:,:,:) = 0._wp
408         !
409      ENDIF ! ln_iceini
410      !
411      at_i (:,:) = 0.0_wp
412      DO jl = 1, jpl
413         at_i (:,:) = at_i (:,:) + a_i (:,:,jl)
414      END DO
415      !
416      ! --- set ice velocities --- !
417      u_ice (:,:) = 0._wp
418      v_ice (:,:) = 0._wp
419      ! fields needed for ice_dyn_adv_umx
420      l_split_advumx(1) = .FALSE.
421      !
422      !----------------------------------------------
423      ! 5) Snow-ice mass (case ice is fully embedded)
424      !----------------------------------------------
425      snwice_mass  (:,:) = tmask(:,:,1) * SUM( rhos * v_s(:,:,:) + rhoi * v_i(:,:,:), dim=3  )   ! snow+ice mass
426      snwice_mass_b(:,:) = snwice_mass(:,:)
427      !
428      IF( ln_ice_embd ) THEN            ! embedded sea-ice: deplete the initial ssh below sea-ice area
429         !
430         sshn(:,:) = sshn(:,:) - snwice_mass(:,:) * r1_rau0
431         sshb(:,:) = sshb(:,:) - snwice_mass(:,:) * r1_rau0
432         !
433         IF( .NOT.ln_linssh ) THEN
434            !
435            WHERE( ht_0(:,:) > 0 )   ;   z2d(:,:) = 1._wp + sshn(:,:)*tmask(:,:,1) / ht_0(:,:)
436            ELSEWHERE                ;   z2d(:,:) = 1._wp   ;   END WHERE
437            !
438            DO jk = 1,jpkm1                     ! adjust initial vertical scale factors               
439               e3t_n(:,:,jk) = e3t_0(:,:,jk) * z2d(:,:)
440               e3t_b(:,:,jk) = e3t_n(:,:,jk)
441               e3t_a(:,:,jk) = e3t_n(:,:,jk)
442            END DO
443            !
444            ! Reconstruction of all vertical scale factors at now and before time-steps
445            ! =========================================================================
446            ! Horizontal scale factor interpolations
447            ! --------------------------------------
448            CALL dom_vvl_interpol( e3t_b(:,:,:), e3u_b(:,:,:), 'U' )
449            CALL dom_vvl_interpol( e3t_b(:,:,:), e3v_b(:,:,:), 'V' )
450            CALL dom_vvl_interpol( e3t_n(:,:,:), e3u_n(:,:,:), 'U' )
451            CALL dom_vvl_interpol( e3t_n(:,:,:), e3v_n(:,:,:), 'V' )
452            CALL dom_vvl_interpol( e3u_n(:,:,:), e3f_n(:,:,:), 'F' )
453            ! Vertical scale factor interpolations
454            ! ------------------------------------
455            CALL dom_vvl_interpol( e3t_n(:,:,:), e3w_n (:,:,:), 'W'  )
456            CALL dom_vvl_interpol( e3u_n(:,:,:), e3uw_n(:,:,:), 'UW' )
457            CALL dom_vvl_interpol( e3v_n(:,:,:), e3vw_n(:,:,:), 'VW' )
458            CALL dom_vvl_interpol( e3u_b(:,:,:), e3uw_b(:,:,:), 'UW' )
459            CALL dom_vvl_interpol( e3v_b(:,:,:), e3vw_b(:,:,:), 'VW' )
460            ! t- and w- points depth
461            ! ----------------------
462            !!gm not sure of that....
463            gdept_n(:,:,1) = 0.5_wp * e3w_n(:,:,1)
464            gdepw_n(:,:,1) = 0.0_wp
465            gde3w_n(:,:,1) = gdept_n(:,:,1) - sshn(:,:)
466            DO jk = 2, jpk
467               gdept_n(:,:,jk) = gdept_n(:,:,jk-1) + e3w_n(:,:,jk  )
468               gdepw_n(:,:,jk) = gdepw_n(:,:,jk-1) + e3t_n(:,:,jk-1)
469               gde3w_n(:,:,jk) = gdept_n(:,:,jk  ) - sshn (:,:)
470            END DO
471         ENDIF
472      ENDIF
473     
474      !------------------------------------
475      ! 6) store fields at before time-step
476      !------------------------------------
477      ! it is only necessary for the 1st interpolation by Agrif
478      a_i_b  (:,:,:)   = a_i  (:,:,:)
479      e_i_b  (:,:,:,:) = e_i  (:,:,:,:)
480      v_i_b  (:,:,:)   = v_i  (:,:,:)
481      v_s_b  (:,:,:)   = v_s  (:,:,:)
482      e_s_b  (:,:,:,:) = e_s  (:,:,:,:)
483      sv_i_b (:,:,:)   = sv_i (:,:,:)
484      oa_i_b (:,:,:)   = oa_i (:,:,:)
485      u_ice_b(:,:)     = u_ice(:,:)
486      v_ice_b(:,:)     = v_ice(:,:)
487      ! total concentration is needed for Lupkes parameterizations
488      at_i_b (:,:)     = at_i (:,:) 
489
490!!clem: output of initial state should be written here but it is impossible because
491!!      the ocean and ice are in the same file
492!!      CALL dia_wri_state( 'output.init' )
493      !
494   END SUBROUTINE ice_istate
495
496
497   SUBROUTINE ice_istate_init
498      !!-------------------------------------------------------------------
499      !!                   ***  ROUTINE ice_istate_init  ***
500      !!       
501      !! ** Purpose :   Definition of initial state of the ice
502      !!
503      !! ** Method  :   Read the namini namelist and check the parameter
504      !!              values called at the first timestep (nit000)
505      !!
506      !! ** input   :  Namelist namini
507      !!
508      !!-----------------------------------------------------------------------------
509      INTEGER ::   ji, jj
510      INTEGER ::   ios, ierr, inum_ice   ! Local integer output status for namelist read
511      INTEGER ::   ifpr, ierror
512      !
513      CHARACTER(len=256) ::  cn_dir          ! Root directory for location of ice files
514      TYPE(FLD_N)                    ::   sn_hti, sn_hts, sn_ati, sn_tsu, sn_tmi, sn_smi
515      TYPE(FLD_N), DIMENSION(jpfldi) ::   slf_i                 ! array of namelist informations on the fields to read
516      !
517      NAMELIST/namini/ ln_iceini, nn_iceini_file, rn_thres_sst, rn_hts_ini_n, rn_hts_ini_s,  &
518         &             rn_hti_ini_n, rn_hti_ini_s, rn_ati_ini_n, rn_ati_ini_s, rn_smi_ini_n, &
519         &             rn_smi_ini_s, rn_tmi_ini_n, rn_tmi_ini_s,                             &
520         &             sn_hti, sn_hts, sn_ati, sn_tsu, sn_tmi, sn_smi, cn_dir
521      !!-----------------------------------------------------------------------------
522      !
523      REWIND( numnam_ice_ref )              ! Namelist namini in reference namelist : Ice initial state
524      READ  ( numnam_ice_ref, namini, IOSTAT = ios, ERR = 901)
525901   IF( ios /= 0 )   CALL ctl_nam ( ios , 'namini in reference namelist', lwp )
526      REWIND( numnam_ice_cfg )              ! Namelist namini in configuration namelist : Ice initial state
527      READ  ( numnam_ice_cfg, namini, IOSTAT = ios, ERR = 902 )
528902   IF( ios >  0 )   CALL ctl_nam ( ios , 'namini in configuration namelist', lwp )
529      IF(lwm) WRITE ( numoni, namini )
530      !
531      slf_i(jp_hti) = sn_hti  ;  slf_i(jp_hts) = sn_hts
532      slf_i(jp_ati) = sn_ati  ;  slf_i(jp_tsu) = sn_tsu
533      slf_i(jp_tmi) = sn_tmi  ;  slf_i(jp_smi) = sn_smi
534      !
535      IF(lwp) THEN                          ! control print
536         WRITE(numout,*)
537         WRITE(numout,*) 'ice_istate_init: ice parameters inititialisation '
538         WRITE(numout,*) '~~~~~~~~~~~~~~~'
539         WRITE(numout,*) '   Namelist namini:'
540         WRITE(numout,*) '      initialization with ice (T) or not (F)                 ln_iceini       = ', ln_iceini
541         WRITE(numout,*) '      ice initialization from a netcdf file                  nn_iceini_file  = ', nn_iceini_file
542         WRITE(numout,*) '      max delta ocean temp. above Tfreeze with initial ice   rn_thres_sst    = ', rn_thres_sst
543         WRITE(numout,*) '      initial snow thickness in the north                    rn_hts_ini_n    = ', rn_hts_ini_n
544         WRITE(numout,*) '      initial snow thickness in the south                    rn_hts_ini_s    = ', rn_hts_ini_s 
545         WRITE(numout,*) '      initial ice thickness  in the north                    rn_hti_ini_n    = ', rn_hti_ini_n
546         WRITE(numout,*) '      initial ice thickness  in the south                    rn_hti_ini_s    = ', rn_hti_ini_s
547         WRITE(numout,*) '      initial ice concentr.  in the north                    rn_ati_ini_n    = ', rn_ati_ini_n
548         WRITE(numout,*) '      initial ice concentr.  in the north                    rn_ati_ini_s    = ', rn_ati_ini_s
549         WRITE(numout,*) '      initial  ice salinity  in the north                    rn_smi_ini_n    = ', rn_smi_ini_n
550         WRITE(numout,*) '      initial  ice salinity  in the south                    rn_smi_ini_s    = ', rn_smi_ini_s
551         WRITE(numout,*) '      initial  ice/snw temp  in the north                    rn_tmi_ini_n    = ', rn_tmi_ini_n
552         WRITE(numout,*) '      initial  ice/snw temp  in the south                    rn_tmi_ini_s    = ', rn_tmi_ini_s
553      ENDIF
554      !
555      IF( nn_iceini_file == 1 ) THEN                      ! Ice initialization using input file
556         !
557         ! set si structure
558         ALLOCATE( si(jpfldi), STAT=ierror )
559         IF( ierror > 0 ) THEN
560            CALL ctl_stop( 'Ice_ini in iceistate: unable to allocate si structure' )   ;   RETURN
561         ENDIF
562         !
563         DO ifpr = 1, jpfldi
564            ALLOCATE( si(ifpr)%fnow(jpi,jpj,1) )
565            ALLOCATE( si(ifpr)%fdta(jpi,jpj,1,2) )
566         END DO
567         !
568         ! fill si with slf_i and control print
569         CALL fld_fill( si, slf_i, cn_dir, 'ice_istate', 'ice istate ini', 'numnam_ice' )
570         !
571         CALL fld_read( nit000, 1, si )                ! input fields provided at the current time-step
572         !
573      ENDIF
574      !
575   END SUBROUTINE ice_istate_init
576
577#else
578   !!----------------------------------------------------------------------
579   !!   Default option :         Empty module         NO SI3 sea-ice model
580   !!----------------------------------------------------------------------
581#endif
582
583   !!======================================================================
584END MODULE iceistate
Note: See TracBrowser for help on using the repository browser.