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.
Changeset 2528 for trunk/NEMOGCM/NEMO/OPA_SRC/ZDF/zdftke.F90 – NEMO

Ignore:
Timestamp:
2010-12-27T18:33:53+01:00 (13 years ago)
Author:
rblod
Message:

Update NEMOGCM from branch nemo_v3_3_beta

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/NEMOGCM/NEMO/OPA_SRC/ZDF/zdftke.F90

    • Property svn:keywords set to Id
    r1756 r2528  
    2525   !!            3.2  !  2009-06  (G. Madec, S. Masson) TKE restart compatible with key_cpl  
    2626   !!                 !                                + cleaning of the parameters + bugs correction 
     27   !!            3.3  !  2010-10  (C. Ethe, G. Madec) reorganisation of initialisation phase 
    2728   !!---------------------------------------------------------------------- 
    2829#if defined key_zdftke   ||   defined key_esopa 
     
    3031   !!   'key_zdftke'                                   TKE vertical physics 
    3132   !!---------------------------------------------------------------------- 
    32    !!   zdf_tke       : update momentum and tracer Kz from a tke scheme 
    33    !!   tke_tke       : tke time stepping: update tke at now time step (en) 
    34    !!   tke_avn       : compute mixing length scale and deduce avm and avt 
    35    !!   tke_init      : initialization, namelist read, and parameters control 
    36    !!   tke_rst       : read/write tke restart in ocean restart file 
     33   !!   zdf_tke      : update momentum and tracer Kz from a tke scheme 
     34   !!   tke_tke      : tke time stepping: update tke at now time step (en) 
     35   !!   tke_avn      : compute mixing length scale and deduce avm and avt 
     36   !!   zdf_tke_init : initialization, namelist read, and parameters control 
     37   !!   tke_rst      : read/write tke restart in ocean restart file 
    3738   !!---------------------------------------------------------------------- 
    38    USE oce            ! ocean dynamics and active tracers  
    39    USE dom_oce        ! ocean space and time domain 
    40    USE domvvl         ! ocean space and time domain : variable volume layer 
    41    USE zdf_oce        ! ocean vertical physics 
     39   USE oce            ! ocean: dynamics and active tracers variables 
     40   USE phycst         ! physical constants 
     41   USE dom_oce        ! domain: ocean 
     42   USE domvvl         ! domain: variable volume layer 
    4243   USE sbc_oce        ! surface boundary condition: ocean 
    43    USE phycst         ! physical constants 
    44    USE zdfmxl         ! mixed layer 
    45    USE restart        ! only for lrst_oce 
     44   USE zdf_oce        ! vertical physics: ocean variables 
     45   USE zdfmxl         ! vertical physics: mixed layer 
     46   USE restart        ! ocean restart 
    4647   USE lbclnk         ! ocean lateral boundary conditions (or mpp link) 
    4748   USE prtctl         ! Print control 
    4849   USE in_out_manager ! I/O manager 
    4950   USE iom            ! I/O manager library 
    50    USE zdfbfr          ! bottom friction 
    5151 
    5252   IMPLICIT NONE 
    5353   PRIVATE 
    5454 
    55    PUBLIC   zdf_tke    ! routine called in step module 
    56    PUBLIC   tke_rst    ! routine called in step module 
     55   PUBLIC   zdf_tke        ! routine called in step module 
     56   PUBLIC   zdf_tke_init   ! routine called in opa module 
     57   PUBLIC   tke_rst        ! routine called in step module 
    5758 
    5859   LOGICAL , PUBLIC, PARAMETER              ::   lk_zdftke = .TRUE.  !: TKE vertical mixing flag 
    5960 
    6061#if defined key_c1d 
    61    !                                                                !!* 1D cfg only * 
    62    REAL(wp), PUBLIC, DIMENSION(jpi,jpj,jpk) ::   e_dis, e_mix        !: dissipation and mixing turbulent lengh scales 
    63    REAL(wp), PUBLIC, DIMENSION(jpi,jpj,jpk) ::   e_pdl, e_ric        !: prandl and local Richardson numbers 
     62   !                                                           !!** 1D cfg only  **   ('key_c1d') 
     63   REAL(wp), PUBLIC, DIMENSION(jpi,jpj,jpk) ::   e_dis, e_mix   !: dissipation and mixing turbulent lengh scales 
     64   REAL(wp), PUBLIC, DIMENSION(jpi,jpj,jpk) ::   e_pdl, e_ric   !: prandl and local Richardson numbers 
    6465#endif 
    6566 
    66    !                                       !!! ** Namelist  namzdf_tke  ** 
    67    LOGICAL  ::   ln_mxl0   = .FALSE.         ! mixing length scale surface value as function of wind stress or not 
    68    INTEGER  ::   nn_mxl    =  2              ! type of mixing length (=0/1/2/3) 
    69    REAL(wp) ::   rn_lmin0  = 0.4_wp          ! surface  min value of mixing length   [m] 
    70    REAL(wp) ::   rn_lmin   = 0.1_wp          ! interior min value of mixing length   [m] 
    71    INTEGER  ::   nn_pdl    =  1              ! Prandtl number or not (ratio avt/avm) (=0/1) 
    72    REAL(wp) ::   rn_ediff  = 0.1_wp          ! coefficient for avt: avt=rn_ediff*mxl*sqrt(e) 
    73    REAL(wp) ::   rn_ediss  = 0.7_wp          ! coefficient of the Kolmogoroff dissipation  
    74    REAL(wp) ::   rn_ebb    = 3.75_wp         ! coefficient of the surface input of tke 
    75    REAL(wp) ::   rn_emin   = 0.7071e-6_wp    ! minimum value of tke           [m2/s2] 
    76    REAL(wp) ::   rn_emin0  = 1.e-4_wp        ! surface minimum value of tke   [m2/s2] 
    77    REAL(wp) ::   rn_bshear = 1.e-20          ! background shear (>0) 
    78    INTEGER  ::   nn_etau   = 0               ! type of depth penetration of surface tke (=0/1/2) 
    79    INTEGER  ::   nn_htau   = 0               ! type of tke profile of penetration (=0/1) 
    80    REAL(wp) ::   rn_efr    = 1.0_wp          ! fraction of TKE surface value which penetrates in the ocean 
    81    REAL(wp) ::   rn_addhft = 0.0_wp          ! add offset   applied to HF tau 
    82    REAL(wp) ::   rn_sclhft = 1.0_wp          ! scale factor applied to HF tau 
    83    LOGICAL  ::   ln_lc     = .FALSE.         ! Langmuir cells (LC) as a source term of TKE or not 
    84    REAL(wp) ::   rn_lc     = 0.15_wp         ! coef to compute vertical velocity of Langmuir cells 
    85  
    86    REAL(wp) ::   ri_cri   ! critic Richardson number (deduced from rn_ediff and rn_ediss values) 
    87  
    88    REAL(wp), DIMENSION(jpi,jpj)     ::   htau      ! depth of tke penetration (nn_htau) 
    89    REAL(wp), DIMENSION(jpi,jpj,jpk) ::   en        ! now turbulent kinetic energy   [m2/s2] 
    90    REAL(wp), DIMENSION(jpi,jpj,jpk) ::   dissl     ! now mixing lenght of dissipation 
     67   !                                      !!** Namelist  namzdf_tke  ** 
     68   LOGICAL  ::   ln_mxl0   = .FALSE.       ! mixing length scale surface value as function of wind stress or not 
     69   INTEGER  ::   nn_mxl    =  2            ! type of mixing length (=0/1/2/3) 
     70   REAL(wp) ::   rn_mxl0   = 0.04_wp       ! surface  min value of mixing length (kappa*z_o=0.4*0.1 m)  [m] 
     71   INTEGER  ::   nn_pdl    =  1            ! Prandtl number or not (ratio avt/avm) (=0/1) 
     72   REAL(wp) ::   rn_ediff  = 0.1_wp        ! coefficient for avt: avt=rn_ediff*mxl*sqrt(e) 
     73   REAL(wp) ::   rn_ediss  = 0.7_wp        ! coefficient of the Kolmogoroff dissipation  
     74   REAL(wp) ::   rn_ebb    = 3.75_wp       ! coefficient of the surface input of tke 
     75   REAL(wp) ::   rn_emin   = 0.7071e-6_wp  ! minimum value of tke           [m2/s2] 
     76   REAL(wp) ::   rn_emin0  = 1.e-4_wp      ! surface minimum value of tke   [m2/s2] 
     77   REAL(wp) ::   rn_bshear = 1.e-20_wp     ! background shear (>0) currently a numerical threshold (do not change it) 
     78   INTEGER  ::   nn_etau   = 0             ! type of depth penetration of surface tke (=0/1/2/3) 
     79   INTEGER  ::   nn_htau   = 0             ! type of tke profile of penetration (=0/1) 
     80   REAL(wp) ::   rn_efr    = 1.0_wp        ! fraction of TKE surface value which penetrates in the ocean 
     81   LOGICAL  ::   ln_lc     = .FALSE.       ! Langmuir cells (LC) as a source term of TKE or not 
     82   REAL(wp) ::   rn_lc     = 0.15_wp       ! coef to compute vertical velocity of Langmuir cells 
     83 
     84   REAL(wp) ::   ri_cri                    ! critic Richardson number (deduced from rn_ediff and rn_ediss values) 
     85   REAL(wp) ::   rmxl_min                  ! minimum mixing length value (deduced from rn_ediff and rn_emin values)  [m] 
     86   REAL(wp) ::   rhftau_add = 1.e-3_wp     ! add offset   applied to HF part of taum  (nn_etau=3) 
     87   REAL(wp) ::   rhftau_scl = 1.0_wp       ! scale factor applied to HF part of taum  (nn_etau=3) 
     88 
     89   REAL(wp), DIMENSION(jpi,jpj,jpk), PUBLIC ::   en   ! now turbulent kinetic energy   [m2/s2] 
     90    
     91   REAL(wp), DIMENSION(jpi,jpj)     ::   htau    ! depth of tke penetration (nn_htau) 
     92   REAL(wp), DIMENSION(jpi,jpj,jpk) ::   dissl   ! now mixing lenght of dissipation 
    9193 
    9294   !! * Substitutions 
     
    9496#  include "vectopt_loop_substitute.h90" 
    9597   !!---------------------------------------------------------------------- 
    96    !! NEMO/OPA 3.2 , LOCEAN-IPSL (2009)  
    97    !! $Id: zdftke2.F90 1201 2008-09-24 13:24:21Z rblod $ 
    98    !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt) 
     98   !! NEMO/OPA 3.3 , NEMO Consortium (2010) 
     99   !! $Id$ 
     100   !! Software governed by the CeCILL licence     (NEMOGCM/NEMO_CeCILL.txt) 
    99101   !!---------------------------------------------------------------------- 
    100  
    101102CONTAINS 
    102103 
     
    149150      !!---------------------------------------------------------------------- 
    150151      ! 
    151       IF( kt == nit000 )   CALL tke_init     ! initialisation  
    152                            ! 
    153                            CALL tke_tke      ! now tke (en) 
    154                            ! 
    155                            CALL tke_avn      ! now avt, avm, avmu, avmv 
     152      CALL tke_tke      ! now tke (en) 
     153      ! 
     154      CALL tke_avn      ! now avt, avm, avmu, avmv 
    156155      ! 
    157156   END SUBROUTINE zdf_tke 
     
    165164      !! 
    166165      !! ** Method  : - TKE surface boundary condition 
    167       !!              - source term due to Langmuir cells (ln_lc=T) 
     166      !!              - source term due to Langmuir cells (Axell JGR 2002) (ln_lc=T) 
    168167      !!              - source term due to shear (saved in avmu, avmv arrays) 
    169168      !!              - Now TKE : resolution of the TKE equation by inverting 
     
    180179      !! 
    181180      INTEGER  ::   ji, jj, jk                      ! dummy loop arguments 
    182 !!$      INTEGER  ::   ikbu, ikbv, ikbum1, ikbvm1      ! temporary scalar 
    183 !!$      INTEGER  ::   ikbt, ikbumm1, ikbvmm1          ! temporary scalar 
     181!!bfr      INTEGER  ::   ikbu, ikbv, ikbum1, ikbvm1      ! temporary scalar 
     182!!bfr      INTEGER  ::   ikbt, ikbumm1, ikbvmm1          ! temporary scalar 
    184183      REAL(wp) ::   zrhoa  = 1.22                   ! Air density kg/m3 
    185184      REAL(wp) ::   zcdrag = 1.5e-3                 ! drag coefficient 
     
    190189      REAL(wp) ::   zus   , zwlc  , zind            !    -         - 
    191190      REAL(wp) ::   zzd_up, zzd_lw                  !    -         - 
    192 !!$      REAL(wp) ::   zebot                           !    -         - 
     191!!bfr      REAL(wp) ::   zebot                           !    -         - 
    193192      INTEGER , DIMENSION(jpi,jpj)     ::   imlc    ! 2D workspace 
    194193      REAL(wp), DIMENSION(jpi,jpj)     ::   zhlc    !  -      - 
     
    197196      ! 
    198197      zbbrau = rn_ebb / rau0       ! Local constant initialisation 
    199       zfact1 = -.5 * rdt  
    200       zfact2 = 1.5 * rdt * rn_ediss 
    201       zfact3 = 0.5       * rn_ediss 
     198      zfact1 = -.5_wp * rdt  
     199      zfact2 = 1.5_wp * rdt * rn_ediss 
     200      zfact3 = 0.5_wp       * rn_ediss 
    202201      ! 
    203202      !                     !<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< 
     
    209208         END DO 
    210209      END DO 
    211       ! 
     210       
     211!!bfr   - start commented area 
    212212      !                     !<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< 
    213213      !                     !  Bottom boundary condition on tke 
     
    219219      ! computational cost is justified 
    220220      !<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< 
    221       ! 
    222221      !                     en(bot)   = (rn_ebb0/rau0)*0.5*sqrt(u_botfr^2+v_botfr^2) (min value rn_emin) 
    223222!CDIR NOVERRCHK 
     
    225224!CDIR NOVERRCHK 
    226225!!       DO ji = fs_2, fs_jpim1   ! vector opt. 
    227 !!          ikbu = MIN( mbathy(ji+1,jj), mbathy(ji,jj) ) 
    228 !!          ikbv = MIN( mbathy(ji,jj+1), mbathy(ji,jj) ) 
    229 !!          ikbum1 = MAX( ikbu-1, 1 ) 
    230 !!          ikbvm1 = MAX( ikbv-1, 1 ) 
    231 !!          ikbu = MIN( mbathy(ji,jj), mbathy(ji-1,jj) ) 
    232 !!          ikbv = MIN( mbathy(ji,jj), mbathy(ji,jj-1) ) 
    233 !!          ikbumm1 = MAX( ikbu-1, 1 ) 
    234 !!          ikbvmm1 = MAX( ikbv-1, 1 ) 
    235 !!          ikbt = MAX( mbathy(ji,jj), 1 ) 
    236 !!          ztx2 = bfrua(ji-1,jj) * ub(ji-1,jj,ikbumm1) + & 
    237 !!                 bfrua(ji  ,jj) * ub(ji  ,jj  ,ikbum1 ) 
    238 !!          zty2 = bfrva(ji,jj  ) * vb(ji  ,jj  ,ikbvm1) + & 
    239 !!                 bfrva(ji,jj-1) * vb(ji  ,jj-1,ikbvmm1 ) 
     226!!          ztx2 = bfrua(ji-1,jj) * ub(ji-1,jj,mbku(ji-1,jj)) + & 
     227!!                 bfrua(ji  ,jj) * ub(ji  ,jj,mbku(ji  ,jj) ) 
     228!!          zty2 = bfrva(ji,jj  ) * vb(ji,jj  ,mbkv(ji,jj  )) + & 
     229!!                 bfrva(ji,jj-1) * vb(ji,jj-1,mbkv(ji,jj-1) ) 
    240230!!          zebot = 0.001875_wp * SQRT( ztx2 * ztx2 + zty2 * zty2 )   !  where 0.001875 = (rn_ebb0/rau0) * 0.5 = 3.75*0.5/1000. 
    241 !!          en (ji,jj,ikbt) = MAX( zebot, rn_emin ) * tmask(ji,jj,1) 
     231!!          en (ji,jj,mbkt(ji,jj)+1) = MAX( zebot, rn_emin ) * tmask(ji,jj,1) 
    242232!!       END DO 
    243233!!    END DO 
    244       ! 
    245       ! 
    246       !                     !<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< 
    247       IF( ln_lc ) THEN      !  Langmuir circulation source term added to tke 
     234!!bfr   - end commented area 
     235      ! 
     236      !                     !<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< 
     237      IF( ln_lc ) THEN      !  Langmuir circulation source term added to tke       (Axell JGR 2002) 
    248238         !                  !>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> 
    249239         ! 
    250240         !                        !* total energy produce by LC : cumulative sum over jk 
    251          zpelc(:,:,1) =  MAX( rn2b(:,:,1), 0. ) * fsdepw(:,:,1) * fse3w(:,:,1) 
     241         zpelc(:,:,1) =  MAX( rn2b(:,:,1), 0._wp ) * fsdepw(:,:,1) * fse3w(:,:,1) 
    252242         DO jk = 2, jpk 
    253             zpelc(:,:,jk)  = zpelc(:,:,jk-1) + MAX( rn2b(:,:,jk), 0. ) * fsdepw(:,:,jk) * fse3w(:,:,jk) 
     243            zpelc(:,:,jk)  = zpelc(:,:,jk-1) + MAX( rn2b(:,:,jk), 0._wp ) * fsdepw(:,:,jk) * fse3w(:,:,jk) 
    254244         END DO 
    255245         !                        !* finite Langmuir Circulation depth 
    256246         zcof = 0.5 * 0.016 * 0.016 / ( zrhoa * zcdrag ) 
    257          imlc(:,:) = mbathy(:,:)         ! Initialization to the number of w ocean point mbathy 
     247         imlc(:,:) = mbkt(:,:) + 1       ! Initialization to the number of w ocean point (=2 over land) 
    258248         DO jk = jpkm1, 2, -1 
    259249            DO jj = 1, jpj               ! Last w-level at which zpelc>=0.5*us*us  
     
    275265            END DO 
    276266         END DO 
    277 # if defined key_c1d 
    278          hlc(:,:) = zhlc(:,:) * tmask(:,:,1)      ! c1d configuration: save finite Langmuir Circulation depth 
    279 # endif 
    280267         zcof = 0.016 / SQRT( zrhoa * zcdrag ) 
    281268!CDIR NOVERRCHK 
     
    328315                  &          / ( fse3t(ji,jj,jk-1) * fse3w(ji,jj,jk  ) ) 
    329316                  !                                                           ! shear prod. at w-point weightened by mask 
    330                zesh2  =  ( avmu(ji-1,jj,jk) + avmu(ji,jj,jk) ) / MAX( 1.e0 , umask(ji-1,jj,jk) + umask(ji,jj,jk) )   & 
    331                   &    + ( avmv(ji,jj-1,jk) + avmv(ji,jj,jk) ) / MAX( 1.e0 , vmask(ji,jj-1,jk) + vmask(ji,jj,jk) )     
     317               zesh2  =  ( avmu(ji-1,jj,jk) + avmu(ji,jj,jk) ) / MAX( 1._wp , umask(ji-1,jj,jk) + umask(ji,jj,jk) )   & 
     318                  &    + ( avmv(ji,jj-1,jk) + avmv(ji,jj,jk) ) / MAX( 1._wp , vmask(ji,jj-1,jk) + vmask(ji,jj,jk) )     
    332319                  ! 
    333320               zd_up(ji,jj,jk) = zzd_up            ! Matrix (zdiag, zd_up, zd_lw) 
    334321               zd_lw(ji,jj,jk) = zzd_lw 
    335                zdiag(ji,jj,jk) = 1.e0 - zzd_lw - zzd_up + zfact2 * dissl(ji,jj,jk) * tmask(ji,jj,jk) 
     322               zdiag(ji,jj,jk) = 1._wp - zzd_lw - zzd_up + zfact2 * dissl(ji,jj,jk) * tmask(ji,jj,jk) 
    336323               ! 
    337324               !                                   ! right hand side in en 
     
    384371      !                            !  TKE due to surface and internal wave breaking 
    385372      !                            !<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< 
    386       IF( nn_etau == 1 ) THEN           !* penetration throughout the water column 
     373      IF( nn_etau == 1 ) THEN           !* penetration below the mixed layer (rn_efr fraction) 
    387374         DO jk = 2, jpkm1 
    388375            DO jj = 2, jpjm1 
    389376               DO ji = fs_2, fs_jpim1   ! vector opt. 
    390377                  en(ji,jj,jk) = en(ji,jj,jk) + rn_efr * en(ji,jj,1) * EXP( -fsdepw(ji,jj,jk) / htau(ji,jj) )   & 
    391                      &                                               * ( 1.e0 - fr_i(ji,jj) )  * tmask(ji,jj,jk) 
    392                END DO 
    393             END DO 
    394          END DO 
    395       ELSEIF( nn_etau == 2 ) THEN       !* act only at the base of the mixed layer (jk=nmln) 
     378                     &                                               * ( 1._wp - fr_i(ji,jj) )  * tmask(ji,jj,jk) 
     379               END DO 
     380            END DO 
     381         END DO 
     382      ELSEIF( nn_etau == 2 ) THEN       !* act only at the base of the mixed layer (jk=nmln)  (rn_efr fraction) 
    396383         DO jj = 2, jpjm1 
    397384            DO ji = fs_2, fs_jpim1   ! vector opt. 
    398385               jk = nmln(ji,jj) 
    399386               en(ji,jj,jk) = en(ji,jj,jk) + rn_efr * en(ji,jj,1) * EXP( -fsdepw(ji,jj,jk) / htau(ji,jj) )   & 
    400                   &                                               * ( 1.e0 - fr_i(ji,jj) )  * tmask(ji,jj,jk) 
    401             END DO 
    402          END DO 
    403       ELSEIF( nn_etau == 3 ) THEN       !* penetration throughout the water column 
     387                  &                                               * ( 1._wp - fr_i(ji,jj) )  * tmask(ji,jj,jk) 
     388            END DO 
     389         END DO 
     390      ELSEIF( nn_etau == 3 ) THEN       !* penetration belox the mixed layer (HF variability) 
    404391!CDIR NOVERRCHK 
    405392         DO jk = 2, jpkm1 
     
    410397                  ztx2 = utau(ji-1,jj  ) + utau(ji,jj) 
    411398                  zty2 = vtau(ji  ,jj-1) + vtau(ji,jj) 
    412                   ztau = 0.5 * SQRT( ztx2 * ztx2 + zty2 * zty2 )      ! module of the mean stress  
    413                   zdif = taum(ji,jj) - ztau                           ! mean of the module - module of the mean  
    414                   zdif = rn_sclhft * MAX( 0.e0, zdif + rn_addhft )    ! apply some modifications... 
     399                  ztau = 0.5_wp * SQRT( ztx2 * ztx2 + zty2 * zty2 )    ! module of the mean stress  
     400                  zdif = taum(ji,jj) - ztau                            ! mean of modulus - modulus of the mean  
     401                  zdif = rhftau_scl * MAX( 0._wp, zdif + rhftau_add )  ! apply some modifications... 
    415402                  en(ji,jj,jk) = en(ji,jj,jk) + zbbrau * zdif * EXP( -fsdepw(ji,jj,jk) / htau(ji,jj) )   & 
    416                      &                                        * ( 1.e0 - fr_i(ji,jj) ) * tmask(ji,jj,jk) 
     403                     &                                        * ( 1._wp - fr_i(ji,jj) ) * tmask(ji,jj,jk) 
    417404               END DO 
    418405            END DO 
     
    439426      !!                      mxl = sqrt(2*en) / N   
    440427      !!      where N is the brunt-vaisala frequency, with a minimum value set 
    441       !!      to rn_lmin (rn_lmin0) in the interior (surface) ocean. 
     428      !!      to rmxl_min (rn_mxl0) in the interior (surface) ocean. 
    442429      !!        The mixing and dissipative length scale are bound as follow :  
    443430      !!         nn_mxl=0 : mxl bounded by the distance to surface and bottom. 
     
    479466      !                     !* Buoyancy length scale: l=sqrt(2*e/n**2) 
    480467      ! 
    481       IF( ln_mxl0 ) THEN         ! surface mixing length = F(stress) : l=vkarmn*2.e5*taum/(rau0*g) 
    482 !!gm  this should be useless 
    483          zmxlm(:,:,1) = 0.e0 
    484 !!gm end 
    485          zraug = vkarmn * 2.e5 / ( rau0 * grav ) 
    486          DO jj = 2, jpjm1 
    487             DO ji = fs_2, fs_jpim1   ! vector opt. 
    488                zmxlm(ji,jj,1) = MAX(  rn_lmin0,  zraug * taum(ji,jj)  ) 
    489             END DO 
    490          END DO 
    491       ELSE                       ! surface set to the minimum value 
    492          zmxlm(:,:,1) = rn_lmin0 
     468      IF( ln_mxl0 ) THEN            ! surface mixing length = F(stress) : l=vkarmn*2.e5*taum/(rau0*g) 
     469         zraug = vkarmn * 2.e5_wp / ( rau0 * grav ) 
     470         zmxlm(:,:,1) = MAX(  rn_mxl0,  zraug * taum(:,:)  ) 
     471      ELSE                          ! surface set to the minimum value 
     472         zmxlm(:,:,1) = rn_mxl0 
    493473      ENDIF 
    494       zmxlm(:,:,jpk) = rn_lmin   ! bottom set to the interior minium value 
    495       ! 
    496 !CDIR NOVERRCHK 
    497       DO jk = 2, jpkm1           ! interior value : l=sqrt(2*e/n**2) 
     474      zmxlm(:,:,jpk)  = rmxl_min     ! last level set to the interior minium value 
     475      ! 
     476!CDIR NOVERRCHK 
     477      DO jk = 2, jpkm1              ! interior value : l=sqrt(2*e/n^2) 
    498478!CDIR NOVERRCHK 
    499479         DO jj = 2, jpjm1 
     
    501481            DO ji = fs_2, fs_jpim1   ! vector opt. 
    502482               zrn2 = MAX( rn2(ji,jj,jk), rsmall ) 
    503                zmxlm(ji,jj,jk) = MAX(  rn_lmin,  SQRT( 2. * en(ji,jj,jk) / zrn2 )  ) 
    504             END DO 
    505          END DO 
    506       END DO 
    507       ! 
    508 !!gm  CAUTION: to be added here the bottom boundary condition on zmxlm 
     483               zmxlm(ji,jj,jk) = MAX(  rmxl_min,  SQRT( 2._wp * en(ji,jj,jk) / zrn2 )  ) 
     484            END DO 
     485         END DO 
     486      END DO 
     487      ! 
    509488      ! 
    510489      !                     !* Physical limits for the mixing length 
    511490      ! 
    512       zmxld(:,:, 1 ) = zmxlm(:,:,1)   ! surface set to the minimum value 
    513       zmxld(:,:,jpk) = rn_lmin        ! bottom  set to the minimum value 
     491      zmxld(:,:, 1 ) = zmxlm(:,:,1)   ! surface set to the zmxlm  value 
     492      zmxld(:,:,jpk) = rmxl_min       ! last level  set to the minimum value 
    514493      ! 
    515494      SELECT CASE ( nn_mxl ) 
     
    520499               DO ji = fs_2, fs_jpim1   ! vector opt. 
    521500                  zemxl = MIN( fsdepw(ji,jj,jk), zmxlm(ji,jj,jk),   & 
    522                   &            fsdepw(ji,jj,mbathy(ji,jj)) - fsdepw(ji,jj,jk) ) 
     501                  &            fsdepw(ji,jj,mbkt(ji,jj)+1) - fsdepw(ji,jj,jk) ) 
    523502                  zmxlm(ji,jj,jk) = zemxl 
    524503                  zmxld(ji,jj,jk) = zemxl 
     
    625604            DO jj = 2, jpjm1 
    626605               DO ji = fs_2, fs_jpim1   ! vector opt. 
    627                   zcoef = 0.5 / ( fse3w(ji,jj,jk) * fse3w(ji,jj,jk) ) 
     606                  zcoef = avm(ji,jj,jk) * 2._wp * fse3w(ji,jj,jk) * fse3w(ji,jj,jk) 
    628607                  !                                          ! shear 
    629608                  zdku = avmu(ji-1,jj,jk) * ( un(ji-1,jj,jk-1) - un(ji-1,jj,jk) ) * ( ub(ji-1,jj,jk-1) - ub(ji-1,jj,jk) )   & 
     
    632611                    &  + avmv(ji,jj  ,jk) * ( vn(ji,jj  ,jk-1) - vn(ji,jj  ,jk) ) * ( vb(ji,jj  ,jk-1) - vb(ji,jj  ,jk) ) 
    633612                  !                                          ! local Richardson number 
    634                   zri   = MAX( rn2b(ji,jj,jk), 0. ) * avm(ji,jj,jk) / (zcoef * (zdku + zdkv + rn_bshear ) ) 
    635                   zpdlr = MAX(  0.1,  0.2 / MAX( 0.2 , zri )  ) 
     613                  zri   = MAX( rn2b(ji,jj,jk), 0._wp ) * zcoef / (zdku + zdkv + rn_bshear ) 
     614                  zpdlr = MAX(  0.1_wp,  0.2 / MAX( 0.2 , zri )  ) 
    636615!!gm and even better with the use of the "true" ri_crit=0.22222...  (this change the results!) 
    637 !!gm              zpdlr = MAX(  0.1,  ri_crit / MAX( ri_crit , zri )  ) 
     616!!gm              zpdlr = MAX(  0.1_wp,  ri_crit / MAX( ri_crit , zri )  ) 
    638617                  avt(ji,jj,jk)   = MAX( zpdlr * avt(ji,jj,jk), avtb_2d(ji,jj) * avtb(jk) ) * tmask(ji,jj,jk) 
    639618# if defined key_c1d 
     
    656635 
    657636 
    658    SUBROUTINE tke_init 
     637   SUBROUTINE zdf_tke_init 
    659638      !!---------------------------------------------------------------------- 
    660       !!                  ***  ROUTINE tke_init  *** 
     639      !!                  ***  ROUTINE zdf_tke_init  *** 
    661640      !!                      
    662641      !! ** Purpose :   Initialization of the vertical eddy diffivity and  
     
    672651      INTEGER ::   ji, jj, jk   ! dummy loop indices 
    673652      !! 
    674       NAMELIST/namzdf_tke/ rn_ediff, rn_ediss , rn_ebb   , rn_emin  ,   & 
    675          &                 rn_emin0, rn_bshear, nn_mxl   , ln_mxl0  ,   & 
    676          &                 rn_lmin , rn_lmin0 , nn_pdl   , nn_etau  ,   & 
    677          &                 nn_htau , rn_efr   , rn_addhft, rn_sclhft,   & 
    678          &                 ln_lc   , rn_lc  
     653      NAMELIST/namzdf_tke/ rn_ediff, rn_ediss , rn_ebb , rn_emin  ,   & 
     654         &                 rn_emin0, rn_bshear, nn_mxl , ln_mxl0  ,   & 
     655         &                 rn_mxl0 , nn_pdl   , ln_lc  , rn_lc    ,   & 
     656         &                 nn_etau , nn_htau  , rn_efr    
    679657      !!---------------------------------------------------------------------- 
    680658 
     
    682660      READ   ( numnam, namzdf_tke ) 
    683661       
    684       ri_cri = 2. / ( 2. + rn_ediss / rn_ediff )      ! resulting critical Richardson number 
     662      ri_cri   = 2._wp    / ( 2._wp + rn_ediss / rn_ediff )   ! resulting critical Richardson number 
     663      rmxl_min = 1.e-6_wp / ( rn_ediff * SQRT( rn_emin ) )    ! resulting minimum length to recover molecular viscosity 
    685664 
    686665      IF(lwp) THEN                    !* Control print 
    687666         WRITE(numout,*) 
    688          WRITE(numout,*) 'zdf_tke : tke turbulent closure scheme - initialisation' 
    689          WRITE(numout,*) '~~~~~~~~' 
     667         WRITE(numout,*) 'zdf_tke_init : tke turbulent closure scheme - initialisation' 
     668         WRITE(numout,*) '~~~~~~~~~~~~' 
    690669         WRITE(numout,*) '   Namelist namzdf_tke : set tke mixing parameters' 
    691670         WRITE(numout,*) '      coef. to compute avt                        rn_ediff  = ', rn_ediff 
     
    698677         WRITE(numout,*) '      prandl number flag                          nn_pdl    = ', nn_pdl 
    699678         WRITE(numout,*) '      surface mixing length = F(stress) or not    ln_mxl0   = ', ln_mxl0 
    700          WRITE(numout,*) '      surface  mixing length minimum value        rn_lmin0  = ', rn_lmin0 
    701          WRITE(numout,*) '      interior mixing length minimum value        rn_lmin0  = ', rn_lmin0 
     679         WRITE(numout,*) '      surface  mixing length minimum value        rn_mxl0   = ', rn_mxl0 
     680         WRITE(numout,*) '      flag to take into acc.  Langmuir circ.      ln_lc     = ', ln_lc 
     681         WRITE(numout,*) '      coef to compute verticla velocity of LC     rn_lc     = ', rn_lc 
    702682         WRITE(numout,*) '      test param. to add tke induced by wind      nn_etau   = ', nn_etau 
    703683         WRITE(numout,*) '      flag for computation of exp. tke profile    nn_htau   = ', nn_htau 
    704684         WRITE(numout,*) '      fraction of en which pene. the thermocline  rn_efr    = ', rn_efr 
    705          WRITE(numout,*) '      add offset   applied to HF tau              rn_addhft = ', rn_addhft 
    706          WRITE(numout,*) '      scale factor applied to HF tau              rn_sclhft = ', rn_sclhft 
    707          WRITE(numout,*) '      flag to take into acc.  Langmuir circ.      ln_lc     = ', ln_lc 
    708          WRITE(numout,*) '      coef to compute verticla velocity of LC     rn_lc     = ', rn_lc 
    709685         WRITE(numout,*) 
    710686         WRITE(numout,*) '      critical Richardson nb with your parameters  ri_cri = ', ri_cri 
     
    712688 
    713689      !                               !* Check of some namelist values 
    714       IF( nn_mxl  < 0     .OR.  nn_mxl  > 3   )   CALL ctl_stop( 'bad flag: nn_mxl is  0, 1 or 2 ' ) 
    715       IF( nn_pdl  < 0     .OR.  nn_pdl  > 1   )   CALL ctl_stop( 'bad flag: nn_pdl is  0 or 1    ' ) 
    716       IF( nn_htau < 0     .OR.  nn_htau > 2   )   CALL ctl_stop( 'bad flag: nn_htau is 0, 1 or 2 ' ) 
    717       IF( rn_lc   < 0.15  .OR.  rn_lc   > 0.2 )   CALL ctl_stop( 'bad value: rn_lc must be between 0.15 and 0.2 ' ) 
    718       IF( rn_sclhft == 0. .AND. nn_etau == 3  )   CALL ctl_stop( 'force null HF tau to penetrate the thermocline...' ) 
    719       IF( .NOT. lhftau    .AND. nn_etau == 3  )   CALL ctl_stop( 'bad flag: nn_etau == 3 must be used with HF tau' ) 
    720  
     690      IF( nn_mxl  < 0  .OR.  nn_mxl  > 3 )   CALL ctl_stop( 'bad flag: nn_mxl is  0, 1 or 2 ' ) 
     691      IF( nn_pdl  < 0  .OR.  nn_pdl  > 1 )   CALL ctl_stop( 'bad flag: nn_pdl is  0 or 1    ' ) 
     692      IF( nn_htau < 0  .OR.  nn_htau > 1 )   CALL ctl_stop( 'bad flag: nn_htau is 0, 1 or 2 ' ) 
     693#if ! key_coupled 
     694      IF( nn_etau == 3 )   CALL ctl_stop( 'nn_etau == 3 : HF taum only known in coupled mode' ) 
     695#endif 
     696 
     697      IF( ln_mxl0 ) THEN 
     698         IF(lwp) WRITE(numout,*) '   use a surface mixing length = F(stress) :   set rn_mxl0 = rmxl_min' 
     699         rn_mxl0 = rmxl_min 
     700      ENDIF 
     701       
    721702      IF( nn_etau == 2  )   CALL zdf_mxl( nit000 )      ! Initialization of nmln  
    722703 
     
    724705      IF( nn_etau /= 0 ) THEN       
    725706         SELECT CASE( nn_htau )             ! Choice of the depth of penetration 
    726          CASE( 0 )                                    ! constant depth penetration (here 10 meters) 
    727             htau(:,:) = 10.e0 
    728          CASE( 1 )                                    ! F(latitude) : 0.5m to 30m at high lat. 
    729             DO jj = 1, jpj 
    730                DO ji = 1, jpi   
    731                   htau(ji,jj) = MAX( 0.5, 3./4. * MIN( 40., 60.*ABS( SIN( rpi/180. * gphit(ji,jj) ) ) )   ) 
    732                END DO 
    733             END DO 
    734          CASE( 2 )                                    ! constant depth penetration (here 30 meters) 
    735             htau(:,:) = 30.e0 
     707         CASE( 0 )                                 ! constant depth penetration (here 10 meters) 
     708            htau(:,:) = 10._wp 
     709         CASE( 1 )                                 ! F(latitude) : 0.5m to 30m poleward of 40 degrees 
     710            htau(:,:) = MAX(  0.5_wp, MIN( 30._wp, 45._wp* ABS( SIN( rpi/180._wp * gphit(:,:) ) ) )   )             
    736711         END SELECT 
    737712      ENDIF 
     
    744719         avmv(:,:,jk) = avmb(jk) * vmask(:,:,jk) 
    745720      END DO 
    746       dissl(:,:,:) = 1.e-12 
     721      dissl(:,:,:) = 1.e-12_wp 
    747722      !                               !* read or initialize all required files  
    748723      CALL tke_rst( nit000, 'READ' ) 
    749724      ! 
    750    END SUBROUTINE tke_init 
     725   END SUBROUTINE zdf_tke_init 
    751726 
    752727 
     
    825800   LOGICAL, PUBLIC, PARAMETER ::   lk_zdftke = .FALSE.   !: TKE flag 
    826801CONTAINS 
    827    SUBROUTINE zdf_tke( kt )          ! Empty routine 
     802   SUBROUTINE zdf_tke_init           ! Dummy routine 
     803   END SUBROUTINE zdf_tke_init 
     804   SUBROUTINE zdf_tke( kt )          ! Dummy routine 
    828805      WRITE(*,*) 'zdf_tke: You should not have seen this print! error?', kt 
    829806   END SUBROUTINE zdf_tke 
Note: See TracChangeset for help on using the changeset viewer.