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.
trcldf_bilap.F90 in trunk/NEMO/TOP_SRC/TRP – NEMO

source: trunk/NEMO/TOP_SRC/TRP/trcldf_bilap.F90 @ 202

Last change on this file since 202 was 202, checked in by opalod, 19 years ago

CT : UPDATE142 : Check the consistency between passive tracers transport modules (in TRP directory) and those used for the active tracers

  • Property svn:eol-style set to native
  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
File size: 9.8 KB
Line 
1MODULE trcldf_bilap
2   !!==============================================================================
3   !!                   ***  MODULE  trcldf_bilap  ***
4   !! Ocean passive tracers:  horizontal component of the lateral tracer mixing trend
5   !!==============================================================================
6#if defined key_passivetrc
7   !!----------------------------------------------------------------------
8   !!   trc_ldf_bilap : update the tracer trend with the horizontal diffusion
9   !!                   using a iso-level biharmonic operator
10   !!----------------------------------------------------------------------
11   !! * Modules used
12   USE oce_trc         ! ocean dynamics and active tracers variables
13   USE trc             ! ocean passive tracers variables
14   USE lbclnk          ! ocean lateral boundary conditions (or mpp link)
15
16   IMPLICIT NONE
17   PRIVATE
18
19   !! * Routine accessibility
20   PUBLIC trc_ldf_bilap   ! routine called by step.F90
21
22   !! * Substitutions
23#  include "passivetrc_substitute.h90"
24   !!----------------------------------------------------------------------
25   !!   OPA 9.0 , LODYC-IPSL (2003)
26   !!----------------------------------------------------------------------
27
28CONTAINS
29   
30   SUBROUTINE trc_ldf_bilap( kt )
31      !!----------------------------------------------------------------------
32      !!                  ***  ROUTINE trc_ldf_bilap  ***
33      !!
34      !! ** Purpose :   Compute the before horizontal tracer tra diffusive
35      !!      trend and add it to the general trend of tracer equation.
36      !!
37      !! ** Method  :   4th order diffusive operator along model level surfaces
38      !!      evaluated using before fields (forward time scheme). The hor.
39      !!      diffusive trends of passive tracer is given by:
40      !!       * s-coordinate ('key_s_coord' defined), the vertical scale
41      !!      factors e3. are inside the derivatives:
42      !!      Laplacian of trb:
43      !!         zlt   = 1/(e1t*e2t*e3t) {  di-1[ e2u*e3u/e1u di(trb) ]
44      !!                                  + dj-1[ e1v*e3v/e2v dj(trb) ]  }
45      !!      Multiply by the eddy diffusivity coef. and insure lateral bc:
46      !!        zlt   = ahtt * zlt
47      !!        call to lbc_lnk
48      !!      Bilaplacian (laplacian of zlt):
49      !!         difft = 1/(e1t*e2t*e3t) {  di-1[ e2u*e3u/e1u di(zlt) ]
50      !!                                  + dj-1[ e1v*e3v/e2v dj(zlt) ]  }
51      !!       * z-coordinate (default key), e3t=e3u=e3v, the trend becomes:
52      !!      Laplacian of trb:
53      !!         zlt   = 1/(e1t*e2t) {  di-1[ e2u/e1u di(trb) ]
54      !!                              + dj-1[ e1v/e2v dj(trb) ] }
55      !!      Multiply by the eddy diffusivity coef. and insure lateral bc:
56      !!        zlt   = ahtt * zlt
57      !!        call to lbc_lnk
58      !!      Bilaplacian (laplacian of zlt):
59      !!         difft = 1/(e1t*e2t) {  di-1[ e2u/e1u di(zlt) ]
60      !!                              + dj-1[ e1v/e2v dj(zlt) ]  }
61      !!
62      !!      Add this trend to the general trend tra :
63      !!         tra = tra + difft
64      !!
65      !! ** Action : - Update tra arrays with the before iso-level
66      !!               biharmonic mixing trend.
67      !!             - Save the trends in trtrd ('key_trc_diatrd')
68      !!
69      !! History :
70      !!        !  91-11  (G. Madec)  Original code
71      !!        !  93-03  (M. Guyon)  symetrical conditions
72      !!        !  95-11  (G. Madec)  suppress volumetric scale factors
73      !!        !  96-01  (G. Madec)  statement function for e3
74      !!        !  96-01  (M. Imbard)  mpp exchange
75      !!        !  97-07  (G. Madec)  optimization, and ahtt
76      !!        !  00-05  (MA Foujols) add lbc for tracer trends
77      !!        !  00-10  (MA Foujols E. Kestenare) use passive tracer coefficient
78      !!   8.5  !  02-08  (G. Madec)  F90: Free form and module
79      !!   9.0  !  04-03  (C. Ethe )  F90: Free form and module
80      !!----------------------------------------------------------------------
81      !! * Arguments
82      INTEGER, INTENT( in ) ::   kt       ! ocean time-step index
83
84      !! * Local declarations
85      INTEGER ::   ji, jj, jk, jn             ! dummy loop indices
86#if defined key_partial_steps
87      INTEGER ::   iku, ikv                   ! temporary integers
88#endif
89      REAL(wp) ::   ztra     ! temporary scalars
90
91      REAL(wp), DIMENSION(jpi,jpj) ::   & 
92         zeeu, zeev, zbtr, zlt                 ! workspace
93      REAL(wp), DIMENSION(jpi,jpj,jpk) ::   & 
94         ztu, ztv                              ! workspace
95      !!----------------------------------------------------------------------
96
97      IF( kt == nittrc000 ) THEN
98         IF(lwp) WRITE(numout,*)
99         IF(lwp) WRITE(numout,*) 'trc_ldf_bilap : iso-level biharmonic operator'
100         IF(lwp) WRITE(numout,*) '~~~~~~~~~~~~~'
101      ENDIF
102      !
103
104      DO jn = 1, jptra
105                                                          ! ===============
106         DO jk = 1, jpkm1                                 ! Horizontal slab
107            !                                             ! ===============
108
109            ! 0. Initialization of metric arrays (for z- or s-coordinates)
110            ! ----------------------------------
111
112            DO jj = 1, jpjm1
113               DO ji = 1, fs_jpim1   ! vector opt.
114#if defined key_s_coord || defined key_partial_steps
115                  ! s-coordinates, vertical scale factor are used
116                  zbtr(ji,jj) = 1. / ( e1t(ji,jj)*e2t(ji,jj)*fse3t(ji,jj,jk) )
117                  zeeu(ji,jj) = e2u(ji,jj) * fse3u(ji,jj,jk) / e1u(ji,jj) * umask(ji,jj,jk)
118                  zeev(ji,jj) = e1v(ji,jj) * fse3v(ji,jj,jk) / e2v(ji,jj) * vmask(ji,jj,jk)
119#else
120                  ! z-coordinates, no vertical scale factors
121                  zbtr(ji,jj) = 1. / ( e1t(ji,jj)*e2t(ji,jj) )
122                  zeeu(ji,jj) = e2u(ji,jj) / e1u(ji,jj) * umask(ji,jj,jk)
123                  zeev(ji,jj) = e1v(ji,jj) / e2v(ji,jj) * vmask(ji,jj,jk)
124#endif
125               END DO
126            END DO
127
128
129            ! 1. Laplacian
130            ! ------------
131
132            ! First derivative (gradient)
133            DO jj = 1, jpjm1
134               DO ji = 1, fs_jpim1   ! vector opt.
135                  ztu(ji,jj,jk) = zeeu(ji,jj) * ( trb(ji+1,jj  ,jk,jn) - trb(ji,jj,jk,jn) )
136                  ztv(ji,jj,jk) = zeev(ji,jj) * ( trb(ji  ,jj+1,jk,jn) - trb(ji,jj,jk,jn) )
137               END DO
138            END DO
139#if defined key_partial_steps
140
141            DO jj = 1, jpj-1
142               DO ji = 1, jpi-1
143                  ! last level
144                  iku = MIN ( mbathy(ji,jj), mbathy(ji+1,jj  ) ) - 1
145                  ikv = MIN ( mbathy(ji,jj), mbathy(ji  ,jj+1) ) - 1
146                  IF( iku == jk ) THEN
147                     ztu(ji,jj,jk) = zeeu(ji,jj) * gtu(ji,jj)
148                  ENDIF
149                  IF( ikv == jk ) THEN
150                     ztv(ji,jj,jk) = zeev(ji,jj) * gtv(ji,jj)
151                  ENDIF
152               END DO
153            END DO
154#endif
155
156            ! Second derivative (divergence)
157            DO jj = 2, jpjm1
158               DO ji = fs_2, fs_jpim1   ! vector opt.
159                  zlt(ji,jj) = zbtr(ji,jj) * (  ztu(ji,jj,jk) - ztu(ji-1,jj,jk) + ztv(ji,jj,jk) - ztv(ji,jj-1,jk)  )
160               END DO
161            END DO
162
163            ! Multiply by the eddy diffusivity coefficient
164            DO jj = 2, jpjm1
165               DO ji = fs_2, fs_jpim1   ! vector opt.
166                  zlt(ji,jj) = fsahtrt(ji,jj,jk) * zlt(ji,jj)
167               END DO
168            END DO
169
170            ! Lateral boundary conditions on the laplacian zlt   (unchanged sgn)
171            CALL lbc_lnk( zlt, 'T', 1. ) 
172
173            ! 2. Bilaplacian
174            ! --------------
175
176            ! third derivative (gradient)
177            DO jj = 1, jpjm1
178               DO ji = 1, fs_jpim1   ! vector opt.
179                  ztu(ji,jj,jk) = zeeu(ji,jj) * ( zlt(ji+1,jj  ) - zlt(ji,jj) )
180                  ztv(ji,jj,jk) = zeev(ji,jj) * ( zlt(ji  ,jj+1) - zlt(ji,jj) )
181               END DO
182            END DO
183
184            ! fourth derivative (divergence) and add to the general tracer trend
185            DO jj = 2, jpjm1
186               DO ji = fs_2, fs_jpim1   ! vector opt.
187                  ! horizontal diffusive trends
188                  ztra = zbtr(ji,jj) * (  ztu(ji,jj,jk) - ztu(ji-1,jj,jk) + ztv(ji,jj,jk) - ztv(ji,jj-1,jk)  )
189                  ! add it to the general tracer trends
190                  tra(ji,jj,jk,jn) = tra(ji,jj,jk,jn) + ztra
191#if defined key_trc_diatrd
192                  ! save the horizontal diffusive trends
193                  trtrd(ji,jj,jk,jn,4) = (  ztu(ji,jj,jk) - ztu(ji-1,jj,jk) ) * zbtr(ji,jj)
194                  trtrd(ji,jj,jk,jn,5) = (  ztv(ji,jj,jk) - ztv(ji-1,jj,jk) ) * zbtr(ji,jj)
195#endif
196               END DO
197            END DO
198            !                                             ! ===============
199         END DO                                           ! Horizontal slab
200         !                                                ! ===============
201#if defined key_trc_diatrd
202         ! Lateral boundary conditions on the laplacian zlt   (unchanged sgn)
203         CALL lbc_lnk( trtrd(1,1,1,jn,5), 'T', 1. ) 
204#endif
205         IF(l_ctl) THEN         ! print mean trends (used for debugging)
206            ztra = SUM( tra(2:nictl,2:njctl,1:jpkm1,jn) * tmask(2:nictl,2:njctl,1:jpkm1) )
207            WRITE(numout,*) ' trc/ldf  - ',ctrcnm(jn),' : ', ztra-tra_ctl(jn)
208            tra_ctl(jn) = ztra 
209         ENDIF
210
211      END DO
212
213   END SUBROUTINE trc_ldf_bilap
214
215#else
216   !!----------------------------------------------------------------------
217   !!   Default option                                         Empty module
218   !!----------------------------------------------------------------------
219CONTAINS
220   SUBROUTINE trc_ldf_bilap( kt ) 
221      INTEGER, INTENT(in) :: kt
222      WRITE(*,*) 'trc_ldf_bilap: You should not have seen this print! error?', kt
223   END SUBROUTINE trc_ldf_bilap
224#endif
225   !!==============================================================================
226END MODULE trcldf_bilap
Note: See TracBrowser for help on using the repository browser.