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 7351 for branches/2016/dev_INGV_UKMO_2016/NEMOGCM/NEMO/OPA_SRC/TRA/trazdf_imp.F90 – NEMO

Ignore:
Timestamp:
2016-11-28T17:04:10+01:00 (7 years ago)
Author:
emanuelaclementi
Message:

ticket #1805 step 3: /2016/dev_INGV_UKMO_2016 aligned to the trunk at revision 7161

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/2016/dev_INGV_UKMO_2016/NEMOGCM/NEMO/OPA_SRC/TRA/trazdf_imp.F90

    r5836 r7351  
    1616   !!            3.3  !  2010-06  (C. Ethe, G. Madec) Merge TRA-TRC 
    1717   !!             -   !  2011-02  (A. Coward, C. Ethe, G. Madec) improvment of surface boundary condition 
     18   !!            3.7  !  2015-11  (G. Madec, A. Coward)  non linear free surface by default  
    1819   !!---------------------------------------------------------------------- 
    1920   
    2021   !!---------------------------------------------------------------------- 
    21    !!   tra_zdf_imp   : Update the tracer trend with the diagonal vertical part of the mixing tensor. 
     22   !!   tra_zdf_imp   : Update the tracer trend with vertical mixing, nad compute the after tracer field 
    2223   !!---------------------------------------------------------------------- 
    2324   USE oce            ! ocean dynamics and tracers variables 
     
    4243   PUBLIC   tra_zdf_imp   !  routine called by step.F90 
    4344 
    44    REAL(wp) ::  r_vvl     ! variable volume indicator, =1 if lk_vvl=T, =0 otherwise  
    45  
    4645   !! * Substitutions 
    47 #  include "domzgr_substitute.h90" 
    4846#  include "zdfddm_substitute.h90" 
    4947#  include "vectopt_loop_substitute.h90" 
     
    6462      !!     it is already computed and add to the general trend in traldf)  
    6563      !! 
    66       !! ** Method  :  The vertical diffusion of the tracer t  is given by: 
    67       !!                  difft = dz( avt dz(t) ) = 1/e3t dk+1( avt/e3w dk(t) ) 
    68       !!      It is computed using a backward time scheme (t=ta). 
     64      !! ** Method  :  The vertical diffusion of a tracer ,t , is given by: 
     65      !!          difft = dz( avt dz(t) ) = 1/e3t dk+1( avt/e3w dk(t) ) 
     66      !!      It is computed using a backward time scheme (t=after field) 
     67      !!      which provide directly the after tracer field. 
    6968      !!      If lk_zdfddm=T, use avs for salinity or for passive tracers 
    7069      !!      Surface and bottom boundary conditions: no diffusive flux on 
     
    7574      !!--------------------------------------------------------------------- 
    7675      INTEGER                              , INTENT(in   ) ::   kt       ! ocean time-step index 
    77       INTEGER                              , INTENT(in   ) ::   kit000          ! first time step index 
     76      INTEGER                              , INTENT(in   ) ::   kit000   ! first time step index 
    7877      CHARACTER(len=3)                     , INTENT(in   ) ::   cdtype   ! =TRA or TRC (tracer indicator) 
    7978      INTEGER                              , INTENT(in   ) ::   kjpt     ! number of tracers 
    80       REAL(wp), DIMENSION(        jpk     ), INTENT(in   ) ::   p2dt     ! vertical profile of tracer time-step 
     79      REAL(wp)                             , INTENT(in   ) ::   p2dt     ! tracer time-step 
    8180      REAL(wp), DIMENSION(jpi,jpj,jpk,kjpt), INTENT(in   ) ::   ptb      ! before and now tracer fields 
    82       REAL(wp), DIMENSION(jpi,jpj,jpk,kjpt), INTENT(inout) ::   pta      ! tracer trend  
     81      REAL(wp), DIMENSION(jpi,jpj,jpk,kjpt), INTENT(inout) ::   pta      ! in: tracer trend ; out: after tracer field 
    8382      ! 
    8483      INTEGER  ::  ji, jj, jk, jn   ! dummy loop indices 
    85       REAL(wp) ::  zrhs, ze3tb, ze3tn, ze3ta   ! local scalars 
     84      REAL(wp) ::  zrhs             ! local scalars 
    8685      REAL(wp), POINTER, DIMENSION(:,:,:) ::  zwi, zwt, zwd, zws 
    8786      !!--------------------------------------------------------------------- 
     
    9594         IF(lwp)WRITE(numout,*) 'tra_zdf_imp : implicit vertical mixing on ', cdtype 
    9695         IF(lwp)WRITE(numout,*) '~~~~~~~~~~~ ' 
    97          ! 
    98          IF( lk_vvl ) THEN   ;    r_vvl = 1._wp       ! Variable volume indicator 
    99          ELSE                ;    r_vvl = 0._wp        
    100          ENDIF 
    10196      ENDIF 
    102       ! 
    10397      !                                               ! ============= ! 
    10498      DO jn = 1, kjpt                                 !  tracer loop  ! 
    10599         !                                            ! ============= ! 
    106          ! 
    107100         !  Matrix construction 
    108101         ! -------------------- 
     
    142135               DO jj = 2, jpjm1 
    143136                  DO ji = fs_2, fs_jpim1   ! vector opt. 
    144                      ze3ta =  ( 1. - r_vvl ) +        r_vvl   * fse3t_a(ji,jj,jk)   ! after scale factor at T-point 
    145                      ze3tn =         r_vvl   + ( 1. - r_vvl ) * fse3t_n(ji,jj,jk)   ! now   scale factor at T-point 
    146                      zwi(ji,jj,jk) = - p2dt(jk) * zwt(ji,jj,jk  ) / ( ze3tn * fse3w(ji,jj,jk  ) ) 
    147                      zws(ji,jj,jk) = - p2dt(jk) * zwt(ji,jj,jk+1) / ( ze3tn * fse3w(ji,jj,jk+1) ) 
    148                      zwd(ji,jj,jk) = ze3ta - zwi(ji,jj,jk) - zws(ji,jj,jk) 
     137!!gm BUG  I think, use e3w_a instead of e3w_n 
     138                     zwi(ji,jj,jk) = - p2dt * zwt(ji,jj,jk  ) / e3w_n(ji,jj,jk  ) 
     139                     zws(ji,jj,jk) = - p2dt * zwt(ji,jj,jk+1) / e3w_n(ji,jj,jk+1) 
     140                     zwd(ji,jj,jk) = e3t_a(ji,jj,jk) - zwi(ji,jj,jk) - zws(ji,jj,jk) 
    149141                 END DO 
    150142               END DO 
     
    170162            !   used as a work space array: its value is modified. 
    171163            ! 
    172             ! first recurrence:   Tk = Dk - Ik Sk-1 / Tk-1   (increasing k) 
    173             ! done once for all passive tracers (so included in the IF instruction) 
    174             DO jj = 2, jpjm1 
    175                DO ji = fs_2, fs_jpim1 
     164            DO jj = 2, jpjm1        !* 1st recurrence:   Tk = Dk - Ik Sk-1 / Tk-1   (increasing k) 
     165               DO ji = fs_2, fs_jpim1            ! done one for all passive tracers (so included in the IF instruction) 
    176166                  zwt(ji,jj,1) = zwd(ji,jj,1) 
    177167               END DO 
     
    185175            END DO 
    186176            ! 
    187          END IF  
     177         ENDIF  
    188178         !          
    189          ! second recurrence:    Zk = Yk - Ik / Tk-1  Zk-1 
    190          DO jj = 2, jpjm1 
     179         DO jj = 2, jpjm1           !* 2nd recurrence:    Zk = Yk - Ik / Tk-1  Zk-1 
    191180            DO ji = fs_2, fs_jpim1 
    192                ze3tb = ( 1. - r_vvl ) + r_vvl * fse3t_b(ji,jj,1) 
    193                ze3tn = ( 1. - r_vvl ) + r_vvl * fse3t(ji,jj,1) 
    194                pta(ji,jj,1,jn) = ze3tb * ptb(ji,jj,1,jn) + p2dt(1) * ze3tn * pta(ji,jj,1,jn) 
     181               pta(ji,jj,1,jn) = e3t_b(ji,jj,1) * ptb(ji,jj,1,jn) + p2dt * e3t_n(ji,jj,1) * pta(ji,jj,1,jn) 
    195182            END DO 
    196183         END DO 
     
    198185            DO jj = 2, jpjm1 
    199186               DO ji = fs_2, fs_jpim1 
    200                   ze3tb = ( 1. - r_vvl ) + r_vvl * fse3t_b(ji,jj,jk) 
    201                   ze3tn = ( 1. - r_vvl ) + r_vvl * fse3t  (ji,jj,jk) 
    202                   zrhs = ze3tb * ptb(ji,jj,jk,jn) + p2dt(jk) * ze3tn * pta(ji,jj,jk,jn)   ! zrhs=right hand side  
     187                  zrhs = e3t_b(ji,jj,jk) * ptb(ji,jj,jk,jn) + p2dt * e3t_n(ji,jj,jk) * pta(ji,jj,jk,jn)   ! zrhs=right hand side 
    203188                  pta(ji,jj,jk,jn) = zrhs - zwi(ji,jj,jk) / zwt(ji,jj,jk-1) * pta(ji,jj,jk-1,jn) 
    204189               END DO 
    205190            END DO 
    206191         END DO 
    207  
    208          ! third recurrence:    Xk = (Zk - Sk Xk+1 ) / Tk   (result is the after tracer) 
    209          DO jj = 2, jpjm1 
     192         ! 
     193         DO jj = 2, jpjm1           !* 3d recurrence:    Xk = (Zk - Sk Xk+1 ) / Tk   (result is the after tracer) 
    210194            DO ji = fs_2, fs_jpim1 
    211195               pta(ji,jj,jpkm1,jn) = pta(ji,jj,jpkm1,jn) / zwt(ji,jj,jpkm1) * tmask(ji,jj,jpkm1) 
Note: See TracChangeset for help on using the changeset viewer.