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.
trazdf_exp.F90 in branches/2015/dev_r5836_NOC3_vvl_by_default/NEMOGCM/NEMO/OPA_SRC/TRA – NEMO

source: branches/2015/dev_r5836_NOC3_vvl_by_default/NEMOGCM/NEMO/OPA_SRC/TRA/trazdf_exp.F90 @ 5845

Last change on this file since 5845 was 5845, checked in by gm, 9 years ago

#1613: vvl by default: suppression of domzgr_substitute.h90

  • Property svn:keywords set to Id
File size: 8.6 KB
Line 
1MODULE trazdf_exp
2   !!==============================================================================
3   !!                    ***  MODULE  trazdf_exp  ***
4   !! Ocean  tracers:  vertical component of the tracer mixing trend using
5   !!                  a split-explicit time-stepping
6   !!==============================================================================
7   !! History :  OPA  !  1990-10  (B. Blanke)  Original code
8   !!            7.0  !  1991-11  (G. Madec)
9   !!                 !  1992-06  (M. Imbard)  correction on tracer trend loops
10   !!                 !  1996-01  (G. Madec)  statement function for e3
11   !!                 !  1997-05  (G. Madec)  vertical component of isopycnal
12   !!                 !  1997-07  (G. Madec)  geopotential diffusion in s-coord
13   !!                 !  2000-08  (G. Madec)  double diffusive mixing
14   !!   NEMO     1.0  !  2002-08  (G. Madec)  F90: Free form and module
15   !!             -   !  2004-08  (C. Talandier) New trends organisation
16   !!             -   !  2005-11  (G. Madec)  New organisation
17   !!            3.0  !  2008-04  (G. Madec)  leap-frog time stepping done in trazdf
18   !!            3.3  !  2010-06  (C. Ethe, G. Madec) Merge TRA-TRC
19   !!----------------------------------------------------------------------
20
21   !!----------------------------------------------------------------------
22   !!   tra_zdf_exp  : compute the tracer the vertical diffusion trend using a
23   !!                  split-explicit time stepping and provide the after tracer
24   !!----------------------------------------------------------------------
25   USE oce             ! ocean dynamics and active tracers
26   USE dom_oce         ! ocean space and time domain
27   USE domvvl          ! variable volume levels
28   USE zdf_oce         ! ocean vertical physics
29   USE zdfddm          ! ocean vertical physics: double diffusion
30   USE trc_oce         ! share passive tracers/Ocean variables
31   USE in_out_manager  ! I/O manager
32   USE lib_mpp         ! MPP library
33   USE wrk_nemo        ! Memory Allocation
34   USE timing          ! Timing
35
36   IMPLICIT NONE
37   PRIVATE
38
39   PUBLIC   tra_zdf_exp   ! routine called by step.F90
40
41   !! * Substitutions
42#  include "zdfddm_substitute.h90"
43#  include "vectopt_loop_substitute.h90"
44   !!----------------------------------------------------------------------
45   !! NEMO/OPA 3.3 , NEMO Consortium (2010)
46   !! $Id$
47   !! Software governed by the CeCILL licence     (NEMOGCM/NEMO_CeCILL.txt)
48   !!----------------------------------------------------------------------
49CONTAINS
50
51   SUBROUTINE tra_zdf_exp( kt, kit000, cdtype, p2dt, kn_zdfexp,   &
52      &                                ptb , pta      , kjpt )
53      !!----------------------------------------------------------------------
54      !!                  ***  ROUTINE tra_zdf_exp  ***
55      !!                   
56      !! ** Purpose :   Compute the after tracer fields due to the vertical
57      !!      tracer mixing alone, and then due to the whole tracer trend.
58      !!
59      !! ** Method  : - The after tracer fields due to the vertical diffusion
60      !!      of tracers alone is given by:
61      !!                zwx = ptb + p2dt difft
62      !!      where difft = dz( avt dz(ptb) ) = 1/e3t dk+1( avt/e3w dk(ptb) )
63      !!           (if lk_zdfddm=T use avs on salinity and passive tracers instead of avt)
64      !!      difft is evaluated with an Euler split-explit scheme using a
65      !!      no flux boundary condition at both surface and bottomi boundaries.
66      !!      (N.B. bottom condition is applied through the masked field avt).
67      !!              - the after tracer fields due to the whole trend is
68      !!      obtained in leap-frog environment by :
69      !!          pta = zwx + p2dt pta
70      !!              - in case of variable level thickness (lk_vvl=T) the
71      !!     the leap-frog is applied on thickness weighted tracer. That is:
72      !!          pta = [ ptb*e3tb + e3tn*( zwx - ptb + p2dt pta ) ] / e3tn
73      !!
74      !! ** Action : - after tracer fields pta
75      !!---------------------------------------------------------------------
76      !
77      INTEGER                              , INTENT(in   ) ::   kt          ! ocean time-step index
78      INTEGER                              , INTENT(in   ) ::   kit000      ! first time step index
79      CHARACTER(len=3)                     , INTENT(in   ) ::   cdtype      ! =TRA or TRC (tracer indicator)
80      INTEGER                              , INTENT(in   ) ::   kjpt        ! number of tracers
81      INTEGER                              , INTENT(in   ) ::   kn_zdfexp   ! number of sub-time step
82      REAL(wp), DIMENSION(        jpk     ), INTENT(in   ) ::   p2dt        ! vertical profile of tracer time-step
83      REAL(wp), DIMENSION(jpi,jpj,jpk,kjpt), INTENT(in   ) ::   ptb         ! before and now tracer fields
84      REAL(wp), DIMENSION(jpi,jpj,jpk,kjpt), INTENT(inout) ::   pta         ! tracer trend
85      !
86      INTEGER  ::  ji, jj, jk, jn, jl        ! dummy loop indices
87      REAL(wp) ::  zlavmr, zave3r, ze3tr     ! local scalars
88      REAL(wp) ::  ztra, ze3tb               !   -      -
89      REAL(wp), POINTER, DIMENSION(:,:,:) ::  zwx, zwy
90      !!---------------------------------------------------------------------
91      !
92      IF( nn_timing == 1 )  CALL timing_start('tra_zdf_exp')
93      !
94      CALL wrk_alloc( jpi, jpj, jpk, zwx, zwy ) 
95      !
96
97      IF( kt == kit000 )  THEN
98         IF(lwp) WRITE(numout,*)
99         IF(lwp) WRITE(numout,*) 'tra_zdf_exp : explicit vertical mixing on ', cdtype
100         IF(lwp) WRITE(numout,*) '~~~~~~~~~~~'
101      ENDIF
102
103      ! Initializations
104      ! ---------------
105      zlavmr = 1. / float( kn_zdfexp )         ! Local constant
106      !
107      !
108      DO jn = 1, kjpt                          ! loop over tracers
109         !
110         zwy(:,:, 1 ) = 0.e0     ! surface boundary conditions: no flux
111         zwy(:,:,jpk) = 0.e0     ! bottom  boundary conditions: no flux
112         !
113         zwx(:,:,:)   = ptb(:,:,:,jn)  ! zwx array set to before tracer values
114
115         ! Split-explicit loop  (after tracer due to the vertical diffusion alone)
116         ! -------------------
117         !
118         DO jl = 1, kn_zdfexp
119            !                     ! first vertical derivative
120            DO jk = 2, jpk
121               DO jj = 2, jpjm1 
122                  DO ji = fs_2, fs_jpim1   ! vector opt.
123                     zave3r = 1.e0 / e3w_n(ji,jj,jk) 
124                     IF( cdtype == 'TRA' .AND. jn == jp_tem ) THEN  ! temperature : use of avt
125                        zwy(ji,jj,jk) =   avt(ji,jj,jk) * ( zwx(ji,jj,jk-1) - zwx(ji,jj,jk) ) * zave3r
126                     ELSE                                           ! salinity or pass. tracer : use of avs
127                        zwy(ji,jj,jk) = fsavs(ji,jj,jk) * ( zwx(ji,jj,jk-1) - zwx(ji,jj,jk) ) * zave3r
128                     END IF
129                  END DO
130               END DO
131            END DO
132            !
133            DO jk = 1, jpkm1      ! second vertical derivative   ==> tracer at kt+l*2*rdt/nn_zdfexp
134               DO jj = 2, jpjm1 
135                  DO ji = fs_2, fs_jpim1   ! vector opt.
136                     ze3tr = zlavmr / e3t_n(ji,jj,jk)
137                     zwx(ji,jj,jk) = zwx(ji,jj,jk) + p2dt(jk) * ( zwy(ji,jj,jk) - zwy(ji,jj,jk+1) ) * ze3tr
138                  END DO
139               END DO
140            END DO
141            !
142         END DO
143
144         ! After tracer due to all trends
145         ! ------------------------------
146         IF( lk_vvl ) THEN          ! variable level thickness : leap-frog on tracer*e3t
147            DO jk = 1, jpkm1
148               DO jj = 2, jpjm1 
149                  DO ji = fs_2, fs_jpim1   ! vector opt.
150                     ze3tb = e3t_b(ji,jj,jk) / e3t_n(ji,jj,jk)                          ! before e3t
151                     ztra  = zwx(ji,jj,jk) - ptb(ji,jj,jk,jn) + p2dt(jk) * pta(ji,jj,jk,jn)       ! total trends * 2*rdt
152                     pta(ji,jj,jk,jn) = ( ze3tb * ptb(ji,jj,jk,jn) + ztra ) * tmask(ji,jj,jk)
153                  END DO
154               END DO
155            END DO
156         ELSE                       ! fixed level thickness : leap-frog on tracers
157            DO jk = 1, jpkm1
158               DO jj = 2, jpjm1 
159                  DO ji = fs_2, fs_jpim1   ! vector opt.
160                     pta(ji,jj,jk,jn) = ( zwx(ji,jj,jk) + p2dt(jk) * pta(ji,jj,jk,jn) ) * tmask(ji,jj,jk)
161                  END DO
162               END DO
163            END DO
164         ENDIF
165         !
166      END DO
167      !
168      CALL wrk_dealloc( jpi, jpj, jpk, zwx, zwy ) 
169      !
170      IF( nn_timing == 1 )  CALL timing_stop('tra_zdf_exp')
171      !
172   END SUBROUTINE tra_zdf_exp
173
174   !!==============================================================================
175END MODULE trazdf_exp
Note: See TracBrowser for help on using the repository browser.