- Timestamp:
- 2017-06-25T12:26:32+02:00 (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2017/dev_r7881_ENHANCE09_RK3/NEMOGCM/NEMO/OPA_SRC/ZDF/zdfric.F90
r7646 r8215 5 5 !! Richardson number dependent formulation 6 6 !!====================================================================== 7 !! History : OPA ! 1987-09 (P. Andrich) Original code 8 !! 4.0 ! 1991-11 (G. Madec) 9 !! 7.0 ! 1996-01 (G. Madec) complete rewriting of multitasking suppression of common work arrays 10 !! 8.0 ! 1997-06 (G. Madec) complete rewriting of zdfmix 11 !! NEMO 1.0 ! 2002-06 (G. Madec) F90: Free form and module 12 !! 3.3 ! 2010-10 (C. Ethe, G. Madec) reorganisation of initialisation phase 13 !! 3.3.1! 2011-09 (P. Oddo) Mixed layer depth parameterization 14 !!---------------------------------------------------------------------- 15 #if defined key_zdfric 16 !!---------------------------------------------------------------------- 17 !! 'key_zdfric' Kz = f(Ri) 18 !!---------------------------------------------------------------------- 19 !! zdf_ric : update momentum and tracer Kz from the Richardson 20 !! number computation 7 !! History : OPA ! 1987-09 (P. Andrich) Original code 8 !! 4.0 ! 1991-11 (G. Madec) 9 !! 7.0 ! 1996-01 (G. Madec) complete rewriting of multitasking suppression of common work arrays 10 !! 8.0 ! 1997-06 (G. Madec) complete rewriting of zdfmix 11 !! NEMO 1.0 ! 2002-06 (G. Madec) F90: Free form and module 12 !! 3.3 ! 2010-10 (C. Ethe, G. Madec) reorganisation of initialisation phase 13 !! 3.3.1! 2011-09 (P. Oddo) Mixed layer depth parameterization 14 !! 4.0 ! 2017-04 (G. Madec) remove CPP ddm key & avm at t-point only 15 !!---------------------------------------------------------------------- 16 17 !!---------------------------------------------------------------------- 21 18 !! zdf_ric_init : initialization, namelist read, & parameters control 19 !! zdf_ric : update momentum and tracer Kz from the Richardson number 20 !! ric_rst : read/write RIC restart in ocean restart file 22 21 !!---------------------------------------------------------------------- 23 22 USE oce ! ocean dynamics and tracers variables 24 23 USE dom_oce ! ocean space and time domain variables 25 USE zdf_oce ! ocean vertical physics 24 USE zdf_oce ! vertical physics: variables 25 USE phycst ! physical constants 26 USE sbc_oce, ONLY : taum 27 ! 26 28 USE in_out_manager ! I/O manager 27 USE lbclnk ! ocean lateral boundary condition (or mpp link) 28 USE lib_mpp ! MPP library 29 USE wrk_nemo ! work arrays 29 USE iom ! I/O manager library 30 30 USE timing ! Timing 31 31 USE lib_fortran ! Fortran utilities (allows no signed zero when 'key_nosignedzero' defined) 32 32 33 USE eosbn2, ONLY : neos34 33 35 34 IMPLICIT NONE 36 35 PRIVATE 37 36 38 PUBLIC zdf_ric ! called by step.F90 39 PUBLIC zdf_ric_init ! called by opa.F90 40 41 LOGICAL, PUBLIC, PARAMETER :: lk_zdfric = .TRUE. !: Richardson vertical mixing flag 42 43 ! !!* Namelist namzdf_ric : Richardson number dependent Kz * 44 INTEGER :: nn_ric ! coefficient of the parameterization 45 REAL(wp) :: rn_avmri ! maximum value of the vertical eddy viscosity 46 REAL(wp) :: rn_alp ! coefficient of the parameterization 47 REAL(wp) :: rn_ekmfc ! Ekman Factor Coeff 48 REAL(wp) :: rn_mldmin ! minimum mixed layer (ML) depth 49 REAL(wp) :: rn_mldmax ! maximum mixed layer depth 50 REAL(wp) :: rn_wtmix ! Vertical eddy Diff. in the ML 51 REAL(wp) :: rn_wvmix ! Vertical eddy Visc. in the ML 52 LOGICAL :: ln_mldw ! Use or not the MLD parameters 53 54 REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:,:) :: tmric !: coef. for the horizontal mean at t-point 37 PUBLIC zdf_ric ! called by zdfphy.F90 38 PUBLIC ric_rst ! called by zdfphy.F90 39 PUBLIC zdf_ric_init ! called by nemogcm.F90 40 41 ! !!* Namelist namzdf_ric : Richardson number dependent Kz * 42 INTEGER :: nn_ric ! coefficient of the parameterization 43 REAL(wp) :: rn_avmri ! maximum value of the vertical eddy viscosity 44 REAL(wp) :: rn_alp ! coefficient of the parameterization 45 REAL(wp) :: rn_ekmfc ! Ekman Factor Coeff 46 REAL(wp) :: rn_mldmin ! minimum mixed layer (ML) depth 47 REAL(wp) :: rn_mldmax ! maximum mixed layer depth 48 REAL(wp) :: rn_wtmix ! Vertical eddy Diff. in the ML 49 REAL(wp) :: rn_wvmix ! Vertical eddy Visc. in the ML 50 LOGICAL :: ln_mldw ! Use or not the MLD parameters 55 51 56 52 !! * Substitutions 57 53 # include "vectopt_loop_substitute.h90" 58 54 !!---------------------------------------------------------------------- 59 !! NEMO/OPA 4.0 , NEMO Consortium (201 1)55 !! NEMO/OPA 4.0 , NEMO Consortium (2017) 60 56 !! $Id$ 61 57 !! Software governed by the CeCILL licence (NEMOGCM/NEMO_CeCILL.txt) … … 63 59 CONTAINS 64 60 65 INTEGER FUNCTION zdf_ric_alloc() 66 !!---------------------------------------------------------------------- 67 !! *** FUNCTION zdf_ric_alloc *** 68 !!---------------------------------------------------------------------- 69 ALLOCATE( tmric(jpi,jpj,jpk) , STAT= zdf_ric_alloc ) 70 ! 71 IF( lk_mpp ) CALL mpp_sum ( zdf_ric_alloc ) 72 IF( zdf_ric_alloc /= 0 ) CALL ctl_warn('zdf_ric_alloc: failed to allocate arrays') 73 END FUNCTION zdf_ric_alloc 74 75 76 SUBROUTINE zdf_ric( kt ) 61 SUBROUTINE zdf_ric_init 62 !!---------------------------------------------------------------------- 63 !! *** ROUTINE zdf_ric_init *** 64 !! 65 !! ** Purpose : Initialization of the vertical eddy diffusivity and 66 !! viscosity coef. for the Richardson number dependent formulation. 67 !! 68 !! ** Method : Read the namzdf_ric namelist and check the parameter values 69 !! 70 !! ** input : Namelist namzdf_ric 71 !! 72 !! ** Action : increase by 1 the nstop flag is setting problem encounter 73 !!---------------------------------------------------------------------- 74 INTEGER :: ji, jj, jk ! dummy loop indices 75 INTEGER :: ios ! Local integer output status for namelist read 76 !! 77 NAMELIST/namzdf_ric/ rn_avmri, rn_alp , nn_ric , rn_ekmfc, & 78 & rn_mldmin, rn_mldmax, rn_wtmix, rn_wvmix, ln_mldw 79 !!---------------------------------------------------------------------- 80 ! 81 REWIND( numnam_ref ) ! Namelist namzdf_ric in reference namelist : Vertical diffusion Kz depends on Richardson number 82 READ ( numnam_ref, namzdf_ric, IOSTAT = ios, ERR = 901) 83 901 IF( ios /= 0 ) CALL ctl_nam ( ios , 'namzdf_ric in reference namelist', lwp ) 84 85 REWIND( numnam_cfg ) ! Namelist namzdf_ric in configuration namelist : Vertical diffusion Kz depends on Richardson number 86 READ ( numnam_cfg, namzdf_ric, IOSTAT = ios, ERR = 902 ) 87 902 IF( ios /= 0 ) CALL ctl_nam ( ios , 'namzdf_ric in configuration namelist', lwp ) 88 IF(lwm) WRITE ( numond, namzdf_ric ) 89 ! 90 IF(lwp) THEN ! Control print 91 WRITE(numout,*) 92 WRITE(numout,*) 'zdf_ric_init : Ri depend vertical mixing scheme' 93 WRITE(numout,*) '~~~~~~~~~~~~' 94 WRITE(numout,*) ' Namelist namzdf_ric : set Kz=F(Ri) parameters' 95 WRITE(numout,*) ' maximum vertical viscosity rn_avmri = ', rn_avmri 96 WRITE(numout,*) ' coefficient rn_alp = ', rn_alp 97 WRITE(numout,*) ' exponent nn_ric = ', nn_ric 98 WRITE(numout,*) ' Ekman layer enhanced mixing ln_mldw = ', ln_mldw 99 WRITE(numout,*) ' Ekman Factor Coeff rn_ekmfc = ', rn_ekmfc 100 WRITE(numout,*) ' minimum mixed layer depth rn_mldmin = ', rn_mldmin 101 WRITE(numout,*) ' maximum mixed layer depth rn_mldmax = ', rn_mldmax 102 WRITE(numout,*) ' Vertical eddy Diff. in the ML rn_wtmix = ', rn_wtmix 103 WRITE(numout,*) ' Vertical eddy Visc. in the ML rn_wvmix = ', rn_wvmix 104 ENDIF 105 ! 106 CALL ric_rst( nit000, 'READ' ) !* read or initialize all required files 107 ! 108 END SUBROUTINE zdf_ric_init 109 110 111 SUBROUTINE zdf_ric( kt, pdept, p_sh2, p_avm, p_avt ) 77 112 !!---------------------------------------------------------------------- 78 113 !! *** ROUTINE zdfric *** … … 88 123 !! with ri = N^2 / dz(u)**2 89 124 !! = e3w**2 * rn2/[ mi( dk(ub) )+mj( dk(vb) ) ] 90 !! avm0= rn_avmri / (1 + rn_alp*ri)**nn_ric 91 !! Where ri is the before local Richardson number, 92 !! rn_avmri is the maximum value reaches by avm and avt 93 !! avmb and avtb are the background (or minimum) values 94 !! and rn_alp, nn_ric are adjustable parameters. 95 !! Typical values used are : avm0=1.e-2 m2/s, avmb=1.e-6 m2/s 96 !! avtb=1.e-7 m2/s, rn_alp=5. and nn_ric=2. 97 !! a numerical threshold is impose on the vertical shear (1.e-20) 125 !! avm0= rn_avmri / (1 + rn_alp*Ri)**nn_ric 126 !! where ri is the before local Richardson number, 127 !! rn_avmri is the maximum value reaches by avm and avt 128 !! and rn_alp, nn_ric are adjustable parameters. 129 !! Typical values : rn_alp=5. and nn_ric=2. 130 !! 98 131 !! As second step compute Ekman depth from wind stress forcing 99 132 !! and apply namelist provided vertical coeff within this depth. … … 101 134 !! Ustar = SQRT(Taum/rho0) 102 135 !! ekd= rn_ekmfc * Ustar / f0 103 !! Large et al. (1994, eq.2 9) suggest rn_ekmfc=0.7; however, the derivation136 !! Large et al. (1994, eq.24) suggest rn_ekmfc=0.7; however, the derivation 104 137 !! of the above equation indicates the value is somewhat arbitrary; therefore 105 138 !! we allow the freedom to increase or decrease this value, if the … … 108 141 !! namelist 109 142 !! N.B. the mask are required for implicit scheme, and surface 110 !! and bottom value already set in zdfini.F90 143 !! and bottom value already set in zdfphy.F90 144 !! 145 !! ** Action : avm, avt mixing coeff (inner domain values only) 111 146 !! 112 147 !! References : Pacanowski & Philander 1981, JPO, 1441-1451. 113 148 !! PFJ Lermusiaux 2001. 114 149 !!---------------------------------------------------------------------- 115 USE phycst, ONLY: rsmall,rau0 116 USE sbc_oce, ONLY: taum 117 !! 118 INTEGER, INTENT( in ) :: kt ! ocean time-step 119 !! 120 INTEGER :: ji, jj, jk ! dummy loop indices 121 REAL(wp) :: zcoef, zdku, zdkv, zri, z05alp, zflageos ! temporary scalars 122 REAL(wp) :: zrhos, zustar 123 REAL(wp), POINTER, DIMENSION(:,:) :: zwx, ekm_dep 124 !!---------------------------------------------------------------------- 125 ! 126 IF( nn_timing == 1 ) CALL timing_start('zdf_ric') 127 ! 128 CALL wrk_alloc( jpi,jpj, zwx, ekm_dep ) 129 ! ! =============== 130 DO jk = 2, jpkm1 ! Horizontal slab 131 ! ! =============== 132 ! Richardson number (put in zwx(ji,jj)) 133 ! ----------------- 134 DO jj = 2, jpjm1 135 DO ji = fs_2, fs_jpim1 136 zcoef = 0.5 / e3w_n(ji,jj,jk) 137 ! ! shear of horizontal velocity 138 zdku = zcoef * ( ub(ji-1,jj,jk-1) + ub(ji,jj,jk-1) & 139 & -ub(ji-1,jj,jk ) - ub(ji,jj,jk ) ) 140 zdkv = zcoef * ( vb(ji,jj-1,jk-1) + vb(ji,jj,jk-1) & 141 & -vb(ji,jj-1,jk ) - vb(ji,jj,jk ) ) 142 ! ! richardson number (minimum value set to zero) 143 zri = rn2(ji,jj,jk) / ( zdku*zdku + zdkv*zdkv + 1.e-20 ) 144 zwx(ji,jj) = MAX( zri, 0.e0 ) 145 END DO 146 END DO 147 CALL lbc_lnk( zwx, 'W', 1. ) ! Boundary condition (sign unchanged) 148 149 ! Vertical eddy viscosity and diffusivity coefficients 150 ! ------------------------------------------------------- 151 z05alp = 0.5_wp * rn_alp 152 DO jj = 1, jpjm1 ! Eddy viscosity coefficients (avm) 153 DO ji = 1, fs_jpim1 154 avmu(ji,jj,jk) = umask(ji,jj,jk) * rn_avmri / ( 1. + z05alp*( zwx(ji+1,jj)+zwx(ji,jj) ) )**nn_ric 155 avmv(ji,jj,jk) = vmask(ji,jj,jk) * rn_avmri / ( 1. + z05alp*( zwx(ji,jj+1)+zwx(ji,jj) ) )**nn_ric 156 END DO 157 END DO 158 DO jj = 2, jpjm1 ! Eddy diffusivity coefficients (avt) 159 DO ji = fs_2, fs_jpim1 160 avt(ji,jj,jk) = tmric(ji,jj,jk) / ( 1._wp + rn_alp * zwx(ji,jj) ) & 161 & * ( avmu(ji,jj,jk) + avmu(ji-1,jj,jk) & 162 & + avmv(ji,jj,jk) + avmv(ji,jj-1,jk) ) & 163 & + avtb(jk) * tmask(ji,jj,jk) 164 END DO 165 END DO 166 DO jj = 2, jpjm1 ! Add the background coefficient on eddy viscosity 167 DO ji = fs_2, fs_jpim1 168 avmu(ji,jj,jk) = avmu(ji,jj,jk) + avmb(jk) * umask(ji,jj,jk) 169 avmv(ji,jj,jk) = avmv(ji,jj,jk) + avmb(jk) * vmask(ji,jj,jk) 170 END DO 171 END DO 172 ! ! =============== 173 END DO ! End of slab 174 ! ! =============== 175 ! 176 IF( ln_mldw ) THEN 177 178 ! Compute Ekman depth from wind stress forcing. 179 ! ------------------------------------------------------- 180 zflageos = ( 0.5 + SIGN( 0.5, neos - 1. ) ) * rau0 181 DO jj = 2, jpjm1 182 DO ji = fs_2, fs_jpim1 183 zrhos = rhop(ji,jj,1) + zflageos * ( 1. - tmask(ji,jj,1) ) 184 zustar = SQRT( taum(ji,jj) / ( zrhos + rsmall ) ) 185 ekm_dep(ji,jj) = rn_ekmfc * zustar / ( ABS( ff(ji,jj) ) + rsmall ) 186 ekm_dep(ji,jj) = MAX(ekm_dep(ji,jj),rn_mldmin) ! Minimun allowed 187 ekm_dep(ji,jj) = MIN(ekm_dep(ji,jj),rn_mldmax) ! Maximum allowed 188 END DO 189 END DO 190 191 ! In the first model level vertical diff/visc coeff.s 192 ! are always equal to the namelist values rn_wtmix/rn_wvmix 193 ! ------------------------------------------------------- 194 DO jj = 2, jpjm1 195 DO ji = fs_2, fs_jpim1 196 avmv(ji,jj,1) = MAX( avmv(ji,jj,1), rn_wvmix ) 197 avmu(ji,jj,1) = MAX( avmu(ji,jj,1), rn_wvmix ) 198 avt( ji,jj,1) = MAX( avt(ji,jj,1), rn_wtmix ) 199 END DO 200 END DO 201 202 ! Force the vertical mixing coef within the Ekman depth 203 ! ------------------------------------------------------- 150 INTEGER , INTENT(in ) :: kt ! ocean time-step 151 REAL(wp), DIMENSION(:,:,:), INTENT(in ) :: pdept ! depth of t-point [m] 152 REAL(wp), DIMENSION(:,:,:), INTENT(in ) :: p_sh2 ! shear production term 153 REAL(wp), DIMENSION(:,:,:), INTENT(inout) :: p_avm, p_avt ! momentum and tracer Kz (w-points) 154 !! 155 INTEGER :: ji, jj, jk ! dummy loop indices 156 REAL(wp) :: zcfRi, zav, zustar, zhek ! local scalars 157 REAL(wp), DIMENSION(jpi,jpj) :: zh_ekm ! 2D workspace 158 !!---------------------------------------------------------------------- 159 ! 160 IF( nn_timing == 1 ) CALL timing_start('zdf_ric') 161 ! 162 ! !== avm and avt = F(Richardson number) ==! 204 163 DO jk = 2, jpkm1 205 DO jj = 2, jpjm1206 DO ji = fs_2, fs_jpim1207 IF( gdept_n(ji,jj,jk) < ekm_dep(ji,jj) ) THEN208 avmv(ji,jj,jk) = MAX( avmv(ji,jj,jk), rn_wvmix )209 avmu(ji,jj,jk) = MAX( avmu(ji,jj,jk), rn_wvmix )210 avt( ji,jj,jk) = MAX( avt(ji,jj,jk), rn_wtmix)211 ENDIF164 DO jj = 1, jpjm1 165 DO ji = 1, jpim1 ! coefficient = F(richardson number) (avm-weighted Ri) 166 zcfRi = 1._wp / ( 1._wp + rn_alp * MAX( 0._wp , avm(ji,jj,jk) * rn2(ji,jj,jk) / ( p_sh2(ji,jj,jk) + 1.e-20 ) ) ) 167 zav = rn_avmri * zcfRi**nn_ric 168 ! ! avm and avt coefficients 169 p_avm(ji,jj,jk) = MAX( zav , avmb(jk) ) * wmask(ji,jj,jk) 170 p_avt(ji,jj,jk) = MAX( zav * zcfRi , avtb(jk) ) * wmask(ji,jj,jk) 212 171 END DO 213 172 END DO 214 173 END DO 215 216 DO jk = 1, jpkm1 217 DO jj = 2, jpjm1 218 DO ji = fs_2, fs_jpim1 219 avmv(ji,jj,jk) = avmv(ji,jj,jk) * vmask(ji,jj,jk) 220 avmu(ji,jj,jk) = avmu(ji,jj,jk) * umask(ji,jj,jk) 221 avt( ji,jj,jk) = avt( ji,jj,jk) * tmask(ji,jj,jk) 174 ! 175 !!gm BUG <<<<==== This param can't work at low latitude 176 !!gm it provides there much to thick mixed layer ( summer 150m in GYRE configuration !!! ) 177 ! 178 IF( ln_mldw ) THEN !== set a minimum value in the Ekman layer ==! 179 ! 180 DO jj = 2, jpjm1 !* Ekman depth 181 DO ji = 2, jpim1 182 zustar = SQRT( taum(ji,jj) * r1_rau0 ) 183 zhek = rn_ekmfc * zustar / ( ABS( ff_t(ji,jj) ) + rsmall ) ! Ekman depth 184 zh_ekm(ji,jj) = MAX( rn_mldmin , MIN( zhek , rn_mldmax ) ) ! set allowed range 222 185 END DO 223 186 END DO 224 END DO 225 226 ENDIF 227 228 CALL lbc_lnk( avt , 'W', 1. ) ! Boundary conditions (unchanged sign) 229 CALL lbc_lnk( avmu, 'U', 1. ) ; CALL lbc_lnk( avmv, 'V', 1. ) 230 ! 231 CALL wrk_dealloc( jpi,jpj, zwx, ekm_dep ) 232 ! 233 IF( nn_timing == 1 ) CALL timing_stop('zdf_ric') 234 ! 235 END SUBROUTINE zdf_ric 236 237 238 SUBROUTINE zdf_ric_init 239 !!---------------------------------------------------------------------- 240 !! *** ROUTINE zdfbfr_init *** 241 !! 242 !! ** Purpose : Initialization of the vertical eddy diffusivity and 243 !! viscosity coef. for the Richardson number dependent formulation. 244 !! 245 !! ** Method : Read the namzdf_ric namelist and check the parameter values 246 !! 247 !! ** input : Namelist namzdf_ric 248 !! 249 !! ** Action : increase by 1 the nstop flag is setting problem encounter 250 !!---------------------------------------------------------------------- 251 INTEGER :: ji, jj, jk ! dummy loop indices 252 INTEGER :: ios ! Local integer output status for namelist read 253 !! 254 NAMELIST/namzdf_ric/ rn_avmri, rn_alp , nn_ric , rn_ekmfc, & 255 & rn_mldmin, rn_mldmax, rn_wtmix, rn_wvmix, ln_mldw 256 !!---------------------------------------------------------------------- 257 ! 258 REWIND( numnam_ref ) ! Namelist namzdf_ric in reference namelist : Vertical diffusion Kz depends on Richardson number 259 READ ( numnam_ref, namzdf_ric, IOSTAT = ios, ERR = 901) 260 901 IF( ios /= 0 ) CALL ctl_nam ( ios , 'namzdf_ric in reference namelist', lwp ) 261 262 REWIND( numnam_cfg ) ! Namelist namzdf_ric in configuration namelist : Vertical diffusion Kz depends on Richardson number 263 READ ( numnam_cfg, namzdf_ric, IOSTAT = ios, ERR = 902 ) 264 902 IF( ios /= 0 ) CALL ctl_nam ( ios , 'namzdf_ric in configuration namelist', lwp ) 265 IF(lwm) WRITE ( numond, namzdf_ric ) 266 ! 267 IF(lwp) THEN ! Control print 268 WRITE(numout,*) 269 WRITE(numout,*) 'zdf_ric : Ri depend vertical mixing scheme' 270 WRITE(numout,*) '~~~~~~~' 271 WRITE(numout,*) ' Namelist namzdf_ric : set Kz(Ri) parameters' 272 WRITE(numout,*) ' maximum vertical viscosity rn_avmri = ', rn_avmri 273 WRITE(numout,*) ' coefficient rn_alp = ', rn_alp 274 WRITE(numout,*) ' coefficient nn_ric = ', nn_ric 275 WRITE(numout,*) ' Ekman Factor Coeff rn_ekmfc = ', rn_ekmfc 276 WRITE(numout,*) ' minimum mixed layer depth rn_mldmin = ', rn_mldmin 277 WRITE(numout,*) ' maximum mixed layer depth rn_mldmax = ', rn_mldmax 278 WRITE(numout,*) ' Vertical eddy Diff. in the ML rn_wtmix = ', rn_wtmix 279 WRITE(numout,*) ' Vertical eddy Visc. in the ML rn_wvmix = ', rn_wvmix 280 WRITE(numout,*) ' Use the MLD parameterization ln_mldw = ', ln_mldw 281 ENDIF 282 ! 283 ! ! allocate zdfric arrays 284 IF( zdf_ric_alloc() /= 0 ) CALL ctl_stop( 'STOP', 'zdf_ric_init : unable to allocate arrays' ) 285 ! 286 DO jk = 1, jpk ! weighting mean array tmric for 4 T-points 287 DO jj = 2, jpj ! which accounts for coastal boundary conditions 288 DO ji = 2, jpi 289 tmric(ji,jj,jk) = tmask(ji,jj,jk) & 290 & / MAX( 1., umask(ji-1,jj ,jk) + umask(ji,jj,jk) & 291 & + vmask(ji ,jj-1,jk) + vmask(ji,jj,jk) ) 187 DO jk = 2, jpkm1 !* minimum mixing coeff. within the Ekman layer 188 DO jj = 2, jpjm1 189 DO ji = 2, jpim1 190 IF( pdept(ji,jj,jk) < zh_ekm(ji,jj) ) THEN 191 p_avm(ji,jj,jk) = MAX( p_avm(ji,jj,jk), rn_wvmix ) * wmask(ji,jj,jk) 192 p_avt(ji,jj,jk) = MAX( p_avt(ji,jj,jk), rn_wtmix ) * wmask(ji,jj,jk) 193 ENDIF 194 END DO 292 195 END DO 293 196 END DO 294 END DO 295 tmric(:,1,:) = 0._wp 296 ! 297 DO jk = 1, jpk ! Initialization of vertical eddy coef. to the background value 298 avt (:,:,jk) = avtb(jk) * tmask(:,:,jk) 299 avmu(:,:,jk) = avmb(jk) * umask(:,:,jk) 300 avmv(:,:,jk) = avmb(jk) * vmask(:,:,jk) 301 END DO 302 ! 303 END SUBROUTINE zdf_ric_init 304 305 #else 306 !!---------------------------------------------------------------------- 307 !! Dummy module : NO Richardson dependent vertical mixing 308 !!---------------------------------------------------------------------- 309 LOGICAL, PUBLIC, PARAMETER :: lk_zdfric = .FALSE. !: Richardson mixing flag 310 CONTAINS 311 SUBROUTINE zdf_ric_init ! Dummy routine 312 END SUBROUTINE zdf_ric_init 313 SUBROUTINE zdf_ric( kt ) ! Dummy routine 314 WRITE(*,*) 'zdf_ric: You should not have seen this print! error?', kt 197 ENDIF 198 ! 199 IF( nn_timing == 1 ) CALL timing_stop('zdf_ric') 200 ! 315 201 END SUBROUTINE zdf_ric 316 #endif 202 203 204 SUBROUTINE ric_rst( kt, cdrw ) 205 !!--------------------------------------------------------------------- 206 !! *** ROUTINE ric_rst *** 207 !! 208 !! ** Purpose : Read or write TKE file (en) in restart file 209 !! 210 !! ** Method : use of IOM library 211 !! if the restart does not contain TKE, en is either 212 !! set to rn_emin or recomputed 213 !!---------------------------------------------------------------------- 214 INTEGER , INTENT(in) :: kt ! ocean time-step 215 CHARACTER(len=*), INTENT(in) :: cdrw ! "READ"/"WRITE" flag 216 ! 217 INTEGER :: jit, jk ! dummy loop indices 218 INTEGER :: id1, id2 ! local integers 219 !!---------------------------------------------------------------------- 220 ! 221 IF( TRIM(cdrw) == 'READ' ) THEN ! Read/initialise 222 ! ! --------------- 223 ! !* Read the restart file 224 IF( ln_rstart ) THEN 225 id1 = iom_varid( numror, 'avt_k', ldstop = .FALSE. ) 226 id2 = iom_varid( numror, 'avm_k', ldstop = .FALSE. ) 227 ! 228 IF( MIN( id1, id2 ) > 0 ) THEN ! restart exists => read it 229 CALL iom_get( numror, jpdom_autoglo, 'avt_k', avt_k ) 230 CALL iom_get( numror, jpdom_autoglo, 'avm_k', avm_k ) 231 ENDIF 232 ENDIF 233 ! !* otherwise Kz already set to the background value in zdf_phy_init 234 ! 235 ELSEIF( TRIM(cdrw) == 'WRITE' ) THEN ! Create restart file 236 ! ! ------------------- 237 IF(lwp) WRITE(numout,*) '---- ric-rst ----' 238 CALL iom_rstput( kt, nitrst, numrow, 'avt_k', avt_k ) 239 CALL iom_rstput( kt, nitrst, numrow, 'avm_k', avm_k ) 240 ! 241 ENDIF 242 ! 243 END SUBROUTINE ric_rst 317 244 318 245 !!======================================================================
Note: See TracChangeset
for help on using the changeset viewer.