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 14072 for NEMO/trunk/src/OCE/ZDF/zdftke.F90 – NEMO

Ignore:
Timestamp:
2020-12-04T08:48:38+01:00 (3 years ago)
Author:
laurent
Message:

Merging branch "2020/dev_r13648_ASINTER-04_laurent_bulk_ice", ticket #2369

File:
1 edited

Legend:

Unmodified
Added
Removed
  • NEMO/trunk/src/OCE/ZDF/zdftke.F90

    r14057 r14072  
    22   !!====================================================================== 
    33   !!                       ***  MODULE  zdftke  *** 
    4    !! Ocean physics:  vertical mixing coefficient computed from the tke  
     4   !! Ocean physics:  vertical mixing coefficient computed from the tke 
    55   !!                 turbulent closure parameterization 
    66   !!===================================================================== 
     
    2222   !!             -   !  2008-05  (J.-M. Molines, G. Madec)  2D form of avtb 
    2323   !!             -   !  2008-06  (G. Madec)  style + DOCTOR name for namelist parameters 
    24    !!             -   !  2008-12  (G. Reffray) stable discretization of the production term  
    25    !!            3.2  !  2009-06  (G. Madec, S. Masson) TKE restart compatible with key_cpl  
     24   !!             -   !  2008-12  (G. Reffray) stable discretization of the production term 
     25   !!            3.2  !  2009-06  (G. Madec, S. Masson) TKE restart compatible with key_cpl 
    2626   !!                 !                                + cleaning of the parameters + bugs correction 
    2727   !!            3.3  !  2010-10  (C. Ethe, G. Madec) reorganisation of initialisation phase 
    2828   !!            3.6  !  2014-11  (P. Mathiot) add ice shelf capability 
    29    !!            4.0  !  2017-04  (G. Madec)  remove CPP ddm key & avm at t-point only  
     29   !!            4.0  !  2017-04  (G. Madec)  remove CPP ddm key & avm at t-point only 
    3030   !!             -   !  2017-05  (G. Madec)  add top/bottom friction as boundary condition 
    3131   !!            4.2  !  2020-12  (G. Madec, E. Clementi) add wave coupling 
     
    5959   USE lbclnk         ! ocean lateral boundary conditions (or mpp link) 
    6060   USE prtctl         ! Print control 
    61    USE lib_fortran    ! Fortran utilities (allows no signed zero when 'key_nosignedzero' defined)   
     61   USE lib_fortran    ! Fortran utilities (allows no signed zero when 'key_nosignedzero' defined) 
    6262   USE sbcwave        ! Surface boundary waves 
    6363 
     
    7878   INTEGER  ::   nn_pdl    ! Prandtl number or not (ratio avt/avm) (=0/1) 
    7979   REAL(wp) ::   rn_ediff  ! coefficient for avt: avt=rn_ediff*mxl*sqrt(e) 
    80    REAL(wp) ::   rn_ediss  ! coefficient of the Kolmogoroff dissipation  
     80   REAL(wp) ::   rn_ediss  ! coefficient of the Kolmogoroff dissipation 
    8181   REAL(wp) ::   rn_ebb    ! coefficient of the surface input of tke 
    8282   REAL(wp) ::   rn_emin   ! minimum value of tke           [m2/s2] 
     
    9090   LOGICAL  ::   ln_lc     ! Langmuir cells (LC) as a source term of TKE or not 
    9191   REAL(wp) ::      rn_lc     ! coef to compute vertical velocity of Langmuir cells 
    92    INTEGER  ::   nn_eice   ! attenutaion of langmuir & surface wave breaking under ice (=0/1/2/3)    
     92   INTEGER  ::   nn_eice   ! attenutaion of langmuir & surface wave breaking under ice (=0/1/2/3) 
    9393 
    9494   REAL(wp) ::   ri_cri    ! critic Richardson number (deduced from rn_ediff and rn_ediss values) 
     
    139139      !!         surface: en = max( rn_emin0, rn_ebb * taum ) 
    140140      !!         bottom : en = rn_emin 
    141       !!      The associated critical Richardson number is: ri_cri = 2/(2+rn_ediss/rn_ediff)  
    142       !! 
    143       !!        The now Turbulent kinetic energy is computed using the following  
     141      !!      The associated critical Richardson number is: ri_cri = 2/(2+rn_ediss/rn_ediff) 
     142      !! 
     143      !!        The now Turbulent kinetic energy is computed using the following 
    144144      !!      time stepping: implicit for vertical diffusion term, linearized semi 
    145       !!      implicit for kolmogoroff dissipation term, and explicit forward for  
    146       !!      both buoyancy and shear production terms. Therefore a tridiagonal  
     145      !!      implicit for kolmogoroff dissipation term, and explicit forward for 
     146      !!      both buoyancy and shear production terms. Therefore a tridiagonal 
    147147      !!      linear system is solved. Note that buoyancy and shear terms are 
    148148      !!      discretized in a energy conserving form (Bruchard 2002). 
     
    152152      !! 
    153153      !!        The now vertical eddy vicosity and diffusivity coefficients are 
    154       !!      given by:  
     154      !!      given by: 
    155155      !!              avm = max( avtb, rn_ediff * zmxlm * en^1/2 ) 
    156       !!              avt = max( avmb, pdl * avm                 )   
     156      !!              avt = max( avmb, pdl * avm                 ) 
    157157      !!              eav = max( avmb, avm ) 
    158158      !!      where pdl, the inverse of the Prandtl number is 1 if nn_pdl=0 and 
    159       !!      given by an empirical funtion of the localRichardson number if nn_pdl=1  
     159      !!      given by an empirical funtion of the localRichardson number if nn_pdl=1 
    160160      !! 
    161161      !! ** Action  :   compute en (now turbulent kinetic energy) 
     
    193193      !!                a tridiagonal linear system by a "methode de chasse" 
    194194      !!              - increase TKE due to surface and internal wave breaking 
    195       !!             NB: when sea-ice is present, both LC parameterization  
    196       !!                 and TKE penetration are turned off when the ice fraction  
    197       !!                 is smaller than 0.25  
     195      !!             NB: when sea-ice is present, both LC parameterization 
     196      !!                 and TKE penetration are turned off when the ice fraction 
     197      !!                 is smaller than 0.25 
    198198      !! 
    199199      !! ** Action  : - en : now turbulent kinetic energy) 
     
    223223      zbbrau  = rn_ebb / rho0       ! Local constant initialisation 
    224224      zbbirau = 3.75_wp / rho0 
    225       zfact1  = -.5_wp * rn_Dt  
     225      zfact1  = -.5_wp * rn_Dt 
    226226      zfact2  = 1.5_wp * rn_Dt * rn_ediss 
    227227      zfact3  = 0.5_wp         * rn_ediss 
     
    244244         en(ji,jj,1) = MAX( rn_emin0, zbbrau * taum(ji,jj) ) 
    245245         zdiag(ji,jj,1) = 1._wp/en(ji,jj,1) 
    246          zd_lw(ji,jj,1) = 1._wp   
     246         zd_lw(ji,jj,1) = 1._wp 
    247247         zd_up(ji,jj,1) = 0._wp 
    248248      END_2D 
     
    345345         END_2D 
    346346         DO_3D( 0, 0, 0, 0, 2, jpkm1 )                  !* TKE Langmuir circulation source term added to en 
    347             IF ( zus3(ji,jj) /= 0._wp ) THEN                
     347            IF ( zus3(ji,jj) /= 0._wp ) THEN 
    348348               IF ( gdepw(ji,jj,jk,Kmm) - zhlc(ji,jj) < 0 .AND. wmask(ji,jj,jk) /= 0. ) THEN 
    349349                  !                                           ! vertical velocity due to LC 
     
    376376         END_3D 
    377377      ENDIF 
    378       !          
     378      ! 
    379379      DO_3D( 0, 0, 0, 0, 2, jpkm1 )   !* Matrix and right hand side in en 
    380380         zcof   = zfact1 * tmask(ji,jj,jk) 
     
    403403      ! 
    404404      IF ( cpl_phioc .and. ln_phioc )  THEN 
    405          SELECT CASE (nn_bc_surf) ! Boundary Condition using surface TKE flux from waves  
     405         SELECT CASE (nn_bc_surf) ! Boundary Condition using surface TKE flux from waves 
    406406 
    407407         CASE ( 0 ) ! Dirichlet BC 
     
    456456      ! 
    457457      IF( nn_etau == 1 ) THEN           !* penetration below the mixed layer (rn_efr fraction) 
    458          DO_3D( 0, 0, 0, 0, 2, jpkm1 )  
     458         DO_3D( 0, 0, 0, 0, 2, jpkm1 ) 
    459459            en(ji,jj,jk) = en(ji,jj,jk) + rn_efr * en(ji,jj,1) * EXP( -gdepw(ji,jj,jk,Kmm) / htau(ji,jj) )   & 
    460460               &                                 * MAX( 0._wp, 1._wp - zice_fra(ji,jj) ) * wmask(ji,jj,jk) * tmask(ji,jj,1) 
     
    470470            ztx2 = utau(ji-1,jj  ) + utau(ji,jj) 
    471471            zty2 = vtau(ji  ,jj-1) + vtau(ji,jj) 
    472             ztau = 0.5_wp * SQRT( ztx2 * ztx2 + zty2 * zty2 ) * tmask(ji,jj,1)    ! module of the mean stress  
    473             zdif = taum(ji,jj) - ztau                            ! mean of modulus - modulus of the mean  
     472            ztau = 0.5_wp * SQRT( ztx2 * ztx2 + zty2 * zty2 ) * tmask(ji,jj,1)    ! module of the mean stress 
     473            zdif = taum(ji,jj) - ztau                            ! mean of modulus - modulus of the mean 
    474474            zdif = rhftau_scl * MAX( 0._wp, zdif + rhftau_add )  ! apply some modifications... 
    475475            en(ji,jj,jk) = en(ji,jj,jk) + zbbrau * zdif * EXP( -gdepw(ji,jj,jk,Kmm) / htau(ji,jj) )   & 
     
    487487      !! ** Purpose :   Compute the vertical eddy viscosity and diffusivity 
    488488      !! 
    489       !! ** Method  :   At this stage, en, the now TKE, is known (computed in  
    490       !!              the tke_tke routine). First, the now mixing lenth is  
     489      !! ** Method  :   At this stage, en, the now TKE, is known (computed in 
     490      !!              the tke_tke routine). First, the now mixing lenth is 
    491491      !!      computed from en and the strafification (N^2), then the mixings 
    492492      !!      coefficients are computed. 
    493493      !!              - Mixing length : a first evaluation of the mixing lengh 
    494494      !!      scales is: 
    495       !!                      mxl = sqrt(2*en) / N   
     495      !!                      mxl = sqrt(2*en) / N 
    496496      !!      where N is the brunt-vaisala frequency, with a minimum value set 
    497497      !!      to rmxl_min (rn_mxl0) in the interior (surface) ocean. 
    498       !!        The mixing and dissipative length scale are bound as follow :  
     498      !!        The mixing and dissipative length scale are bound as follow : 
    499499      !!         nn_mxl=0 : mxl bounded by the distance to surface and bottom. 
    500500      !!                        zmxld = zmxlm = mxl 
    501501      !!         nn_mxl=1 : mxl bounded by the e3w and zmxld = zmxlm = mxl 
    502       !!         nn_mxl=2 : mxl bounded such that the vertical derivative of mxl is  
     502      !!         nn_mxl=2 : mxl bounded such that the vertical derivative of mxl is 
    503503      !!                    less than 1 (|d/dz(mxl)|<1) and zmxld = zmxlm = mxl 
    504504      !!         nn_mxl=3 : mxl is bounded from the surface to the bottom usings 
    505       !!                    |d/dz(xml)|<1 to obtain lup, and from the bottom to  
    506       !!                    the surface to obtain ldown. the resulting length  
     505      !!                    |d/dz(xml)|<1 to obtain lup, and from the bottom to 
     506      !!                    the surface to obtain ldown. the resulting length 
    507507      !!                    scales are: 
    508       !!                        zmxld = sqrt( lup * ldown )  
     508      !!                        zmxld = sqrt( lup * ldown ) 
    509509      !!                        zmxlm = min ( lup , ldown ) 
    510510      !!              - Vertical eddy viscosity and diffusivity: 
    511511      !!                      avm = max( avtb, rn_ediff * zmxlm * en^1/2 ) 
    512       !!                      avt = max( avmb, pdlr * avm )   
     512      !!                      avt = max( avmb, pdlr * avm ) 
    513513      !!      with pdlr=1 if nn_pdl=0, pdlr=1/pdl=F(Ri) otherwise. 
    514514      !! 
     
    534534      ! 
    535535      ! initialisation of interior minimum value (avoid a 2d loop with mikt) 
    536       zmxlm(:,:,:)  = rmxl_min     
     536      zmxlm(:,:,:)  = rmxl_min 
    537537      zmxld(:,:,:)  = rmxl_min 
    538538      ! 
     
    543543         zmxlm(:,:,1)= zcoef * MAX ( 1.6 * hsw(:,:) , 0.02 )        ! surface mixing length = F(wave height) 
    544544      ELSE 
    545       !  
     545      ! 
    546546         IF( ln_mxl0 ) THEN            ! surface mixing length = F(stress) : l=vkarmn*2.e5*taum/(rho0*g) 
    547547         ! 
     
    603603      !                     !* Physical limits for the mixing length 
    604604      ! 
    605       zmxld(:,:, 1 ) = zmxlm(:,:,1)   ! surface set to the minimum value  
     605      zmxld(:,:, 1 ) = zmxlm(:,:,1)   ! surface set to the minimum value 
    606606      zmxld(:,:,jpk) = rmxl_min       ! last level  set to the minimum value 
    607607      ! 
     
    686686      !!---------------------------------------------------------------------- 
    687687      !!                  ***  ROUTINE zdf_tke_init  *** 
    688       !!                      
    689       !! ** Purpose :   Initialization of the vertical eddy diffivity and  
     688      !! 
     689      !! ** Purpose :   Initialization of the vertical eddy diffivity and 
    690690      !!              viscosity when using a tke turbulent closure scheme 
    691691      !! 
     
    707707         &                 rn_mxl0 , nn_mxlice, rn_mxlice,             & 
    708708         &                 nn_pdl  , ln_lc    , rn_lc    ,             & 
    709          &                 nn_etau , nn_htau  , rn_efr   , nn_eice  ,  &    
     709         &                 nn_etau , nn_htau  , rn_efr   , nn_eice  ,  & 
    710710         &                 nn_bc_surf, nn_bc_bot, ln_mxhsw 
    711711      !!---------------------------------------------------------------------- 
     
    760760         WRITE(numout,*) '          fraction of TKE that penetrates            rn_efr    = ', rn_efr 
    761761         WRITE(numout,*) '      langmuir & surface wave breaking under ice  nn_eice = ', nn_eice 
    762          SELECT CASE( nn_eice )  
     762         SELECT CASE( nn_eice ) 
    763763         CASE( 0 )   ;   WRITE(numout,*) '   ==>>>   no impact of ice cover on langmuir & surface wave breaking' 
    764764         CASE( 1 )   ;   WRITE(numout,*) '   ==>>>   weigthed by 1-TANH( fr_i(:,:) * 10 )' 
     
    767767         CASE DEFAULT 
    768768            CALL ctl_stop( 'zdf_tke_init: wrong value for nn_eice, should be 0,1,2, or 3') 
    769          END SELECT       
     769         END SELECT 
    770770         WRITE(numout,*) 
    771771         WRITE(numout,*) '   ==>>>   critical Richardson nb with your parameters  ri_cri = ', ri_cri 
     
    796796         rn_mxl0 = rmxl_min 
    797797      ENDIF 
    798        
    799       IF( nn_etau == 2  )   CALL zdf_mxl( nit000, Kmm )      ! Initialization of nmln  
     798 
     799      IF( nn_etau == 2  )   CALL zdf_mxl( nit000, Kmm )      ! Initialization of nmln 
    800800 
    801801      !                               !* depth of penetration of surface tke 
    802       IF( nn_etau /= 0 ) THEN       
     802      IF( nn_etau /= 0 ) THEN 
    803803         SELECT CASE( nn_htau )             ! Choice of the depth of penetration 
    804804         CASE( 0 )                                 ! constant depth penetration (here 10 meters) 
    805805            htau(:,:) = 10._wp 
    806806         CASE( 1 )                                 ! F(latitude) : 0.5m to 30m poleward of 40 degrees 
    807             htau(:,:) = MAX(  0.5_wp, MIN( 30._wp, 45._wp* ABS( SIN( rpi/180._wp * gphit(:,:) ) ) )   )             
     807            htau(:,:) = MAX(  0.5_wp, MIN( 30._wp, 45._wp* ABS( SIN( rpi/180._wp * gphit(:,:) ) ) )   ) 
    808808         END SELECT 
    809809      ENDIF 
    810810      !                                !* read or initialize all required files 
    811       CALL tke_rst( nit000, 'READ' )      ! (en, avt_k, avm_k, dissl)  
     811      CALL tke_rst( nit000, 'READ' )      ! (en, avt_k, avm_k, dissl) 
    812812      ! 
    813813   END SUBROUTINE zdf_tke_init 
     
    817817      !!--------------------------------------------------------------------- 
    818818      !!                   ***  ROUTINE tke_rst  *** 
    819       !!                      
     819      !! 
    820820      !! ** Purpose :   Read or write TKE file (en) in restart file 
    821821      !! 
    822822      !! ** Method  :   use of IOM library 
    823       !!                if the restart does not contain TKE, en is either  
    824       !!                set to rn_emin or recomputed  
     823      !!                if the restart does not contain TKE, en is either 
     824      !!                set to rn_emin or recomputed 
    825825      !!---------------------------------------------------------------------- 
    826826      USE zdf_oce , ONLY : en, avt_k, avm_k   ! ocean vertical physics 
     
    833833      !!---------------------------------------------------------------------- 
    834834      ! 
    835       IF( TRIM(cdrw) == 'READ' ) THEN        ! Read/initialise  
     835      IF( TRIM(cdrw) == 'READ' ) THEN        ! Read/initialise 
    836836         !                                   ! --------------- 
    837837         IF( ln_rstart ) THEN                   !* Read the restart file 
Note: See TracChangeset for help on using the changeset viewer.