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 1546 for trunk/NEMO/OPA_SRC/ZDF/zdfevd.F90 – NEMO

Ignore:
Timestamp:
2009-07-27T15:39:29+02:00 (15 years ago)
Author:
ctlod
Message:

small optimisation, see ticket: #495

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/NEMO/OPA_SRC/ZDF/zdfevd.F90

    r1537 r1546  
    4545      !!      sivity coefficients when a static instability is encountered. 
    4646      !! 
    47       !! ** Method  :   avt, and the 4 neighbouring avmu, avmv coefficients 
     47      !! ** Method  :   avt, avm, and the 4 neighbouring avmu, avmv coefficients 
    4848      !!      are set to avevd (namelist parameter) if the water column is  
    4949      !!      statically unstable (i.e. if rn2 < -1.e-12 ) 
    5050      !! 
    51       !! ** Action  :   Update avt, avmu, avmv in statically instable cases 
    52       !!                and avt_evd which is avt due to convection 
     51      !! ** Action  :   avt, avm, avmu, avmv updted in static instability cases 
     52      !! 
    5353      !! References :   Lazar, A., these de l'universite Paris VI, France, 1997 
    5454      !!---------------------------------------------------------------------- 
     55      USE oce,   zav_evd  =>   ua   ! use ua as workspace 
     56      !! 
    5557      INTEGER, INTENT( in ) ::   kt         ! ocean time-step indexocean time step 
    5658      !! 
     
    6567      ENDIF 
    6668 
    67       ! Initialisation of avt_evd (vertical diffusion due to convection) to avt and avmu_evd to avmu 
    68       avt_evd  (:,:,:) = avt(:,:,:)  
    69       avmu_evd (:,:,:) = avmu(:,:,:)  
     69      zav_evd(:,:,:) = avt(:,:,:)           ! set avt prior to evd application 
    7070 
    7171      SELECT CASE ( nn_evdm ) 
    7272  
    7373      CASE ( 1 )           ! enhance vertical eddy viscosity and diffusivity (if rn2<-1.e-12) 
    74          !                                                ! =============== 
    75          DO jk = 1, jpkm1                                 ! Horizontal slab 
    76             !                                             ! =============== 
     74         DO jk = 1, jpkm1  
    7775#if defined key_vectopt_loop 
    7876            DO jj = 1, 1                     ! big loop forced 
     
    8381#endif 
    8482#if defined key_zdfkpp 
    85 !! no implicit mixing in the boundary layer with KPP 
     83                  ! no evd mixing in the boundary layer with KPP 
    8684                  IF( ( MIN( rn2(ji,jj,jk),  rn2b(ji,jj,jk) ) <= -1.e-12 ) .AND. ( fsdepw(ji,jj,jk) > hkpp(ji,jj) ) ) THEN 
    8785#else 
     
    9795               END DO 
    9896            END DO 
    99             !                                             ! =============== 
    100          END DO                                           !   End of slab 
    101          !                                                ! =============== 
    102  
    103          ! Lateral boundary conditions on ( avt, avmu, avmv )   (unchanged sign) 
    104          ! -------------------------------=================== 
    105          CALL lbc_lnk( avt , 'W', 1. ) 
    106          CALL lbc_lnk( avm , 'W', 1. ) 
    107          CALL lbc_lnk( avmu, 'U', 1. ) 
    108          CALL lbc_lnk( avmv, 'V', 1. ) 
    109  
     97         END DO  
     98         CALL lbc_lnk( avt , 'W', 1. )   ;   CALL lbc_lnk( avm , 'W', 1. )   ! Lateral boundary conditions   (unchanged sign) 
     99         CALL lbc_lnk( avmu, 'U', 1. )   ;   CALL lbc_lnk( avmv, 'V', 1. ) 
     100         ! 
    110101      CASE DEFAULT         ! enhance vertical eddy diffusivity only (if rn2<-1.e-12)  
    111          !                                                ! =============== 
    112          DO jk = 1, jpkm1                                 ! Horizontal slab 
    113             !                                             ! =============== 
    114 !!!         WHERE( rn2(:,:,jk) <= -1.e-12 ) avt(:,:,jk) = tmask(:,:,jk) * rn_avevd   ! agissant sur T SEUL!  
     102         DO jk = 1, jpkm1 
     103!!!         WHERE( rn2(:,:,jk) <= -1.e-12 ) avt(:,:,jk) = tmask(:,:,jk) * avevd   ! agissant sur T SEUL!  
    115104#if defined key_vectopt_loop 
    116105            DO jj = 1, 1                     ! big loop forced 
     
    121110#endif 
    122111#if defined key_zdfkpp 
    123 !! no implicit mixing in the boundary layer with KPP 
     112                  ! no evd mixing in the boundary layer with KPP 
    124113                  IF( ( MIN( rn2(ji,jj,jk), rn2b(ji,jj,jk) ) <= -1.e-12 ) .AND. ( fsdepw(ji,jj,jk) > hkpp(ji,jj) ) ) &           
    125114#else 
     
    129118               END DO 
    130119            END DO 
    131             !                                             ! =============== 
    132          END DO                                           !   End of slab 
    133          !                                                ! =============== 
     120         END DO 
     121         ! 
    134122      END SELECT  
    135123 
    136       ! update of avt_evd and avmu_evd 
    137       avt_evd (:,:,:) = avt (:,:,:) - avt_evd (:,:,:)  
    138       avmu_evd(:,:,:) = avmu(:,:,:) - avmu_evd(:,:,:)  
    139       CALL iom_put( "avt_evd", avt_evd  )    ! T enhan. vert. eddy diff. coef. 
    140       CALL iom_put( "avm_evd", avmu_evd )    ! T enhan. vert. eddy visc. coef. 
    141  
     124      zav_evd(:,:,:) = avt(:,:,:) - zav_evd(:,:,:)      ! change in avt due to evd 
     125      CALL iom_put( "avt_evd", zav_evd )                ! output this change 
     126      ! 
    142127   END SUBROUTINE zdf_evd 
    143128 
Note: See TracChangeset for help on using the changeset viewer.