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_bilap.F90 in branches/nemo_v3_3_beta/NEMOGCM/NEMO/OPA_SRC/TRA – NEMO

source: branches/nemo_v3_3_beta/NEMOGCM/NEMO/OPA_SRC/TRA/traldf_bilap.F90 @ 2326

Last change on this file since 2326 was 2287, checked in by smasson, 14 years ago

update licence of all NEMO files...

  • Property svn:keywords set to Id
File size: 9.1 KB
Line 
1MODULE traldf_bilap
2   !!==============================================================================
3   !!                   ***  MODULE  traldf_bilap  ***
4   !! Ocean  tracers:  horizontal component of the lateral tracer mixing trend
5   !!==============================================================================
6   !! History :  OPA  !  1991-11  (G. Madec)  Original code
7   !!                 !  1993-03  (M. Guyon)  symetrical conditions
8   !!                 !  1995-11  (G. Madec)  suppress volumetric scale factors
9   !!                 !  1996-01  (G. Madec)  statement function for e3
10   !!                 !  1996-01  (M. Imbard)  mpp exchange
11   !!                 !  1997-07  (G. Madec)  optimization, and ahtt
12   !!            8.5  !  2002-08  (G. Madec)  F90: Free form and module
13   !!   NEMO     1.0  !  2004-08  (C. Talandier) New trends organization
14   !!             -   !  2005-11  (G. Madec)  zps or sco as default option
15   !!            3.3  !  2010-05  (C. Ethe, G. Madec)  merge TRC-TRA
16   !!==============================================================================
17
18   !!----------------------------------------------------------------------
19   !!   tra_ldf_bilap : update the tracer trend with the horizontal diffusion
20   !!                   using a iso-level biharmonic operator
21   !!----------------------------------------------------------------------
22   USE oce             ! ocean dynamics and active tracers
23   USE dom_oce         ! ocean space and time domain
24   USE ldftra_oce      ! ocean tracer   lateral physics
25   USE in_out_manager  ! I/O manager
26   USE ldfslp          ! iso-neutral slopes
27   USE lbclnk          ! ocean lateral boundary conditions (or mpp link)
28   USE diaptr          ! poleward transport diagnostics
29   USE trc_oce         ! share passive tracers/Ocean variables
30
31   IMPLICIT NONE
32   PRIVATE
33
34   PUBLIC   tra_ldf_bilap   ! routine called by step.F90
35
36   !! * Substitutions
37#  include "domzgr_substitute.h90"
38#  include "ldftra_substitute.h90"
39#  include "ldfeiv_substitute.h90"
40#  include "vectopt_loop_substitute.h90"
41   !!----------------------------------------------------------------------
42   !! NEMO/OPA 3.3 , NEMO Consortium (2010)
43   !! $Id$
44   !! Software governed by the CeCILL licence (NEMOGCM/NEMO_CeCILL.txt)
45   !!----------------------------------------------------------------------
46
47CONTAINS
48 
49   SUBROUTINE tra_ldf_bilap( kt, cdtype, pgu, pgv,  &
50      &                                  ptb, pta, kjpt ) 
51      !!----------------------------------------------------------------------
52      !!                  ***  ROUTINE tra_ldf_bilap  ***
53      !!
54      !! ** Purpose :   Compute the before horizontal tracer diffusive
55      !!      trend and add it to the general trend of tracer equation.
56      !!
57      !! ** Method  :   4th order diffusive operator along model level surfaces
58      !!      evaluated using before fields (forward time scheme). The hor.
59      !!      diffusive trends  is given by:
60      !!      Laplacian of tb:
61      !!         zlt   = 1/(e1t*e2t*e3t) {  di-1[ e2u*e3u/e1u di(tb) ]
62      !!                                  + dj-1[ e1v*e3v/e2v dj(tb) ]  }
63      !!      Multiply by the eddy diffusivity coef. and insure lateral bc:
64      !!        zlt   = ahtt * zlt
65      !!        call to lbc_lnk
66      !!      Bilaplacian (laplacian of zlt):
67      !!         difft = 1/(e1t*e2t*e3t) {  di-1[ e2u*e3u/e1u di(zlt) ]
68      !!                                  + dj-1[ e1v*e3v/e2v dj(zlt) ]  }
69      !!
70      !!      Add this trend to the general trend
71      !!         (pta) = (pta) + ( difft )
72      !!
73      !! ** Action : - Update pta arrays with the before iso-level
74      !!               biharmonic mixing trend.
75      !!----------------------------------------------------------------------
76      !!
77      USE oce         , ztu => ua   ! use ua as workspace
78      USE oce         , ztv => va   ! use va as workspace
79      !!
80      INTEGER                              , INTENT(in   ) ::   kt         ! ocean time-step index
81      CHARACTER(len=3)                     , INTENT(in   ) ::   cdtype     ! =TRA or TRC (tracer indicator)
82      INTEGER                              , INTENT(in   ) ::   kjpt       ! number of tracers
83      REAL(wp), DIMENSION(jpi,jpj,    kjpt), INTENT(in   ) ::   pgu, pgv   ! tracer gradient at pstep levels
84      REAL(wp), DIMENSION(jpi,jpj,jpk,kjpt), INTENT(in   ) ::   ptb        ! before and now tracer fields
85      REAL(wp), DIMENSION(jpi,jpj,jpk,kjpt), INTENT(inout) ::   pta        ! tracer trend
86      !!
87      INTEGER  ::  ji, jj, jk, jn   ! dummy loop indices
88      INTEGER  ::  iku, ikv         ! local integers
89      REAL(wp) ::  zbtr, ztra       ! local scalars
90      REAL(wp), DIMENSION(jpi,jpj) ::   zeeu, zeev, zlt   ! 2D workspace
91      !!----------------------------------------------------------------------
92
93      IF( kt == nit000 )  THEN
94         IF(lwp) WRITE(numout,*)
95         IF(lwp) WRITE(numout,*) 'tra_ldf_bilap : iso-level biharmonic operator on ', cdtype
96         IF(lwp) WRITE(numout,*) '~~~~~~~~~~~~~'
97      ENDIF
98      !                                                          ! ===========
99      DO jn = 1, kjpt                                            ! tracer loop
100         !                                                       ! ===========
101         !                                               
102         DO jk = 1, jpkm1                                        ! Horizontal slab
103            !                                             
104            !                          !==  Initialization of metric arrays (for z- or s-coordinates)  ==!
105            DO jj = 1, jpjm1
106               DO ji = 1, fs_jpim1   ! vector opt.
107                  zeeu(ji,jj) = e2u(ji,jj) * fse3u(ji,jj,jk) / e1u(ji,jj) * umask(ji,jj,jk)
108                  zeev(ji,jj) = e1v(ji,jj) * fse3v(ji,jj,jk) / e2v(ji,jj) * vmask(ji,jj,jk)
109               END DO
110            END DO
111
112            !                          !==  Laplacian  ==!
113            !
114            DO jj = 1, jpjm1                 ! First derivative (gradient)
115               DO ji = 1, fs_jpim1   ! vector opt.
116                  ztu(ji,jj,jk) = zeeu(ji,jj) * ( ptb(ji+1,jj  ,jk,jn) - ptb(ji,jj,jk,jn) )
117                  ztv(ji,jj,jk) = zeev(ji,jj) * ( ptb(ji  ,jj+1,jk,jn) - ptb(ji,jj,jk,jn) )
118               END DO
119            END DO
120            IF( ln_zps ) THEN                ! set gradient at partial step level
121               DO jj = 1, jpjm1
122                  DO ji = 1, jpim1
123                     ! last level
124                     iku = MIN ( mbathy(ji,jj), mbathy(ji+1,jj  ) ) - 1
125                     ikv = MIN ( mbathy(ji,jj), mbathy(ji  ,jj+1) ) - 1
126                     IF( iku == jk )  ztu(ji,jj,jk) = zeeu(ji,jj) * pgu(ji,jj,jn)
127                     IF( ikv == jk )  ztv(ji,jj,jk) = zeev(ji,jj) * pgv(ji,jj,jn)
128                  END DO
129               END DO
130            ENDIF
131            DO jj = 2, jpjm1                 ! Second derivative (divergence) time the eddy diffusivity coefficient
132               DO ji = fs_2, fs_jpim1   ! vector opt.
133                  zbtr = 1.0 / ( e1t(ji,jj) * e2t(ji,jj) * fse3t(ji,jj,jk) )
134                  zlt(ji,jj) = fsahtt(ji,jj,jk) * zbtr * (   ztu(ji,jj,jk) - ztu(ji-1,jj,jk)   &
135                     &                                     + ztv(ji,jj,jk) - ztv(ji,jj-1,jk)   )
136               END DO
137            END DO
138            CALL lbc_lnk( zlt, 'T', 1. )     ! Lateral boundary conditions (unchanged sgn)
139
140            !                          !==  Bilaplacian  ==!
141            !
142            DO jj = 1, jpjm1                 ! third derivative (gradient)
143               DO ji = 1, fs_jpim1   ! vector opt.
144                  ztu(ji,jj,jk) = zeeu(ji,jj) * ( zlt(ji+1,jj  ) - zlt(ji,jj) )
145                  ztv(ji,jj,jk) = zeev(ji,jj) * ( zlt(ji  ,jj+1) - zlt(ji,jj) )
146               END DO
147            END DO
148            DO jj = 2, jpjm1                 ! fourth derivative (divergence) and add to the general tracer trend
149               DO ji = fs_2, fs_jpim1   ! vector opt.
150                  ! horizontal diffusive trends
151                  zbtr = 1.0 / ( e1t(ji,jj) * e2t(ji,jj) * fse3t(ji,jj,jk) )
152                  ztra = zbtr * (  ztu(ji,jj,jk) - ztu(ji-1,jj,jk) + ztv(ji,jj,jk) - ztv(ji,jj-1,jk)  )
153                  ! add it to the general tracer trends
154                  pta(ji,jj,jk,jn) = pta(ji,jj,jk,jn) + ztra
155               END DO
156            END DO
157            !                                             
158         END DO                                           ! Horizontal slab
159         !                                               
160         ! "zonal" mean lateral diffusive heat and salt transport
161         IF( cdtype == 'TRA' .AND. ln_diaptr .AND. ( MOD( kt, nf_ptr ) == 0 ) ) THEN 
162           IF( jn == jp_tem )  pht_ldf(:) = ptr_vj( ztv(:,:,:) )
163           IF( jn == jp_sal )  pst_ldf(:) = ptr_vj( ztv(:,:,:) )
164         ENDIF
165         !                                                ! ===========
166      END DO                                              ! tracer loop
167      !                                                   ! ===========
168   END SUBROUTINE tra_ldf_bilap
169
170   !!==============================================================================
171END MODULE traldf_bilap
Note: See TracBrowser for help on using the repository browser.