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

Last change on this file since 558 was 503, checked in by opalod, 18 years ago

nemo_v1_update_064 : CT : general trends update including the addition of mean windows analysis possibility in the mixed layer

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