[3] | 1 | MODULE zdfbfr |
---|
| 2 | !!====================================================================== |
---|
| 3 | !! *** MODULE zdfbfr *** |
---|
| 4 | !! Ocean physics: Bottom friction |
---|
| 5 | !!====================================================================== |
---|
[1662] | 6 | !! History : OPA ! 1997-06 (G. Madec, A.-M. Treguier) Original code |
---|
[1601] | 7 | !! NEMO 1.0 ! 2002-06 (G. Madec) F90: Free form and module |
---|
[1708] | 8 | !! 3.2 ! 2009-09 (A.C.Coward) Correction to include barotropic contribution |
---|
[2528] | 9 | !! 3.3 ! 2010-10 (C. Ethe, G. Madec) reorganisation of initialisation phase |
---|
[3633] | 10 | !! 3.4 ! 2011-11 (H. Liu) implementation of semi-implicit bottom friction option |
---|
| 11 | !! ! 2012-06 (H. Liu) implementation of Log Layer bottom friction option |
---|
[1601] | 12 | !!---------------------------------------------------------------------- |
---|
[3] | 13 | |
---|
| 14 | !!---------------------------------------------------------------------- |
---|
[4381] | 15 | !! zdf_bfr : update bottom friction coefficient (non-linear bottom friction only) |
---|
[1601] | 16 | !! zdf_bfr_init : read in namelist and control the bottom friction parameters. |
---|
[3] | 17 | !!---------------------------------------------------------------------- |
---|
| 18 | USE oce ! ocean dynamics and tracers variables |
---|
[3764] | 19 | USE dom_oce ! ocean space and time domain variables |
---|
[3] | 20 | USE zdf_oce ! ocean vertical physics variables |
---|
| 21 | USE in_out_manager ! I/O manager |
---|
| 22 | USE lbclnk ! ocean lateral boundary conditions (or mpp link) |
---|
[1671] | 23 | USE lib_mpp ! distributed memory computing |
---|
[258] | 24 | USE prtctl ! Print control |
---|
[3294] | 25 | USE timing ! Timing |
---|
[4381] | 26 | USE wrk_nemo ! Memory Allocation |
---|
[3633] | 27 | USE phycst, ONLY: vkarmn |
---|
| 28 | |
---|
[3] | 29 | IMPLICIT NONE |
---|
| 30 | PRIVATE |
---|
| 31 | |
---|
[2528] | 32 | PUBLIC zdf_bfr ! called by step.F90 |
---|
[4381] | 33 | PUBLIC zdf_bfr_init ! called by nemogcm.F90 |
---|
[2715] | 34 | |
---|
[4147] | 35 | ! !!* Namelist nambfr: bottom friction namelist * |
---|
| 36 | INTEGER , PUBLIC :: nn_bfr ! = 0/1/2/3 type of bottom friction (PUBLIC for TAM) |
---|
| 37 | REAL(wp), PUBLIC :: rn_bfri1 ! bottom drag coefficient (linear case) (PUBLIC for TAM) |
---|
| 38 | REAL(wp), PUBLIC :: rn_bfri2 ! bottom drag coefficient (non linear case) (PUBLIC for TAM) |
---|
[4381] | 39 | REAL(wp), PUBLIC :: rn_bfri2_max ! Maximum bottom drag coefficient (non linear case and ln_loglayer=T) (PUBLIC for TAM) |
---|
[4147] | 40 | REAL(wp), PUBLIC :: rn_bfeb2 ! background bottom turbulent kinetic energy [m2/s2] (PUBLIC for TAM) |
---|
| 41 | REAL(wp), PUBLIC :: rn_bfrien ! local factor to enhance coefficient bfri (PUBLIC for TAM) |
---|
| 42 | LOGICAL , PUBLIC :: ln_bfr2d ! logical switch for 2D enhancement (PUBLIC for TAM) |
---|
[4990] | 43 | REAL(wp), PUBLIC :: rn_tfri1 ! top drag coefficient (linear case) (PUBLIC for TAM) |
---|
| 44 | REAL(wp), PUBLIC :: rn_tfri2 ! top drag coefficient (non linear case) (PUBLIC for TAM) |
---|
| 45 | REAL(wp), PUBLIC :: rn_tfri2_max ! Maximum top drag coefficient (non linear case and ln_loglayer=T) (PUBLIC for TAM) |
---|
| 46 | REAL(wp), PUBLIC :: rn_tfeb2 ! background top turbulent kinetic energy [m2/s2] (PUBLIC for TAM) |
---|
| 47 | REAL(wp), PUBLIC :: rn_tfrien ! local factor to enhance coefficient tfri (PUBLIC for TAM) |
---|
| 48 | LOGICAL , PUBLIC :: ln_tfr2d ! logical switch for 2D enhancement (PUBLIC for TAM) |
---|
| 49 | |
---|
[4147] | 50 | LOGICAL , PUBLIC :: ln_loglayer ! switch for log layer bfr coeff. (PUBLIC for TAM) |
---|
| 51 | REAL(wp), PUBLIC :: rn_bfrz0 ! bottom roughness for loglayer bfr coeff (PUBLIC for TAM) |
---|
[4990] | 52 | REAL(wp), PUBLIC :: rn_tfrz0 ! bottom roughness for loglayer bfr coeff (PUBLIC for TAM) |
---|
[4381] | 53 | LOGICAL , PUBLIC :: ln_bfrimp ! logical switch for implicit bottom friction |
---|
[4990] | 54 | REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:), PUBLIC :: bfrcoef2d, tfrcoef2d ! 2D bottom/top drag coefficient (PUBLIC for TAM) |
---|
[3] | 55 | |
---|
| 56 | !! * Substitutions |
---|
[2528] | 57 | # include "vectopt_loop_substitute.h90" |
---|
[3] | 58 | # include "domzgr_substitute.h90" |
---|
| 59 | !!---------------------------------------------------------------------- |
---|
[2715] | 60 | !! NEMO/OPA 4.0 , NEMO Consortium (2011) |
---|
[2528] | 61 | !! $Id$ |
---|
| 62 | !! Software governed by the CeCILL licence (NEMOGCM/NEMO_CeCILL.txt) |
---|
[3] | 63 | !!---------------------------------------------------------------------- |
---|
| 64 | CONTAINS |
---|
| 65 | |
---|
[2715] | 66 | INTEGER FUNCTION zdf_bfr_alloc() |
---|
| 67 | !!---------------------------------------------------------------------- |
---|
| 68 | !! *** FUNCTION zdf_bfr_alloc *** |
---|
| 69 | !!---------------------------------------------------------------------- |
---|
[4990] | 70 | ALLOCATE( bfrcoef2d(jpi,jpj), tfrcoef2d(jpi,jpj), STAT=zdf_bfr_alloc ) |
---|
[2715] | 71 | ! |
---|
| 72 | IF( lk_mpp ) CALL mpp_sum ( zdf_bfr_alloc ) |
---|
| 73 | IF( zdf_bfr_alloc /= 0 ) CALL ctl_warn('zdf_bfr_alloc: failed to allocate arrays.') |
---|
| 74 | END FUNCTION zdf_bfr_alloc |
---|
| 75 | |
---|
| 76 | |
---|
[3] | 77 | SUBROUTINE zdf_bfr( kt ) |
---|
| 78 | !!---------------------------------------------------------------------- |
---|
| 79 | !! *** ROUTINE zdf_bfr *** |
---|
[3764] | 80 | !! |
---|
[1708] | 81 | !! ** Purpose : compute the bottom friction coefficient. |
---|
[3] | 82 | !! |
---|
[3764] | 83 | !! ** Method : Calculate and store part of the momentum trend due |
---|
| 84 | !! to bottom friction following the chosen friction type |
---|
[1662] | 85 | !! (free-slip, linear, or quadratic). The component |
---|
| 86 | !! calculated here is multiplied by the bottom velocity in |
---|
| 87 | !! dyn_bfr to provide the trend term. |
---|
[1708] | 88 | !! The coefficients are updated at each time step only |
---|
| 89 | !! in the quadratic case. |
---|
[1662] | 90 | !! |
---|
| 91 | !! ** Action : bfrua , bfrva bottom friction coefficients |
---|
[3] | 92 | !!---------------------------------------------------------------------- |
---|
| 93 | INTEGER, INTENT( in ) :: kt ! ocean time-step index |
---|
[1601] | 94 | !! |
---|
[3633] | 95 | INTEGER :: ji, jj ! dummy loop indices |
---|
[4381] | 96 | INTEGER :: ikbt, ikbu, ikbv ! local integers |
---|
| 97 | REAL(wp) :: zvu, zuv, zecu, zecv, ztmp ! temporary scalars |
---|
[4990] | 98 | REAL(wp), POINTER, DIMENSION(:,:) :: zbfrt, ztfrt |
---|
[3] | 99 | !!---------------------------------------------------------------------- |
---|
[3294] | 100 | ! |
---|
| 101 | IF( nn_timing == 1 ) CALL timing_start('zdf_bfr') |
---|
| 102 | ! |
---|
[4381] | 103 | IF( kt == nit000 .AND. lwp ) THEN |
---|
| 104 | WRITE(numout,*) |
---|
| 105 | WRITE(numout,*) 'zdf_bfr : Set bottom friction coefficient (non-linear case)' |
---|
| 106 | WRITE(numout,*) '~~~~~~~~' |
---|
| 107 | ENDIF |
---|
| 108 | ! |
---|
| 109 | IF( nn_bfr == 2 ) THEN ! quadratic bottom friction only |
---|
[1662] | 110 | ! |
---|
[4990] | 111 | CALL wrk_alloc( jpi, jpj, zbfrt, ztfrt ) |
---|
[3633] | 112 | |
---|
[4381] | 113 | IF ( ln_loglayer.AND.lk_vvl ) THEN ! "log layer" bottom friction coefficient |
---|
[3820] | 114 | |
---|
[4381] | 115 | DO jj = 1, jpj |
---|
| 116 | DO ji = 1, jpi |
---|
| 117 | ikbt = mbkt(ji,jj) |
---|
[4990] | 118 | !! JC: possible WAD implementation should modify line below if layers vanish |
---|
[4381] | 119 | ztmp = tmask(ji,jj,ikbt) * ( vkarmn / LOG( 0.5_wp * fse3t_n(ji,jj,ikbt) / rn_bfrz0 ))**2._wp |
---|
| 120 | zbfrt(ji,jj) = MAX(bfrcoef2d(ji,jj), ztmp) |
---|
| 121 | zbfrt(ji,jj) = MIN(zbfrt(ji,jj), rn_bfri2_max) |
---|
[4990] | 122 | ! (ISF) |
---|
| 123 | ikbt = mikt(ji,jj) |
---|
| 124 | ! JC: possible WAD implementation should modify line below if layers vanish |
---|
| 125 | ztmp = tmask(ji,jj,ikbt) * ( vkarmn / LOG( 0.5_wp * fse3t_n(ji,jj,ikbt) / rn_bfrz0 ))**2._wp |
---|
| 126 | ztfrt(ji,jj) = MAX(tfrcoef2d(ji,jj), ztmp) |
---|
| 127 | ztfrt(ji,jj) = MIN(ztfrt(ji,jj), rn_tfri2_max) |
---|
| 128 | |
---|
[4381] | 129 | END DO |
---|
| 130 | END DO |
---|
| 131 | ! |
---|
| 132 | ELSE |
---|
| 133 | zbfrt(:,:) = bfrcoef2d(:,:) |
---|
[4990] | 134 | ztfrt(:,:) = tfrcoef2d(:,:) |
---|
[3633] | 135 | ENDIF |
---|
| 136 | |
---|
[3] | 137 | DO jj = 2, jpjm1 |
---|
| 138 | DO ji = 2, jpim1 |
---|
[3764] | 139 | ikbu = mbku(ji,jj) ! ocean bottom level at u- and v-points |
---|
[2528] | 140 | ikbv = mbkv(ji,jj) ! (deepest ocean u- and v-points) |
---|
[1662] | 141 | ! |
---|
[2528] | 142 | zvu = 0.25 * ( vn(ji,jj ,ikbu) + vn(ji+1,jj ,ikbu) & |
---|
| 143 | & + vn(ji,jj-1,ikbu) + vn(ji+1,jj-1,ikbu) ) |
---|
| 144 | zuv = 0.25 * ( un(ji,jj ,ikbv) + un(ji-1,jj ,ikbv) & |
---|
| 145 | & + un(ji,jj+1,ikbv) + un(ji-1,jj+1,ikbv) ) |
---|
[1662] | 146 | ! |
---|
[2528] | 147 | zecu = SQRT( un(ji,jj,ikbu) * un(ji,jj,ikbu) + zvu*zvu + rn_bfeb2 ) |
---|
| 148 | zecv = SQRT( vn(ji,jj,ikbv) * vn(ji,jj,ikbv) + zuv*zuv + rn_bfeb2 ) |
---|
[1662] | 149 | ! |
---|
[4381] | 150 | bfrua(ji,jj) = - 0.5_wp * ( zbfrt(ji,jj) + zbfrt(ji+1,jj ) ) * zecu |
---|
| 151 | bfrva(ji,jj) = - 0.5_wp * ( zbfrt(ji,jj) + zbfrt(ji ,jj+1) ) * zecv |
---|
[4990] | 152 | ! |
---|
| 153 | ! in case of 2 cell water column, we assume each cell feels the top and bottom friction |
---|
| 154 | IF ( miku(ji,jj) + 2 .GE. mbku(ji,jj) ) THEN |
---|
| 155 | bfrua(ji,jj) = - 0.5_wp * ( ( zbfrt(ji,jj) + zbfrt(ji+1,jj ) ) & |
---|
| 156 | & + ( ztfrt(ji,jj) + ztfrt(ji+1,jj ) ) ) & |
---|
| 157 | & * zecu * (1._wp - umask(ji,jj,1)) |
---|
| 158 | END IF |
---|
| 159 | IF ( mikv(ji,jj) + 2 .GE. mbkv(ji,jj) ) THEN |
---|
| 160 | bfrva(ji,jj) = - 0.5_wp * ( ( zbfrt(ji,jj) + zbfrt(ji ,jj+1) ) & |
---|
| 161 | & + ( ztfrt(ji,jj) + ztfrt(ji ,jj+1) ) ) & |
---|
| 162 | & * zecv * (1._wp - vmask(ji,jj,1)) |
---|
| 163 | END IF |
---|
| 164 | ! (ISF) ======================================================================== |
---|
| 165 | ikbu = miku(ji,jj) ! ocean bottom level at u- and v-points |
---|
| 166 | ikbv = mikv(ji,jj) ! (deepest ocean u- and v-points) |
---|
| 167 | ! |
---|
| 168 | zvu = 0.25 * ( vn(ji,jj ,ikbu) + vn(ji+1,jj ,ikbu) & |
---|
| 169 | & + vn(ji,jj-1,ikbu) + vn(ji+1,jj-1,ikbu) ) |
---|
| 170 | zuv = 0.25 * ( un(ji,jj ,ikbv) + un(ji-1,jj ,ikbv) & |
---|
| 171 | & + un(ji,jj+1,ikbv) + un(ji-1,jj+1,ikbv) ) |
---|
| 172 | ! |
---|
| 173 | zecu = SQRT( un(ji,jj,ikbu) * un(ji,jj,ikbu) + zvu*zvu + rn_bfeb2 ) |
---|
| 174 | zecv = SQRT( vn(ji,jj,ikbv) * vn(ji,jj,ikbv) + zuv*zuv + rn_bfeb2 ) |
---|
| 175 | ! |
---|
| 176 | tfrua(ji,jj) = - 0.5_wp * ( ztfrt(ji,jj) + ztfrt(ji+1,jj ) ) * zecu * (1._wp - umask(ji,jj,1)) |
---|
| 177 | tfrva(ji,jj) = - 0.5_wp * ( ztfrt(ji,jj) + ztfrt(ji ,jj+1) ) * zecv * (1._wp - vmask(ji,jj,1)) |
---|
| 178 | ! (ISF) END ==================================================================== |
---|
| 179 | ! in case of 2 cell water column, we assume each cell feels the top and bottom friction |
---|
| 180 | IF ( miku(ji,jj) + 2 .GE. mbku(ji,jj) ) THEN |
---|
| 181 | tfrua(ji,jj) = - 0.5_wp * ( ( ztfrt(ji,jj) + ztfrt(ji+1,jj ) ) & |
---|
| 182 | & + ( zbfrt(ji,jj) + zbfrt(ji+1,jj ) ) ) & |
---|
| 183 | & * zecu * (1._wp - umask(ji,jj,1)) |
---|
| 184 | END IF |
---|
| 185 | IF ( mikv(ji,jj) + 2 .GE. mbkv(ji,jj) ) THEN |
---|
| 186 | tfrva(ji,jj) = - 0.5_wp * ( ( ztfrt(ji,jj) + ztfrt(ji ,jj+1) ) & |
---|
| 187 | & + ( zbfrt(ji,jj) + zbfrt(ji ,jj+1) ) ) & |
---|
| 188 | & * zecv * (1._wp - vmask(ji,jj,1)) |
---|
| 189 | END IF |
---|
[3] | 190 | END DO |
---|
| 191 | END DO |
---|
[1601] | 192 | ! |
---|
[1708] | 193 | CALL lbc_lnk( bfrua, 'U', 1. ) ; CALL lbc_lnk( bfrva, 'V', 1. ) ! Lateral boundary condition |
---|
| 194 | ! |
---|
| 195 | IF(ln_ctl) CALL prt_ctl( tab2d_1=bfrua, clinfo1=' bfr - u: ', mask1=umask, & |
---|
| 196 | & tab2d_2=bfrva, clinfo2= ' v: ', mask2=vmask,ovlap=1 ) |
---|
[4990] | 197 | CALL wrk_dealloc( jpi,jpj,zbfrt, ztfrt ) |
---|
[1662] | 198 | ENDIF |
---|
| 199 | ! |
---|
[3294] | 200 | IF( nn_timing == 1 ) CALL timing_stop('zdf_bfr') |
---|
| 201 | ! |
---|
[3] | 202 | END SUBROUTINE zdf_bfr |
---|
| 203 | |
---|
| 204 | |
---|
| 205 | SUBROUTINE zdf_bfr_init |
---|
| 206 | !!---------------------------------------------------------------------- |
---|
| 207 | !! *** ROUTINE zdf_bfr_init *** |
---|
[3764] | 208 | !! |
---|
[3] | 209 | !! ** Purpose : Initialization of the bottom friction |
---|
| 210 | !! |
---|
[4381] | 211 | !! ** Method : Read the nambfr namelist and check their consistency |
---|
| 212 | !! called at the first timestep (nit000) |
---|
[3] | 213 | !!---------------------------------------------------------------------- |
---|
[1662] | 214 | USE iom ! I/O module for ehanced bottom friction file |
---|
| 215 | !! |
---|
[3633] | 216 | INTEGER :: inum ! logical unit for enhanced bottom friction file |
---|
| 217 | INTEGER :: ji, jj ! dummy loop indexes |
---|
[4381] | 218 | INTEGER :: ikbt, ikbu, ikbv ! temporary integers |
---|
| 219 | INTEGER :: ictu, ictv ! - - |
---|
[4147] | 220 | INTEGER :: ios |
---|
[3633] | 221 | REAL(wp) :: zminbfr, zmaxbfr ! temporary scalars |
---|
[4990] | 222 | REAL(wp) :: zmintfr, zmaxtfr ! temporary scalars |
---|
[4381] | 223 | REAL(wp) :: ztmp, zfru, zfrv ! - - |
---|
[1708] | 224 | !! |
---|
[4381] | 225 | NAMELIST/nambfr/ nn_bfr, rn_bfri1, rn_bfri2, rn_bfri2_max, rn_bfeb2, rn_bfrz0, ln_bfr2d, & |
---|
[4990] | 226 | & rn_tfri1, rn_tfri2, rn_tfri2_max, rn_tfeb2, rn_tfrz0, ln_tfr2d, & |
---|
| 227 | & rn_bfrien, rn_tfrien, ln_bfrimp, ln_loglayer |
---|
[3] | 228 | !!---------------------------------------------------------------------- |
---|
[3294] | 229 | ! |
---|
| 230 | IF( nn_timing == 1 ) CALL timing_start('zdf_bfr_init') |
---|
| 231 | ! |
---|
[4381] | 232 | ! !* Allocate zdfbfr arrays |
---|
| 233 | IF( zdf_bfr_alloc() /= 0 ) CALL ctl_stop( 'STOP', 'zdf_bfr_init : unable to allocate arrays' ) |
---|
| 234 | ! |
---|
| 235 | ! !* Parameter control and print |
---|
| 236 | ! |
---|
[4147] | 237 | REWIND( numnam_ref ) ! Namelist nambfr in reference namelist : Bottom momentum boundary condition |
---|
| 238 | READ ( numnam_ref, nambfr, IOSTAT = ios, ERR = 901) |
---|
| 239 | 901 IF( ios /= 0 ) CALL ctl_nam ( ios , 'nambfr in reference namelist', lwp ) |
---|
[3] | 240 | |
---|
[4147] | 241 | REWIND( numnam_cfg ) ! Namelist nambfr in configuration namelist : Bottom momentum boundary condition |
---|
| 242 | READ ( numnam_cfg, nambfr, IOSTAT = ios, ERR = 902 ) |
---|
| 243 | 902 IF( ios /= 0 ) CALL ctl_nam ( ios , 'nambfr in configuration namelist', lwp ) |
---|
[4624] | 244 | IF(lwm) WRITE ( numond, nambfr ) |
---|
[1662] | 245 | IF(lwp) WRITE(numout,*) |
---|
[4381] | 246 | IF(lwp) WRITE(numout,*) 'zdf_bfr_init : momentum bottom friction' |
---|
| 247 | IF(lwp) WRITE(numout,*) '~~~~~~~~~~~~~' |
---|
[1708] | 248 | IF(lwp) WRITE(numout,*) ' Namelist nam_bfr : set bottom friction parameters' |
---|
[4381] | 249 | ! |
---|
[1662] | 250 | SELECT CASE (nn_bfr) |
---|
[2715] | 251 | ! |
---|
[3] | 252 | CASE( 0 ) |
---|
[1708] | 253 | IF(lwp) WRITE(numout,*) ' free-slip ' |
---|
[1662] | 254 | bfrua(:,:) = 0.e0 |
---|
| 255 | bfrva(:,:) = 0.e0 |
---|
[4990] | 256 | tfrua(:,:) = 0.e0 |
---|
| 257 | tfrva(:,:) = 0.e0 |
---|
[1662] | 258 | ! |
---|
[3] | 259 | CASE( 1 ) |
---|
[1708] | 260 | IF(lwp) WRITE(numout,*) ' linear botton friction' |
---|
[4990] | 261 | IF(lwp) WRITE(numout,*) ' bottom friction coef. rn_bfri1 = ', rn_bfri1 |
---|
[1708] | 262 | IF( ln_bfr2d ) THEN |
---|
| 263 | IF(lwp) WRITE(numout,*) ' read coef. enhancement distribution from file ln_bfr2d = ', ln_bfr2d |
---|
| 264 | IF(lwp) WRITE(numout,*) ' coef rn_bfri2 enhancement factor rn_bfrien = ',rn_bfrien |
---|
[1662] | 265 | ENDIF |
---|
[4990] | 266 | IF(lwp) WRITE(numout,*) ' top friction coef. rn_bfri1 = ', rn_bfri1 |
---|
| 267 | IF( ln_tfr2d ) THEN |
---|
| 268 | IF(lwp) WRITE(numout,*) ' read coef. enhancement distribution from file ln_tfr2d = ', ln_tfr2d |
---|
| 269 | IF(lwp) WRITE(numout,*) ' coef rn_tfri2 enhancement factor rn_tfrien = ',rn_tfrien |
---|
| 270 | ENDIF |
---|
[1601] | 271 | ! |
---|
[3764] | 272 | IF(ln_bfr2d) THEN |
---|
[1662] | 273 | ! bfr_coef is a coefficient in [0,1] giving the mask where to apply the bfr enhancement |
---|
| 274 | CALL iom_open('bfr_coef.nc',inum) |
---|
| 275 | CALL iom_get (inum, jpdom_data, 'bfr_coef',bfrcoef2d,1) ! bfrcoef2d is used as tmp array |
---|
| 276 | CALL iom_close(inum) |
---|
[2715] | 277 | bfrcoef2d(:,:) = rn_bfri1 * ( 1 + rn_bfrien * bfrcoef2d(:,:) ) |
---|
[4381] | 278 | ELSE |
---|
| 279 | bfrcoef2d(:,:) = rn_bfri1 ! initialize bfrcoef2d to the namelist variable |
---|
[1662] | 280 | ENDIF |
---|
[4381] | 281 | ! |
---|
[1662] | 282 | bfrua(:,:) = - bfrcoef2d(:,:) |
---|
| 283 | bfrva(:,:) = - bfrcoef2d(:,:) |
---|
| 284 | ! |
---|
[3] | 285 | CASE( 2 ) |
---|
[4381] | 286 | IF(lwp) WRITE(numout,*) ' quadratic bottom friction' |
---|
[1708] | 287 | IF(lwp) WRITE(numout,*) ' friction coef. rn_bfri2 = ', rn_bfri2 |
---|
[4381] | 288 | IF(lwp) WRITE(numout,*) ' Max. coef. (log case) rn_bfri2_max = ', rn_bfri2_max |
---|
[1708] | 289 | IF(lwp) WRITE(numout,*) ' background tke rn_bfeb2 = ', rn_bfeb2 |
---|
[4381] | 290 | IF(lwp) WRITE(numout,*) ' log formulation ln_bfr2d = ', ln_loglayer |
---|
| 291 | IF(lwp) WRITE(numout,*) ' bottom roughness rn_bfrz0 [m] = ', rn_bfrz0 |
---|
| 292 | IF( rn_bfrz0<=0.e0 ) THEN |
---|
| 293 | WRITE(ctmp1,*) ' bottom roughness must be strictly positive' |
---|
| 294 | CALL ctl_stop( ctmp1 ) |
---|
| 295 | ENDIF |
---|
[1708] | 296 | IF( ln_bfr2d ) THEN |
---|
| 297 | IF(lwp) WRITE(numout,*) ' read coef. enhancement distribution from file ln_bfr2d = ', ln_bfr2d |
---|
| 298 | IF(lwp) WRITE(numout,*) ' coef rn_bfri2 enhancement factor rn_bfrien = ',rn_bfrien |
---|
[1662] | 299 | ENDIF |
---|
[4990] | 300 | IF(lwp) WRITE(numout,*) ' quadratic top friction' |
---|
| 301 | IF(lwp) WRITE(numout,*) ' friction coef. rn_bfri2 = ', rn_tfri2 |
---|
| 302 | IF(lwp) WRITE(numout,*) ' Max. coef. (log case) rn_tfri2_max = ', rn_tfri2_max |
---|
| 303 | IF(lwp) WRITE(numout,*) ' background tke rn_tfeb2 = ', rn_tfeb2 |
---|
| 304 | IF(lwp) WRITE(numout,*) ' log formulation ln_tfr2d = ', ln_loglayer |
---|
| 305 | IF(lwp) WRITE(numout,*) ' bottom roughness rn_tfrz0 [m] = ', rn_tfrz0 |
---|
| 306 | IF( rn_tfrz0<=0.e0 ) THEN |
---|
| 307 | WRITE(ctmp1,*) ' bottom roughness must be strictly positive' |
---|
| 308 | CALL ctl_stop( ctmp1 ) |
---|
| 309 | ENDIF |
---|
| 310 | IF( ln_tfr2d ) THEN |
---|
| 311 | IF(lwp) WRITE(numout,*) ' read coef. enhancement distribution from file ln_tfr2d = ', ln_tfr2d |
---|
| 312 | IF(lwp) WRITE(numout,*) ' coef rn_tfri2 enhancement factor rn_tfrien = ',rn_tfrien |
---|
| 313 | ENDIF |
---|
[1708] | 314 | ! |
---|
[3764] | 315 | IF(ln_bfr2d) THEN |
---|
[1662] | 316 | ! bfr_coef is a coefficient in [0,1] giving the mask where to apply the bfr enhancement |
---|
| 317 | CALL iom_open('bfr_coef.nc',inum) |
---|
| 318 | CALL iom_get (inum, jpdom_data, 'bfr_coef',bfrcoef2d,1) ! bfrcoef2d is used as tmp array |
---|
| 319 | CALL iom_close(inum) |
---|
[4381] | 320 | ! |
---|
| 321 | bfrcoef2d(:,:) = rn_bfri2 * ( 1 + rn_bfrien * bfrcoef2d(:,:) ) |
---|
| 322 | ELSE |
---|
| 323 | bfrcoef2d(:,:) = rn_bfri2 ! initialize bfrcoef2d to the namelist variable |
---|
[1662] | 324 | ENDIF |
---|
[1601] | 325 | ! |
---|
[4381] | 326 | IF ( ln_loglayer.AND.(.NOT.lk_vvl) ) THEN ! set "log layer" bottom friction once for all |
---|
| 327 | DO jj = 1, jpj |
---|
| 328 | DO ji = 1, jpi |
---|
| 329 | ikbt = mbkt(ji,jj) |
---|
| 330 | ztmp = tmask(ji,jj,ikbt) * ( vkarmn / LOG( 0.5_wp * fse3t_n(ji,jj,ikbt) / rn_bfrz0 ))**2._wp |
---|
| 331 | bfrcoef2d(ji,jj) = MAX(bfrcoef2d(ji,jj), ztmp) |
---|
| 332 | bfrcoef2d(ji,jj) = MIN(bfrcoef2d(ji,jj), rn_bfri2_max) |
---|
| 333 | END DO |
---|
| 334 | END DO |
---|
| 335 | ENDIF |
---|
| 336 | ! |
---|
[3] | 337 | CASE DEFAULT |
---|
[1708] | 338 | IF(lwp) WRITE(ctmp1,*) ' bad flag value for nn_bfr = ', nn_bfr |
---|
[474] | 339 | CALL ctl_stop( ctmp1 ) |
---|
[1601] | 340 | ! |
---|
[3] | 341 | END SELECT |
---|
[4381] | 342 | ! |
---|
| 343 | IF(lwp) WRITE(numout,*) ' implicit bottom friction switch ln_bfrimp = ', ln_bfrimp |
---|
| 344 | ! |
---|
| 345 | ! ! Make sure ln_zdfexp=.false. when use implicit bfr |
---|
| 346 | IF( ln_bfrimp .AND. ln_zdfexp ) THEN |
---|
[3820] | 347 | IF(lwp) THEN |
---|
| 348 | WRITE(numout,*) |
---|
[4381] | 349 | WRITE(numout,*) 'Implicit bottom friction can only be used when ln_zdfexp=.false.' |
---|
| 350 | WRITE(numout,*) ' but you set: ln_bfrimp=.true. and ln_zdfexp=.true.!!!!' |
---|
| 351 | WRITE(ctmp1,*) ' set either ln_zdfexp = .false or ln_bfrimp = .false.' |
---|
[3820] | 352 | CALL ctl_stop( ctmp1 ) |
---|
| 353 | END IF |
---|
| 354 | END IF |
---|
[1601] | 355 | ! |
---|
[1662] | 356 | ! Basic stability check on bottom friction coefficient |
---|
| 357 | ! |
---|
| 358 | ictu = 0 ! counter for stability criterion breaches at U-pts |
---|
| 359 | ictv = 0 ! counter for stability criterion breaches at V-pts |
---|
[1708] | 360 | zminbfr = 1.e10_wp ! initialise tracker for minimum of bottom friction coefficient |
---|
| 361 | zmaxbfr = -1.e10_wp ! initialise tracker for maximum of bottom friction coefficient |
---|
[4990] | 362 | zmintfr = 1.e10_wp ! initialise tracker for minimum of bottom friction coefficient |
---|
| 363 | zmaxtfr = -1.e10_wp ! initialise tracker for maximum of bottom friction coefficient |
---|
[1662] | 364 | ! |
---|
| 365 | DO jj = 2, jpjm1 |
---|
| 366 | DO ji = 2, jpim1 |
---|
[2528] | 367 | ikbu = mbku(ji,jj) ! deepest ocean level at u- and v-points |
---|
| 368 | ikbv = mbkv(ji,jj) |
---|
| 369 | zfru = 0.5 * fse3u(ji,jj,ikbu) / rdt |
---|
| 370 | zfrv = 0.5 * fse3v(ji,jj,ikbv) / rdt |
---|
[1708] | 371 | IF( ABS( bfrcoef2d(ji,jj) ) > zfru ) THEN |
---|
| 372 | IF( ln_ctl ) THEN |
---|
[2528] | 373 | WRITE(numout,*) 'BFR ', narea, nimpp+ji, njmpp+jj, ikbu |
---|
| 374 | WRITE(numout,*) 'BFR ', ABS( bfrcoef2d(ji,jj) ), zfru |
---|
[1662] | 375 | ENDIF |
---|
| 376 | ictu = ictu + 1 |
---|
| 377 | ENDIF |
---|
[1708] | 378 | IF( ABS( bfrcoef2d(ji,jj) ) > zfrv ) THEN |
---|
| 379 | IF( ln_ctl ) THEN |
---|
| 380 | WRITE(numout,*) 'BFR ', narea, nimpp+ji, njmpp+jj, ikbv |
---|
| 381 | WRITE(numout,*) 'BFR ', bfrcoef2d(ji,jj), zfrv |
---|
[1662] | 382 | ENDIF |
---|
| 383 | ictv = ictv + 1 |
---|
| 384 | ENDIF |
---|
[1708] | 385 | zminbfr = MIN( zminbfr, MIN( zfru, ABS( bfrcoef2d(ji,jj) ) ) ) |
---|
| 386 | zmaxbfr = MAX( zmaxbfr, MIN( zfrv, ABS( bfrcoef2d(ji,jj) ) ) ) |
---|
[1662] | 387 | END DO |
---|
| 388 | END DO |
---|
[1708] | 389 | IF( lk_mpp ) THEN |
---|
[1662] | 390 | CALL mpp_sum( ictu ) |
---|
| 391 | CALL mpp_sum( ictv ) |
---|
[1708] | 392 | CALL mpp_min( zminbfr ) |
---|
| 393 | CALL mpp_max( zmaxbfr ) |
---|
[1662] | 394 | ENDIF |
---|
[3294] | 395 | IF( .NOT.ln_bfrimp) THEN |
---|
[2528] | 396 | IF( lwp .AND. ictu + ictv > 0 ) THEN |
---|
[1662] | 397 | WRITE(numout,*) ' Bottom friction stability check failed at ', ictu, ' U-points ' |
---|
| 398 | WRITE(numout,*) ' Bottom friction stability check failed at ', ictv, ' V-points ' |
---|
[1708] | 399 | WRITE(numout,*) ' Bottom friction coefficient now ranges from: ', zminbfr, ' to ', zmaxbfr |
---|
[4990] | 400 | WRITE(numout,*) ' Bottom friction coefficient now ranges from: ', zmintfr, ' to ', zmaxtfr |
---|
[1708] | 401 | WRITE(numout,*) ' Bottom friction coefficient will be reduced where necessary' |
---|
[1662] | 402 | ENDIF |
---|
[3294] | 403 | ENDIF |
---|
[1662] | 404 | ! |
---|
[3294] | 405 | IF( nn_timing == 1 ) CALL timing_stop('zdf_bfr_init') |
---|
| 406 | ! |
---|
[3] | 407 | END SUBROUTINE zdf_bfr_init |
---|
| 408 | |
---|
| 409 | !!====================================================================== |
---|
| 410 | END MODULE zdfbfr |
---|