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 13191 for branches/UKMO/dev_1d_bugfixes_tocommit/NEMOGCM/NEMO/OPA_SRC/ZDF – NEMO

Ignore:
Timestamp:
2020-07-01T15:01:22+02:00 (4 years ago)
Author:
jwhile
Message:

Updates for 1d runnig

Location:
branches/UKMO/dev_1d_bugfixes_tocommit/NEMOGCM/NEMO/OPA_SRC/ZDF
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • branches/UKMO/dev_1d_bugfixes_tocommit/NEMOGCM/NEMO/OPA_SRC/ZDF/zdfbfr.F90

    r11442 r13191  
    107107         WRITE(numout,*) '~~~~~~~~' 
    108108      ENDIF 
    109       !  
     109      ! 
     110#if defined key_traldf_c2d || key_traldf_c3d 
    110111      IF( ln_stopack .AND. ( nn_spp_bfr > 0 ) ) THEN 
    111112         bfrcoef2d = bfrcoef2d0 
    112113         CALL spp_gen(kt, bfrcoef2d, nn_spp_bfr, rn_bfr_sd, jk_spp_bfr) 
    113114      ENDIF 
     115#else 
     116      IF ( ln_stopack .AND. ( nn_spp_bfr > 0 ) ) & 
     117         & CALL ctl_stop( 'zdf_bfr: parameter perturbation will only work with '// & 
     118                          'key_traldf_c2d or key_traldf_c3d') 
     119#endif 
    114120      ! 
    115121      IF( nn_bfr == 2 ) THEN                 ! quadratic bottom friction only 
     
    140146               END DO 
    141147            END IF 
    142          !    
     148         ! 
    143149         ELSE 
    144150            zbfrt(:,:) = bfrcoef2d(:,:) 
     
    183189               DO ji = 2, jpim1 
    184190                  ! (ISF) ======================================================================== 
    185                   ikbu = miku(ji,jj)         ! ocean top level at u- and v-points  
     191                  ikbu = miku(ji,jj)         ! ocean top level at u- and v-points 
    186192                  ikbv = mikv(ji,jj)         ! (1st wet ocean u- and v-points) 
    187193                  ! 
     
    363369            bfrcoef2d(:,:) = rn_bfri2  ! initialize bfrcoef2d to the namelist variable 
    364370         ENDIF 
    365           
     371 
    366372         IF ( ln_isfcav ) THEN 
    367373            IF(ln_tfr2d) THEN 
  • branches/UKMO/dev_1d_bugfixes_tocommit/NEMOGCM/NEMO/OPA_SRC/ZDF/zdfevd.F90

    r11442 r13191  
    2020   USE zdfkpp          ! KPP vertical mixing 
    2121   USE trd_oce         ! trends: ocean variables 
    22    USE trdtra          ! trends manager: tracers  
     22   USE trdtra          ! trends manager: tracers 
    2323   USE in_out_manager  ! I/O manager 
    2424   USE iom             ! for iom_put 
    2525   USE lbclnk          ! ocean lateral boundary conditions (or mpp link) 
    2626   USE timing          ! Timing 
    27    USE stopack          
     27   USE stopack 
    2828 
    2929   IMPLICIT NONE 
     
    4545      !!---------------------------------------------------------------------- 
    4646      !!                  ***  ROUTINE zdf_evd  *** 
    47       !!                    
     47      !! 
    4848      !! ** Purpose :   Local increased the vertical eddy viscosity and diffu- 
    4949      !!      sivity coefficients when a static instability is encountered. 
    5050      !! 
    5151      !! ** Method  :   avt, avm, and the 4 neighbouring avmu, avmv coefficients 
    52       !!      are set to avevd (namelist parameter) if the water column is  
     52      !!      are set to avevd (namelist parameter) if the water column is 
    5353      !!      statically unstable (i.e. if rn2 < -1.e-12 ) 
    5454      !! 
     
    7777      zavt_evd(:,:,:) = avt(:,:,:)           ! set avt prior to evd application 
    7878 
     79#if defined key_traldf_c2d || key_traldf_c3d 
    7980      IF( ln_stopack .AND. ( nn_spp_aevd > 0 ) ) THEN 
    8081         rn_avevd0(:,:) = rn_avevd 
    8182         CALL spp_gen(kt, rn_avevd0, nn_spp_aevd, rn_aevd_sd, jk_spp_aevd) 
    8283      ENDIF 
     84#else 
     85      IF ( ln_stopack .AND. ( nn_spp_aevd > 0 ) ) & 
     86         & CALL ctl_stop( 'zdf_evd: parameter perturbation will only work with '// & 
     87                          'key_traldf_c2d or key_traldf_c3d') 
     88#endif 
    8389 
    8490      SELECT CASE ( nn_evdm ) 
     
    8894         zavm_evd(:,:,:) = avm(:,:,:)           ! set avm prior to evd application 
    8995         ! 
    90          DO jk = 1, jpkm1  
     96         DO jk = 1, jpkm1 
    9197            DO jj = 2, jpj             ! no vector opt. 
    9298               DO ji = 2, jpi 
     
    106112               END DO 
    107113            END DO 
    108          END DO  
     114         END DO 
    109115         CALL lbc_lnk( avt , 'W', 1. )   ;   CALL lbc_lnk( avm , 'W', 1. )   ! Lateral boundary conditions 
    110116         CALL lbc_lnk( avmu, 'U', 1. )   ;   CALL lbc_lnk( avmv, 'V', 1. ) 
     
    113119         CALL iom_put( "avm_evd", zavm_evd )              ! output this change 
    114120         ! 
    115       CASE DEFAULT         ! enhance vertical eddy diffusivity only (if rn2<-1.e-12)  
     121      CASE DEFAULT         ! enhance vertical eddy diffusivity only (if rn2<-1.e-12) 
    116122         DO jk = 1, jpkm1 
    117 !!!         WHERE( rn2(:,:,jk) <= -1.e-12 ) avt(:,:,jk) = tmask(:,:,jk) * avevd   ! agissant sur T SEUL!  
     123!!!         WHERE( rn2(:,:,jk) <= -1.e-12 ) avt(:,:,jk) = tmask(:,:,jk) * avevd   ! agissant sur T SEUL! 
    118124            DO jj = 1, jpj             ! loop over the whole domain (no lbc_lnk call) 
    119125               DO ji = 1, jpi 
    120126#if defined key_zdfkpp 
    121127                  ! no evd mixing in the boundary layer with KPP 
    122                   IF(  MIN( rn2(ji,jj,jk), rn2b(ji,jj,jk) ) <= -1.e-12  .AND.  fsdepw(ji,jj,jk) > hkpp(ji,jj)  )   &           
     128                  IF(  MIN( rn2(ji,jj,jk), rn2b(ji,jj,jk) ) <= -1.e-12  .AND.  fsdepw(ji,jj,jk) > hkpp(ji,jj)  )   & 
    123129#else 
    124130                  IF(  MIN( rn2(ji,jj,jk), rn2b(ji,jj,jk) ) <= -1.e-12 )   & 
     
    129135         END DO 
    130136         ! 
    131       END SELECT  
     137      END SELECT 
    132138 
    133139      zavt_evd(:,:,:) = avt(:,:,:) - zavt_evd(:,:,:)   ! change in avt due to evd 
  • branches/UKMO/dev_1d_bugfixes_tocommit/NEMOGCM/NEMO/OPA_SRC/ZDF/zdfgls.F90

    r11442 r13191  
    22   !!====================================================================== 
    33   !!                       ***  MODULE  zdfgls  *** 
    4    !! Ocean physics:  vertical mixing coefficient computed from the gls  
     4   !! Ocean physics:  vertical mixing coefficient computed from the gls 
    55   !!                 turbulent closure parameterization 
    66   !!====================================================================== 
     
    1616   !!   gls_rst       : read/write gls restart in ocean restart file 
    1717   !!---------------------------------------------------------------------- 
    18    USE oce            ! ocean dynamics and active tracers  
     18   USE oce            ! ocean dynamics and active tracers 
    1919   USE dom_oce        ! ocean space and time domain 
    2020   USE domvvl         ! ocean space and time domain : variable volume layer 
     
    3131   USE iom            ! I/O manager library 
    3232   USE timing         ! Timing 
    33    USE lib_fortran    ! Fortran utilities (allows no signed zero when 'key_nosignedzero' defined)   
     33   USE lib_fortran    ! Fortran utilities (allows no signed zero when 'key_nosignedzero' defined) 
    3434   USE stopack 
    3535 
     
    6262   REAL(wp) ::   rn_crban          ! Craig and Banner constant for surface breaking waves mixing 
    6363   REAL(wp) ::   rn_hsro           ! Minimum surface roughness 
    64    REAL(wp) ::   rn_frac_hs        ! Fraction of wave height as surface roughness (if nn_z0_met > 1)  
     64   REAL(wp) ::   rn_frac_hs        ! Fraction of wave height as surface roughness (if nn_z0_met > 1) 
    6565 
    6666   REAL(wp) ::   rcm_sf        =  0.73_wp     ! Shear free turbulence parameters 
    67    REAL(wp) ::   ra_sf         = -2.0_wp      ! Must be negative -2 < ra_sf < -1  
    68    REAL(wp) ::   rl_sf         =  0.2_wp      ! 0 <rl_sf<vkarmn     
     67   REAL(wp) ::   ra_sf         = -2.0_wp      ! Must be negative -2 < ra_sf < -1 
     68   REAL(wp) ::   rl_sf         =  0.2_wp      ! 0 <rl_sf<vkarmn 
    6969   REAL(wp) ::   rghmin        = -0.28_wp 
    7070   REAL(wp) ::   rgh0          =  0.0329_wp 
     
    7373   REAL(wp) ::   ra2           =  0.74_wp 
    7474   REAL(wp) ::   rb1           = 16.60_wp 
    75    REAL(wp) ::   rb2           = 10.10_wp          
    76    REAL(wp) ::   re2           =  1.33_wp          
     75   REAL(wp) ::   rb2           = 10.10_wp 
     76   REAL(wp) ::   re2           =  1.33_wp 
    7777   REAL(wp) ::   rl1           =  0.107_wp 
    7878   REAL(wp) ::   rl2           =  0.0032_wp 
     
    134134      INTEGER  ::   ji, jj, jk, ibot, ibotm1, dir  ! dummy loop arguments 
    135135      REAL(wp) ::   zesh2, zsigpsi, zcoef, zex1, zex2   ! local scalars 
    136       REAL(wp) ::   ztx2, zty2, zup, zdown, zcof        !   -      -  
     136      REAL(wp) ::   ztx2, zty2, zup, zdown, zcof        !   -      - 
    137137      REAL(wp) ::   zratio, zrn2, zflxb, sh             !   -      - 
    138138      REAL(wp) ::   prod, buoy, diss, zdiss, sm         !   -      - 
     
    140140      REAL(wp), POINTER, DIMENSION(:,:  ) ::   zdep 
    141141      REAL(wp), POINTER, DIMENSION(:,:  ) ::   zkar 
    142       REAL(wp), POINTER, DIMENSION(:,:  ) ::   zflxs       ! Turbulence fluxed induced by internal waves  
     142      REAL(wp), POINTER, DIMENSION(:,:  ) ::   zflxs       ! Turbulence fluxed induced by internal waves 
    143143      REAL(wp), POINTER, DIMENSION(:,:  ) ::   zhsro       ! Surface roughness (surface waves) 
    144144      REAL(wp), POINTER, DIMENSION(:,:,:) ::   eb          ! tke at time before 
     
    157157      CALL wrk_alloc( jpi,jpj, zdep, zkar, zflxs, zhsro ) 
    158158      CALL wrk_alloc( jpi,jpj,jpk, eb, mxlb, shear, eps, zwall_psi, z_elem_a, z_elem_b, z_elem_c, psi  ) 
    159        
     159 
    160160      ! Preliminary computing 
    161161 
     
    166166         avm (:,:,:) = avm_k (:,:,:) 
    167167         avmu(:,:,:) = avmu_k(:,:,:) 
    168          avmv(:,:,:) = avmv_k(:,:,:)  
     168         avmv(:,:,:) = avmv_k(:,:,:) 
    169169      ENDIF 
    170170 
    171171      ! Compute surface and bottom friction at T-points 
    172 !CDIR NOVERRCHK           
    173       DO jj = 2, jpjm1           
    174 !CDIR NOVERRCHK          
    175          DO ji = fs_2, fs_jpim1   ! vector opt.          
     172!CDIR NOVERRCHK 
     173      DO jj = 2, jpjm1 
     174!CDIR NOVERRCHK 
     175         DO ji = fs_2, fs_jpim1   ! vector opt. 
    176176            ! 
    177177            ! surface friction 
    178178            ustars2(ji,jj) = r1_rau0 * taum(ji,jj) * tmask(ji,jj,1) 
    179             !    
    180             ! bottom friction (explicit before friction)         
    181             ! Note that we chose here not to bound the friction as in dynbfr)    
    182             ztx2 = (  bfrua(ji,jj)  * ub(ji,jj,mbku(ji,jj)) + bfrua(ji-1,jj) * ub(ji-1,jj,mbku(ji-1,jj))  )   &          
    183                & * ( 1._wp - 0.5_wp * umask(ji,jj,1) * umask(ji-1,jj,1)  )       
    184             zty2 = (  bfrva(ji,jj)  * vb(ji,jj,mbkv(ji,jj)) + bfrva(ji,jj-1) * vb(ji,jj-1,mbkv(ji,jj-1))  )   &          
    185                & * ( 1._wp - 0.5_wp * vmask(ji,jj,1) * vmask(ji,jj-1,1)  )       
    186             ustarb2(ji,jj) = SQRT( ztx2 * ztx2 + zty2 * zty2 ) * tmask(ji,jj,1)          
    187          END DO          
    188       END DO     
     179            ! 
     180            ! bottom friction (explicit before friction) 
     181            ! Note that we chose here not to bound the friction as in dynbfr) 
     182            ztx2 = (  bfrua(ji,jj)  * ub(ji,jj,mbku(ji,jj)) + bfrua(ji-1,jj) * ub(ji-1,jj,mbku(ji-1,jj))  )   & 
     183               & * ( 1._wp - 0.5_wp * umask(ji,jj,1) * umask(ji-1,jj,1)  ) 
     184            zty2 = (  bfrva(ji,jj)  * vb(ji,jj,mbkv(ji,jj)) + bfrva(ji,jj-1) * vb(ji,jj-1,mbkv(ji,jj-1))  )   & 
     185               & * ( 1._wp - 0.5_wp * vmask(ji,jj,1) * vmask(ji,jj-1,1)  ) 
     186            ustarb2(ji,jj) = SQRT( ztx2 * ztx2 + zty2 * zty2 ) * tmask(ji,jj,1) 
     187         END DO 
     188      END DO 
    189189 
    190190      ! Set surface roughness length 
    191191      SELECT CASE ( nn_z0_met ) 
    192192      ! 
    193       CASE ( 0 )             ! Constant roughness           
     193      CASE ( 0 )             ! Constant roughness 
    194194         zhsro(:,:) = rn_hsro 
    195195      CASE ( 1 )             ! Standard Charnock formula 
     
    227227      IF( nn_clos == 0 ) THEN    ! Mellor-Yamada 
    228228         DO jk = 2, jpkm1 
    229             DO jj = 2, jpjm1  
     229            DO jj = 2, jpjm1 
    230230               DO ji = fs_2, fs_jpim1   ! vector opt. 
    231231                  zup   = mxln(ji,jj,jk) * fsdepw(ji,jj,mbkt(ji,jj)+1) 
     
    276276               IF( ln_sigpsi ) THEN 
    277277                  zsigpsi = MIN( 1._wp, zesh2 / eps(ji,jj,jk) )     ! 0. <= zsigpsi <= 1. 
    278                   zwall_psi(ji,jj,jk) = rsc_psi /   &  
     278                  zwall_psi(ji,jj,jk) = rsc_psi /   & 
    279279                     &     (  zsigpsi * rsc_psi + (1._wp-zsigpsi) * rsc_psi0 / MAX( zwall(ji,jj,jk), 1._wp )  ) 
    280280               ELSE 
     
    295295               ! diagonal 
    296296               z_elem_b(ji,jj,jk) = 1._wp - z_elem_a(ji,jj,jk) - z_elem_c(ji,jj,jk)  & 
    297                   &                       + rdt * zdiss * tmask(ji,jj,jk)  
     297                  &                       + rdt * zdiss * tmask(ji,jj,jk) 
    298298               ! 
    299299               ! right hand side in en 
     
    317317      ! First level 
    318318      en(:,:,1) = rc02r * ustars2(:,:) * (1._wp + rsbc_tke1)**(2._wp/3._wp) 
    319       en(:,:,1) = MAX(en(:,:,1), rn_emin)  
     319      en(:,:,1) = MAX(en(:,:,1), rn_emin) 
    320320      z_elem_a(:,:,1) = en(:,:,1) 
    321321      z_elem_c(:,:,1) = 0._wp 
    322322      z_elem_b(:,:,1) = 1._wp 
    323       !  
     323      ! 
    324324      ! One level below 
    325325      en(:,:,2) = rc02r * ustars2(:,:) * (1._wp + rsbc_tke1 * ((zhsro(:,:)+fsdepw(:,:,2)) & 
    326326          &            / zhsro(:,:) )**(1.5_wp*ra_sf))**(2._wp/3._wp) 
    327327      en(:,:,2) = MAX(en(:,:,2), rn_emin ) 
    328       z_elem_a(:,:,2) = 0._wp  
     328      z_elem_a(:,:,2) = 0._wp 
    329329      z_elem_c(:,:,2) = 0._wp 
    330330      z_elem_b(:,:,2) = 1._wp 
     
    335335      ! Dirichlet conditions at k=1 
    336336      en(:,:,1)       = rc02r * ustars2(:,:) * (1._wp + rsbc_tke1)**(2._wp/3._wp) 
    337       en(:,:,1)       = MAX(en(:,:,1), rn_emin)       
     337      en(:,:,1)       = MAX(en(:,:,1), rn_emin) 
    338338      z_elem_a(:,:,1) = en(:,:,1) 
    339339      z_elem_c(:,:,1) = 0._wp 
     
    358358      SELECT CASE ( nn_bc_bot ) 
    359359      ! 
    360       CASE ( 0 )             ! Dirichlet  
     360      CASE ( 0 )             ! Dirichlet 
    361361         !                      ! en(ibot) = u*^2 / Co2 and mxln(ibot) = rn_lmin 
    362362         !                      ! Balance between the production and the dissipation terms 
     
    378378               z_elem_c(ji,jj,ibotm1) = 0._wp 
    379379               z_elem_b(ji,jj,ibotm1) = 1._wp 
    380                en(ji,jj,ibotm1) = MAX( rc02r * ustarb2(ji,jj), rn_emin )  
     380               en(ji,jj,ibotm1) = MAX( rc02r * ustarb2(ji,jj), rn_emin ) 
    381381            END DO 
    382382         END DO 
    383383         ! 
    384384      CASE ( 1 )             ! Neumman boundary condition 
    385          !                       
     385         ! 
    386386!CDIR NOVERRCHK 
    387387         DO jj = 2, jpjm1 
     
    429429         END DO 
    430430      END DO 
    431       !                                            ! set the minimum value of tke  
     431      !                                            ! set the minimum value of tke 
    432432      en(:,:,:) = MAX( en(:,:,:), rn_emin ) 
    433433 
     
    471471            DO jj = 2, jpjm1 
    472472               DO ji = fs_2, fs_jpim1   ! vector opt. 
    473                   psi(ji,jj,jk)  = rc02 * eb(ji,jj,jk) * mxlb(ji,jj,jk)**rnn  
     473                  psi(ji,jj,jk)  = rc02 * eb(ji,jj,jk) * mxlb(ji,jj,jk)**rnn 
    474474               END DO 
    475475            END DO 
     
    490490               ! 
    491491               ! psi / k 
    492                zratio = psi(ji,jj,jk) / eb(ji,jj,jk)  
     492               zratio = psi(ji,jj,jk) / eb(ji,jj,jk) 
    493493               ! 
    494494               ! psi3+ : stable : B=-KhN²<0 => N²>0 if rn2>0 dir = 1 (stable) otherwise dir = 0 (unstable) 
     
    510510               zesh2 = dir * ( prod + buoy )          + (1._wp - dir ) * prod                        ! production term 
    511511               zdiss = dir * ( diss / psi(ji,jj,jk) ) + (1._wp - dir ) * (diss-buoy) / psi(ji,jj,jk) ! dissipation term 
    512                !                                                         
     512               ! 
    513513               ! building the matrix 
    514514               zcof = rfact_psi * zwall_psi(ji,jj,jk) * tmask(ji,jj,jk) 
     
    552552      z_elem_c(:,:,2) = 0._wp 
    553553      z_elem_b(:,:,2) = 1._wp 
    554       !  
     554      ! 
    555555      ! 
    556556      CASE ( 1 )             ! Neumann boundary condition on d(psi)/dz 
     
    576576      psi(:,:,2) = psi(:,:,2) + zflxs(:,:) / fse3w(:,:,2) 
    577577 
    578       !    
     578      ! 
    579579      ! 
    580580      END SELECT 
     
    586586      ! 
    587587      ! 
    588       CASE ( 0 )             ! Dirichlet  
     588      CASE ( 0 )             ! Dirichlet 
    589589         !                      ! en(ibot) = u*^2 / Co2 and mxln(ibot) = vkarmn * rn_bfrz0 
    590590         !                      ! Balance between the production and the dissipation terms 
     
    611611         ! 
    612612      CASE ( 1 )             ! Neumman boundary condition 
    613          !                       
     613         ! 
    614614!CDIR NOVERRCHK 
    615615         DO jj = 2, jpjm1 
     
    693693            DO jj = 2, jpjm1 
    694694               DO ji = fs_2, fs_jpim1   ! vector opt. 
    695                   eps(ji,jj,jk) = rc04 * en(ji,jj,jk) * psi(ji,jj,jk)  
     695                  eps(ji,jj,jk) = rc04 * en(ji,jj,jk) * psi(ji,jj,jk) 
    696696               END DO 
    697697            END DO 
     
    720720               eps(ji,jj,jk)  = MAX( eps(ji,jj,jk), rn_epsmin ) 
    721721               mxln(ji,jj,jk)  = rc03 * en(ji,jj,jk) * SQRT( en(ji,jj,jk) ) / eps(ji,jj,jk) 
    722                ! Galperin criterium (NOTE : Not required if the proper value of C3 in stable cases is calculated)  
     722               ! Galperin criterium (NOTE : Not required if the proper value of C3 in stable cases is calculated) 
    723723               zrn2 = MAX( rn2(ji,jj,jk), rsmall ) 
    724724               IF (ln_length_lim) mxln(ji,jj,jk) = MIN(  rn_clim_galp * SQRT( 2._wp * en(ji,jj,jk) / zrn2 ), mxln(ji,jj,jk) ) 
    725725            END DO 
    726726         END DO 
    727       END DO  
     727      END DO 
    728728 
    729729      ! 
     
    807807            END DO 
    808808         END DO 
     809#if defined key_traldf_c2d || key_traldf_c3d 
    809810         IF( ln_stopack) THEN 
    810811            IF( nn_spp_avt > 0 ) CALL spp_gen(kt, avt(:,:,jk), nn_spp_avt, rn_avt_sd,jk) 
    811812            IF( nn_spp_avm > 0 ) CALL spp_gen(kt, avm(:,:,jk), nn_spp_avm, rn_avm_sd,jk) 
    812          ENDIF  
     813         ENDIF 
     814#else 
     815         IF ( ln_stopack ) & 
     816            & CALL ctl_stop( 'zdf_gls: parameter perturbation will only work with '// & 
     817                             'key_traldf_c2d or key_traldf_c3d') 
     818#endif 
    813819      END DO 
    814820      ! 
     
    851857      !!---------------------------------------------------------------------- 
    852858      !!                  ***  ROUTINE zdf_gls_init  *** 
    853       !!                      
    854       !! ** Purpose :   Initialization of the vertical eddy diffivity and  
     859      !! 
     860      !! ** Purpose :   Initialization of the vertical eddy diffivity and 
    855861      !!      viscosity when using a gls turbulent closure scheme 
    856862      !! 
     
    10711077         ! 
    10721078      END SELECT 
    1073      
     1079 
    10741080      !                                !* Set Schmidt number for psi diffusion in the wave breaking case 
    10751081      !                                     ! See Eq. (13) of Carniel et al, OM, 30, 225-239, 2009 
    10761082      !                                     !  or Eq. (17) of Burchard, JPO, 31, 3133-3145, 2001 
    10771083      IF( ln_sigpsi ) THEN 
    1078          ra_sf = -1.5 ! Set kinetic energy slope, then deduce rsc_psi and rl_sf  
     1084         ra_sf = -1.5 ! Set kinetic energy slope, then deduce rsc_psi and rl_sf 
    10791085         ! Verification: retrieve Burchard (2001) results by uncomenting the line below: 
    10801086         ! Note that the results depend on the value of rn_cm_sf which is constant (=rc0) in his work 
     
    10841090         rsc_psi0 = rsc_psi 
    10851091      ENDIF 
    1086   
     1092 
    10871093      !                                !* Shear free turbulence parameters 
    10881094      ! 
     
    11301136      rc04  = rc03 * rc0 
    11311137      rsbc_tke1 = -3._wp/2._wp*rn_crban*ra_sf*rl_sf                      ! Dirichlet + Wave breaking 
    1132       rsbc_tke2 = rdt * rn_crban / rl_sf                                 ! Neumann + Wave breaking  
     1138      rsbc_tke2 = rdt * rn_crban / rl_sf                                 ! Neumann + Wave breaking 
    11331139      zcr = MAX(rsmall, rsbc_tke1**(1./(-ra_sf*3._wp/2._wp))-1._wp ) 
    1134       rtrans = 0.2_wp / zcr                                              ! Ad. inverse transition length between log and wave layer  
     1140      rtrans = 0.2_wp / zcr                                              ! Ad. inverse transition length between log and wave layer 
    11351141      rsbc_zs1  = rn_charn/grav                                          ! Charnock formula for surface roughness 
    1136       rsbc_zs2  = rn_frac_hs / 0.85_wp / grav * 665._wp                  ! Rascle formula for surface roughness  
     1142      rsbc_zs2  = rn_frac_hs / 0.85_wp / grav * 665._wp                  ! Rascle formula for surface roughness 
    11371143      rsbc_psi1 = -0.5_wp * rdt * rc0**(rpp-2._wp*rmm) / rsc_psi 
    1138       rsbc_psi2 = -0.5_wp * rdt * rc0**rpp * rnn * vkarmn**rnn / rsc_psi ! Neumann + NO Wave breaking  
     1144      rsbc_psi2 = -0.5_wp * rdt * rc0**rpp * rnn * vkarmn**rnn / rsc_psi ! Neumann + NO Wave breaking 
    11391145 
    11401146      rfact_tke = -0.5_wp / rsc_tke * rdt                                ! Cst used for the Diffusion term of tke 
     
    11511157         avmv(:,:,jk) = avmb(jk) * vmask(:,:,jk) 
    11521158      END DO 
    1153       !                               
     1159      ! 
    11541160      CALL gls_rst( nit000, 'READ' )   !* read or initialize all required files 
    11551161      ! 
     
    11621168      !!--------------------------------------------------------------------- 
    11631169      !!                   ***  ROUTINE ts_rst  *** 
    1164       !!                      
     1170      !! 
    11651171      !! ** Purpose :   Read or write TKE file (en) in restart file 
    11661172      !! 
    11671173      !! ** Method  :   use of IOM library 
    1168       !!                if the restart does not contain TKE, en is either  
     1174      !!                if the restart does not contain TKE, en is either 
    11691175      !!                set to rn_emin or recomputed (nn_igls/=0) 
    11701176      !!---------------------------------------------------------------------- 
     
    11781184      !!---------------------------------------------------------------------- 
    11791185      ! 
    1180       IF( TRIM(cdrw) == 'READ' ) THEN        ! Read/initialise  
     1186      IF( TRIM(cdrw) == 'READ' ) THEN        ! Read/initialise 
    11811187         !                                   ! --------------- 
    11821188         IF( ln_rstart ) THEN                   !* Read the restart file 
     
    11971203               CALL iom_get( numror, jpdom_autoglo, 'mxln'  , mxln   ) 
    11981204               IF(nn_timing == 2)  CALL timing_stop('iom_rstget') 
    1199             ELSE                         
     1205            ELSE 
    12001206               IF(lwp) WRITE(numout,*) ' ===>>>> : previous run without gls scheme, en and mxln computed by iterative loop' 
    12011207               en  (:,:,:) = rn_emin 
    1202                mxln(:,:,:) = 0.05         
     1208               mxln(:,:,:) = 0.05 
    12031209               avt_k (:,:,:) = avt (:,:,:) 
    12041210               avm_k (:,:,:) = avm (:,:,:) 
     
    12101216            IF(lwp) WRITE(numout,*) ' ===>>>> : Initialisation of en and mxln by background values' 
    12111217            en  (:,:,:) = rn_emin 
    1212             mxln(:,:,:) = 0.05        
     1218            mxln(:,:,:) = 0.05 
    12131219         ENDIF 
    12141220         ! 
     
    12171223         IF(lwp) WRITE(numout,*) '---- gls-rst ----' 
    12181224         IF(nn_timing == 2)  CALL timing_start('iom_rstput') 
    1219          CALL iom_rstput( kt, nitrst, numrow, 'en'   , en     )  
     1225         CALL iom_rstput( kt, nitrst, numrow, 'en'   , en     ) 
    12201226         CALL iom_rstput( kt, nitrst, numrow, 'avt'  , avt_k  ) 
    12211227         CALL iom_rstput( kt, nitrst, numrow, 'avm'  , avm_k  ) 
    1222          CALL iom_rstput( kt, nitrst, numrow, 'avmu' , avmu_k )  
     1228         CALL iom_rstput( kt, nitrst, numrow, 'avmu' , avmu_k ) 
    12231229         CALL iom_rstput( kt, nitrst, numrow, 'avmv' , avmv_k ) 
    12241230         CALL iom_rstput( kt, nitrst, numrow, 'mxln' , mxln   ) 
     
    12391245      WRITE(*,*) 'zdf_gls_init: You should not have seen this print! error?' 
    12401246   END SUBROUTINE zdf_gls_init 
    1241     
     1247 
    12421248   SUBROUTINE zdf_gls( kt )          ! Empty routine 
    12431249   IMPLICIT NONE 
    1244       INTEGER, INTENT(in) ::   kt ! ocean time step    
     1250      INTEGER, INTENT(in) ::   kt ! ocean time step 
    12451251      WRITE(*,*) 'zdf_gls: You should not have seen this print! error?', kt 
    12461252   END SUBROUTINE zdf_gls 
    1247     
     1253 
    12481254   SUBROUTINE gls_rst( kt, cdrw )          ! Empty routine 
    12491255   IMPLICIT NONE 
     
    12561262   !!====================================================================== 
    12571263END MODULE zdfgls 
    1258  
  • branches/UKMO/dev_1d_bugfixes_tocommit/NEMOGCM/NEMO/OPA_SRC/ZDF/zdftke.F90

    r11442 r13191  
    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 
     
    5252   USE wrk_nemo       ! work arrays 
    5353   USE timing         ! Timing 
    54    USE lib_fortran    ! Fortran utilities (allows no signed zero when 'key_nosignedzero' defined)   
     54   USE lib_fortran    ! Fortran utilities (allows no signed zero when 'key_nosignedzero' defined) 
    5555#if defined key_agrif 
    5656   USE agrif_opa_interp 
     
    7474   INTEGER  ::   nn_pdl    ! Prandtl number or not (ratio avt/avm) (=0/1) 
    7575   REAL(wp) ::   rn_ediff  ! coefficient for avt: avt=rn_ediff*mxl*sqrt(e) 
    76    REAL(wp) ::   rn_ediss  ! coefficient of the Kolmogoroff dissipation  
     76   REAL(wp) ::   rn_ediss  ! coefficient of the Kolmogoroff dissipation 
    7777   REAL(wp) ::   rn_ebb    ! coefficient of the surface input of tke 
    7878   REAL(wp) ::   rn_emin   ! minimum value of tke           [m2/s2] 
     
    102102   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::   e_niw          !: TKE budget- near-inertial waves term 
    103103   REAL(wp)        , ALLOCATABLE, SAVE, DIMENSION(:,:)   ::   efr            ! surface boundary condition for nn_etau = 4 
    104     
     104 
    105105   !! * Substitutions 
    106106#  include "domzgr_substitute.h90" 
     
    118118      !!---------------------------------------------------------------------- 
    119119      ALLOCATE(                                                                    & 
    120          &      efr  (jpi,jpj)     , e_niw(jpi,jpj,jpk) ,                         &       
     120         &      efr  (jpi,jpj)     , e_niw(jpi,jpj,jpk) ,                         & 
    121121#if defined key_c1d 
    122122         &      e_dis(jpi,jpj,jpk) , e_mix(jpi,jpj,jpk) ,                          & 
     
    147147      !!         surface: en = max( rn_emin0, rn_ebb * taum ) 
    148148      !!         bottom : en = rn_emin 
    149       !!      The associated critical Richardson number is: ri_cri = 2/(2+rn_ediss/rn_ediff)  
    150       !! 
    151       !!        The now Turbulent kinetic energy is computed using the following  
     149      !!      The associated critical Richardson number is: ri_cri = 2/(2+rn_ediss/rn_ediff) 
     150      !! 
     151      !!        The now Turbulent kinetic energy is computed using the following 
    152152      !!      time stepping: implicit for vertical diffusion term, linearized semi 
    153       !!      implicit for kolmogoroff dissipation term, and explicit forward for  
    154       !!      both buoyancy and shear production terms. Therefore a tridiagonal  
     153      !!      implicit for kolmogoroff dissipation term, and explicit forward for 
     154      !!      both buoyancy and shear production terms. Therefore a tridiagonal 
    155155      !!      linear system is solved. Note that buoyancy and shear terms are 
    156156      !!      discretized in a energy conserving form (Bruchard 2002). 
     
    160160      !! 
    161161      !!        The now vertical eddy vicosity and diffusivity coefficients are 
    162       !!      given by:  
     162      !!      given by: 
    163163      !!              avm = max( avtb, rn_ediff * zmxlm * en^1/2 ) 
    164       !!              avt = max( avmb, pdl * avm                 )   
     164      !!              avt = max( avmb, pdl * avm                 ) 
    165165      !!              eav = max( avmb, avm ) 
    166166      !!      where pdl, the inverse of the Prandtl number is 1 if nn_pdl=0 and 
    167       !!      given by an empirical funtion of the localRichardson number if nn_pdl=1  
     167      !!      given by an empirical funtion of the localRichardson number if nn_pdl=1 
    168168      !! 
    169169      !! ** Action  :   compute en (now turbulent kinetic energy) 
     
    180180      ! 
    181181      IF( kt /= nit000 ) THEN   ! restore before value to compute tke 
    182          avt (:,:,:) = avt_k (:,:,:)  
    183          avm (:,:,:) = avm_k (:,:,:)  
    184          avmu(:,:,:) = avmu_k(:,:,:)  
    185          avmv(:,:,:) = avmv_k(:,:,:)  
    186       ENDIF 
    187       ! 
     182         avt (:,:,:) = avt_k (:,:,:) 
     183         avm (:,:,:) = avm_k (:,:,:) 
     184         avmu(:,:,:) = avmu_k(:,:,:) 
     185         avmv(:,:,:) = avmv_k(:,:,:) 
     186      ENDIF 
     187      ! 
     188#if defined key_traldf_c2d || key_traldf_c3d 
    188189      IF( ln_stopack) THEN 
    189190         IF( nn_spp_tkelc > 0 ) THEN 
     
    208209         ENDIF 
    209210      ENDIF 
     211#else 
     212      IF ( ln_stopack ) & 
     213         & CALL ctl_stop( 'zdf_tke: parameter perturbation will only work with '// & 
     214                          'key_traldf_c2d or key_traldf_c3d') 
     215#endif 
    210216      ! 
    211217      CALL tke_tke      ! now tke (en) 
     
    213219      CALL tke_avn      ! now avt, avm, avmu, avmv 
    214220      ! 
    215       avt_k (:,:,:) = avt (:,:,:)  
    216       avm_k (:,:,:) = avm (:,:,:)  
    217       avmu_k(:,:,:) = avmu(:,:,:)  
    218       avmv_k(:,:,:) = avmv(:,:,:)  
     221      avt_k (:,:,:) = avt (:,:,:) 
     222      avm_k (:,:,:) = avm (:,:,:) 
     223      avmu_k(:,:,:) = avmu(:,:,:) 
     224      avmv_k(:,:,:) = avmv(:,:,:) 
    219225      ! 
    220226#if defined key_agrif 
    221       ! Update child grid f => parent grid  
     227      ! Update child grid f => parent grid 
    222228      IF( .NOT.Agrif_Root() )   CALL Agrif_Update_Tke( kt )      ! children only 
    223 #endif       
     229#endif 
    224230      IF (  kt == nitend ) THEN 
    225231        DEALLOCATE ( rn_lc0, rn_ediff0, rn_ediss0, rn_ebb0, rn_efr0 ) 
     
    271277      CALL wrk_alloc( jpi,jpj, zfact2 ) 
    272278      CALL wrk_alloc( jpi,jpj, zfact3 ) 
    273       CALL wrk_alloc( jpi,jpj,jpk, zpelc, zdiag, zd_up, zd_lw )  
     279      CALL wrk_alloc( jpi,jpj,jpk, zpelc, zdiag, zd_up, zd_lw ) 
    274280      ! 
    275281      zbbrau = rn_ebb0 / rau0       ! Local constant initialisation 
    276       zfact1 = -.5_wp * rdt  
     282      zfact1 = -.5_wp * rdt 
    277283      zfact2 = 1.5_wp * rdt * rn_ediss0 
    278284      zfact3 = 0.5_wp       * rn_ediss0 
     
    294300         END DO 
    295301      END DO 
    296        
     302 
    297303!!bfr   - start commented area 
    298304      !                     !<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< 
     
    333339         imlc(:,:) = mbkt(:,:) + 1       ! Initialization to the number of w ocean point (=2 over land) 
    334340         DO jk = jpkm1, 2, -1 
    335             DO jj = 1, jpj               ! Last w-level at which zpelc>=0.5*us*us  
     341            DO jj = 1, jpj               ! Last w-level at which zpelc>=0.5*us*us 
    336342               DO ji = 1, jpi            !      with us=0.016*wind(starting from jpk-1) 
    337343                  zus  = zcof * taum(ji,jj) 
     
    341347         END DO 
    342348         !                               ! finite LC depth 
    343          DO jj = 1, jpj  
     349         DO jj = 1, jpj 
    344350            DO ji = 1, jpi 
    345351               zhlc(ji,jj) = fsdepw(ji,jj,imlc(ji,jj)) 
     
    378384            DO ji = 1, jpi 
    379385               avmu(ji,jj,jk) = avmu(ji,jj,jk) * ( un(ji,jj,jk-1) - un(ji,jj,jk) )   & 
    380                   &                            * ( ub(ji,jj,jk-1) - ub(ji,jj,jk) )   &  
     386                  &                            * ( ub(ji,jj,jk-1) - ub(ji,jj,jk) )   & 
    381387                  &                            / (  fse3uw_n(ji,jj,jk)               & 
    382388                  &                              *  fse3uw_b(ji,jj,jk)  ) 
     
    407413                  !                                                           ! shear prod. at w-point weightened by mask 
    408414               zesh2  =  ( avmu(ji-1,jj,jk) + avmu(ji,jj,jk) ) / MAX( 1._wp , umask(ji-1,jj,jk) + umask(ji,jj,jk) )   & 
    409                   &    + ( avmv(ji,jj-1,jk) + avmv(ji,jj,jk) ) / MAX( 1._wp , vmask(ji,jj-1,jk) + vmask(ji,jj,jk) )     
     415                  &    + ( avmv(ji,jj-1,jk) + avmv(ji,jj,jk) ) / MAX( 1._wp , vmask(ji,jj-1,jk) + vmask(ji,jj,jk) ) 
    410416                  ! 
    411417               zd_up(ji,jj,jk) = zzd_up            ! Matrix (zdiag, zd_up, zd_lw) 
     
    464470      END DO 
    465471 
    466       !                                 ! Save TKE prior to nn_etau addition   
    467       e_niw(:,:,:) = en(:,:,:)   
    468       !   
     472      !                                 ! Save TKE prior to nn_etau addition 
     473      e_niw(:,:,:) = en(:,:,:) 
     474      ! 
    469475      !                            !<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< 
    470476      !                            !  TKE due to surface and internal wave breaking 
     
    508514                  ztx2 = utau(ji-1,jj  ) + utau(ji,jj) 
    509515                  zty2 = vtau(ji  ,jj-1) + vtau(ji,jj) 
    510                   ztau = 0.5_wp * SQRT( ztx2 * ztx2 + zty2 * zty2 ) * tmask(ji,jj,1)    ! module of the mean stress  
    511                   zdif = taum(ji,jj) - ztau                            ! mean of modulus - modulus of the mean  
     516                  ztau = 0.5_wp * SQRT( ztx2 * ztx2 + zty2 * zty2 ) * tmask(ji,jj,1)    ! module of the mean stress 
     517                  zdif = taum(ji,jj) - ztau                            ! mean of modulus - modulus of the mean 
    512518                  zdif = rhftau_scl * MAX( 0._wp, zdif + rhftau_add )  ! apply some modifications... 
    513519                  en(ji,jj,jk) = en(ji,jj,jk) + zbbrau(ji,jj) * zdif * EXP( -fsdepw(ji,jj,jk) / htau(ji,jj) )   & 
     
    517523         END DO 
    518524      ELSEIF( nn_etau == 4 ) THEN       !* column integral independant of htau (rn_efr must be scaled up) 
    519          IF( nn_htau == 2 ) THEN        ! efr dependant on time-varying htau  
     525         IF( nn_htau == 2 ) THEN        ! efr dependant on time-varying htau 
    520526            DO jj = 2, jpjm1 
    521527               DO ji = fs_2, fs_jpim1   ! vector opt. 
     
    535541      CALL lbc_lnk( en, 'W', 1. )      ! Lateral boundary conditions (sign unchanged) 
    536542      ! 
    537       DO jk = 2, jpkm1                             ! TKE budget: near-inertial waves term   
    538          DO jj = 2, jpjm1   
    539             DO ji = fs_2, fs_jpim1   ! vector opt.   
    540                e_niw(ji,jj,jk) = en(ji,jj,jk) - e_niw(ji,jj,jk)   
    541             END DO   
    542          END DO   
    543       END DO   
    544       !   
    545       CALL lbc_lnk( e_niw, 'W', 1. )   
     543      DO jk = 2, jpkm1                             ! TKE budget: near-inertial waves term 
     544         DO jj = 2, jpjm1 
     545            DO ji = fs_2, fs_jpim1   ! vector opt. 
     546               e_niw(ji,jj,jk) = en(ji,jj,jk) - e_niw(ji,jj,jk) 
     547            END DO 
     548         END DO 
     549      END DO 
     550      ! 
     551      CALL lbc_lnk( e_niw, 'W', 1. ) 
    546552      ! 
    547553      CALL wrk_dealloc( jpi,jpj, imlc )    ! integer 
    548       CALL wrk_dealloc( jpi,jpj, zhlc )  
    549       CALL wrk_dealloc( jpi,jpj, zbbrau )  
    550       CALL wrk_dealloc( jpi,jpj, zfact2 )  
    551       CALL wrk_dealloc( jpi,jpj, zfact3 )  
    552       CALL wrk_dealloc( jpi,jpj,jpk, zpelc, zdiag, zd_up, zd_lw )  
     554      CALL wrk_dealloc( jpi,jpj, zhlc ) 
     555      CALL wrk_dealloc( jpi,jpj, zbbrau ) 
     556      CALL wrk_dealloc( jpi,jpj, zfact2 ) 
     557      CALL wrk_dealloc( jpi,jpj, zfact3 ) 
     558      CALL wrk_dealloc( jpi,jpj,jpk, zpelc, zdiag, zd_up, zd_lw ) 
    553559      ! 
    554560      IF( nn_timing == 1 )  CALL timing_stop('tke_tke') 
     
    563569      !! ** Purpose :   Compute the vertical eddy viscosity and diffusivity 
    564570      !! 
    565       !! ** Method  :   At this stage, en, the now TKE, is known (computed in  
    566       !!              the tke_tke routine). First, the now mixing lenth is  
     571      !! ** Method  :   At this stage, en, the now TKE, is known (computed in 
     572      !!              the tke_tke routine). First, the now mixing lenth is 
    567573      !!      computed from en and the strafification (N^2), then the mixings 
    568574      !!      coefficients are computed. 
    569575      !!              - Mixing length : a first evaluation of the mixing lengh 
    570576      !!      scales is: 
    571       !!                      mxl = sqrt(2*en) / N   
     577      !!                      mxl = sqrt(2*en) / N 
    572578      !!      where N is the brunt-vaisala frequency, with a minimum value set 
    573579      !!      to rmxl_min (rn_mxl0) in the interior (surface) ocean. 
    574       !!        The mixing and dissipative length scale are bound as follow :  
     580      !!        The mixing and dissipative length scale are bound as follow : 
    575581      !!         nn_mxl=0 : mxl bounded by the distance to surface and bottom. 
    576582      !!                        zmxld = zmxlm = mxl 
    577583      !!         nn_mxl=1 : mxl bounded by the e3w and zmxld = zmxlm = mxl 
    578       !!         nn_mxl=2 : mxl bounded such that the vertical derivative of mxl is  
     584      !!         nn_mxl=2 : mxl bounded such that the vertical derivative of mxl is 
    579585      !!                    less than 1 (|d/dz(mxl)|<1) and zmxld = zmxlm = mxl 
    580586      !!         nn_mxl=3 : mxl is bounded from the surface to the bottom usings 
    581       !!                    |d/dz(xml)|<1 to obtain lup, and from the bottom to  
    582       !!                    the surface to obtain ldown. the resulting length  
     587      !!                    |d/dz(xml)|<1 to obtain lup, and from the bottom to 
     588      !!                    the surface to obtain ldown. the resulting length 
    583589      !!                    scales are: 
    584       !!                        zmxld = sqrt( lup * ldown )  
     590      !!                        zmxld = sqrt( lup * ldown ) 
    585591      !!                        zmxlm = min ( lup , ldown ) 
    586592      !!              - Vertical eddy viscosity and diffusivity: 
    587593      !!                      avm = max( avtb, rn_ediff * zmxlm * en^1/2 ) 
    588       !!                      avt = max( avmb, pdlr * avm )   
     594      !!                      avt = max( avmb, pdlr * avm ) 
    589595      !!      with pdlr=1 if nn_pdl=0, pdlr=1/pdl=F(Ri) otherwise. 
    590596      !! 
     
    601607      IF( nn_timing == 1 )  CALL timing_start('tke_avn') 
    602608 
    603       CALL wrk_alloc( jpi,jpj,jpk, zmpdl, zmxlm, zmxld )  
     609      CALL wrk_alloc( jpi,jpj,jpk, zmpdl, zmxlm, zmxld ) 
    604610 
    605611      !                     !<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< 
     
    610616      ! 
    611617      ! initialisation of interior minimum value (avoid a 2d loop with mikt) 
    612       zmxlm(:,:,:)  = rmxl_min     
     618      zmxlm(:,:,:)  = rmxl_min 
    613619      zmxld(:,:,:)  = rmxl_min 
    614620      ! 
     
    620626            END DO 
    621627         END DO 
    622       ELSE  
     628      ELSE 
    623629         zmxlm(:,:,1) = rn_mxl0 
    624630      ENDIF 
     
    638644      !                     !* Physical limits for the mixing length 
    639645      ! 
    640       zmxld(:,:,1  ) = zmxlm(:,:,1)   ! surface set to the minimum value  
     646      zmxld(:,:,1  ) = zmxlm(:,:,1)   ! surface set to the minimum value 
    641647      zmxld(:,:,jpk) = rmxl_min       ! last level  set to the minimum value 
    642648      ! 
     
    738744            END DO 
    739745         END DO 
     746#if defined key_traldf_c2d || key_traldf_c3d 
    740747         IF( ln_stopack) THEN 
    741748            IF(nn_spp_avt > 0 ) CALL spp_gen( 1, avt(:,:,jk), nn_spp_avt, rn_avt_sd, jk_spp_avt, jk) 
    742749            IF(nn_spp_avm > 0 ) CALL spp_gen( 1, avm(:,:,jk), nn_spp_avm, rn_avm_sd, jk_spp_avm, jk) 
    743750         ENDIF 
     751#else 
     752         IF ( ln_stopack  ) & 
     753            & CALL ctl_stop( 'tke_avn: parameter perturbation will only work with '// & 
     754                             'key_traldf_c2d or key_traldf_c3d') 
     755#endif 
    744756      END DO 
    745757      CALL lbc_lnk( avm, 'W', 1. )      ! Lateral boundary conditions (sign unchanged) 
     
    787799      ENDIF 
    788800      ! 
    789       CALL wrk_dealloc( jpi,jpj,jpk, zmpdl, zmxlm, zmxld )  
     801      CALL wrk_dealloc( jpi,jpj,jpk, zmpdl, zmxlm, zmxld ) 
    790802      ! 
    791803      IF( nn_timing == 1 )  CALL timing_stop('tke_avn') 
     
    797809      !!---------------------------------------------------------------------- 
    798810      !!                  ***  ROUTINE zdf_tke_init  *** 
    799       !!                      
    800       !! ** Purpose :   Initialization of the vertical eddy diffivity and  
     811      !! 
     812      !! ** Purpose :   Initialization of the vertical eddy diffivity and 
    801813      !!              viscosity when using a tke turbulent closure scheme 
    802814      !! 
     
    814826         &                 rn_emin0, rn_bshear, nn_mxl , ln_mxl0  ,   & 
    815827         &                 rn_mxl0 , nn_pdl   , ln_lc  , rn_lc    ,   & 
    816          &                 nn_etau , nn_htau  , rn_efr , rn_c    
     828         &                 nn_etau , nn_htau  , rn_efr , rn_c 
    817829      !!---------------------------------------------------------------------- 
    818830 
     
    884896      ALLOCATE( rn_ebb0  (jpi,jpj) ) ; rn_ebb0   = rn_ebb 
    885897      ALLOCATE( rn_efr0  (jpi,jpj) ) ; rn_efr0   = rn_efr 
    886        
     898 
    887899      IF( nn_etau == 2  ) THEN 
    888900          ierr = zdf_mxl_alloc() 
     
    896908 
    897909      !                               !* depth of penetration of surface tke 
    898       IF( nn_etau /= 0 ) THEN       
     910      IF( nn_etau /= 0 ) THEN 
    899911         htau(:,:) = 0._wp 
    900912         SELECT CASE( nn_htau )             ! Choice of the depth of penetration 
     
    902914            htau(:,:) = 10._wp 
    903915         CASE( 1 )                                 ! F(latitude) : 0.5m to 30m poleward of 40 degrees 
    904             htau(:,:) = MAX(  0.5_wp, MIN( 30._wp, 45._wp* ABS( SIN( rpi/180._wp * gphit(:,:) ) ) )   )             
     916            htau(:,:) = MAX(  0.5_wp, MIN( 30._wp, 45._wp* ABS( SIN( rpi/180._wp * gphit(:,:) ) ) )   ) 
    905917         CASE( 2 )                                 ! fraction of depth-integrated TKE within mixed-layer 
    906918            rhtau = -1._wp / LOG( 1._wp - rn_c ) 
     
    945957      END DO 
    946958      dissl(:,:,:) = 1.e-12_wp 
    947       !                               
     959      ! 
    948960      CALL tke_rst( nit000, 'READ' )  !* read or initialize all required files 
    949961      ! 
     
    954966     !!--------------------------------------------------------------------- 
    955967     !!                   ***  ROUTINE tke_rst  *** 
    956      !!                      
     968     !! 
    957969     !! ** Purpose :   Read or write TKE file (en) in restart file 
    958970     !! 
    959971     !! ** Method  :   use of IOM library 
    960      !!                if the restart does not contain TKE, en is either  
    961      !!                set to rn_emin or recomputed  
     972     !!                if the restart does not contain TKE, en is either 
     973     !!                set to rn_emin or recomputed 
    962974     !!---------------------------------------------------------------------- 
    963975     INTEGER         , INTENT(in) ::   kt     ! ocean time-step 
     
    968980     !!---------------------------------------------------------------------- 
    969981     ! 
    970      IF( TRIM(cdrw) == 'READ' ) THEN        ! Read/initialise  
     982     IF( TRIM(cdrw) == 'READ' ) THEN        ! Read/initialise 
    971983        !                                   ! --------------- 
    972984        IF( ln_rstart ) THEN                   !* Read the restart file 
     
    10061018        avmu_k(:,:,:) = avmu(:,:,:) 
    10071019        avmv_k(:,:,:) = avmv(:,:,:) 
    1008          
     1020 
    10091021     ELSEIF( TRIM(cdrw) == 'WRITE' ) THEN   ! Create restart file 
    10101022        !                                   ! ------------------- 
Note: See TracChangeset for help on using the changeset viewer.