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

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

set proper svn properties to all 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   !!   OPA 9.0 , LOCEAN-IPSL (2005)
42   !! $Header$
43   !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt)
44   !!----------------------------------------------------------------------
45
46CONTAINS
47
48   SUBROUTINE tra_ldf_iso_grif( kt )
49      !!----------------------------------------------------------------------
50      !!                  ***  ROUTINE tra_ldf_iso_grif  ***
51      !!
52      !! ** Purpose :   Compute the before horizontal tracer (t & s) diffusive
53      !!      trend for a laplacian tensor (except the dz[ dz[.] ] term) and
54      !!      add it to the general trend of tracer equation.
55      !!
56      !! ** Method  :   The horizontal component of the lateral diffusive trends
57      !!      is provided by a 2nd order operator rotated along neutral or geopo-
58      !!      tential surfaces to which an eddy induced advection can be added
59      !!      It is computed using before fields (forward in time)
60      !!
61      !!      1st part :  masked horizontal derivative of T & S ( di[ t ] )
62      !!      ========    with partial cell update if ln_zps=T.
63      !!
64      !!      2nd part :  horizontal fluxes of the lateral mixing operator
65      !!      ========   
66      !!      take the horizontal divergence of the fluxes:
67      !!         difft = 1/(e1t*e2t*e3t) {  di-1[ zftu ] +  dj-1[ zftv ]  }
68      !!      Add this trend to the general trend (ta,sa):
69      !!         ta = ta + difft
70      !!
71      !!      3rd part: vertical trends of the lateral mixing operator
72      !!      ========  (excluding the vertical flux proportional to dk[t] )
73      !!      vertical fluxes associated with the rotated lateral mixing:
74
75      !!      take the horizontal divergence of the fluxes:
76      !!         difft = 1/(e1t*e2t*e3t) dk[ zftw ]
77      !!      Add this trend to the general trend (ta,sa):
78      !!         ta = ta + difft
79      !!
80      !! ** Action :
81      !!         Update (ta,sa) arrays with the before rotated diffusion trend
82      !!            (except the dk[ dk[.] ] term)
83      !!
84      !!----------------------------------------------------------------------
85      USE oce           , zftv => ua   ! use ua as workspace
86      USE oce           , zfsv => va   ! use va as workspace
87      !!
88      INTEGER, INTENT( in ) ::   kt        ! ocean time-step index
89      !!
90      INTEGER  ::   ji, jj, jk, ip, jp, kp    ! dummy loop indices
91      INTEGER  ::   iku, ikv                  ! temporary integer
92      REAL(wp) ::   zatempu, zdx, zta         ! temporary scalars
93      REAL(wp) ::   zatempv, zdy, zsa         !    "         "
94      REAL(wp) ::   zslopec, zdsloper, zepsln !    "         "
95      REAL(wp) ::   zsxe, za_sxe, zfact       !    "         "
96      REAL(wp) ::   zbtr                      !    "         "
97      REAL(wp), DIMENSION(2) ::   zdelta   ! 1D workspace
98      REAL(wp), DIMENSION(jpi,jpj)     ::   zftu   ! 2D workspace
99      REAL(wp), DIMENSION(jpi,jpj)     ::   zfsu   !    "           "
100      REAL(wp), DIMENSION(jpi,jpj,jpk) ::   zdit, zdjt, zdkt     ! 3D workspace
101      REAL(wp), DIMENSION(jpi,jpj,jpk) ::   zdis, zdjs, zdks     !  "      "
102
103
104
105      !!----------------------------------------------------------------------
106
107      IF( kt == nit000 ) THEN
108         IF(lwp) WRITE(numout,*)
109         IF(lwp) WRITE(numout,*) 'tra_ldf_iso_grif : rotated laplacian diffusion operator'
110         IF(lwp) WRITE(numout,*) '~~~~~~~~~~~~~~~~'
111      ENDIF
112
113      IF ( .NOT. lk_traldf_eiv ) THEN
114        fsaeiu(:,:,:)=0.0
115        fsaeiv(:,:,:)=0.0
116        fsaeiw(:,:,:)=0.0
117      ENDIF
118
119      DO jk=1,jpkm1
120      DO jj=1,jpjm1
121      DO ji=1,fs_jpim1
122               ftu(ji,jj,jk)=ftud(ji,jj,jk)+ftu(ji,jj,jk)*(fsahtu(ji,jj,jk)-fsaeiu(ji,jj,jk))
123               fsu(ji,jj,jk)=fsud(ji,jj,jk)+fsu(ji,jj,jk)*(fsahtu(ji,jj,jk)-fsaeiu(ji,jj,jk))
124               ftv(ji,jj,jk)=ftvd(ji,jj,jk)+ftv(ji,jj,jk)*(fsahtv(ji,jj,jk)-fsaeiv(ji,jj,jk))
125               fsv(ji,jj,jk)=fsvd(ji,jj,jk)+fsv(ji,jj,jk)*(fsahtv(ji,jj,jk)-fsaeiv(ji,jj,jk))
126      END DO
127      END DO
128      END DO
129
130      DO jk = 1, jpkm1
131
132         ! II.4 Second derivative (divergence) and add to the general trend
133         ! ----------------------------------------------------------------
134         DO jj = 2 , jpjm1
135            DO ji = fs_2, fs_jpim1   ! vector opt.
136               zbtr= 1. / ( e1t(ji,jj)*e2t(ji,jj)*fse3t(ji,jj,jk) )
137               zta = zbtr * ( ftu(ji,jj,jk) - ftu(ji-1,jj,jk) + ftv(ji,jj,jk) - ftv(ji,jj-1,jk)  )
138               zsa = zbtr * ( fsu(ji,jj,jk) - fsu(ji-1,jj,jk) + fsv(ji,jj,jk) - fsv(ji,jj-1,jk)  )
139               ta (ji,jj,jk) = ta (ji,jj,jk) + zta
140               sa (ji,jj,jk) = sa (ji,jj,jk) + zsa
141            END DO
142         END DO
143         !                                          ! ===============
144      END DO                                        !   End of slab 
145      !                                             ! ===============
146
147      IF( ln_diaptr .AND. ( MOD( kt, nf_ptr ) == 0 ) ) THEN   ! Poleward diffusive heat and salt transports
148         pht_ldf(:) = ptr_vj( zftv(:,:,:) )
149         pst_ldf(:) = ptr_vj( zfsv(:,:,:) )
150      ENDIF
151
152      !!----------------------------------------------------------------------
153      !!   III - vertical trend of T & S (extra diagonal terms only)
154      !!----------------------------------------------------------------------
155
156      ! I.5 Divergence of vertical fluxes added to the general tracer trend
157      ! -------------------------------------------------------------------
158
159      DO jk=1,jpk
160      DO jj=2,jpjm1
161      DO ji=fs_2,fs_jpim1
162               tfw(ji,jj,jk)=tfw(ji,jj,jk)*(fsahtw(ji,jj,jk)+fsaeiw(ji,jj,jk))
163               sfw(ji,jj,jk)=sfw(ji,jj,jk)*(fsahtw(ji,jj,jk)+fsaeiw(ji,jj,jk))
164      END DO
165      END DO
166      END DO
167
168      DO jk = 1, jpkm1
169         DO jj = 2, jpjm1
170            DO ji = fs_2, fs_jpim1   ! vector opt.
171               zbtr =  1. / ( e1t(ji,jj)*e2t(ji,jj)*fse3t(ji,jj,jk) )
172               zta  = (  tfw(ji,jj,jk) - tfw(ji,jj,jk+1)  ) * zbtr
173               zsa  = (  sfw(ji,jj,jk) - sfw(ji,jj,jk+1)  ) * zbtr
174               ta(ji,jj,jk) = ta(ji,jj,jk) + zta
175               sa(ji,jj,jk) = sa(ji,jj,jk) + zsa
176            END DO
177         END DO
178      END DO
179      !
180      DO jk=1,jpk
181      DO jj=2,jpjm1
182      DO ji=fs_2,fs_jpim1
183       psix_eiv(ji,jj,jk) = psix_eiv(ji,jj,jk)*fsaeiu(ji,jj,jk)
184       psiy_eiv(ji,jj,jk) = psiy_eiv(ji,jj,jk)*fsaeiv(ji,jj,jk)
185      END DO
186      END DO
187      END DO
188
189   END SUBROUTINE tra_ldf_iso_grif
190
191#else
192   !!----------------------------------------------------------------------
193   !!   default option :   Dummy code   NO rotation of the diffusive tensor
194   !!----------------------------------------------------------------------
195CONTAINS
196   SUBROUTINE tra_ldf_iso_grif( kt )               ! Empty routine
197      WRITE(*,*) 'tra_ldf_iso_grif: You should not have seen this print! error?', kt
198   END SUBROUTINE tra_ldf_iso_grif
199#endif
200
201   !!==============================================================================
202END MODULE traldf_iso_grif
Note: See TracBrowser for help on using the repository browser.