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/2019/dev_r10984_HPC-13_IRRMANN_BDY_optimization/src/ICE – NEMO

source: NEMO/branches/2019/dev_r10984_HPC-13_IRRMANN_BDY_optimization/src/ICE/iceistate.F90 @ 11397

Last change on this file since 11397 was 11397, checked in by clem, 5 years ago

rewrite iceistate.F90, add new variables (optional) for input fields, and prepare the code for a simplified ice restart

  • Property svn:keywords set to Id
File size: 25.4 KB
RevLine 
[8586]1MODULE iceistate
2   !!======================================================================
3   !!                     ***  MODULE  iceistate  ***
4   !!   sea-ice : Initialization of ice variables
5   !!======================================================================
[9604]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]
[8586]9   !!----------------------------------------------------------------------
[9570]10#if defined key_si3
[8586]11   !!----------------------------------------------------------------------
[9570]12   !!   'key_si3'                                       SI3 sea-ice model
[8586]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
[11397]24   USE ice            ! sea-ice: variables
25   USE ice1D          ! sea-ice: thermodynamics variables
26   USE icetab         ! sea-ice: 1D <==> 2D transformation
27   USE icevar         ! sea-ice: operations
[8586]28   !
29   USE in_out_manager ! I/O manager
30   USE iom            ! I/O manager library
31   USE lib_mpp        ! MPP library
32   USE lib_fortran    ! fortran utilities (glob_sum + no signed zero)
33   USE fldread        ! read input fields
34
35   IMPLICIT NONE
36   PRIVATE
37
38   PUBLIC   ice_istate        ! called by icestp.F90
39   PUBLIC   ice_istate_init   ! called by icestp.F90
40   !
[8813]41   !                             !! ** namelist (namini) **
[11397]42   LOGICAL  ::   ln_iceini        ! Ice initialization or not
43   LOGICAL  ::   ln_iceini_file   ! Ice initialization from 2D netcdf file
[8586]44   REAL(wp) ::   rn_thres_sst     ! threshold water temperature for initial sea ice
45   REAL(wp) ::   rn_hts_ini_n     ! initial snow thickness in the north
46   REAL(wp) ::   rn_hts_ini_s     ! initial snow thickness in the south
47   REAL(wp) ::   rn_hti_ini_n     ! initial ice thickness in the north
48   REAL(wp) ::   rn_hti_ini_s     ! initial ice thickness in the south
[11397]49   REAL(wp) ::   rn_ati_ini_n     ! initial concentration in the north
50   REAL(wp) ::   rn_ati_ini_s     ! initial concentration in the south
51   REAL(wp) ::   rn_smi_ini_n     ! initial salinity in the north
52   REAL(wp) ::   rn_smi_ini_s     ! initial salinity in the south
53   REAL(wp) ::   rn_tmi_ini_n     ! initial ice temperature in the north
54   REAL(wp) ::   rn_tmi_ini_s     ! initial ice temperature in the south
55   REAL(wp) ::   rn_tms_ini_n     ! initial snw temperature in the north
56   REAL(wp) ::   rn_tms_ini_s     ! initial swn temperature in the south
57   REAL(wp) ::   rn_apd_ini_n     ! initial pond fraction in the north
58   REAL(wp) ::   rn_apd_ini_s     ! initial pond fraction in the south
59   REAL(wp) ::   rn_hpd_ini_n     ! initial pond depth in the north
60   REAL(wp) ::   rn_hpd_ini_s     ! initial pond depth in the south
61
62   !                              ! if ln_iceini_file = T
63   INTEGER , PARAMETER ::   jpfldi = 9           ! maximum number of files to read
64   INTEGER , PARAMETER ::   jp_hti = 1           ! index of ice thickness    (m)
65   INTEGER , PARAMETER ::   jp_hts = 2           ! index of snw thickness    (m)
66   INTEGER , PARAMETER ::   jp_ati = 3           ! index of ice fraction     (-)
67   INTEGER , PARAMETER ::   jp_tsu = 4           ! index of ice surface temp (K)
68   INTEGER , PARAMETER ::   jp_tmi = 5           ! index of ice temperature  (K)
69   INTEGER , PARAMETER ::   jp_smi = 6           ! index of ice salinity     (g/kg)
70   INTEGER , PARAMETER ::   jp_tms = 7           ! index of snw temperature  (K)
71   INTEGER , PARAMETER ::   jp_apd = 8           ! index of pnd fraction     (-)
72   INTEGER , PARAMETER ::   jp_hpd = 9           ! index of pnd depth        (m)
73   TYPE(FLD), ALLOCATABLE, DIMENSION(:) ::   si  ! structure of input fields (file informations, fields read)
74   !   
[8586]75   !!----------------------------------------------------------------------
[9598]76   !! NEMO/ICE 4.0 , NEMO Consortium (2018)
[10069]77   !! $Id$
[10413]78   !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt)
[8586]79   !!----------------------------------------------------------------------
80CONTAINS
81
[11397]82   SUBROUTINE ice_istate( kt )
[8586]83      !!-------------------------------------------------------------------
84      !!                    ***  ROUTINE ice_istate  ***
85      !!
86      !! ** Purpose :   defined the sea-ice initial state
87      !!
88      !! ** Method  :   This routine will put some ice where ocean
89      !!                is at the freezing point, then fill in ice
90      !!                state variables using prescribed initial
91      !!                values in the namelist           
92      !!
93      !! ** Steps   :   1) Set initial surface and basal temperatures
94      !!                2) Recompute or read sea ice state variables
95      !!                3) Fill in the ice thickness distribution using gaussian
96      !!                4) Fill in space-dependent arrays for state variables
97      !!                5) snow-ice mass computation
98      !!                6) store before fields
99      !!
100      !! ** Notes   : o_i, t_su, t_s, t_i, sz_i must be filled everywhere, even
[11397]101      !!              where there is no ice
[8586]102      !!--------------------------------------------------------------------
[11397]103      INTEGER, INTENT(in) ::   kt   ! time step
104      !!
[8813]105      INTEGER  ::   ji, jj, jk, jl         ! dummy loop indices
[11397]106      REAL(wp) ::   ztmelts
[8586]107      INTEGER , DIMENSION(4)           ::   itest
108      REAL(wp), DIMENSION(jpi,jpj)     ::   z2d
109      REAL(wp), DIMENSION(jpi,jpj)     ::   zswitch    ! ice indicator
[11397]110      REAL(wp), DIMENSION(jpi,jpj)     ::   zht_i_ini, zat_i_ini, ztm_s_ini            !data from namelist or nc file
111      REAL(wp), DIMENSION(jpi,jpj)     ::   zt_su_ini, zht_s_ini, zsm_i_ini, ztm_i_ini !data from namelist or nc file
112      REAL(wp), DIMENSION(jpi,jpj)     ::   zapnd_ini, zhpnd_ini                       !data from namelist or nc file
113      REAL(wp), DIMENSION(jpi,jpj,jpl) ::   zti_3d , zts_3d                            !temporary arrays
114      !!
115      REAL(wp), DIMENSION(:,:), ALLOCATABLE ::   zhi_2d, zhs_2d, zai_2d, zti_2d, zts_2d, ztsu_2d, zsi_2d
[8586]116      !--------------------------------------------------------------------
117
118      IF(lwp) WRITE(numout,*)
119      IF(lwp) WRITE(numout,*) 'ice_istate: sea-ice initialization '
120      IF(lwp) WRITE(numout,*) '~~~~~~~~~~'
121
[11397]122      !---------------------------
123      ! 1) 1st init. of the fields
124      !---------------------------
[8586]125      !
[11397]126      ! basal temperature (considered at freezing point)   [Kelvin]
127      CALL eos_fzp( sss_m(:,:), t_bo(:,:) )
128      t_bo(:,:) = ( t_bo(:,:) + rt0 ) * tmask(:,:,1) 
129      !
130      ! surface temperature and conductivity
[8586]131      DO jl = 1, jpl
[9416]132         t_su   (:,:,jl) = rt0 * tmask(:,:,1)  ! temp at the surface
[10534]133         cnd_ice(:,:,jl) = 0._wp               ! initialisation of the effective conductivity at the top of ice/snow (ln_cndflx=T)
[8586]134      END DO
[8813]135      !
[11397]136      ! ice and snw temperatures
137      DO jl = 1, jpl
138         DO jk = 1, nlay_i
139            t_i(:,:,jk,jl) = rt0 * tmask(:,:,1)
140         END DO
141         DO jk = 1, nlay_s
142            t_s(:,:,jk,jl) = rt0 * tmask(:,:,1)
143         END DO
144      END DO
145      !
146      ! specific temperatures for coupled runs
147      tn_ice (:,:,:) = t_i (:,:,1,:)
148      t1_ice (:,:,:) = t_i (:,:,1,:)
[8586]149
[11397]150      ! heat contents
151      e_i (:,:,:,:) = 0._wp
152      e_s (:,:,:,:) = 0._wp
153     
154      ! general fields
155      a_i (:,:,:) = 0._wp
156      v_i (:,:,:) = 0._wp
157      v_s (:,:,:) = 0._wp
158      sv_i(:,:,:) = 0._wp
159      oa_i(:,:,:) = 0._wp
160      !
161      h_i (:,:,:) = 0._wp
162      h_s (:,:,:) = 0._wp
163      s_i (:,:,:) = 0._wp
164      o_i (:,:,:) = 0._wp
165      !
166      ! melt ponds
167      a_ip     (:,:,:) = 0._wp
168      v_ip     (:,:,:) = 0._wp
169      a_ip_frac(:,:,:) = 0._wp
170      h_ip     (:,:,:) = 0._wp
171      !
172      ! ice velocities
173      u_ice (:,:) = 0._wp
174      v_ice (:,:) = 0._wp
175      !
176      !------------------------------------------------------------------------
177      ! 2) overwrite some of the fields with namelist parameters or netcdf file
178      !------------------------------------------------------------------------
[8586]179      IF( ln_iceini ) THEN
180         !                             !---------------!
181         IF( ln_iceini_file )THEN      ! Read a file   !
182            !                          !---------------!
[11397]183            CALL fld_read( kt, 1, si )                ! input fields provided at the current time-step
[8586]184            !
[11397]185            zht_i_ini(:,:) = si(jp_hti)%fnow(:,:,1)
186            zht_s_ini(:,:) = si(jp_hts)%fnow(:,:,1)
187            zat_i_ini(:,:) = si(jp_ati)%fnow(:,:,1)
188            zt_su_ini(:,:) = si(jp_tsu)%fnow(:,:,1)
189            ztm_i_ini(:,:) = si(jp_tmi)%fnow(:,:,1)
190            zsm_i_ini(:,:) = si(jp_smi)%fnow(:,:,1)
191            ! snow temperature
192            IF( TRIM(si(jp_tms)%clrootname) == 'NOT USED' )   si(jp_tms)%fnow(:,:,1) = si(jp_tmi)%fnow(:,:,1)
193            ztm_s_ini(:,:) = si(jp_tms)%fnow(:,:,1)
194            ! ponds
195            IF( TRIM(si(jp_apd)%clrootname) == 'NOT USED' )   si(jp_apd)%fnow(:,:,1) = 0._wp 
196            IF( TRIM(si(jp_hpd)%clrootname) == 'NOT USED' )   si(jp_hpd)%fnow(:,:,1) = 0._wp 
197            zapnd_ini(:,:) = si(jp_apd)%fnow(:,:,1)
198            zhpnd_ini(:,:) = si(jp_hpd)%fnow(:,:,1)
[8586]199            !
200            WHERE( zat_i_ini(:,:) > 0._wp ) ; zswitch(:,:) = tmask(:,:,1) 
201            ELSEWHERE                       ; zswitch(:,:) = 0._wp
202            END WHERE
[8813]203            !                          !---------------!
[8586]204         ELSE                          ! Read namelist !
205            !                          !---------------!
[11397]206            ! no ice if (sst - Tfreez) >= thresold
[8813]207            WHERE( ( sst_m(:,:) - (t_bo(:,:) - rt0) ) * tmask(:,:,1) >= rn_thres_sst )   ;   zswitch(:,:) = 0._wp 
208            ELSEWHERE                                                                    ;   zswitch(:,:) = tmask(:,:,1)
[8586]209            END WHERE
[8813]210            !
[8586]211            ! assign initial thickness, concentration, snow depth and salinity to an hemisphere-dependent array
212            WHERE( ff_t(:,:) >= 0._wp )
213               zht_i_ini(:,:) = rn_hti_ini_n * zswitch(:,:)
214               zht_s_ini(:,:) = rn_hts_ini_n * zswitch(:,:)
215               zat_i_ini(:,:) = rn_ati_ini_n * zswitch(:,:)
[11397]216               zt_su_ini(:,:) = rn_tmi_ini_n * zswitch(:,:)
[8586]217               zsm_i_ini(:,:) = rn_smi_ini_n * zswitch(:,:)
218               ztm_i_ini(:,:) = rn_tmi_ini_n * zswitch(:,:)
[11397]219               ztm_s_ini(:,:) = rn_tms_ini_n * zswitch(:,:)
220               zapnd_ini(:,:) = rn_apd_ini_n * zswitch(:,:)
221               zhpnd_ini(:,:) = rn_hpd_ini_n * zswitch(:,:)
[8586]222            ELSEWHERE
223               zht_i_ini(:,:) = rn_hti_ini_s * zswitch(:,:)
224               zht_s_ini(:,:) = rn_hts_ini_s * zswitch(:,:)
225               zat_i_ini(:,:) = rn_ati_ini_s * zswitch(:,:)
[11397]226               zt_su_ini(:,:) = rn_tmi_ini_s * zswitch(:,:)
[8586]227               zsm_i_ini(:,:) = rn_smi_ini_s * zswitch(:,:)
228               ztm_i_ini(:,:) = rn_tmi_ini_s * zswitch(:,:)
[11397]229               ztm_s_ini(:,:) = rn_tms_ini_s * zswitch(:,:)
230               zapnd_ini(:,:) = rn_apd_ini_s * zswitch(:,:)
231               zhpnd_ini(:,:) = rn_hpd_ini_s * zswitch(:,:)
[8586]232            END WHERE
233            !
234         ENDIF
[11397]235         !-------------!
236         ! fill fields !
237         !-------------!
238         ! select ice covered grid points
239         npti = 0 ; nptidx(:) = 0
240         DO jj = 1, jpj
241            DO ji = 1, jpi
242               IF ( zht_i_ini(ji,jj) > 0._wp ) THEN
243                  npti         = npti  + 1
244                  nptidx(npti) = (jj - 1) * jpi + ji
245               ENDIF
246            END DO
247         END DO
248
249         ! move to 1D arrays: (jpi,jpj) -> (jpi*jpj)
250         CALL tab_2d_1d( npti, nptidx(1:npti), h_i_1d (1:npti)  , zht_i_ini )
251         CALL tab_2d_1d( npti, nptidx(1:npti), h_s_1d (1:npti)  , zht_s_ini )
252         CALL tab_2d_1d( npti, nptidx(1:npti), at_i_1d(1:npti)  , zat_i_ini )
253         CALL tab_2d_1d( npti, nptidx(1:npti), t_i_1d (1:npti,1), ztm_i_ini )
254         CALL tab_2d_1d( npti, nptidx(1:npti), t_s_1d (1:npti,1), ztm_s_ini )
255         CALL tab_2d_1d( npti, nptidx(1:npti), t_su_1d(1:npti)  , zt_su_ini )
256         CALL tab_2d_1d( npti, nptidx(1:npti), s_i_1d (1:npti)  , zsm_i_ini )
257
258         ! allocate temporary arrays
259         ALLOCATE( zhi_2d(npti,jpl), zhs_2d(npti,jpl), zai_2d (npti,jpl), &
260            &      zti_2d(npti,jpl), zts_2d(npti,jpl), ztsu_2d(npti,jpl), zsi_2d(npti,jpl) )
[8586]261         
[11397]262         ! distribute 1-cat into jpl-cat: (jpi*jpj) -> (jpi*jpj,jpl)
263         CALL ice_var_itd( h_i_1d(1:npti)  , h_s_1d(1:npti)  , at_i_1d(1:npti),                   zhi_2d, zhs_2d, zai_2d , &
264            &              t_i_1d(1:npti,1), t_s_1d(1:npti,1), t_su_1d(1:npti), s_i_1d(1:npti),   zti_2d, zts_2d, ztsu_2d, zsi_2d )
[8586]265
[11397]266         ! move to 3D arrays: (jpi*jpj,jpl) -> (jpi,jpj,jpl)
267         DO jl = 1, jpl
268            zti_3d(:,:,jl) = rt0 * tmask(:,:,1)
269            zts_3d(:,:,jl) = rt0 * tmask(:,:,1)
270         END DO
271         CALL tab_2d_3d( npti, nptidx(1:npti), zhi_2d  , h_i  )
272         CALL tab_2d_3d( npti, nptidx(1:npti), zhs_2d  , h_s  )
273         CALL tab_2d_3d( npti, nptidx(1:npti), zai_2d  , a_i  )
274         CALL tab_2d_3d( npti, nptidx(1:npti), zti_2d  , zti_3d )
275         CALL tab_2d_3d( npti, nptidx(1:npti), zts_2d  , zts_3d )
276         CALL tab_2d_3d( npti, nptidx(1:npti), ztsu_2d , t_su )
277         CALL tab_2d_3d( npti, nptidx(1:npti), zsi_2d  , s_i  )
[10413]278
[11397]279         ! deallocate temporary arrays
280         DEALLOCATE( zhi_2d, zhs_2d, zai_2d , &
281            &        zti_2d, zts_2d, ztsu_2d, zsi_2d )
[8586]282
[11397]283         ! Melt ponds: distribute uniformely over the categories
284         IF ( ln_pnd_CST .OR. ln_pnd_H12 ) THEN
285            DO jl = 1, jpl
286               a_ip_frac(:,:,jl) = zapnd_ini(:,:)
287               h_ip     (:,:,jl) = zhpnd_ini(:,:)
288               a_ip     (:,:,jl) = a_ip_frac(:,:,jl) * a_i (:,:,jl) 
289               v_ip     (:,:,jl) = h_ip     (:,:,jl) * a_ip(:,:,jl)
[10413]290            END DO
291         ENDIF
[11397]292         
293         ! calculate extensive and intensive variables
294         CALL ice_var_salprof ! for sz_i
295         DO jl = 1, jpl
[8586]296            DO jj = 1, jpj
297               DO ji = 1, jpi
298                  v_i (ji,jj,jl) = h_i(ji,jj,jl) * a_i(ji,jj,jl)              ! ice volume
299                  v_s (ji,jj,jl) = h_s(ji,jj,jl) * a_i(ji,jj,jl)              ! snow volume
[11397]300                  sv_i(ji,jj,jl) = MIN( MAX( rn_simin , s_i(ji,jj,jl) ) , rn_simax ) * v_i(ji,jj,jl)
[8586]301               END DO
302            END DO
303         END DO
[8813]304         !
[11397]305         DO jl = 1, jpl
306            DO jk = 1, nlay_s
[8586]307               DO jj = 1, jpj
308                  DO ji = 1, jpi
[11397]309                     t_s(ji,jj,jk,jl) = zts_3d(ji,jj,jl)
310                     e_s(ji,jj,jk,jl) = zswitch(ji,jj) * v_s(ji,jj,jl) * r1_nlay_s * &
311                        &               rhos * ( rcpi * ( rt0 - t_s(ji,jj,jk,jl) ) + rLfus )
[8586]312                  END DO
313               END DO
314            END DO
315         END DO
[8813]316         !
[11397]317         DO jl = 1, jpl
318            DO jk = 1, nlay_i
[8586]319               DO jj = 1, jpj
320                  DO ji = 1, jpi
[11397]321                     t_i (ji,jj,jk,jl) = zti_3d(ji,jj,jl) 
[9935]322                     ztmelts          = - rTmlt * sz_i(ji,jj,jk,jl) + rt0 !Melting temperature in K
[11397]323                     e_i(ji,jj,jk,jl) = zswitch(ji,jj) * v_i(ji,jj,jl) * r1_nlay_i * &
324                        &               rhoi * (  rcpi  * ( ztmelts - t_i(ji,jj,jk,jl) ) + &
325                        &                         rLfus * ( 1._wp - (ztmelts-rt0) / MIN( (t_i(ji,jj,jk,jl)-rt0), -epsi20 ) ) &
326                        &                       - rcp   * ( ztmelts - rt0 ) )
[8586]327                  END DO
328               END DO
329            END DO
330         END DO
[8933]331
[11397]332         ! specific temperatures for coupled runs
333         tn_ice(:,:,:) = t_su(:,:,:)
334         t1_ice(:,:,:) = t_i (:,:,1,:)
[8813]335         !
[8586]336      ENDIF ! ln_iceini
[8813]337      !
[11397]338      at_i(:,:) = SUM( a_i, dim=3 )
[8586]339      !
340      !----------------------------------------------
[11397]341      ! 3) Snow-ice mass (case ice is fully embedded)
[8586]342      !----------------------------------------------
[9935]343      snwice_mass  (:,:) = tmask(:,:,1) * SUM( rhos * v_s(:,:,:) + rhoi * v_i(:,:,:), dim=3  )   ! snow+ice mass
[8586]344      snwice_mass_b(:,:) = snwice_mass(:,:)
345      !
346      IF( ln_ice_embd ) THEN            ! embedded sea-ice: deplete the initial ssh below sea-ice area
[8813]347         !
[8586]348         sshn(:,:) = sshn(:,:) - snwice_mass(:,:) * r1_rau0
349         sshb(:,:) = sshb(:,:) - snwice_mass(:,:) * r1_rau0
[8813]350         !
[8586]351         IF( .NOT.ln_linssh ) THEN
[8813]352            !
[8586]353            WHERE( ht_0(:,:) > 0 )   ;   z2d(:,:) = 1._wp + sshn(:,:)*tmask(:,:,1) / ht_0(:,:)
354            ELSEWHERE                ;   z2d(:,:) = 1._wp   ;   END WHERE
[8813]355            !
[8586]356            DO jk = 1,jpkm1                     ! adjust initial vertical scale factors               
357               e3t_n(:,:,jk) = e3t_0(:,:,jk) * z2d(:,:)
358               e3t_b(:,:,jk) = e3t_n(:,:,jk)
359               e3t_a(:,:,jk) = e3t_n(:,:,jk)
360            END DO
[8813]361            !
[8586]362            ! Reconstruction of all vertical scale factors at now and before time-steps
363            ! =========================================================================
364            ! Horizontal scale factor interpolations
365            ! --------------------------------------
366            CALL dom_vvl_interpol( e3t_b(:,:,:), e3u_b(:,:,:), 'U' )
367            CALL dom_vvl_interpol( e3t_b(:,:,:), e3v_b(:,:,:), 'V' )
368            CALL dom_vvl_interpol( e3t_n(:,:,:), e3u_n(:,:,:), 'U' )
369            CALL dom_vvl_interpol( e3t_n(:,:,:), e3v_n(:,:,:), 'V' )
370            CALL dom_vvl_interpol( e3u_n(:,:,:), e3f_n(:,:,:), 'F' )
371            ! Vertical scale factor interpolations
372            ! ------------------------------------
373            CALL dom_vvl_interpol( e3t_n(:,:,:), e3w_n (:,:,:), 'W'  )
374            CALL dom_vvl_interpol( e3u_n(:,:,:), e3uw_n(:,:,:), 'UW' )
375            CALL dom_vvl_interpol( e3v_n(:,:,:), e3vw_n(:,:,:), 'VW' )
376            CALL dom_vvl_interpol( e3u_b(:,:,:), e3uw_b(:,:,:), 'UW' )
377            CALL dom_vvl_interpol( e3v_b(:,:,:), e3vw_b(:,:,:), 'VW' )
378            ! t- and w- points depth
379            ! ----------------------
380            !!gm not sure of that....
381            gdept_n(:,:,1) = 0.5_wp * e3w_n(:,:,1)
382            gdepw_n(:,:,1) = 0.0_wp
383            gde3w_n(:,:,1) = gdept_n(:,:,1) - sshn(:,:)
384            DO jk = 2, jpk
385               gdept_n(:,:,jk) = gdept_n(:,:,jk-1) + e3w_n(:,:,jk  )
386               gdepw_n(:,:,jk) = gdepw_n(:,:,jk-1) + e3t_n(:,:,jk-1)
387               gde3w_n(:,:,jk) = gdept_n(:,:,jk  ) - sshn (:,:)
388            END DO
389         ENDIF
390      ENDIF
391     
392      !------------------------------------
[11397]393      ! 4) store fields at before time-step
[8586]394      !------------------------------------
395      ! it is only necessary for the 1st interpolation by Agrif
396      a_i_b  (:,:,:)   = a_i  (:,:,:)
397      e_i_b  (:,:,:,:) = e_i  (:,:,:,:)
398      v_i_b  (:,:,:)   = v_i  (:,:,:)
399      v_s_b  (:,:,:)   = v_s  (:,:,:)
400      e_s_b  (:,:,:,:) = e_s  (:,:,:,:)
401      sv_i_b (:,:,:)   = sv_i (:,:,:)
402      oa_i_b (:,:,:)   = oa_i (:,:,:)
403      u_ice_b(:,:)     = u_ice(:,:)
404      v_ice_b(:,:)     = v_ice(:,:)
[10527]405      ! total concentration is needed for Lupkes parameterizations
406      at_i_b (:,:)     = at_i (:,:) 
[8586]407
[8885]408!!clem: output of initial state should be written here but it is impossible because
409!!      the ocean and ice are in the same file
[10425]410!!      CALL dia_wri_state( 'output.init' )
[8813]411      !
[8586]412   END SUBROUTINE ice_istate
413
[8813]414
[8586]415   SUBROUTINE ice_istate_init
416      !!-------------------------------------------------------------------
417      !!                   ***  ROUTINE ice_istate_init  ***
418      !!       
[8813]419      !! ** Purpose :   Definition of initial state of the ice
[8586]420      !!
[8813]421      !! ** Method  :   Read the namini namelist and check the parameter
422      !!              values called at the first timestep (nit000)
[8586]423      !!
[8813]424      !! ** input   :  Namelist namini
[8586]425      !!
426      !!-----------------------------------------------------------------------------
[11263]427      INTEGER ::   ios   ! Local integer output status for namelist read
[8813]428      INTEGER ::   ifpr, ierror
[8586]429      !
430      CHARACTER(len=256) ::  cn_dir          ! Root directory for location of ice files
[11397]431      TYPE(FLD_N)                    ::   sn_hti, sn_hts, sn_ati, sn_tsu, sn_tmi, sn_smi, sn_tms, sn_apd, sn_hpd
[8586]432      TYPE(FLD_N), DIMENSION(jpfldi) ::   slf_i                 ! array of namelist informations on the fields to read
433      !
[11397]434      NAMELIST/namini/ ln_iceini, ln_iceini_file, rn_thres_sst, &
435         &             rn_hts_ini_n, rn_hts_ini_s, rn_hti_ini_n, rn_hti_ini_s, &
436         &             rn_ati_ini_n, rn_ati_ini_s, rn_smi_ini_n, rn_smi_ini_s, &
437         &             rn_tmi_ini_n, rn_tmi_ini_s, rn_tms_ini_n, rn_tms_ini_s, &
438         &             rn_apd_ini_n, rn_apd_ini_s, rn_hpd_ini_n, rn_hpd_ini_s, &
439         &             sn_hti, sn_hts, sn_ati, sn_tsu, sn_tmi, sn_smi, sn_tms, sn_apd, sn_hpd, cn_dir
[8586]440      !!-----------------------------------------------------------------------------
441      !
442      REWIND( numnam_ice_ref )              ! Namelist namini in reference namelist : Ice initial state
443      READ  ( numnam_ice_ref, namini, IOSTAT = ios, ERR = 901)
[11317]444901   IF( ios /= 0 )   CALL ctl_nam ( ios , 'namini in reference namelist' )
[8586]445      REWIND( numnam_ice_cfg )              ! Namelist namini in configuration namelist : Ice initial state
446      READ  ( numnam_ice_cfg, namini, IOSTAT = ios, ERR = 902 )
[11317]447902   IF( ios >  0 )   CALL ctl_nam ( ios , 'namini in configuration namelist' )
[8586]448      IF(lwm) WRITE ( numoni, namini )
[8813]449      !
[8586]450      slf_i(jp_hti) = sn_hti  ;  slf_i(jp_hts) = sn_hts
451      slf_i(jp_ati) = sn_ati  ;  slf_i(jp_tsu) = sn_tsu
452      slf_i(jp_tmi) = sn_tmi  ;  slf_i(jp_smi) = sn_smi
[11397]453      slf_i(jp_tms) = sn_tms  ;
454      slf_i(jp_apd) = sn_apd  ;  slf_i(jp_hpd) = sn_hpd
[8586]455      !
456      IF(lwp) THEN                          ! control print
457         WRITE(numout,*)
458         WRITE(numout,*) 'ice_istate_init: ice parameters inititialisation '
459         WRITE(numout,*) '~~~~~~~~~~~~~~~'
460         WRITE(numout,*) '   Namelist namini:'
[11397]461         WRITE(numout,*) '      ice initialization (T) or not (F)                     ln_iceini       = ', ln_iceini
462         WRITE(numout,*) '      ice initialization from a netcdf file                 ln_iceini_file  = ', ln_iceini_file
463         WRITE(numout,*) '      max delta ocean temp. above Tfreeze with initial ice  rn_thres_sst    = ', rn_thres_sst
464         WRITE(numout,*) '      initial snw thickness in the north                    rn_hts_ini_n    = ', rn_hts_ini_n
465         WRITE(numout,*) '      initial snw thickness in the south                    rn_hts_ini_s    = ', rn_hts_ini_s 
466         WRITE(numout,*) '      initial ice thickness in the north                    rn_hti_ini_n    = ', rn_hti_ini_n
467         WRITE(numout,*) '      initial ice thickness in the south                    rn_hti_ini_s    = ', rn_hti_ini_s
468         WRITE(numout,*) '      initial ice concentr  in the north                    rn_ati_ini_n    = ', rn_ati_ini_n
469         WRITE(numout,*) '      initial ice concentr  in the north                    rn_ati_ini_s    = ', rn_ati_ini_s
470         WRITE(numout,*) '      initial ice salinity  in the north                    rn_smi_ini_n    = ', rn_smi_ini_n
471         WRITE(numout,*) '      initial ice salinity  in the south                    rn_smi_ini_s    = ', rn_smi_ini_s
472         WRITE(numout,*) '      initial ice temperat  in the north                    rn_tmi_ini_n    = ', rn_tmi_ini_n
473         WRITE(numout,*) '      initial ice temperat  in the south                    rn_tmi_ini_s    = ', rn_tmi_ini_s
474         WRITE(numout,*) '      initial snw temperat  in the north                    rn_tms_ini_n    = ', rn_tms_ini_n
475         WRITE(numout,*) '      initial snw temperat  in the south                    rn_tms_ini_s    = ', rn_tms_ini_s
476         WRITE(numout,*) '      initial pnd fraction  in the north                    rn_apd_ini_n    = ', rn_apd_ini_n
477         WRITE(numout,*) '      initial pnd fraction  in the south                    rn_apd_ini_s    = ', rn_apd_ini_s
478         WRITE(numout,*) '      initial pnd depth     in the north                    rn_hpd_ini_n    = ', rn_hpd_ini_n
479         WRITE(numout,*) '      initial pnd depth     in the south                    rn_hpd_ini_s    = ', rn_hpd_ini_s
[8586]480      ENDIF
[8813]481      !
[8586]482      IF( ln_iceini_file ) THEN                      ! Ice initialization using input file
483         !
484         ! set si structure
485         ALLOCATE( si(jpfldi), STAT=ierror )
486         IF( ierror > 0 ) THEN
[11397]487            CALL ctl_stop( 'ice_istate_ini in iceistate: unable to allocate si structure' )   ;   RETURN
[8586]488         ENDIF
[8813]489         !
[8586]490         DO ifpr = 1, jpfldi
491            ALLOCATE( si(ifpr)%fnow(jpi,jpj,1) )
[11397]492            IF( slf_i(ifpr)%ln_tint )  ALLOCATE( si(ifpr)%fdta(jpi,jpj,1,2) )
[8586]493         END DO
[8813]494         !
[8586]495         ! fill si with slf_i and control print
[11397]496         CALL fld_fill( si, slf_i, cn_dir, 'ice_istate_ini', 'initialization of sea ice fields', 'numnam_ice' )
[8813]497         !
[8586]498      ENDIF
[8813]499      !
[8586]500   END SUBROUTINE ice_istate_init
501
502#else
503   !!----------------------------------------------------------------------
[9570]504   !!   Default option :         Empty module         NO SI3 sea-ice model
[8586]505   !!----------------------------------------------------------------------
506#endif
507
508   !!======================================================================
509END MODULE iceistate
Note: See TracBrowser for help on using the repository browser.