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 @ 888

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

merge dev_001_SBC branche with the trunk to include the New Surface Module package, see ticket: #113

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
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 :  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         IF( l_trdtra )   THEN                         ! save the vertical diffusive trends for further diagnostics
95            ztrdt(:,:,:) = ta(:,:,:) - ztrdt(:,:,:)
96            ztrds(:,:,:) = sa(:,:,:) - ztrds(:,:,:)
97            CALL trd_mod( ztrdt, ztrds, jptra_trd_zdf, 'TRA', kt )
98         ENDIF
99
100      CASE ( 1 )                                       ! implicit scheme
101         CALL tra_zdf_imp    ( kt, r2dt )
102         IF( l_trdtra )   THEN                         ! save the vertical diffusive trends for further diagnostics
103            DO jk = 1, jpkm1
104               ztrdt(:,:,jk) = ( ( ta(:,:,jk) - tb(:,:,jk) ) / r2dt(jk) ) - ztrdt(:,:,jk)
105               ztrds(:,:,jk) = ( ( sa(:,:,jk) - sb(:,:,jk) ) / r2dt(jk) ) - ztrds(:,:,jk)
106            END DO
107            CALL trd_mod( ztrdt, ztrds, jptra_trd_zdf, 'TRA', kt )
108         ENDIF
109
110      END SELECT
111
112      !                                                ! print mean trends (used for debugging)
113      IF(ln_ctl)   CALL prt_ctl( tab3d_1=ta, clinfo1=' zdf  - Ta: ', mask1=tmask,               &
114         &                       tab3d_2=sa, clinfo2=       ' Sa: ', mask2=tmask, clinfo3='tra' )
115
116   END SUBROUTINE tra_zdf
117
118
119   SUBROUTINE zdf_ctl
120      !!----------------------------------------------------------------------
121      !!                 ***  ROUTINE zdf_ctl  ***
122      !!
123      !! ** Purpose :   Choose the vertical mixing scheme
124      !!
125      !! ** Method  :   Set nzdf from ln_zdfexp
126      !!      nzdf = 0   explicit (time-splitting) scheme (ln_zdfexp=T)
127      !!           = 1   implicit (euler backward) scheme (ln_zdfexp=F)
128      !!      NB: rotation of lateral mixing operator or TKE or KPP scheme,
129      !!      the implicit scheme is required.
130      !!----------------------------------------------------------------------
131      USE zdftke
132      USE zdfkpp
133      !!----------------------------------------------------------------------
134
135      !  Define the vertical tracer physics scheme
136      ! ==========================================
137
138      ! Choice from ln_zdfexp already read in namelist in zdfini module
139      IF( ln_zdfexp ) THEN               ! use explicit scheme
140         nzdf = 0
141      ELSE                               ! use implicit scheme
142         nzdf = 1
143      ENDIF
144
145      ! Force implicit schemes
146      IF( lk_zdftke .OR. lk_zdfkpp   )   nzdf = 1      ! TKE or KPP physics
147      IF( ln_traldf_iso              )   nzdf = 1      ! iso-neutral lateral physics
148      IF( ln_traldf_hor .AND. ln_sco )   nzdf = 1      ! horizontal lateral physics in s-coordinate
149
150      IF( ln_zdfexp .AND. nzdf == 1 )   THEN
151         CALL ctl_stop( 'tra_zdf : If using the rotation of lateral mixing operator or TKE ', &
152            &           '          or KPP scheme, the implicit scheme is required, set ln_zdfexp = .false.' )
153      ENDIF
154
155      ! Test: esopa
156      IF( lk_esopa )    nzdf = -1                      ! All schemes used
157
158      IF(lwp) THEN
159         WRITE(numout,*)
160         WRITE(numout,*) 'tra:zdf_ctl : vertical tracer physics scheme'
161         WRITE(numout,*) '~~~~~~~~~~~'
162         IF( nzdf == -1 )   WRITE(numout,*) '              ESOPA test All scheme used'
163         IF( nzdf ==  0 )   WRITE(numout,*) '              Explicit time-splitting scheme'
164         IF( nzdf ==  1 )   WRITE(numout,*) '              Implicit (euler backward) scheme'
165      ENDIF
166
167   END SUBROUTINE zdf_ctl
168
169   !!==============================================================================
170END MODULE trazdf
Note: See TracBrowser for help on using the repository browser.