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.
dynzdf.F90 in trunk/NEMO/OPA_SRC/DYN – NEMO

source: trunk/NEMO/OPA_SRC/DYN/dynzdf.F90 @ 719

Last change on this file since 719 was 719, checked in by ctlod, 17 years ago

get back to the nemo_v2_3 version for trunk

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 7.2 KB
Line 
1MODULE dynzdf
2   !!==============================================================================
3   !!                 ***  MODULE  dynzdf  ***
4   !! Ocean dynamics :  vertical component of the momentum mixing trend
5   !!==============================================================================
6   !! History :  9.0  !  05-11  (G. Madec)  Original code
7   !!----------------------------------------------------------------------
8
9   !!----------------------------------------------------------------------
10   !!   dyn_zdf      : Update the momentum trend with the vertical diffusion
11   !!       zdf_ctl  : initializations of the vertical diffusion scheme
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 dynzdf_exp      ! vertical diffusion: explicit (dyn_zdf_exp     routine)
18   USE dynzdf_imp      ! vertical diffusion: implicit (dyn_zdf_imp     routine)
19   USE dynzdf_imp_jki  ! vertical diffusion  implicit (dyn_zdf_imp_jki routine)
20
21   USE ldfdyn_oce      ! ocean dynamics: lateral physics
22   USE trdmod          ! ocean active dynamics and 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   dyn_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) ::   r2dt                  ! 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: /home/opalod/NEMOCVSROOT/NEMO/OPA_SRC/DYN/dynzdf.F90,v 1.3 2007/06/05 11:00:28 opalod Exp $
45   !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt)
46   !!----------------------------------------------------------------------
47
48CONTAINS
49   
50   SUBROUTINE dyn_zdf( kt )
51      !!----------------------------------------------------------------------
52      !!                  ***  ROUTINE dyn_zdf  ***
53      !!
54      !! ** Purpose :   compute the vertical ocean dynamics physics.
55      !!---------------------------------------------------------------------
56      INTEGER, INTENT( in ) ::   kt      ! ocean time-step index
57      !!
58      REAL(wp), DIMENSION(jpi,jpj,jpk) ::   ztrdu, ztrdv   ! 3D workspace
59      !!---------------------------------------------------------------------
60
61      IF( kt == nit000 )   CALL zdf_ctl          ! initialisation & control of options
62
63      !                                          ! set time step
64      IF( neuler == 0 .AND. kt == nit000    ) THEN   ;   r2dt =      rdt      ! = rdtra (restarting with Euler time stepping)
65      ELSEIF(               kt <= nit000 + 1) THEN   ;   r2dt = 2. * rdt      ! = 2 rdttra (leapfrog)
66      ENDIF
67
68      IF( l_trddyn )   THEN                      ! temporary save of ta and sa trends
69         ztrdu(:,:,:) = ua(:,:,:)
70         ztrdv(:,:,:) = va(:,:,:)
71      ENDIF
72
73      SELECT CASE ( nzdf )                       ! compute lateral mixing trend and add it to the general trend
74      !
75      CASE ( 0 )   ;   CALL dyn_zdf_exp    ( kt, r2dt )      ! explicit scheme
76      CASE ( 1 )   ;   CALL dyn_zdf_imp    ( kt, r2dt )      ! implicit scheme (k-j-i loop)
77      CASE ( 2 )   ;   CALL dyn_zdf_imp_jki( kt, r2dt )      ! implicit scheme (j-k-i loop)
78      !
79      CASE ( -1 )                                      ! esopa: test all possibility with control print
80                       CALL dyn_zdf_exp    ( kt, r2dt )
81                       CALL prt_ctl( tab3d_1=ua, clinfo1=' zdf0 - Ua: ', mask1=umask,               &
82            &                        tab3d_2=va, clinfo2=       ' Va: ', mask2=vmask, clinfo3='dyn' )
83                       CALL dyn_zdf_imp    ( kt, r2dt )
84                       CALL prt_ctl( tab3d_1=ua, clinfo1=' zdf1 - Ua: ', mask1=umask,               &
85            &                        tab3d_2=va, clinfo2=       ' Va: ', mask2=vmask, clinfo3='dyn' )
86                       CALL dyn_zdf_imp_jki( kt, r2dt )
87                       CALL prt_ctl( tab3d_1=ua, clinfo1=' zdf2 - Ua: ', mask1=umask,               &
88            &                        tab3d_2=va, clinfo2=       ' Va: ', mask2=vmask, clinfo3='dyn' )
89      END SELECT
90
91      IF( l_trddyn )   THEN                      ! save the vertical diffusive trends for further diagnostics
92         ztrdu(:,:,:) = ua(:,:,:) - ztrdu(:,:,:)
93         ztrdv(:,:,:) = va(:,:,:) - ztrdv(:,:,:)
94         CALL trd_mod( ztrdu, ztrdv, jpdyn_trd_zdf, 'DYN', kt )
95      ENDIF
96      !                                          ! print mean trends (used for debugging)
97      IF(ln_ctl)   CALL prt_ctl( tab3d_1=ua, clinfo1=' zdf  - Ua: ', mask1=umask,               &
98            &                    tab3d_2=va, clinfo2=       ' Va: ', mask2=vmask, clinfo3='dyn' )
99      !
100   END SUBROUTINE dyn_zdf
101
102
103   SUBROUTINE zdf_ctl
104      !!----------------------------------------------------------------------
105      !!                 ***  ROUTINE zdf_ctl  ***
106      !!
107      !! ** Purpose :   initializations of the vertical diffusion scheme
108      !!
109      !! ** Method  :   implicit (euler backward) scheme (default)
110      !!                explicit (time-splitting) scheme if ln_zdfexp=T
111      !!                OpenMP / NEC autotasking: use j-k-i loops
112      !!----------------------------------------------------------------------
113      USE zdftke
114      USE zdfkpp
115      !!----------------------------------------------------------------------
116
117      ! Choice from ln_zdfexp read in namelist in zdfini
118      IF( ln_zdfexp ) THEN   ;   nzdf = 0           ! use explicit scheme
119      ELSE                   ;   nzdf = 1           ! use implicit scheme
120      ENDIF
121
122      ! Force implicit schemes
123      IF( lk_zdftke .OR. lk_zdfkpp   )   nzdf = 1   ! TKE or KPP physics
124      IF( ln_dynldf_iso              )   nzdf = 1   ! iso-neutral lateral physics
125      IF( ln_dynldf_hor .AND. ln_sco )   nzdf = 1   ! horizontal lateral physics in s-coordinate
126
127      ! OpenMP / NEC autotasking
128#if defined key_mpp_omp
129      IF( nzdf == 1 )   nzdf = 2                    ! j-k-i loop
130#endif
131
132      IF( lk_esopa )    nzdf = -1                   ! Esopa key: All schemes used
133
134      IF(lwp) THEN                                  ! Print the choice
135         WRITE(numout,*)
136         WRITE(numout,*) 'dyn:zdf_ctl : vertical dynamics physics scheme'
137         WRITE(numout,*) '~~~~~~~~~~~'
138         IF( nzdf == -1 )   WRITE(numout,*) '              ESOPA test All scheme used'
139         IF( nzdf ==  0 )   WRITE(numout,*) '              Explicit time-splitting scheme'
140         IF( nzdf ==  1 )   WRITE(numout,*) '              Implicit (euler backward) scheme'
141         IF( nzdf ==  2 )   WRITE(numout,*) '              Implicit (euler backward) scheme with j-k-i loops'
142      ENDIF
143      !
144   END SUBROUTINE zdf_ctl
145
146   !!==============================================================================
147END MODULE dynzdf
Note: See TracBrowser for help on using the repository browser.