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 NEMO/branches/UKMO/r8395_coupling_sequence/NEMOGCM/NEMO/TOP_SRC/TRP – NEMO

source: NEMO/branches/UKMO/r8395_coupling_sequence/NEMOGCM/NEMO/TOP_SRC/TRP/trczdf.F90 @ 10762

Last change on this file since 10762 was 10762, checked in by jcastill, 5 years ago

Revert previous changes as the removal of keywords was not uncoupled of the actual changes

File size: 7.9 KB
RevLine 
[2030]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   !!----------------------------------------------------------------------
[5836]13   !!   trc_zdf      : update the tracer trend with the lateral diffusion
14   !!   trc_zdf_ini  : initialization, namelist read, and parameters control
[2030]15   !!----------------------------------------------------------------------
[5836]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
[2030]24
25   IMPLICIT NONE
26   PRIVATE
27
[5836]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)
[2030]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   !!----------------------------------------------------------------------
[5836]41   !! NEMO/TOP 3.7 , NEMO Consortium (2015)
[10762]42   !! $Id: trczdf.F90 7753 2017-03-03 11:46:59Z mocavero $
[2715]43   !! Software governed by the CeCILL licence     (NEMOGCM/NEMO_CeCILL.txt)
[2030]44   !!----------------------------------------------------------------------
45CONTAINS
[2715]46
[2030]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      !
[7753]55      INTEGER               ::  jk, jn
[2030]56      CHARACTER (len=22)    :: charout
[3294]57      REAL(wp), POINTER, DIMENSION(:,:,:,:) ::   ztrtrd   ! 4D workspace
[2030]58      !!---------------------------------------------------------------------
[3294]59      !
60      IF( nn_timing == 1 )  CALL timing_start('trc_zdf')
61      !
[2030]62      IF( l_trdtrc )  THEN
[3294]63         CALL wrk_alloc( jpi, jpj, jpk, jptra, ztrtrd )
[7753]64         ztrtrd(:,:,:,:)  = tra(:,:,:,:)
[2030]65      ENDIF
66
67      SELECT CASE ( nzdf )                       ! compute lateral mixing trend and add it to the general trend
[6140]68      CASE ( 0 ) ;  CALL tra_zdf_exp( kt, nittrc000, 'TRC', r2dttrc, nn_trczdf_exp, trb, tra, jptra )    !   explicit scheme
69      CASE ( 1 ) ;  CALL tra_zdf_imp( kt, nittrc000, 'TRC', r2dttrc,                trb, tra, jptra )    !   implicit scheme         
[2030]70      END SELECT
71
[3632]72      IF( l_trdtrc )   THEN                      ! save the vertical diffusive trends for further diagnostics
[2030]73         DO jn = 1, jptra
74            DO jk = 1, jpkm1
[7753]75               ztrtrd(:,:,jk,jn) = ( ( tra(:,:,jk,jn) - trb(:,:,jk,jn) ) / r2dttrc ) - ztrtrd(:,:,jk,jn)
[2030]76            END DO
[4990]77            CALL trd_tra( kt, 'TRC', jn, jptra_zdf, ztrtrd(:,:,:,jn) )
[2030]78         END DO
[3294]79         CALL wrk_dealloc( jpi, jpj, jpk, jptra, ztrtrd )
[2030]80      ENDIF
81      !                                          ! print mean trends (used for debugging)
82      IF( ln_ctl )   THEN
83         WRITE(charout, FMT="('zdf ')") ;  CALL prt_ctl_trc_info(charout)
84                                           CALL prt_ctl_trc( tab4d=tra, mask=tmask, clinfo=ctrcnm, clinfo2='trd' )
85      END IF
86      !
[3294]87      IF( nn_timing == 1 )  CALL timing_stop('trc_zdf')
88      !
[2030]89   END SUBROUTINE trc_zdf
90
91
[5836]92   SUBROUTINE trc_zdf_ini
[2030]93      !!----------------------------------------------------------------------
[5836]94      !!                 ***  ROUTINE trc_zdf_ini  ***
[2030]95      !!
96      !! ** Purpose :   Choose the vertical mixing scheme
97      !!
98      !! ** Method  :   Set nzdf from ln_zdfexp
99      !!      nzdf = 0   explicit (time-splitting) scheme (ln_trczdf_exp=T)
100      !!           = 1   implicit (euler backward) scheme (ln_trczdf_exp=F)
[2476]101      !!      NB: The implicit scheme is required when using :
102      !!             - rotated lateral mixing operator
[5836]103      !!             - TKE, GLS vertical mixing scheme
[2030]104      !!----------------------------------------------------------------------
[5836]105      INTEGER ::  ios                 ! Local integer output status for namelist read
106      !!
107      NAMELIST/namtrc_zdf/ ln_trczdf_exp  , nn_trczdf_exp
108      !!----------------------------------------------------------------------
109      !
110      REWIND( numnat_ref )             ! namtrc_zdf in reference namelist
111      READ  ( numnat_ref, namtrc_zdf, IOSTAT = ios, ERR = 905)
112905   IF( ios /= 0 ) CALL ctl_nam ( ios , 'namtrc_zdf in reference namelist', lwp )
113      !
114      REWIND( numnat_cfg )             ! namtrc_zdf in configuration namelist
115      READ  ( numnat_cfg, namtrc_zdf, IOSTAT = ios, ERR = 906 )
116906   IF( ios /= 0 ) CALL ctl_nam ( ios , 'namtrc_zdf in configuration namelist', lwp )
117      IF(lwm) WRITE ( numont, namtrc_zdf )
118      !
119      IF(lwp) THEN                     ! Control print
120         WRITE(numout,*)
121         WRITE(numout,*) '   Namelist namtrc_zdf : set vertical diffusion  parameters'
122         WRITE(numout,*) '      time splitting / backward scheme ln_trczdf_exp = ', ln_trczdf_exp
123         WRITE(numout,*) '      number of time step              nn_trczdf_exp = ', nn_trczdf_exp
124      ENDIF
[2030]125
[5836]126      !                                ! Define the vertical tracer physics scheme
127      IF( ln_trczdf_exp ) THEN   ;   nzdf = 0     ! explicit scheme
128      ELSE                       ;   nzdf = 1     ! implicit scheme
[2030]129      ENDIF
130
[5836]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_zdfgls 
135                                         nzdf = 1      ! TKE or GLS physics       
[2030]136#endif
[5836]137      IF( ln_trczdf_exp .AND. nzdf == 1 )  & 
138         CALL ctl_stop( 'trc_zdf : If using the rotated lateral mixing operator or TKE, GLS vertical scheme ', &
[2476]139            &           '          the implicit scheme is required, set ln_trczdf_exp = .false.' )
[2030]140
141      IF(lwp) THEN
142         WRITE(numout,*)
143         WRITE(numout,*) 'trc:zdf_ctl : vertical passive tracer physics scheme'
144         WRITE(numout,*) '~~~~~~~~~~~'
145         IF( nzdf ==  0 )   WRITE(numout,*) '              Explicit time-splitting scheme'
146         IF( nzdf ==  1 )   WRITE(numout,*) '              Implicit (euler backward) scheme'
147      ENDIF
[5836]148      !
149   END SUBROUTINE trc_zdf_ini
150   
[2030]151#else
152   !!----------------------------------------------------------------------
153   !!   Default option                                         Empty module
154   !!----------------------------------------------------------------------
155CONTAINS
156   SUBROUTINE trc_zdf( kt )
157      INTEGER, INTENT(in) :: kt 
158      WRITE(*,*) 'trc_zdf: You should not have seen this print! error?', kt
159   END SUBROUTINE trc_zdf
160#endif
161   !!==============================================================================
162END MODULE trczdf
Note: See TracBrowser for help on using the repository browser.