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 8215 for branches/2017/dev_r7881_ENHANCE09_RK3/NEMOGCM/NEMO/OPA_SRC/TRA – NEMO

Ignore:
Timestamp:
2017-06-25T12:26:32+02:00 (7 years ago)
Author:
gm
Message:

#1911 (ENHANCE-09): PART 0 - phasing with branch dev_r7832_HPC09_ZDF revision 8214

Location:
branches/2017/dev_r7881_ENHANCE09_RK3/NEMOGCM/NEMO/OPA_SRC/TRA
Files:
2 deleted
3 edited

Legend:

Unmodified
Added
Removed
  • branches/2017/dev_r7881_ENHANCE09_RK3/NEMOGCM/NEMO/OPA_SRC/TRA/eosbn2.F90

    r7753 r8215  
    928928               pn2(ji,jj,jk) = grav * (  zaw * ( pts(ji,jj,jk-1,jp_tem) - pts(ji,jj,jk,jp_tem) )     & 
    929929                  &                    - zbw * ( pts(ji,jj,jk-1,jp_sal) - pts(ji,jj,jk,jp_sal) )  )  & 
    930                   &            / e3w_n(ji,jj,jk) * tmask(ji,jj,jk) 
     930                  &            / e3w_n(ji,jj,jk) * wmask(ji,jj,jk) 
    931931            END DO 
    932932         END DO 
  • branches/2017/dev_r7881_ENHANCE09_RK3/NEMOGCM/NEMO/OPA_SRC/TRA/trabbl.F90

    r7753 r8215  
    1313   !!             -   ! 2010-11  (G. Madec) add mbk. arrays associated to the deepest ocean level 
    1414   !!             -   ! 2013-04  (F. Roquet, G. Madec)  use of eosbn2 instead of local hard coded alpha and beta 
     15   !!            4.0  ! 2017-04  (G. Madec)  ln_trabbl namelist variable instead of a CPP key 
    1516   !!---------------------------------------------------------------------- 
    16 #if   defined key_trabbl 
    17    !!---------------------------------------------------------------------- 
    18    !!   'key_trabbl'   or                             bottom boundary layer 
     17 
    1918   !!---------------------------------------------------------------------- 
    2019   !!   tra_bbl_alloc : allocate trabbl arrays 
     
    4948   PUBLIC   bbl           !  routine called by trcbbl.F90 and dtadyn.F90 
    5049 
    51    LOGICAL, PUBLIC, PARAMETER ::   lk_trabbl = .TRUE.    !: bottom boundary layer flag 
    52  
    5350   !                                !!* Namelist nambbl * 
     51   LOGICAL , PUBLIC ::   ln_trabbl   !: bottom boundary layer flag 
    5452   INTEGER , PUBLIC ::   nn_bbl_ldf  !: =1   : diffusive bbl or not (=0) 
    5553   INTEGER , PUBLIC ::   nn_bbl_adv  !: =1/2 : advective bbl or not (=0) 
     
    8280      !!                ***  FUNCTION tra_bbl_alloc  *** 
    8381      !!---------------------------------------------------------------------- 
    84       ALLOCATE( utr_bbl  (jpi,jpj) , ahu_bbl  (jpi,jpj) , mbku_d  (jpi,jpj) , mgrhu(jpi,jpj) ,     & 
    85          &      vtr_bbl  (jpi,jpj) , ahv_bbl  (jpi,jpj) , mbkv_d  (jpi,jpj) , mgrhv(jpi,jpj) ,     & 
    86          &      ahu_bbl_0(jpi,jpj) , ahv_bbl_0(jpi,jpj) ,                                          & 
    87          &      e3u_bbl_0(jpi,jpj) , e3v_bbl_0(jpi,jpj) ,                                      STAT=tra_bbl_alloc ) 
     82      ALLOCATE( utr_bbl  (jpi,jpj) , ahu_bbl  (jpi,jpj) , mbku_d(jpi,jpj) , mgrhu(jpi,jpj) ,     & 
     83         &      vtr_bbl  (jpi,jpj) , ahv_bbl  (jpi,jpj) , mbkv_d(jpi,jpj) , mgrhv(jpi,jpj) ,     & 
     84         &      ahu_bbl_0(jpi,jpj) , ahv_bbl_0(jpi,jpj) ,                                        & 
     85         &      e3u_bbl_0(jpi,jpj) , e3v_bbl_0(jpi,jpj) ,                                    STAT=tra_bbl_alloc ) 
    8886         ! 
    8987      IF( lk_mpp            )   CALL mpp_sum ( tra_bbl_alloc ) 
     
    111109      IF( nn_timing == 1 )  CALL timing_start( 'tra_bbl') 
    112110      ! 
    113       IF( l_trdtra )   THEN                         !* Save the input trends 
     111      IF( l_trdtra )   THEN                         !* Save the T-S input trends 
    114112         CALL wrk_alloc( jpi, jpj, jpk, ztrdt, ztrds ) 
    115113         ztrdt(:,:,:) = tsa(:,:,:,jp_tem) 
     
    301299            ! 
    302300         END DO 
    303          !                                                       ! =========== 
    304       END DO                                                     ! end tracer 
    305       !                                                          ! =========== 
     301         !                                                  ! =========== 
     302      END DO                                                ! end tracer 
     303      !                                                     ! =========== 
     304      ! 
    306305      IF( nn_timing == 1 )  CALL timing_stop( 'tra_bbl_adv') 
    307306      ! 
     
    498497      INTEGER ::   ios                  !   -      - 
    499498      REAL(wp), POINTER, DIMENSION(:,:) :: zmbk 
    500       ! 
    501       NAMELIST/nambbl/ nn_bbl_ldf, nn_bbl_adv, rn_ahtbbl, rn_gambbl 
     499      !! 
     500      NAMELIST/nambbl/ ln_trabbl, nn_bbl_ldf, nn_bbl_adv, rn_ahtbbl, rn_gambbl 
    502501      !!---------------------------------------------------------------------- 
    503502      ! 
     
    519518         WRITE(numout,*) 'tra_bbl_init : bottom boundary layer initialisation' 
    520519         WRITE(numout,*) '~~~~~~~~~~~~' 
    521          WRITE(numout,*) '   Namelist nambbl : set bbl parameters' 
    522          WRITE(numout,*) '      diffusive bbl (=1)   or not (=0)    nn_bbl_ldf = ', nn_bbl_ldf 
    523          WRITE(numout,*) '      advective bbl (=1/2) or not (=0)    nn_bbl_adv = ', nn_bbl_adv 
    524          WRITE(numout,*) '      diffusive bbl coefficient           rn_ahtbbl  = ', rn_ahtbbl, ' m2/s' 
    525          WRITE(numout,*) '      advective bbl coefficient           rn_gambbl  = ', rn_gambbl, ' s' 
    526       ENDIF 
    527  
     520         WRITE(numout,*) '       Namelist nambbl : set bbl parameters' 
     521         WRITE(numout,*) '          bottom boundary layer flag          ln_trabbl  = ', ln_trabbl 
     522      ENDIF 
     523      IF( .NOT.ln_trabbl )   RETURN 
     524      ! 
     525      IF(lwp) THEN 
     526         WRITE(numout,*) '          diffusive bbl (=1)   or not (=0)    nn_bbl_ldf = ', nn_bbl_ldf 
     527         WRITE(numout,*) '          advective bbl (=1/2) or not (=0)    nn_bbl_adv = ', nn_bbl_adv 
     528         WRITE(numout,*) '          diffusive bbl coefficient           rn_ahtbbl  = ', rn_ahtbbl, ' m2/s' 
     529         WRITE(numout,*) '          advective bbl coefficient           rn_gambbl  = ', rn_gambbl, ' s' 
     530      ENDIF 
     531      ! 
    528532      !                              ! allocate trabbl arrays 
    529533      IF( tra_bbl_alloc() /= 0 )   CALL ctl_stop( 'STOP', 'tra_bbl_init : unable to allocate arrays' ) 
    530  
     534      ! 
    531535      IF( nn_bbl_adv == 1 )    WRITE(numout,*) '       * Advective BBL using upper velocity' 
    532536      IF( nn_bbl_adv == 2 )    WRITE(numout,*) '       * Advective BBL using velocity = F( delta rho)' 
    533  
     537      ! 
    534538      !                             !* vertical index of  "deep" bottom u- and v-points 
    535539      DO jj = 1, jpjm1                    ! (the "shelf" bottom k-indices are mbku and mbkv) 
     
    544548      zmbk(:,:) = REAL( mbkv_d(:,:), wp )   ;   CALL lbc_lnk(zmbk,'V',1.)   ;   mbkv_d(:,:) = MAX( INT( zmbk(:,:) ), 1 ) 
    545549      CALL wrk_dealloc( jpi, jpj, zmbk ) 
    546  
     550      ! 
    547551      !                                 !* sign of grad(H) at u- and v-points 
    548552      mgrhu(jpi,:) = 0   ;   mgrhu(:,jpj) = 0   ;   mgrhv(jpi,:) = 0   ;   mgrhv(:,jpj) = 0 
     
    565569      ahu_bbl_0(:,:) = rn_ahtbbl * e2_e1u(:,:) * e3u_bbl_0(:,:) * umask(:,:,1) 
    566570      ahv_bbl_0(:,:) = rn_ahtbbl * e1_e2v(:,:) * e3v_bbl_0(:,:) * vmask(:,:,1) 
    567  
    568571      ! 
    569572      IF( nn_timing == 1 )  CALL timing_stop( 'tra_bbl_init') 
    570573      ! 
    571574   END SUBROUTINE tra_bbl_init 
    572  
    573 #else 
    574    !!---------------------------------------------------------------------- 
    575    !!   Dummy module :                      No bottom boundary layer scheme 
    576    !!---------------------------------------------------------------------- 
    577    LOGICAL, PUBLIC, PARAMETER ::   lk_trabbl = .FALSE.   !: bbl flag 
    578 CONTAINS 
    579    SUBROUTINE tra_bbl_init               ! Dummy routine 
    580    END SUBROUTINE tra_bbl_init 
    581    SUBROUTINE tra_bbl( kt )              ! Dummy routine 
    582       WRITE(*,*) 'tra_bbl: You should not have seen this print! error?', kt 
    583    END SUBROUTINE tra_bbl 
    584 #endif 
    585575 
    586576   !!====================================================================== 
  • branches/2017/dev_r7881_ENHANCE09_RK3/NEMOGCM/NEMO/OPA_SRC/TRA/trazdf.F90

    r7753 r8215  
    44   !! Ocean active tracers:  vertical component of the tracer mixing trend 
    55   !!============================================================================== 
    6    !! History :  1.0  ! 2005-11  (G. Madec)  Original code 
    7    !!            3.0  ! 2008-01  (C. Ethe, G. Madec)  merge TRC-TRA 
     6   !! History :  1.0  !  2005-11  (G. Madec)  Original code 
     7   !!            3.0  !  2008-01  (C. Ethe, G. Madec)  merge TRC-TRA 
     8   !!            4.0  !  2017-06  (G. Madec)  remove explict time-stepping option 
    89   !!---------------------------------------------------------------------- 
    910 
    1011   !!---------------------------------------------------------------------- 
    1112   !!   tra_zdf       : Update the tracer trend with the vertical diffusion 
    12    !!   tra_zdf_init  : initialisation of the computation 
    1313   !!---------------------------------------------------------------------- 
    1414   USE oce            ! ocean dynamics and tracers variables 
     
    2020   USE ldftra         ! lateral diffusion: eddy diffusivity 
    2121   USE ldfslp         ! lateral diffusion: iso-neutral slope  
    22    USE trazdf_exp     ! vertical diffusion: explicit (tra_zdf_exp routine) 
    23    USE trazdf_imp     ! vertical diffusion: implicit (tra_zdf_imp routine) 
    2422   USE trd_oce        ! trends: ocean variables 
    2523   USE trdtra         ! trends: tracer trend manager 
     
    2927   USE lbclnk         ! ocean lateral boundary conditions (or mpp link) 
    3028   USE lib_mpp        ! MPP library 
    31    USE wrk_nemo       ! Memory allocation 
    3229   USE timing         ! Timing 
    3330 
     
    3532   PRIVATE 
    3633 
    37    PUBLIC   tra_zdf        ! routine called by step.F90 
    38    PUBLIC   tra_zdf_init   ! routine called by nemogcm.F90 
    39  
    40    INTEGER ::   nzdf = 0   ! type vertical diffusion algorithm used (defined from ln_zdf...  namlist logicals) 
     34   PUBLIC   tra_zdf       ! called by step.F90 
     35   PUBLIC   tra_zdf_imp   ! called by trczdf.F90 
    4136 
    4237   !! * Substitutions 
    43 #  include "zdfddm_substitute.h90" 
    4438#  include "vectopt_loop_substitute.h90" 
    4539   !!---------------------------------------------------------------------- 
    46    !! NEMO/OPA 3.7 , NEMO Consortium (2015) 
     40   !! NEMO/OPA 4.0 , NEMO Consortium (2017) 
    4741   !! $Id$ 
    4842   !! Software governed by the CeCILL licence     (NEMOGCM/NEMO_CeCILL.txt) 
     
    5953      ! 
    6054      INTEGER  ::   jk                   ! Dummy loop indices 
    61       REAL(wp), POINTER, DIMENSION(:,:,:) ::   ztrdt, ztrds   ! 3D workspace 
     55      REAL(wp), DIMENSION(:,:,:), ALLOCATABLE ::   ztrdt, ztrds   ! 3D workspace 
    6256      !!--------------------------------------------------------------------- 
    6357      ! 
     
    6559      ! 
    6660      IF( neuler == 0 .AND. kt == nit000 ) THEN     ! at nit000 
    67          r2dt =  rdt                          ! = rdt (restarting with Euler time stepping) 
     61         r2dt =  rdt                                     ! = rdt (restarting with Euler time stepping) 
    6862      ELSEIF( kt <= nit000 + 1) THEN                ! at nit000 or nit000+1 
    69          r2dt = 2. * rdt                      ! = 2 rdt (leapfrog) 
    70       ENDIF 
    71       ! 
    72       IF( l_trdtra )   THEN                    !* Save ta and sa trends 
    73          CALL wrk_alloc( jpi, jpj, jpk, ztrdt, ztrds ) 
     63         r2dt = 2. * rdt                                 ! = 2 rdt (leapfrog) 
     64      ENDIF 
     65      ! 
     66      IF( l_trdtra )   THEN                  !* Save ta and sa trends 
     67         ALLOCATE( ztrdt(jpi,jpj,jpk) , ztrds(jpi,jpj,jpk) ) 
    7468         ztrdt(:,:,:) = tsa(:,:,:,jp_tem) 
    7569         ztrds(:,:,:) = tsa(:,:,:,jp_sal) 
    7670      ENDIF 
    7771      ! 
    78       SELECT CASE ( nzdf )                       ! compute lateral mixing trend and add it to the general trend 
    79       CASE ( 0 )    ;    CALL tra_zdf_exp( kt, nit000, 'TRA', r2dt, nn_zdfexp, tsb, tsa, jpts )  !   explicit scheme  
    80       CASE ( 1 )    ;    CALL tra_zdf_imp( kt, nit000, 'TRA', r2dt,            tsb, tsa, jpts )  !   implicit scheme  
    81       END SELECT 
     72      !                                      !* compute lateral mixing trend and add it to the general trend 
     73      CALL tra_zdf_imp( kt, nit000, 'TRA', r2dt, tsb, tsa, jpts )  
     74 
    8275!!gm WHY here !   and I don't like that ! 
    8376      ! DRAKKAR SSS control { 
     
    9891         CALL trd_tra( kt, 'TRA', jp_tem, jptra_zdf, ztrdt ) 
    9992         CALL trd_tra( kt, 'TRA', jp_sal, jptra_zdf, ztrds ) 
    100          CALL wrk_dealloc( jpi, jpj, jpk, ztrdt, ztrds ) 
     93         DEALLOCATE( ztrdt , ztrds ) 
    10194      ENDIF 
    10295      !                                          ! print mean trends (used for debugging) 
     
    108101   END SUBROUTINE tra_zdf 
    109102 
    110  
    111    SUBROUTINE tra_zdf_init 
     103  
     104   SUBROUTINE tra_zdf_imp( kt, kit000, cdtype, p2dt, ptb, pta, kjpt )  
    112105      !!---------------------------------------------------------------------- 
    113       !!                 ***  ROUTINE tra_zdf_init  *** 
    114       !! 
    115       !! ** Purpose :   Choose the vertical mixing scheme 
    116       !! 
    117       !! ** Method  :   Set nzdf from ln_zdfexp 
    118       !!      nzdf = 0   explicit (time-splitting) scheme (ln_zdfexp=T) 
    119       !!           = 1   implicit (euler backward) scheme (ln_zdfexp=F) 
    120       !!      NB: rotation of lateral mixing operator or TKE & GLS schemes, 
    121       !!          an implicit scheme is required. 
    122       !!---------------------------------------------------------------------- 
    123       USE zdftke 
    124       USE zdfgls 
    125       !!---------------------------------------------------------------------- 
    126       ! 
    127       ! Choice from ln_zdfexp already read in namelist in zdfini module 
    128       IF( ln_zdfexp ) THEN   ;   nzdf = 0           ! use explicit scheme 
    129       ELSE                   ;   nzdf = 1           ! use implicit scheme 
    130       ENDIF 
    131       ! 
    132       ! Force implicit schemes 
    133       IF( lk_zdftke .OR. lk_zdfgls   )   nzdf = 1   ! TKE, or GLS physics 
    134       IF( ln_traldf_iso              )   nzdf = 1   ! iso-neutral lateral physics 
    135       IF( ln_traldf_hor .AND. ln_sco )   nzdf = 1   ! horizontal lateral physics in s-coordinate 
    136       IF( ln_zdfexp .AND. nzdf == 1 )   CALL ctl_stop( 'tra_zdf : If using the rotation of lateral mixing operator',   & 
    137             &                         ' GLS or TKE scheme, the implicit scheme is required, set ln_zdfexp = .false.' ) 
    138             ! 
    139       IF(lwp) THEN 
    140          WRITE(numout,*) 
    141          WRITE(numout,*) 'tra_zdf_init : vertical tracer physics scheme' 
    142          WRITE(numout,*) '~~~~~~~~~~~' 
    143          IF( nzdf ==  0 )   WRITE(numout,*) '      ===>>   Explicit time-splitting scheme' 
    144          IF( nzdf ==  1 )   WRITE(numout,*) '      ===>>   Implicit (euler backward) scheme' 
    145       ENDIF 
    146       ! 
    147    END SUBROUTINE tra_zdf_init 
     106      !!                  ***  ROUTINE tra_zdf_imp  *** 
     107      !! 
     108      !! ** Purpose :   Compute the after tracer through a implicit computation 
     109      !!     of the vertical tracer diffusion (including the vertical component  
     110      !!     of lateral mixing (only for 2nd order operator, for fourth order  
     111      !!     it is already computed and add to the general trend in traldf)  
     112      !! 
     113      !! ** Method  :  The vertical diffusion of a tracer ,t , is given by: 
     114      !!          difft = dz( avt dz(t) ) = 1/e3t dk+1( avt/e3w dk(t) ) 
     115      !!      It is computed using a backward time scheme (t=after field) 
     116      !!      which provide directly the after tracer field. 
     117      !!      If ln_zdfddm=T, use avs for salinity or for passive tracers 
     118      !!      Surface and bottom boundary conditions: no diffusive flux on 
     119      !!      both tracers (bottom, applied through the masked field avt). 
     120      !!      If iso-neutral mixing, add to avt the contribution due to lateral mixing. 
     121      !! 
     122      !! ** Action  : - pta  becomes the after tracer 
     123      !!--------------------------------------------------------------------- 
     124      INTEGER                              , INTENT(in   ) ::   kt       ! ocean time-step index 
     125      INTEGER                              , INTENT(in   ) ::   kit000   ! first time step index 
     126      CHARACTER(len=3)                     , INTENT(in   ) ::   cdtype   ! =TRA or TRC (tracer indicator) 
     127      INTEGER                              , INTENT(in   ) ::   kjpt     ! number of tracers 
     128      REAL(wp)                             , INTENT(in   ) ::   p2dt     ! tracer time-step 
     129      REAL(wp), DIMENSION(jpi,jpj,jpk,kjpt), INTENT(in   ) ::   ptb      ! before and now tracer fields 
     130      REAL(wp), DIMENSION(jpi,jpj,jpk,kjpt), INTENT(inout) ::   pta      ! in: tracer trend ; out: after tracer field 
     131      ! 
     132      INTEGER  ::  ji, jj, jk, jn   ! dummy loop indices 
     133      REAL(wp) ::  zrhs             ! local scalars 
     134      REAL(wp), DIMENSION(jpi,jpj,jpk) ::  zwi, zwt, zwd, zws 
     135      !!--------------------------------------------------------------------- 
     136      ! 
     137      IF( nn_timing == 1 )  CALL timing_start('tra_zdf_imp') 
     138      ! 
     139      IF( kt == kit000 )  THEN 
     140         IF(lwp)WRITE(numout,*) 
     141         IF(lwp)WRITE(numout,*) 'tra_zdf_imp : implicit vertical mixing on ', cdtype 
     142         IF(lwp)WRITE(numout,*) '~~~~~~~~~~~ ' 
     143      ENDIF 
     144      !                                               ! ============= ! 
     145      DO jn = 1, kjpt                                 !  tracer loop  ! 
     146         !                                            ! ============= ! 
     147         !  Matrix construction 
     148         ! -------------------- 
     149         ! Build matrix if temperature or salinity (only in double diffusion case) or first passive tracer 
     150         ! 
     151         IF(  ( cdtype == 'TRA' .AND. ( jn == jp_tem .OR. ( jn == jp_sal .AND. ln_zdfddm ) ) ) .OR.   & 
     152            & ( cdtype == 'TRC' .AND. jn == 1 )  )  THEN 
     153            ! 
     154            ! vertical mixing coef.: avt for temperature, avs for salinity and passive tracers 
     155            IF( cdtype == 'TRA' .AND. jn == jp_tem ) THEN   ;   zwt(:,:,2:jpk) = avt(:,:,2:jpk) 
     156            ELSE                                            ;   zwt(:,:,2:jpk) = avs(:,:,2:jpk) 
     157            ENDIF 
     158            zwt(:,:,1) = 0._wp 
     159            ! 
     160            IF( l_ldfslp ) THEN            ! isoneutral diffusion: add the contribution  
     161               IF( ln_traldf_msc  ) THEN     ! MSC iso-neutral operator  
     162                  DO jk = 2, jpkm1 
     163                     DO jj = 2, jpjm1 
     164                        DO ji = fs_2, fs_jpim1   ! vector opt. 
     165                           zwt(ji,jj,jk) = zwt(ji,jj,jk) + akz(ji,jj,jk)   
     166                        END DO 
     167                     END DO 
     168                  END DO 
     169               ELSE                          ! standard or triad iso-neutral operator 
     170                  DO jk = 2, jpkm1 
     171                     DO jj = 2, jpjm1 
     172                        DO ji = fs_2, fs_jpim1   ! vector opt. 
     173                           zwt(ji,jj,jk) = zwt(ji,jj,jk) + ah_wslp2(ji,jj,jk) 
     174                        END DO 
     175                     END DO 
     176                  END DO 
     177               ENDIF 
     178            ENDIF 
     179            ! 
     180            ! Diagonal, lower (i), upper (s)  (including the bottom boundary condition since avt is masked) 
     181            DO jk = 1, jpkm1 
     182               DO jj = 2, jpjm1 
     183                  DO ji = fs_2, fs_jpim1   ! vector opt. 
     184!!gm BUG  I think, use e3w_a instead of e3w_n, not sure of that 
     185                     zwi(ji,jj,jk) = - p2dt * zwt(ji,jj,jk  ) / e3w_n(ji,jj,jk  ) 
     186                     zws(ji,jj,jk) = - p2dt * zwt(ji,jj,jk+1) / e3w_n(ji,jj,jk+1) 
     187                     zwd(ji,jj,jk) = e3t_a(ji,jj,jk) - zwi(ji,jj,jk) - zws(ji,jj,jk) 
     188                 END DO 
     189               END DO 
     190            END DO 
     191            ! 
     192            !! Matrix inversion from the first level 
     193            !!---------------------------------------------------------------------- 
     194            !   solve m.x = y  where m is a tri diagonal matrix ( jpk*jpk ) 
     195            ! 
     196            !        ( zwd1 zws1   0    0    0  )( zwx1 ) ( zwy1 ) 
     197            !        ( zwi2 zwd2 zws2   0    0  )( zwx2 ) ( zwy2 ) 
     198            !        (  0   zwi3 zwd3 zws3   0  )( zwx3 )=( zwy3 ) 
     199            !        (        ...               )( ...  ) ( ...  ) 
     200            !        (  0    0    0   zwik zwdk )( zwxk ) ( zwyk ) 
     201            ! 
     202            !   m is decomposed in the product of an upper and lower triangular matrix. 
     203            !   The 3 diagonal terms are in 3d arrays: zwd, zws, zwi. 
     204            !   Suffices i,s and d indicate "inferior" (below diagonal), diagonal 
     205            !   and "superior" (above diagonal) components of the tridiagonal system. 
     206            !   The solution will be in the 4d array pta. 
     207            !   The 3d array zwt is used as a work space array. 
     208            !   En route to the solution pta is used a to evaluate the rhs and then  
     209            !   used as a work space array: its value is modified. 
     210            ! 
     211            DO jj = 2, jpjm1        !* 1st recurrence:   Tk = Dk - Ik Sk-1 / Tk-1   (increasing k) 
     212               DO ji = fs_2, fs_jpim1            ! done one for all passive tracers (so included in the IF instruction) 
     213                  zwt(ji,jj,1) = zwd(ji,jj,1) 
     214               END DO 
     215            END DO 
     216            DO jk = 2, jpkm1 
     217               DO jj = 2, jpjm1 
     218                  DO ji = fs_2, fs_jpim1 
     219                     zwt(ji,jj,jk) = zwd(ji,jj,jk) - zwi(ji,jj,jk) * zws(ji,jj,jk-1) / zwt(ji,jj,jk-1) 
     220                  END DO 
     221               END DO 
     222            END DO 
     223            ! 
     224         ENDIF  
     225         !          
     226         DO jj = 2, jpjm1           !* 2nd recurrence:    Zk = Yk - Ik / Tk-1  Zk-1 
     227            DO ji = fs_2, fs_jpim1 
     228               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) 
     229            END DO 
     230         END DO 
     231         DO jk = 2, jpkm1 
     232            DO jj = 2, jpjm1 
     233               DO ji = fs_2, fs_jpim1 
     234                  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 
     235                  pta(ji,jj,jk,jn) = zrhs - zwi(ji,jj,jk) / zwt(ji,jj,jk-1) * pta(ji,jj,jk-1,jn) 
     236               END DO 
     237            END DO 
     238         END DO 
     239         ! 
     240         DO jj = 2, jpjm1           !* 3d recurrence:    Xk = (Zk - Sk Xk+1 ) / Tk   (result is the after tracer) 
     241            DO ji = fs_2, fs_jpim1 
     242               pta(ji,jj,jpkm1,jn) = pta(ji,jj,jpkm1,jn) / zwt(ji,jj,jpkm1) * tmask(ji,jj,jpkm1) 
     243            END DO 
     244         END DO 
     245         DO jk = jpk-2, 1, -1 
     246            DO jj = 2, jpjm1 
     247               DO ji = fs_2, fs_jpim1 
     248                  pta(ji,jj,jk,jn) = ( pta(ji,jj,jk,jn) - zws(ji,jj,jk) * pta(ji,jj,jk+1,jn) )   & 
     249                     &             / zwt(ji,jj,jk) * tmask(ji,jj,jk) 
     250               END DO 
     251            END DO 
     252         END DO 
     253         !                                            ! ================= ! 
     254      END DO                                          !  end tracer loop  ! 
     255      !                                               ! ================= ! 
     256      ! 
     257      IF( nn_timing == 1 )  CALL timing_stop('tra_zdf_imp') 
     258      ! 
     259   END SUBROUTINE tra_zdf_imp 
    148260 
    149261   !!============================================================================== 
Note: See TracChangeset for help on using the changeset viewer.