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/2011/DEV_r2739_STFC_dCSE/NEMOGCM/NEMO/OPA_SRC/DYN – NEMO

source: branches/2011/DEV_r2739_STFC_dCSE/NEMOGCM/NEMO/OPA_SRC/DYN/dynzdf.F90 @ 4460

Last change on this file since 4460 was 3211, checked in by spickles2, 12 years ago

Stephen Pickles, 11 Dec 2011

Commit to bring the rest of the DCSE NEMO development branch
in line with the latest development version. This includes
array index re-ordering of all OPA_SRC/.

  • Property svn:keywords set to Id
File size: 7.1 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 lib_mpp         ! MPP library
26   USE prtctl          ! Print control
27
28   IMPLICIT NONE
29   PRIVATE
30
31   PUBLIC   dyn_zdf       !  routine called by step.F90
32   PUBLIC   dyn_zdf_init  !  routine called by opa.F90
33
34   INTEGER  ::   nzdf = 0   ! type vertical diffusion algorithm used, defined from ln_zdf... namlist logicals
35   REAL(wp) ::   r2dt       ! time-step, = 2 rdttra except at nit000 (=rdttra) if neuler=0
36
37   !! * Control permutation of array indices
38#  include "oce_ftrans.h90"
39#  include "dom_oce_ftrans.h90"
40#  include "zdf_oce_ftrans.h90"
41#  include "ldfdyn_oce_ftrans.h90"
42
43   !! * Substitutions
44#  include "domzgr_substitute.h90"
45#  include "zdfddm_substitute.h90"
46#  include "vectopt_loop_substitute.h90"
47   !!----------------------------------------------------------------------
48   !! NEMO/OPA 3.3 , NEMO Consortium (2010)
49   !! $Id$
50   !! Software governed by the CeCILL licence (NEMOGCM/NEMO_CeCILL.txt)
51   !!----------------------------------------------------------------------
52
53CONTAINS
54   
55   SUBROUTINE dyn_zdf( kt )
56      !!----------------------------------------------------------------------
57      !!                  ***  ROUTINE dyn_zdf  ***
58      !!
59      !! ** Purpose :   compute the vertical ocean dynamics physics.
60      !!---------------------------------------------------------------------
61      USE wrk_nemo, ONLY:   wrk_in_use, wrk_not_released
62      USE wrk_nemo, ONLY:   ztrdu => wrk_3d_1 , ztrdv => wrk_3d_2    ! 3D workspace
63      !! DCSE_NEMO: need additional directives for renamed module variables
64!FTRANS ztrdu :I :I :z
65!FTRANS ztrdv :I :I :z
66      !!
67      INTEGER, INTENT( in ) ::   kt      ! ocean time-step index
68      !!---------------------------------------------------------------------
69
70      IF( wrk_in_use(3, 1,2) ) THEN
71         CALL ctl_stop('dyn_zdf: requested workspace arrays unavailable')   ;   RETURN
72      END IF
73      !                                          ! set time step
74      IF( neuler == 0 .AND. kt == nit000     ) THEN   ;   r2dt =      rdt   ! = rdtra (restart with Euler time stepping)
75      ELSEIF(               kt <= nit000 + 1 ) THEN   ;   r2dt = 2. * rdt   ! = 2 rdttra (leapfrog)
76      ENDIF
77
78      IF( l_trddyn )   THEN                      ! temporary save of ta and sa trends
79         ztrdu(:,:,:) = ua(:,:,:)
80         ztrdv(:,:,:) = va(:,:,:)
81      ENDIF
82
83      SELECT CASE ( nzdf )                       ! compute lateral mixing trend and add it to the general trend
84      !
85      CASE ( 0 )   ;   CALL dyn_zdf_exp( kt, r2dt )      ! explicit scheme
86      CASE ( 1 )   ;   CALL dyn_zdf_imp( kt, r2dt )      ! implicit scheme
87      !
88      CASE ( -1 )                                        ! esopa: test all possibility with control print
89                       CALL dyn_zdf_exp( kt, r2dt )
90                       CALL prt_ctl( tab3d_1=ua, clinfo1=' zdf0 - Ua: ', mask1=umask,               &
91                          &          tab3d_2=va, clinfo2=       ' Va: ', mask2=vmask, clinfo3='dyn' )
92                       CALL dyn_zdf_imp( kt, r2dt )
93                       CALL prt_ctl( tab3d_1=ua, clinfo1=' zdf1 - Ua: ', mask1=umask,               &
94                          &          tab3d_2=va, clinfo2=       ' Va: ', mask2=vmask, clinfo3='dyn' )
95      END SELECT
96
97      IF( l_trddyn )   THEN                      ! save the vertical diffusive trends for further diagnostics
98         ztrdu(:,:,:) = ua(:,:,:) - ztrdu(:,:,:)
99         ztrdv(:,:,:) = va(:,:,:) - ztrdv(:,:,:)
100         CALL trd_mod( ztrdu, ztrdv, jpdyn_trd_zdf, 'DYN', kt )
101      ENDIF
102      !                                          ! print mean trends (used for debugging)
103      IF(ln_ctl)   CALL prt_ctl( tab3d_1=ua, clinfo1=' zdf  - Ua: ', mask1=umask,               &
104            &                    tab3d_2=va, clinfo2=       ' Va: ', mask2=vmask, clinfo3='dyn' )
105      !
106      IF( wrk_not_released(3, 1,2) )   CALL ctl_stop('dyn_zdf: failed to release workspace arrays')
107      !
108   END SUBROUTINE dyn_zdf
109
110
111   SUBROUTINE dyn_zdf_init
112      !!----------------------------------------------------------------------
113      !!                 ***  ROUTINE dyn_zdf_init  ***
114      !!
115      !! ** Purpose :   initializations of the vertical diffusion scheme
116      !!
117      !! ** Method  :   implicit (euler backward) scheme (default)
118      !!                explicit (time-splitting) scheme if ln_zdfexp=T
119      !!----------------------------------------------------------------------
120      USE zdftke
121      USE zdfgls
122      USE zdfkpp
123#  include "zdftke_ftrans.h90"
124      !!----------------------------------------------------------------------
125      !
126      ! Choice from ln_zdfexp read in namelist in zdfini
127      IF( ln_zdfexp ) THEN   ;   nzdf = 0           ! use explicit scheme
128      ELSE                   ;   nzdf = 1           ! use implicit scheme
129      ENDIF
130      !
131      ! Force implicit schemes
132      IF( lk_zdftke .OR. lk_zdfgls .OR. lk_zdfkpp )   nzdf = 1   ! TKE, GLS or KPP physics
133      IF( ln_dynldf_iso                           )   nzdf = 1   ! iso-neutral lateral physics
134      IF( ln_dynldf_hor .AND. ln_sco              )   nzdf = 1   ! horizontal lateral physics in s-coordinate
135      !
136      IF( lk_esopa )    nzdf = -1                   ! Esopa key: All schemes used
137      !
138      IF(lwp) THEN                                  ! Print the choice
139         WRITE(numout,*)
140         WRITE(numout,*) 'dyn_zdf_init : vertical dynamics physics scheme'
141         WRITE(numout,*) '~~~~~~~~~~~'
142         IF( nzdf == -1 )   WRITE(numout,*) '              ESOPA test All scheme used'
143         IF( nzdf ==  0 )   WRITE(numout,*) '              Explicit time-splitting scheme'
144         IF( nzdf ==  1 )   WRITE(numout,*) '              Implicit (euler backward) scheme'
145      ENDIF
146      !
147   END SUBROUTINE dyn_zdf_init
148
149   !!==============================================================================
150END MODULE dynzdf
Note: See TracBrowser for help on using the repository browser.