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

source: NEMO/trunk/src/TOP/TRP/trcldf.F90

Last change on this file was 14834, checked in by hadcv, 3 years ago

#2600: Merge in dev_r14273_HPC-02_Daley_Tiling

  • Property svn:keywords set to Id
File size: 10.8 KB
Line 
1MODULE trcldf
2   !!======================================================================
3   !!                       ***  MODULE  trcldf  ***
4   !! Ocean Passive tracers : lateral diffusive trends
5   !!=====================================================================
6   !! History :  1.0  ! 2005-11  (G. Madec)  Original code
7   !!            3.0  ! 2008-01  (C. Ethe, G. Madec)  merge TRC-TRA
8   !!            3.7  ! 2014-03  (G. Madec)  LDF simplification
9   !!----------------------------------------------------------------------
10#if defined key_top
11   !!----------------------------------------------------------------------
12   !!   'key_top'                                                TOP models
13   !!----------------------------------------------------------------------
14   !!   trc_ldf       : update the tracer trend with the lateral diffusion
15   !!   trc_ldf_ini   : initialization, namelist read, and parameters control
16   !!----------------------------------------------------------------------
17   USE par_trc        ! need jptra, number of passive tracers
18   USE trc            ! ocean passive tracers variables
19   USE oce_trc        ! ocean dynamics and active tracers
20   USE ldftra         ! lateral diffusion: eddy diffusivity & EIV coeff.
21   USE ldfslp         ! Lateral diffusion: slopes of neutral surfaces
22   USE traldf_lap_blp ! lateral diffusion: lap/bilaplacian iso-level      operator  (tra_ldf_lap/_blp   routine)
23   USE traldf_iso     ! lateral diffusion: laplacian iso-neutral standard operator  (tra_ldf_iso        routine)
24   USE traldf_triad   ! lateral diffusion: laplacian iso-neutral triad    operator  (tra_ldf_     triad routine)
25   USE trd_oce        ! trends: ocean variables
26   USE trdtra         ! trends manager: tracers
27   !
28   USE prtctl         ! Print control
29
30   IMPLICIT NONE
31   PRIVATE
32
33   PUBLIC   trc_ldf   
34   PUBLIC   trc_ldf_ini   
35   !
36   !                                      !!: ** lateral mixing namelist (nam_trcldf) **
37   LOGICAL , PUBLIC ::   ln_trcldf_OFF     !: No operator (no explicit lateral diffusion)
38   LOGICAL , PUBLIC ::   ln_trcldf_tra     !: use active tracer operator
39   REAL(wp), PUBLIC ::      rn_ldf_multi      !: multiplier of T-S eddy diffusivity to obtain the passive tracer one
40   REAL(wp), PUBLIC ::      rn_fact_lap       !: enhanced Equatorial zonal diffusivity coefficent
41   !
42   INTEGER  ::   nldf_trc = 0   ! type of lateral diffusion used defined from ln_traldf_... (namlist logicals)
43   REAL(wp) ::   rldf           ! multiplier between active and passive tracers eddy diffusivity   [-]
44   
45   !! * Substitutions
46#  include "do_loop_substitute.h90"
47#  include "domzgr_substitute.h90"
48   !!----------------------------------------------------------------------
49   !! NEMO/TOP 4.0 , NEMO Consortium (2018)
50   !! $Id$
51   !! Software governed by the CeCILL license (see ./LICENSE)
52   !!----------------------------------------------------------------------
53CONTAINS
54
55   SUBROUTINE trc_ldf( kt, Kbb, Kmm, ptr, Krhs )
56      !!----------------------------------------------------------------------
57      !!                  ***  ROUTINE tra_ldf  ***
58      !!
59      !! ** Purpose :   compute the lateral ocean tracer physics.
60      !!
61      !!----------------------------------------------------------------------
62      INTEGER,                                    INTENT(in   ) :: kt              ! ocean time-step index
63      INTEGER,                                    INTENT(in   ) :: Kbb, Kmm, Krhs  ! ocean time-level index
64      REAL(wp), DIMENSION(jpi,jpj,jpk,jptra,jpt), INTENT(inout) :: ptr             ! passive tracers and RHS of tracer equation
65      !
66      INTEGER            :: ji, jj, jk, jn
67      REAL(wp)           :: zdep
68      CHARACTER (len=22) :: charout
69      REAL(wp),          DIMENSION(jpi,jpj,jpk) ::   zahu, zahv
70      REAL(wp), POINTER, DIMENSION(:,:,:,:)     ::   ztrtrd
71      !!----------------------------------------------------------------------
72      !
73      IF( ln_trcldf_OFF )   RETURN        ! not lateral diffusion applied on passive tracers
74      !
75      IF( ln_timing )   CALL timing_start('trc_ldf')
76      !
77      IF( l_trdtrc )  THEN
78         ALLOCATE( ztrtrd(jpi,jpj,jpk,jptra) )
79         ztrtrd(:,:,:,:)  = ptr(:,:,:,:,Krhs)
80      ENDIF
81      !                                  !* set the lateral diffusivity coef. for passive tracer     
82      zahu(:,:,:) = rldf * ahtu(:,:,:) 
83      zahv(:,:,:) = rldf * ahtv(:,:,:)
84      !                                  !* Enhanced zonal diffusivity coefficent in the equatorial domain
85      DO_3D( nn_hls, nn_hls, nn_hls, nn_hls, 1, jpk )
86         IF( gdept(ji,jj,jk,Kmm) > 200. .AND. gphit(ji,jj) < 5. .AND. gphit(ji,jj) > -5. ) THEN
87            zdep = MAX( gdept(ji,jj,jk,Kmm) - 1000., 0. ) / 1000.
88            zahu(ji,jj,jk) = zahu(ji,jj,jk) * MAX( 1., rn_fact_lap * EXP( -zdep ) )
89         ENDIF
90      END_3D
91      !
92      SELECT CASE ( nldf_trc )                 !* compute lateral mixing trend and add it to the general trend
93      !
94      CASE ( np_lap   )                                                                                    ! iso-level laplacian
95         CALL tra_ldf_lap  ( kt, Kmm, nittrc000,'TRC', zahu, zahv, gtru, gtrv, gtrui, gtrvi,            &
96           &                     ptr(:,:,:,:,Kbb), ptr(:,:,:,:,Krhs),                   jptra, 1 )
97      CASE ( np_lap_i )                                                                                    ! laplacian : standard iso-neutral operator (Madec)
98         CALL tra_ldf_iso  ( kt, Kmm, nittrc000,'TRC', zahu, zahv, gtru, gtrv, gtrui, gtrvi,            &
99           &                     ptr(:,:,:,:,Kbb), ptr(:,:,:,:,Kbb), ptr(:,:,:,:,Krhs), jptra, 1 )
100      CASE ( np_lap_it )                                                                                   ! laplacian : triad iso-neutral operator (griffies)
101         CALL tra_ldf_triad( kt, Kmm, nittrc000,'TRC', zahu, zahv, gtru, gtrv, gtrui, gtrvi,            &
102           &                     ptr(:,:,:,:,Kbb), ptr(:,:,:,:,Kbb), ptr(:,:,:,:,Krhs), jptra, 1 )
103      CASE ( np_blp , np_blp_i , np_blp_it )                                                               ! bilaplacian: all operator (iso-level, -neutral)
104         CALL tra_ldf_blp  ( kt, Kmm, nittrc000,'TRC', zahu, zahv, gtru, gtrv, gtrui, gtrvi,            &
105           &                     ptr(:,:,:,:,Kbb) , ptr(:,:,:,:,Krhs),                 jptra, nldf_trc )
106      END SELECT
107      !
108      IF( l_trdtrc )   THEN                    ! send the trends for further diagnostics
109        DO jn = 1, jptra
110           ztrtrd(:,:,:,jn) = ptr(:,:,:,jn,Krhs) - ztrtrd(:,:,:,jn)
111           CALL trd_tra( kt, Kmm, Krhs, 'TRC', jn, jptra_ldf, ztrtrd(:,:,:,jn) )
112        END DO
113        DEALLOCATE( ztrtrd )
114      ENDIF
115      !               
116      IF( sn_cfctl%l_prttrc ) THEN ! print mean trends (used for debugging)
117         WRITE(charout, FMT="('ldf ')")
118         CALL prt_ctl_info( charout, cdcomp = 'top' )
119         CALL prt_ctl( tab4d_1=ptr(:,:,:,:,Krhs), mask1=tmask, clinfo=ctrcnm, clinfo3='trd' )
120      ENDIF
121      !
122      IF( ln_timing )   CALL timing_stop('trc_ldf')
123      !
124   END SUBROUTINE trc_ldf
125
126
127   SUBROUTINE trc_ldf_ini
128      !!----------------------------------------------------------------------
129      !!                  ***  ROUTINE ldf_ctl  ***
130      !!
131      !! ** Purpose :   Define the operator for the lateral diffusion
132      !!
133      !! ** Method  : - ln_trcldf_tra=T : use nldf_tra set in ldftra module
134      !!              to defined the passive tracer lateral diffusive operator
135      !!              - ln_trcldf_OFF=T : no explicit diffusion used
136      !!----------------------------------------------------------------------
137      INTEGER ::   ios, ioptio   ! local integers
138      !!
139      NAMELIST/namtrc_ldf/ ln_trcldf_OFF , ln_trcldf_tra,   &   ! operator & direction
140         &                 rn_ldf_multi  , rn_fact_lap          ! coefficient
141      !!----------------------------------------------------------------------
142      !
143      IF(lwp) THEN
144         WRITE(numout,*)
145         WRITE(numout,*) 'trc_ldf_ini : lateral passive tracer diffusive operator'
146         WRITE(numout,*) '~~~~~~~~~~~'
147      ENDIF
148      !
149      READ  ( numnat_ref, namtrc_ldf, IOSTAT = ios, ERR = 903)
150903   IF( ios /= 0 )   CALL ctl_nam ( ios , 'namtrc_ldf in reference namelist' )
151      !
152      READ  ( numnat_cfg, namtrc_ldf, IOSTAT = ios, ERR = 904 )
153904   IF( ios >  0 )   CALL ctl_nam ( ios , 'namtrc_ldf in configuration namelist' )
154      IF(lwm) WRITE ( numont, namtrc_ldf )
155      !
156      IF(lwp) THEN                     ! Namelist print
157         WRITE(numout,*) '   Namelist namtrc_ldf : set lateral mixing parameters (type, direction, coefficients)'
158         WRITE(numout,*) '      no explicit diffusion                 ln_trcldf_OFF   = ', ln_trcldf_OFF
159         WRITE(numout,*) '      use active tracer operator            ln_trcldf_tra   = ', ln_trcldf_tra
160         WRITE(numout,*) '      diffusivity coefficient :'
161         WRITE(numout,*) '         multiplier of TRA coef. for TRC       rn_ldf_multi = ', rn_ldf_multi
162         WRITE(numout,*) '         enhanced zonal Eq. laplacian coef.    rn_fact_lap  = ', rn_fact_lap
163
164      ENDIF
165      !     
166      !                                ! control the namelist parameters
167      nldf_trc = np_ERROR
168      ioptio   = 0
169      IF( ln_trcldf_OFF  ) THEN   ;   nldf_trc = np_no_ldf   ;   ioptio = ioptio + 1   ;   ENDIF
170      IF( ln_trcldf_tra  ) THEN   ;   nldf_trc = nldf_tra    ;   ioptio = ioptio + 1   ;   ENDIF
171      IF( ioptio /=  1   )   CALL ctl_stop( 'trc_ldf_ini: use ONE of the 2 operator options (OFF/tra)' )
172     
173      !                                ! multiplier : passive/active tracers ration
174      IF( ln_traldf_lap ) THEN               ! laplacian operator
175         rldf = rn_ldf_multi                       ! simple multiplier
176      ELSEIF( ln_traldf_blp ) THEN           ! bilaplacian operator:
177         rldf = SQRT( ABS( rn_ldf_multi )  )       ! the coef. used is the SQRT of the bilaplacian coef.
178      ENDIF
179      !
180      IF(lwp) THEN
181         WRITE(numout,*)
182         SELECT CASE( nldf_trc )
183         CASE( np_no_ldf )   ;   WRITE(numout,*) '      ===>>   NO lateral diffusion'
184         CASE( np_lap    )   ;   WRITE(numout,*) '      ===>>   laplacian iso-level operator'
185         CASE( np_lap_i  )   ;   WRITE(numout,*) '      ===>>   Rotated laplacian operator (standard)'
186         CASE( np_lap_it )   ;   WRITE(numout,*) '      ===>>   Rotated laplacian operator (triad)'
187         CASE( np_blp    )   ;   WRITE(numout,*) '      ===>>   bilaplacian iso-level operator'
188         CASE( np_blp_i  )   ;   WRITE(numout,*) '      ===>>   Rotated bilaplacian operator (standard)'
189         CASE( np_blp_it )   ;   WRITE(numout,*) '      ===>>   Rotated bilaplacian operator (triad)'
190         END SELECT
191      ENDIF
192      !
193   END SUBROUTINE trc_ldf_ini
194
195#endif
196   !!======================================================================
197END MODULE trcldf
Note: See TracBrowser for help on using the repository browser.