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/test_moci_test_suite_namelist_read/NEMOGCM/NEMO/OPA_SRC/ZDF – NEMO

source: branches/UKMO/test_moci_test_suite_namelist_read/NEMOGCM/NEMO/OPA_SRC/ZDF/zdfini.F90 @ 9366

Last change on this file since 9366 was 9366, checked in by andmirek, 6 years ago

#2050 first version. Compiled OK in moci test suite

File size: 10.3 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   USE iom_def, ONLY : lxios_read
32
33   IMPLICIT NONE
34   PRIVATE
35
36   PUBLIC   zdf_init   ! routine called by opa.F90
37   PRIVATE  zdf_namelist
38   
39   !!----------------------------------------------------------------------
40   !! NEMO/OPA 4.0 , NEMO Consortium (2011)
41   !! $Id$
42   !! Software governed by the CeCILL licence     (NEMOGCM/NEMO_CeCILL.txt)
43   !!----------------------------------------------------------------------
44CONTAINS
45
46   SUBROUTINE zdf_init
47      !!----------------------------------------------------------------------
48      !!                  ***  ROUTINE zdf_init  ***
49      !!
50      !! ** Purpose :   initializations of the vertical ocean physics
51      !!
52      !! ** Method  :   Read namelist namzdf, control logicals
53      !!----------------------------------------------------------------------
54      INTEGER ::   ioptio       ! temporary scalar
55      INTEGER ::   ios
56      !!
57      NAMELIST/namzdf/ rn_avm0, rn_avt0, nn_avb, nn_havtb, ln_zdfexp, nn_zdfexp,   &
58         &              ln_zdfevd, nn_evdm, rn_avevd, ln_zdfnpc, nn_npc, nn_npcp
59      !!----------------------------------------------------------------------
60      IF(lwm) THEN
61         REWIND( numnam_ref )              ! Namelist namzdf in reference namelist : Vertical mixing parameters
62         READ  ( numnam_ref, namzdf, IOSTAT = ios, ERR = 901)
63901      IF( ios /= 0 ) CALL ctl_nam ( ios , 'namzdf in reference namelist', lwm )
64         REWIND( numnam_cfg )              ! Namelist namzdf in reference namelist : Vertical mixing parameters
65         READ  ( numnam_cfg, namzdf, IOSTAT = ios, ERR = 902 )
66902      IF( ios /= 0 ) CALL ctl_nam ( ios , 'namzdf in configuration namelist', lwm )
67      ENDIF
68
69      IF(lwm) WRITE ( numond, namzdf )
70
71      CALL zdf_namelist() 
72
73      IF(lwp) THEN               !* Parameter print
74         WRITE(numout,*)
75         WRITE(numout,*) 'zdf_init: vertical physics'
76         WRITE(numout,*) '~~~~~~~~'
77         WRITE(numout,*) '   Namelist namzdf : set vertical mixing mixing parameters'
78         WRITE(numout,*) '      vertical eddy viscosity             rn_avm0   = ', rn_avm0
79         WRITE(numout,*) '      vertical eddy diffusivity           rn_avt0   = ', rn_avt0
80         WRITE(numout,*) '      constant background or profile      nn_avb    = ', nn_avb
81         WRITE(numout,*) '      horizontal variation for avtb       nn_havtb  = ', nn_havtb
82         WRITE(numout,*) '      time splitting / backward scheme    ln_zdfexp = ', ln_zdfexp
83         WRITE(numout,*) '      number of time step                 nn_zdfexp = ', nn_zdfexp
84         WRITE(numout,*) '      enhanced vertical diffusion         ln_zdfevd = ', ln_zdfevd
85         WRITE(numout,*) '         applied on momentum (=1/0)       nn_evdm   = ', nn_evdm
86         WRITE(numout,*) '      vertical coefficient for evd        rn_avevd  = ', rn_avevd
87         WRITE(numout,*) '      non-penetrative convection (npc)    ln_zdfnpc = ', ln_zdfnpc
88         WRITE(numout,*) '      npc call  frequency                 nn_npc    = ', nn_npc
89         WRITE(numout,*) '      npc print frequency                 nn_npcp   = ', nn_npcp
90      ENDIF
91
92      !                          !* Parameter & logical controls
93      !                          !  ----------------------------
94      !
95      !                               ! ... check of vertical mixing scheme on tracers
96      !                                              ==> will be done in trazdf module
97      !
98      !                               ! ... check of mixing coefficient
99      IF(lwp) WRITE(numout,*)
100      IF(lwp) WRITE(numout,*) '   vertical mixing option :'
101      ioptio = 0
102      IF( lk_zdfcst ) THEN
103         IF(lwp) WRITE(numout,*) '      constant eddy diffusion coefficients'
104         ioptio = ioptio+1
105      ENDIF
106      IF( lk_zdfric ) THEN
107         IF(lwp) WRITE(numout,*) '      Richardson dependent eddy coefficients'
108         ioptio = ioptio+1
109      ENDIF
110      IF( lk_zdftke ) THEN
111         IF(lwp) WRITE(numout,*) '      TKE dependent eddy coefficients'
112         ioptio = ioptio+1
113      ENDIF
114      IF( lk_zdfgls ) THEN
115         IF(lwp) WRITE(numout,*) '      GLS dependent eddy coefficients'
116         ioptio = ioptio+1
117      ENDIF
118      IF( lk_zdfkpp ) THEN
119         IF(lwp) WRITE(numout,*) '      KPP dependent eddy coefficients'
120         ioptio = ioptio+1
121      ENDIF
122      IF( ioptio == 0 .OR. ioptio > 1 .AND. .NOT. lk_esopa )   &
123         &   CALL ctl_stop( ' one and only one vertical diffusion option has to be defined ' )
124      IF( ( lk_zdfric .OR. lk_zdfgls .OR. lk_zdfkpp ) .AND. ln_isfcav )   &
125         &   CALL ctl_stop( ' only zdfcst and zdftke were tested with ice shelves cavities ' )
126      !
127      !                               ! ... Convection
128      IF(lwp) WRITE(numout,*)
129      IF(lwp) WRITE(numout,*) '   convection :'
130      !
131#if defined key_top
132      IF( ln_zdfnpc )   CALL ctl_stop( ' zdf_init: npc scheme is not working with key_top' )
133#endif
134      !
135      ioptio = 0
136      IF( ln_zdfnpc ) THEN
137         IF(lwp) WRITE(numout,*) '      use non penetrative convective scheme'
138         ioptio = ioptio+1
139      ENDIF
140      IF( ln_zdfevd ) THEN
141         IF(lwp) WRITE(numout,*) '      use enhanced vertical dif. scheme'
142         ioptio = ioptio+1
143      ENDIF
144      IF( lk_zdftke ) THEN
145         IF(lwp) WRITE(numout,*) '      use the 1.5 turbulent closure'
146      ENDIF
147      IF( lk_zdfgls ) THEN
148         IF(lwp) WRITE(numout,*) '      use the GLS closure scheme'
149      ENDIF
150      IF( lk_zdfkpp ) THEN
151         IF(lwp) WRITE(numout,*) '      use the KPP closure scheme'
152         IF(lk_mpp) THEN
153            IF(lwp) WRITE(numout,cform_err)
154            IF(lwp) WRITE(numout,*) 'The KPP scheme is not ready to run in MPI'
155         ENDIF
156      ENDIF
157      IF ( ioptio > 1 .AND. .NOT. lk_esopa )   CALL ctl_stop( ' chose between ln_zdfnpc and ln_zdfevd' )
158      IF( ioptio == 0 .AND. .NOT.( lk_zdftke .OR. lk_zdfgls .OR. lk_zdfkpp ) )           &
159         CALL ctl_stop( ' except for TKE, GLS or KPP physics, a convection scheme is',   &
160         &              ' required: ln_zdfevd or ln_zdfnpc logicals' )
161
162      !                               !* Background eddy viscosity and diffusivity profil
163      IF( nn_avb == 0 ) THEN                ! Define avmb, avtb from namelist parameter
164         avmb(:) = rn_avm0
165         avtb(:) = rn_avt0                     
166      ELSE                                  ! Background profile of avt (fit a theoretical/observational profile (Krauss 1990)
167         avmb(:) = rn_avm0
168         avtb(:) = rn_avt0 + ( 3.e-4_wp - 2._wp * rn_avt0 ) * 1.e-4_wp * gdepw_1d(:)   ! m2/s
169         IF(ln_sco .AND. lwp)   CALL ctl_warn( 'avtb profile not valid in sco' )
170      ENDIF
171      !
172      IF( ln_rstart ) THEN                  !  Read avmb, avtb in restart (if exist)
173         ! if ln_traadv_cen, avmb, avtb have been modified in traadv_cen2 module.
174         ! To ensure the restartability, avmb & avtb are written in the restart
175         ! file in traadv_cen2 end read here.
176         IF( iom_varid( numror, 'avmb', ldstop = .FALSE. ) > 0 ) THEN
177            CALL iom_get( numror, jpdom_unknown, 'avmb', avmb, lrxios = lxios_read )
178            CALL iom_get( numror, jpdom_unknown, 'avtb', avtb, lrxios = lxios_read )
179         ENDIF
180      ENDIF
181      !                                     ! 2D shape of the avtb
182      avtb_2d(:,:) = 1.e0                        ! uniform
183      !
184      IF( nn_havtb == 1 ) THEN                   ! decrease avtb in the equatorial band
185           !  -15S -5S : linear decrease from avt0 to avt0/10.
186           !  -5S  +5N : cst value avt0/10.
187           !   5N  15N : linear increase from avt0/10, to avt0
188           WHERE(-15. <= gphit .AND. gphit < -5 )   avtb_2d = (1.  - 0.09 * (gphit + 15.))
189           WHERE( -5. <= gphit .AND. gphit <  5 )   avtb_2d =  0.1
190           WHERE(  5. <= gphit .AND. gphit < 15 )   avtb_2d = (0.1 + 0.09 * (gphit -  5.))
191      ENDIF
192      !
193   END SUBROUTINE zdf_init
194
195   SUBROUTINE zdf_namelist()
196     !!---------------------------------------------------------------------
197     !!                   ***  ROUTINE zdf_namelist  ***
198     !!                     
199     !! ** Purpose :   Broadcast namelist variables read by procesor lwp
200     !!
201     !! ** Method  :   use lib_mpp
202     !!----------------------------------------------------------------------
203#if defined key_mpp_mpi
204      CALL mpp_bcast(rn_avm0)
205      CALL mpp_bcast(rn_avt0)
206      CALL mpp_bcast(nn_avb)
207      CALL mpp_bcast(nn_havtb)
208      CALL mpp_bcast(ln_zdfexp)
209      CALL mpp_bcast(nn_zdfexp)
210      CALL mpp_bcast(ln_zdfevd)
211      CALL mpp_bcast(nn_evdm)
212      CALL mpp_bcast(rn_avevd)
213      CALL mpp_bcast(ln_zdfnpc)
214      CALL mpp_bcast(nn_npc)
215      CALL mpp_bcast(nn_npcp)
216#endif
217   END SUBROUTINE zdf_namelist
218
219   !!======================================================================
220END MODULE zdfini
Note: See TracBrowser for help on using the repository browser.