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/2012/dev_r3309_LOCEAN12_Ediag/NEMOGCM/NEMO/OPA_SRC/TRA – NEMO

source: branches/2012/dev_r3309_LOCEAN12_Ediag/NEMOGCM/NEMO/OPA_SRC/TRA/trazdf.F90 @ 3325

Last change on this file since 3325 was 3318, checked in by gm, 12 years ago

Ediag branche: #927 split TRA/DYN trd computation

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