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/2017/dev_r7881_no_wrk_alloc/NEMOGCM/NEMO/TOP_SRC/TRP – NEMO

source: branches/2017/dev_r7881_no_wrk_alloc/NEMOGCM/NEMO/TOP_SRC/TRP/trczdf.F90 @ 7910

Last change on this file since 7910 was 7910, checked in by timgraham, 7 years ago

All wrk_alloc removed

  • Property svn:keywords set to Id
File size: 7.8 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   !!   trc_zdf      : update the tracer trend with the lateral diffusion
14   !!   trc_zdf_ini  : initialization, namelist read, and parameters control
15   !!----------------------------------------------------------------------
16   USE trc           ! ocean passive tracers variables
17   USE oce_trc       ! ocean dynamics and active tracers
18   USE trd_oce       ! trends: ocean variables
19   USE trazdf_exp    ! vertical diffusion: explicit (tra_zdf_exp     routine)
20   USE trazdf_imp    ! vertical diffusion: implicit (tra_zdf_imp     routine)
21   USE trcldf        ! passive tracers: lateral diffusion
22   USE trdtra        ! trends manager: tracers
23   USE prtctl_trc    ! Print control
24
25   IMPLICIT NONE
26   PRIVATE
27
28   PUBLIC   trc_zdf         ! called by step.F90
29   PUBLIC   trc_zdf_ini     ! called by nemogcm.F90
30   
31   !                                        !!** Vertical diffusion (nam_trczdf) **
32   LOGICAL , PUBLIC ::   ln_trczdf_exp       !: explicit vertical diffusion scheme flag
33   INTEGER , PUBLIC ::   nn_trczdf_exp       !: number of sub-time step (explicit time stepping)
34
35   INTEGER ::   nzdf = 0               ! type vertical diffusion algorithm used
36      !                                ! defined from ln_zdf...  namlist logicals)
37   !! * Substitutions
38#  include "zdfddm_substitute.h90"
39#  include "vectopt_loop_substitute.h90"
40   !!----------------------------------------------------------------------
41   !! NEMO/TOP 3.7 , NEMO Consortium (2015)
42   !! $Id$
43   !! Software governed by the CeCILL licence     (NEMOGCM/NEMO_CeCILL.txt)
44   !!----------------------------------------------------------------------
45CONTAINS
46
47   SUBROUTINE trc_zdf( kt )
48      !!----------------------------------------------------------------------
49      !!                  ***  ROUTINE trc_zdf  ***
50      !!
51      !! ** Purpose :   compute the vertical ocean tracer physics.
52      !!---------------------------------------------------------------------
53      INTEGER, INTENT( in ) ::  kt      ! ocean time-step index
54      !
55      INTEGER               ::  jk, jn
56      CHARACTER (len=22)    :: charout
57      REAL(wp), DIMENSION(jpi,jpj,jpk,jptra) ::   ztrtrd   ! 4D workspace
58      !!---------------------------------------------------------------------
59      !
60      IF( nn_timing == 1 )  CALL timing_start('trc_zdf')
61      !
62      IF( l_trdtrc )  THEN
63         ztrtrd(:,:,:,:)  = tra(:,:,:,:)
64      ENDIF
65
66      SELECT CASE ( nzdf )                       ! compute lateral mixing trend and add it to the general trend
67      CASE ( 0 ) ;  CALL tra_zdf_exp( kt, nittrc000, 'TRC', r2dttrc, nn_trczdf_exp, trb, tra, jptra )    !   explicit scheme
68      CASE ( 1 ) ;  CALL tra_zdf_imp( kt, nittrc000, 'TRC', r2dttrc,                trb, tra, jptra )    !   implicit scheme         
69      END SELECT
70
71      IF( l_trdtrc )   THEN                      ! save the vertical diffusive trends for further diagnostics
72         DO jn = 1, jptra
73            DO jk = 1, jpkm1
74               ztrtrd(:,:,jk,jn) = ( ( tra(:,:,jk,jn) - trb(:,:,jk,jn) ) / r2dttrc ) - ztrtrd(:,:,jk,jn)
75            END DO
76            CALL trd_tra( kt, 'TRC', jn, jptra_zdf, ztrtrd(:,:,:,jn) )
77         END DO
78      ENDIF
79      !                                          ! print mean trends (used for debugging)
80      IF( ln_ctl )   THEN
81         WRITE(charout, FMT="('zdf ')") ;  CALL prt_ctl_trc_info(charout)
82                                           CALL prt_ctl_trc( tab4d=tra, mask=tmask, clinfo=ctrcnm, clinfo2='trd' )
83      END IF
84      !
85      IF( nn_timing == 1 )  CALL timing_stop('trc_zdf')
86      !
87   END SUBROUTINE trc_zdf
88
89
90   SUBROUTINE trc_zdf_ini
91      !!----------------------------------------------------------------------
92      !!                 ***  ROUTINE trc_zdf_ini  ***
93      !!
94      !! ** Purpose :   Choose the vertical mixing scheme
95      !!
96      !! ** Method  :   Set nzdf from ln_zdfexp
97      !!      nzdf = 0   explicit (time-splitting) scheme (ln_trczdf_exp=T)
98      !!           = 1   implicit (euler backward) scheme (ln_trczdf_exp=F)
99      !!      NB: The implicit scheme is required when using :
100      !!             - rotated lateral mixing operator
101      !!             - TKE, GLS vertical mixing scheme
102      !!----------------------------------------------------------------------
103      INTEGER ::  ios                 ! Local integer output status for namelist read
104      !!
105      NAMELIST/namtrc_zdf/ ln_trczdf_exp  , nn_trczdf_exp
106      !!----------------------------------------------------------------------
107      !
108      REWIND( numnat_ref )             ! namtrc_zdf in reference namelist
109      READ  ( numnat_ref, namtrc_zdf, IOSTAT = ios, ERR = 905)
110905   IF( ios /= 0 ) CALL ctl_nam ( ios , 'namtrc_zdf in reference namelist', lwp )
111      !
112      REWIND( numnat_cfg )             ! namtrc_zdf in configuration namelist
113      READ  ( numnat_cfg, namtrc_zdf, IOSTAT = ios, ERR = 906 )
114906   IF( ios /= 0 ) CALL ctl_nam ( ios , 'namtrc_zdf in configuration namelist', lwp )
115      IF(lwm) WRITE ( numont, namtrc_zdf )
116      !
117      IF(lwp) THEN                     ! Control print
118         WRITE(numout,*)
119         WRITE(numout,*) '   Namelist namtrc_zdf : set vertical diffusion  parameters'
120         WRITE(numout,*) '      time splitting / backward scheme ln_trczdf_exp = ', ln_trczdf_exp
121         WRITE(numout,*) '      number of time step              nn_trczdf_exp = ', nn_trczdf_exp
122      ENDIF
123
124      !                                ! Define the vertical tracer physics scheme
125      IF( ln_trczdf_exp ) THEN   ;   nzdf = 0     ! explicit scheme
126      ELSE                       ;   nzdf = 1     ! implicit scheme
127      ENDIF
128
129      !                                ! Force implicit schemes
130      IF( ln_trcldf_iso              )   nzdf = 1      ! iso-neutral lateral physics
131      IF( ln_trcldf_hor .AND. ln_sco )   nzdf = 1      ! horizontal lateral physics in s-coordinate
132#if defined key_zdftke || defined key_zdfgls 
133                                         nzdf = 1      ! TKE or GLS physics       
134#endif
135      IF( ln_trczdf_exp .AND. nzdf == 1 )  & 
136         CALL ctl_stop( 'trc_zdf : If using the rotated lateral mixing operator or TKE, GLS vertical scheme ', &
137            &           '          the implicit scheme is required, set ln_trczdf_exp = .false.' )
138
139      IF(lwp) THEN
140         WRITE(numout,*)
141         WRITE(numout,*) 'trc:zdf_ctl : vertical passive tracer physics scheme'
142         WRITE(numout,*) '~~~~~~~~~~~'
143         IF( nzdf ==  0 )   WRITE(numout,*) '              Explicit time-splitting scheme'
144         IF( nzdf ==  1 )   WRITE(numout,*) '              Implicit (euler backward) scheme'
145      ENDIF
146      !
147   END SUBROUTINE trc_zdf_ini
148   
149#else
150   !!----------------------------------------------------------------------
151   !!   Default option                                         Empty module
152   !!----------------------------------------------------------------------
153CONTAINS
154   SUBROUTINE trc_zdf( kt )
155      INTEGER, INTENT(in) :: kt 
156      WRITE(*,*) 'trc_zdf: You should not have seen this print! error?', kt
157   END SUBROUTINE trc_zdf
158#endif
159   !!==============================================================================
160END MODULE trczdf
Note: See TracBrowser for help on using the repository browser.