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.
zdfini.F90 in branches/UKMO/dev_r5518_GO6_under_ice_relax_dr_hook/NEMOGCM/NEMO/OPA_SRC/ZDF – NEMO

source: branches/UKMO/dev_r5518_GO6_under_ice_relax_dr_hook/NEMOGCM/NEMO/OPA_SRC/ZDF/zdfini.F90 @ 11738

Last change on this file since 11738 was 11738, checked in by marc, 5 years ago

The Dr Hook changes from my perl code.

File size: 9.7 KB
Line 
1MODULE zdfini
2   !!======================================================================
3   !!                      ***  MODULE  zdfini  ***
4   !! Ocean physics :   read vertical mixing namelist and check consistancy
5   !!======================================================================
6   !! History :  8.0  ! 1997-06  (G. Madec)  Original code from inimix
7   !!            1.0  ! 2002-08  (G. Madec)  F90 : free form
8   !!             -   ! 2005-06  (C. Ethe) KPP parameterization
9   !!             -   ! 2009-07  (G. Madec) add avmb, avtb in restart for cen2 advection
10   !!----------------------------------------------------------------------
11
12   !!----------------------------------------------------------------------
13   !!   zdf_init    : initialization, namelist read, and parameters control
14   !!----------------------------------------------------------------------
15   USE par_oce         ! mesh and scale factors
16   USE ldftra_oce      ! ocean active tracers: lateral physics
17   USE ldfdyn_oce      ! ocean dynamics lateral physics
18   USE zdf_oce         ! TKE vertical mixing         
19   USE lib_mpp         ! distribued memory computing
20   USE zdftke          ! TKE vertical mixing
21   USE zdfgls          ! GLS vertical mixing
22   USE zdfkpp          ! KPP vertical mixing         
23   USE zdfddm          ! double diffusion mixing     
24   USE zdfevd          ! enhanced vertical diffusion 
25   USE zdfric          ! Richardson vertical mixing   
26   USE tranpc          ! convection: non penetrative adjustment
27   USE ldfslp          ! iso-neutral slopes
28
29   USE in_out_manager  ! I/O manager
30   USE iom             ! IOM library
31
32   USE yomhook, ONLY: lhook, dr_hook
33   USE parkind1, ONLY: jprb, jpim
34
35   IMPLICIT NONE
36   PRIVATE
37
38   PUBLIC   zdf_init   ! routine called by opa.F90
39   
40   !!----------------------------------------------------------------------
41   !! NEMO/OPA 4.0 , NEMO Consortium (2011)
42   !! $Id$
43   !! Software governed by the CeCILL licence     (NEMOGCM/NEMO_CeCILL.txt)
44   !!----------------------------------------------------------------------
45CONTAINS
46
47   SUBROUTINE zdf_init
48      !!----------------------------------------------------------------------
49      !!                  ***  ROUTINE zdf_init  ***
50      !!
51      !! ** Purpose :   initializations of the vertical ocean physics
52      !!
53      !! ** Method  :   Read namelist namzdf, control logicals
54      !!----------------------------------------------------------------------
55      INTEGER ::   ioptio       ! temporary scalar
56      INTEGER ::   ios
57      !!
58      NAMELIST/namzdf/ rn_avm0, rn_avt0, nn_avb, nn_havtb, ln_zdfexp, nn_zdfexp,   &
59         &              ln_zdfevd, nn_evdm, rn_avevd, ln_zdfnpc, nn_npc, nn_npcp
60         INTEGER(KIND=jpim), PARAMETER :: zhook_in = 0
61         INTEGER(KIND=jpim), PARAMETER :: zhook_out = 1
62         REAL(KIND=jprb)               :: zhook_handle
63
64         CHARACTER(LEN=*), PARAMETER :: RoutineName='ZDF_INIT'
65
66         IF (lhook) CALL dr_hook(RoutineName,zhook_in,zhook_handle)
67
68      !!----------------------------------------------------------------------
69
70      REWIND( numnam_ref )              ! Namelist namzdf in reference namelist : Vertical mixing parameters
71      READ  ( numnam_ref, namzdf, IOSTAT = ios, ERR = 901)
72901   IF( ios /= 0 ) CALL ctl_nam ( ios , 'namzdf in reference namelist', lwp )
73
74      REWIND( numnam_cfg )              ! Namelist namzdf in reference namelist : Vertical mixing parameters
75      READ  ( numnam_cfg, namzdf, IOSTAT = ios, ERR = 902 )
76902   IF( ios /= 0 ) CALL ctl_nam ( ios , 'namzdf in configuration namelist', lwp )
77      IF(lwm) WRITE ( numond, namzdf )
78
79      IF(lwp) THEN               !* Parameter print
80         WRITE(numout,*)
81         WRITE(numout,*) 'zdf_init: vertical physics'
82         WRITE(numout,*) '~~~~~~~~'
83         WRITE(numout,*) '   Namelist namzdf : set vertical mixing mixing parameters'
84         WRITE(numout,*) '      vertical eddy viscosity             rn_avm0   = ', rn_avm0
85         WRITE(numout,*) '      vertical eddy diffusivity           rn_avt0   = ', rn_avt0
86         WRITE(numout,*) '      constant background or profile      nn_avb    = ', nn_avb
87         WRITE(numout,*) '      horizontal variation for avtb       nn_havtb  = ', nn_havtb
88         WRITE(numout,*) '      time splitting / backward scheme    ln_zdfexp = ', ln_zdfexp
89         WRITE(numout,*) '      number of time step                 nn_zdfexp = ', nn_zdfexp
90         WRITE(numout,*) '      enhanced vertical diffusion         ln_zdfevd = ', ln_zdfevd
91         WRITE(numout,*) '         applied on momentum (=1/0)       nn_evdm   = ', nn_evdm
92         WRITE(numout,*) '      vertical coefficient for evd        rn_avevd  = ', rn_avevd
93         WRITE(numout,*) '      non-penetrative convection (npc)    ln_zdfnpc = ', ln_zdfnpc
94         WRITE(numout,*) '      npc call  frequency                 nn_npc    = ', nn_npc
95         WRITE(numout,*) '      npc print frequency                 nn_npcp   = ', nn_npcp
96      ENDIF
97
98      !                          !* Parameter & logical controls
99      !                          !  ----------------------------
100      !
101      !                               ! ... check of vertical mixing scheme on tracers
102      !                                              ==> will be done in trazdf module
103      !
104      !                               ! ... check of mixing coefficient
105      IF(lwp) WRITE(numout,*)
106      IF(lwp) WRITE(numout,*) '   vertical mixing option :'
107      ioptio = 0
108      IF( lk_zdfcst ) THEN
109         IF(lwp) WRITE(numout,*) '      constant eddy diffusion coefficients'
110         ioptio = ioptio+1
111      ENDIF
112      IF( lk_zdfric ) THEN
113         IF(lwp) WRITE(numout,*) '      Richardson dependent eddy coefficients'
114         ioptio = ioptio+1
115      ENDIF
116      IF( lk_zdftke ) THEN
117         IF(lwp) WRITE(numout,*) '      TKE dependent eddy coefficients'
118         ioptio = ioptio+1
119      ENDIF
120      IF( lk_zdfgls ) THEN
121         IF(lwp) WRITE(numout,*) '      GLS dependent eddy coefficients'
122         ioptio = ioptio+1
123      ENDIF
124      IF( lk_zdfkpp ) THEN
125         IF(lwp) WRITE(numout,*) '      KPP dependent eddy coefficients'
126         ioptio = ioptio+1
127      ENDIF
128      IF( ioptio == 0 .OR. ioptio > 1 .AND. .NOT. lk_esopa )   &
129         &   CALL ctl_stop( ' one and only one vertical diffusion option has to be defined ' )
130      IF( ( lk_zdfric .OR. lk_zdfgls .OR. lk_zdfkpp ) .AND. ln_isfcav )   &
131         &   CALL ctl_stop( ' only zdfcst and zdftke were tested with ice shelves cavities ' )
132      !
133      !                               ! ... Convection
134      IF(lwp) WRITE(numout,*)
135      IF(lwp) WRITE(numout,*) '   convection :'
136      !
137#if defined key_top
138      IF( ln_zdfnpc )   CALL ctl_stop( ' zdf_init: npc scheme is not working with key_top' )
139#endif
140      !
141      ioptio = 0
142      IF( ln_zdfnpc ) THEN
143         IF(lwp) WRITE(numout,*) '      use non penetrative convective scheme'
144         ioptio = ioptio+1
145      ENDIF
146      IF( ln_zdfevd ) THEN
147         IF(lwp) WRITE(numout,*) '      use enhanced vertical dif. scheme'
148         ioptio = ioptio+1
149      ENDIF
150      IF( lk_zdftke ) THEN
151         IF(lwp) WRITE(numout,*) '      use the 1.5 turbulent closure'
152      ENDIF
153      IF( lk_zdfgls ) THEN
154         IF(lwp) WRITE(numout,*) '      use the GLS closure scheme'
155      ENDIF
156      IF( lk_zdfkpp ) THEN
157         IF(lwp) WRITE(numout,*) '      use the KPP closure scheme'
158         IF(lk_mpp) THEN
159            IF(lwp) WRITE(numout,cform_err)
160            IF(lwp) WRITE(numout,*) 'The KPP scheme is not ready to run in MPI'
161         ENDIF
162      ENDIF
163      IF ( ioptio > 1 .AND. .NOT. lk_esopa )   CALL ctl_stop( ' chose between ln_zdfnpc and ln_zdfevd' )
164      IF( ioptio == 0 .AND. .NOT.( lk_zdftke .OR. lk_zdfgls .OR. lk_zdfkpp ) )           &
165         CALL ctl_stop( ' except for TKE, GLS or KPP physics, a convection scheme is',   &
166         &              ' required: ln_zdfevd or ln_zdfnpc logicals' )
167
168      !                               !* Background eddy viscosity and diffusivity profil
169      IF( nn_avb == 0 ) THEN                ! Define avmb, avtb from namelist parameter
170         avmb(:) = rn_avm0
171         avtb(:) = rn_avt0                     
172      ELSE                                  ! Background profile of avt (fit a theoretical/observational profile (Krauss 1990)
173         avmb(:) = rn_avm0
174         avtb(:) = rn_avt0 + ( 3.e-4_wp - 2._wp * rn_avt0 ) * 1.e-4_wp * gdepw_1d(:)   ! m2/s
175         IF(ln_sco .AND. lwp)   CALL ctl_warn( 'avtb profile not valid in sco' )
176      ENDIF
177      !
178      IF( ln_rstart ) THEN                  !  Read avmb, avtb in restart (if exist)
179         ! if ln_traadv_cen, avmb, avtb have been modified in traadv_cen2 module.
180         ! To ensure the restartability, avmb & avtb are written in the restart
181         ! file in traadv_cen2 end read here.
182         IF( iom_varid( numror, 'avmb', ldstop = .FALSE. ) > 0 ) THEN
183            CALL iom_get( numror, jpdom_unknown, 'avmb', avmb )
184            CALL iom_get( numror, jpdom_unknown, 'avtb', avtb )
185         ENDIF
186      ENDIF
187      !                                     ! 2D shape of the avtb
188      avtb_2d(:,:) = 1.e0                        ! uniform
189      !
190      IF( nn_havtb == 1 ) THEN                   ! decrease avtb in the equatorial band
191           !  -15S -5S : linear decrease from avt0 to avt0/10.
192           !  -5S  +5N : cst value avt0/10.
193           !   5N  15N : linear increase from avt0/10, to avt0
194           WHERE(-15. <= gphit .AND. gphit < -5 )   avtb_2d = (1.  - 0.09 * (gphit + 15.))
195           WHERE( -5. <= gphit .AND. gphit <  5 )   avtb_2d =  0.1
196           WHERE(  5. <= gphit .AND. gphit < 15 )   avtb_2d = (0.1 + 0.09 * (gphit -  5.))
197      ENDIF
198      !
199         IF (lhook) CALL dr_hook(RoutineName,zhook_out,zhook_handle)
200   END SUBROUTINE zdf_init
201
202   !!======================================================================
203END MODULE zdfini
Note: See TracBrowser for help on using the repository browser.