Index: trunk/NEMOGCM/NEMO/TOP_SRC/C14b/trcini_c14b.F90
===================================================================
--- trunk/NEMOGCM/NEMO/TOP_SRC/C14b/trcini_c14b.F90	(revision 2715)
+++ trunk/NEMOGCM/NEMO/TOP_SRC/C14b/trcini_c14b.F90	(revision 3294)
@@ -181,10 +181,10 @@
       IF( ctrcnm(jpc14) /= 'C14B' ) THEN
           ctrcnm(jpc14)  = 'C14B'
-          ctrcnl(jpc14)  = 'Bomb C14 concentration'
+          ctrcln(jpc14)  = 'Bomb C14 concentration'
       ENDIF
 
       IF(lwp) THEN
          CALL ctl_warn( ' we force tracer names' )
-         WRITE(numout,*) ' tracer nb: ',jpc14,' name = ',ctrcnm(jpc14), ctrcnl(jpc14)
+         WRITE(numout,*) ' tracer nb: ',jpc14,' name = ',ctrcnm(jpc14), ctrcln(jpc14)
          WRITE(numout,*) ' '
       ENDIF
Index: trunk/NEMOGCM/NEMO/TOP_SRC/C14b/trcnam_c14b.F90
===================================================================
--- trunk/NEMOGCM/NEMO/TOP_SRC/C14b/trcnam_c14b.F90	(revision 2715)
+++ trunk/NEMOGCM/NEMO/TOP_SRC/C14b/trcnam_c14b.F90	(revision 3294)
@@ -16,4 +16,5 @@
    USE trc             ! TOP variables
    USE trcsms_c14b     ! C14b specific variable
+   USE iom             ! I/O manager
 
    IMPLICIT NONE
@@ -37,5 +38,5 @@
       !!
       !! ** Method  :   Read the namc14 namelist and check the parameter 
-      !!       values called at the first timestep (nit000)
+      !!       values called at the first timestep (nittrc000)
       !!
       !! ** input   :   Namelist namelist_c14b
@@ -43,21 +44,11 @@
       INTEGER ::   numnatb
 
-#if defined key_diatrc && ! defined key_iomput
       ! definition of additional diagnostic as a structure
-      INTEGER ::   jl, jn
-      TYPE DIAG
-         CHARACTER(len = 20)  :: snamedia   !: short name
-         CHARACTER(len = 80 ) :: lnamedia   !: long name
-         CHARACTER(len = 20 ) :: unitdia    !: unit
-      END TYPE DIAG
-
-      TYPE(DIAG) , DIMENSION(jp_c14b_2d) :: c14dia2d
-      TYPE(DIAG) , DIMENSION(jp_c14b_3d) :: c14dia3d
-#endif
+      INTEGER :: jl, jn
+      TYPE(DIAG), DIMENSION(jp_c14b_2d) :: c14dia2d
+      TYPE(DIAG), DIMENSION(jp_c14b_3d) :: c14dia3d
       !!
       NAMELIST/namc14date/ ndate_beg_b, nyear_res_b
-#if defined key_diatrc && ! defined key_iomput
-      NAMELIST/namc14dia/nn_writedia, c14dia2d, c14dia3d     ! additional diagnostics
-#endif
+      NAMELIST/namc14dia/  c14dia2d, c14dia3d     ! additional diagnostics
       !!-------------------------------------------------------------------
 
@@ -80,65 +71,56 @@
       IF(lwp) WRITE(numout,*) '    initial year (aa)                  nyear_beg_b = ', nyear_beg_b
       !
-#if defined key_diatrc && ! defined key_iomput
+      IF( .NOT.lk_iomput .AND. ln_diatrc ) THEN
+         !
+         ! Namelist namc14dia
+         ! -------------------
+         DO jl = 1, jp_c14b_2d
+            WRITE(c14dia2d(jl)%sname,'("2D_",I1)') jl                      ! short name
+            WRITE(c14dia2d(jl)%lname,'("2D DIAGNOSTIC NUMBER ",I2)') jl    ! long name
+            c14dia2d(jl)%units = ' '                                       ! units
+         END DO
+         !                                 ! 3D output arrays
+         DO jl = 1, jp_c14b_3d
+            WRITE(c14dia3d(jl)%sname,'("3D_",I1)') jl                      ! short name
+            WRITE(c14dia3d(jl)%lname,'("3D DIAGNOSTIC NUMBER ",I2)') jl    ! long name
+            c14dia3d(jl)%units = ' '                                       ! units
+         END DO
 
-      ! Namelist namc14dia
-      ! -------------------
-      nn_writedia = 10                   ! default values
-
-      DO jl = 1, jp_c14b_2d
-         jn = jp_c14b0_2d + jl - 1
-         WRITE(ctrc2d(jn),'("2D_",I1)') jn                      ! short name
-         WRITE(ctrc2l(jn),'("2D DIAGNOSTIC NUMBER ",I2)') jn    ! long name
-         ctrc2u(jn) = ' '                                       ! units
-      END DO
-      !                                 ! 3D output arrays
-      DO jl = 1, jp_c14b_3d
-         jn = jp_c14b0_3d + jl - 1
-         WRITE(ctrc3d(jn),'("3D_",I1)') jn                      ! short name
-         WRITE(ctrc3l(jn),'("3D DIAGNOSTIC NUMBER ",I2)') jn    ! long name
-         ctrc3u(jn) = ' '                                       ! units
-      END DO
-
-      REWIND( numnatb )               ! read natrtd
-      READ  ( numnatb, namc14dia )
-
-      DO jl = 1, jp_c14b_2d
-         jn = jp_c14b0_2d + jl - 1
-         ctrc2d(jn) = c14dia2d(jl)%snamedia
-         ctrc2l(jn) = c14dia2d(jl)%lnamedia
-         ctrc2u(jn) = c14dia2d(jl)%unitdia
-      END DO
-
-      DO jl = 1, jp_c14b_3d
-         jn = jp_c14b0_3d + jl - 1
-         ctrc3d(jn) = c14dia3d(jl)%snamedia
-         ctrc3l(jn) = c14dia3d(jl)%lnamedia
-         ctrc3u(jn) = c14dia3d(jl)%unitdia
-      END DO
-
-      IF(lwp) THEN                   ! control print
-         WRITE(numout,*)
-         WRITE(numout,*) ' Namelist : natadd'
-         WRITE(numout,*) '    frequency of outputs for additional arrays nn_writedia = ', nn_writedia
-         DO jl = 1, jp_c14b_3d
-            jn = jp_c14b0_3d + jl - 1
-            WRITE(numout,*) '   3d output field No : ',jn
-            WRITE(numout,*) '   short name         : ', TRIM(ctrc3d(jn))
-            WRITE(numout,*) '   long name          : ', TRIM(ctrc3l(jn))
-            WRITE(numout,*) '   unit               : ', TRIM(ctrc3u(jn))
-            WRITE(numout,*) ' '
-         END DO
+         REWIND( numnatb )               ! 
+         READ  ( numnatb, namc14dia )
 
          DO jl = 1, jp_c14b_2d
             jn = jp_c14b0_2d + jl - 1
-            WRITE(numout,*) '   2d output field No : ',jn
-            WRITE(numout,*) '   short name         : ', TRIM(ctrc2d(jn))
-            WRITE(numout,*) '   long name          : ', TRIM(ctrc2l(jn))
-            WRITE(numout,*) '   unit               : ', TRIM(ctrc2u(jn))
+            ctrc2d(jn) = c14dia2d(jl)%sname
+            ctrc2l(jn) = c14dia2d(jl)%lname
+            ctrc2u(jn) = c14dia2d(jl)%units
+         END DO
+
+         DO jl = 1, jp_c14b_3d
+            jn = jp_c14b0_3d + jl - 1
+            ctrc3d(jn) = c14dia3d(jl)%sname
+            ctrc3l(jn) = c14dia3d(jl)%lname
+            ctrc3u(jn) = c14dia3d(jl)%units
+         END DO
+
+         IF(lwp) THEN                   ! control print
+            WRITE(numout,*)
+            WRITE(numout,*) ' Namelist : natadd'
+            DO jl = 1, jp_c14b_3d
+               jn = jp_c14b0_3d + jl - 1
+               WRITE(numout,*) '  3d diag nb : ', jn, '    short name : ', ctrc3d(jn), &
+                 &             '  long name  : ', ctrc3l(jn), '   unit : ', ctrc3u(jn)
+            END DO
             WRITE(numout,*) ' '
-         END DO
+
+            DO jl = 1, jp_c14b_2d
+               jn = jp_c14b0_2d + jl - 1
+               WRITE(numout,*) '  2d diag nb : ', jn, '    short name : ', ctrc2d(jn), &
+                 &             '  long name  : ', ctrc2l(jn), '   unit : ', ctrc2u(jn)
+            END DO
+            WRITE(numout,*) ' '
+         ENDIF
+         !
       ENDIF
-
-#endif
 
    END SUBROUTINE trc_nam_c14b
Index: trunk/NEMOGCM/NEMO/TOP_SRC/C14b/trcsms_c14b.F90
===================================================================
--- trunk/NEMOGCM/NEMO/TOP_SRC/C14b/trcsms_c14b.F90	(revision 2715)
+++ trunk/NEMOGCM/NEMO/TOP_SRC/C14b/trcsms_c14b.F90	(revision 3294)
@@ -94,7 +94,4 @@
       !!
       !!----------------------------------------------------------------------
-      USE wrk_nemo, ONLY:   wrk_in_use, wrk_not_released
-      USE wrk_nemo, ONLY:   zatmbc14 => wrk_2d_1
-      USE wrk_nemo, ONLY:   zw3d     => wrk_3d_1
       !
       INTEGER, INTENT(in) ::   kt    ! ocean time-step index
@@ -113,11 +110,15 @@
       REAL(wp) :: zpv               ! piston velocity 
       REAL(wp) :: zdemi, ztra
-      !!----------------------------------------------------------------------
-
-      IF( wrk_in_use(2, 1) .OR. wrk_in_use(3, 1) ) THEN
-         CALL ctl_stop('trc_sms_c14b : requested workspace arrays unavailable')   ;   RETURN
-      ENDIF
-
-      IF( kt == nit000 )  THEN         ! Computation of decay coeffcient
+      REAL(wp), POINTER, DIMENSION(:,:  ) :: zatmbc14  
+      REAL(wp), POINTER, DIMENSION(:,:,:) :: zdecay
+      !!---------------------------------------------------------------------
+      !
+      IF( nn_timing == 1 )  CALL timing_start('trc_sms_c14b')
+      !
+      ! Allocate temporary workspace
+      CALL wrk_alloc( jpi, jpj,      zatmbc14 )
+      CALL wrk_alloc( jpi, jpj, jpk, zdecay   )
+
+      IF( kt == nittrc000 )  THEN         ! Computation of decay coeffcient
          zdemi   = 5730._wp
          xlambda = LOG(2.) / zdemi / ( nyear_len(1) * rday )
@@ -246,5 +247,4 @@
 #endif
                   &                      * tmask(ji,jj,1) * ( 1. - fr_i(ji,jj) ) / 2.
-
             ! Add the surface flux to the trend
             tra(ji,jj,1,jpc14) = tra(ji,jj,1,jpc14) + qtr_c14(ji,jj) / fse3t(ji,jj,1) 
@@ -252,10 +252,5 @@
             ! cumulation of surface flux at each time step
             qint_c14(ji,jj) = qint_c14(ji,jj) + qtr_c14(ji,jj) * rdt
-
-# if defined key_diatrc && ! defined key_iomput
-            ! Save 2D diagnostics
-            trc2d(ji,jj,jp_c14b0_2d    ) = qtr_c14 (ji,jj)
-            trc2d(ji,jj,jp_c14b0_2d + 1) = qint_c14(ji,jj)
-# endif 
+            !
          END DO
       END DO
@@ -265,33 +260,33 @@
          DO jj = 1, jpj
             DO ji = 1, jpi
-#if ! defined key_degrad
-               ztra = trn(ji,jj,jk,jpc14) * xaccum
+#if defined key_degrad
+               zdecay(ji,jj,jk) = trn(ji,jj,jk,jpc14) * ( 1. - EXP( -xlambda * rdt * facvol(ji,jj,jk) ) )
 #else
-               ztra = trn(ji,jj,jk,jpc14) * ( 1. - EXP( -xlambda * rdt * facvol(ji,jj,jk) ) )
+               zdecay(ji,jj,jk) = trn(ji,jj,jk,jpc14) * xaccum
 #endif
-               tra(ji,jj,jk,jpc14) = tra(ji,jj,jk,jpc14) - ztra / rdt
-#if defined key_diatrc
-               ! Save 3D diagnostics
-# if ! defined key_iomput
-               trc3d(ji,jj,jk,jp_c14b0_3d ) = ztra    !  radioactive decay
-# else 
-               zw3d(ji,jj,jk) = ztra    !  radioactive decay
-# endif
-#endif
+               tra(ji,jj,jk,jpc14) = tra(ji,jj,jk,jpc14) - zdecay(ji,jj,jk) / rdt
+               !
             END DO
          END DO
       END DO
 
-#if defined key_diatrc  && defined key_iomput
-      CALL iom_put( "qtrC14b"  , qtr_c14  )
-      CALL iom_put( "qintC14b" , qint_c14 )
-#endif
-#if defined key_diatrc  && defined key_iomput
-      CALL iom_put( "fdecay" , zw3d )
-#endif
-      IF( l_trdtrc )   CALL trd_mod_trc( tra(:,:,:,jpc14), jpc14, jptra_trd_sms, kt )   ! save trends
-
-      IF( wrk_not_released(2, 1) .OR.   &
-          wrk_not_released(3, 1) )   CALL ctl_stop('trc_sms_c14b : failed to release workspace arrays')
+      IF( ln_diatrc ) THEN
+         IF( lk_iomput ) THEN
+            CALL iom_put( "qtrC14b"  , qtr_c14  )
+            CALL iom_put( "qintC14b" , qint_c14 )
+            CALL iom_put( "fdecay"   , zdecay   )
+          ELSE
+            trc2d(:,:  ,jp_c14b0_2d     ) = qtr_c14 (:,:)
+            trc2d(:,:  ,jp_c14b0_2d + 1 ) = qint_c14(:,:)
+            trc3d(:,:,:,jp_c14b0_3d     ) = zdecay  (:,:,:)
+          ENDIF
+      ENDIF
+
+      IF( l_trdtrc )  CALL trd_mod_trc( tra(:,:,:,jpc14), jpc14, jptra_trd_sms, kt )   ! save trends
+
+      CALL wrk_dealloc( jpi, jpj,      zatmbc14 )
+      CALL wrk_dealloc( jpi, jpj, jpk, zdecay   )
+      !
+      IF( nn_timing == 1 )  CALL timing_stop('trc_sms_c14b')
       !
    END SUBROUTINE trc_sms_c14b
