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/UKMO/r5936_hadgem3_cplseq/NEMOGCM/NEMO/OPA_SRC/DYN – NEMO

source: branches/UKMO/r5936_hadgem3_cplseq/NEMOGCM/NEMO/OPA_SRC/DYN/dynzdf.F90 @ 7131

Last change on this file since 7131 was 7131, checked in by jcastill, 7 years ago

Remove svn keywords

File size: 6.0 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 wrk_nemo       ! Memory Allocation
27   USE timing         ! Timing
28
29   IMPLICIT NONE
30   PRIVATE
31
32   PUBLIC   dyn_zdf       !  routine called by step.F90
33   PUBLIC   dyn_zdf_init  !  routine called by opa.F90
34
35   INTEGER  ::   nzdf = 0   ! type vertical diffusion algorithm used, defined from ln_zdf... namlist logicals
36   REAL(wp) ::   r2dt       ! time-step, = 2 rdttra 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   !! NEMO/OPA 3.3 , NEMO Consortium (2010)
44   !! $Id$
45   !! Software governed by the CeCILL licence (NEMOGCM/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      !!
57      INTEGER, INTENT( in ) ::   kt      ! ocean time-step index
58      !
59      REAL(wp), POINTER, DIMENSION(:,:,:) ::  ztrdu, ztrdv
60      !!---------------------------------------------------------------------
61      !
62      IF( nn_timing == 1 )   CALL timing_start('dyn_zdf')
63      !
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         CALL wrk_alloc( jpi, jpj, jpk, ztrdu, ztrdv ) 
71         ztrdu(:,:,:) = ua(:,:,:)
72         ztrdv(:,:,:) = va(:,:,:)
73      ENDIF
74
75      SELECT CASE ( nzdf )                       ! compute lateral mixing trend and add it to the general trend
76      !
77      CASE ( 0 )   ;   CALL dyn_zdf_exp( kt, r2dt )      ! explicit scheme
78      CASE ( 1 )   ;   CALL dyn_zdf_imp( kt, r2dt )      ! implicit scheme
79      !
80      END SELECT
81
82      IF( l_trddyn )   THEN                      ! save the vertical diffusive trends for further diagnostics
83         ztrdu(:,:,:) = ua(:,:,:) - ztrdu(:,:,:)
84         ztrdv(:,:,:) = va(:,:,:) - ztrdv(:,:,:)
85         CALL trd_dyn( ztrdu, ztrdv, jpdyn_zdf, kt )
86         CALL wrk_dealloc( jpi, jpj, jpk, ztrdu, ztrdv ) 
87      ENDIF
88      !                                          ! print mean trends (used for debugging)
89      IF(ln_ctl)   CALL prt_ctl( tab3d_1=ua, clinfo1=' zdf  - Ua: ', mask1=umask,               &
90         &                       tab3d_2=va, clinfo2=       ' Va: ', mask2=vmask, clinfo3='dyn' )
91         !
92      IF( nn_timing == 1 )   CALL timing_stop('dyn_zdf')
93      !
94   END SUBROUTINE dyn_zdf
95
96
97   SUBROUTINE dyn_zdf_init
98      !!----------------------------------------------------------------------
99      !!                 ***  ROUTINE dyn_zdf_init  ***
100      !!
101      !! ** Purpose :   initializations of the vertical diffusion scheme
102      !!
103      !! ** Method  :   implicit (euler backward) scheme (default)
104      !!                explicit (time-splitting) scheme if ln_zdfexp=T
105      !!----------------------------------------------------------------------
106      USE zdftke
107      USE zdfgls
108      !!----------------------------------------------------------------------
109      !
110      ! Choice from ln_zdfexp read in namelist in zdfini
111      IF( ln_zdfexp ) THEN   ;   nzdf = 0           ! use explicit scheme
112      ELSE                   ;   nzdf = 1           ! use implicit scheme
113      ENDIF
114      !
115      ! Force implicit schemes
116      IF( lk_zdftke .OR. lk_zdfgls   )   nzdf = 1   ! TKE or GLS physics
117      IF( ln_dynldf_iso              )   nzdf = 1   ! iso-neutral lateral physics
118      IF( ln_dynldf_hor .AND. ln_sco )   nzdf = 1   ! horizontal lateral physics in s-coordinate
119      !
120      IF(lwp) THEN                                  ! Print the choice
121         WRITE(numout,*)
122         WRITE(numout,*) 'dyn_zdf_init : vertical dynamics physics scheme'
123         WRITE(numout,*) '~~~~~~~~~~~'
124         IF( nzdf ==  0 )   WRITE(numout,*) '              Explicit time-splitting scheme'
125         IF( nzdf ==  1 )   WRITE(numout,*) '              Implicit (euler backward) scheme'
126      ENDIF
127      !
128   END SUBROUTINE dyn_zdf_init
129
130   !!==============================================================================
131END MODULE dynzdf
Note: See TracBrowser for help on using the repository browser.