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.
trazdf.F90 in branches/UKMO/r5936_CO6_CO5_shelfdiagnostic/NEMOGCM/NEMO/OPA_SRC/TRA – NEMO

source: branches/UKMO/r5936_CO6_CO5_shelfdiagnostic/NEMOGCM/NEMO/OPA_SRC/TRA/trazdf.F90 @ 7113

Last change on this file since 7113 was 7113, checked in by jcastill, 8 years ago

Remove again the svn keywords, as it did not work before

File size: 7.3 KB
RevLine 
[458]1MODULE trazdf
2   !!==============================================================================
3   !!                 ***  MODULE  trazdf  ***
4   !! Ocean active tracers:  vertical component of the tracer mixing trend
5   !!==============================================================================
[2528]6   !! History :  1.0  ! 2005-11  (G. Madec)  Original code
7   !!            3.0  ! 2008-01  (C. Ethe, G. Madec)  merge TRC-TRA
[458]8   !!----------------------------------------------------------------------
[503]9
10   !!----------------------------------------------------------------------
[458]11   !!   tra_zdf      : Update the tracer trend with the vertical diffusion
[2528]12   !!   tra_zdf_init : initialisation of the computation
[458]13   !!----------------------------------------------------------------------
14   USE oce             ! ocean dynamics and tracers variables
15   USE dom_oce         ! ocean space and time domain variables
[2715]16   USE domvvl          ! variable volume
17   USE phycst          ! physical constant
[458]18   USE zdf_oce         ! ocean vertical physics variables
[888]19   USE sbc_oce         ! surface boundary condition: ocean
[5836]20   !
21   USE ldftra          ! lateral diffusion: eddy diffusivity
22   USE ldfslp          ! lateral diffusion: iso-neutral slope
[458]23   USE trazdf_exp      ! vertical diffusion: explicit (tra_zdf_exp     routine)
24   USE trazdf_imp      ! vertical diffusion: implicit (tra_zdf_imp     routine)
[5836]25   !
[4990]26   USE trd_oce         ! trends: ocean variables
27   USE trdtra          ! trends manager: tracers
28   !
[458]29   USE in_out_manager  ! I/O manager
30   USE prtctl          ! Print control
[592]31   USE lbclnk          ! ocean lateral boundary conditions (or mpp link)
[2715]32   USE lib_mpp         ! MPP library
[3294]33   USE wrk_nemo        ! Memory allocation
34   USE timing          ! Timing
[592]35
[458]36   IMPLICIT NONE
37   PRIVATE
38
[2715]39   PUBLIC   tra_zdf        ! routine called by step.F90
40   PUBLIC   tra_zdf_init   ! routine called by nemogcm.F90
[458]41
[2715]42   INTEGER ::   nzdf = 0   ! type vertical diffusion algorithm used (defined from ln_zdf...  namlist logicals)
[458]43
44   !! * Substitutions
45#  include "domzgr_substitute.h90"
46#  include "zdfddm_substitute.h90"
47#  include "vectopt_loop_substitute.h90"
48   !!----------------------------------------------------------------------
[5836]49   !! NEMO/OPA 3.7 , NEMO Consortium (2015)
[888]50   !! $Id$
[2715]51   !! Software governed by the CeCILL licence     (NEMOGCM/NEMO_CeCILL.txt)
[458]52   !!----------------------------------------------------------------------
[2715]53CONTAINS
[458]54
55   SUBROUTINE tra_zdf( kt )
56      !!----------------------------------------------------------------------
57      !!                  ***  ROUTINE tra_zdf  ***
58      !!
59      !! ** Purpose :   compute the vertical ocean tracer physics.
60      !!---------------------------------------------------------------------
61      INTEGER, INTENT( in ) ::   kt      ! ocean time-step index
[2528]62      !!
[458]63      INTEGER  ::   jk                   ! Dummy loop indices
[3294]64      REAL(wp), POINTER, DIMENSION(:,:,:) ::   ztrdt, ztrds   ! 3D workspace
[458]65      !!---------------------------------------------------------------------
[3294]66      !
67      IF( nn_timing == 1 )  CALL timing_start('tra_zdf')
68      !
[458]69      IF( neuler == 0 .AND. kt == nit000 ) THEN     ! at nit000
[2715]70         r2dtra(:) =  rdttra(:)                          ! = rdtra (restarting with Euler time stepping)
[458]71      ELSEIF( kt <= nit000 + 1) THEN                ! at nit000 or nit000+1
[2715]72         r2dtra(:) = 2. * rdttra(:)                      ! = 2 rdttra (leapfrog)
[458]73      ENDIF
74
[2528]75      IF( l_trdtra )   THEN                    !* Save ta and sa trends
[3294]76         CALL wrk_alloc( jpi, jpj, jpk, ztrdt, ztrds )
77         ztrdt(:,:,:) = tsa(:,:,:,jp_tem)
78         ztrds(:,:,:) = tsa(:,:,:,jp_sal)
[458]79      ENDIF
80
81      SELECT CASE ( nzdf )                       ! compute lateral mixing trend and add it to the general trend
[3294]82      CASE ( 0 )    ;    CALL tra_zdf_exp( kt, nit000, 'TRA', r2dtra, nn_zdfexp, tsb, tsa, jpts )  !   explicit scheme
83      CASE ( 1 )    ;    CALL tra_zdf_imp( kt, nit000, 'TRA', r2dtra,            tsb, tsa, jpts )  !   implicit scheme
[458]84      END SELECT
[5836]85!!gm WHY here !   and I don't like that !
[5385]86      ! DRAKKAR SSS control {
87      ! JMM avoid negative salinities near river outlet ! Ugly fix
88      ! JMM : restore negative salinities to small salinities:
89      WHERE ( tsa(:,:,:,jp_sal) < 0._wp )   tsa(:,:,:,jp_sal) = 0.1_wp
[5836]90!!gm
[458]91
[1110]92      IF( l_trdtra )   THEN                      ! save the vertical diffusive trends for further diagnostics
93         DO jk = 1, jpkm1
[2715]94            ztrdt(:,:,jk) = ( ( tsa(:,:,jk,jp_tem) - tsb(:,:,jk,jp_tem) ) / r2dtra(jk) ) - ztrdt(:,:,jk)
95            ztrds(:,:,jk) = ( ( tsa(:,:,jk,jp_sal) - tsb(:,:,jk,jp_sal) ) / r2dtra(jk) ) - ztrds(:,:,jk)
[1110]96         END DO
[5836]97!!gm this should be moved in trdtra.F90 and done on all trends
[4990]98         CALL lbc_lnk( ztrdt, 'T', 1. )
99         CALL lbc_lnk( ztrds, 'T', 1. )
[5836]100!!gm
[4990]101         CALL trd_tra( kt, 'TRA', jp_tem, jptra_zdf, ztrdt )
102         CALL trd_tra( kt, 'TRA', jp_sal, jptra_zdf, ztrds )
[3294]103         CALL wrk_dealloc( jpi, jpj, jpk, ztrdt, ztrds )
[1110]104      ENDIF
105
106      !                                          ! print mean trends (used for debugging)
[2528]107      IF(ln_ctl)   CALL prt_ctl( tab3d_1=tsa(:,:,:,jp_tem), clinfo1=' zdf  - Ta: ', mask1=tmask,               &
108         &                       tab3d_2=tsa(:,:,:,jp_sal), clinfo2=       ' Sa: ', mask2=tmask, clinfo3='tra' )
[2715]109      !
[3294]110      IF( nn_timing == 1 )  CALL timing_stop('tra_zdf')
111      !
[458]112   END SUBROUTINE tra_zdf
113
114
[2528]115   SUBROUTINE tra_zdf_init
[458]116      !!----------------------------------------------------------------------
[2528]117      !!                 ***  ROUTINE tra_zdf_init  ***
[458]118      !!
119      !! ** Purpose :   Choose the vertical mixing scheme
120      !!
[789]121      !! ** Method  :   Set nzdf from ln_zdfexp
[458]122      !!      nzdf = 0   explicit (time-splitting) scheme (ln_zdfexp=T)
123      !!           = 1   implicit (euler backward) scheme (ln_zdfexp=F)
[5836]124      !!      NB: rotation of lateral mixing operator or TKE & GLS schemes,
125      !!          an implicit scheme is required.
[458]126      !!----------------------------------------------------------------------
127      USE zdftke
[2528]128      USE zdfgls
[458]129      !!----------------------------------------------------------------------
130
131      ! Choice from ln_zdfexp already read in namelist in zdfini module
[2528]132      IF( ln_zdfexp ) THEN   ;   nzdf = 0           ! use explicit scheme
133      ELSE                   ;   nzdf = 1           ! use implicit scheme
[458]134      ENDIF
135
136      ! Force implicit schemes
[5836]137      IF( lk_zdftke .OR. lk_zdfgls   )   nzdf = 1   ! TKE, or GLS physics
138      IF( ln_traldf_iso              )   nzdf = 1   ! iso-neutral lateral physics
139      IF( ln_traldf_hor .AND. ln_sco )   nzdf = 1   ! horizontal lateral physics in s-coordinate
[2528]140      IF( ln_zdfexp .AND. nzdf == 1 )   CALL ctl_stop( 'tra_zdf : If using the rotation of lateral mixing operator',   &
[5836]141            &                         ' GLS or TKE scheme, the implicit scheme is required, set ln_zdfexp = .false.' )
[458]142
143      IF(lwp) THEN
144         WRITE(numout,*)
[2528]145         WRITE(numout,*) 'tra_zdf_init : vertical tracer physics scheme'
[458]146         WRITE(numout,*) '~~~~~~~~~~~'
147         IF( nzdf ==  0 )   WRITE(numout,*) '              Explicit time-splitting scheme'
148         IF( nzdf ==  1 )   WRITE(numout,*) '              Implicit (euler backward) scheme'
149      ENDIF
[2528]150      !
151   END SUBROUTINE tra_zdf_init
[458]152
153   !!==============================================================================
154END MODULE trazdf
Note: See TracBrowser for help on using the repository browser.