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 13069 for NEMO/trunk/src/OCE – NEMO

Changeset 13069 for NEMO/trunk/src/OCE


Ignore:
Timestamp:
2020-06-09T10:22:33+02:00 (4 years ago)
Author:
smasson
Message:

trunk: fix trdtra when used with traadv_ubs, see #2484

File:
1 edited

Legend:

Unmodified
Added
Removed
  • NEMO/trunk/src/OCE/TRD/trdtra.F90

    r12489 r13069  
    8282      REAL(wp), DIMENSION(jpi,jpj,jpk), INTENT(in), OPTIONAL ::   ptra    ! now tracer variable 
    8383      ! 
    84       INTEGER ::   jk   ! loop indices 
     84      INTEGER ::   j k   ! loop indices 
     85      INTEGER ::   i01   ! 0 or 1 
    8586      REAL(wp),        DIMENSION(jpi,jpj,jpk) ::   ztrds             ! 3D workspace 
    8687      REAL(wp), ALLOCATABLE, DIMENSION(:,:,:) ::   zwt, zws, ztrdt   ! 3D workspace 
     
    9091         IF( trd_tra_alloc() /= 0 )   CALL ctl_stop( 'STOP', 'trd_tra : unable to allocate arrays' ) 
    9192      ENDIF 
    92  
     93      ! 
     94      i01 = COUNT( (/ PRESENT(pun) .OR. ( ktrd /= jptra_xad .AND. ktrd /= jptra_yad .AND. ktrd /= jptra_zad ) /) ) 
     95      ! 
    9396      IF( ctype == 'TRA' .AND. ktra == jp_tem ) THEN   !==  Temperature trend  ==! 
    9497         ! 
    95          SELECT CASE( ktrd ) 
     98         SELECT CASE( ktrd*i01 ) 
    9699         !                            ! advection: transform the advective flux into a trend 
    97100         CASE( jptra_xad )   ;   CALL trd_tra_adv( ptrd, pu, ptra, 'X', trdtx, Kmm )  
     
    112115      IF( ctype == 'TRA' .AND. ktra == jp_sal ) THEN      !==  Salinity trends  ==! 
    113116         ! 
    114          SELECT CASE( ktrd ) 
     117         SELECT CASE( ktrd*i01 ) 
    115118         !                            ! advection: transform the advective flux into a trend 
    116119         !                            !            and send T & S trends to trd_tra_mng 
     
    163166      IF( ctype == 'TRC' ) THEN                           !==  passive tracer trend  ==! 
    164167         ! 
    165          SELECT CASE( ktrd ) 
     168         SELECT CASE( ktrd*i01 ) 
    166169         !                            ! advection: transform the advective flux into a masked trend 
    167170         CASE( jptra_xad )   ;   CALL trd_tra_adv( ptrd , pu , ptra, 'X', ztrds, Kmm )  
Note: See TracChangeset for help on using the changeset viewer.