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 trunk/NEMO/OPA_SRC/TRA – NEMO

source: trunk/NEMO/OPA_SRC/TRA/trazdf.F90 @ 1110

Last change on this file since 1110 was 1110, checked in by ctlod, 16 years ago

trunk: remove a bug related to the combination of key_vvl and ln_trazdf_exp options, see ticket: #202

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 7.4 KB
Line 
1MODULE trazdf
2   !!==============================================================================
3   !!                 ***  MODULE  trazdf  ***
4   !! Ocean active tracers:  vertical component of the tracer mixing trend
5   !!==============================================================================
6   !! History :  9.0  !  05-11  (G. Madec)  Original code
7   !!----------------------------------------------------------------------
8
9   !!----------------------------------------------------------------------
10   !!   tra_zdf      : Update the tracer trend with the vertical diffusion
11   !!       zdf_ctl  : ???
12   !!----------------------------------------------------------------------
13   USE oce             ! ocean dynamics and tracers variables
14   USE dom_oce         ! ocean space and time domain variables
15   USE zdf_oce         ! ocean vertical physics variables
16   USE sbc_oce         ! surface boundary condition: ocean
17   USE dynspg_oce
18
19   USE trazdf_exp      ! vertical diffusion: explicit (tra_zdf_exp     routine)
20   USE trazdf_imp      ! vertical diffusion: implicit (tra_zdf_imp     routine)
21
22   USE ldftra_oce      ! ocean active tracers: lateral physics
23   USE trdmod          ! ocean active tracers trends
24   USE trdmod_oce      ! ocean variables trends
25   USE in_out_manager  ! I/O manager
26   USE prtctl          ! Print control
27
28   USE phycst
29   USE lbclnk          ! ocean lateral boundary conditions (or mpp link)
30   USE domvvl          ! variable volume
31
32   IMPLICIT NONE
33   PRIVATE
34
35   PUBLIC tra_zdf   !  routine called by step.F90
36
37   INTEGER ::   nzdf = 0               ! type vertical diffusion algorithm used
38      !                                ! defined from ln_zdf...  namlist logicals)
39
40   REAL(wp), DIMENSION(jpk) ::   r2dt  ! vertical profile time-step, = 2 rdttra
41      !                                ! except at nit000 (=rdttra) if neuler=0
42
43   !! * Substitutions
44#  include "domzgr_substitute.h90"
45#  include "zdfddm_substitute.h90"
46#  include "vectopt_loop_substitute.h90"
47   !!----------------------------------------------------------------------
48   !!  OPA 9.0 , LOCEAN-IPSL (2005)
49   !! $Id$
50   !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt)
51   !!----------------------------------------------------------------------
52
53CONTAINS
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
62
63      INTEGER  ::   jk                   ! Dummy loop indices
64      REAL(wp), DIMENSION(jpi,jpj,jpk) ::   ztrdt, ztrds   ! 3D workspace
65      !!---------------------------------------------------------------------
66
67      IF( kt == nit000 )   CALL zdf_ctl          ! initialisation & control of options
68
69      !                                          ! set time step
70      IF( neuler == 0 .AND. kt == nit000 ) THEN     ! at nit000
71         r2dt(:) =  rdttra(:)                          ! = rdtra (restarting with Euler time stepping)
72      ELSEIF( kt <= nit000 + 1) THEN                ! at nit000 or nit000+1
73         r2dt(:) = 2. * rdttra(:)                      ! = 2 rdttra (leapfrog)
74      ENDIF
75
76      IF( l_trdtra )   THEN                      ! temporary save of ta and sa trends
77         ztrdt(:,:,:) = ta(:,:,:)
78         ztrds(:,:,:) = sa(:,:,:)
79      ENDIF
80
81      IF( lk_vvl )   CALL dom_vvl_ssh( kt )      ! compute ssha field
82
83      SELECT CASE ( nzdf )                       ! compute lateral mixing trend and add it to the general trend
84      CASE ( -1 )                                       ! esopa: test all possibility with control print
85         CALL tra_zdf_exp    ( kt, r2dt )
86         CALL prt_ctl( tab3d_1=ta, clinfo1=' zdf0 - Ta: ', mask1=tmask,               &
87            &          tab3d_2=sa, clinfo2=       ' Sa: ', mask2=tmask, clinfo3='tra' )
88         CALL tra_zdf_imp    ( kt, r2dt )
89         CALL prt_ctl( tab3d_1=ta, clinfo1=' zdf1 - Ta: ', mask1=tmask,               &
90            &          tab3d_2=sa, clinfo2=       ' Sa: ', mask2=tmask, clinfo3='tra' )
91
92      CASE ( 0 )                                       ! explicit scheme
93         CALL tra_zdf_exp    ( kt, r2dt )
94
95      CASE ( 1 )                                       ! implicit scheme
96         CALL tra_zdf_imp    ( kt, r2dt )
97
98      END SELECT
99
100      IF( l_trdtra )   THEN                      ! save the vertical diffusive trends for further diagnostics
101         DO jk = 1, jpkm1
102            ztrdt(:,:,jk) = ( ( ta(:,:,jk) - tb(:,:,jk) ) / r2dt(jk) ) - ztrdt(:,:,jk)
103            ztrds(:,:,jk) = ( ( sa(:,:,jk) - sb(:,:,jk) ) / r2dt(jk) ) - ztrds(:,:,jk)
104         END DO
105         CALL trd_mod( ztrdt, ztrds, jptra_trd_zdf, 'TRA', kt )
106      ENDIF
107
108      !                                          ! print mean trends (used for debugging)
109      IF(ln_ctl)   CALL prt_ctl( tab3d_1=ta, clinfo1=' zdf  - Ta: ', mask1=tmask,               &
110         &                       tab3d_2=sa, clinfo2=       ' Sa: ', mask2=tmask, clinfo3='tra' )
111
112   END SUBROUTINE tra_zdf
113
114
115   SUBROUTINE zdf_ctl
116      !!----------------------------------------------------------------------
117      !!                 ***  ROUTINE zdf_ctl  ***
118      !!
119      !! ** Purpose :   Choose the vertical mixing scheme
120      !!
121      !! ** Method  :   Set nzdf from ln_zdfexp
122      !!      nzdf = 0   explicit (time-splitting) scheme (ln_zdfexp=T)
123      !!           = 1   implicit (euler backward) scheme (ln_zdfexp=F)
124      !!      NB: rotation of lateral mixing operator or TKE or KPP scheme,
125      !!      the implicit scheme is required.
126      !!----------------------------------------------------------------------
127      USE zdftke
128      USE zdfkpp
129      !!----------------------------------------------------------------------
130
131      !  Define the vertical tracer physics scheme
132      ! ==========================================
133
134      ! Choice from ln_zdfexp already read in namelist in zdfini module
135      IF( ln_zdfexp ) THEN               ! use explicit scheme
136         nzdf = 0
137      ELSE                               ! use implicit scheme
138         nzdf = 1
139      ENDIF
140
141      ! Force implicit schemes
142      IF( lk_zdftke .OR. lk_zdfkpp   )   nzdf = 1      ! TKE or KPP physics
143      IF( ln_traldf_iso              )   nzdf = 1      ! iso-neutral lateral physics
144      IF( ln_traldf_hor .AND. ln_sco )   nzdf = 1      ! horizontal lateral physics in s-coordinate
145
146      IF( ln_zdfexp .AND. nzdf == 1 )   THEN
147         CALL ctl_stop( 'tra_zdf : If using the rotation of lateral mixing operator or TKE ', &
148            &           '          or KPP scheme, the implicit scheme is required, set ln_zdfexp = .false.' )
149      ENDIF
150
151      ! Test: esopa
152      IF( lk_esopa )    nzdf = -1                      ! All schemes used
153
154      IF(lwp) THEN
155         WRITE(numout,*)
156         WRITE(numout,*) 'tra:zdf_ctl : vertical tracer physics scheme'
157         WRITE(numout,*) '~~~~~~~~~~~'
158         IF( nzdf == -1 )   WRITE(numout,*) '              ESOPA test All scheme used'
159         IF( nzdf ==  0 )   WRITE(numout,*) '              Explicit time-splitting scheme'
160         IF( nzdf ==  1 )   WRITE(numout,*) '              Implicit (euler backward) scheme'
161      ENDIF
162
163   END SUBROUTINE zdf_ctl
164
165   !!==============================================================================
166END MODULE trazdf
Note: See TracBrowser for help on using the repository browser.