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 @ 5866

Last change on this file since 5866 was 5866, checked in by gm, 8 years ago

#1613: vvl by default: add ln_linssh and remove key_vvl

  • Property svn:keywords set to Id
File size: 8.5 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 applied on thickness weighted tracer by :
69      !!          pta = [ ptb*e3tb + e3tn*( zwx - ptb + p2dt pta ) ] / e3tn
70      !!
71      !! ** Action : - after tracer fields pta
72      !!---------------------------------------------------------------------
73      INTEGER                              , INTENT(in   ) ::   kt          ! ocean time-step index
74      INTEGER                              , INTENT(in   ) ::   kit000      ! first time step index
75      CHARACTER(len=3)                     , INTENT(in   ) ::   cdtype      ! =TRA or TRC (tracer indicator)
76      INTEGER                              , INTENT(in   ) ::   kjpt        ! number of tracers
77      INTEGER                              , INTENT(in   ) ::   kn_zdfexp   ! number of sub-time step
78      REAL(wp), DIMENSION(        jpk     ), INTENT(in   ) ::   p2dt        ! vertical profile of tracer time-step
79      REAL(wp), DIMENSION(jpi,jpj,jpk,kjpt), INTENT(in   ) ::   ptb         ! before and now tracer fields
80      REAL(wp), DIMENSION(jpi,jpj,jpk,kjpt), INTENT(inout) ::   pta         ! tracer trend
81      !
82      INTEGER  ::  ji, jj, jk, jn, jl        ! dummy loop indices
83      REAL(wp) ::  zlavmr, zave3r, ze3tr     ! local scalars
84      REAL(wp) ::  ztra, ze3tb               !   -      -
85      REAL(wp), POINTER, DIMENSION(:,:,:) ::  zwx, zwy
86      !!---------------------------------------------------------------------
87      !
88      IF( nn_timing == 1 )  CALL timing_start('tra_zdf_exp')
89      !
90      CALL wrk_alloc( jpi,jpj,jpk,   zwx, zwy ) 
91      !
92
93      IF( kt == kit000 )  THEN
94         IF(lwp) WRITE(numout,*)
95         IF(lwp) WRITE(numout,*) 'tra_zdf_exp : explicit vertical mixing on ', cdtype
96         IF(lwp) WRITE(numout,*) '~~~~~~~~~~~'
97      ENDIF
98
99      ! Initializations
100      ! ---------------
101      zlavmr = 1. / float( kn_zdfexp )         ! Local constant
102      !
103      !
104      DO jn = 1, kjpt                          ! loop over tracers
105         !
106         zwy(:,:, 1 ) = 0.e0     ! surface boundary conditions: no flux
107         zwy(:,:,jpk) = 0.e0     ! bottom  boundary conditions: no flux
108         !
109         zwx(:,:,:)   = ptb(:,:,:,jn)  ! zwx array set to before tracer values
110
111         ! Split-explicit loop  (after tracer due to the vertical diffusion alone)
112         ! -------------------
113         !
114         DO jl = 1, kn_zdfexp
115            !                     ! first vertical derivative
116            DO jk = 2, jpk
117               DO jj = 2, jpjm1 
118                  DO ji = fs_2, fs_jpim1   ! vector opt.
119                     zave3r = 1.e0 / e3w_n(ji,jj,jk)            !!gm here it should be e3w_b  ????
120                     IF( cdtype == 'TRA' .AND. jn == jp_tem ) THEN  ! temperature : use of avt
121                        zwy(ji,jj,jk) =   avt(ji,jj,jk) * ( zwx(ji,jj,jk-1) - zwx(ji,jj,jk) ) * zave3r
122                     ELSE                                           ! salinity or pass. tracer : use of avs
123                        zwy(ji,jj,jk) = fsavs(ji,jj,jk) * ( zwx(ji,jj,jk-1) - zwx(ji,jj,jk) ) * zave3r
124                     END IF
125                  END DO
126               END DO
127            END DO
128            !
129            DO jk = 1, jpkm1      ! second vertical derivative   ==> tracer at kt+l*2*rdt/nn_zdfexp
130               DO jj = 2, jpjm1 
131                  DO ji = fs_2, fs_jpim1   ! vector opt.
132                     ze3tr = zlavmr / e3t_n(ji,jj,jk)
133                     zwx(ji,jj,jk) = zwx(ji,jj,jk) + p2dt(jk) * ( zwy(ji,jj,jk) - zwy(ji,jj,jk+1) ) * ze3tr
134                  END DO
135               END DO
136            END DO
137            !
138         END DO
139
140         ! After tracer due to all trends
141         ! ------------------------------
142         IF( .NOT.ln_linssh ) THEN     ! variable level thickness : leap-frog on tracer*e3t
143            DO jk = 1, jpkm1
144               DO jj = 2, jpjm1 
145                  DO ji = fs_2, fs_jpim1   ! vector opt.
146                     ze3tb = e3t_b(ji,jj,jk) / e3t_n(ji,jj,jk)                          ! before e3t
147                     ztra  = zwx(ji,jj,jk) - ptb(ji,jj,jk,jn) + p2dt(jk) * pta(ji,jj,jk,jn)       ! total trends * 2*rdt
148                     pta(ji,jj,jk,jn) = ( ze3tb * ptb(ji,jj,jk,jn) + ztra ) * tmask(ji,jj,jk)
149                  END DO
150               END DO
151            END DO
152         ELSE                          ! fixed level thickness : leap-frog on tracers
153            DO jk = 1, jpkm1
154               DO jj = 2, jpjm1 
155                  DO ji = fs_2, fs_jpim1   ! vector opt.
156                     pta(ji,jj,jk,jn) = ( zwx(ji,jj,jk) + p2dt(jk) * pta(ji,jj,jk,jn) ) * tmask(ji,jj,jk)
157                  END DO
158               END DO
159            END DO
160         ENDIF
161         !
162      END DO
163      !
164      CALL wrk_dealloc( jpi,jpj,jpk,   zwx, zwy ) 
165      !
166      IF( nn_timing == 1 )  CALL timing_stop('tra_zdf_exp')
167      !
168   END SUBROUTINE tra_zdf_exp
169
170   !!==============================================================================
171END MODULE trazdf_exp
Note: See TracBrowser for help on using the repository browser.