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 3318 for branches/2012/dev_r3309_LOCEAN12_Ediag/NEMOGCM/NEMO/TOP_SRC/TRP/trcrad.F90 – NEMO

Ignore:
Timestamp:
2012-02-25T16:50:01+01:00 (12 years ago)
Author:
gm
Message:

Ediag branche: #927 split TRA/DYN trd computation

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/2012/dev_r3309_LOCEAN12_Ediag/NEMOGCM/NEMO/TOP_SRC/TRP/trcrad.F90

    r3294 r3318  
    44   !! Ocean passive tracers:  correction of negative concentrations 
    55   !!====================================================================== 
    6    !! History :   -   !  01-01  (O. Aumont & E. Kestenare)  Original code 
    7    !!            1.0  !  04-03  (C. Ethe)  free form F90 
     6   !! History :  OPA  !  2001-01  (O. Aumont & E. Kestenare)  Original code 
     7   !!   NEMO     1.0  !  2004-03  (C. Ethe)  free form F90 
    88   !!---------------------------------------------------------------------- 
    99#if defined key_top 
     
    1111   !!   'key_top'                                                TOP models 
    1212   !!---------------------------------------------------------------------- 
    13    !!   trc_rad    : correction of negative concentrations 
    14    !!---------------------------------------------------------------------- 
    15    USE oce_trc             ! ocean dynamics and tracers variables 
    16    USE trc                 ! ocean passive tracers variables 
    17    USE trdmod_oce 
    18    USE trdtra 
    19    USE prtctl_trc          ! Print control for debbuging 
     13   !!   trc_rad       : correction of negative concentrations 
     14   !!---------------------------------------------------------------------- 
     15   USE oce_trc        ! ocean dynamics and tracers variables 
     16   USE trc            ! ocean passive tracers variables 
     17   USE trd_oce        ! trends: ocean variables 
     18   USE trdtra         ! trends: tracer manager 
     19   USE prtctl_trc     ! Print control for debbuging 
    2020 
    2121   IMPLICIT NONE 
    2222   PRIVATE 
    2323 
    24    PUBLIC trc_rad         ! routine called by trcstp.F90 
     24   PUBLIC   trc_rad   ! routine called by trcstp.F90 
    2525 
    2626   !! * Substitutions 
     
    3131   !! Software governed by the CeCILL licence (NEMOGCM/NEMO_CeCILL.txt) 
    3232   !!---------------------------------------------------------------------- 
    33     
    3433CONTAINS 
    3534 
     
    4948      !!                (the total CFC content is not strictly preserved) 
    5049      !!---------------------------------------------------------------------- 
    51       INTEGER, INTENT( in ) ::   kt   ! ocean time-step index       
     50      INTEGER, INTENT( in ) ::   kt   ! ocean time-step index 
     51      ! 
    5252      CHARACTER (len=22) :: charout 
    5353      !!---------------------------------------------------------------------- 
     
    7777      ! 
    7878   END SUBROUTINE trc_rad 
     79 
    7980 
    8081   SUBROUTINE trc_rad_sms( kt, ptrb, ptrn, jp_sms0, jp_sms1, cpreserv ) 
     
    9495      !!                  (the total content of concentration is not strictly preserved) 
    9596      !!-------------------------------------------------------------------------------- 
    96       !! Arguments 
    97       INTEGER, INTENT( in ) ::   kt   ! ocean time-step index 
    98       INTEGER  , INTENT( in ) ::  & 
    99          jp_sms0, &       !: First index of the passive tracer model 
    100          jp_sms1          !: Last  index of  the passive tracer model 
    101  
    102       REAL(wp), DIMENSION (jpi,jpj,jpk,jptra), INTENT( inout )  :: & 
    103          ptrb, ptrn       !: before and now traceur concentration 
    104  
    105       CHARACTER( len = 1) , INTENT(in), OPTIONAL  :: & 
    106          cpreserv          !: flag to preserve content or not 
    107        
    108       ! Local declarations 
    109       INTEGER  :: ji, jj, jk, jn     ! dummy loop indices 
    110       REAL(wp) :: ztrcorb, ztrmasb   ! temporary scalars 
    111       REAL(wp) :: zcoef, ztrcorn, ztrmasn   !    "         " 
    112       REAL(wp), POINTER, DIMENSION(:,:,:) ::   ztrtrdb, ztrtrdn   ! workspace arrays 
    113       REAL(wp) :: zs2rdt 
    114       LOGICAL ::   lldebug = .FALSE. 
    115       !!---------------------------------------------------------------------- 
    116  
     97      INTEGER                                , INTENT(in   ) ::   kt                 ! ocean time-step index 
     98      INTEGER                                , INTENT(in   ) ::   jp_sms0, jp_sms1   ! first/last index of the passive tracer model 
     99      REAL(wp), DIMENSION (jpi,jpj,jpk,jptra), INTENT(inout) ::   ptrb, ptrn         ! before/now traceur concentration 
     100      CHARACTER( len = 1),      OPTIONAL     , INTENT(in   ) ::   cpreserv           ! flag to preserve content or not 
     101      ! 
     102      INTEGER  ::   ji, jj, jk, jn             ! dummy loop indices 
     103      REAL(wp) ::   ztrcorb, ztrmasb, zs2rdt   ! local scalars 
     104      REAL(wp) ::   zcoef, ztrcorn, ztrmasn    !   -      - 
     105      LOGICAL  ::   lldebug = .FALSE. 
     106      REAL(wp), POINTER, DIMENSION(:,:,:) ::   ztrtrdb, ztrtrdn   ! 3D workspace 
     107      !!---------------------------------------------------------------------- 
    117108  
    118109      IF( l_trdtrc )  CALL wrk_alloc( jpi, jpj, jpk, ztrtrdb, ztrtrdn ) 
    119110       
    120111      IF( PRESENT( cpreserv )  ) THEN   !  total tracer concentration is preserved  
    121        
     112         !                                                           ! =========== 
     113 
    122114         DO jn = jp_sms0, jp_sms1 
    123             !                                                        ! =========== 
    124             ztrcorb = 0.e0   ;   ztrmasb = 0.e0 
    125             ztrcorn = 0.e0   ;   ztrmasn = 0.e0 
    126  
     115            ! 
     116            ztrcorb = 0._wp   ;   ztrmasb = 0._wp 
     117            ztrcorn = 0._wp   ;   ztrmasn = 0._wp 
     118            ! 
    127119            IF( l_trdtrc ) THEN 
    128120               ztrtrdb(:,:,:) = ptrb(:,:,:,jn)                        ! save input trb for trend computation 
     
    132124            ztrcorb = glob_sum( MIN( 0., ptrb(:,:,:,jn) ) * cvol(:,:,:) ) 
    133125            ztrcorn = glob_sum( MIN( 0., ptrn(:,:,:,jn) ) * cvol(:,:,:) ) 
    134  
    135126            ztrmasb = glob_sum( MAX( 0., ptrb(:,:,:,jn) ) * cvol(:,:,:) ) 
    136127            ztrmasn = glob_sum( MAX( 0., ptrn(:,:,:,jn) ) * cvol(:,:,:) ) 
    137  
     128            ! 
    138129            IF( ztrcorb /= 0 ) THEN 
    139130               zcoef = 1. + ztrcorb / ztrmasb 
     
    143134               END DO 
    144135            ENDIF 
    145  
     136            ! 
    146137            IF( ztrcorn /= 0 ) THEN 
    147138               zcoef = 1. + ztrcorn / ztrmasn 
     
    157148               ztrtrdb(:,:,:) = ( ptrb(:,:,:,jn) - ztrtrdb(:,:,:) ) * zs2rdt 
    158149               ztrtrdn(:,:,:) = ( ptrn(:,:,:,jn) - ztrtrdn(:,:,:) ) * zs2rdt  
    159                CALL trd_tra( kt, 'TRC', jn, jptra_trd_radb, ztrtrdb )       ! Asselin-like trend handling 
    160                CALL trd_tra( kt, 'TRC', jn, jptra_trd_radn, ztrtrdn )       ! standard     trend handling 
     150               CALL trd_tra( kt, 'TRC', jn, jptra_radb, ztrtrdb )       ! Asselin-like trend handling 
     151               CALL trd_tra( kt, 'TRC', jn, jptra_radn, ztrtrdn )       ! standard     trend handling 
    161152              ! 
    162153            ENDIF 
    163  
     154            ! 
    164155         END DO 
    165156         ! 
    166157         ! 
    167158      ELSE  ! total CFC content is not strictly preserved 
    168  
     159         ! 
    169160         DO jn = jp_sms0, jp_sms1   
    170  
    171            IF( l_trdtrc ) THEN 
    172               ztrtrdb(:,:,:) = ptrb(:,:,:,jn)                        ! save input trb for trend computation 
    173               ztrtrdn(:,:,:) = ptrn(:,:,:,jn)                        ! save input trn for trend computation 
    174            ENDIF 
    175  
     161            ! 
     162            IF( l_trdtrc ) THEN 
     163               ztrtrdb(:,:,:) = ptrb(:,:,:,jn)                        ! save input trb for trend computation 
     164               ztrtrdn(:,:,:) = ptrn(:,:,:,jn)                        ! save input trn for trend computation 
     165            ENDIF 
     166            ! 
    176167            DO jk = 1, jpkm1 
    177168               DO jj = 1, jpj 
     
    182173               END DO 
    183174            END DO 
    184           
    185             IF( l_trdtrc ) THEN 
    186                ! 
     175            ! 
     176            IF( l_trdtrc ) THEN 
    187177               zs2rdt = 1. / ( 2. * rdt * FLOAT( nn_dttrc ) ) 
    188178               ztrtrdb(:,:,:) = ( ptrb(:,:,:,jn) - ztrtrdb(:,:,:) ) * zs2rdt 
    189179               ztrtrdn(:,:,:) = ( ptrn(:,:,:,jn) - ztrtrdn(:,:,:) ) * zs2rdt  
    190                CALL trd_tra( kt, 'TRC', jn, jptra_trd_radb, ztrtrdb )       ! Asselin-like trend handling 
    191                CALL trd_tra( kt, 'TRC', jn, jptra_trd_radn, ztrtrdn )       ! standard     trend handling 
    192               ! 
    193             ENDIF 
    194             ! 
    195          ENDDO 
    196  
     180               CALL trd_tra( kt, 'TRC', jn, jptra_radb, ztrtrdb )       ! Asselin-like trend handling 
     181               CALL trd_tra( kt, 'TRC', jn, jptra_radn, ztrtrdn )       ! standard     trend handling 
     182            ENDIF 
     183            ! 
     184         END DO 
     185         ! 
    197186      ENDIF 
    198  
     187      ! 
    199188      IF( l_trdtrc )  CALL wrk_dealloc( jpi, jpj, jpk, ztrtrdb, ztrtrdn ) 
    200  
     189      ! 
    201190   END SUBROUTINE trc_rad_sms 
     191 
    202192#else 
    203193   !!---------------------------------------------------------------------- 
Note: See TracChangeset for help on using the changeset viewer.