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 branches/DEV_r2006_merge_TRA_TRC/NEMO/TOP_SRC/TRP – NEMO

source: branches/DEV_r2006_merge_TRA_TRC/NEMO/TOP_SRC/TRP/trczdf.F90 @ 2034

Last change on this file since 2034 was 2034, checked in by cetlod, 14 years ago

cosmetic changes

File size: 8.0 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/OPA 3.3 , LOCEAN-IPSL (2010)
44   !! $Id: trcldf.F90 2024 2010-07-29 10:57:35Z cetlod $
45   !! Software governed by the CeCILL licence (modipsl/doc/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 == nittrc000 )   CALL zdf_ctl          ! initialisation & control of options
64
65      IF( neuler == 0 .AND. kt == nittrc000 ) THEN     ! at nit000
66         r2dt(:) =  rdttra(:) * FLOAT(nn_dttrc)          ! = rdtra (restarting with Euler time stepping)
67      ELSEIF( kt <= nittrc000 + nn_dttrc ) THEN          ! at nit000 or nit000+1
68         r2dt(:) = 2. * rdttra(:) * FLOAT(nn_dttrc)      ! = 2 rdttra (leapfrog)
69      ENDIF
70
71      IF( l_trdtrc )  THEN
72         ALLOCATE( ztrtrd(jpi,jpj,jpk,jptra) )   ! temporary save of trends
73         ztrtrd(:,:,:,:)  = tra(:,:,:,:)
74      ENDIF
75
76      SELECT CASE ( nzdf )                       ! compute lateral mixing trend and add it to the general trend
77      CASE ( -1 )                                       ! esopa: test all possibility with control print
78         CALL tra_zdf_exp( kt , 'TRC', r2dt, nn_trczdf_exp, trb, tra, jptra ) 
79         WRITE(charout, FMT="('zdf1 ')") ;  CALL prt_ctl_trc_info(charout)
80                                            CALL prt_ctl_trc( tab4d=tra, mask=tmask, clinfo=ctrcnm, clinfo2='trd' )
81         CALL tra_zdf_imp( kt , 'TRC', r2dt,                trb, tra, jptra ) 
82         WRITE(charout, FMT="('zdf2 ')") ;  CALL prt_ctl_trc_info(charout)
83                                            CALL prt_ctl_trc( tab4d=tra, mask=tmask, clinfo=ctrcnm, clinfo2='trd' )
84      CASE ( 0 ) ;  CALL tra_zdf_exp( kt , 'TRC', r2dt, nn_trczdf_exp, trb, tra, jptra )    !   explicit scheme
85      CASE ( 1 ) ;  CALL tra_zdf_imp( kt , 'TRC', r2dt,                trb, tra, jptra )    !   implicit scheme         
86
87      END SELECT
88
89      IF( l_trdtra )   THEN                      ! save the vertical diffusive trends for further diagnostics
90         DO jn = 1, jptra
91            DO jk = 1, jpkm1
92               ztrtrd(:,:,jk,jn) = ( ( tra(:,:,jk,jn) - trb(:,:,jk,jn) ) / r2dt(jk) ) - ztrtrd(:,:,jk,jn)
93            END DO
94            CALL trd_tra( kt, 'TRC', jn, jptra_trd_zdf, ztrtrd(:,:,:,jn) )
95         END DO
96         DEALLOCATE( ztrtrd )
97      ENDIF
98
99      !                                          ! print mean trends (used for debugging)
100      IF( ln_ctl )   THEN
101         WRITE(charout, FMT="('zdf ')") ;  CALL prt_ctl_trc_info(charout)
102                                           CALL prt_ctl_trc( tab4d=tra, mask=tmask, clinfo=ctrcnm, clinfo2='trd' )
103      END IF
104      !
105   END SUBROUTINE trc_zdf
106
107
108   SUBROUTINE zdf_ctl
109      !!----------------------------------------------------------------------
110      !!                 ***  ROUTINE zdf_ctl  ***
111      !!
112      !! ** Purpose :   Choose the vertical mixing scheme
113      !!
114      !! ** Method  :   Set nzdf from ln_zdfexp
115      !!      nzdf = 0   explicit (time-splitting) scheme (ln_trczdf_exp=T)
116      !!           = 1   implicit (euler backward) scheme (ln_trczdf_exp=F)
117      !!      NB: rotation of lateral mixing operator or TKE or KPP scheme,
118      !!      the implicit scheme is required.
119      !!----------------------------------------------------------------------
120
121      !  Define the vertical tracer physics scheme
122      ! ==========================================
123
124      ! Choice from ln_zdfexp already read in namelist in zdfini module
125      IF( ln_trczdf_exp ) THEN           ! use explicit scheme
126         nzdf = 0
127      ELSE                               ! use implicit scheme
128         nzdf = 1
129      ENDIF
130
131      ! Force implicit schemes
132      IF( ln_trcldf_iso                               )   nzdf = 1      ! iso-neutral lateral physics
133      IF( ln_trcldf_hor .AND. ln_sco                  )   nzdf = 1      ! horizontal lateral physics in s-coordinate
134#if defined key_zdftke || defined key_zdftke_old || defined key_zdfkpp
135                                                          nzdf = 1      ! TKE or KPP physics       
136#endif
137      IF( ln_trczdf_exp .AND. nzdf == 1 )   THEN
138         CALL ctl_stop( 'trc_zdf : If using the rotation of lateral mixing operator or TKE ', &
139            &           '          or KPP scheme, the implicit scheme is required, set ln_trczdf_exp = .false.' )
140      ENDIF
141
142      ! Test: esopa
143      IF( lk_esopa )    nzdf = -1                      ! All schemes used
144
145      IF(lwp) THEN
146         WRITE(numout,*)
147         WRITE(numout,*) 'trc:zdf_ctl : vertical passive tracer physics scheme'
148         WRITE(numout,*) '~~~~~~~~~~~'
149         IF( nzdf == -1 )   WRITE(numout,*) '              ESOPA test All scheme used'
150         IF( nzdf ==  0 )   WRITE(numout,*) '              Explicit time-splitting scheme'
151         IF( nzdf ==  1 )   WRITE(numout,*) '              Implicit (euler backward) scheme'
152      ENDIF
153
154   END SUBROUTINE zdf_ctl
155#else
156   !!----------------------------------------------------------------------
157   !!   Default option                                         Empty module
158   !!----------------------------------------------------------------------
159CONTAINS
160   SUBROUTINE trc_zdf( kt )
161      INTEGER, INTENT(in) :: kt 
162      WRITE(*,*) 'trc_zdf: You should not have seen this print! error?', kt
163   END SUBROUTINE trc_zdf
164#endif
165   !!==============================================================================
166END MODULE trczdf
Note: See TracBrowser for help on using the repository browser.