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

source: trunk/NEMOGCM/NEMO/TOP_SRC/TRP/trczdf.F90 @ 2528

Last change on this file since 2528 was 2528, checked in by rblod, 13 years ago

Update NEMOGCM from branch nemo_v3_3_beta

  • Property svn:keywords set to Id
File size: 8.1 KB
Line 
1MODULE trczdf
2   !!==============================================================================
3   !!                 ***  MODULE  trczdf  ***
4   !! Ocean Passive tracers : vertical diffusive trends
5   !!=====================================================================
6   !! History :  9.0  ! 2005-11 (G. Madec)  Original code
7   !!       NEMO 3.0  ! 2008-01  (C. Ethe, G. Madec)  merge TRC-TRA
8   !!----------------------------------------------------------------------
9#if defined key_top
10   !!----------------------------------------------------------------------
11   !!   'key_top'                                                TOP models
12   !!----------------------------------------------------------------------
13   !!----------------------------------------------------------------------
14   !!   trc_ldf     : update the tracer trend with the lateral diffusion
15   !!       ldf_ctl : initialization, namelist read, and parameters control
16   !!----------------------------------------------------------------------
17   USE oce_trc         ! ocean dynamics and active tracers
18   USE trc             ! ocean passive tracers variables
19   USE trcnam_trp      ! passive tracers transport namelist variables
20   USE trazdf_exp      ! vertical diffusion: explicit (tra_zdf_exp     routine)
21   USE trazdf_imp      ! vertical diffusion: implicit (tra_zdf_imp     routine)
22   USE prtctl_trc      ! Print control
23   USE in_out_manager  ! I/O manager
24   USE lbclnk          ! ocean lateral boundary conditions (or mpp link)
25   USE trdmod_oce
26   USE trdtra
27
28   IMPLICIT NONE
29   PRIVATE
30
31   PUBLIC   trc_zdf    ! called by step.F90
32
33   INTEGER ::   nzdf = 0               ! type vertical diffusion algorithm used
34      !                                ! defined from ln_zdf...  namlist logicals)
35   REAL(wp), DIMENSION(jpk) ::  r2dt   ! vertical profile time-step, = 2 rdttra
36      !                                ! except at nit000 (=rdttra) if neuler=0
37
38   !! * Substitutions
39#  include "domzgr_substitute.h90"
40#  include "zdfddm_substitute.h90"
41#  include "vectopt_loop_substitute.h90"
42   !!----------------------------------------------------------------------
43   !! NEMO/TOP 3.3 , NEMO Consortium (2010)
44   !! $Id$
45   !! Software governed by the CeCILL licence (NEMOGCM/NEMO_CeCILL.txt)
46   !!----------------------------------------------------------------------
47
48CONTAINS
49   
50   SUBROUTINE trc_zdf( kt )
51      !!----------------------------------------------------------------------
52      !!                  ***  ROUTINE trc_zdf  ***
53      !!
54      !! ** Purpose :   compute the vertical ocean tracer physics.
55      !!---------------------------------------------------------------------
56      INTEGER, INTENT( in ) ::  kt      ! ocean time-step index
57      !
58      INTEGER               ::  jk, jn
59      CHARACTER (len=22)    :: charout
60      REAL(wp), DIMENSION(:,:,:,:), ALLOCATABLE ::   ztrtrd   ! 4D workspace
61      !!---------------------------------------------------------------------
62
63      IF( kt == nit000 )   CALL zdf_ctl          ! initialisation & control of options
64
65#if ! defined key_pisces
66      IF( neuler == 0 .AND. kt == nit000 ) THEN     ! at nit000
67         r2dt(:) =  rdttrc(:)           ! = rdttrc (restarting with Euler time stepping)
68      ELSEIF( kt <= nit000 + nn_dttrc ) THEN          ! at nit000 or nit000+1
69         r2dt(:) = 2. * rdttrc(:)       ! = 2 rdttrc (leapfrog)
70      ENDIF
71#else
72      r2dt(:) =  rdttrc(:)              ! = rdttrc (for PISCES use Euler time stepping)
73#endif
74
75      IF( l_trdtrc )  THEN
76         ALLOCATE( ztrtrd(jpi,jpj,jpk,jptra) )   ! temporary save of trends
77         ztrtrd(:,:,:,:)  = tra(:,:,:,:)
78      ENDIF
79
80      SELECT CASE ( nzdf )                       ! compute lateral mixing trend and add it to the general trend
81      CASE ( -1 )                                       ! esopa: test all possibility with control print
82         CALL tra_zdf_exp( kt, 'TRC', r2dt, nn_trczdf_exp, trb, tra, jptra ) 
83         WRITE(charout, FMT="('zdf1 ')") ;  CALL prt_ctl_trc_info(charout)
84                                            CALL prt_ctl_trc( tab4d=tra, mask=tmask, clinfo=ctrcnm, clinfo2='trd' )
85         CALL tra_zdf_imp( kt, 'TRC', r2dt,                trb, tra, jptra ) 
86         WRITE(charout, FMT="('zdf2 ')") ;  CALL prt_ctl_trc_info(charout)
87                                            CALL prt_ctl_trc( tab4d=tra, mask=tmask, clinfo=ctrcnm, clinfo2='trd' )
88      CASE ( 0 ) ;  CALL tra_zdf_exp( kt, 'TRC', r2dt, nn_trczdf_exp, trb, tra, jptra )    !   explicit scheme
89      CASE ( 1 ) ;  CALL tra_zdf_imp( kt, 'TRC', r2dt,                trb, tra, jptra )    !   implicit scheme         
90
91      END SELECT
92
93      IF( l_trdtra )   THEN                      ! save the vertical diffusive trends for further diagnostics
94         DO jn = 1, jptra
95            DO jk = 1, jpkm1
96               ztrtrd(:,:,jk,jn) = ( ( tra(:,:,jk,jn) - trb(:,:,jk,jn) ) / r2dt(jk) ) - ztrtrd(:,:,jk,jn)
97            END DO
98            CALL trd_tra( kt, 'TRC', jn, jptra_trd_zdf, ztrtrd(:,:,:,jn) )
99         END DO
100         DEALLOCATE( ztrtrd )
101      ENDIF
102
103      !                                          ! print mean trends (used for debugging)
104      IF( ln_ctl )   THEN
105         WRITE(charout, FMT="('zdf ')") ;  CALL prt_ctl_trc_info(charout)
106                                           CALL prt_ctl_trc( tab4d=tra, mask=tmask, clinfo=ctrcnm, clinfo2='trd' )
107      END IF
108      !
109   END SUBROUTINE trc_zdf
110
111
112   SUBROUTINE zdf_ctl
113      !!----------------------------------------------------------------------
114      !!                 ***  ROUTINE zdf_ctl  ***
115      !!
116      !! ** Purpose :   Choose the vertical mixing scheme
117      !!
118      !! ** Method  :   Set nzdf from ln_zdfexp
119      !!      nzdf = 0   explicit (time-splitting) scheme (ln_trczdf_exp=T)
120      !!           = 1   implicit (euler backward) scheme (ln_trczdf_exp=F)
121      !!      NB: The implicit scheme is required when using :
122      !!             - rotated lateral mixing operator
123      !!             - TKE, GLS or KPP vertical mixing scheme
124      !!----------------------------------------------------------------------
125
126      !  Define the vertical tracer physics scheme
127      ! ==========================================
128
129      ! Choice from ln_zdfexp already read in namelist in zdfini module
130      IF( ln_trczdf_exp ) THEN           ! use explicit scheme
131         nzdf = 0
132      ELSE                               ! use implicit scheme
133         nzdf = 1
134      ENDIF
135
136      ! Force implicit schemes
137      IF( ln_trcldf_iso                               )   nzdf = 1      ! iso-neutral lateral physics
138      IF( ln_trcldf_hor .AND. ln_sco                  )   nzdf = 1      ! horizontal lateral physics in s-coordinate
139#if defined key_zdftke || defined key_zdfgls || defined key_zdfkpp
140                                                          nzdf = 1      ! TKE, GLS or KPP physics       
141#endif
142      IF( ln_trczdf_exp .AND. nzdf == 1 )   THEN
143         CALL ctl_stop( 'trc_zdf : If using the rotated lateral mixing operator or TKE, GLS or KPP vertical scheme ', &
144            &           '          the implicit scheme is required, set ln_trczdf_exp = .false.' )
145      ENDIF
146
147      ! Test: esopa
148      IF( lk_esopa )    nzdf = -1                      ! All schemes used
149
150      IF(lwp) THEN
151         WRITE(numout,*)
152         WRITE(numout,*) 'trc:zdf_ctl : vertical passive tracer physics scheme'
153         WRITE(numout,*) '~~~~~~~~~~~'
154         IF( nzdf == -1 )   WRITE(numout,*) '              ESOPA test All scheme used'
155         IF( nzdf ==  0 )   WRITE(numout,*) '              Explicit time-splitting scheme'
156         IF( nzdf ==  1 )   WRITE(numout,*) '              Implicit (euler backward) scheme'
157      ENDIF
158
159   END SUBROUTINE zdf_ctl
160#else
161   !!----------------------------------------------------------------------
162   !!   Default option                                         Empty module
163   !!----------------------------------------------------------------------
164CONTAINS
165   SUBROUTINE trc_zdf( kt )
166      INTEGER, INTENT(in) :: kt 
167      WRITE(*,*) 'trc_zdf: You should not have seen this print! error?', kt
168   END SUBROUTINE trc_zdf
169#endif
170   !!==============================================================================
171END MODULE trczdf
Note: See TracBrowser for help on using the repository browser.