[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 |
---|
[1601] | 9 | !!---------------------------------------------------------------------- |
---|
[3] | 10 | |
---|
| 11 | !!---------------------------------------------------------------------- |
---|
[1601] | 12 | !! zdf_bfr : update momentum Kz at the ocean bottom due to the type of bottom friction chosen |
---|
| 13 | !! zdf_bfr_init : read in namelist and control the bottom friction parameters. |
---|
[1662] | 14 | !! zdf_bfr_2d : read in namelist and control the bottom friction |
---|
| 15 | !! parameters. |
---|
[3] | 16 | !!---------------------------------------------------------------------- |
---|
| 17 | USE oce ! ocean dynamics and tracers variables |
---|
| 18 | USE dom_oce ! ocean space and time domain variables |
---|
| 19 | USE zdf_oce ! ocean vertical physics variables |
---|
| 20 | USE in_out_manager ! I/O manager |
---|
| 21 | USE lbclnk ! ocean lateral boundary conditions (or mpp link) |
---|
[1671] | 22 | USE lib_mpp ! distributed memory computing |
---|
[258] | 23 | USE prtctl ! Print control |
---|
[3] | 24 | |
---|
| 25 | IMPLICIT NONE |
---|
| 26 | PRIVATE |
---|
| 27 | |
---|
[1601] | 28 | PUBLIC zdf_bfr ! called by step.F90 |
---|
[1708] | 29 | |
---|
| 30 | REAL(wp), PUBLIC, DIMENSION(jpi,jpj) :: bfrua , bfrva !: Bottom friction coefficients set in zdfbfr |
---|
[3] | 31 | |
---|
[1708] | 32 | ! !!* Namelist nambfr: bottom friction namelist * |
---|
| 33 | INTEGER :: nn_bfr = 0 ! = 0/1/2/3 type of bottom friction |
---|
| 34 | REAL(wp) :: rn_bfri1 = 4.0e-4_wp ! bottom drag coefficient (linear case) |
---|
| 35 | REAL(wp) :: rn_bfri2 = 1.0e-3_wp ! bottom drag coefficient (non linear case) |
---|
| 36 | REAL(wp) :: rn_bfeb2 = 2.5e-3_wp ! background bottom turbulent kinetic energy [m2/s2] |
---|
| 37 | REAL(wp) :: rn_bfrien = 30_wp ! local factor to enhance coefficient bfri |
---|
| 38 | LOGICAL :: ln_bfr2d = .false. ! logical switch for 2D enhancement |
---|
| 39 | |
---|
| 40 | REAL(wp), DIMENSION(jpi,jpj) :: bfrcoef2d = 1.e-3_wp ! 2D bottom drag coefficient |
---|
[3] | 41 | |
---|
| 42 | !! * Substitutions |
---|
| 43 | # include "domzgr_substitute.h90" |
---|
| 44 | !!---------------------------------------------------------------------- |
---|
[1601] | 45 | !! NEMO/OPA 3.2 , LOCEAN-IPSL (2009) |
---|
[1152] | 46 | !! $Id$ |
---|
[1601] | 47 | !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt) |
---|
[3] | 48 | !!---------------------------------------------------------------------- |
---|
| 49 | |
---|
| 50 | CONTAINS |
---|
| 51 | |
---|
| 52 | SUBROUTINE zdf_bfr( kt ) |
---|
| 53 | !!---------------------------------------------------------------------- |
---|
| 54 | !! *** ROUTINE zdf_bfr *** |
---|
| 55 | !! |
---|
[1708] | 56 | !! ** Purpose : compute the bottom friction coefficient. |
---|
[3] | 57 | !! |
---|
[1662] | 58 | !! ** Method : Calculate and store part of the momentum trend due |
---|
| 59 | !! to bottom friction following the chosen friction type |
---|
| 60 | !! (free-slip, linear, or quadratic). The component |
---|
| 61 | !! calculated here is multiplied by the bottom velocity in |
---|
| 62 | !! dyn_bfr to provide the trend term. |
---|
[1708] | 63 | !! The coefficients are updated at each time step only |
---|
| 64 | !! in the quadratic case. |
---|
[1662] | 65 | !! |
---|
| 66 | !! ** Action : bfrua , bfrva bottom friction coefficients |
---|
[3] | 67 | !!---------------------------------------------------------------------- |
---|
| 68 | INTEGER, INTENT( in ) :: kt ! ocean time-step index |
---|
[1601] | 69 | !! |
---|
[1708] | 70 | INTEGER :: ji, jj ! dummy loop indices |
---|
[1662] | 71 | INTEGER :: ikbu, ikbum1 ! temporary integers |
---|
[1708] | 72 | INTEGER :: ikbv, ikbvm1 ! - - |
---|
[1662] | 73 | REAL(wp) :: zvu, zuv, zecu, zecv ! temporary scalars |
---|
[3] | 74 | !!---------------------------------------------------------------------- |
---|
| 75 | |
---|
| 76 | |
---|
[1662] | 77 | IF( kt == nit000 ) CALL zdf_bfr_init ! initialisation |
---|
[3] | 78 | |
---|
[1662] | 79 | IF( nn_bfr == 2 ) THEN ! quadratic botton friction |
---|
[1708] | 80 | ! Calculate and store the quadratic bottom friction coefficient bfrua and bfrva |
---|
[1662] | 81 | ! where bfrUa = C_d*SQRT(u_bot^2 + v_bot^2 + e_b) {U=[u,v]} |
---|
| 82 | ! from these the trend due to bottom friction: -F_h/e3U can be calculated |
---|
| 83 | ! where -F_h/e3U_bot = bfrUa*Ub/e3U_bot {U=[u,v]} |
---|
| 84 | ! |
---|
[789] | 85 | # if defined key_vectopt_loop |
---|
[1601] | 86 | DO jj = 1, 1 |
---|
[3] | 87 | !CDIR NOVERRCHK |
---|
[1601] | 88 | DO ji = jpi+2, jpij-jpi-1 ! vector opt. (forced unrolling) |
---|
[3] | 89 | # else |
---|
| 90 | !CDIR NOVERRCHK |
---|
| 91 | DO jj = 2, jpjm1 |
---|
| 92 | !CDIR NOVERRCHK |
---|
| 93 | DO ji = 2, jpim1 |
---|
| 94 | # endif |
---|
| 95 | ikbu = MIN( mbathy(ji+1,jj ), mbathy(ji,jj) ) |
---|
| 96 | ikbv = MIN( mbathy(ji ,jj+1), mbathy(ji,jj) ) |
---|
| 97 | ikbum1 = MAX( ikbu-1, 1 ) |
---|
| 98 | ikbvm1 = MAX( ikbv-1, 1 ) |
---|
[1662] | 99 | ! |
---|
[3] | 100 | zvu = 0.25 * ( vn(ji,jj ,ikbum1) + vn(ji+1,jj ,ikbum1) & |
---|
[1662] | 101 | & + vn(ji,jj-1,ikbum1) + vn(ji+1,jj-1,ikbum1) ) |
---|
[3] | 102 | zuv = 0.25 * ( un(ji,jj ,ikbvm1) + un(ji-1,jj ,ikbvm1) & |
---|
[1662] | 103 | & + un(ji,jj+1,ikbvm1) + un(ji-1,jj+1,ikbvm1) ) |
---|
| 104 | ! |
---|
[1601] | 105 | zecu = SQRT( un(ji,jj,ikbum1) * un(ji,jj,ikbum1) + zvu*zvu + rn_bfeb2 ) |
---|
| 106 | zecv = SQRT( vn(ji,jj,ikbvm1) * vn(ji,jj,ikbvm1) + zuv*zuv + rn_bfeb2 ) |
---|
[1662] | 107 | ! |
---|
[1708] | 108 | bfrua(ji,jj) = - 0.5 * ( bfrcoef2d(ji,jj) + bfrcoef2d(ji+1,jj ) ) * zecu |
---|
| 109 | bfrva(ji,jj) = - 0.5 * ( bfrcoef2d(ji,jj) + bfrcoef2d(ji ,jj+1) ) * zecv |
---|
[3] | 110 | END DO |
---|
| 111 | END DO |
---|
[1601] | 112 | ! |
---|
[1708] | 113 | CALL lbc_lnk( bfrua, 'U', 1. ) ; CALL lbc_lnk( bfrva, 'V', 1. ) ! Lateral boundary condition |
---|
| 114 | ! |
---|
| 115 | IF(ln_ctl) CALL prt_ctl( tab2d_1=bfrua, clinfo1=' bfr - u: ', mask1=umask, & |
---|
| 116 | & tab2d_2=bfrva, clinfo2= ' v: ', mask2=vmask,ovlap=1 ) |
---|
[1662] | 117 | ENDIF |
---|
| 118 | ! |
---|
[3] | 119 | END SUBROUTINE zdf_bfr |
---|
| 120 | |
---|
| 121 | |
---|
| 122 | SUBROUTINE zdf_bfr_init |
---|
| 123 | !!---------------------------------------------------------------------- |
---|
| 124 | !! *** ROUTINE zdf_bfr_init *** |
---|
| 125 | !! |
---|
| 126 | !! ** Purpose : Initialization of the bottom friction |
---|
| 127 | !! |
---|
| 128 | !! ** Method : Read the nammbf namelist and check their consistency |
---|
[1662] | 129 | !! called at the first timestep (nit000) |
---|
[3] | 130 | !!---------------------------------------------------------------------- |
---|
[1662] | 131 | USE iom ! I/O module for ehanced bottom friction file |
---|
| 132 | !! |
---|
[1708] | 133 | INTEGER :: inum ! logical unit for enhanced bottom friction file |
---|
| 134 | INTEGER :: ji, jj ! dummy loop indexes |
---|
| 135 | INTEGER :: ikbu, ikbv ! temporary integers |
---|
| 136 | INTEGER :: ictu, ictv ! - - |
---|
| 137 | REAL(wp) :: zminbfr, zmaxbfr ! temporary scalars |
---|
| 138 | REAL(wp) :: zfru, zfrv ! - - |
---|
| 139 | !! |
---|
[1662] | 140 | NAMELIST/nambfr/ nn_bfr, rn_bfri1, rn_bfri2, rn_bfeb2, ln_bfr2d, rn_bfrien |
---|
[3] | 141 | !!---------------------------------------------------------------------- |
---|
| 142 | |
---|
[1662] | 143 | REWIND ( numnam ) !* Read Namelist nam_bfr : bottom momentum boundary condition |
---|
| 144 | READ ( numnam, nambfr ) |
---|
[3] | 145 | |
---|
[1662] | 146 | ! !* Parameter control and print |
---|
| 147 | IF(lwp) WRITE(numout,*) |
---|
[3] | 148 | IF(lwp) WRITE(numout,*) 'zdf_bfr : momentum bottom friction' |
---|
| 149 | IF(lwp) WRITE(numout,*) '~~~~~~~' |
---|
[1708] | 150 | IF(lwp) WRITE(numout,*) ' Namelist nam_bfr : set bottom friction parameters' |
---|
[3] | 151 | |
---|
[1662] | 152 | SELECT CASE (nn_bfr) |
---|
| 153 | |
---|
[3] | 154 | CASE( 0 ) |
---|
[1708] | 155 | IF(lwp) WRITE(numout,*) ' free-slip ' |
---|
[1662] | 156 | bfrua(:,:) = 0.e0 |
---|
| 157 | bfrva(:,:) = 0.e0 |
---|
| 158 | ! |
---|
[3] | 159 | CASE( 1 ) |
---|
[1708] | 160 | IF(lwp) WRITE(numout,*) ' linear botton friction' |
---|
| 161 | IF(lwp) WRITE(numout,*) ' friction coef. rn_bfri1 = ', rn_bfri1 |
---|
| 162 | IF( ln_bfr2d ) THEN |
---|
| 163 | IF(lwp) WRITE(numout,*) ' read coef. enhancement distribution from file ln_bfr2d = ', ln_bfr2d |
---|
| 164 | IF(lwp) WRITE(numout,*) ' coef rn_bfri2 enhancement factor rn_bfrien = ',rn_bfrien |
---|
[1662] | 165 | ENDIF |
---|
[1601] | 166 | ! |
---|
[1662] | 167 | bfrcoef2d(:,:) = rn_bfri1 ! initialize bfrcoef2d to the namelist variable |
---|
[1708] | 168 | ! |
---|
| 169 | IF(ln_bfr2d) THEN |
---|
[1662] | 170 | ! bfr_coef is a coefficient in [0,1] giving the mask where to apply the bfr enhancement |
---|
| 171 | CALL iom_open('bfr_coef.nc',inum) |
---|
| 172 | CALL iom_get (inum, jpdom_data, 'bfr_coef',bfrcoef2d,1) ! bfrcoef2d is used as tmp array |
---|
| 173 | CALL iom_close(inum) |
---|
[1708] | 174 | bfrcoef2d(:,:)= rn_bfri1 * ( 1 + rn_bfrien * bfrcoef2d(:,:) ) |
---|
[1662] | 175 | ENDIF |
---|
| 176 | bfrua(:,:) = - bfrcoef2d(:,:) |
---|
| 177 | bfrva(:,:) = - bfrcoef2d(:,:) |
---|
| 178 | ! |
---|
[3] | 179 | CASE( 2 ) |
---|
[1708] | 180 | IF(lwp) WRITE(numout,*) ' quadratic botton friction' |
---|
| 181 | IF(lwp) WRITE(numout,*) ' friction coef. rn_bfri2 = ', rn_bfri2 |
---|
| 182 | IF(lwp) WRITE(numout,*) ' background tke rn_bfeb2 = ', rn_bfeb2 |
---|
| 183 | IF( ln_bfr2d ) THEN |
---|
| 184 | IF(lwp) WRITE(numout,*) ' read coef. enhancement distribution from file ln_bfr2d = ', ln_bfr2d |
---|
| 185 | IF(lwp) WRITE(numout,*) ' coef rn_bfri2 enhancement factor rn_bfrien = ',rn_bfrien |
---|
[1662] | 186 | ENDIF |
---|
| 187 | bfrcoef2d(:,:) = rn_bfri2 ! initialize bfrcoef2d to the namelist variable |
---|
[1708] | 188 | ! |
---|
| 189 | IF(ln_bfr2d) THEN |
---|
[1662] | 190 | ! bfr_coef is a coefficient in [0,1] giving the mask where to apply the bfr enhancement |
---|
| 191 | CALL iom_open('bfr_coef.nc',inum) |
---|
| 192 | CALL iom_get (inum, jpdom_data, 'bfr_coef',bfrcoef2d,1) ! bfrcoef2d is used as tmp array |
---|
| 193 | CALL iom_close(inum) |
---|
[1708] | 194 | bfrcoef2d(:,:)= rn_bfri2 * ( 1 + rn_bfrien * bfrcoef2d(:,:) ) |
---|
[1662] | 195 | ENDIF |
---|
[1601] | 196 | ! |
---|
[3] | 197 | CASE DEFAULT |
---|
[1708] | 198 | IF(lwp) WRITE(ctmp1,*) ' bad flag value for nn_bfr = ', nn_bfr |
---|
[474] | 199 | CALL ctl_stop( ctmp1 ) |
---|
[1601] | 200 | ! |
---|
[3] | 201 | END SELECT |
---|
[1601] | 202 | ! |
---|
[1662] | 203 | ! Basic stability check on bottom friction coefficient |
---|
| 204 | ! |
---|
| 205 | ictu = 0 ! counter for stability criterion breaches at U-pts |
---|
| 206 | ictv = 0 ! counter for stability criterion breaches at V-pts |
---|
[1708] | 207 | zminbfr = 1.e10_wp ! initialise tracker for minimum of bottom friction coefficient |
---|
| 208 | zmaxbfr = -1.e10_wp ! initialise tracker for maximum of bottom friction coefficient |
---|
[1662] | 209 | ! |
---|
| 210 | # if defined key_vectopt_loop |
---|
| 211 | DO jj = 1, 1 |
---|
| 212 | !CDIR NOVERRCHK |
---|
| 213 | DO ji = jpi+2, jpij-jpi-1 ! vector opt. (forced unrolling) |
---|
| 214 | # else |
---|
| 215 | !CDIR NOVERRCHK |
---|
| 216 | DO jj = 2, jpjm1 |
---|
| 217 | !CDIR NOVERRCHK |
---|
| 218 | DO ji = 2, jpim1 |
---|
| 219 | # endif |
---|
[1708] | 220 | ikbu = MIN( mbathy(ji+1,jj ), mbathy(ji,jj) ) |
---|
| 221 | ikbv = MIN( mbathy(ji ,jj+1), mbathy(ji,jj) ) |
---|
| 222 | zfru = 0.5 * fse3u(ji,jj,ikbu) / rdt |
---|
| 223 | zfrv = 0.5 * fse3v(ji,jj,ikbv) / rdt |
---|
| 224 | IF( ABS( bfrcoef2d(ji,jj) ) > zfru ) THEN |
---|
| 225 | IF( ln_ctl ) THEN |
---|
| 226 | WRITE(numout,*) 'BFR ',narea,nimpp+ji,njmpp+jj,ikbu |
---|
| 227 | WRITE(numout,*) 'BFR ',ABS( bfrcoef2d(ji,jj) ), zfru |
---|
[1662] | 228 | ENDIF |
---|
| 229 | ictu = ictu + 1 |
---|
| 230 | ENDIF |
---|
[1708] | 231 | IF( ABS( bfrcoef2d(ji,jj) ) > zfrv ) THEN |
---|
| 232 | IF( ln_ctl ) THEN |
---|
| 233 | WRITE(numout,*) 'BFR ', narea, nimpp+ji, njmpp+jj, ikbv |
---|
| 234 | WRITE(numout,*) 'BFR ', bfrcoef2d(ji,jj), zfrv |
---|
[1662] | 235 | ENDIF |
---|
| 236 | ictv = ictv + 1 |
---|
| 237 | ENDIF |
---|
[1708] | 238 | zminbfr = MIN( zminbfr, MIN( zfru, ABS( bfrcoef2d(ji,jj) ) ) ) |
---|
| 239 | zmaxbfr = MAX( zmaxbfr, MIN( zfrv, ABS( bfrcoef2d(ji,jj) ) ) ) |
---|
[1662] | 240 | END DO |
---|
| 241 | END DO |
---|
[1708] | 242 | IF( lk_mpp ) THEN |
---|
[1662] | 243 | CALL mpp_sum( ictu ) |
---|
| 244 | CALL mpp_sum( ictv ) |
---|
[1708] | 245 | CALL mpp_min( zminbfr ) |
---|
| 246 | CALL mpp_max( zmaxbfr ) |
---|
[1662] | 247 | ENDIF |
---|
[1708] | 248 | IF( lwp .AND. ictu + ictv .GT. 0 ) THEN |
---|
[1662] | 249 | WRITE(numout,*) ' Bottom friction stability check failed at ', ictu, ' U-points ' |
---|
| 250 | WRITE(numout,*) ' Bottom friction stability check failed at ', ictv, ' V-points ' |
---|
[1708] | 251 | WRITE(numout,*) ' Bottom friction coefficient now ranges from: ', zminbfr, ' to ', zmaxbfr |
---|
| 252 | WRITE(numout,*) ' Bottom friction coefficient will be reduced where necessary' |
---|
[1662] | 253 | ENDIF |
---|
| 254 | ! |
---|
[3] | 255 | END SUBROUTINE zdf_bfr_init |
---|
| 256 | |
---|
| 257 | !!====================================================================== |
---|
| 258 | END MODULE zdfbfr |
---|