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.
traldf_iso.F90 in NEMO/branches/2019/dev_r11943_MERGE_2019/src/OCE/TRA – NEMO

source: NEMO/branches/2019/dev_r11943_MERGE_2019/src/OCE/TRA/traldf_iso.F90 @ 12340

Last change on this file since 12340 was 12340, checked in by acc, 4 years ago

Branch 2019/dev_r11943_MERGE_2019. This commit introduces basic do loop macro
substitution to the 2019 option 1, merge branch. These changes have been SETTE
tested. The only addition is the do_loop_substitute.h90 file in the OCE directory but
the macros defined therein are used throughout the code to replace identifiable, 2D-
and 3D- nested loop opening and closing statements with single-line alternatives. Code
indents are also adjusted accordingly.

The following explanation is taken from comments in the new header file:

This header file contains preprocessor definitions and macros used in the do-loop
substitutions introduced between version 4.0 and 4.2. The primary aim of these macros
is to assist in future applications of tiling to improve performance. This is expected
to be achieved by alternative versions of these macros in selected locations. The
initial introduction of these macros simply replaces all identifiable nested 2D- and
3D-loops with single line statements (and adjusts indenting accordingly). Do loops
are identifiable if they comform to either:

DO jk = ....

DO jj = .... DO jj = ...

DO ji = .... DO ji = ...
. OR .
. .

END DO END DO

END DO END DO

END DO

and white-space variants thereof.

Additionally, only loops with recognised jj and ji loops limits are treated; these are:
Lower limits of 1, 2 or fs_2
Upper limits of jpi, jpim1 or fs_jpim1 (for ji) or jpj, jpjm1 or fs_jpjm1 (for jj)

The macro naming convention takes the form: DO_2D_BT_LR where:

B is the Bottom offset from the PE's inner domain;
T is the Top offset from the PE's inner domain;
L is the Left offset from the PE's inner domain;
R is the Right offset from the PE's inner domain

So, given an inner domain of 2,jpim1 and 2,jpjm1, a typical example would replace:

DO jj = 2, jpj

DO ji = 1, jpim1
.
.

END DO

END DO

with:

DO_2D_01_10
.
.
END_2D

similar conventions apply to the 3D loops macros. jk loop limits are retained
through macro arguments and are not restricted. This includes the possibility of
strides for which an extra set of DO_3DS macros are defined.

In the example definition below the inner PE domain is defined by start indices of
(kIs, kJs) and end indices of (kIe, KJe)

#define DO_2D_00_00 DO jj = kJs, kJe ; DO ji = kIs, kIe
#define END_2D END DO ; END DO

TO DO:


Only conventional nested loops have been identified and replaced by this step. There are constructs such as:

DO jk = 2, jpkm1

z2d(:,:) = z2d(:,:) + e3w(:,:,jk,Kmm) * z3d(:,:,jk) * wmask(:,:,jk)

END DO

which may need to be considered.

  • Property svn:keywords set to Id
File size: 19.4 KB
Line 
1MODULE traldf_iso
2   !!======================================================================
3   !!                   ***  MODULE  traldf_iso  ***
4   !! Ocean  tracers:  horizontal component of the lateral tracer mixing trend
5   !!======================================================================
6   !! History :  OPA  ! 1994-08  (G. Madec, M. Imbard)
7   !!            8.0  ! 1997-05  (G. Madec)  split into traldf and trazdf
8   !!            NEMO ! 2002-08  (G. Madec)  Free form, F90
9   !!            1.0  ! 2005-11  (G. Madec)  merge traldf and trazdf :-)
10   !!            3.3  ! 2010-09  (C. Ethe, G. Madec) Merge TRA-TRC
11   !!            3.7  ! 2014-01  (G. Madec, S. Masson)  restructuration/simplification of aht/aeiv specification
12   !!             -   ! 2014-02  (F. Lemarie, G. Madec)  triad operator (Griffies) + Method of Stabilizing Correction
13   !!----------------------------------------------------------------------
14
15   !!----------------------------------------------------------------------
16   !!   tra_ldf_iso   : update the tracer trend with the horizontal component of a iso-neutral laplacian operator
17   !!                   and with the vertical part of the isopycnal or geopotential s-coord. operator
18   !!----------------------------------------------------------------------
19   USE oce            ! ocean dynamics and active tracers
20   USE dom_oce        ! ocean space and time domain
21   USE trc_oce        ! share passive tracers/Ocean variables
22   USE zdf_oce        ! ocean vertical physics
23   USE ldftra         ! lateral diffusion: tracer eddy coefficients
24   USE ldfslp         ! iso-neutral slopes
25   USE diaptr         ! poleward transport diagnostics
26   USE diaar5         ! AR5 diagnostics
27   !
28   USE in_out_manager ! I/O manager
29   USE iom            ! I/O library
30   USE phycst         ! physical constants
31   USE lbclnk         ! ocean lateral boundary conditions (or mpp link)
32
33   IMPLICIT NONE
34   PRIVATE
35
36   PUBLIC   tra_ldf_iso   ! routine called by step.F90
37
38   LOGICAL  ::   l_ptr   ! flag to compute poleward transport
39   LOGICAL  ::   l_hst   ! flag to compute heat transport
40
41   !! * Substitutions
42#  include "vectopt_loop_substitute.h90"
43#  include "do_loop_substitute.h90"
44   !!----------------------------------------------------------------------
45   !! NEMO/OCE 4.0 , NEMO Consortium (2018)
46   !! $Id$
47   !! Software governed by the CeCILL license (see ./LICENSE)
48   !!----------------------------------------------------------------------
49CONTAINS
50
51  SUBROUTINE tra_ldf_iso( kt, Kmm, kit000, cdtype, pahu, pahv,                    &
52      &                                            pgu , pgv    ,   pgui, pgvi,   &
53      &                                       pt , pt2 , pt_rhs , kjpt  , kpass )
54      !!----------------------------------------------------------------------
55      !!                  ***  ROUTINE tra_ldf_iso  ***
56      !!
57      !! ** Purpose :   Compute the before horizontal tracer (t & s) diffusive
58      !!      trend for a laplacian tensor (ezxcept the dz[ dz[.] ] term) and
59      !!      add it to the general trend of tracer equation.
60      !!
61      !! ** Method  :   The horizontal component of the lateral diffusive trends
62      !!      is provided by a 2nd order operator rotated along neural or geopo-
63      !!      tential surfaces to which an eddy induced advection can be added
64      !!      It is computed using before fields (forward in time) and isopyc-
65      !!      nal or geopotential slopes computed in routine ldfslp.
66      !!
67      !!      1st part :  masked horizontal derivative of T  ( di[ t ] )
68      !!      ========    with partial cell update if ln_zps=T
69      !!                  with top     cell update if ln_isfcav
70      !!
71      !!      2nd part :  horizontal fluxes of the lateral mixing operator
72      !!      ========   
73      !!         zftu =  pahu e2u*e3u/e1u di[ tb ]
74      !!               - pahu e2u*uslp    dk[ mi(mk(tb)) ]
75      !!         zftv =  pahv e1v*e3v/e2v dj[ tb ]
76      !!               - pahv e2u*vslp    dk[ mj(mk(tb)) ]
77      !!      take the horizontal divergence of the fluxes:
78      !!         difft = 1/(e1e2t*e3t) {  di-1[ zftu ] +  dj-1[ zftv ]  }
79      !!      Add this trend to the general trend (ta,sa):
80      !!         ta = ta + difft
81      !!
82      !!      3rd part: vertical trends of the lateral mixing operator
83      !!      ========  (excluding the vertical flux proportional to dk[t] )
84      !!      vertical fluxes associated with the rotated lateral mixing:
85      !!         zftw = - {  mi(mk(pahu)) * e2t*wslpi di[ mi(mk(tb)) ]
86      !!                   + mj(mk(pahv)) * e1t*wslpj dj[ mj(mk(tb)) ]  }
87      !!      take the horizontal divergence of the fluxes:
88      !!         difft = 1/(e1e2t*e3t) dk[ zftw ]
89      !!      Add this trend to the general trend (ta,sa):
90      !!         pt_rhs = pt_rhs + difft
91      !!
92      !! ** Action :   Update pt_rhs arrays with the before rotated diffusion
93      !!----------------------------------------------------------------------
94      INTEGER                              , INTENT(in   ) ::   kt         ! ocean time-step index
95      INTEGER                              , INTENT(in   ) ::   kit000     ! first time step index
96      CHARACTER(len=3)                     , INTENT(in   ) ::   cdtype     ! =TRA or TRC (tracer indicator)
97      INTEGER                              , INTENT(in   ) ::   kjpt       ! number of tracers
98      INTEGER                              , INTENT(in   ) ::   kpass      ! =1/2 first or second passage
99      INTEGER                              , INTENT(in   ) ::   Kmm        ! ocean time level index
100      REAL(wp), DIMENSION(jpi,jpj,jpk)     , INTENT(in   ) ::   pahu, pahv ! eddy diffusivity at u- and v-points  [m2/s]
101      REAL(wp), DIMENSION(jpi,jpj    ,kjpt), INTENT(in   ) ::   pgu, pgv   ! tracer gradient at pstep levels
102      REAL(wp), DIMENSION(jpi,jpj,    kjpt), INTENT(in   ) ::   pgui, pgvi ! tracer gradient at top   levels
103      REAL(wp), DIMENSION(jpi,jpj,jpk,kjpt), INTENT(in   ) ::   pt         ! tracer (kpass=1) or laplacian of tracer (kpass=2)
104      REAL(wp), DIMENSION(jpi,jpj,jpk,kjpt), INTENT(in   ) ::   pt2        ! tracer (only used in kpass=2)
105      REAL(wp), DIMENSION(jpi,jpj,jpk,kjpt), INTENT(inout) ::   pt_rhs     ! tracer trend
106      !
107      INTEGER  ::  ji, jj, jk, jn   ! dummy loop indices
108      INTEGER  ::  ikt
109      INTEGER  ::  ierr             ! local integer
110      REAL(wp) ::  zmsku, zahu_w, zabe1, zcof1, zcoef3   ! local scalars
111      REAL(wp) ::  zmskv, zahv_w, zabe2, zcof2, zcoef4   !   -      -
112      REAL(wp) ::  zcoef0, ze3w_2, zsign, z2dt, z1_2dt   !   -      -
113      REAL(wp), DIMENSION(jpi,jpj)     ::   zdkt, zdk1t, z2d
114      REAL(wp), DIMENSION(jpi,jpj,jpk) ::   zdit, zdjt, zftu, zftv, ztfw 
115      !!----------------------------------------------------------------------
116      !
117      IF( kpass == 1 .AND. kt == kit000 )  THEN
118         IF(lwp) WRITE(numout,*)
119         IF(lwp) WRITE(numout,*) 'tra_ldf_iso : rotated laplacian diffusion operator on ', cdtype
120         IF(lwp) WRITE(numout,*) '~~~~~~~~~~~'
121         !
122         akz     (:,:,:) = 0._wp     
123         ah_wslp2(:,:,:) = 0._wp
124      ENDIF
125      !   
126      l_hst = .FALSE.
127      l_ptr = .FALSE.
128      IF( cdtype == 'TRA' .AND. ( iom_use( 'sophtldf' ) .OR. iom_use( 'sopstldf' ) ) )     l_ptr = .TRUE. 
129      IF( cdtype == 'TRA' .AND. ( iom_use("uadv_heattr") .OR. iom_use("vadv_heattr") .OR. &
130         &                        iom_use("uadv_salttr") .OR. iom_use("vadv_salttr")  ) )   l_hst = .TRUE.
131      !
132      !                                            ! set time step size (Euler/Leapfrog)
133      IF( neuler == 0 .AND. kt == nit000 ) THEN   ;   z2dt =     rdt      ! at nit000   (Euler)
134      ELSE                                        ;   z2dt = 2.* rdt      !             (Leapfrog)
135      ENDIF
136      z1_2dt = 1._wp / z2dt
137      !
138      IF( kpass == 1 ) THEN   ;   zsign =  1._wp      ! bilaplacian operator require a minus sign (eddy diffusivity >0)
139      ELSE                    ;   zsign = -1._wp
140      ENDIF
141         
142      !!----------------------------------------------------------------------
143      !!   0 - calculate  ah_wslp2 and akz
144      !!----------------------------------------------------------------------
145      !
146      IF( kpass == 1 ) THEN                  !==  first pass only  ==!
147         !
148         DO_3D_00_00( 2, jpkm1 )
149            !
150            zmsku = wmask(ji,jj,jk) / MAX(   umask(ji  ,jj,jk-1) + umask(ji-1,jj,jk)          &
151               &                           + umask(ji-1,jj,jk-1) + umask(ji  ,jj,jk) , 1._wp  )
152            zmskv = wmask(ji,jj,jk) / MAX(   vmask(ji,jj  ,jk-1) + vmask(ji,jj-1,jk)          &
153               &                           + vmask(ji,jj-1,jk-1) + vmask(ji,jj  ,jk) , 1._wp  )
154               !
155            zahu_w = (   pahu(ji  ,jj,jk-1) + pahu(ji-1,jj,jk)    &
156               &       + pahu(ji-1,jj,jk-1) + pahu(ji  ,jj,jk)  ) * zmsku
157            zahv_w = (   pahv(ji,jj  ,jk-1) + pahv(ji,jj-1,jk)    &
158               &       + pahv(ji,jj-1,jk-1) + pahv(ji,jj  ,jk)  ) * zmskv
159               !
160            ah_wslp2(ji,jj,jk) = zahu_w * wslpi(ji,jj,jk) * wslpi(ji,jj,jk)   &
161               &               + zahv_w * wslpj(ji,jj,jk) * wslpj(ji,jj,jk)
162         END_3D
163         !
164         IF( ln_traldf_msc ) THEN                ! stabilizing vertical diffusivity coefficient
165            DO_3D_00_00( 2, jpkm1 )
166               akz(ji,jj,jk) = 0.25_wp * (                                                                     &
167                  &              ( pahu(ji  ,jj,jk) + pahu(ji  ,jj,jk-1) ) / ( e1u(ji  ,jj) * e1u(ji  ,jj) )   &
168                  &            + ( pahu(ji-1,jj,jk) + pahu(ji-1,jj,jk-1) ) / ( e1u(ji-1,jj) * e1u(ji-1,jj) )   &
169                  &            + ( pahv(ji,jj  ,jk) + pahv(ji,jj  ,jk-1) ) / ( e2v(ji,jj  ) * e2v(ji,jj  ) )   &
170                  &            + ( pahv(ji,jj-1,jk) + pahv(ji,jj-1,jk-1) ) / ( e2v(ji,jj-1) * e2v(ji,jj-1) )   )
171            END_3D
172            !
173            IF( ln_traldf_blp ) THEN                ! bilaplacian operator
174               DO_3D_10_10( 2, jpkm1 )
175                  akz(ji,jj,jk) = 16._wp * ah_wslp2(ji,jj,jk)   &
176                     &          * (  akz(ji,jj,jk) + ah_wslp2(ji,jj,jk) / ( e3w(ji,jj,jk,Kmm) * e3w(ji,jj,jk,Kmm) )  )
177               END_3D
178            ELSEIF( ln_traldf_lap ) THEN              ! laplacian operator
179               DO_3D_10_10( 2, jpkm1 )
180                  ze3w_2 = e3w(ji,jj,jk,Kmm) * e3w(ji,jj,jk,Kmm)
181                  zcoef0 = z2dt * (  akz(ji,jj,jk) + ah_wslp2(ji,jj,jk) / ze3w_2  )
182                  akz(ji,jj,jk) = MAX( zcoef0 - 0.5_wp , 0._wp ) * ze3w_2 * z1_2dt
183               END_3D
184           ENDIF
185           !
186         ELSE                                    ! 33 flux set to zero with akz=ah_wslp2 ==>> computed in full implicit
187            akz(:,:,:) = ah_wslp2(:,:,:)     
188         ENDIF
189      ENDIF
190      !
191      !                                                          ! ===========
192      DO jn = 1, kjpt                                            ! tracer loop
193         !                                                       ! ===========
194         !                                               
195         !!----------------------------------------------------------------------
196         !!   I - masked horizontal derivative
197         !!----------------------------------------------------------------------
198!!gm : bug.... why (x,:,:)?   (1,jpj,:) and (jpi,1,:) should be sufficient....
199         zdit (1,:,:) = 0._wp     ;     zdit (jpi,:,:) = 0._wp
200         zdjt (1,:,:) = 0._wp     ;     zdjt (jpi,:,:) = 0._wp
201         !!end
202
203         ! Horizontal tracer gradient
204         DO_3D_10_10( 1, jpkm1 )
205            zdit(ji,jj,jk) = ( pt(ji+1,jj  ,jk,jn) - pt(ji,jj,jk,jn) ) * umask(ji,jj,jk)
206            zdjt(ji,jj,jk) = ( pt(ji  ,jj+1,jk,jn) - pt(ji,jj,jk,jn) ) * vmask(ji,jj,jk)
207         END_3D
208         IF( ln_zps ) THEN      ! botton and surface ocean correction of the horizontal gradient
209            DO_2D_10_10
210               zdit(ji,jj,mbku(ji,jj)) = pgu(ji,jj,jn)         
211               zdjt(ji,jj,mbkv(ji,jj)) = pgv(ji,jj,jn)
212            END_2D
213            IF( ln_isfcav ) THEN      ! first wet level beneath a cavity
214               DO_2D_10_10
215                  IF( miku(ji,jj) > 1 )   zdit(ji,jj,miku(ji,jj)) = pgui(ji,jj,jn)         
216                  IF( mikv(ji,jj) > 1 )   zdjt(ji,jj,mikv(ji,jj)) = pgvi(ji,jj,jn)     
217               END_2D
218            ENDIF
219         ENDIF
220         !
221         !!----------------------------------------------------------------------
222         !!   II - horizontal trend  (full)
223         !!----------------------------------------------------------------------
224         !
225         DO jk = 1, jpkm1                                 ! Horizontal slab
226            !
227            !                             !== Vertical tracer gradient
228            zdk1t(:,:) = ( pt(:,:,jk,jn) - pt(:,:,jk+1,jn) ) * wmask(:,:,jk+1)     ! level jk+1
229            !
230            IF( jk == 1 ) THEN   ;   zdkt(:,:) = zdk1t(:,:)                          ! surface: zdkt(jk=1)=zdkt(jk=2)
231            ELSE                 ;   zdkt(:,:) = ( pt(:,:,jk-1,jn) - pt(:,:,jk,jn) ) * wmask(:,:,jk)
232            ENDIF
233            DO_2D_10_10
234               zabe1 = pahu(ji,jj,jk) * e2_e1u(ji,jj) * e3u(ji,jj,jk,Kmm)
235               zabe2 = pahv(ji,jj,jk) * e1_e2v(ji,jj) * e3v(ji,jj,jk,Kmm)
236               !
237               zmsku = 1. / MAX(  wmask(ji+1,jj,jk  ) + wmask(ji,jj,jk+1)   &
238                  &             + wmask(ji+1,jj,jk+1) + wmask(ji,jj,jk  ), 1. )
239               !
240               zmskv = 1. / MAX(  wmask(ji,jj+1,jk  ) + wmask(ji,jj,jk+1)   &
241                  &             + wmask(ji,jj+1,jk+1) + wmask(ji,jj,jk  ), 1. )
242               !
243               zcof1 = - pahu(ji,jj,jk) * e2u(ji,jj) * uslp(ji,jj,jk) * zmsku
244               zcof2 = - pahv(ji,jj,jk) * e1v(ji,jj) * vslp(ji,jj,jk) * zmskv
245               !
246               zftu(ji,jj,jk ) = (  zabe1 * zdit(ji,jj,jk)   &
247                  &               + zcof1 * (  zdkt (ji+1,jj) + zdk1t(ji,jj)      &
248                  &                          + zdk1t(ji+1,jj) + zdkt (ji,jj)  )  ) * umask(ji,jj,jk)
249               zftv(ji,jj,jk) = (  zabe2 * zdjt(ji,jj,jk)   &
250                  &               + zcof2 * (  zdkt (ji,jj+1) + zdk1t(ji,jj)      &
251                  &                          + zdk1t(ji,jj+1) + zdkt (ji,jj)  )  ) * vmask(ji,jj,jk)                 
252            END_2D
253            !
254            DO_2D_00_00
255               pt_rhs(ji,jj,jk,jn) = pt_rhs(ji,jj,jk,jn) + zsign * (  zftu(ji,jj,jk) - zftu(ji-1,jj,jk)      &
256                  &                                                 + zftv(ji,jj,jk) - zftv(ji,jj-1,jk)  )   &
257                  &                                              * r1_e1e2t(ji,jj) / e3t(ji,jj,jk,Kmm)
258            END_2D
259         END DO                                        !   End of slab 
260
261         !!----------------------------------------------------------------------
262         !!   III - vertical trend (full)
263         !!----------------------------------------------------------------------
264         !
265         ztfw(fs_2:1,:,:) = 0._wp     ;     ztfw(jpi:fs_jpim1,:,:) = 0._wp   ! avoid to potentially manipulate NaN values
266         !
267         ! Vertical fluxes
268         ! ---------------
269         !                          ! Surface and bottom vertical fluxes set to zero
270         ztfw(:,:, 1 ) = 0._wp      ;      ztfw(:,:,jpk) = 0._wp
271         
272         DO_3D_00_00( 2, jpkm1 )
273            !
274            zmsku = wmask(ji,jj,jk) / MAX(   umask(ji  ,jj,jk-1) + umask(ji-1,jj,jk)          &
275               &                           + umask(ji-1,jj,jk-1) + umask(ji  ,jj,jk) , 1._wp  )
276            zmskv = wmask(ji,jj,jk) / MAX(   vmask(ji,jj  ,jk-1) + vmask(ji,jj-1,jk)          &
277               &                           + vmask(ji,jj-1,jk-1) + vmask(ji,jj  ,jk) , 1._wp  )
278               !
279            zahu_w = (   pahu(ji  ,jj,jk-1) + pahu(ji-1,jj,jk)    &
280               &       + pahu(ji-1,jj,jk-1) + pahu(ji  ,jj,jk)  ) * zmsku
281            zahv_w = (   pahv(ji,jj  ,jk-1) + pahv(ji,jj-1,jk)    &
282               &       + pahv(ji,jj-1,jk-1) + pahv(ji,jj  ,jk)  ) * zmskv
283               !
284            zcoef3 = - zahu_w * e2t(ji,jj) * zmsku * wslpi (ji,jj,jk)   !wslpi & j are already w-masked
285            zcoef4 = - zahv_w * e1t(ji,jj) * zmskv * wslpj (ji,jj,jk)
286            !
287            ztfw(ji,jj,jk) = zcoef3 * (   zdit(ji  ,jj  ,jk-1) + zdit(ji-1,jj  ,jk)      &
288               &                        + zdit(ji-1,jj  ,jk-1) + zdit(ji  ,jj  ,jk)  )   &
289               &           + zcoef4 * (   zdjt(ji  ,jj  ,jk-1) + zdjt(ji  ,jj-1,jk)      &
290               &                        + zdjt(ji  ,jj-1,jk-1) + zdjt(ji  ,jj  ,jk)  )
291         END_3D
292         !                                !==  add the vertical 33 flux  ==!
293         IF( ln_traldf_lap ) THEN               ! laplacian case: eddy coef = ah_wslp2 - akz
294            DO_3D_00_00( 2, jpkm1 )
295               ztfw(ji,jj,jk) = ztfw(ji,jj,jk) + e1e2t(ji,jj) / e3w(ji,jj,jk,Kmm) * wmask(ji,jj,jk)   &
296                  &                            * ( ah_wslp2(ji,jj,jk) - akz(ji,jj,jk) )               &
297                  &                            * (  pt(ji,jj,jk-1,jn) -  pt(ji,jj,jk,jn) )
298            END_3D
299            !
300         ELSE                                   ! bilaplacian
301            SELECT CASE( kpass )
302            CASE(  1  )                            ! 1st pass : eddy coef = ah_wslp2
303               DO_3D_00_00( 2, jpkm1 )
304                  ztfw(ji,jj,jk) = ztfw(ji,jj,jk)                       &
305                     &           + ah_wslp2(ji,jj,jk)  * e1e2t(ji,jj)   &
306                     &           * ( pt(ji,jj,jk-1,jn) - pt(ji,jj,jk,jn) ) / e3w(ji,jj,jk,Kmm) * wmask(ji,jj,jk)
307               END_3D
308            CASE(  2  )                         ! 2nd pass : eddy flux = ah_wslp2 and akz applied on pt  and pt2 gradients, resp.
309               DO_3D_00_00( 2, jpkm1 )
310                  ztfw(ji,jj,jk) = ztfw(ji,jj,jk) + e1e2t(ji,jj) / e3w(ji,jj,jk,Kmm) * wmask(ji,jj,jk)                  &
311                     &                            * (  ah_wslp2(ji,jj,jk) * ( pt (ji,jj,jk-1,jn) - pt (ji,jj,jk,jn) )   &
312                     &                            +         akz(ji,jj,jk) * ( pt2(ji,jj,jk-1,jn) - pt2(ji,jj,jk,jn) )   )
313               END_3D
314            END SELECT
315         ENDIF
316         !         
317         DO_3D_00_00( 1, jpkm1 )
318            pt_rhs(ji,jj,jk,jn) = pt_rhs(ji,jj,jk,jn) + zsign * (  ztfw (ji,jj,jk) - ztfw(ji,jj,jk+1)  )   &
319               &                                              * r1_e1e2t(ji,jj) / e3t(ji,jj,jk,Kmm)
320         END_3D
321         !
322         IF( ( kpass == 1 .AND. ln_traldf_lap ) .OR.  &     !==  first pass only (  laplacian)  ==!
323             ( kpass == 2 .AND. ln_traldf_blp ) ) THEN      !==  2nd   pass      (bilaplacian)  ==!
324            !
325            !                             ! "Poleward" diffusive heat or salt transports (T-S case only)
326               ! note sign is reversed to give down-gradient diffusive transports )
327            IF( l_ptr )  CALL dia_ptr_hst( jn, 'ldf', -zftv(:,:,:)  )
328            !                          ! Diffusive heat transports
329            IF( l_hst )  CALL dia_ar5_hst( jn, 'ldf', -zftu(:,:,:), -zftv(:,:,:) )
330            !
331         ENDIF                                                    !== end pass selection  ==!
332         !
333         !                                                        ! ===============
334      END DO                                                      ! end tracer loop
335      !
336   END SUBROUTINE tra_ldf_iso
337
338   !!==============================================================================
339END MODULE traldf_iso
Note: See TracBrowser for help on using the repository browser.