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 3294 for trunk/NEMOGCM/NEMO/TOP_SRC/C14b/trcsms_c14b.F90 – NEMO

Ignore:
Timestamp:
2012-01-28T17:44:18+01:00 (12 years ago)
Author:
rblod
Message:

Merge of 3.4beta into the trunk

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/NEMOGCM/NEMO/TOP_SRC/C14b/trcsms_c14b.F90

    r2715 r3294  
    9494      !! 
    9595      !!---------------------------------------------------------------------- 
    96       USE wrk_nemo, ONLY:   wrk_in_use, wrk_not_released 
    97       USE wrk_nemo, ONLY:   zatmbc14 => wrk_2d_1 
    98       USE wrk_nemo, ONLY:   zw3d     => wrk_3d_1 
    9996      ! 
    10097      INTEGER, INTENT(in) ::   kt    ! ocean time-step index 
     
    113110      REAL(wp) :: zpv               ! piston velocity  
    114111      REAL(wp) :: zdemi, ztra 
    115       !!---------------------------------------------------------------------- 
    116  
    117       IF( wrk_in_use(2, 1) .OR. wrk_in_use(3, 1) ) THEN 
    118          CALL ctl_stop('trc_sms_c14b : requested workspace arrays unavailable')   ;   RETURN 
    119       ENDIF 
    120  
    121       IF( kt == nit000 )  THEN         ! Computation of decay coeffcient 
     112      REAL(wp), POINTER, DIMENSION(:,:  ) :: zatmbc14   
     113      REAL(wp), POINTER, DIMENSION(:,:,:) :: zdecay 
     114      !!--------------------------------------------------------------------- 
     115      ! 
     116      IF( nn_timing == 1 )  CALL timing_start('trc_sms_c14b') 
     117      ! 
     118      ! Allocate temporary workspace 
     119      CALL wrk_alloc( jpi, jpj,      zatmbc14 ) 
     120      CALL wrk_alloc( jpi, jpj, jpk, zdecay   ) 
     121 
     122      IF( kt == nittrc000 )  THEN         ! Computation of decay coeffcient 
    122123         zdemi   = 5730._wp 
    123124         xlambda = LOG(2.) / zdemi / ( nyear_len(1) * rday ) 
     
    246247#endif 
    247248                  &                      * tmask(ji,jj,1) * ( 1. - fr_i(ji,jj) ) / 2. 
    248  
    249249            ! Add the surface flux to the trend 
    250250            tra(ji,jj,1,jpc14) = tra(ji,jj,1,jpc14) + qtr_c14(ji,jj) / fse3t(ji,jj,1)  
     
    252252            ! cumulation of surface flux at each time step 
    253253            qint_c14(ji,jj) = qint_c14(ji,jj) + qtr_c14(ji,jj) * rdt 
    254  
    255 # if defined key_diatrc && ! defined key_iomput 
    256             ! Save 2D diagnostics 
    257             trc2d(ji,jj,jp_c14b0_2d    ) = qtr_c14 (ji,jj) 
    258             trc2d(ji,jj,jp_c14b0_2d + 1) = qint_c14(ji,jj) 
    259 # endif  
     254            ! 
    260255         END DO 
    261256      END DO 
     
    265260         DO jj = 1, jpj 
    266261            DO ji = 1, jpi 
    267 #if ! defined key_degrad 
    268                ztra = trn(ji,jj,jk,jpc14) * xaccum 
     262#if defined key_degrad 
     263               zdecay(ji,jj,jk) = trn(ji,jj,jk,jpc14) * ( 1. - EXP( -xlambda * rdt * facvol(ji,jj,jk) ) ) 
    269264#else 
    270                ztra = trn(ji,jj,jk,jpc14) * ( 1. - EXP( -xlambda * rdt * facvol(ji,jj,jk) ) ) 
     265               zdecay(ji,jj,jk) = trn(ji,jj,jk,jpc14) * xaccum 
    271266#endif 
    272                tra(ji,jj,jk,jpc14) = tra(ji,jj,jk,jpc14) - ztra / rdt 
    273 #if defined key_diatrc 
    274                ! Save 3D diagnostics 
    275 # if ! defined key_iomput 
    276                trc3d(ji,jj,jk,jp_c14b0_3d ) = ztra    !  radioactive decay 
    277 # else  
    278                zw3d(ji,jj,jk) = ztra    !  radioactive decay 
    279 # endif 
    280 #endif 
     267               tra(ji,jj,jk,jpc14) = tra(ji,jj,jk,jpc14) - zdecay(ji,jj,jk) / rdt 
     268               ! 
    281269            END DO 
    282270         END DO 
    283271      END DO 
    284272 
    285 #if defined key_diatrc  && defined key_iomput 
    286       CALL iom_put( "qtrC14b"  , qtr_c14  ) 
    287       CALL iom_put( "qintC14b" , qint_c14 ) 
    288 #endif 
    289 #if defined key_diatrc  && defined key_iomput 
    290       CALL iom_put( "fdecay" , zw3d ) 
    291 #endif 
    292       IF( l_trdtrc )   CALL trd_mod_trc( tra(:,:,:,jpc14), jpc14, jptra_trd_sms, kt )   ! save trends 
    293  
    294       IF( wrk_not_released(2, 1) .OR.   & 
    295           wrk_not_released(3, 1) )   CALL ctl_stop('trc_sms_c14b : failed to release workspace arrays') 
     273      IF( ln_diatrc ) THEN 
     274         IF( lk_iomput ) THEN 
     275            CALL iom_put( "qtrC14b"  , qtr_c14  ) 
     276            CALL iom_put( "qintC14b" , qint_c14 ) 
     277            CALL iom_put( "fdecay"   , zdecay   ) 
     278          ELSE 
     279            trc2d(:,:  ,jp_c14b0_2d     ) = qtr_c14 (:,:) 
     280            trc2d(:,:  ,jp_c14b0_2d + 1 ) = qint_c14(:,:) 
     281            trc3d(:,:,:,jp_c14b0_3d     ) = zdecay  (:,:,:) 
     282          ENDIF 
     283      ENDIF 
     284 
     285      IF( l_trdtrc )  CALL trd_mod_trc( tra(:,:,:,jpc14), jpc14, jptra_trd_sms, kt )   ! save trends 
     286 
     287      CALL wrk_dealloc( jpi, jpj,      zatmbc14 ) 
     288      CALL wrk_dealloc( jpi, jpj, jpk, zdecay   ) 
     289      ! 
     290      IF( nn_timing == 1 )  CALL timing_stop('trc_sms_c14b') 
    296291      ! 
    297292   END SUBROUTINE trc_sms_c14b 
Note: See TracChangeset for help on using the changeset viewer.