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/branches/2021/dev_r14116_HPC-10_mcastril_Mixed_Precision_implementation/src/OCE/TRA – NEMO

source: NEMO/branches/2021/dev_r14116_HPC-10_mcastril_Mixed_Precision_implementation/src/OCE/TRA/tramle.F90 @ 15540

Last change on this file since 15540 was 15540, checked in by sparonuz, 3 years ago

Mixed precision version, tested up to 30 years on ORCA2.

  • Property svn:keywords set to Id
File size: 20.9 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(dp) ::   r5_21 = 5.e0 / 21.e0   ! factor used in mle streamfunction computation
47   REAL(dp) ::   rb_c                   ! ML buoyancy criteria = g rho_c /rho0 where rho_c is defined in zdfmld
48   REAL(dp) ::   rc_f                   ! MLE coefficient (= rn_ce / (5 km * fo) ) in nn_mle=1 case
49
50   REAL(dp), 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
100      REAL(dp), DIMENSION(A2D(nn_hls))      :: zLf_MH
101      REAL(wp), DIMENSION(A2D(nn_hls),jpk) :: zpsi_uw, zpsi_vw
102      !!----------------------------------------------------------------------
103      !
104      !
105      IF(ln_osm_mle.and.ln_zdfosm) THEN
106         ikmax = MIN( MAXVAL( mld_prof(:,:) ), jpkm1 )                  ! max level of the computation
107         !
108         !
109         SELECT CASE( nn_mld_uv )                         ! MLD at u- & v-pts
110         CASE ( 0 )                                               != min of the 2 neighbour MLDs
111            DO_2D( nn_hls, nn_hls-1, nn_hls, nn_hls-1 )
112               zhu(ji,jj) = MIN( hmle(ji+1,jj), hmle(ji,jj) )
113               zhv(ji,jj) = MIN( hmle(ji,jj+1), hmle(ji,jj) )
114            END_2D
115         CASE ( 1 )                                               != average of the 2 neighbour MLDs
116            DO_2D( nn_hls, nn_hls-1, nn_hls, nn_hls-1 )
117               zhu(ji,jj) = MAX( hmle(ji+1,jj), hmle(ji,jj) )
118               zhv(ji,jj) = MAX( hmle(ji,jj+1), hmle(ji,jj) )
119            END_2D
120         CASE ( 2 )                                               != max of the 2 neighbour MLDs
121            DO_2D( nn_hls, nn_hls-1, nn_hls, nn_hls-1 )
122               zhu(ji,jj) = MAX( hmle(ji+1,jj), hmle(ji,jj) )
123               zhv(ji,jj) = MAX( hmle(ji,jj+1), hmle(ji,jj) )
124            END_2D
125         END SELECT
126         IF( nn_mle == 0 ) THEN           ! Fox-Kemper et al. 2010 formulation
127            DO_2D( nn_hls, nn_hls-1, nn_hls, nn_hls-1 )
128               zpsim_u(ji,jj) = rn_ce * zhu(ji,jj) * zhu(ji,jj)  * e2u(ji,jj)                                            &
129                    &           * dbdx_mle(ji,jj) * MIN( 111.e3_wp , e1u(ji,jj) )   &
130                    &           / (  MAX( rn_lf * rfu(ji,jj) , SQRT( rb_c * zhu(ji,jj) ) )   )
131               !
132               zpsim_v(ji,jj) = rn_ce * zhv(ji,jj) * zhv(ji,jj)  * e1v(ji,jj)                                            &
133                    &           * dbdy_mle(ji,jj)  * MIN( 111.e3_wp , e2v(ji,jj) )   &
134                    &           / (  MAX( rn_lf * rfv(ji,jj) , SQRT( rb_c * zhv(ji,jj) ) )   )
135            END_2D
136            !
137         ELSEIF( nn_mle == 1 ) THEN       ! New formulation (Lf = 5km fo/ff with fo=Coriolis parameter at latitude rn_lat)
138            DO_2D( nn_hls, nn_hls-1, nn_hls, nn_hls-1 )
139               zpsim_u(ji,jj) = rc_f *   zhu(ji,jj)   * zhu(ji,jj)   * e2u(ji,jj)               &
140                    &                  * dbdx_mle(ji,jj) * MIN( 111.e3_wp , e1u(ji,jj) )
141               !
142               zpsim_v(ji,jj) = rc_f *   zhv(ji,jj)   * zhv(ji,jj)   * e1v(ji,jj)               &
143                    &                  * dbdy_mle(ji,jj) * MIN( 111.e3_wp , e2v(ji,jj) )
144            END_2D
145         ENDIF
146
147      ELSE !do not use osn_mle
148         !                                      !==  MLD used for MLE  ==!
149         !                                                ! compute from the 10m density to deal with the diurnal cycle
150         DO_2D( nn_hls, nn_hls, nn_hls, nn_hls )
151            inml_mle(ji,jj) = mbkt(ji,jj) + 1                    ! init. to number of ocean w-level (T-level + 1)
152         END_2D
153         IF ( nla10 > 0 ) THEN                            ! avoid case where first level is thicker than 10m
154           DO_3DS( nn_hls, nn_hls, nn_hls, nn_hls, jpkm1, nlb10, -1 )        ! from the bottom to nlb10 (10m)
155              IF( rhop(ji,jj,jk) > rhop(ji,jj,nla10) + rn_rho_c_mle )   inml_mle(ji,jj) = jk      ! Mixed layer
156           END_3D
157         ENDIF
158         ikmax = MIN( MAXVAL( inml_mle(:,:) ), jpkm1 )                  ! max level of the computation
159         !
160         !
161         zmld(:,:) = 0._wp                      !==   Horizontal shape of the MLE  ==!
162         zbm (:,:) = 0._wp
163         zn2 (:,:) = 0._wp
164         DO_3D( nn_hls, nn_hls, nn_hls, nn_hls, 1, ikmax )                    ! MLD and mean buoyancy and N2 over the mixed layer
165            zc = e3t(ji,jj,jk,Kmm) * REAL( MIN( MAX( 0, inml_mle(ji,jj)-jk ) , 1  )  )    ! zc being 0 outside the ML t-points
166            zmld(ji,jj) = zmld(ji,jj) + zc
167            zbm (ji,jj) = zbm (ji,jj) + zc * (rho0 - rhop(ji,jj,jk) ) * r1_rho0
168            zn2 (ji,jj) = zn2 (ji,jj) + zc * (rn2(ji,jj,jk)+rn2(ji,jj,jk+1))*0.5_wp
169         END_3D
170   
171         SELECT CASE( nn_mld_uv )                         ! MLD at u- & v-pts
172         CASE ( 0 )                                               != min of the 2 neighbour MLDs
173            DO_2D( nn_hls, nn_hls-1, nn_hls, nn_hls-1 )
174               zhu(ji,jj) = MIN( zmld(ji+1,jj), zmld(ji,jj) )
175               zhv(ji,jj) = MIN( zmld(ji,jj+1), zmld(ji,jj) )
176            END_2D
177         CASE ( 1 )                                               != average of the 2 neighbour MLDs
178            DO_2D( nn_hls, nn_hls-1, nn_hls, nn_hls-1 )
179               zhu(ji,jj) = ( zmld(ji+1,jj) + zmld(ji,jj) ) * 0.5_wp
180               zhv(ji,jj) = ( zmld(ji,jj+1) + zmld(ji,jj) ) * 0.5_wp
181            END_2D
182         CASE ( 2 )                                               != max of the 2 neighbour MLDs
183            DO_2D( nn_hls, nn_hls-1, nn_hls, nn_hls-1 )
184               zhu(ji,jj) = MAX( zmld(ji+1,jj), zmld(ji,jj) )
185               zhv(ji,jj) = MAX( zmld(ji,jj+1), zmld(ji,jj) )
186            END_2D
187         END SELECT
188         !                                                ! convert density into buoyancy
189         DO_2D( nn_hls, nn_hls, nn_hls, nn_hls )
190            zbm(ji,jj) = + grav * zbm(ji,jj) / MAX( e3t(ji,jj,1,Kmm), zmld(ji,jj) )
191         END_2D
192         !
193         !
194         !                                      !==  Magnitude of the MLE stream function  ==!
195         !
196         !                 di[bm]  Ds
197         ! Psi = Ce  H^2 ---------------- e2u  mu(z)   where fu Lf = MAX( fu*rn_fl , (Db H)^1/2 )
198         !                  e1u   Lf fu                      and the e2u for the "transport"
199         !                                                      (not *e3u as divided by e3u at the end)
200         !
201         IF( nn_mle == 0 ) THEN           ! Fox-Kemper et al. 2010 formulation
202            DO_2D( nn_hls, nn_hls-1, nn_hls, nn_hls-1 )
203               zpsim_u(ji,jj) = rn_ce * zhu(ji,jj) * zhu(ji,jj)  * e2_e1u(ji,jj)                                            &
204                    &           * ( zbm(ji+1,jj) - zbm(ji,jj) ) * MIN( 111.e3_wp , e1u(ji,jj) )   &
205                    &           / (  MAX( rn_lf * rfu(ji,jj) , SQRT( rb_c * zhu(ji,jj) ) )   )
206               !
207               zpsim_v(ji,jj) = rn_ce * zhv(ji,jj) * zhv(ji,jj)  * e1_e2v(ji,jj)                                            &
208                    &           * ( zbm(ji,jj+1) - zbm(ji,jj) ) * MIN( 111.e3_wp , e2v(ji,jj) )   &
209                    &           / (  MAX( rn_lf * rfv(ji,jj) , SQRT( rb_c * zhv(ji,jj) ) )   )
210            END_2D
211            !
212         ELSEIF( nn_mle == 1 ) THEN       ! New formulation (Lf = 5km fo/ff with fo=Coriolis parameter at latitude rn_lat)
213            DO_2D( nn_hls, nn_hls-1, nn_hls, nn_hls-1 )
214               zpsim_u(ji,jj) = rc_f *   zhu(ji,jj)   * zhu(ji,jj)   * e2_e1u(ji,jj)               &
215                    &                  * ( zbm(ji+1,jj) - zbm(ji,jj) ) * MIN( 111.e3_wp , e1u(ji,jj) )
216               !
217               zpsim_v(ji,jj) = rc_f *   zhv(ji,jj)   * zhv(ji,jj)   * e1_e2v(ji,jj)               &
218                    &                  * ( zbm(ji,jj+1) - zbm(ji,jj) ) * MIN( 111.e3_wp , e2v(ji,jj) )
219            END_2D
220         ENDIF
221         !
222         IF( nn_conv == 1 ) THEN              ! No MLE in case of convection
223            DO_2D( nn_hls, nn_hls-1, nn_hls, nn_hls-1 )
224               IF( MIN( zn2(ji,jj) , zn2(ji+1,jj) ) < 0._wp )   zpsim_u(ji,jj) = 0._wp
225               IF( MIN( zn2(ji,jj) , zn2(ji,jj+1) ) < 0._wp )   zpsim_v(ji,jj) = 0._wp
226            END_2D
227         ENDIF
228         !
229      ENDIF  ! end of ln_osm_mle conditional
230    !                                      !==  structure function value at uw- and vw-points  ==!
231    DO_2D( nn_hls, nn_hls-1, nn_hls, nn_hls-1 )
232       zhu(ji,jj) = 1._wp / MAX(zhu(ji,jj), rsmall)                   ! hu --> 1/hu
233       zhv(ji,jj) = 1._wp / MAX(zhv(ji,jj), rsmall) 
234    END_2D
235    !
236    zpsi_uw(:,:,:) = 0._wp
237    zpsi_vw(:,:,:) = 0._wp
238    !
239      DO_3D( nn_hls, nn_hls-1, nn_hls, nn_hls-1, 2, ikmax )                ! start from 2 : surface value = 0
240     
241         zcuw = 1._wp - ( gdepw(ji+1,jj,jk,Kmm) + gdepw(ji,jj,jk,Kmm) ) * zhu(ji,jj)
242         zcvw = 1._wp - ( gdepw(ji,jj+1,jk,Kmm) + gdepw(ji,jj,jk,Kmm) ) * zhv(ji,jj)
243         zcuw = zcuw * zcuw
244         zcvw = zcvw * zcvw
245         zmuw = MAX(  0._wp , ( 1._wp - zcuw ) * ( 1._wp + r5_21 * zcuw )  )
246         zmvw = MAX(  0._wp , ( 1._wp - zcvw ) * ( 1._wp + r5_21 * zcvw )  )
247         !
248         zpsi_uw(ji,jj,jk) = zpsim_u(ji,jj) * zmuw * wumask(ji,jj,jk) * wumask(ji,jj,1)
249         zpsi_vw(ji,jj,jk) = zpsim_v(ji,jj) * zmvw * wvmask(ji,jj,jk) * wvmask(ji,jj,1)
250      END_3D
251      !
252      !                                      !==  transport increased by the MLE induced transport ==!
253      DO jk = 1, ikmax
254         DO_2D_OVR( nn_hls, nn_hls-1, nn_hls, nn_hls-1 )
255            pu(ji,jj,jk) = pu(ji,jj,jk) + ( zpsi_uw(ji,jj,jk) - zpsi_uw(ji,jj,jk+1) )
256            pv(ji,jj,jk) = pv(ji,jj,jk) + ( zpsi_vw(ji,jj,jk) - zpsi_vw(ji,jj,jk+1) )
257         END_2D
258         DO_2D_OVR( nn_hls-1, nn_hls-1, nn_hls-1, nn_hls-1 )
259            pw(ji,jj,jk) = pw(ji,jj,jk) - ( zpsi_uw(ji,jj,jk) - zpsi_uw(ji-1,jj,jk)   &
260               &                          + zpsi_vw(ji,jj,jk) - zpsi_vw(ji,jj-1,jk) ) * wmask(ji,jj,1)
261         END_2D
262      END DO
263
264      IF( cdtype == 'TRA') THEN              !==  outputs  ==!
265         !
266         IF (ln_osm_mle.and.ln_zdfosm) THEN
267            DO_2D( 0, 0, 0, 0 )
268               zLf_NH(ji,jj) = SQRT( rb_c * hmle(ji,jj) ) * r1_ft(ji,jj)      ! Lf = N H / f
269            END_2D
270         ELSE
271            DO_2D( 0, 0, 0, 0 )
272               zLf_NH(ji,jj) = SQRT( rb_c * zmld(ji,jj) ) * r1_ft(ji,jj)      ! Lf = N H / f
273            END_2D
274         ENDIF
275         !
276         CALL iom_put( "Lf_NHpf" , zLf_NH  )    ! Lf = N H / f
277         !
278         ! divide by cross distance to give streamfunction with dimensions m^2/s
279         DO_3D( 0, 0, 0, 0, 1, ikmax+1 )
280            zpsi_uw(ji,jj,jk) = zpsi_uw(ji,jj,jk) * r1_e2u(ji,jj)
281            zpsi_vw(ji,jj,jk) = zpsi_vw(ji,jj,jk) * r1_e1v(ji,jj)
282         END_3D
283         CALL iom_put( "psiu_mle", zpsi_uw )    ! i-mle streamfunction
284         CALL iom_put( "psiv_mle", zpsi_vw )    ! j-mle streamfunction
285      ENDIF
286      !
287   END SUBROUTINE tra_mle_trp
288
289   SUBROUTINE tra_mle_init
290      !!---------------------------------------------------------------------
291      !!                  ***  ROUTINE tra_mle_init  ***
292      !!
293      !! ** Purpose :   Control the consistency between namelist options for
294      !!              tracer advection schemes and set nadv
295      !!----------------------------------------------------------------------
296      INTEGER  ::   ji, jj, jk   ! dummy loop indices
297      INTEGER  ::   ierr
298      INTEGER ::    ios                 ! Local integer output status for namelist read
299      REAL(wp) ::   z1_t2, zfu, zfv                                !    -         -
300      !
301      NAMELIST/namtra_mle/ ln_mle , nn_mle, rn_ce, rn_lf, rn_time, rn_lat, nn_mld_uv, nn_conv, rn_rho_c_mle
302      !!----------------------------------------------------------------------
303
304      READ  ( numnam_ref, namtra_mle, IOSTAT = ios, ERR = 901)
305901   IF( ios /= 0 )   CALL ctl_nam ( ios , 'namtra_mle in reference namelist' )
306
307      READ  ( numnam_cfg, namtra_mle, IOSTAT = ios, ERR = 902 )
308902   IF( ios >  0 )   CALL ctl_nam ( ios , 'namtra_mle in configuration namelist' )
309      IF(lwm) WRITE ( numond, namtra_mle )
310
311      IF(lwp) THEN                     ! Namelist print
312         WRITE(numout,*)
313         WRITE(numout,*) 'tra_mle_init : mixed layer eddy (MLE) advection acting on tracers'
314         WRITE(numout,*) '~~~~~~~~~~~~~'
315         WRITE(numout,*) '   Namelist namtra_mle : mixed layer eddy advection applied on tracers'
316         WRITE(numout,*) '      use mixed layer eddy (MLE, i.e. Fox-Kemper param) (T/F)      ln_mle       = ', ln_mle
317         WRITE(numout,*) '         MLE type: =0 standard Fox-Kemper ; =1 new formulation        nn_mle    = ', nn_mle
318         WRITE(numout,*) '         magnitude of the MLE (typical value: 0.06 to 0.08)           rn_ce     = ', rn_ce
319         WRITE(numout,*) '         scale of ML front (ML radius of deformation) (rn_mle=0)      rn_lf     = ', rn_lf, 'm'
320         WRITE(numout,*) '         maximum time scale of MLE                    (rn_mle=0)      rn_time   = ', rn_time, 's'
321         WRITE(numout,*) '         reference latitude (degrees) of MLE coef.    (rn_mle=1)      rn_lat    = ', rn_lat, 'deg'
322         WRITE(numout,*) '         space interp. of MLD at u-(v-)pts (0=min,1=averaged,2=max)   nn_mld_uv = ', nn_mld_uv
323         WRITE(numout,*) '         =1 no MLE in case of convection ; =0 always MLE              nn_conv   = ', nn_conv
324         WRITE(numout,*) '         Density difference used to define ML for FK              rn_rho_c_mle  = ', rn_rho_c_mle
325      ENDIF
326      !
327      IF(lwp) THEN
328         WRITE(numout,*)
329         IF( ln_mle ) THEN
330            WRITE(numout,*) '   ==>>>   Mixed Layer Eddy induced transport added to tracer advection'
331            IF( nn_mle == 0 )   WRITE(numout,*) '              Fox-Kemper et al 2010 formulation'
332            IF( nn_mle == 1 )   WRITE(numout,*) '              New formulation'
333         ELSE
334            WRITE(numout,*) '   ==>>>   Mixed Layer Eddy parametrisation NOT used'
335         ENDIF
336      ENDIF
337      !
338      IF( ln_mle ) THEN                ! MLE initialisation
339         !
340         rb_c = grav * rn_rho_c_mle /rho0        ! Mixed Layer buoyancy criteria
341         IF(lwp) WRITE(numout,*)
342         IF(lwp) WRITE(numout,*) '      ML buoyancy criteria = ', rb_c, ' m/s2 '
343         IF(lwp) WRITE(numout,*) '      associated ML density criteria defined in zdfmxl = ', rho_c, 'kg/m3'
344         !
345         IF( nn_mle == 0 ) THEN           ! MLE array allocation & initialisation
346            ALLOCATE( rfu(jpi,jpj) , rfv(jpi,jpj) , STAT= ierr )
347            IF( ierr /= 0 )   CALL ctl_stop( 'tra_adv_mle_init: failed to allocate arrays' )
348            z1_t2 = 1._wp / ( rn_time * rn_time )
349            DO_2D( 0, 1, 0, 1 )                      ! "coriolis+ time^-1" at u- & v-points
350               zfu = ( ff_f(ji,jj) + ff_f(ji,jj-1) ) * 0.5_wp
351               zfv = ( ff_f(ji,jj) + ff_f(ji-1,jj) ) * 0.5_wp
352               rfu(ji,jj) = SQRT(  zfu * zfu + z1_t2 )
353               rfv(ji,jj) = SQRT(  zfv * zfv + z1_t2 )
354            END_2D
355            CALL lbc_lnk( 'tramle', rfu, 'U', 1.0_wp , rfv, 'V', 1.0_wp )
356            !
357         ELSEIF( nn_mle == 1 ) THEN           ! MLE array allocation & initialisation
358            rc_f = rn_ce / (  5.e3_wp * 2._wp * omega * SIN( rad * rn_lat )  )
359            !
360         ENDIF
361         !
362         !                                ! 1/(f^2+tau^2)^1/2 at t-point (needed in both nn_mle case)
363         ALLOCATE( r1_ft(jpi,jpj) , STAT= ierr )
364         IF( ierr /= 0 )   CALL ctl_stop( 'tra_adv_mle_init: failed to allocate r1_ft array' )
365         !
366         z1_t2 = 1._wp / ( rn_time * rn_time )
367         r1_ft(:,:) = 1._wp / SQRT(  ff_t(:,:) * ff_t(:,:) + z1_t2  )
368         !
369      ENDIF
370      !
371   END SUBROUTINE tra_mle_init
372
373   !!==============================================================================
374END MODULE tramle
Note: See TracBrowser for help on using the repository browser.