source: NEMO/trunk/src/OCE/ZDF/zdfevd.F90

Last change on this file was 13295, checked in by acc, 9 months ago

Replace do-loop macros in the trunk with alternative forms with greater flexibility for extra halo applications. This alters a lot of routines but does not change any behaviour or results. do_loop_substitute.h90 is greatly simplified by this change. SETTE results are identical to those with the previous revision

  • Property svn:keywords set to Id
File size: 5.6 KB
Line 
1MODULE zdfevd
2   !!======================================================================
3   !!                       ***  MODULE  zdfevd  ***
4   !! Ocean physics: parameterization of convection through an enhancement
5   !!                of vertical eddy mixing coefficient
6   !!======================================================================
7   !! History :  OPA  !  1997-06  (G. Madec, A. Lazar)  Original code
8   !!   NEMO     1.0  !  2002-06  (G. Madec)  F90: Free form and module
9   !!            3.2  !  2009-03  (M. Leclair, G. Madec, R. Benshila) test on both before & after
10   !!            4.0  !  2017-04  (G. Madec)  evd applied on avm (at t-point)
11   !!----------------------------------------------------------------------
12
13   !!----------------------------------------------------------------------
14   !!   zdf_evd       : increase the momentum and tracer Kz at the location of
15   !!                   statically unstable portion of the water column (ln_zdfevd=T)
16   !!----------------------------------------------------------------------
17   USE oce             ! ocean dynamics and tracers variables
18   USE dom_oce         ! ocean space and time domain variables
19   USE zdf_oce         ! ocean vertical physics variables
20   USE trd_oce         ! trends: ocean variables
21   USE trdtra          ! trends manager: tracers
22   !
23   USE in_out_manager  ! I/O manager
24   USE iom             ! for iom_put
25   USE lbclnk          ! ocean lateral boundary conditions (or mpp link)
26   USE timing          ! Timing
27
28   IMPLICIT NONE
29   PRIVATE
30
31   PUBLIC   zdf_evd    ! called by step.F90
32
33   !! * Substitutions
34#  include "do_loop_substitute.h90"
35   !!----------------------------------------------------------------------
36   !! NEMO/OCE 4.0 , NEMO Consortium (2018)
37   !! $Id$
38   !! Software governed by the CeCILL license (see ./LICENSE)
39   !!----------------------------------------------------------------------
40CONTAINS
41
42   SUBROUTINE zdf_evd( kt, Kmm, Krhs, p_avm, p_avt )
43      !!----------------------------------------------------------------------
44      !!                  ***  ROUTINE zdf_evd  ***
45      !!                   
46      !! ** Purpose :   Local increased the vertical eddy viscosity and diffu-
47      !!      sivity coefficients when a static instability is encountered.
48      !!
49      !! ** Method  :   tracer (and momentum if nn_evdm=1) vertical mixing
50      !!              coefficients are set to rn_evd (namelist parameter)
51      !!              if the water column is statically unstable.
52      !!                The test of static instability is performed using
53      !!              Brunt-Vaisala frequency (rn2 < -1.e-12) of to successive
54      !!              time-step (Leap-Frog environnement): before and
55      !!              now time-step.
56      !!
57      !! ** Action  :   avt, avm   enhanced where static instability occurs
58      !!----------------------------------------------------------------------
59      INTEGER                    , INTENT(in   ) ::   kt             ! ocean time-step indexocean time step
60      INTEGER                    , INTENT(in   ) ::   Kmm, Krhs      ! time level indices
61      REAL(wp), DIMENSION(:,:,:) , INTENT(inout) ::   p_avm, p_avt   !  momentum and tracer Kz (w-points)
62      !
63      INTEGER ::   ji, jj, jk   ! dummy loop indices
64      REAL(wp), DIMENSION(jpi,jpj,jpk) ::   zavt_evd, zavm_evd
65      !!----------------------------------------------------------------------
66      !
67      IF( kt == nit000 ) THEN
68         IF(lwp) WRITE(numout,*)
69         IF(lwp) WRITE(numout,*) 'zdf_evd : Enhanced Vertical Diffusion (evd)'
70         IF(lwp) WRITE(numout,*) '~~~~~~~ '
71         IF(lwp) WRITE(numout,*)
72      ENDIF
73      !
74      !
75      zavt_evd(:,:,:) = p_avt(:,:,:)         ! set avt prior to evd application
76      !
77      SELECT CASE ( nn_evdm )
78      !
79      CASE ( 1 )           !==  enhance tracer & momentum Kz  ==!   (if rn2<-1.e-12)
80         !
81         zavm_evd(:,:,:) = p_avm(:,:,:)      ! set avm prior to evd application
82         !
83!! change last digits results
84!         WHERE( MAX( rn2(2:jpi,2:jpj,2:jpkm1), rn2b(2:jpi,2:jpj,2:jpkm1) )  <= -1.e-12 ) THEN
85!            p_avt(2:jpi,2:jpj,2:jpkm1) = rn_evd * wmask(2:jpi,2:jpj,2:jpkm1)
86!            p_avm(2:jpi,2:jpj,2:jpkm1) = rn_evd * wmask(2:jpi,2:jpj,2:jpkm1)
87!         END WHERE
88         !
89         DO_3D( 0, 0, 0, 0, 1, jpkm1 )
90            IF(  MIN( rn2(ji,jj,jk), rn2b(ji,jj,jk) ) <= -1.e-12 ) THEN
91               p_avt(ji,jj,jk) = rn_evd * wmask(ji,jj,jk)
92               p_avm(ji,jj,jk) = rn_evd * wmask(ji,jj,jk)
93            ENDIF
94         END_3D
95         !
96         zavm_evd(:,:,:) = p_avm(:,:,:) - zavm_evd(:,:,:)   ! change in avm due to evd
97         CALL iom_put( "avm_evd", zavm_evd )                ! output this change
98         !
99      CASE DEFAULT         !==  enhance tracer Kz  ==!   (if rn2<-1.e-12)
100!! change last digits results
101!         WHERE( MAX( rn2(2:jpi,2:jpj,2:jpkm1), rn2b(2:jpi,2:jpj,2:jpkm1) )  <= -1.e-12 )
102!            p_avt(2:jpi,2:jpj,2:jpkm1) = rn_evd * wmask(2:jpi,2:jpj,2:jpkm1)
103!         END WHERE
104
105         DO_3D( 0, 0, 0, 0, 1, jpkm1 )
106            IF(  MIN( rn2(ji,jj,jk), rn2b(ji,jj,jk) ) <= -1.e-12 )   &
107               p_avt(ji,jj,jk) = rn_evd * wmask(ji,jj,jk)
108         END_3D
109         !
110      END SELECT 
111      !
112      zavt_evd(:,:,:) = p_avt(:,:,:) - zavt_evd(:,:,:)   ! change in avt due to evd
113      CALL iom_put( "avt_evd", zavt_evd )              ! output this change
114      IF( l_trdtra ) CALL trd_tra( kt, Kmm, Krhs, 'TRA', jp_tem, jptra_evd, zavt_evd )
115      !
116   END SUBROUTINE zdf_evd
117
118   !!======================================================================
119END MODULE zdfevd
Note: See TracBrowser for help on using the repository browser.