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/2017/dev_r7881_no_wrk_alloc/NEMOGCM/NEMO/OPA_SRC/DYN – NEMO

source: branches/2017/dev_r7881_no_wrk_alloc/NEMOGCM/NEMO/OPA_SRC/DYN/dynzdf.F90 @ 7910

Last change on this file since 7910 was 7910, checked in by timgraham, 7 years ago

All wrk_alloc removed

  • Property svn:keywords set to Id
File size: 5.7 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   USE dynzdf_exp     ! vertical diffusion: explicit (dyn_zdf_exp     routine)
18   USE dynzdf_imp     ! vertical diffusion: implicit (dyn_zdf_imp     routine)
19   USE ldfdyn         ! lateral diffusion: eddy viscosity coef.
20   USE trd_oce        ! trends: ocean variables
21   USE trddyn         ! trend manager: dynamics
22   !
23   USE in_out_manager ! I/O manager
24   USE lib_mpp        ! MPP library
25   USE prtctl         ! Print control
26   USE timing         ! Timing
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
36   !! * Substitutions
37#  include "vectopt_loop_substitute.h90"
38   !!----------------------------------------------------------------------
39   !! NEMO/OPA 3.3 , NEMO Consortium (2010)
40   !! $Id$
41   !! Software governed by the CeCILL licence (NEMOGCM/NEMO_CeCILL.txt)
42   !!----------------------------------------------------------------------
43
44CONTAINS
45   
46   SUBROUTINE dyn_zdf( kt )
47      !!----------------------------------------------------------------------
48      !!                  ***  ROUTINE dyn_zdf  ***
49      !!
50      !! ** Purpose :   compute the vertical ocean dynamics physics.
51      !!---------------------------------------------------------------------
52      !!
53      INTEGER, INTENT( in ) ::   kt      ! ocean time-step index
54      !
55      REAL(wp), DIMENSION(jpi,jpj,jpk) ::  ztrdu, ztrdv
56      !!---------------------------------------------------------------------
57      !
58      IF( nn_timing == 1 )   CALL timing_start('dyn_zdf')
59      !
60      !                                          ! set time step
61      IF( neuler == 0 .AND. kt == nit000     ) THEN   ;   r2dt =      rdt   ! = rdt (restart with Euler time stepping)
62      ELSEIF(               kt <= nit000 + 1 ) THEN   ;   r2dt = 2. * rdt   ! = 2 rdt (leapfrog)
63      ENDIF
64
65      IF( l_trddyn )   THEN                      ! temporary save of ta and sa trends
66         ztrdu(:,:,:) = ua(:,:,:)
67         ztrdv(:,:,:) = va(:,:,:)
68      ENDIF
69
70      SELECT CASE ( nzdf )                       ! compute lateral mixing trend and add it to the general trend
71      !
72      CASE ( 0 )   ;   CALL dyn_zdf_exp( kt, r2dt )      ! explicit scheme
73      CASE ( 1 )   ;   CALL dyn_zdf_imp( kt, r2dt )      ! implicit scheme
74      !
75      END SELECT
76
77      IF( l_trddyn )   THEN                      ! save the vertical diffusive trends for further diagnostics
78         ztrdu(:,:,:) = ( ua(:,:,:) - ub(:,:,:) ) / r2dt - ztrdu(:,:,:)
79         ztrdv(:,:,:) = ( va(:,:,:) - vb(:,:,:) ) / r2dt - ztrdv(:,:,:)
80         CALL trd_dyn( ztrdu, ztrdv, jpdyn_zdf, kt )
81      ENDIF
82      !                                          ! print mean trends (used for debugging)
83      IF(ln_ctl)   CALL prt_ctl( tab3d_1=ua, clinfo1=' zdf  - Ua: ', mask1=umask,               &
84         &                       tab3d_2=va, clinfo2=       ' Va: ', mask2=vmask, clinfo3='dyn' )
85         !
86      IF( nn_timing == 1 )   CALL timing_stop('dyn_zdf')
87      !
88   END SUBROUTINE dyn_zdf
89
90
91   SUBROUTINE dyn_zdf_init
92      !!----------------------------------------------------------------------
93      !!                 ***  ROUTINE dyn_zdf_init  ***
94      !!
95      !! ** Purpose :   initializations of the vertical diffusion scheme
96      !!
97      !! ** Method  :   implicit (euler backward) scheme (default)
98      !!                explicit (time-splitting) scheme if ln_zdfexp=T
99      !!----------------------------------------------------------------------
100      USE zdftke
101      USE zdfgls
102      !!----------------------------------------------------------------------
103      !
104      ! Choice from ln_zdfexp read in namelist in zdfini
105      IF( ln_zdfexp ) THEN   ;   nzdf = 0           ! use explicit scheme
106      ELSE                   ;   nzdf = 1           ! use implicit scheme
107      ENDIF
108      !
109      ! Force implicit schemes
110      IF( lk_zdftke .OR. lk_zdfgls   )   nzdf = 1   ! TKE or GLS physics
111      IF( ln_dynldf_iso              )   nzdf = 1   ! iso-neutral lateral physics
112      IF( ln_dynldf_hor .AND. ln_sco )   nzdf = 1   ! horizontal lateral physics in s-coordinate
113      !
114      IF(lwp) THEN                                  ! Print the choice
115         WRITE(numout,*)
116         WRITE(numout,*) 'dyn_zdf_init : vertical dynamics physics scheme'
117         WRITE(numout,*) '~~~~~~~~~~~'
118         IF( nzdf ==  0 )   WRITE(numout,*) '      ===>>   Explicit time-splitting scheme'
119         IF( nzdf ==  1 )   WRITE(numout,*) '      ===>>   Implicit (euler backward) scheme'
120      ENDIF
121      !
122   END SUBROUTINE dyn_zdf_init
123
124   !!==============================================================================
125END MODULE dynzdf
Note: See TracBrowser for help on using the repository browser.