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.
sbcisf.F90 in branches/2015/dev_merge_2015/NEMOGCM/NEMO/OPA_SRC/SBC – NEMO

source: branches/2015/dev_merge_2015/NEMOGCM/NEMO/OPA_SRC/SBC/sbcisf.F90 @ 6069

Last change on this file since 6069 was 6069, checked in by timgraham, 8 years ago

Merge of dev_MetOffice_merge_2015 into branch (only NEMO directory for now).

  • Property svn:keywords set to Id
File size: 40.6 KB
Line 
1MODULE sbcisf
2   !!======================================================================
3   !!                       ***  MODULE  sbcisf  ***
4   !! Surface module :  update surface ocean boundary condition under ice
5   !!                   shelf
6   !!======================================================================
7   !! History :  3.2   !  2011-02  (C.Harris  ) Original code isf cav
8   !!            X.X   !  2006-02  (C. Wang   ) Original code bg03
9   !!            3.4   !  2013-03  (P. Mathiot) Merging + parametrization
10   !!----------------------------------------------------------------------
11
12   !!----------------------------------------------------------------------
13   !!   sbc_isf        : update sbc under ice shelf
14   !!----------------------------------------------------------------------
15   USE oce             ! ocean dynamics and tracers
16   USE dom_oce         ! ocean space and time domain
17   USE phycst          ! physical constants
18   USE eosbn2          ! equation of state
19   USE sbc_oce         ! surface boundary condition: ocean fields
20   USE zdfbfr          !
21   !
22   USE in_out_manager  ! I/O manager
23   USE iom             ! I/O manager library
24   USE fldread         ! read input field at current time step
25   USE lbclnk          !
26   USE wrk_nemo        ! Memory allocation
27   USE timing          ! Timing
28   USE lib_fortran     ! glob_sum
29
30   IMPLICIT NONE
31   PRIVATE
32
33   PUBLIC   sbc_isf, sbc_isf_div, sbc_isf_alloc  ! routine called in sbcmod and divhor
34
35   ! public in order to be able to output then
36
37   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::   risf_tsc_b, risf_tsc  !: before and now T & S isf contents [K.m/s & PSU.m/s] 
38   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:)   ::   qisf                  !: net heat flux from ice shelf      [W/m2]
39   REAL(wp), PUBLIC ::   rn_hisf_tbl                 !: thickness of top boundary layer [m]
40   INTEGER , PUBLIC ::   nn_isf                      !: flag to choose between explicit/param/specified 
41   INTEGER , PUBLIC ::   nn_isfblk                   !: flag to choose the bulk formulation to compute the ice shelf melting
42   INTEGER , PUBLIC ::   nn_gammablk                 !: flag to choose how the exchange coefficient is computed
43   REAL(wp), PUBLIC ::   rn_gammat0                  !: temperature exchange coeficient []
44   REAL(wp), PUBLIC ::   rn_gammas0                  !: salinity    exchange coeficient []
45
46   REAL(wp)   , PUBLIC, ALLOCATABLE, SAVE, DIMENSION (:,:)     ::  rzisf_tbl              !:depth of calving front (shallowest point) nn_isf ==2/3
47   REAL(wp)   , PUBLIC, ALLOCATABLE, SAVE, DIMENSION (:,:)     ::  rhisf_tbl, rhisf_tbl_0 !:thickness of tbl  [m]
48   REAL(wp)   , PUBLIC, ALLOCATABLE, SAVE, DIMENSION (:,:)     ::  r1_hisf_tbl            !:1/thickness of tbl
49   REAL(wp)   , PUBLIC, ALLOCATABLE, SAVE, DIMENSION (:,:)     ::  ralpha                 !:proportion of bottom cell influenced by tbl
50   REAL(wp)   , PUBLIC, ALLOCATABLE, SAVE, DIMENSION (:,:)     ::  risfLeff               !:effective length (Leff) BG03 nn_isf==2
51   REAL(wp)   , PUBLIC, ALLOCATABLE, SAVE, DIMENSION (:,:)     ::  ttbl, stbl, utbl, vtbl !:top boundary layer variable at T point
52   INTEGER,    PUBLIC, ALLOCATABLE, SAVE, DIMENSION (:,:)      ::  misfkt, misfkb         !:Level of ice shelf base
53
54   REAL(wp), PUBLIC, SAVE ::   rcpi     = 2000.0_wp     ! specific heat of ice shelf             [J/kg/K]
55   REAL(wp), PUBLIC, SAVE ::   rkappa   = 1.54e-6_wp    ! heat diffusivity through the ice-shelf [m2/s]
56   REAL(wp), PUBLIC, SAVE ::   rhoisf   = 920.0_wp      ! volumic mass of ice shelf              [kg/m3]
57   REAL(wp), PUBLIC, SAVE ::   tsurf    = -20.0_wp      ! air temperature on top of ice shelf    [C]
58   REAL(wp), PUBLIC, SAVE ::   rlfusisf = 0.334e6_wp    ! latent heat of fusion of ice shelf     [J/kg]
59
60!: Variable used in fldread to read the forcing file (nn_isf == 4 .OR. nn_isf == 3)
61   CHARACTER(len=100), PUBLIC           :: cn_dirisf  = './' !: Root directory for location of ssr files
62   TYPE(FLD_N)       , PUBLIC           :: sn_fwfisf         !: information about the isf melting file to be read
63   TYPE(FLD), ALLOCATABLE, DIMENSION(:) :: sf_fwfisf
64   TYPE(FLD_N)       , PUBLIC           :: sn_rnfisf         !: information about the isf melting param.   file to be read
65   TYPE(FLD), ALLOCATABLE, DIMENSION(:) :: sf_rnfisf           
66   TYPE(FLD_N)       , PUBLIC           :: sn_depmax_isf     !: information about the grounding line depth file to be read
67   TYPE(FLD_N)       , PUBLIC           :: sn_depmin_isf     !: information about the calving   line depth file to be read
68   TYPE(FLD_N)       , PUBLIC           :: sn_Leff_isf       !: information about the effective length     file to be read
69   
70   !!----------------------------------------------------------------------
71   !! NEMO/OPA 3.7 , LOCEAN-IPSL (2015)
72   !! $Id$
73   !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt)
74   !!----------------------------------------------------------------------
75CONTAINS
76 
77  SUBROUTINE sbc_isf(kt)
78      !!---------------------------------------------------------------------
79      !!                  ***  ROUTINE sbc_isf  ***
80      !!
81      !! ** Purpose : Compute Salt and Heat fluxes related to ice_shelf
82      !!              melting and freezing
83      !!
84      !! ** Method  :  4 parameterizations are available according to nn_isf
85      !!               nn_isf = 1 : Realistic ice_shelf formulation
86      !!                        2 : Beckmann & Goose parameterization
87      !!                        3 : Specified runoff in deptht (Mathiot & al. )
88      !!                        4 : specified fwf and heat flux forcing beneath the ice shelf
89      !!----------------------------------------------------------------------
90      INTEGER, INTENT( in ) :: kt                   ! ocean time step
91      !
92      INTEGER               :: ji, jj               ! loop index
93      REAL(wp), DIMENSION (:,:), POINTER :: zt_frz, zdep ! freezing temperature (zt_frz) at depth (zdep)
94      !!---------------------------------------------------------------------
95      !
96      !                                         ! ====================== !
97      IF( kt == nit000 ) THEN                   !  First call kt=nit000  !
98         !                                      ! ====================== !
99         CALL sbc_isf_init
100      !                                         ! ---------------------------------------- !
101      ELSE                                      !          Swap of forcing fields          !
102         !                                      ! ---------------------------------------- !
103         fwfisf_b  (:,:  ) = fwfisf  (:,:  )    ! Swap the ocean forcing fields except at nit000
104         risf_tsc_b(:,:,:) = risf_tsc(:,:,:)    ! where before fields are set at the end of the routine
105         !
106      END IF
107
108      IF( MOD( kt-1, nn_fsbc) == 0 ) THEN
109         ! allocation
110         CALL wrk_alloc( jpi,jpj, zt_frz, zdep  )
111
112         ! compute salt and heat flux
113         SELECT CASE ( nn_isf )
114         CASE ( 1 )    ! realistic ice shelf formulation
115            ! compute T/S/U/V for the top boundary layer
116            CALL sbc_isf_tbl(tsn(:,:,:,jp_tem),ttbl(:,:),'T')
117            CALL sbc_isf_tbl(tsn(:,:,:,jp_sal),stbl(:,:),'T')
118            CALL sbc_isf_tbl(un(:,:,:)        ,utbl(:,:),'U')
119            CALL sbc_isf_tbl(vn(:,:,:)        ,vtbl(:,:),'V')
120            ! iom print
121            CALL iom_put('ttbl',ttbl(:,:))
122            CALL iom_put('stbl',stbl(:,:))
123            CALL iom_put('utbl',utbl(:,:) * (1._wp - tmask(:,:,1)) * ssmask(:,:))
124            CALL iom_put('vtbl',vtbl(:,:) * (1._wp - tmask(:,:,1)) * ssmask(:,:))
125            ! compute fwf and heat flux
126            CALL sbc_isf_cav (kt)
127
128         CASE ( 2 )    ! Beckmann and Goosse parametrisation
129            stbl(:,:)   = soce
130            CALL sbc_isf_bg03(kt)
131
132         CASE ( 3 )    ! specified runoff in depth (Mathiot et al., XXXX in preparation)
133            CALL fld_read ( kt, nn_fsbc, sf_rnfisf   )
134            fwfisf(:,:) = - sf_rnfisf(1)%fnow(:,:,1)         ! fwf  flux from the isf (fwfisf <0 mean melting)
135            qisf(:,:)   = fwfisf(:,:) * rlfusisf             ! heat flux
136            stbl(:,:)   = soce
137
138         CASE ( 4 )    ! specified fwf and heat flux forcing beneath the ice shelf
139            CALL fld_read ( kt, nn_fsbc, sf_fwfisf   )
140            fwfisf(:,:) = - sf_fwfisf(1)%fnow(:,:,1)           ! fwf  flux from the isf (fwfisf <0 mean melting)
141            qisf(:,:)   = fwfisf(:,:) * rlfusisf               ! heat flux
142            stbl(:,:)   = soce
143
144         END SELECT
145
146         ! compute tsc due to isf
147         ! isf melting implemented as a volume flux and we assume that melt water is at 0 PSU.
148         ! WARNING water add at temp = 0C, need to add a correction term (fwfisf * tfreez / rau0).
149         ! compute freezing point beneath ice shelf (or top cell if nn_isf = 3)
150         DO jj = 1,jpj
151            DO ji = 1,jpi
152               zdep(ji,jj)=fsdepw_n(ji,jj,misfkt(ji,jj))
153            END DO
154         END DO
155         CALL eos_fzp( stbl(:,:), zt_frz(:,:), zdep(:,:) )
156         
157         risf_tsc(:,:,jp_tem) = qisf(:,:) * r1_rau0_rcp - fwfisf(:,:) * zt_frz(:,:) * r1_rau0 !
158         risf_tsc(:,:,jp_sal) = 0.0_wp
159
160         ! lbclnk
161         CALL lbc_lnk(risf_tsc(:,:,jp_tem),'T',1.)
162         CALL lbc_lnk(risf_tsc(:,:,jp_sal),'T',1.)
163         CALL lbc_lnk(fwfisf(:,:)         ,'T',1.)
164         CALL lbc_lnk(qisf(:,:)           ,'T',1.)
165
166         IF( kt == nit000 ) THEN                         !   set the forcing field at nit000 - 1    !
167            IF( ln_rstart .AND.    &                     ! Restart: read in restart file
168                 & iom_varid( numror, 'fwf_isf_b', ldstop = .FALSE. ) > 0 ) THEN
169               IF(lwp) WRITE(numout,*) '          nit000-1 isf tracer content forcing fields read in the restart file'
170               CALL iom_get( numror, jpdom_autoglo, 'fwf_isf_b', fwfisf_b(:,:) )   ! before salt content isf_tsc trend
171               CALL iom_get( numror, jpdom_autoglo, 'isf_sc_b', risf_tsc_b(:,:,jp_sal) )   ! before salt content isf_tsc trend
172               CALL iom_get( numror, jpdom_autoglo, 'isf_hc_b', risf_tsc_b(:,:,jp_tem) )   ! before salt content isf_tsc trend
173            ELSE
174               fwfisf_b(:,:)    = fwfisf(:,:)
175               risf_tsc_b(:,:,:)= risf_tsc(:,:,:)
176            END IF
177         END IF
178         !
179         ! output
180         CALL iom_put('qisf'  , qisf)
181         CALL iom_put('fwfisf', fwfisf)
182
183         ! deallocation
184         CALL wrk_dealloc( jpi,jpj, zt_frz, zdep  )
185      END IF
186     
187  END SUBROUTINE sbc_isf
188
189
190  INTEGER FUNCTION sbc_isf_alloc()
191      !!----------------------------------------------------------------------
192      !!               ***  FUNCTION sbc_isf_rnf_alloc  ***
193      !!----------------------------------------------------------------------
194      sbc_isf_alloc = 0       ! set to zero if no array to be allocated
195      IF( .NOT. ALLOCATED( qisf ) ) THEN
196         ALLOCATE(  risf_tsc(jpi,jpj,jpts), risf_tsc_b(jpi,jpj,jpts), qisf(jpi,jpj)   , &
197               &    rhisf_tbl(jpi,jpj)    , r1_hisf_tbl(jpi,jpj), rzisf_tbl(jpi,jpj)  , &
198               &    ttbl(jpi,jpj)         , stbl(jpi,jpj)       , utbl(jpi,jpj)       , &
199               &    vtbl(jpi, jpj)        , risfLeff(jpi,jpj)   , rhisf_tbl_0(jpi,jpj), &
200               &    ralpha(jpi,jpj)       , misfkt(jpi,jpj)     , misfkb(jpi,jpj)     , &
201               &    STAT= sbc_isf_alloc )
202         !
203         IF( lk_mpp             )   CALL mpp_sum ( sbc_isf_alloc )
204         IF( sbc_isf_alloc /= 0 )   CALL ctl_warn('sbc_isf_alloc: failed to allocate arrays.')
205         !
206      END IF
207  END FUNCTION
208
209  SUBROUTINE sbc_isf_init
210      !!---------------------------------------------------------------------
211      !!                  ***  ROUTINE sbc_isf_init  ***
212      !!
213      !! ** Purpose : Initialisation of variables for iceshelf fluxes formulation
214      !!
215      !! ** Method  :  4 parameterizations are available according to nn_isf
216      !!               nn_isf = 1 : Realistic ice_shelf formulation
217      !!                        2 : Beckmann & Goose parameterization
218      !!                        3 : Specified runoff in deptht (Mathiot & al. )
219      !!                        4 : specified fwf and heat flux forcing beneath the ice shelf
220      !!----------------------------------------------------------------------
221      INTEGER               :: ji, jj, jk           ! loop index
222      INTEGER               :: ik                   ! current level index
223      INTEGER               :: ikt, ikb             ! top and bottom level of the isf boundary layer
224      INTEGER               :: inum, ierror
225      INTEGER               :: ios                  ! Local integer output status for namelist read
226      REAL(wp)              :: zhk
227      CHARACTER(len=256)    :: cvarzisf, cvarhisf   ! name for isf file
228      CHARACTER(LEN=32 )    :: cvarLeff             ! variable name for efficient Length scale
229      !!----------------------------------------------------------------------
230      NAMELIST/namsbc_isf/ nn_isfblk, rn_hisf_tbl, rn_gammat0, rn_gammas0, nn_gammablk, nn_isf, &
231                         & sn_fwfisf, sn_rnfisf, sn_depmax_isf, sn_depmin_isf, sn_Leff_isf
232      !!----------------------------------------------------------------------
233
234      REWIND( numnam_ref )              ! Namelist namsbc_rnf in reference namelist : Runoffs
235      READ  ( numnam_ref, namsbc_isf, IOSTAT = ios, ERR = 901)
236901   IF( ios /= 0 ) CALL ctl_nam ( ios , 'namsbc_isf in reference namelist', lwp )
237
238      REWIND( numnam_cfg )              ! Namelist namsbc_rnf in configuration namelist : Runoffs
239      READ  ( numnam_cfg, namsbc_isf, IOSTAT = ios, ERR = 902 )
240902   IF( ios /= 0 ) CALL ctl_nam ( ios , 'namsbc_isf in configuration namelist', lwp )
241      IF(lwm) WRITE ( numond, namsbc_isf )
242
243      IF ( lwp ) WRITE(numout,*)
244      IF ( lwp ) WRITE(numout,*) 'sbc_isf: heat flux of the ice shelf'
245      IF ( lwp ) WRITE(numout,*) '~~~~~~~~~'
246      IF ( lwp ) WRITE(numout,*) 'sbcisf :' 
247      IF ( lwp ) WRITE(numout,*) '~~~~~~~~'
248      IF ( lwp ) WRITE(numout,*) '        nn_isf      = ', nn_isf
249      IF ( lwp ) WRITE(numout,*) '        nn_isfblk   = ', nn_isfblk
250      IF ( lwp ) WRITE(numout,*) '        rn_hisf_tbl = ', rn_hisf_tbl
251      IF ( lwp ) WRITE(numout,*) '        nn_gammablk = ', nn_gammablk 
252      IF ( lwp ) WRITE(numout,*) '        rn_gammat0  = ', rn_gammat0 
253      IF ( lwp ) WRITE(numout,*) '        rn_gammas0  = ', rn_gammas0 
254      IF ( lwp ) WRITE(numout,*) '        rn_tfri2    = ', rn_tfri2 
255      !
256      ! Allocate public variable
257      IF ( sbc_isf_alloc()  /= 0 )         CALL ctl_stop( 'STOP', 'sbc_isf : unable to allocate arrays' )
258      !
259      ! initialisation
260      qisf(:,:)        = 0._wp  ; fwfisf  (:,:) = 0._wp
261      risf_tsc(:,:,:)  = 0._wp  ; fwfisf_b(:,:) = 0._wp
262      !
263      ! define isf tbl tickness, top and bottom indice
264      SELECT CASE ( nn_isf )
265      CASE ( 1 ) 
266         rhisf_tbl(:,:) = rn_hisf_tbl
267         misfkt(:,:)    = mikt(:,:)         ! same indice for bg03 et cav => used in isfdiv
268
269      CASE ( 2 , 3 )
270         ALLOCATE( sf_rnfisf(1), STAT=ierror )
271         ALLOCATE( sf_rnfisf(1)%fnow(jpi,jpj,1), sf_rnfisf(1)%fdta(jpi,jpj,1,2) )
272         CALL fld_fill( sf_rnfisf, (/ sn_rnfisf /), cn_dirisf, 'sbc_isf_init', 'read fresh water flux isf data', 'namsbc_isf' )
273
274         !  read effective lenght (BG03)
275         IF (nn_isf == 2) THEN
276            CALL iom_open( sn_Leff_isf%clname, inum )
277            cvarLeff = TRIM(sn_Leff_isf%clvar)
278            CALL iom_get( inum, jpdom_data, cvarLeff, risfLeff , 1)
279            CALL iom_close(inum)
280            !
281            risfLeff = risfLeff*1000.0_wp           !: convertion in m
282         END IF
283
284         ! read depth of the top and bottom of the isf top boundary layer (in this case, isf front depth and grounding line depth)
285         CALL iom_open( sn_depmax_isf%clname, inum )
286         cvarhisf = TRIM(sn_depmax_isf%clvar)
287         CALL iom_get( inum, jpdom_data, cvarhisf, rhisf_tbl, 1) !: depth of deepest point of the ice shelf base
288         CALL iom_close(inum)
289         !
290         CALL iom_open( sn_depmin_isf%clname, inum )
291         cvarzisf = TRIM(sn_depmin_isf%clvar)
292         CALL iom_get( inum, jpdom_data, cvarzisf, rzisf_tbl, 1) !: depth of shallowest point of the ice shelves base
293         CALL iom_close(inum)
294         !
295         rhisf_tbl(:,:) = rhisf_tbl(:,:) - rzisf_tbl(:,:)        !: tickness isf boundary layer
296
297         !! compute first level of the top boundary layer
298         DO ji = 1, jpi
299            DO jj = 1, jpj
300                ik = 2
301                DO WHILE ( ik <= mbkt(ji,jj) .AND. fsdepw(ji,jj,ik) < rzisf_tbl(ji,jj) ) ;  ik = ik + 1 ;  END DO
302                misfkt(ji,jj) = ik-1
303            END DO
304         END DO
305
306      CASE ( 4 ) 
307         ! as in nn_isf == 1
308         rhisf_tbl(:,:) = rn_hisf_tbl
309         misfkt(:,:)    = mikt(:,:)         ! same indice for bg03 et cav => used in isfdiv
310         
311         ! load variable used in fldread (use for temporal interpolation of isf fwf forcing)
312         ALLOCATE( sf_fwfisf(1), STAT=ierror )
313         ALLOCATE( sf_fwfisf(1)%fnow(jpi,jpj,1), sf_fwfisf(1)%fdta(jpi,jpj,1,2) )
314         CALL fld_fill( sf_fwfisf, (/ sn_fwfisf /), cn_dirisf, 'sbc_isf_init', 'read fresh water flux isf data', 'namsbc_isf' )
315
316      END SELECT
317         
318      rhisf_tbl_0(:,:) = rhisf_tbl(:,:)
319
320      ! compute bottom level of isf tbl and thickness of tbl below the ice shelf
321      DO jj = 1,jpj
322         DO ji = 1,jpi
323            ikt = misfkt(ji,jj)
324            ikb = misfkt(ji,jj)
325            ! thickness of boundary layer at least the top level thickness
326            rhisf_tbl(ji,jj) = MAX(rhisf_tbl_0(ji,jj), fse3t_n(ji,jj,ikt))
327
328            ! determine the deepest level influenced by the boundary layer
329            DO jk = ikt+1, mbkt(ji,jj)
330               IF ( (SUM(fse3t_n(ji,jj,ikt:jk-1)) < rhisf_tbl(ji,jj)) .AND. (tmask(ji,jj,jk) == 1) ) ikb = jk
331            END DO
332            rhisf_tbl(ji,jj) = MIN(rhisf_tbl(ji,jj), SUM(fse3t_n(ji,jj,ikt:ikb))) ! limit the tbl to water thickness.
333            misfkb(ji,jj) = ikb                                                   ! last wet level of the tbl
334            r1_hisf_tbl(ji,jj) = 1._wp / rhisf_tbl(ji,jj)
335
336            zhk           = SUM( fse3t(ji, jj, ikt:ikb - 1)) * r1_hisf_tbl(ji,jj) ! proportion of tbl cover by cell from ikt to ikb - 1
337            ralpha(ji,jj) = rhisf_tbl(ji,jj) * (1._wp - zhk ) / fse3t(ji,jj,ikb)  ! proportion of bottom cell influenced by boundary layer
338         END DO
339      END DO
340
341  END SUBROUTINE sbc_isf_init
342
343  SUBROUTINE sbc_isf_bg03(kt)
344      !!---------------------------------------------------------------------
345      !!                  ***  ROUTINE sbc_isf_bg03  ***
346      !!
347      !! ** Purpose : add net heat and fresh water flux from ice shelf melting
348      !!          into the adjacent ocean
349      !!
350      !! ** Method  :   See reference
351      !!
352      !! ** Reference : Beckmann and Goosse (2003), "A parameterization of ice shelf-ocean
353      !!         interaction for climate models", Ocean Modelling 5(2003) 157-170.
354      !!         (hereafter BG)
355      !! History :
356      !!         06-02  (C. Wang) Original code
357      !!----------------------------------------------------------------------
358      INTEGER, INTENT ( in ) :: kt
359      !
360      INTEGER  :: ji, jj, jk ! dummy loop index
361      INTEGER  :: ik         ! current level
362      REAL(wp) :: zt_sum     ! sum of the temperature between 200m and 600m
363      REAL(wp) :: zt_ave     ! averaged temperature between 200m and 600m
364      REAL(wp) :: zt_frz     ! freezing point temperature at depth z
365      REAL(wp) :: zpress     ! pressure to compute the freezing point in depth
366      !!----------------------------------------------------------------------
367
368      IF ( nn_timing == 1 ) CALL timing_start('sbc_isf_bg03')
369      !
370      DO ji = 1, jpi
371         DO jj = 1, jpj
372            ik = misfkt(ji,jj)
373            !! Initialize arrays to 0 (each step)
374            zt_sum = 0.e0_wp
375            IF ( ik > 1 ) THEN
376               ! 1. -----------the average temperature between 200m and 600m ---------------------
377               DO jk = misfkt(ji,jj),misfkb(ji,jj)
378                  ! freezing point temperature  at ice shelf base BG eq. 2 (JMM sign pb ??? +7.64e-4 !!!)
379                  ! after verif with UNESCO, wrong sign in BG eq. 2
380                  ! Calculate freezing temperature
381                  CALL eos_fzp(stbl(ji,jj), zt_frz, zpress) 
382                  zt_sum = zt_sum + (tsn(ji,jj,jk,jp_tem)-zt_frz) * e3t_n(ji,jj,jk) * tmask(ji,jj,jk)  ! sum temp
383               END DO
384               zt_ave = zt_sum/rhisf_tbl(ji,jj) ! calcul mean value
385               ! 2. ------------Net heat flux and fresh water flux due to the ice shelf
386               ! For those corresponding to zonal boundary   
387               qisf(ji,jj) = - rau0 * rcp * rn_gammat0 * risfLeff(ji,jj) * e1t(ji,jj) * zt_ave  &
388                           & * r1_e1e2t(ji,jj) * tmask(ji,jj,jk)
389             
390               fwfisf(ji,jj) = qisf(ji,jj) / rlfusisf          !fresh water flux kg/(m2s)                 
391               fwfisf(ji,jj) = fwfisf(ji,jj) * ( soce / stbl(ji,jj) )
392               !add to salinity trend
393            ELSE
394               qisf(ji,jj) = 0._wp ; fwfisf(ji,jj) = 0._wp
395            END IF
396         END DO
397      END DO
398      !
399      IF( nn_timing == 1 )  CALL timing_stop('sbc_isf_bg03')
400      !
401  END SUBROUTINE sbc_isf_bg03
402
403  SUBROUTINE sbc_isf_cav( kt )
404      !!---------------------------------------------------------------------
405      !!                     ***  ROUTINE sbc_isf_cav  ***
406      !!
407      !! ** Purpose :   handle surface boundary condition under ice shelf
408      !!
409      !! ** Method  : -
410      !!
411      !! ** Action  :   utau, vtau : remain unchanged
412      !!                taum, wndm : remain unchanged
413      !!                qns        : update heat flux below ice shelf
414      !!                emp, emps  : update freshwater flux below ice shelf
415      !!---------------------------------------------------------------------
416      INTEGER, INTENT(in)          ::   kt         ! ocean time step
417      !
418      INTEGER  ::   ji, jj     ! dummy loop indices
419      INTEGER  ::   nit
420      REAL(wp) ::   zlamb1, zlamb2, zlamb3
421      REAL(wp) ::   zeps1,zeps2,zeps3,zeps4,zeps6,zeps7
422      REAL(wp) ::   zaqe,zbqe,zcqe,zaqer,zdis,zsfrz,zcfac
423      REAL(wp) ::   zeps = 1.e-20_wp       
424      REAL(wp) ::   zerr
425      REAL(wp), DIMENSION(:,:), POINTER ::   zfrz
426      REAL(wp), DIMENSION(:,:), POINTER ::   zgammat, zgammas 
427      REAL(wp), DIMENSION(:,:), POINTER ::   zfwflx, zhtflx, zhtflx_b
428      LOGICAL  ::   lit
429      !!---------------------------------------------------------------------
430      ! coeficient for linearisation of potential tfreez
431      ! Crude approximation for pressure (but commonly used)
432      zlamb1 =-0.0573_wp
433      zlamb2 = 0.0832_wp
434      zlamb3 =-7.53e-08_wp * grav * rau0
435      IF( nn_timing == 1 )  CALL timing_start('sbc_isf_cav')
436      !
437      CALL wrk_alloc( jpi,jpj, zfrz  , zgammat, zgammas  )
438      CALL wrk_alloc( jpi,jpj, zfwflx, zhtflx , zhtflx_b )
439
440      ! initialisation
441      zgammat(:,:) = rn_gammat0 ; zgammas (:,:) = rn_gammas0
442      zhtflx (:,:) = 0.0_wp     ; zhtflx_b(:,:) = 0.0_wp   
443      zfwflx (:,:) = 0.0_wp
444
445      ! compute ice shelf melting
446      nit = 1 ; lit = .TRUE.
447      DO WHILE ( lit )    ! maybe just a constant number of iteration as in blk_core is fine
448         SELECT CASE ( nn_isfblk )
449         CASE ( 1 )   !  ISOMIP formulation (2 equations) for volume flux (Hunter et al., 2006)
450            ! Calculate freezing temperature
451            CALL eos_fzp( stbl(:,:), zfrz(:,:), risfdep(:,:) )
452
453            ! compute gammat every where (2d)
454            CALL sbc_isf_gammats(zgammat, zgammas, zhtflx, zfwflx)
455           
456            ! compute upward heat flux zhtflx and upward water flux zwflx
457            DO jj = 1, jpj
458               DO ji = 1, jpi
459                  zhtflx(ji,jj) =   zgammat(ji,jj)*rcp*rau0*(ttbl(ji,jj)-zfrz(ji,jj))
460                  zfwflx(ji,jj) = - zhtflx(ji,jj)/rlfusisf
461               END DO
462            END DO
463
464            ! Compute heat flux and upward fresh water flux
465            qisf  (:,:) = - zhtflx(:,:) * (1._wp - tmask(:,:,1)) * ssmask(:,:)
466            fwfisf(:,:) =   zfwflx(:,:) * (1._wp - tmask(:,:,1)) * ssmask(:,:)
467
468         CASE ( 2 )  ! ISOMIP+ formulation (3 equations) for volume flux (Asay-Davis et al., 2015)
469            ! compute gammat every where (2d)
470            CALL sbc_isf_gammats(zgammat, zgammas, zhtflx, zfwflx)
471
472            ! compute upward heat flux zhtflx and upward water flux zwflx
473            ! Resolution of a 2d equation from equation 21, 22 and 23 to find Sb (Asay-Davis et al., 2015)
474            DO jj = 1, jpj
475               DO ji = 1, jpi
476                  ! compute coeficient to solve the 2nd order equation
477                  zeps1 = rcp*rau0*zgammat(ji,jj)
478                  zeps2 = rlfusisf*rau0*zgammas(ji,jj)
479                  zeps3 = rhoisf*rcpi*rkappa/MAX(risfdep(ji,jj),zeps)
480                  zeps4 = zlamb2+zlamb3*risfdep(ji,jj)
481                  zeps6 = zeps4-ttbl(ji,jj)
482                  zeps7 = zeps4-tsurf
483                  zaqe  = zlamb1 * (zeps1 + zeps3)
484                  zaqer = 0.5_wp/MIN(zaqe,-zeps)
485                  zbqe  = zeps1*zeps6+zeps3*zeps7-zeps2
486                  zcqe  = zeps2*stbl(ji,jj)
487                  zdis  = zbqe*zbqe-4.0_wp*zaqe*zcqe               
488
489                  ! Presumably zdis can never be negative because gammas is very small compared to gammat
490                  ! compute s freeze
491                  zsfrz=(-zbqe-SQRT(zdis))*zaqer
492                  IF ( zsfrz < 0.0_wp ) zsfrz=(-zbqe+SQRT(zdis))*zaqer
493
494                  ! compute t freeze (eq. 22)
495                  zfrz(ji,jj)=zeps4+zlamb1*zsfrz
496 
497                  ! zfwflx is upward water flux
498                  ! zhtflx is upward heat flux (out of ocean)
499                  ! compute the upward water and heat flux (eq. 28 and eq. 29)
500                  zfwflx(ji,jj) = rau0 * zgammas(ji,jj) * (zsfrz-stbl(ji,jj)) / MAX(zsfrz,zeps)
501                  zhtflx(ji,jj) = zgammat(ji,jj) * rau0 * rcp * (ttbl(ji,jj) - zfrz(ji,jj) ) 
502               END DO
503            END DO
504
505            ! compute heat and water flux
506            qisf  (:,:) = - zhtflx(:,:) * (1._wp - tmask(:,:,1)) * ssmask(:,:)
507            fwfisf(:,:) =   zfwflx(:,:) * (1._wp - tmask(:,:,1)) * ssmask(:,:)
508
509         END SELECT
510
511         ! define if we need to iterate (nn_gammablk 0/1 do not need iteration)
512         IF ( nn_gammablk <  2 ) THEN ; lit = .FALSE.
513         ELSE                           
514            ! check total number of iteration
515            IF (nit >= 100) THEN ; CALL ctl_stop( 'STOP', 'sbc_isf_hol99 : too many iteration ...' )
516            ELSE                 ; nit = nit + 1
517            END IF
518
519            ! compute error between 2 iterations
520            ! if needed save gammat and compute zhtflx_b for next iteration
521            zerr = MAXVAL(ABS(zhtflx-zhtflx_b))
522            IF ( zerr <= 0.01_wp ) THEN ; lit = .FALSE.
523            ELSE                        ; zhtflx_b(:,:) = zhtflx(:,:)
524            END IF
525         END IF
526      END DO
527      !
528      CALL iom_put('isfgammat', zgammat)
529      CALL iom_put('isfgammas', zgammas)
530      !
531      CALL wrk_dealloc( jpi,jpj, zfrz  , zgammat, zgammas  )
532      CALL wrk_dealloc( jpi,jpj, zfwflx, zhtflx , zhtflx_b )
533      !
534      IF( nn_timing == 1 )  CALL timing_stop('sbc_isf_cav')
535      !
536   END SUBROUTINE sbc_isf_cav
537
538   SUBROUTINE sbc_isf_gammats(pgt, pgs, pqhisf, pqwisf )
539      !!----------------------------------------------------------------------
540      !! ** Purpose    : compute the coefficient echange for heat flux
541      !!
542      !! ** Method     : gamma assume constant or depends of u* and stability
543      !!
544      !! ** References : Holland and Jenkins, 1999, JPO, p1787-1800, eq 14
545      !!                Jenkins et al., 2010, JPO, p2298-2312
546      !!---------------------------------------------------------------------
547      REAL(wp), DIMENSION(:,:), INTENT(out) :: pgt, pgs
548      REAL(wp), DIMENSION(:,:), INTENT(in ) :: pqhisf, pqwisf
549      !
550      INTEGER  :: ikt                       
551      INTEGER  :: ji, jj                     ! loop index
552      REAL(wp), DIMENSION(:,:), POINTER :: zustar           ! U, V at T point and friction velocity
553      REAL(wp) :: zdku, zdkv                 ! U, V shear
554      REAL(wp) :: zPr, zSc, zRc              ! Prandtl, Scmidth and Richardson number
555      REAL(wp) :: zmob, zmols                ! Monin Obukov length, coriolis factor at T point
556      REAL(wp) :: zbuofdep, zhnu             ! Bouyancy length scale, sublayer tickness
557      REAL(wp) :: zhmax                      ! limitation of mol
558      REAL(wp) :: zetastar                   ! stability parameter
559      REAL(wp) :: zgmolet, zgmoles, zgturb   ! contribution of modelecular sublayer and turbulence
560      REAL(wp) :: zcoef                      ! temporary coef
561      REAL(wp) :: zdep
562      REAL(wp) :: zeps = 1.0e-20_wp   
563      REAL(wp), PARAMETER :: zxsiN = 0.052_wp   ! dimensionless constant
564      REAL(wp), PARAMETER :: znu   = 1.95e-6_wp ! kinamatic viscosity of sea water (m2.s-1)
565      REAL(wp), DIMENSION(2) :: zts, zab
566      !!---------------------------------------------------------------------
567      CALL wrk_alloc( jpi,jpj, zustar )
568      !
569      SELECT CASE ( nn_gammablk )
570      CASE ( 0 ) ! gamma is constant (specified in namelist)
571         !! ISOMIP formulation (Hunter et al, 2006)
572         pgt(:,:) = rn_gammat0
573         pgs(:,:) = rn_gammas0
574
575      CASE ( 1 ) ! gamma is assume to be proportional to u*
576         !! Jenkins et al., 2010, JPO, p2298-2312
577         !! Adopted by Asay-Davis et al. (2015)
578
579         !! compute ustar (eq. 24)
580         zustar(:,:) = SQRT( rn_tfri2 * (utbl(:,:) * utbl(:,:) + vtbl(:,:) * vtbl(:,:) + rn_tfeb2) )
581
582         !! Compute gammats
583         pgt(:,:) = zustar(:,:) * rn_gammat0
584         pgs(:,:) = zustar(:,:) * rn_gammas0
585     
586      CASE ( 2 ) ! gamma depends of stability of boundary layer
587         !! Holland and Jenkins, 1999, JPO, p1787-1800, eq 14
588         !! as MOL depends of flux and flux depends of MOL, best will be iteration (TO DO)
589         !! compute ustar
590         zustar(:,:) = SQRT( rn_tfri2 * (utbl(:,:) * utbl(:,:) + vtbl(:,:) * vtbl(:,:) + rn_tfeb2) )
591
592         !! compute Pr and Sc number (can be improved)
593         zPr =   13.8_wp
594         zSc = 2432.0_wp
595
596         !! compute gamma mole
597         zgmolet = 12.5_wp * zPr ** (2.0/3.0) - 6.0_wp
598         zgmoles = 12.5_wp * zSc ** (2.0/3.0) - 6.0_wp
599
600         !! compute gamma
601         DO ji=2,jpi
602            DO jj=2,jpj
603               ikt = mikt(ji,jj)
604
605               IF (zustar(ji,jj) == 0._wp) THEN           ! only for kt = 1 I think
606                  pgt = rn_gammat0
607                  pgs = rn_gammas0
608               ELSE
609                  !! compute Rc number (as done in zdfric.F90)
610                  zcoef = 0.5_wp / fse3w(ji,jj,ikt)
611                  !                                            ! shear of horizontal velocity
612                  zdku = zcoef * (  un(ji-1,jj  ,ikt  ) + un(ji,jj,ikt  )  &
613                     &             -un(ji-1,jj  ,ikt+1) - un(ji,jj,ikt+1)  )
614                  zdkv = zcoef * (  vn(ji  ,jj-1,ikt  ) + vn(ji,jj,ikt  )  &
615                     &             -vn(ji  ,jj-1,ikt+1) - vn(ji,jj,ikt+1)  )
616                  !                                            ! richardson number (minimum value set to zero)
617                  zRc = rn2(ji,jj,ikt+1) / MAX( zdku*zdku + zdkv*zdkv, zeps )
618
619                  !! compute bouyancy
620                  zts(jp_tem) = ttbl(ji,jj)
621                  zts(jp_sal) = stbl(ji,jj)
622                  zdep        = fsdepw(ji,jj,ikt)
623                  !
624                  CALL eos_rab( zts, zdep, zab )
625                  !
626                  !! compute length scale
627                  zbuofdep = grav * ( zab(jp_tem) * pqhisf(ji,jj) - zab(jp_sal) * pqwisf(ji,jj) )  !!!!!!!!!!!!!!!!!!!!!!!!!!!!
628
629      !! compute Monin Obukov Length
630               ! Maximum boundary layer depth
631               zhmax = gdept_n(ji,jj,mbkt(ji,jj)) - gdepw_n(ji,jj,mikt(ji,jj)) -0.001_wp
632               ! Compute Monin obukhov length scale at the surface and Ekman depth:
633               zmob   = zustar ** 3 / (vkarmn * (zbuofdep + epsln))
634               zmols  = SIGN(1._wp, zmob) * MIN(ABS(zmob), zhmax) * tmask(ji,jj,ikt)
635
636                  !! compute eta* (stability parameter)
637                  zetastar = 1._wp / ( SQRT(1._wp + MAX(zxsiN * zustar(ji,jj) / ( ABS(ff(ji,jj)) * zmols * zRc ), 0.0_wp)))
638
639                  !! compute the sublayer thickness
640                  zhnu = 5 * znu / zustar(ji,jj)
641
642                  !! compute gamma turb
643                  zgturb = 1._wp / vkarmn * LOG(zustar(ji,jj) * zxsiN * zetastar * zetastar / ( ABS(ff(ji,jj)) * zhnu )) &
644                  &      + 1._wp / ( 2 * zxsiN * zetastar ) - 1._wp / vkarmn
645
646                  !! compute gammats
647                  pgt(ji,jj) = zustar(ji,jj) / (zgturb + zgmolet)
648                  pgs(ji,jj) = zustar(ji,jj) / (zgturb + zgmoles)
649               END IF
650            END DO
651         END DO
652         CALL lbc_lnk(pgt(:,:),'T',1.)
653         CALL lbc_lnk(pgs(:,:),'T',1.)
654      END SELECT
655      CALL wrk_dealloc( jpi,jpj, zustar )
656      !
657   END SUBROUTINE sbc_isf_gammats
658
659   SUBROUTINE sbc_isf_tbl( pvarin, pvarout, cd_ptin )
660      !!----------------------------------------------------------------------
661      !!                  ***  SUBROUTINE sbc_isf_tbl  ***
662      !!
663      !! ** Purpose : compute mean T/S/U/V in the boundary layer at T- point
664      !!
665      !!----------------------------------------------------------------------
666      REAL(wp), DIMENSION(:,:,:), INTENT( in  ) :: pvarin
667      REAL(wp), DIMENSION(:,:)  , INTENT( out ) :: pvarout
668      CHARACTER(len=1),           INTENT( in  ) :: cd_ptin ! point of variable in/out
669      !
670      REAL(wp) :: ze3, zhk
671      REAL(wp), DIMENSION(:,:), POINTER :: zhisf_tbl ! thickness of the tbl
672
673      INTEGER :: ji, jj, jk                  ! loop index
674      INTEGER :: ikt, ikb                    ! top and bottom index of the tbl
675      !!----------------------------------------------------------------------
676      ! allocation
677      CALL wrk_alloc( jpi,jpj, zhisf_tbl)
678     
679      ! initialisation
680      pvarout(:,:)=0._wp
681   
682      SELECT CASE ( cd_ptin )
683      CASE ( 'U' ) ! compute U in the top boundary layer at T- point
684         DO jj = 1,jpj
685            DO ji = 1,jpi
686               ikt = miku(ji,jj) ; ikb = miku(ji,jj)
687               ! thickness of boundary layer at least the top level thickness
688               zhisf_tbl(ji,jj) = MAX(rhisf_tbl_0(ji,jj), fse3u_n(ji,jj,ikt))
689
690               ! determine the deepest level influenced by the boundary layer
691               DO jk = ikt+1, mbku(ji,jj)
692                  IF ( (SUM(fse3u_n(ji,jj,ikt:jk-1)) < zhisf_tbl(ji,jj)) .AND. (umask(ji,jj,jk) == 1) ) ikb = jk
693               END DO
694               zhisf_tbl(ji,jj) = MIN(zhisf_tbl(ji,jj), SUM(fse3u_n(ji,jj,ikt:ikb)))  ! limit the tbl to water thickness.
695
696               ! level fully include in the ice shelf boundary layer
697               DO jk = ikt, ikb - 1
698                  ze3 = fse3u_n(ji,jj,jk)
699                  pvarout(ji,jj) = pvarout(ji,jj) + pvarin(ji,jj,jk) / zhisf_tbl(ji,jj) * ze3
700               END DO
701
702               ! level partially include in ice shelf boundary layer
703               zhk = SUM( fse3u_n(ji, jj, ikt:ikb - 1)) / zhisf_tbl(ji,jj)
704               pvarout(ji,jj) = pvarout(ji,jj) + pvarin(ji,jj,ikb) * (1._wp - zhk)
705            END DO
706         END DO
707         DO jj = 2,jpj
708            DO ji = 2,jpi
709               pvarout(ji,jj) = 0.5_wp * (pvarout(ji,jj) + pvarout(ji-1,jj))
710            END DO
711         END DO
712         CALL lbc_lnk(pvarout,'T',-1.)
713     
714      CASE ( 'V' ) ! compute V in the top boundary layer at T- point
715         DO jj = 1,jpj
716            DO ji = 1,jpi
717               ikt = mikv(ji,jj) ; ikb = mikv(ji,jj)
718               ! thickness of boundary layer at least the top level thickness
719               zhisf_tbl(ji,jj) = MAX(rhisf_tbl_0(ji,jj), fse3v_n(ji,jj,ikt))
720
721               ! determine the deepest level influenced by the boundary layer
722               DO jk = ikt+1, mbkv(ji,jj)
723                  IF ( (SUM(fse3v_n(ji,jj,ikt:jk-1)) < zhisf_tbl(ji,jj)) .AND. (vmask(ji,jj,jk) == 1) ) ikb = jk
724               END DO
725               zhisf_tbl(ji,jj) = MIN(zhisf_tbl(ji,jj), SUM(fse3v_n(ji,jj,ikt:ikb)))  ! limit the tbl to water thickness.
726
727               ! level fully include in the ice shelf boundary layer
728               DO jk = ikt, ikb - 1
729                  ze3 = fse3v_n(ji,jj,jk)
730                  pvarout(ji,jj) = pvarout(ji,jj) + pvarin(ji,jj,jk) / zhisf_tbl(ji,jj) * ze3
731               END DO
732
733               ! level partially include in ice shelf boundary layer
734               zhk = SUM( fse3v_n(ji, jj, ikt:ikb - 1)) / zhisf_tbl(ji,jj)
735               pvarout(ji,jj) = pvarout(ji,jj) + pvarin(ji,jj,ikb) * (1._wp - zhk)
736            END DO
737         END DO
738         DO jj = 2,jpj
739            DO ji = 2,jpi
740               pvarout(ji,jj) = 0.5_wp * (pvarout(ji,jj) + pvarout(ji,jj-1))
741            END DO
742         END DO
743         CALL lbc_lnk(pvarout,'T',-1.)
744
745      CASE ( 'T' ) ! compute T in the top boundary layer at T- point
746         DO jj = 1,jpj
747            DO ji = 1,jpi
748               ikt = misfkt(ji,jj)
749               ikb = misfkb(ji,jj)
750
751               ! level fully include in the ice shelf boundary layer
752               DO jk = ikt, ikb - 1
753                  ze3 = e3t_n(ji,jj,jk)
754                  pvarout(ji,jj) = pvarout(ji,jj) + pvarin(ji,jj,jk) * r1_hisf_tbl(ji,jj) * ze3
755               END DO
756
757               ! level partially include in ice shelf boundary layer
758               zhk = SUM( e3t_n(ji, jj, ikt:ikb - 1)) * r1_hisf_tbl(ji,jj)
759               pvarout(ji,jj) = pvarout(ji,jj) + pvarin(ji,jj,ikb) * (1._wp - zhk)
760            END DO
761         END DO
762      END SELECT
763
764      ! mask mean tbl value
765      pvarout(:,:) = pvarout(:,:) * ssmask(:,:)
766
767      ! deallocation
768      CALL wrk_dealloc( jpi,jpj, zhisf_tbl )     
769      !
770   END SUBROUTINE sbc_isf_tbl
771     
772
773   SUBROUTINE sbc_isf_div( phdivn )
774      !!----------------------------------------------------------------------
775      !!                  ***  SUBROUTINE sbc_isf_div  ***
776      !!       
777      !! ** Purpose :   update the horizontal divergence with the runoff inflow
778      !!
779      !! ** Method  :   
780      !!                CAUTION : risf_tsc(:,:,jp_sal) is negative (outflow) increase the
781      !!                          divergence and expressed in m/s
782      !!
783      !! ** Action  :   phdivn   decreased by the runoff inflow
784      !!----------------------------------------------------------------------
785      REAL(wp), DIMENSION(:,:,:), INTENT( inout ) ::   phdivn   ! horizontal divergence
786      !
787      INTEGER  ::   ji, jj, jk   ! dummy loop indices
788      INTEGER  ::   ikt, ikb 
789      REAL(wp) ::   zhk
790      REAL(wp) ::   zfact     ! local scalar
791      !!----------------------------------------------------------------------
792      !
793      zfact   = 0.5_wp
794      !
795      IF(.NOT.ln_linssh ) THEN     ! need to re compute level distribution of isf fresh water
796         DO jj = 1,jpj
797            DO ji = 1,jpi
798               ikt = misfkt(ji,jj)
799               ikb = misfkt(ji,jj)
800               ! thickness of boundary layer at least the top level thickness
801               rhisf_tbl(ji,jj) = MAX(rhisf_tbl_0(ji,jj), e3t_n(ji,jj,ikt))
802
803               ! determine the deepest level influenced by the boundary layer
804               DO jk = ikt, mbkt(ji,jj)
805                  IF ( (SUM(e3t_n(ji,jj,ikt:jk-1)) .LT. rhisf_tbl(ji,jj)) .AND. (tmask(ji,jj,jk) == 1) ) ikb = jk
806               END DO
807               rhisf_tbl(ji,jj) = MIN(rhisf_tbl(ji,jj), SUM(e3t_n(ji,jj,ikt:ikb)))  ! limit the tbl to water thickness.
808               misfkb(ji,jj) = ikb                                                  ! last wet level of the tbl
809               r1_hisf_tbl(ji,jj) = 1._wp / rhisf_tbl(ji,jj)
810
811               zhk           = SUM( e3t_n(ji, jj, ikt:ikb - 1)) * r1_hisf_tbl(ji,jj)  ! proportion of tbl cover by cell from ikt to ikb - 1
812               ralpha(ji,jj) = rhisf_tbl(ji,jj) * (1._wp - zhk ) / e3t_n(ji,jj,ikb)  ! proportion of bottom cell influenced by boundary layer
813            END DO
814         END DO
815      END IF 
816      !
817      !==   ice shelf melting distributed over several levels   ==!
818      DO jj = 1,jpj
819         DO ji = 1,jpi
820               ikt = misfkt(ji,jj)
821               ikb = misfkb(ji,jj)
822               ! level fully include in the ice shelf boundary layer
823               DO jk = ikt, ikb - 1
824                  phdivn(ji,jj,jk) = phdivn(ji,jj,jk) + ( fwfisf(ji,jj) + fwfisf_b(ji,jj) ) &
825                    &              * r1_hisf_tbl(ji,jj) * r1_rau0 * zfact
826               END DO
827               ! level partially include in ice shelf boundary layer
828               phdivn(ji,jj,ikb) = phdivn(ji,jj,ikb) + ( fwfisf(ji,jj) &
829                    &            + fwfisf_b(ji,jj) ) * r1_hisf_tbl(ji,jj) * r1_rau0 * zfact * ralpha(ji,jj) 
830         END DO
831      END DO
832      !
833   END SUBROUTINE sbc_isf_div
834   !!======================================================================
835END MODULE sbcisf
Note: See TracBrowser for help on using the repository browser.