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_grif.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_iso_grif.F90 @ 2287

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

update licence of all NEMO files...

  • Property svn:keywords set to Id
File size: 8.8 KB
Line 
1MODULE traldf_iso_grif
2   !!==============================================================================
3   !!                   ***  MODULE  traldf_iso_grif  ***
4   !! Ocean active tracers:  horizontal component of the lateral tracer mixing trend
5   !!==============================================================================
6   !! History :   9.0  !  06-10  (C. Harris)
7   !!----------------------------------------------------------------------
8#if   defined key_ldfslp   ||   defined key_esopa
9   !!----------------------------------------------------------------------
10   !!   'key_ldfslp'               slope of the lateral diffusive direction
11   !!----------------------------------------------------------------------
12   !!   tra_ldf_iso_grif  : update the tracer trend with the horizontal
13   !!                       component of a iso-neutral laplacian operator
14   !!                       and with the vertical part of
15   !!                       the isopycnal or geopotential s-coord. operator
16   !!                       vector optimization, use k-j-i loops.
17   !!----------------------------------------------------------------------
18
19   USE oce             ! ocean dynamics and active tracers
20   USE dom_oce         ! ocean space and time domain
21   USE ldftra_oce      ! ocean active tracers: lateral physics
22   USE trdmod          ! ocean active tracers trends
23   USE trdmod_oce      ! ocean variables trends
24   USE zdf_oce         ! ocean vertical physics
25   USE in_out_manager  ! I/O manager
26   USE ldfslp          ! iso-neutral slopes
27   USE diaptr          ! poleward transport diagnostics
28   USE prtctl          ! Print control
29
30   IMPLICIT NONE
31   PRIVATE
32
33   PUBLIC tra_ldf_iso_grif   ! routine called by traldf.F90
34
35   !! * Substitutions
36#  include "domzgr_substitute.h90"
37#  include "ldftra_substitute.h90"
38#  include "ldfeiv_substitute.h90"
39#  include "vectopt_loop_substitute.h90"
40
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_iso_grif( kt )
50      !!----------------------------------------------------------------------
51      !!                  ***  ROUTINE tra_ldf_iso_grif  ***
52      !!
53      !! ** Purpose :   Compute the before horizontal tracer (t & s) diffusive
54      !!      trend for a laplacian tensor (except the dz[ dz[.] ] term) and
55      !!      add it to the general trend of tracer equation.
56      !!
57      !! ** Method  :   The horizontal component of the lateral diffusive trends
58      !!      is provided by a 2nd order operator rotated along neutral or geopo-
59      !!      tential surfaces to which an eddy induced advection can be added
60      !!      It is computed using before fields (forward in time)
61      !!
62      !!      1st part :  masked horizontal derivative of T & S ( di[ t ] )
63      !!      ========    with partial cell update if ln_zps=T.
64      !!
65      !!      2nd part :  horizontal fluxes of the lateral mixing operator
66      !!      ========   
67      !!      take the horizontal divergence of the fluxes:
68      !!         difft = 1/(e1t*e2t*e3t) {  di-1[ zftu ] +  dj-1[ zftv ]  }
69      !!      Add this trend to the general trend (ta,sa):
70      !!         ta = ta + difft
71      !!
72      !!      3rd part: vertical trends of the lateral mixing operator
73      !!      ========  (excluding the vertical flux proportional to dk[t] )
74      !!      vertical fluxes associated with the rotated lateral mixing:
75
76      !!      take the horizontal divergence of the fluxes:
77      !!         difft = 1/(e1t*e2t*e3t) dk[ zftw ]
78      !!      Add this trend to the general trend (ta,sa):
79      !!         ta = ta + difft
80      !!
81      !! ** Action :
82      !!         Update (ta,sa) arrays with the before rotated diffusion trend
83      !!            (except the dk[ dk[.] ] term)
84      !!
85      !!----------------------------------------------------------------------
86      USE oce           , zftv => ua   ! use ua as workspace
87      USE oce           , zfsv => va   ! use va as workspace
88      !!
89      INTEGER, INTENT( in ) ::   kt        ! ocean time-step index
90      !!
91      INTEGER  ::   ji, jj, jk, ip, jp, kp    ! dummy loop indices
92      INTEGER  ::   iku, ikv                  ! temporary integer
93      REAL(wp) ::   zatempu, zdx, zta         ! temporary scalars
94      REAL(wp) ::   zatempv, zdy, zsa         !    "         "
95      REAL(wp) ::   zslopec, zdsloper, zepsln !    "         "
96      REAL(wp) ::   zsxe, za_sxe, zfact       !    "         "
97      REAL(wp) ::   zbtr                      !    "         "
98      REAL(wp), DIMENSION(2) ::   zdelta   ! 1D workspace
99      REAL(wp), DIMENSION(jpi,jpj)     ::   zftu   ! 2D workspace
100      REAL(wp), DIMENSION(jpi,jpj)     ::   zfsu   !    "           "
101      REAL(wp), DIMENSION(jpi,jpj,jpk) ::   zdit, zdjt, zdkt     ! 3D workspace
102      REAL(wp), DIMENSION(jpi,jpj,jpk) ::   zdis, zdjs, zdks     !  "      "
103
104
105
106      !!----------------------------------------------------------------------
107
108      IF( kt == nit000 ) THEN
109         IF(lwp) WRITE(numout,*)
110         IF(lwp) WRITE(numout,*) 'tra_ldf_iso_grif : rotated laplacian diffusion operator'
111         IF(lwp) WRITE(numout,*) '~~~~~~~~~~~~~~~~'
112      ENDIF
113
114      IF ( .NOT. lk_traldf_eiv ) THEN
115        fsaeiu(:,:,:)=0.0
116        fsaeiv(:,:,:)=0.0
117        fsaeiw(:,:,:)=0.0
118      ENDIF
119
120      DO jk=1,jpkm1
121      DO jj=1,jpjm1
122      DO ji=1,fs_jpim1
123               ftu(ji,jj,jk)=ftud(ji,jj,jk)+ftu(ji,jj,jk)*(fsahtu(ji,jj,jk)-fsaeiu(ji,jj,jk))
124               fsu(ji,jj,jk)=fsud(ji,jj,jk)+fsu(ji,jj,jk)*(fsahtu(ji,jj,jk)-fsaeiu(ji,jj,jk))
125               ftv(ji,jj,jk)=ftvd(ji,jj,jk)+ftv(ji,jj,jk)*(fsahtv(ji,jj,jk)-fsaeiv(ji,jj,jk))
126               fsv(ji,jj,jk)=fsvd(ji,jj,jk)+fsv(ji,jj,jk)*(fsahtv(ji,jj,jk)-fsaeiv(ji,jj,jk))
127      END DO
128      END DO
129      END DO
130
131      DO jk = 1, jpkm1
132
133         ! II.4 Second derivative (divergence) and add to the general trend
134         ! ----------------------------------------------------------------
135         DO jj = 2 , jpjm1
136            DO ji = fs_2, fs_jpim1   ! vector opt.
137               zbtr= 1. / ( e1t(ji,jj)*e2t(ji,jj)*fse3t(ji,jj,jk) )
138               zta = zbtr * ( ftu(ji,jj,jk) - ftu(ji-1,jj,jk) + ftv(ji,jj,jk) - ftv(ji,jj-1,jk)  )
139               zsa = zbtr * ( fsu(ji,jj,jk) - fsu(ji-1,jj,jk) + fsv(ji,jj,jk) - fsv(ji,jj-1,jk)  )
140               ta (ji,jj,jk) = ta (ji,jj,jk) + zta
141               sa (ji,jj,jk) = sa (ji,jj,jk) + zsa
142            END DO
143         END DO
144         !                                          ! ===============
145      END DO                                        !   End of slab 
146      !                                             ! ===============
147
148      IF( ln_diaptr .AND. ( MOD( kt, nf_ptr ) == 0 ) ) THEN   ! Poleward diffusive heat and salt transports
149         pht_ldf(:) = ptr_vj( zftv(:,:,:) )
150         pst_ldf(:) = ptr_vj( zfsv(:,:,:) )
151      ENDIF
152
153      !!----------------------------------------------------------------------
154      !!   III - vertical trend of T & S (extra diagonal terms only)
155      !!----------------------------------------------------------------------
156
157      ! I.5 Divergence of vertical fluxes added to the general tracer trend
158      ! -------------------------------------------------------------------
159
160      DO jk=1,jpk
161      DO jj=2,jpjm1
162      DO ji=fs_2,fs_jpim1
163               tfw(ji,jj,jk)=tfw(ji,jj,jk)*(fsahtw(ji,jj,jk)+fsaeiw(ji,jj,jk))
164               sfw(ji,jj,jk)=sfw(ji,jj,jk)*(fsahtw(ji,jj,jk)+fsaeiw(ji,jj,jk))
165      END DO
166      END DO
167      END DO
168
169      DO jk = 1, jpkm1
170         DO jj = 2, jpjm1
171            DO ji = fs_2, fs_jpim1   ! vector opt.
172               zbtr =  1. / ( e1t(ji,jj)*e2t(ji,jj)*fse3t(ji,jj,jk) )
173               zta  = (  tfw(ji,jj,jk) - tfw(ji,jj,jk+1)  ) * zbtr
174               zsa  = (  sfw(ji,jj,jk) - sfw(ji,jj,jk+1)  ) * zbtr
175               ta(ji,jj,jk) = ta(ji,jj,jk) + zta
176               sa(ji,jj,jk) = sa(ji,jj,jk) + zsa
177            END DO
178         END DO
179      END DO
180      !
181      DO jk=1,jpk
182      DO jj=2,jpjm1
183      DO ji=fs_2,fs_jpim1
184       psix_eiv(ji,jj,jk) = psix_eiv(ji,jj,jk)*fsaeiu(ji,jj,jk)
185       psiy_eiv(ji,jj,jk) = psiy_eiv(ji,jj,jk)*fsaeiv(ji,jj,jk)
186      END DO
187      END DO
188      END DO
189
190   END SUBROUTINE tra_ldf_iso_grif
191
192#else
193   !!----------------------------------------------------------------------
194   !!   default option :   Dummy code   NO rotation of the diffusive tensor
195   !!----------------------------------------------------------------------
196CONTAINS
197   SUBROUTINE tra_ldf_iso_grif( kt )               ! Empty routine
198      WRITE(*,*) 'tra_ldf_iso_grif: You should not have seen this print! error?', kt
199   END SUBROUTINE tra_ldf_iso_grif
200#endif
201
202   !!==============================================================================
203END MODULE traldf_iso_grif
Note: See TracBrowser for help on using the repository browser.