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/2014/dev_CNRS0_NOC1_LDF/NEMOGCM/NEMO/OPA_SRC/TRA – NEMO

source: branches/2014/dev_CNRS0_NOC1_LDF/NEMOGCM/NEMO/OPA_SRC/TRA/trazdf.F90 @ 4616

Last change on this file since 4616 was 4596, checked in by gm, 10 years ago

#1260: LDF simplification + bilap iso-neutral for TRA and GYRE

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