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 branches/dev_r2586_dynamic_mem/NEMOGCM/NEMO/OPA_SRC/DYN – NEMO

source: branches/dev_r2586_dynamic_mem/NEMOGCM/NEMO/OPA_SRC/DYN/dynzdf.F90 @ 2633

Last change on this file since 2633 was 2633, checked in by trackstand2, 13 years ago

Renamed wrk_use => wrk_in_use and wrk_release => wrk_not_released

  • Property svn:keywords set to Id
File size: 6.8 KB
Line 
1MODULE dynzdf
2   !!==============================================================================
3   !!                 ***  MODULE  dynzdf  ***
4   !! Ocean dynamics :  vertical component of the momentum mixing trend
5   !!==============================================================================
6   !! History :  1.0  !  2005-11  (G. Madec)  Original code
7   !!            3.3  !  2010-10  (C. Ethe, G. Madec) reorganisation of initialisation phase
8   !!----------------------------------------------------------------------
9
10   !!----------------------------------------------------------------------
11   !!   dyn_zdf      : Update the momentum trend with the vertical diffusion
12   !!   dyn_zdf_init : initializations of the vertical diffusion scheme
13   !!----------------------------------------------------------------------
14   USE oce             ! ocean dynamics and tracers variables
15   USE dom_oce         ! ocean space and time domain variables
16   USE zdf_oce         ! ocean vertical physics variables
17
18   USE dynzdf_exp      ! vertical diffusion: explicit (dyn_zdf_exp     routine)
19   USE dynzdf_imp      ! vertical diffusion: implicit (dyn_zdf_imp     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   PUBLIC   dyn_zdf_init  !  routine called by opa.F90
32
33   INTEGER  ::   nzdf = 0   ! type vertical diffusion algorithm used, defined from ln_zdf... namlist logicals
34   REAL(wp) ::   r2dt       ! time-step, = 2 rdttra except at nit000 (=rdttra) if neuler=0
35
36   !! * Substitutions
37#  include "domzgr_substitute.h90"
38#  include "zdfddm_substitute.h90"
39#  include "vectopt_loop_substitute.h90"
40   !!----------------------------------------------------------------------
41   !! NEMO/OPA 3.3 , NEMO Consortium (2010)
42   !! $Id$
43   !! Software governed by the CeCILL licence (NEMOGCM/NEMO_CeCILL.txt)
44   !!----------------------------------------------------------------------
45
46CONTAINS
47   
48   SUBROUTINE dyn_zdf( kt )
49      !!----------------------------------------------------------------------
50      !!                  ***  ROUTINE dyn_zdf  ***
51      !!
52      !! ** Purpose :   compute the vertical ocean dynamics physics.
53      !!---------------------------------------------------------------------
54      USE wrk_nemo, ONLY: wrk_in_use, wrk_not_released
55      USE wrk_nemo, ONLY: ztrdu => wrk_3d_1, ztrdv => wrk_3d_2
56      !!
57      INTEGER, INTENT( in ) ::   kt      ! ocean time-step index
58      !!---------------------------------------------------------------------
59
60      IF(wrk_in_use(3, 1,2))THEN
61         CALL ctl_stop('dyn_zdf: requested workspace arrays unavailable.')
62         RETURN
63      END IF
64      !                                          ! set time step
65      IF( neuler == 0 .AND. kt == nit000     ) THEN   ;   r2dt =      rdt   ! = rdtra (restart with Euler time stepping)
66      ELSEIF(               kt <= nit000 + 1 ) THEN   ;   r2dt = 2. * rdt   ! = 2 rdttra (leapfrog)
67      ENDIF
68
69      IF( l_trddyn )   THEN                      ! temporary save of ta and sa trends
70         ztrdu(:,:,:) = ua(:,:,:)
71         ztrdv(:,:,:) = va(:,:,:)
72      ENDIF
73
74      SELECT CASE ( nzdf )                       ! compute lateral mixing trend and add it to the general trend
75      !
76      CASE ( 0 )   ;   CALL dyn_zdf_exp( kt, r2dt )      ! explicit scheme
77      CASE ( 1 )   ;   CALL dyn_zdf_imp( kt, r2dt )      ! implicit scheme
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      END SELECT
87
88      IF( l_trddyn )   THEN                      ! save the vertical diffusive trends for further diagnostics
89         ztrdu(:,:,:) = ua(:,:,:) - ztrdu(:,:,:)
90         ztrdv(:,:,:) = va(:,:,:) - ztrdv(:,:,:)
91         CALL trd_mod( ztrdu, ztrdv, jpdyn_trd_zdf, 'DYN', kt )
92      ENDIF
93      !                                          ! print mean trends (used for debugging)
94      IF(ln_ctl)   CALL prt_ctl( tab3d_1=ua, clinfo1=' zdf  - Ua: ', mask1=umask,               &
95            &                    tab3d_2=va, clinfo2=       ' Va: ', mask2=vmask, clinfo3='dyn' )
96      !
97      IF(wrk_not_released(3, 1,2))THEN
98         CALL ctl_stop('dyn_zdf: failed to release workspace arrays.')
99      END IF
100      !
101   END SUBROUTINE dyn_zdf
102
103
104   SUBROUTINE dyn_zdf_init
105      !!----------------------------------------------------------------------
106      !!                 ***  ROUTINE dyn_zdf_init  ***
107      !!
108      !! ** Purpose :   initializations of the vertical diffusion scheme
109      !!
110      !! ** Method  :   implicit (euler backward) scheme (default)
111      !!                explicit (time-splitting) scheme if ln_zdfexp=T
112      !!----------------------------------------------------------------------
113      USE zdftke
114      USE zdfgls
115      USE zdfkpp
116      !!----------------------------------------------------------------------
117      !
118      ! Choice from ln_zdfexp read in namelist in zdfini
119      IF( ln_zdfexp ) THEN   ;   nzdf = 0           ! use explicit scheme
120      ELSE                   ;   nzdf = 1           ! use implicit scheme
121      ENDIF
122      !
123      ! Force implicit schemes
124      IF( lk_zdftke .OR. lk_zdfgls .OR. lk_zdfkpp )   nzdf = 1   ! TKE, GLS or KPP physics
125      IF( ln_dynldf_iso                           )   nzdf = 1   ! iso-neutral lateral physics
126      IF( ln_dynldf_hor .AND. ln_sco              )   nzdf = 1   ! horizontal lateral physics in s-coordinate
127      !
128      IF( lk_esopa )    nzdf = -1                   ! Esopa key: All schemes used
129      !
130      IF(lwp) THEN                                  ! Print the choice
131         WRITE(numout,*)
132         WRITE(numout,*) 'dyn_zdf_init : vertical dynamics physics scheme'
133         WRITE(numout,*) '~~~~~~~~~~~'
134         IF( nzdf == -1 )   WRITE(numout,*) '              ESOPA test All scheme used'
135         IF( nzdf ==  0 )   WRITE(numout,*) '              Explicit time-splitting scheme'
136         IF( nzdf ==  1 )   WRITE(numout,*) '              Implicit (euler backward) scheme'
137      ENDIF
138      !
139   END SUBROUTINE dyn_zdf_init
140
141   !!==============================================================================
142END MODULE dynzdf
Note: See TracBrowser for help on using the repository browser.