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 @ 496

Last change on this file since 496 was 456, checked in by opalod, 18 years ago

nemo_v1_update_048:RB: reorganization of dynamics part, add dynhpg_jki.F90 dynldf.F90 dynzdf.F90 dynzdf_imp_jki.F90

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 7.6 KB
Line 
1MODULE dynzdf
2   !!==============================================================================
3   !!                 ***  MODULE  dynzdf  ***
4   !! Ocean dynamics :  vertical component of the momentum mixing trend
5   !!==============================================================================
6   !!----------------------------------------------------------------------
7   !!   dyn_zdf      : Update the momentum trend with the vertical diffusion
8   !!       zdf_ctl  : ???
9   !!----------------------------------------------------------------------
10   !! * Modules used
11   USE oce             ! ocean dynamics and tracers variables
12   USE dom_oce         ! ocean space and time domain variables
13   USE zdf_oce         ! ocean vertical physics variables
14
15   USE dynzdf_exp      ! vertical diffusion: explicit (dyn_zdf_exp     routine)
16   USE dynzdf_imp      ! vertical diffusion: implicit (dyn_zdf_imp     routine)
17   USE dynzdf_imp_jki  ! vertical diffusion  implicit (dyn_zdf_imp_jki routine)
18
19   USE ldfdyn_oce      ! ocean dynamics: lateral physics
20   USE trdmod          ! ocean active dynamics and tracers trends
21   USE trdmod_oce      ! ocean variables trends
22   USE in_out_manager  ! I/O manager
23   USE prtctl          ! Print control
24
25   IMPLICIT NONE
26   PRIVATE
27
28   !! * Routine accessibility
29   PUBLIC dyn_zdf   !  routine called by step.F90
30
31   !! * module variables
32   INTEGER ::                        &
33      nzdf = 0                         ! type vertical diffusion algorithm used
34      !                                ! defined from ln_zdf...  namlist logicals)
35
36   !! * Module variables
37   REAL(wp) ::   &
38      r2dt                          ! time-step, = 2 rdttra except at nit000 (=rdttra) if neuler=0
39
40   !! * Substitutions
41#  include "domzgr_substitute.h90"
42#  include "zdfddm_substitute.h90"
43#  include "vectopt_loop_substitute.h90"
44   !!----------------------------------------------------------------------
45   !!  OPA 9.0 , LOCEAN-IPSL (2005)
46   !!----------------------------------------------------------------------
47
48CONTAINS
49   
50   SUBROUTINE dyn_zdf( kt )
51      !!----------------------------------------------------------------------
52      !!                  ***  ROUTINE dyn_zdf  ***
53      !!
54      !! ** Purpose :   compute the vertical ocean dynamics physics.
55      !! ** Method  :
56      !! ** Action  :
57      !!
58      !! History :
59      !!   9.0  !  05-11  (G. Madec)  Original code
60      !!---------------------------------------------------------------------
61      !! * Arguments
62      INTEGER, INTENT( in ) ::   kt      ! ocean time-step index
63
64      !! * local declarations
65      REAL(wp), DIMENSION(jpi,jpj,jpk) ::   &
66         ztrdu, ztrdv                    ! 3D temporary workspace
67      !!---------------------------------------------------------------------
68
69      IF( kt == nit000 )   CALL zdf_ctl          ! initialisation & control of options
70
71      !                                          ! set time step
72      IF( neuler == 0 .AND. kt == nit000 ) THEN     ! at nit000
73         r2dt =  rdt                                    ! = rdtra (restarting with Euler time stepping)
74      ELSEIF( kt <= nit000 + 1) THEN                ! at nit000 or nit000+1
75         r2dt = 2. * rdt                                ! = 2 rdttra (leapfrog)
76      ENDIF
77
78
79      IF( l_trddyn )   THEN                      ! temporary save of ta and sa trends
80         ztrdu(:,:,:) = ua(:,:,:)
81         ztrdv(:,:,:) = va(:,:,:)
82      ENDIF
83
84      SELECT CASE ( nzdf )                       ! compute lateral mixing trend and add it to the general trend
85      CASE ( -1 )                                       ! esopa: test all possibility with control print
86         CALL dyn_zdf_exp    ( kt )
87         CALL prt_ctl( tab3d_1=ua, clinfo1=' zdf0 - Ua: ', mask1=umask,               &
88            &          tab3d_2=va, clinfo2=       ' Va: ', mask2=vmask, clinfo3='dyn' )
89         CALL dyn_zdf_imp    ( kt )
90         CALL prt_ctl( tab3d_1=ua, clinfo1=' zdf1 - Ua: ', mask1=umask,               &
91            &          tab3d_2=va, clinfo2=       ' Va: ', mask2=vmask, clinfo3='dyn' )
92         CALL dyn_zdf_imp_jki( kt )
93         CALL prt_ctl( tab3d_1=ua, clinfo1=' zdf2 - Ua: ', mask1=umask,               &
94            &          tab3d_2=va, clinfo2=       ' Va: ', mask2=vmask, clinfo3='dyn' )
95
96      CASE ( 0 )                                       ! explicit scheme
97         CALL dyn_zdf_exp    ( kt )
98
99      CASE ( 1 )                                       ! implicit scheme (k-j-i loop)
100         CALL dyn_zdf_imp    ( kt )
101
102      CASE ( 2 )                                       ! implicit scheme (j-k-i loop)
103         CALL dyn_zdf_imp_jki( kt )
104
105      END SELECT
106
107      IF( l_trddyn )   THEN                         ! save the vertical diffusive trends for further diagnostics
108         ztrdu(:,:,:) = ua(:,:,:) - ztrdu(:,:,:)
109         ztrdv(:,:,:) = va(:,:,:) - ztrdv(:,:,:)
110         CALL trd_mod( ztrdu, ztrdv, jpttdzdf, 'DYN', kt )
111      ENDIF
112
113      !                                          ! print mean trends (used for debugging)
114      IF(ln_ctl)   CALL prt_ctl( tab3d_1=ua, clinfo1=' zdf  - Ua: ', mask1=umask,               &
115            &                    tab3d_2=va, clinfo2=       ' Va: ', mask2=vmask, clinfo3='dyn' )
116
117   END SUBROUTINE dyn_zdf
118
119
120   SUBROUTINE zdf_ctl
121      !!----------------------------------------------------------------------
122      !!                 ***  ROUTINE zdf_ctl  ***
123      !!
124      !! ** Purpose :   initializations of the vertical ocean dynamics physics
125      !!
126      !! ** Method  :   implicit (euler backward) scheme (default)
127      !!                explicit (time-splitting) scheme if ln_zdfexp=T
128      !!                OpenMP / NEC autotasking: use j-k-i loops
129      !!
130      !! History :
131      !!   9.0  !  05-11  (G. Madec)  Original code
132      !!----------------------------------------------------------------------
133      !! * Module used
134      USE zdftke
135      USE zdfkpp
136      !!----------------------------------------------------------------------
137
138      !  Define the vertical dynamics physics scheme
139      ! ==========================================
140
141      ! Choice from ln_zdfexp read in namelist in zdfini
142      IF( ln_zdfexp ) THEN               ! use explicit scheme
143         nzdf = 0
144      ELSE                               ! use implicit scheme
145         nzdf = 1
146      ENDIF
147
148      ! Force implicit schemes
149      IF( lk_zdftke .OR. lk_zdfkpp   )   nzdf = 1      ! TKE or KPP physics
150      IF( ln_dynldf_iso              )   nzdf = 1      ! iso-neutral lateral physics
151      IF( ln_dynldf_hor .AND. ln_sco )   nzdf = 1      ! horizontal lateral physics in s-coordinate
152
153      ! OpenMP / NEC autotasking
154#if defined key_mpp_omp
155      IF( nzdf == 1 )   nzdf = 2                       ! j-k-i loop
156#endif
157
158!!bug
159!     IF( ln_dynldf_iso              )   nzdf = 3      ! iso-neutral lateral physics
160!     IF( ln_dynldf_hor .AND. ln_sco )   nzdf = 3      ! horizontal lateral physics in s-coordinate
161!!bug
162      ! Test: esopa
163      IF( lk_esopa )    nzdf = -1                      ! All schemes used
164
165      IF(lwp) THEN
166         WRITE(numout,*)
167         WRITE(numout,*) 'dyn:zdf_ctl : vertical dynamics physics scheme'
168         WRITE(numout,*) '~~~~~~~~~~~'
169         IF( nzdf == -1 )   WRITE(numout,*) '              ESOPA test All scheme used'
170         IF( nzdf ==  0 )   WRITE(numout,*) '              Explicit time-splitting scheme'
171         IF( nzdf ==  1 )   WRITE(numout,*) '              Implicit (euler backward) scheme'
172         IF( nzdf ==  2 )   WRITE(numout,*) '              Implicit (euler backward) scheme with j-k-i loops'
173      ENDIF
174
175   END SUBROUTINE zdf_ctl
176
177   !!==============================================================================
178END MODULE dynzdf
Note: See TracBrowser for help on using the repository browser.