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.
tramle.F90 in NEMO/trunk/src/OCE/TRA – NEMO

source: NEMO/trunk/src/OCE/TRA/tramle.F90

Last change on this file was 14921, checked in by smueller, 3 years ago

Merge of development branch /NEMO/branches/2021/dev_r14122_HPC-08_Mueller_OSMOSIS_streamlining into /NEMO/trunk (ticket #2353)

  • Property svn:keywords set to Id
File size: 20.8 KB
Line 
1MODULE tramle
2   !!======================================================================
3   !!                    ***  MODULE  tramle  ***
4   !! Ocean tracers: Mixed Layer Eddy induced transport
5   !!======================================================================
6   !! History :  3.3  !  2010-08  (G. Madec)  Original code
7   !!----------------------------------------------------------------------
8
9   !!----------------------------------------------------------------------
10   !!   tra_mle_trp   : update the effective transport with the Mixed Layer Eddy induced transport
11   !!   tra_mle_init  : initialisation of the Mixed Layer Eddy induced transport computation
12   !!----------------------------------------------------------------------
13   USE oce            ! ocean dynamics and tracers variables
14   USE dom_oce        ! ocean space and time domain variables
15   USE phycst         ! physical constant
16   USE zdfmxl         ! mixed layer depth
17   !
18   USE in_out_manager ! I/O manager
19   USE iom            ! IOM library
20   USE lib_mpp        ! MPP library
21   USE lbclnk         ! lateral boundary condition / mpp link
22
23   ! where OSMOSIS_OBL is used with integrated FK
24   USE zdf_oce, ONLY : ln_zdfosm
25   USE zdfosm, ONLY  : ln_osm_mle, hmle, dbdx_mle, dbdy_mle, mld_prof
26
27   IMPLICIT NONE
28   PRIVATE
29
30   PUBLIC   tra_mle_trp        ! routine called in traadv.F90
31   PUBLIC   tra_mle_init   ! routine called in traadv.F90
32
33   !                                    !!* namelist namtra_mle *
34   LOGICAL, PUBLIC ::   ln_mle           !: flag to activate the Mixed Layer Eddy (MLE) parameterisation
35   INTEGER         ::      nn_mle           ! MLE type: =0 standard Fox-Kemper ; =1 new formulation
36   INTEGER         ::      nn_mld_uv        ! space interpolation of MLD at u- & v-pts (0=min,1=averaged,2=max)
37   INTEGER         ::      nn_conv          ! =1 no MLE in case of convection ; =0 always MLE
38   REAL(wp)        ::      rn_ce            ! MLE coefficient
39   !                                        ! parameters used in nn_mle = 0 case
40   REAL(wp)        ::      rn_lf               ! typical scale of mixed layer front
41   REAL(wp)        ::      rn_time             ! time scale for mixing momentum across the mixed layer
42   !                                        ! parameters used in nn_mle = 1 case
43   REAL(wp)        ::      rn_lat              ! reference latitude for a 5 km scale of ML front
44   REAL(wp)        ::      rn_rho_c_mle        ! Density criterion for definition of MLD used by FK
45
46   REAL(wp) ::   r5_21 = 5.e0 / 21.e0   ! factor used in mle streamfunction computation
47   REAL(wp) ::   rb_c                   ! ML buoyancy criteria = g rho_c /rho0 where rho_c is defined in zdfmld
48   REAL(wp) ::   rc_f                   ! MLE coefficient (= rn_ce / (5 km * fo) ) in nn_mle=1 case
49
50   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:) ::   rfu, rfv   ! modified Coriolis parameter (f+tau) at u- & v-pts
51   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:) ::   r1_ft      ! inverse of the modified Coriolis parameter at t-pts
52
53   !! * Substitutions
54#  include "do_loop_substitute.h90"
55#  include "domzgr_substitute.h90"
56   !!----------------------------------------------------------------------
57   !! NEMO/OCE 4.0 , NEMO Consortium (2018)
58   !! $Id$
59   !! Software governed by the CeCILL license (see ./LICENSE)
60   !!----------------------------------------------------------------------
61CONTAINS
62
63   SUBROUTINE tra_mle_trp( kt, kit000, pu, pv, pw, cdtype, Kmm )
64      !!----------------------------------------------------------------------
65      !!                  ***  ROUTINE tra_mle_trp  ***
66      !!
67      !! ** Purpose :   Add to the transport the Mixed Layer Eddy induced transport
68      !!
69      !! ** Method  :   The 3 components of the Mixed Layer Eddy (MLE) induced
70      !!              transport are computed as follows :
71      !!                zu_mle = dk[ zpsi_uw ]
72      !!                zv_mle = dk[ zpsi_vw ]
73      !!                zw_mle = - di[ zpsi_uw ] - dj[ zpsi_vw ]
74      !!                where zpsi is the MLE streamfunction at uw and vw points (see the doc)
75      !!              and added to the input velocity :
76      !!                p.n = p.n + z._mle
77      !!
78      !! ** Action  : - (pu,pv,pw) increased by the mle transport
79      !!                CAUTION, the transport is not updated at the last line/raw
80      !!                         this may be a problem for some advection schemes
81      !!
82      !! References: Fox-Kemper et al., JPO, 38, 1145-1165, 2008
83      !!             Fox-Kemper and Ferrari, JPO, 38, 1166-1179, 2008
84      !!----------------------------------------------------------------------
85      INTEGER                     , INTENT(in   ) ::   kt         ! ocean time-step index
86      INTEGER                     , INTENT(in   ) ::   kit000     ! first time step index
87      INTEGER                     , INTENT(in   ) ::   Kmm        ! ocean time level index
88      CHARACTER(len=3)            , INTENT(in   ) ::   cdtype     ! =TRA or TRC (tracer indicator)
89      ! TEMP: [tiling] Can be A2D(nn_hls) after all lbc_lnks removed in the nn_hls = 2 case in tra_adv_fct
90      REAL(wp), DIMENSION(jpi,jpj,jpk), INTENT(inout) ::   pu         ! in : 3 ocean transport components
91      REAL(wp), DIMENSION(jpi,jpj,jpk), INTENT(inout) ::   pv         ! out: same 3  transport components
92      REAL(wp), DIMENSION(jpi,jpj,jpk), INTENT(inout) ::   pw         !   increased by the MLE induced transport
93      !
94      INTEGER  ::   ji, jj, jk          ! dummy loop indices
95      INTEGER  ::   ii, ij, ik, ikmax   ! local integers
96      REAL(wp) ::   zcuw, zmuw, zc      ! local scalar
97      REAL(wp) ::   zcvw, zmvw          !   -      -
98      INTEGER , DIMENSION(A2D(nn_hls))     :: inml_mle
99      REAL(wp), DIMENSION(A2D(nn_hls))     :: zpsim_u, zpsim_v, zmld, zbm, zhu, zhv, zn2, zLf_NH, zLf_MH
100      REAL(wp), DIMENSION(A2D(nn_hls),jpk) :: zpsi_uw, zpsi_vw
101      !!----------------------------------------------------------------------
102      !
103      !
104      IF(ln_osm_mle.and.ln_zdfosm) THEN
105         ikmax = MIN( MAXVAL( mld_prof(:,:) ), jpkm1 )                  ! max level of the computation
106         !
107         !
108         SELECT CASE( nn_mld_uv )                         ! MLD at u- & v-pts
109         CASE ( 0 )                                               != min of the 2 neighbour MLDs
110            DO_2D( nn_hls, nn_hls-1, nn_hls, nn_hls-1 )
111               zhu(ji,jj) = MIN( hmle(ji+1,jj), hmle(ji,jj) )
112               zhv(ji,jj) = MIN( hmle(ji,jj+1), hmle(ji,jj) )
113            END_2D
114         CASE ( 1 )                                               != average of the 2 neighbour MLDs
115            DO_2D( nn_hls, nn_hls-1, nn_hls, nn_hls-1 )
116               zhu(ji,jj) = MAX( hmle(ji+1,jj), hmle(ji,jj) )
117               zhv(ji,jj) = MAX( hmle(ji,jj+1), hmle(ji,jj) )
118            END_2D
119         CASE ( 2 )                                               != max of the 2 neighbour MLDs
120            DO_2D( nn_hls, nn_hls-1, nn_hls, nn_hls-1 )
121               zhu(ji,jj) = MAX( hmle(ji+1,jj), hmle(ji,jj) )
122               zhv(ji,jj) = MAX( hmle(ji,jj+1), hmle(ji,jj) )
123            END_2D
124         END SELECT
125         IF( nn_mle == 0 ) THEN           ! Fox-Kemper et al. 2010 formulation
126            DO_2D( nn_hls, nn_hls-1, nn_hls, nn_hls-1 )
127               zpsim_u(ji,jj) = rn_ce * zhu(ji,jj) * zhu(ji,jj)  * e2u(ji,jj)                                            &
128                    &           * dbdx_mle(ji,jj) * MIN( 111.e3_wp , e1u(ji,jj) )   &
129                    &           / (  MAX( rn_lf * rfu(ji,jj) , SQRT( rb_c * zhu(ji,jj) ) )   )
130               !
131               zpsim_v(ji,jj) = rn_ce * zhv(ji,jj) * zhv(ji,jj)  * e1v(ji,jj)                                            &
132                    &           * dbdy_mle(ji,jj)  * MIN( 111.e3_wp , e2v(ji,jj) )   &
133                    &           / (  MAX( rn_lf * rfv(ji,jj) , SQRT( rb_c * zhv(ji,jj) ) )   )
134            END_2D
135            !
136         ELSEIF( nn_mle == 1 ) THEN       ! New formulation (Lf = 5km fo/ff with fo=Coriolis parameter at latitude rn_lat)
137            DO_2D( nn_hls, nn_hls-1, nn_hls, nn_hls-1 )
138               zpsim_u(ji,jj) = rc_f *   zhu(ji,jj)   * zhu(ji,jj)   * e2u(ji,jj)               &
139                    &                  * dbdx_mle(ji,jj) * MIN( 111.e3_wp , e1u(ji,jj) )
140               !
141               zpsim_v(ji,jj) = rc_f *   zhv(ji,jj)   * zhv(ji,jj)   * e1v(ji,jj)               &
142                    &                  * dbdy_mle(ji,jj) * MIN( 111.e3_wp , e2v(ji,jj) )
143            END_2D
144         ENDIF
145
146      ELSE !do not use osn_mle
147         !                                      !==  MLD used for MLE  ==!
148         !                                                ! compute from the 10m density to deal with the diurnal cycle
149         DO_2D( nn_hls, nn_hls, nn_hls, nn_hls )
150            inml_mle(ji,jj) = mbkt(ji,jj) + 1                    ! init. to number of ocean w-level (T-level + 1)
151         END_2D
152         IF ( nla10 > 0 ) THEN                            ! avoid case where first level is thicker than 10m
153           DO_3DS( nn_hls, nn_hls, nn_hls, nn_hls, jpkm1, nlb10, -1 )        ! from the bottom to nlb10 (10m)
154              IF( rhop(ji,jj,jk) > rhop(ji,jj,nla10) + rn_rho_c_mle )   inml_mle(ji,jj) = jk      ! Mixed layer
155           END_3D
156         ENDIF
157         ikmax = MIN( MAXVAL( inml_mle(:,:) ), jpkm1 )                  ! max level of the computation
158         !
159         !
160         zmld(:,:) = 0._wp                      !==   Horizontal shape of the MLE  ==!
161         zbm (:,:) = 0._wp
162         zn2 (:,:) = 0._wp
163         DO_3D( nn_hls, nn_hls, nn_hls, nn_hls, 1, ikmax )                    ! MLD and mean buoyancy and N2 over the mixed layer
164            zc = e3t(ji,jj,jk,Kmm) * REAL( MIN( MAX( 0, inml_mle(ji,jj)-jk ) , 1  )  )    ! zc being 0 outside the ML t-points
165            zmld(ji,jj) = zmld(ji,jj) + zc
166            zbm (ji,jj) = zbm (ji,jj) + zc * (rho0 - rhop(ji,jj,jk) ) * r1_rho0
167            zn2 (ji,jj) = zn2 (ji,jj) + zc * (rn2(ji,jj,jk)+rn2(ji,jj,jk+1))*0.5_wp
168         END_3D
169   
170         SELECT CASE( nn_mld_uv )                         ! MLD at u- & v-pts
171         CASE ( 0 )                                               != min of the 2 neighbour MLDs
172            DO_2D( nn_hls, nn_hls-1, nn_hls, nn_hls-1 )
173               zhu(ji,jj) = MIN( zmld(ji+1,jj), zmld(ji,jj) )
174               zhv(ji,jj) = MIN( zmld(ji,jj+1), zmld(ji,jj) )
175            END_2D
176         CASE ( 1 )                                               != average of the 2 neighbour MLDs
177            DO_2D( nn_hls, nn_hls-1, nn_hls, nn_hls-1 )
178               zhu(ji,jj) = ( zmld(ji+1,jj) + zmld(ji,jj) ) * 0.5_wp
179               zhv(ji,jj) = ( zmld(ji,jj+1) + zmld(ji,jj) ) * 0.5_wp
180            END_2D
181         CASE ( 2 )                                               != max of the 2 neighbour MLDs
182            DO_2D( nn_hls, nn_hls-1, nn_hls, nn_hls-1 )
183               zhu(ji,jj) = MAX( zmld(ji+1,jj), zmld(ji,jj) )
184               zhv(ji,jj) = MAX( zmld(ji,jj+1), zmld(ji,jj) )
185            END_2D
186         END SELECT
187         !                                                ! convert density into buoyancy
188         DO_2D( nn_hls, nn_hls, nn_hls, nn_hls )
189            zbm(ji,jj) = + grav * zbm(ji,jj) / MAX( e3t(ji,jj,1,Kmm), zmld(ji,jj) )
190         END_2D
191         !
192         !
193         !                                      !==  Magnitude of the MLE stream function  ==!
194         !
195         !                 di[bm]  Ds
196         ! Psi = Ce  H^2 ---------------- e2u  mu(z)   where fu Lf = MAX( fu*rn_fl , (Db H)^1/2 )
197         !                  e1u   Lf fu                      and the e2u for the "transport"
198         !                                                      (not *e3u as divided by e3u at the end)
199         !
200         IF( nn_mle == 0 ) THEN           ! Fox-Kemper et al. 2010 formulation
201            DO_2D( nn_hls, nn_hls-1, nn_hls, nn_hls-1 )
202               zpsim_u(ji,jj) = rn_ce * zhu(ji,jj) * zhu(ji,jj)  * e2_e1u(ji,jj)                                            &
203                    &           * ( zbm(ji+1,jj) - zbm(ji,jj) ) * MIN( 111.e3_wp , e1u(ji,jj) )   &
204                    &           / (  MAX( rn_lf * rfu(ji,jj) , SQRT( rb_c * zhu(ji,jj) ) )   )
205               !
206               zpsim_v(ji,jj) = rn_ce * zhv(ji,jj) * zhv(ji,jj)  * e1_e2v(ji,jj)                                            &
207                    &           * ( zbm(ji,jj+1) - zbm(ji,jj) ) * MIN( 111.e3_wp , e2v(ji,jj) )   &
208                    &           / (  MAX( rn_lf * rfv(ji,jj) , SQRT( rb_c * zhv(ji,jj) ) )   )
209            END_2D
210            !
211         ELSEIF( nn_mle == 1 ) THEN       ! New formulation (Lf = 5km fo/ff with fo=Coriolis parameter at latitude rn_lat)
212            DO_2D( nn_hls, nn_hls-1, nn_hls, nn_hls-1 )
213               zpsim_u(ji,jj) = rc_f *   zhu(ji,jj)   * zhu(ji,jj)   * e2_e1u(ji,jj)               &
214                    &                  * ( zbm(ji+1,jj) - zbm(ji,jj) ) * MIN( 111.e3_wp , e1u(ji,jj) )
215               !
216               zpsim_v(ji,jj) = rc_f *   zhv(ji,jj)   * zhv(ji,jj)   * e1_e2v(ji,jj)               &
217                    &                  * ( zbm(ji,jj+1) - zbm(ji,jj) ) * MIN( 111.e3_wp , e2v(ji,jj) )
218            END_2D
219         ENDIF
220         !
221         IF( nn_conv == 1 ) THEN              ! No MLE in case of convection
222            DO_2D( nn_hls, nn_hls-1, nn_hls, nn_hls-1 )
223               IF( MIN( zn2(ji,jj) , zn2(ji+1,jj) ) < 0._wp )   zpsim_u(ji,jj) = 0._wp
224               IF( MIN( zn2(ji,jj) , zn2(ji,jj+1) ) < 0._wp )   zpsim_v(ji,jj) = 0._wp
225            END_2D
226         ENDIF
227         !
228      ENDIF  ! end of ln_osm_mle conditional
229    !                                      !==  structure function value at uw- and vw-points  ==!
230    DO_2D( nn_hls, nn_hls-1, nn_hls, nn_hls-1 )
231       zhu(ji,jj) = 1._wp / MAX(zhu(ji,jj), rsmall)                   ! hu --> 1/hu
232       zhv(ji,jj) = 1._wp / MAX(zhv(ji,jj), rsmall) 
233    END_2D
234    !
235    zpsi_uw(:,:,:) = 0._wp
236    zpsi_vw(:,:,:) = 0._wp
237    !
238      DO_3D( nn_hls, nn_hls-1, nn_hls, nn_hls-1, 2, ikmax )                ! start from 2 : surface value = 0
239     
240         zcuw = 1._wp - ( gdepw(ji+1,jj,jk,Kmm) + gdepw(ji,jj,jk,Kmm) ) * zhu(ji,jj)
241         zcvw = 1._wp - ( gdepw(ji,jj+1,jk,Kmm) + gdepw(ji,jj,jk,Kmm) ) * zhv(ji,jj)
242         zcuw = zcuw * zcuw
243         zcvw = zcvw * zcvw
244         zmuw = MAX(  0._wp , ( 1._wp - zcuw ) * ( 1._wp + r5_21 * zcuw )  )
245         zmvw = MAX(  0._wp , ( 1._wp - zcvw ) * ( 1._wp + r5_21 * zcvw )  )
246         !
247         zpsi_uw(ji,jj,jk) = zpsim_u(ji,jj) * zmuw * wumask(ji,jj,jk) * wumask(ji,jj,1)
248         zpsi_vw(ji,jj,jk) = zpsim_v(ji,jj) * zmvw * wvmask(ji,jj,jk) * wvmask(ji,jj,1)
249      END_3D
250      !
251      !                                      !==  transport increased by the MLE induced transport ==!
252      DO jk = 1, ikmax
253         DO_2D_OVR( nn_hls, nn_hls-1, nn_hls, nn_hls-1 )
254            pu(ji,jj,jk) = pu(ji,jj,jk) + ( zpsi_uw(ji,jj,jk) - zpsi_uw(ji,jj,jk+1) )
255            pv(ji,jj,jk) = pv(ji,jj,jk) + ( zpsi_vw(ji,jj,jk) - zpsi_vw(ji,jj,jk+1) )
256         END_2D
257         DO_2D_OVR( nn_hls-1, nn_hls-1, nn_hls-1, nn_hls-1 )
258            pw(ji,jj,jk) = pw(ji,jj,jk) - ( zpsi_uw(ji,jj,jk) - zpsi_uw(ji-1,jj,jk)   &
259               &                          + zpsi_vw(ji,jj,jk) - zpsi_vw(ji,jj-1,jk) ) * wmask(ji,jj,1)
260         END_2D
261      END DO
262
263      IF( cdtype == 'TRA') THEN              !==  outputs  ==!
264         !
265         IF (ln_osm_mle.and.ln_zdfosm) THEN
266            DO_2D( 0, 0, 0, 0 )
267               zLf_NH(ji,jj) = SQRT( rb_c * hmle(ji,jj) ) * r1_ft(ji,jj)      ! Lf = N H / f
268            END_2D
269         ELSE
270            DO_2D( 0, 0, 0, 0 )
271               zLf_NH(ji,jj) = SQRT( rb_c * zmld(ji,jj) ) * r1_ft(ji,jj)      ! Lf = N H / f
272            END_2D
273         ENDIF
274         !
275         CALL iom_put( "Lf_NHpf" , zLf_NH  )    ! Lf = N H / f
276         !
277         ! divide by cross distance to give streamfunction with dimensions m^2/s
278         DO_3D( 0, 0, 0, 0, 1, ikmax+1 )
279            zpsi_uw(ji,jj,jk) = zpsi_uw(ji,jj,jk) * r1_e2u(ji,jj)
280            zpsi_vw(ji,jj,jk) = zpsi_vw(ji,jj,jk) * r1_e1v(ji,jj)
281         END_3D
282         CALL iom_put( "psiu_mle", zpsi_uw )    ! i-mle streamfunction
283         CALL iom_put( "psiv_mle", zpsi_vw )    ! j-mle streamfunction
284      ENDIF
285      !
286   END SUBROUTINE tra_mle_trp
287
288   SUBROUTINE tra_mle_init
289      !!---------------------------------------------------------------------
290      !!                  ***  ROUTINE tra_mle_init  ***
291      !!
292      !! ** Purpose :   Control the consistency between namelist options for
293      !!              tracer advection schemes and set nadv
294      !!----------------------------------------------------------------------
295      INTEGER  ::   ji, jj, jk   ! dummy loop indices
296      INTEGER  ::   ierr
297      INTEGER ::    ios                 ! Local integer output status for namelist read
298      REAL(wp) ::   z1_t2, zfu, zfv                                !    -         -
299      !
300      NAMELIST/namtra_mle/ ln_mle , nn_mle, rn_ce, rn_lf, rn_time, rn_lat, nn_mld_uv, nn_conv, rn_rho_c_mle
301      !!----------------------------------------------------------------------
302
303      READ  ( numnam_ref, namtra_mle, IOSTAT = ios, ERR = 901)
304901   IF( ios /= 0 )   CALL ctl_nam ( ios , 'namtra_mle in reference namelist' )
305
306      READ  ( numnam_cfg, namtra_mle, IOSTAT = ios, ERR = 902 )
307902   IF( ios >  0 )   CALL ctl_nam ( ios , 'namtra_mle in configuration namelist' )
308      IF(lwm) WRITE ( numond, namtra_mle )
309
310      IF(lwp) THEN                     ! Namelist print
311         WRITE(numout,*)
312         WRITE(numout,*) 'tra_mle_init : mixed layer eddy (MLE) advection acting on tracers'
313         WRITE(numout,*) '~~~~~~~~~~~~~'
314         WRITE(numout,*) '   Namelist namtra_mle : mixed layer eddy advection applied on tracers'
315         WRITE(numout,*) '      use mixed layer eddy (MLE, i.e. Fox-Kemper param) (T/F)      ln_mle       = ', ln_mle
316         WRITE(numout,*) '         MLE type: =0 standard Fox-Kemper ; =1 new formulation        nn_mle    = ', nn_mle
317         WRITE(numout,*) '         magnitude of the MLE (typical value: 0.06 to 0.08)           rn_ce     = ', rn_ce
318         WRITE(numout,*) '         scale of ML front (ML radius of deformation) (rn_mle=0)      rn_lf     = ', rn_lf, 'm'
319         WRITE(numout,*) '         maximum time scale of MLE                    (rn_mle=0)      rn_time   = ', rn_time, 's'
320         WRITE(numout,*) '         reference latitude (degrees) of MLE coef.    (rn_mle=1)      rn_lat    = ', rn_lat, 'deg'
321         WRITE(numout,*) '         space interp. of MLD at u-(v-)pts (0=min,1=averaged,2=max)   nn_mld_uv = ', nn_mld_uv
322         WRITE(numout,*) '         =1 no MLE in case of convection ; =0 always MLE              nn_conv   = ', nn_conv
323         WRITE(numout,*) '         Density difference used to define ML for FK              rn_rho_c_mle  = ', rn_rho_c_mle
324      ENDIF
325      !
326      IF(lwp) THEN
327         WRITE(numout,*)
328         IF( ln_mle ) THEN
329            WRITE(numout,*) '   ==>>>   Mixed Layer Eddy induced transport added to tracer advection'
330            IF( nn_mle == 0 )   WRITE(numout,*) '              Fox-Kemper et al 2010 formulation'
331            IF( nn_mle == 1 )   WRITE(numout,*) '              New formulation'
332         ELSE
333            WRITE(numout,*) '   ==>>>   Mixed Layer Eddy parametrisation NOT used'
334         ENDIF
335      ENDIF
336      !
337      IF( ln_mle ) THEN                ! MLE initialisation
338         !
339         rb_c = grav * rn_rho_c_mle /rho0        ! Mixed Layer buoyancy criteria
340         IF(lwp) WRITE(numout,*)
341         IF(lwp) WRITE(numout,*) '      ML buoyancy criteria = ', rb_c, ' m/s2 '
342         IF(lwp) WRITE(numout,*) '      associated ML density criteria defined in zdfmxl = ', rho_c, 'kg/m3'
343         !
344         IF( nn_mle == 0 ) THEN           ! MLE array allocation & initialisation
345            ALLOCATE( rfu(jpi,jpj) , rfv(jpi,jpj) , STAT= ierr )
346            IF( ierr /= 0 )   CALL ctl_stop( 'tra_adv_mle_init: failed to allocate arrays' )
347            z1_t2 = 1._wp / ( rn_time * rn_time )
348            DO_2D( 0, 1, 0, 1 )                      ! "coriolis+ time^-1" at u- & v-points
349               zfu = ( ff_f(ji,jj) + ff_f(ji,jj-1) ) * 0.5_wp
350               zfv = ( ff_f(ji,jj) + ff_f(ji-1,jj) ) * 0.5_wp
351               rfu(ji,jj) = SQRT(  zfu * zfu + z1_t2 )
352               rfv(ji,jj) = SQRT(  zfv * zfv + z1_t2 )
353            END_2D
354            CALL lbc_lnk( 'tramle', rfu, 'U', 1.0_wp , rfv, 'V', 1.0_wp )
355            !
356         ELSEIF( nn_mle == 1 ) THEN           ! MLE array allocation & initialisation
357            rc_f = rn_ce / (  5.e3_wp * 2._wp * omega * SIN( rad * rn_lat )  )
358            !
359         ENDIF
360         !
361         !                                ! 1/(f^2+tau^2)^1/2 at t-point (needed in both nn_mle case)
362         ALLOCATE( r1_ft(jpi,jpj) , STAT= ierr )
363         IF( ierr /= 0 )   CALL ctl_stop( 'tra_adv_mle_init: failed to allocate r1_ft array' )
364         !
365         z1_t2 = 1._wp / ( rn_time * rn_time )
366         r1_ft(:,:) = 1._wp / SQRT(  ff_t(:,:) * ff_t(:,:) + z1_t2  )
367         !
368      ENDIF
369      !
370   END SUBROUTINE tra_mle_init
371
372   !!==============================================================================
373END MODULE tramle
Note: See TracBrowser for help on using the repository browser.