Index: /branches/2011/dev_r2787_LOCEAN3_TRA_TRP/NEMOGCM/CONFIG/GYRE_LOBSTER/EXP00/namelist_lobster
===================================================================
--- /branches/2011/dev_r2787_LOCEAN3_TRA_TRP/NEMOGCM/CONFIG/GYRE_LOBSTER/EXP00/namelist_lobster	(revision 2818)
+++ /branches/2011/dev_r2787_LOCEAN3_TRA_TRP/NEMOGCM/CONFIG/GYRE_LOBSTER/EXP00/namelist_lobster	(revision 2819)
@@ -98,8 +98,6 @@
 /
 !'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
-&namlobdia     !   additional 2D/3D tracers diagnostics ("key_trc_diaadd")
+&namlobdia     !   additional 2D/3D tracers diagnostics
 !,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
-   nn_writedia =  360  !  time step frequency for tracers diagnostics
-!
 !              !    name   ! title of   ! units !
 !              !           ! the field  !       !  
@@ -130,9 +128,5 @@
 &namlobdbi     !   biological diagnostics trends     
 !,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
-!                !  3D bio diagnostics   units : mmole/m3/s   ("key_trc_diabio")
 !                !  2D bio diagnostics   units : mmole/m2/s   ("key_trdmld_trc")
-
-   nwritebio    =   4320    !  time step frequency for biological outputs
-!
 !                !  name    !       title of the field      !     units      !
    lobdiabio(1)  = 'NO3PHY' , 'Flux from NO3 to PHY          ',  'mmole/m3/s'
Index: /branches/2011/dev_r2787_LOCEAN3_TRA_TRP/NEMOGCM/CONFIG/GYRE_LOBSTER/EXP00/namelist_top
===================================================================
--- /branches/2011/dev_r2787_LOCEAN3_TRA_TRP/NEMOGCM/CONFIG/GYRE_LOBSTER/EXP00/namelist_top	(revision 2818)
+++ /branches/2011/dev_r2787_LOCEAN3_TRA_TRP/NEMOGCM/CONFIG/GYRE_LOBSTER/EXP00/namelist_top	(revision 2819)
@@ -1,36 +1,50 @@
 !!>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
-!! NEMO/TOP1 :  1 - tracer definition                     (namtrc    )
-!! namelists    2 - dynamical tracer trends               (namtrc_trd)
-!!              3 - tracer advection                      (namtrc_adv)
-!!              4 - tracer lateral diffusion              (namtrc_ldf)
-!!              5 - tracer vertical physics               (namtrc_zdf)
-!!              6 - tracer newtonian damping              (namtrc_dmp)
+!! NEMO/TOP2 namelits :  1 - tracer definition                     (namtrc    )
+!!                       2 - tracer advection                      (namtrc_adv)
+!!                       3 - tracer lateral diffusion              (namtrc_ldf)
+!!                       4 - tracer vertical physics               (namtrc_zdf)
+!!                       5 - tracer newtonian damping              (namtrc_dmp)
+!!                       6 - dynamical tracer trends               (namtrc_trd)
+!!                       7 - tracer output                         (namtrc_wri)
 !>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
 !'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
 &namtrc     !   tracers definition
 !,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
+!
    nn_dttrc      =  1        !  time step frequency for passive sn_tracers
-   nn_writetrc   =  360      !  time step frequency for sn_tracer outputs
+   nn_writetrc   =  60      !  time step frequency for sn_tracer outputs
    ln_rsttr      = .false.   !  start from a restart file (T) or not (F)
-   nn_rsttr      =   0       !  restart control = 0 initial time step is not compared to the restart file value
+   nn_rsttr      =   1       !  restart control = 0 initial time step is not compared to the restart file value
                            !                  = 1 do not use the value in the restart file
                            !                  = 2 calendar parameters read in the restart file
-   cn_trcrst_in  = "restart_trc"   !  suffix of pass. sn_tracer restart name (input)
+   cn_trcrst_in  = "restart_trc.nc"   !  suffix of pass. sn_tracer restart name (input)
    cn_trcrst_out = "restart_trc"   !  suffix of pass. sn_tracer restart name (output)
+   ln_trcdta     =   .false.    !  Initialisation from data input file (T) or not (F)
 !
-!              ! name  !     title of the field       !   units       ! initial data ! save   !
-!              !       !                              !               ! from file    ! or not ! 
-!              !       !                              !               ! or not       !        !
-   sn_tracer(1)   = 'DET' , 'Detritus                   ',  'mmole-N/m3' ,  .false.     ,  .true.
-   sn_tracer(2)   = 'ZOO' , 'Zooplankton concentration  ',  'mmole-N/m3' ,  .false.     ,  .true.
-   sn_tracer(3)   = 'PHY' , 'Phytoplankton concentration',  'mmole-N/m3' ,  .false.     ,  .true.
-   sn_tracer(4)   = 'NO3' , 'Nitrate concentration      ',  'mmole-N/m3' ,  .false.     ,  .true.
-   sn_tracer(5)   = 'NH4' , 'Ammonium concentration     ',  'mmole-N/m3' ,  .false.     ,  .true.
-   sn_tracer(6)   = 'DOM' , 'Dissolved organic matter   ',  'mmole-N/m3' ,  .false.     ,  .true.
+!                ! name  !     title of the field          !   units       ! initial data ! save   !
+!                !       !                                 !               ! from file    ! or not ! 
+!                !       !                                 !               ! or not       !        !
+   sn_tracer(1)   = 'DET'   , 'Detritus                   ',  'mmole-N/m3' ,  .false.     ,  .false.
+   sn_tracer(2)   = 'ZOO'   , 'Zooplankton concentration  ',  'mmole-N/m3' ,  .false.     ,  .false.
+   sn_tracer(3)   = 'PHY'   , 'Phytoplankton concentration',  'mmole-N/m3' ,  .false.     ,  .false.
+   sn_tracer(4)   = 'NO3'   , 'Nitrate concentration      ',  'mmole-N/m3' ,  .false.     ,  .true.
+   sn_tracer(5)   = 'NH4'   , 'Ammonium concentration     ',  'mmole-N/m3' ,  .false.     ,  .false.
+   sn_tracer(6)   = 'DOM'   , 'Dissolved organic matter   ',  'mmole-N/m3' ,  .false.     ,  .false.
 /
 !-----------------------------------------------------------------------
-&namtrc_adv    !   advection scheme for passive tracer
+&namtrc_dta      !    Initialisation from data input file (T) or not (F)
 !-----------------------------------------------------------------------
-   ln_trcadv_cen2   =  .false.  !  2nd order centered scheme
+!
+!                !  file name  ! frequency (hours) ! variable   ! time interp. !  clim  ! 'yearly'/ ! weights  ! rotation !
+!                !             !  (if <0  months)  !   name     !   (logical)  !  (T/F) ! 'monthly' ! filename ! pairing  !
+   sn_trcdta(4)  = 'NO3_R1'    ,        -12        ,  'NO3'     ,    .false.   , .true. , 'yearly'  , ''       , ''
+
+   cn_dir        =     './'    !  root directory for the location of the runoff files
+   rn_trfac(4)   =    1.0      !   -       -       -       -      -
+/
+!-----------------------------------------------------------------------
+&namtrc_adv    !   advection scheme for passive tracer 
+!-----------------------------------------------------------------------
+   ln_trcadv_cen2   =  .false.  !  2nd order centered scheme   
    ln_trcadv_tvd    =  .true.   !  TVD scheme
    ln_trcadv_muscl  =  .false.  !  MUSCL scheme
@@ -51,4 +65,5 @@
    ln_trcldf_iso    =  .true.   !     iso-neutral                       (require "key_ldfslp")
 !                               !  Coefficient
+   rn_ahtrc_0       =  1000.    !  horizontal eddy diffusivity for tracers [m2/s]
    rn_ahtrb_0       =     0.    !     background eddy diffusivity for ldf_iso [m2/s]
 /
@@ -60,11 +75,12 @@
 /
 !-----------------------------------------------------------------------
-&namtrc_rad        !  treatment of negative concentrations
+&namtrc_rad        !  treatment of negative concentrations 
 !-----------------------------------------------------------------------
    ln_trcrad   =  .false.  !  artificially correct negative concentrations (T) or not (F)
 /
 !-----------------------------------------------------------------------
-&namtrc_dmp    !   passive tracer newtonian damping    ('key_tradmp && key_trcdmp')
+&namtrc_dmp    !   passive tracer newtonian damping  
 !-----------------------------------------------------------------------
+   ln_trcdmp   =  .false.  !  add a damping termn (T) or not (F)
    nn_hdmp_tr  =   -1      !  horizontal shape =-1, damping in Med and Red Seas only
                            !                   =XX, damping poleward of XX degrees (XX>0)
@@ -79,17 +95,18 @@
 /
 !-----------------------------------------------------------------------
-&namtrc_trd       !   diagnostics on tracer trends        ('key_trdtrc')
-!                          or mixed-layer trends          ('key_trdmld_trc')
+&namtrc_trd                !   diagnostics on tracer trends        ('key_trdtrc')
+!                                   or mixed-layer trends          ('key_trdmld_trc')
 !----------------------------------------------------------------------
-   nn_trd_trc   =  360      !  time step frequency and tracers trends
-   nn_ctls_trc  =   0       !  control surface type in mixed-layer trends (0,1 or n<jpk)
-   rn_ucf_trc   =  86400    !  unit conversion factor (=1 -> /seconds ; =86400. -> /day)
+   nn_trd_trc  =  5475      !  time step frequency and tracers trends
+   nn_ctls_trc =   0        !  control surface type in mixed-layer trends (0,1 or n<jpk)
+   rn_ucf_trc  =   1        !  unit conversion factor (=1 -> /seconds ; =86400. -> /day)
    ln_trdmld_trc_restart = .false.  !  restart for ML diagnostics
-   ln_trdmld_trc_instant = .false.  !  flag to diagnose trends of instantantaneous or mean ML T/S
+   ln_trdmld_trc_instant = .true.  !  flag to diagnose trends of instantantaneous or mean ML T/S
    ln_trdtrc(1)  =   .true.
-   ln_trdtrc(2)  =   .true.
-   ln_trdtrc(3)  =   .true.
-   ln_trdtrc(4)  =   .true.
-   ln_trdtrc(5)  =   .true.
-   ln_trdtrc(6)  =   .true.
 /
+!-----------------------------------------------------------------------
+&namtrc_dia       !   parameters for passive tracer additional diagnostics
+!----------------------------------------------------------------------
+   ln_diatrc     =  .true.   !  save additional diag. (T) or not (F)
+   nn_writedia   =  60     !  time step frequency for diagnostics
+/
Index: /branches/2011/dev_r2787_LOCEAN3_TRA_TRP/NEMOGCM/CONFIG/ORCA2_LIM/cpp_ORCA2_LIM.fcm
===================================================================
--- /branches/2011/dev_r2787_LOCEAN3_TRA_TRP/NEMOGCM/CONFIG/ORCA2_LIM/cpp_ORCA2_LIM.fcm	(revision 2818)
+++ /branches/2011/dev_r2787_LOCEAN3_TRA_TRP/NEMOGCM/CONFIG/ORCA2_LIM/cpp_ORCA2_LIM.fcm	(revision 2819)
@@ -1,1 +1,1 @@
- bld::tool::fppkeys key_trabbl key_vectopt_loop key_orca_r2 key_lim2 key_dynspg_flt key_diaeiv key_ldfslp key_traldf_c2d key_traldf_eiv key_dynldf_c3d key_dtatem key_dtasal key_tradmp key_zdftke key_zdfddm key_zdftmx key_iomput 
+ bld::tool::fppkeys key_trabbl key_vectopt_loop key_orca_r2 key_lim2 key_dynspg_flt key_diaeiv key_ldfslp key_traldf_c2d key_traldf_eiv key_dynldf_c3d key_zdftke key_zdfddm key_zdftmx key_iomput 
Index: /branches/2011/dev_r2787_LOCEAN3_TRA_TRP/NEMOGCM/CONFIG/ORCA2_LIM_PISCES/EXP00/namelist_pisces
===================================================================
--- /branches/2011/dev_r2787_LOCEAN3_TRA_TRP/NEMOGCM/CONFIG/ORCA2_LIM_PISCES/EXP00/namelist_pisces	(revision 2818)
+++ /branches/2011/dev_r2787_LOCEAN3_TRA_TRP/NEMOGCM/CONFIG/ORCA2_LIM_PISCES/EXP00/namelist_pisces	(revision 2819)
@@ -142,6 +142,4 @@
 &nampisdia     !   additional 2D/3D tracers diagnostics ("key_trc_diaadd")
 !,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
-   nn_writedia  =  5475   !  time step frequency for tracers diagnostics
-!
 !              !    name   !           title of the field          !     units      !
 !              !           !                                       !                !  
Index: /branches/2011/dev_r2787_LOCEAN3_TRA_TRP/NEMOGCM/CONFIG/ORCA2_LIM_PISCES/EXP00/namelist_top
===================================================================
--- /branches/2011/dev_r2787_LOCEAN3_TRA_TRP/NEMOGCM/CONFIG/ORCA2_LIM_PISCES/EXP00/namelist_top	(revision 2818)
+++ /branches/2011/dev_r2787_LOCEAN3_TRA_TRP/NEMOGCM/CONFIG/ORCA2_LIM_PISCES/EXP00/namelist_top	(revision 2819)
@@ -1,9 +1,11 @@
 !!>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
 !! NEMO/TOP1 :  1 - tracer definition                     (namtrc    )
-!! namelists    2 - dynamical tracer trends               (namtrc_trd)
+!!              2 - tracer data initialisation            (namtrc_dta)
 !!              3 - tracer advection                      (namtrc_adv)
 !!              4 - tracer lateral diffusion              (namtrc_ldf)
 !!              5 - tracer vertical physics               (namtrc_zdf)
 !!              6 - tracer newtonian damping              (namtrc_dmp)
+!!              7 - dynamical tracer trends               (namtrc_trd)
+!!              8 - tracer output diagonstics             (namtrc_dia)
 !>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
 !'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
@@ -18,4 +20,5 @@
    cn_trcrst_in  = "restart_trc"   !  suffix of pass. sn_tracer restart name (input)
    cn_trcrst_out = "restart_trc"   !  suffix of pass. sn_tracer restart name (output)
+   ln_trcdta     =   .true. !  Initialisation from data input file (T) or not (F)
 !
 !              !    name   !           title of the field              !   units    ! initial data ! save   !
@@ -48,4 +51,29 @@
 /
 !-----------------------------------------------------------------------
+&namtrc_dta      !    Initialisation from data input file
+!-----------------------------------------------------------------------
+!
+!                !  file name               ! frequency (hours) ! variable   ! time interp. !  clim  ! 'yearly'/ ! weights  ! rotation !
+!                !                          !  (if <0  months)  !   name     !   (logical)  !  (T/F) ! 'monthly' ! filename ! pairing  !
+   sn_trcdta(1)  = 'data_DIC_nomask'        ,        -12        ,  'DIC'     ,    .false.   , .true. , 'yearly'  , ''       , ''
+   sn_trcdta(2)  = 'data_Alkalini_nomask'   ,        -12        ,  'Alkalini',    .false.   , .true. , 'yearly'  , ''       , ''
+   sn_trcdta(3)  = 'data_O2_nomask'         ,        -1         ,  'O2'      ,    .true.    , .true. , 'yearly'  , ''       , ''
+   sn_trcdta(5)  = 'data_PO4_nomask'        ,        -1         ,  'PO4'     ,    .true.    , .true. , 'yearly'  , ''       , ''
+   sn_trcdta(7)  = 'data_Si_nomask'         ,        -1         ,  'Si'      ,    .true.    , .true. , 'yearly'  , ''       , ''
+   sn_trcdta(10) = 'data_DOC_nomask'        ,        -12        ,  'DOC'     ,    .false.   , .true. , 'yearly'  , ''       , ''
+   sn_trcdta(14) = 'data_Fer_nomask'        ,        -12        ,  'Fer'     ,    .false.   , .true. , 'yearly'  , ''       , ''
+   sn_trcdta(23) = 'data_NO3_nomask'        ,        -1         ,  'NO3'     ,    .true.    , .true. , 'yearly'  , ''       , ''
+!
+   cn_dir        =  './'      !  root directory for the location of the data files
+   rn_trfac(1)   =   1.0e-06  !  multiplicative factor
+   rn_trfac(2)   =   1.0e-06  !  -      -      -     -
+   rn_trfac(3)   =  44.6e-06  !  -      -      -     -
+   rn_trfac(5)   = 122.0e-06  !  -      -      -     -
+   rn_trfac(7)   =   1.0e-06  !  -      -      -     -
+   rn_trfac(10)  =   1.0      !  -      -      -     -
+   rn_trfac(14)  =   1.0      !  -      -      -     -
+   rn_trfac(23)  =   7.6e-06  !  -      -      -     -
+/
+!-----------------------------------------------------------------------
 &namtrc_adv    !   advection scheme for passive tracer 
 !-----------------------------------------------------------------------
@@ -69,4 +97,5 @@
    ln_trcldf_iso    =  .true.   !     iso-neutral                       (require "key_ldfslp")
 !                               !  Coefficient
+   rn_ahtrc_0       =  2000.    !  horizontal eddy diffusivity for tracers [m2/s]
    rn_ahtrb_0       =     0.    !     background eddy diffusivity for ldf_iso [m2/s]
 /
@@ -83,6 +112,7 @@
 /
 !-----------------------------------------------------------------------
-&namtrc_dmp    !   passive tracer newtonian damping    ('key_tradmp && key_trcdmp')
+&namtrc_dmp    !   passive tracer newtonian damping   
 !-----------------------------------------------------------------------
+   ln_trcdmp   =  .false.  !  add a damping termn (T) or not (F)
    nn_hdmp_tr  =   -1      !  horizontal shape =-1, damping in Med and Red Seas only
                            !                   =XX, damping poleward of XX degrees (XX>0)
@@ -107,25 +137,10 @@
    ln_trdtrc(1)  =   .true.
    ln_trdtrc(2)  =   .true.
-   ln_trdtrc(3)  =   .false.
-   ln_trdtrc(4)  =   .false.
-   ln_trdtrc(5)  =   .false.
-   ln_trdtrc(6)  =   .false.
-   ln_trdtrc(7)  =   .false.
-   ln_trdtrc(8)  =   .false.
-   ln_trdtrc(9)  =   .false.
-   ln_trdtrc(10) =   .false.
-   ln_trdtrc(11) =   .false.
-   ln_trdtrc(12) =   .false.
-   ln_trdtrc(13) =   .false.
-   ln_trdtrc(14) =   .false.
-   ln_trdtrc(15) =   .false.
-   ln_trdtrc(16) =   .false.
-   ln_trdtrc(17) =   .false.
-   ln_trdtrc(18) =   .false.
-   ln_trdtrc(19) =   .false.
-   ln_trdtrc(20) =   .false.
-   ln_trdtrc(21) =   .false.
-   ln_trdtrc(22) =   .false.
    ln_trdtrc(23) =   .true.
-   ln_trdtrc(24) =   .false.
 /
+!-----------------------------------------------------------------------
+&namtrc_dia       !   parameters for passive tracer additional diagnostics
+!----------------------------------------------------------------------
+   ln_diatrc     =  .true.   !  save additional diag. (T) or not (F)
+   nn_writedia   =  5475     !  time step frequency for diagnostics
+/
Index: /branches/2011/dev_r2787_LOCEAN3_TRA_TRP/NEMOGCM/CONFIG/ORCA2_LIM_PISCES/cpp_ORCA2_LIM_PISCES.fcm
===================================================================
--- /branches/2011/dev_r2787_LOCEAN3_TRA_TRP/NEMOGCM/CONFIG/ORCA2_LIM_PISCES/cpp_ORCA2_LIM_PISCES.fcm	(revision 2818)
+++ /branches/2011/dev_r2787_LOCEAN3_TRA_TRP/NEMOGCM/CONFIG/ORCA2_LIM_PISCES/cpp_ORCA2_LIM_PISCES.fcm	(revision 2819)
@@ -1,1 +1,1 @@
-bld::tool::fppkeys key_trabbl key_vectopt_loop key_orca_r2 key_lim2 key_dynspg_flt key_diaeiv key_ldfslp key_traldf_c2d key_traldf_eiv key_dynldf_c3d key_dtatem key_dtasal key_tradmp key_zdftke key_zdfddm key_top key_pisces key_dtatrc key_diatrc key_iomput 
+bld::tool::fppkeys key_trabbl key_vectopt_loop key_orca_r2 key_lim2 key_dynspg_flt key_diaeiv key_ldfslp key_traldf_c2d key_traldf_eiv key_dynldf_c3d key_zdfddm key_top key_pisces key_iomput 
Index: /branches/2011/dev_r2787_LOCEAN3_TRA_TRP/NEMOGCM/CONFIG/ORCA2_OFF_PISCES/EXP00/namelist_top
===================================================================
--- /branches/2011/dev_r2787_LOCEAN3_TRA_TRP/NEMOGCM/CONFIG/ORCA2_OFF_PISCES/EXP00/namelist_top	(revision 2818)
+++ /branches/2011/dev_r2787_LOCEAN3_TRA_TRP/NEMOGCM/CONFIG/ORCA2_OFF_PISCES/EXP00/namelist_top	(revision 2819)
@@ -1,9 +1,11 @@
 !!>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
 !! NEMO/TOP1 :  1 - tracer definition                     (namtrc    )
-!! namelists    2 - dynamical tracer trends               (namtrc_trd)
+!!              2 - tracer data initialisation            (namtrc_dta)
 !!              3 - tracer advection                      (namtrc_adv)
 !!              4 - tracer lateral diffusion              (namtrc_ldf)
 !!              5 - tracer vertical physics               (namtrc_zdf)
 !!              6 - tracer newtonian damping              (namtrc_dmp)
+!!              7 - dynamical tracer trends               (namtrc_trd)
+!!              8 - tracer output diagonstics             (namtrc_dia)
 !>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
 !'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
@@ -18,4 +20,5 @@
    cn_trcrst_in  = "restart_trc"   !  suffix of pass. sn_tracer restart name (input)
    cn_trcrst_out = "restart_trc"   !  suffix of pass. sn_tracer restart name (output)
+   ln_trcdta     =   .true. !  Initialisation from data input file (T) or not (F)
 !
 !              !    name   !           title of the field              !   units    ! initial data ! save   !
@@ -48,4 +51,29 @@
 /
 !-----------------------------------------------------------------------
+&namtrc_dta      !    Initialisation from data input file
+!-----------------------------------------------------------------------
+!
+!                !  file name               ! frequency (hours) ! variable   ! time interp. !  clim  ! 'yearly'/ ! weights  ! rotation !
+!                !                          !  (if <0  months)  !   name     !   (logical)  !  (T/F) ! 'monthly' ! filename ! pairing  !
+   sn_trcdta(1)  = 'data_DIC_nomask'        ,        -12        ,  'DIC'     ,    .false.   , .true. , 'yearly'  , ''       , ''
+   sn_trcdta(2)  = 'data_Alkalini_nomask'   ,        -12        ,  'Alkalini',    .false.   , .true. , 'yearly'  , ''       , ''
+   sn_trcdta(3)  = 'data_O2_nomask'         ,        -1         ,  'O2'      ,    .true.    , .true. , 'yearly'  , ''       , ''
+   sn_trcdta(5)  = 'data_PO4_nomask'        ,        -1         ,  'PO4'     ,    .true.    , .true. , 'yearly'  , ''       , ''
+   sn_trcdta(7)  = 'data_Si_nomask'         ,        -1         ,  'Si'      ,    .true.    , .true. , 'yearly'  , ''       , ''
+   sn_trcdta(10) = 'data_DOC_nomask'        ,        -12        ,  'DOC'     ,    .false.   , .true. , 'yearly'  , ''       , ''
+   sn_trcdta(14) = 'data_Fer_nomask'        ,        -12        ,  'Fer'     ,    .false.   , .true. , 'yearly'  , ''       , ''
+   sn_trcdta(23) = 'data_NO3_nomask'        ,        -1         ,  'NO3'     ,    .true.    , .true. , 'yearly'  , ''       , ''
+!
+   cn_dir        =  './'      !  root directory for the location of the data files
+   rn_trfac(1)   =   1.0e-06  !  multiplicative factor
+   rn_trfac(2)   =   1.0e-06  !  -      -      -     -
+   rn_trfac(3)   =  44.6e-06  !  -      -      -     -
+   rn_trfac(5)   = 122.0e-06  !  -      -      -     -
+   rn_trfac(7)   =   1.0e-06  !  -      -      -     -
+   rn_trfac(10)  =   1.0      !  -      -      -     -
+   rn_trfac(14)  =   1.0      !  -      -      -     -
+   rn_trfac(23)  =   7.6e-06  !  -      -      -     -
+/
+!-----------------------------------------------------------------------
 &namtrc_adv    !   advection scheme for passive tracer 
 !-----------------------------------------------------------------------
@@ -69,4 +97,5 @@
    ln_trcldf_iso    =  .true.   !     iso-neutral                       (require "key_ldfslp")
 !                               !  Coefficient
+   rn_ahtrc_0       =  2000.    !  horizontal eddy diffusivity for tracers [m2/s]
    rn_ahtrb_0       =     0.    !     background eddy diffusivity for ldf_iso [m2/s]
 /
@@ -83,6 +112,7 @@
 /
 !-----------------------------------------------------------------------
-&namtrc_dmp    !   passive tracer newtonian damping    ('key_tradmp && key_trcdmp')
+&namtrc_dmp    !   passive tracer newtonian damping   
 !-----------------------------------------------------------------------
+   ln_trcdmp   =  .false.  !  add a damping termn (T) or not (F)
    nn_hdmp_tr  =   -1      !  horizontal shape =-1, damping in Med and Red Seas only
                            !                   =XX, damping poleward of XX degrees (XX>0)
@@ -107,25 +137,10 @@
    ln_trdtrc(1)  =   .true.
    ln_trdtrc(2)  =   .true.
-   ln_trdtrc(3)  =   .false.
-   ln_trdtrc(4)  =   .false.
-   ln_trdtrc(5)  =   .false.
-   ln_trdtrc(6)  =   .false.
-   ln_trdtrc(7)  =   .false.
-   ln_trdtrc(8)  =   .false.
-   ln_trdtrc(9)  =   .false.
-   ln_trdtrc(10) =   .false.
-   ln_trdtrc(11) =   .false.
-   ln_trdtrc(12) =   .false.
-   ln_trdtrc(13) =   .false.
-   ln_trdtrc(14) =   .false.
-   ln_trdtrc(15) =   .false.
-   ln_trdtrc(16) =   .false.
-   ln_trdtrc(17) =   .false.
-   ln_trdtrc(18) =   .false.
-   ln_trdtrc(19) =   .false.
-   ln_trdtrc(20) =   .false.
-   ln_trdtrc(21) =   .false.
-   ln_trdtrc(22) =   .false.
    ln_trdtrc(23) =   .true.
-   ln_trdtrc(24) =   .false.
 /
+!-----------------------------------------------------------------------
+&namtrc_dia       !   parameters for passive tracer additional diagnostics
+!----------------------------------------------------------------------
+   ln_diatrc     =  .true.   !  save additional diag. (T) or not (F)
+   nn_writedia   =  1460     !  time step frequency for diagnostics
+/
Index: /branches/2011/dev_r2787_LOCEAN3_TRA_TRP/NEMOGCM/CONFIG/ORCA2_OFF_PISCES/cpp_ORCA2_OFF_PISCES.fcm
===================================================================
--- /branches/2011/dev_r2787_LOCEAN3_TRA_TRP/NEMOGCM/CONFIG/ORCA2_OFF_PISCES/cpp_ORCA2_OFF_PISCES.fcm	(revision 2818)
+++ /branches/2011/dev_r2787_LOCEAN3_TRA_TRP/NEMOGCM/CONFIG/ORCA2_OFF_PISCES/cpp_ORCA2_OFF_PISCES.fcm	(revision 2819)
@@ -1,1 +1,1 @@
-bld::tool::fppkeys key_trabbl key_vectopt_loop key_orca_r2 key_ldfslp key_traldf_c2d key_traldf_eiv key_top key_offline key_pisces key_dtatrc key_diatrc key_iomput 
+bld::tool::fppkeys key_trabbl key_vectopt_loop key_orca_r2 key_ldfslp key_traldf_c2d key_traldf_eiv key_top key_offline key_pisces key_iomput 
Index: /branches/2011/dev_r2787_LOCEAN3_TRA_TRP/NEMOGCM/NEMO/OPA_SRC/LDF/ldftra_oce.F90
===================================================================
--- /branches/2011/dev_r2787_LOCEAN3_TRA_TRP/NEMOGCM/NEMO/OPA_SRC/LDF/ldftra_oce.F90	(revision 2818)
+++ /branches/2011/dev_r2787_LOCEAN3_TRA_TRP/NEMOGCM/NEMO/OPA_SRC/LDF/ldftra_oce.F90	(revision 2819)
@@ -34,4 +34,7 @@
    LOGICAL , PUBLIC ::   l_triad_iso     = .FALSE.   !: calculate triads twice
    LOGICAL , PUBLIC ::   l_no_smooth     = .FALSE.   !: no Shapiro smoothing
+
+   REAL(wp), PUBLIC ::   rldf                        !: multiplicative factor of diffusive coefficient
+                                                     !: Needed to define the ratio between passive and active tracer diffusion coef. 
 
 #if defined key_traldf_c3d
Index: /branches/2011/dev_r2787_LOCEAN3_TRA_TRP/NEMOGCM/NEMO/OPA_SRC/LDF/ldftra_substitute.h90
===================================================================
--- /branches/2011/dev_r2787_LOCEAN3_TRA_TRP/NEMOGCM/NEMO/OPA_SRC/LDF/ldftra_substitute.h90	(revision 2818)
+++ /branches/2011/dev_r2787_LOCEAN3_TRA_TRP/NEMOGCM/NEMO/OPA_SRC/LDF/ldftra_substitute.h90	(revision 2819)
@@ -12,25 +12,25 @@
 #if defined key_traldf_c3d
 !   'key_traldf_c3d' :                 aht: 3D coefficient
-#       define   fsahtt(i,j,k)   ahtt(i,j,k)
-#       define   fsahtu(i,j,k)   ahtu(i,j,k)
-#       define   fsahtv(i,j,k)   ahtv(i,j,k)
-#       define   fsahtw(i,j,k)   ahtw(i,j,k)
+#       define   fsahtt(i,j,k)   rldf * ahtt(i,j,k)
+#       define   fsahtu(i,j,k)   rldf * ahtu(i,j,k)
+#       define   fsahtv(i,j,k)   rldf * ahtv(i,j,k)
+#       define   fsahtw(i,j,k)   rldf * ahtw(i,j,k)
 #elif defined key_traldf_c2d
 !   'key_traldf_c2d' :                 aht: 2D coefficient
-#       define   fsahtt(i,j,k)   ahtt(i,j)
-#       define   fsahtu(i,j,k)   ahtu(i,j)
-#       define   fsahtv(i,j,k)   ahtv(i,j)
-#       define   fsahtw(i,j,k)   ahtw(i,j)
+#       define   fsahtt(i,j,k)   rldf * ahtt(i,j)
+#       define   fsahtu(i,j,k)   rldf * ahtu(i,j)
+#       define   fsahtv(i,j,k)   rldf * ahtv(i,j)
+#       define   fsahtw(i,j,k)   rldf * ahtw(i,j)
 #elif defined key_traldf_c1d
 !   'key_traldf_c1d' :                aht: 1D coefficient
-#       define   fsahtt(i,j,k)   ahtt(k)
-#       define   fsahtu(i,j,k)   ahtu(k)
-#       define   fsahtv(i,j,k)   ahtv(k)
-#       define   fsahtw(i,j,k)   ahtw(k)
+#       define   fsahtt(i,j,k)   rldf * ahtt(k)
+#       define   fsahtu(i,j,k)   rldf * ahtu(k)
+#       define   fsahtv(i,j,k)   rldf * ahtv(k)
+#       define   fsahtw(i,j,k)   rldf * ahtw(k)
 #else
 !   Default option :             aht: Constant coefficient
-#      define   fsahtt(i,j,k)   aht0
-#      define   fsahtu(i,j,k)   aht0
-#      define   fsahtv(i,j,k)   aht0
-#      define   fsahtw(i,j,k)   aht0
+#      define   fsahtt(i,j,k)   rldf * aht0
+#      define   fsahtu(i,j,k)   rldf * aht0
+#      define   fsahtv(i,j,k)   rldf * aht0
+#      define   fsahtw(i,j,k)   rldf * aht0
 #endif
Index: /branches/2011/dev_r2787_LOCEAN3_TRA_TRP/NEMOGCM/NEMO/OPA_SRC/TRA/traldf.F90
===================================================================
--- /branches/2011/dev_r2787_LOCEAN3_TRA_TRP/NEMOGCM/NEMO/OPA_SRC/TRA/traldf.F90	(revision 2818)
+++ /branches/2011/dev_r2787_LOCEAN3_TRA_TRP/NEMOGCM/NEMO/OPA_SRC/TRA/traldf.F90	(revision 2819)
@@ -61,4 +61,6 @@
       REAL(wp), DIMENSION(:,:,:), ALLOCATABLE ::  ztrdt, ztrds
       !!----------------------------------------------------------------------
+
+      rldf = 1     ! For active tracers the 
 
       IF( l_trdtra )   THEN                    !* Save ta and sa trends
Index: /branches/2011/dev_r2787_LOCEAN3_TRA_TRP/NEMOGCM/NEMO/OPA_SRC/trc_oce.F90
===================================================================
--- /branches/2011/dev_r2787_LOCEAN3_TRA_TRP/NEMOGCM/NEMO/OPA_SRC/trc_oce.F90	(revision 2818)
+++ /branches/2011/dev_r2787_LOCEAN3_TRA_TRP/NEMOGCM/NEMO/OPA_SRC/trc_oce.F90	(revision 2819)
@@ -48,4 +48,15 @@
    !!----------------------------------------------------------------------
    LOGICAL, PUBLIC, PARAMETER ::   lk_offline = .FALSE.   !: offline flag
+#endif
+#if defined key_degrad
+   !!----------------------------------------------------------------------
+   !!   'key_degrad'                                     Degradation mode          
+   !!----------------------------------------------------------------------
+   LOGICAL, PUBLIC, PARAMETER ::   lk_degrad = .TRUE.   !: degradation flag
+#else
+   !!----------------------------------------------------------------------
+   !!   Default option                                   NO  Degradation mode          
+   !!----------------------------------------------------------------------
+   LOGICAL, PUBLIC, PARAMETER ::   lk_degrad = .FALSE.   !: degradation flag
 #endif
 
Index: /branches/2011/dev_r2787_LOCEAN3_TRA_TRP/NEMOGCM/NEMO/TOP_SRC/C14b/trcini_c14b.F90
===================================================================
--- /branches/2011/dev_r2787_LOCEAN3_TRA_TRP/NEMOGCM/NEMO/TOP_SRC/C14b/trcini_c14b.F90	(revision 2818)
+++ /branches/2011/dev_r2787_LOCEAN3_TRA_TRP/NEMOGCM/NEMO/TOP_SRC/C14b/trcini_c14b.F90	(revision 2819)
@@ -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: /branches/2011/dev_r2787_LOCEAN3_TRA_TRP/NEMOGCM/NEMO/TOP_SRC/C14b/trcnam_c14b.F90
===================================================================
--- /branches/2011/dev_r2787_LOCEAN3_TRA_TRP/NEMOGCM/NEMO/TOP_SRC/C14b/trcnam_c14b.F90	(revision 2818)
+++ /branches/2011/dev_r2787_LOCEAN3_TRA_TRP/NEMOGCM/NEMO/TOP_SRC/C14b/trcnam_c14b.F90	(revision 2819)
@@ -16,4 +16,5 @@
    USE trc             ! TOP variables
    USE trcsms_c14b     ! C14b specific variable
+   USE iom             ! I/O manager
 
    IMPLICIT NONE
@@ -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: /branches/2011/dev_r2787_LOCEAN3_TRA_TRP/NEMOGCM/NEMO/TOP_SRC/C14b/trcsms_c14b.F90
===================================================================
--- /branches/2011/dev_r2787_LOCEAN3_TRA_TRP/NEMOGCM/NEMO/TOP_SRC/C14b/trcsms_c14b.F90	(revision 2818)
+++ /branches/2011/dev_r2787_LOCEAN3_TRA_TRP/NEMOGCM/NEMO/TOP_SRC/C14b/trcsms_c14b.F90	(revision 2819)
@@ -246,5 +246,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) 
@@ -253,9 +252,10 @@
             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 
+            !                                        ! Save 2D diagnostics
+            IF( .NOT.lk_iomput .AND. ln_diatrc ) THEN
+               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,30 +265,28 @@
          DO jj = 1, jpj
             DO ji = 1, jpi
-#if ! defined key_degrad
+#if defined key_degrad
+               ztra = trn(ji,jj,jk,jpc14) * ( 1. - EXP( -xlambda * rdt * facvol(ji,jj,jk) ) )
+#else
                ztra = trn(ji,jj,jk,jpc14) * xaccum
-#else
-               ztra = trn(ji,jj,jk,jpc14) * ( 1. - EXP( -xlambda * rdt * facvol(ji,jj,jk) ) )
 #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
+               !                                     ! save 3D diag : radioactive decay
+               IF( ln_diatrc ) THEN
+                  IF( lk_iomput ) THEN   ;   zw3d(ji,jj,jk)               = ztra
+                  ELSE                   ;   trc3d(ji,jj,jk,jp_c14b0_3d ) = ztra
+                  ENDIF
+               ENDIF
+               !
             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( lk_iomput ) THEN
+         CALL iom_put( "qtrC14b"  , qtr_c14  )
+         CALL iom_put( "qintC14b" , qint_c14 )
+         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.   &
Index: /branches/2011/dev_r2787_LOCEAN3_TRA_TRP/NEMOGCM/NEMO/TOP_SRC/CFC/par_cfc.F90
===================================================================
--- /branches/2011/dev_r2787_LOCEAN3_TRA_TRP/NEMOGCM/NEMO/TOP_SRC/CFC/par_cfc.F90	(revision 2818)
+++ /branches/2011/dev_r2787_LOCEAN3_TRA_TRP/NEMOGCM/NEMO/TOP_SRC/CFC/par_cfc.F90	(revision 2819)
@@ -32,5 +32,5 @@
    !!---------------------------------------------------------------------
    LOGICAL, PUBLIC, PARAMETER ::   lk_cfc     = .TRUE.      !: CFC flag 
-   INTEGER, PUBLIC, PARAMETER ::   jp_cfc     =  2          !: number of passive tracers
+   INTEGER, PUBLIC, PARAMETER ::   jp_cfc     =  1          !: number of passive tracers
    INTEGER, PUBLIC, PARAMETER ::   jp_cfc_2d  =  2          !: additional 2d output arrays ('key_trc_diaadd')
    INTEGER, PUBLIC, PARAMETER ::   jp_cfc_3d  =  0          !: additional 3d output arrays ('key_trc_diaadd')
Index: /branches/2011/dev_r2787_LOCEAN3_TRA_TRP/NEMOGCM/NEMO/TOP_SRC/CFC/trcini_cfc.F90
===================================================================
--- /branches/2011/dev_r2787_LOCEAN3_TRA_TRP/NEMOGCM/NEMO/TOP_SRC/CFC/trcini_cfc.F90	(revision 2818)
+++ /branches/2011/dev_r2787_LOCEAN3_TRA_TRP/NEMOGCM/NEMO/TOP_SRC/CFC/trcini_cfc.F90	(revision 2819)
@@ -4,5 +4,5 @@
    !! TOP :   initialisation of the CFC tracers
    !!======================================================================
-   !! History :   2.0  !  2007-12  (C. Ethe, G. Madec) from trcini.cfc.h90
+   !! History :   2.0  !  2007-12  (C. Ethe, G. Madec) 
    !!----------------------------------------------------------------------
 #if defined key_cfc
@@ -43,5 +43,6 @@
       !! ** Method  : - Read the namcfc namelist and check the parameter values
       !!----------------------------------------------------------------------
-      INTEGER  ::  ji, jj, jn, jl, jm, js
+      INTEGER  ::  ji, jj, jn, jl, jm, js, io, ierr
+      INTEGER  ::  iskip = 6   ! number of 1st descriptor lines
       REAL(wp) ::  zyy, zyd
       !!----------------------------------------------------------------------
@@ -51,5 +52,25 @@
       IF(lwp) WRITE(numout,*) ' ~~~~~~~~~~~'
 
+
+      IF(lwp) WRITE(numout,*) 'read of formatted file cfc1112atm'
+      
+      CALL ctl_opn( inum, clname, 'OLD', 'FORMATTED', 'SEQUENTIAL', -1, numout, .FALSE. )
+      REWIND(inum)
+      
+      ! compute the number of year in the file
+      ! file starts in 1931 do jn represent the year in the century
+      jn = 31 
+      DO 
+        READ(inum,'(1x)',END=100) 
+        jn = jn + 1
+      END DO
+ 100  jpyear = jn - 1 - iskip
+      IF ( lwp) WRITE(numout,*) '    ', jpyear ,' years read'
       !                                ! Allocate CFC arrays
+
+      ALLOCATE( p_cfc(jpyear,jphem,2), STAT=ierr )
+      IF( ierr > 0 ) THEN
+         CALL ctl_stop( 'trc_ini_cfc: unable to allocate p_cfc array' )   ;   RETURN
+      ENDIF
       IF( trc_sms_cfc_alloc() /= 0 )   CALL ctl_stop( 'STOP', 'trc_ini_cfc: unable to allocate CFC arrays' )
 
@@ -75,32 +96,17 @@
       ENDIF
 
-
-      !   READ CFC partial pressure atmospheric value :
-      !     p11(year,nt) = PCFC11  in northern (1) and southern (2) hemisphere 
-      !     p12(year,nt) = PCFC12  in northern (1) and southern (2) hemisphere 
-      !--------------------------------------------------------------------
-
-      IF(lwp) WRITE(numout,*) 'read of formatted file cfc1112atm'
-      
-      CALL ctl_opn( inum, clname, 'OLD', 'FORMATTED', 'SEQUENTIAL', -1, numout, .FALSE. )
       REWIND(inum)
       
-      DO jm = 1, 6        ! Skip over 1st six descriptor lines
+      DO jm = 1, iskip        ! Skip over 1st six descriptor lines
          READ(inum,'(1x)')
       END DO
-   
       ! file starts in 1931 do jn represent the year in the century.jhh
       ! Read file till the end
       jn = 31
-      DO WHILE ( 1 /= 2 )
-         READ(inum,*,END=100) zyy, p_cfc(jn,1,1), p_cfc(jn,1,2), p_cfc(jn,2,1), p_cfc(jn,2,2)
-         IF ( lwp) THEN
-           WRITE(numout,'(f7.2, 4f8.2)' ) &
-            &         zyy, p_cfc(jn,1,1), p_cfc(jn,1,2), p_cfc(jn,2,1), p_cfc(jn,2,2)
-         ENDIF
-         jn = jn + 1
+      DO 
+        READ(inum,*, IOSTAT=io) zyy, p_cfc(jn,1,1), p_cfc(jn,1,2), p_cfc(jn,2,1), p_cfc(jn,2,2)
+        IF( io < 0 ) exit
+        jn = jn + 1
       END DO
- 100  npyear = jn - 1
-      IF ( lwp) WRITE(numout,*) '    ', npyear ,' years read'
 
       p_cfc(32,1:2,1) = 5.e-4      ! modify the values of the first years
@@ -116,5 +122,5 @@
          WRITE(numout,*)
          WRITE(numout,*) ' Year   p11HN    p11HS    p12HN    p12HS '
-         DO jn = 30, 100
+         DO jn = 30, jpyear
             WRITE(numout, '( 1I4, 4F9.2)') jn, p_cfc(jn,1,1), p_cfc(jn,2,1), p_cfc(jn,1,2), p_cfc(jn,2,2)
          END DO
Index: /branches/2011/dev_r2787_LOCEAN3_TRA_TRP/NEMOGCM/NEMO/TOP_SRC/CFC/trcnam_cfc.F90
===================================================================
--- /branches/2011/dev_r2787_LOCEAN3_TRA_TRP/NEMOGCM/NEMO/TOP_SRC/CFC/trcnam_cfc.F90	(revision 2818)
+++ /branches/2011/dev_r2787_LOCEAN3_TRA_TRP/NEMOGCM/NEMO/TOP_SRC/CFC/trcnam_cfc.F90	(revision 2819)
@@ -16,4 +16,5 @@
    USE trc             ! TOP variables
    USE trcsms_cfc      ! CFC specific variable
+   USE iom             ! I/O manager
 
    IMPLICIT NONE
@@ -41,21 +42,10 @@
       !! ** input   :   Namelist namcfc
       !!----------------------------------------------------------------------
-      INTEGER ::   numnatc
-#if defined key_diatrc && ! defined key_iomput
-      ! definition of additional diagnostic as a structure
+      INTEGER ::  numnatc
       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_cfc_2d) :: cfcdia2d
-#endif
+      TYPE(DIAG), DIMENSION(jp_cfc_2d) :: cfcdia2d
       !!
       NAMELIST/namcfcdate/ ndate_beg, nyear_res
-#if defined key_diatrc && ! defined key_iomput
-      NAMELIST/namcfcdia/nn_writedia, cfcdia2d     ! additional diagnostics
-#endif
+      NAMELIST/namcfcdia/  cfcdia2d     ! additional diagnostics
       !!-------------------------------------------------------------------
 
@@ -78,42 +68,37 @@
       IF(lwp) WRITE(numout,*) '    initial year (aa)                       nyear_beg = ', nyear_beg
       !
-#if defined key_diatrc && ! defined key_iomput
 
-      ! Namelist namcfcdia
-      ! -------------------
-      nn_writedia = 10                   ! default values
+      IF( .NOT.lk_iomput .AND. ln_diatrc ) THEN
+         !
+         ! Namelist namcfcdia
+         ! -------------------
+         DO jl = 1, jp_cfc_2d
+            WRITE(cfcdia2d(jl)%sname,'("2D_",I1)') jl                      ! short name
+            WRITE(cfcdia2d(jl)%lname,'("2D DIAGNOSTIC NUMBER ",I2)') jl    ! long name
+            cfcdia2d(jl)%units = ' '                                       ! units
+         END DO
 
-      DO jl = 1, jp_cfc_2d
-         jn = jp_cfc0_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
+         REWIND( numnatc )               ! read natrtd
+         READ  ( numnatc, namcfcdia )
 
-      REWIND( numnatc )               ! read natrtd
-      READ  ( numnatc, namcfcdia )
-
-      DO jl = 1, jp_cfc_2d
-         jn = jp_cfc0_2d + jl - 1
-         ctrc2d(jn) = cfcdia2d(jl)%snamedia
-         ctrc2l(jn) = cfcdia2d(jl)%lnamedia
-         ctrc2u(jn) = cfcdia2d(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_cfc_2d
             jn = jp_cfc0_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) = TRIM( cfcdia2d(jl)%sname )
+            ctrc2l(jn) = TRIM( cfcdia2d(jl)%lname )
+            ctrc2u(jn) = TRIM( cfcdia2d(jl)%units )
+         END DO
+
+         IF(lwp) THEN                   ! control print
+            WRITE(numout,*)
+            WRITE(numout,*) ' Namelist : natadd'
+            DO jl = 1, jp_cfc_2d
+               jn = jp_cfc0_2d + jl - 1
+               WRITE(numout,*) '  2d diag nb : ', jn, '    short name : ', ctrc2d(jn), &
+                 &             '  long name  : ', ctrc2l(jn), '   unit : ', ctrc2u(jn)
+            END DO
             WRITE(numout,*) ' '
-         END DO
+         ENDIF
+         !
       ENDIF
-#endif
 
    END SUBROUTINE trc_nam_cfc
Index: /branches/2011/dev_r2787_LOCEAN3_TRA_TRP/NEMOGCM/NEMO/TOP_SRC/CFC/trcsms_cfc.F90
===================================================================
--- /branches/2011/dev_r2787_LOCEAN3_TRA_TRP/NEMOGCM/NEMO/TOP_SRC/CFC/trcsms_cfc.F90	(revision 2818)
+++ /branches/2011/dev_r2787_LOCEAN3_TRA_TRP/NEMOGCM/NEMO/TOP_SRC/CFC/trcsms_cfc.F90	(revision 2819)
@@ -28,15 +28,15 @@
    PUBLIC   trc_sms_cfc_alloc   ! called in trcini_cfc.F90
 
-   INTEGER , PUBLIC, PARAMETER ::   jpyear = 150   ! temporal parameter 
    INTEGER , PUBLIC, PARAMETER ::   jphem  =   2   ! parameter for the 2 hemispheres
-   INTEGER , PUBLIC    ::   ndate_beg      ! initial calendar date (aammjj) for CFC
-   INTEGER , PUBLIC    ::   nyear_res      ! restoring time constant (year)
-   INTEGER , PUBLIC    ::   nyear_beg      ! initial year (aa) 
-   INTEGER , PUBLIC    ::   npyear         ! Number of years read in CFC1112 file
+   INTEGER , PUBLIC            ::   jpyear         ! Number of years read in CFC1112 file
+   INTEGER , PUBLIC            ::   ndate_beg      ! initial calendar date (aammjj) for CFC
+   INTEGER , PUBLIC            ::   nyear_res      ! restoring time constant (year)
+   INTEGER , PUBLIC            ::   nyear_beg      ! initial year (aa) 
    
-   REAL(wp), PUBLIC, DIMENSION(jpyear,jphem, 2    )      ::   p_cfc    ! partial hemispheric pressure for CFC
+   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::   p_cfc    ! partial hemispheric pressure for CFC
    REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:)   ::   xphem    ! spatial interpolation factor for patm
    REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::   qtr_cfc  ! flux at surface
    REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::   qint_cfc ! cumulative flux 
+   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:)   ::   patm     ! atmospheric function
 
    REAL(wp), DIMENSION(4,2) ::   soa   ! coefficient for solubility of CFC [mol/l/atm]
@@ -75,6 +75,4 @@
       !!                CFC concentration in pico-mol/m3
       !!----------------------------------------------------------------------
-      USE wrk_nemo, ONLY:   wrk_in_use, wrk_not_released
-      USE wrk_nemo, ONLY:   ztrcfc => wrk_3d_1        ! use for CFC sms trend
       !
       INTEGER, INTENT(in) ::   kt    ! ocean time-step index
@@ -82,5 +80,5 @@
       INTEGER  ::   ji, jj, jn, jl, jm, js
       INTEGER  ::   iyear_beg, iyear_end
-      INTEGER  ::   im1, im2
+      INTEGER  ::   im1, im2, ierr
       REAL(wp) ::   ztap, zdtap        
       REAL(wp) ::   zt1, zt2, zt3, zv2
@@ -90,9 +88,10 @@
       REAL(wp) ::   zca_cfc   ! concentration at equilibrium
       REAL(wp) ::   zak_cfc   ! transfert coefficients
-      REAL(wp), DIMENSION(jphem,jp_cfc) ::   zpatm   ! atmospheric function
-      !!----------------------------------------------------------------------
-      !
-      IF( wrk_in_use(3, 1) ) THEN
-         CALL ctl_stop('trc_sms_cfc: requested workspace array unavailable')   ;   RETURN
+      REAL(wp), ALLOCATABLE, DIMENSION(:,:)  ::   zpatm     ! atmospheric function
+      !!----------------------------------------------------------------------
+      !
+      ALLOCATE( zpatm(jphem,jp_cfc), STAT=ierr )
+      IF( ierr > 0 ) THEN
+         CALL ctl_stop( 'trc_sms_cfc: unable to allocate zpatm array' )   ;   RETURN
       ENDIF
 
@@ -158,5 +157,5 @@
 
                ! Input function  : speed *( conc. at equil - concen at surface )
-               ! trn in pico-mol/l idem qtr; ak in en m/s
+               ! trn in pico-mol/l idem qtr; ak in en m/a
                qtr_cfc(ji,jj,jl) = -zak_cfc * ( trb(ji,jj,1,jn) - zca_cfc )   &
 #if defined key_degrad
@@ -164,5 +163,4 @@
 #endif
                   &                         * tmask(ji,jj,1) * ( 1. - fr_i(ji,jj) )
-
                ! Add the surface flux to the trend
                tra(ji,jj,1,jn) = tra(ji,jj,1,jn) + qtr_cfc(ji,jj,jl) / fse3t(ji,jj,1) 
@@ -176,24 +174,21 @@
       END DO                                                !  end CFC loop  !
       !                                                     !----------------!
-
-#if defined key_diatrc 
-      ! Save diagnostics , just for CFC11
-# if  defined key_iomput
-      CALL iom_put( "qtrCFC11"  , qtr_cfc (:,:,1) )
-      CALL iom_put( "qintCFC11" , qint_cfc(:,:,1) )
-# else
-      trc2d(:,:,jp_cfc0_2d    ) = qtr_cfc (:,:,1)
-      trc2d(:,:,jp_cfc0_2d + 1) = qint_cfc(:,:,1)
-# endif
-#endif
-
+      IF( ln_diatrc ) THEN
+        !
+        IF( lk_iomput ) THEN
+           CALL iom_put( "qtrCFC11"  , qtr_cfc (:,:,1) )
+           CALL iom_put( "qintCFC11" , qint_cfc(:,:,1) )
+        ELSE
+           trc2d(:,:,jp_cfc0_2d    ) = qtr_cfc (:,:,1)
+           trc2d(:,:,jp_cfc0_2d + 1) = qint_cfc(:,:,1)
+        END IF
+        !
+      END IF
+ 
       IF( l_trdtrc ) THEN
           DO jn = jp_cfc0, jp_cfc1
-            ztrcfc(:,:,:) = tra(:,:,:,jn)
-            CALL trd_mod_trc( ztrcfc, jn, jptra_trd_sms, kt )   ! save trends
+            CALL trd_mod_trc( tra(:,:,:,jn), jn, jptra_trd_sms, kt )   ! save trends
           END DO
       END IF
-      !
-      IF( wrk_not_released(3, 1) )   CALL ctl_stop('trc_sms_cfc: failed to release workspace array')
       !
    END SUBROUTINE trc_sms_cfc
Index: /branches/2011/dev_r2787_LOCEAN3_TRA_TRP/NEMOGCM/NEMO/TOP_SRC/LOBSTER/par_lobster.F90
===================================================================
--- /branches/2011/dev_r2787_LOCEAN3_TRA_TRP/NEMOGCM/NEMO/TOP_SRC/LOBSTER/par_lobster.F90	(revision 2818)
+++ /branches/2011/dev_r2787_LOCEAN3_TRA_TRP/NEMOGCM/NEMO/TOP_SRC/LOBSTER/par_lobster.F90	(revision 2819)
@@ -19,6 +19,6 @@
    LOGICAL, PUBLIC, PARAMETER ::   lk_lobster     = .TRUE.    !: LOBSTER flag 
    INTEGER, PUBLIC, PARAMETER ::   jp_lobster     =  6        !: number of LOBSTER tracers
-   INTEGER, PUBLIC, PARAMETER ::   jp_lobster_2d  = 19        !: additional 2d output arrays ('key_diatrc')
-   INTEGER, PUBLIC, PARAMETER ::   jp_lobster_3d  =  3        !: additional 3d output arrays ('key_diatrc')
+   INTEGER, PUBLIC, PARAMETER ::   jp_lobster_2d  = 19        !: additional 2d output arrays 
+   INTEGER, PUBLIC, PARAMETER ::   jp_lobster_3d  =  3        !: additional 3d output arrays 
    INTEGER, PUBLIC, PARAMETER ::   jp_lobster_trd = 17       !: number of sms trends for LOBSTER
 
Index: /branches/2011/dev_r2787_LOCEAN3_TRA_TRP/NEMOGCM/NEMO/TOP_SRC/LOBSTER/trcbio.F90
===================================================================
--- /branches/2011/dev_r2787_LOCEAN3_TRA_TRP/NEMOGCM/NEMO/TOP_SRC/LOBSTER/trcbio.F90	(revision 2818)
+++ /branches/2011/dev_r2787_LOCEAN3_TRA_TRP/NEMOGCM/NEMO/TOP_SRC/LOBSTER/trcbio.F90	(revision 2819)
@@ -74,24 +74,18 @@
       REAL(wp) ::   zfilpz, zfildz, zphya, zzooa, zno3a
       REAL(wp) ::   znh4a, zdeta, zdoma, zzoobod, zboddet, zdomaju
-#if defined key_diatrc
       REAL(wp) ::   ze3t
-#endif
-#if defined key_diatrc && defined key_iomput
       REAL(wp), POINTER,   DIMENSION(:,:,:) :: zw2d
       REAL(wp), POINTER, DIMENSION(:,:,:,:) :: zw3d
-#endif
-      REAL(wp), DIMENSION(:,:,:,:), ALLOCATABLE ::   ztrbio
       CHARACTER (len=25) :: charout
       !!---------------------------------------------------------------------
 
-#if defined key_diatrc && defined key_iomput
-      IF( ( wrk_in_use(3, 2) ) .OR. ( wrk_in_use(4, 1) ) ) THEN
-         CALL ctl_stop('trc_bio : requested workspace arrays unavailable.')
-         RETURN
-      END IF
-      ! Set-up pointers into sub-arrays of workspaces
-      zw2d => wrk_3d_2(:,:,1:17)
-      zw3d => wrk_4d_1(:,:,:,1:3)
-#endif
+      IF( ln_diatrc .AND. lk_iomput ) THEN
+         IF( ( wrk_in_use(3, 2) ) .OR. ( wrk_in_use(4, 1) ) ) THEN
+            CALL ctl_stop('trc_bio : requested workspace arrays unavailable.')  ;  RETURN
+         END IF
+         ! Set-up pointers into sub-arrays of workspaces
+         zw2d => wrk_3d_2(:,:,1:17)
+         zw3d => wrk_4d_1(:,:,:,1:3)
+      ENDIF
 
       IF( kt == nit000 ) THEN
@@ -102,23 +96,18 @@
 
       fbod(:,:) = 0.e0
-#if defined key_diatrc && ! defined key_iomput
-#  if defined key_iomput
-      zw2d  (:,:,:) = 0.e0
-      zw3d(:,:,:,:) = 0.e0
-#  else
-      DO jl = jp_lob0_2d, jp_lob1_2d
-         trc2d(:,:,jl) = 0.e0
-      END DO 
-#  endif
-#endif
-
-      IF( l_trdtrc )THEN
-         ALLOCATE( ztrbio(jpi,jpj,jpk,jp_lobster_trd) )
-         ztrbio(:,:,:,:) = 0.
-      ENDIF
-
-      !                                      ! -------------------------- !
-      DO jk = 1, jpkbm1                      !  Upper ocean (bio-layers)  !
-         !                                   ! -------------------------- !
+      IF( ln_diatrc ) THEN
+         !
+         IF( lk_iomput ) THEN
+            zw2d  (:,:,:) = 0.e0
+            zw3d(:,:,:,:) = 0.e0
+         ELSE
+            trc2d(:,:,  jp_lob0_2d:jp_lob1_2d) = 0.e0
+            trc3d(:,:,:,jp_lob0_3d:jp_lob1_3d) = 0.e0
+         ENDIF
+         !
+      ENDIF
+
+      DO jk = 1, jpkm1                     
+         !                             
          DO jj = 2, jpjm1
             DO ji = fs_2, fs_jpim1 
@@ -133,64 +122,107 @@
                znh4 = MAX( 0.e0, trn(ji,jj,jk,jp_lob_nh4) )
                zdom = MAX( 0.e0, trn(ji,jj,jk,jp_lob_dom) )
-
-               ! Limitations
-               zlt   = 1.
-               zle   = 1. - EXP( -xpar(ji,jj,jk) / aki / zlt )
-               ! psinut,akno3,aknh4 added by asklod AS Kremeur 2005-03
-               zlno3 = zno3 * EXP( -psinut * znh4 ) / ( akno3 + zno3 )
-               zlnh4 = znh4 / (znh4+aknh4) 
-
-               ! sinks and sources
-               !    phytoplankton production and exsudation
-               zno3phy = tmumax * zle * zlt * zlno3 * zphy
-               znh4phy = tmumax * zle * zlt * zlnh4 * zphy
-
-               !    fphylab added by asklod AS Kremeur 2005-03
-               zphydom = rgamma * (1 - fphylab) * (zno3phy + znh4phy)
-               zphynh4 = rgamma * fphylab * (zno3phy + znh4phy)
-
-               ! zooplankton production
-               !    preferences
-               zppz = rppz
-               zpdz = 1. - rppz
-               zpppz = ( zppz * zphy ) / ( ( zppz * zphy + zpdz * zdet ) + 1.e-13 )
-               zppdz = ( zpdz * zdet ) / ( ( zppz * zphy + zpdz * zdet ) + 1.e-13 )
-               zfood = zpppz * zphy + zppdz * zdet
-               !    filtration
-               zfilpz = taus * zpppz / (aks + zfood)
-               zfildz = taus * zppdz / (aks + zfood)
-               !    grazing
-               zphyzoo = zfilpz * zphy * zzoo
-               zdetzoo = zfildz * zdet * zzoo
-
-               ! fecal pellets production
-               zzoodet = rpnaz * zphyzoo + rdnaz * zdetzoo
+               !                                      ! -------------------------- !
+               IF( jk <= jpkbm1 ) THEN                !  Upper ocean (bio-layers)  ! 
+                  !                                   ! -------------------------- !
+                  ! Limitations                     
+                  zlt   = 1.
+                  zle   = 1. - EXP( -xpar(ji,jj,jk) / aki / zlt )
+                  ! psinut,akno3,aknh4 added by asklod AS Kremeur 2005-03
+                  zlno3 = zno3 * EXP( -psinut * znh4 ) / ( akno3 + zno3 )
+                  zlnh4 = znh4 / (znh4+aknh4) 
+
+                  ! sinks and sources
+                  !    phytoplankton production and exsudation
+                  zno3phy = tmumax * zle * zlt * zlno3 * zphy
+                  znh4phy = tmumax * zle * zlt * zlnh4 * zphy
+
+                  !    fphylab added by asklod AS Kremeur 2005-03
+                  zphydom = rgamma * (1 - fphylab) * (zno3phy + znh4phy)
+                  zphynh4 = rgamma * fphylab * (zno3phy + znh4phy)
+   
+                  ! zooplankton production
+                  !    preferences
+                  zppz = rppz
+                  zpdz = 1. - rppz
+                  zpppz = ( zppz * zphy ) / ( ( zppz * zphy + zpdz * zdet ) + 1.e-13 )
+                  zppdz = ( zpdz * zdet ) / ( ( zppz * zphy + zpdz * zdet ) + 1.e-13 )
+                  zfood = zpppz * zphy + zppdz * zdet
+                  !    filtration
+                  zfilpz = taus * zpppz / (aks + zfood)
+                  zfildz = taus * zppdz / (aks + zfood)
+                  !    grazing zphyzoo = zfilpz * zphy * zzoo
+                  zdetzoo = zfildz * zdet * zzoo
+
+                  ! fecal pellets production
+                  zzoodet = rpnaz * zphyzoo + rdnaz * zdetzoo
  
-               ! zooplankton liquide excretion
-               zzoonh4 = tauzn * fzoolab * zzoo 
-               zzoodom = tauzn * (1 - fzoolab) * zzoo
-
-               ! mortality
-               !    phytoplankton mortality 
-               zphydet = tmminp * zphy
-
-               !    zooplankton mortality
-               !    closure : flux fbod is redistributed below level jpkbio
-               zzoobod = tmminz * zzoo * zzoo
-               fbod(ji,jj) = fbod(ji,jj) + (1-fdbod) * zzoobod * fse3t(ji,jj,jk)
-               zboddet = fdbod * zzoobod
-
-               ! detritus and dom breakdown
-               zdetnh4 = taudn * fdetlab * zdet
-               zdetdom = taudn * (1 - fdetlab) * zdet 
-
-               zdomnh4 = taudomn * zdom
-
-               ! flux added to express how the excess of nitrogen from
-               ! PHY, ZOO and DET to DOM goes directly to NH4 (flux of ajustment)
-               zdomaju = (1 - redf/reddom) * (zphydom + zzoodom + zdetdom)
-
-               ! Nitrification
-               znh4no3 = taunn * znh4
+                  ! zooplankton liquide excretion
+                  zzoonh4 = tauzn * fzoolab * zzoo 
+                  zzoodom = tauzn * (1 - fzoolab) * zzoo
+
+                  ! mortality
+                  !    phytoplankton mortality 
+                  zphydet = tmminp * zphy
+
+                  !    zooplankton mortality
+                  !    closure : flux fbod is redistributed below level jpkbio
+                  zzoobod = tmminz * zzoo * zzoo
+                  fbod(ji,jj) = fbod(ji,jj) + (1-fdbod) * zzoobod * fse3t(ji,jj,jk)
+                  zboddet = fdbod * zzoobod
+
+                  ! detritus and dom breakdown
+                  zdetnh4 = taudn * fdetlab * zdet
+                  zdetdom = taudn * (1 - fdetlab) * zdet 
+
+                  zdomnh4 = taudomn * zdom
+
+                  ! flux added to express how the excess of nitrogen from
+                  ! PHY, ZOO and DET to DOM goes directly to NH4 (flux of ajustment)
+                  zdomaju = (1 - redf/reddom) * (zphydom + zzoodom + zdetdom)
+
+                  ! Nitrification
+                  znh4no3 = taunn * znh4
+                  !                                   ! -------------------------- !
+               ELSE                                   !  Lower ocean               ! 
+                  !                                   ! -------------------------- !
+                  !    Limitations
+                  zlt   = 0.e0
+                  zle   = 0.e0
+                  zlno3 = 0.e0
+                  zlnh4 = 0.e0
+
+                  !    sinks and sources
+                  !       phytoplankton production and exsudation
+                  zno3phy = 0.e0
+                  znh4phy = 0.e0
+                  zphydom = 0.e0
+                  zphynh4 = 0.e0
+
+                  !    zooplankton production
+                  zphyzoo = 0.e0      ! grazing
+                  zdetzoo = 0.e0
+
+                  zzoodet = 0.e0      ! fecal pellets production
+
+                  zzoonh4 = tauzn * fzoolab * zzoo         ! zooplankton liquide excretion
+                  zzoodom = tauzn * (1 - fzoolab) * zzoo
+
+                  !    mortality
+                  zphydet = tmminp * zphy      ! phytoplankton mortality 
+
+                  zzoobod = 0.e0               ! zooplankton mortality
+                  zboddet = 0.e0               ! closure : flux fbod is redistributed below level jpkbio
+
+                  !    detritus and dom breakdown
+                  zdetnh4 = taudn * fdetlab * zdet
+                  zdetdom = taudn * (1 - fdetlab) * zdet
+
+                  zdomnh4 = taudomn * zdom
+                  zdomaju = (1 - redf/reddom) * (zphydom + zzoodom + zdetdom)
+
+                  !    Nitrification
+                  znh4no3 = taunn * znh4
+                  !
+               ENDIF
 
                ! determination of trends
@@ -211,286 +243,138 @@
                tra(ji,jj,jk,jp_lob_dom) = tra(ji,jj,jk,jp_lob_dom) + zdoma
 
-#if defined key_diabio
-               trbio(ji,jj,jk,jp_lob0_trd     ) = zno3phy
-               trbio(ji,jj,jk,jp_lob0_trd +  1) = znh4phy
-               trbio(ji,jj,jk,jp_lob0_trd +  2) = zphynh4
-               trbio(ji,jj,jk,jp_lob0_trd +  3) = zphydom
-               trbio(ji,jj,jk,jp_lob0_trd +  4) = zphyzoo
-               trbio(ji,jj,jk,jp_lob0_trd +  5) = zphydet
-               trbio(ji,jj,jk,jp_lob0_trd +  6) = zdetzoo
-               trbio(ji,jj,jk,jp_lob0_trd +  8) = zzoodet
-               trbio(ji,jj,jk,jp_lob0_trd +  9) = zzoobod
-               trbio(ji,jj,jk,jp_lob0_trd + 10) = zzoonh4
-               trbio(ji,jj,jk,jp_lob0_trd + 11) = zzoodom
-               trbio(ji,jj,jk,jp_lob0_trd + 12) = znh4no3
-               trbio(ji,jj,jk,jp_lob0_trd + 13) = zdomnh4
-               trbio(ji,jj,jk,jp_lob0_trd + 14) = zdetnh4
-               trbio(ji,jj,jk,jp_lob0_trd + 15) = zdetdom
-#endif
-               IF( l_trdtrc ) THEN
-                  ztrbio(ji,jj,jk,jp_lob0_trd     ) = zno3phy
-                  ztrbio(ji,jj,jk,jp_lob0_trd +  1) = znh4phy
-                  ztrbio(ji,jj,jk,jp_lob0_trd +  2) = zphynh4
-                  ztrbio(ji,jj,jk,jp_lob0_trd +  3) = zphydom
-                  ztrbio(ji,jj,jk,jp_lob0_trd +  4) = zphyzoo
-                  ztrbio(ji,jj,jk,jp_lob0_trd +  5) = zphydet
-                  ztrbio(ji,jj,jk,jp_lob0_trd +  6) = zdetzoo
+               IF( ( ln_diabio .AND. .NOT. lk_iomput ) .OR. l_trdtrc ) THEN
+                  trbio(ji,jj,jk,jp_lob0_trd     ) = zno3phy
+                  trbio(ji,jj,jk,jp_lob0_trd +  1) = znh4phy
+                  trbio(ji,jj,jk,jp_lob0_trd +  2) = zphynh4
+                  trbio(ji,jj,jk,jp_lob0_trd +  3) = zphydom
+                  trbio(ji,jj,jk,jp_lob0_trd +  4) = zphyzoo
+                  trbio(ji,jj,jk,jp_lob0_trd +  5) = zphydet
+                  trbio(ji,jj,jk,jp_lob0_trd +  6) = zdetzoo
                   !  trend number 8 in trcsed
-                  ztrbio(ji,jj,jk,jp_lob0_trd +  8) = zzoodet
-                  ztrbio(ji,jj,jk,jp_lob0_trd +  9) = zzoobod
-                  ztrbio(ji,jj,jk,jp_lob0_trd + 10) = zzoonh4
-                  ztrbio(ji,jj,jk,jp_lob0_trd + 11) = zzoodom
-                  ztrbio(ji,jj,jk,jp_lob0_trd + 12) = znh4no3
-                  ztrbio(ji,jj,jk,jp_lob0_trd + 13) = zdomnh4
-                  ztrbio(ji,jj,jk,jp_lob0_trd + 14) = zdetnh4
-                  ztrbio(ji,jj,jk,jp_lob0_trd + 15) = zdetdom
+                  trbio(ji,jj,jk,jp_lob0_trd +  8) = zzoodet
+                  trbio(ji,jj,jk,jp_lob0_trd +  9) = zzoobod
+                  trbio(ji,jj,jk,jp_lob0_trd + 10) = zzoonh4
+                  trbio(ji,jj,jk,jp_lob0_trd + 11) = zzoodom
+                  trbio(ji,jj,jk,jp_lob0_trd + 12) = znh4no3
+                  trbio(ji,jj,jk,jp_lob0_trd + 13) = zdomnh4
+                  trbio(ji,jj,jk,jp_lob0_trd + 14) = zdetnh4
+                  trbio(ji,jj,jk,jp_lob0_trd + 15) = zdetdom
                   !  trend number 17 in trcexp
                 ENDIF
 
-#if defined key_diatrc
-               ! convert fluxes in per day
-               ze3t = fse3t(ji,jj,jk) * 86400.
-#if ! defined key_iomput
-               trc2d(ji,jj,jp_lob0_2d    ) = trc2d(ji,jj, jp_lob0_2d    ) + zno3phy * ze3t 
-               trc2d(ji,jj,jp_lob0_2d + 1) = trc2d(ji,jj, jp_lob0_2d + 1) + znh4phy * ze3t
-               trc2d(ji,jj,jp_lob0_2d + 2) = trc2d(ji,jj, jp_lob0_2d + 2) + zphydom * ze3t
-               trc2d(ji,jj,jp_lob0_2d + 3) = trc2d(ji,jj, jp_lob0_2d + 3) + zphynh4 * ze3t
-               trc2d(ji,jj,jp_lob0_2d + 4) = trc2d(ji,jj, jp_lob0_2d + 4) + zphyzoo * ze3t
-               trc2d(ji,jj,jp_lob0_2d + 5) = trc2d(ji,jj, jp_lob0_2d + 5) + zphydet * ze3t
-               trc2d(ji,jj,jp_lob0_2d + 6) = trc2d(ji,jj, jp_lob0_2d + 6) + zdetzoo * ze3t
-               ! trend number 8 is in trcsed.F            
-               trc2d(ji,jj,jp_lob0_2d +  8) = trc2d(ji,jj,jp_lob0_2d +  8) + zzoodet * ze3t
-               trc2d(ji,jj,jp_lob0_2d +  9) = trc2d(ji,jj,jp_lob0_2d +  9) + zzoobod * ze3t
-               trc2d(ji,jj,jp_lob0_2d + 10) = trc2d(ji,jj,jp_lob0_2d + 10) + zzoonh4 * ze3t
-               trc2d(ji,jj,jp_lob0_2d + 11) = trc2d(ji,jj,jp_lob0_2d + 11) + zzoodom * ze3t
-               trc2d(ji,jj,jp_lob0_2d + 12) = trc2d(ji,jj,jp_lob0_2d + 12) + znh4no3 * ze3t
-               trc2d(ji,jj,jp_lob0_2d + 13) = trc2d(ji,jj,jp_lob0_2d + 13) + zdomnh4 * ze3t
-               trc2d(ji,jj,jp_lob0_2d + 14) = trc2d(ji,jj,jp_lob0_2d + 14) + zdetnh4 * ze3t             
-               trc2d(ji,jj,jp_lob0_2d + 15) = trc2d(ji,jj,jp_lob0_2d + 15) + (  zno3phy + znh4phy - zphynh4   &
-                  &                                 - zphydom - zphyzoo - zphydet ) * ze3t
-               trc2d(ji,jj,jp_lob0_2d + 16) = trc2d(ji,jj,jp_lob0_2d + 16) + (  zphyzoo + zdetzoo - zzoodet   &
-                  &                                 - zzoobod - zzoonh4 - zzoodom ) * ze3t
-               trc2d(ji,jj,jp_lob0_2d + 17) = trc2d(ji,jj,jp_lob0_2d + 17) + zdetdom * ze3t
-               ! trend number 19 is in trcexp.F
-#else
-               zw2d(ji,jj,1)  = zw2d(ji,jj,1)  + zno3phy * ze3t 
-               zw2d(ji,jj,2)  = zw2d(ji,jj,2)  + znh4phy * ze3t
-               zw2d(ji,jj,3)  = zw2d(ji,jj,3)  + zphydom * ze3t
-               zw2d(ji,jj,4)  = zw2d(ji,jj,4)  + zphynh4 * ze3t
-               zw2d(ji,jj,5)  = zw2d(ji,jj,5)  + zphyzoo * ze3t
-               zw2d(ji,jj,6)  = zw2d(ji,jj,6)  + zphydet * ze3t
-               zw2d(ji,jj,7)  = zw2d(ji,jj,7)  + zdetzoo * ze3t
-               zw2d(ji,jj,8)  = zw2d(ji,jj,8)  + zzoodet * ze3t
-               zw2d(ji,jj,9)  = zw2d(ji,jj,9)  + zzoobod * ze3t
-               zw2d(ji,jj,10) = zw2d(ji,jj,10) + zzoonh4 * ze3t
-               zw2d(ji,jj,11) = zw2d(ji,jj,11) + zzoodom * ze3t
-               zw2d(ji,jj,12) = zw2d(ji,jj,12) + znh4no3 * ze3t
-               zw2d(ji,jj,13) = zw2d(ji,jj,13) + zdomnh4 * ze3t
-               zw2d(ji,jj,14) = zw2d(ji,jj,14) + zdetnh4 * ze3t             
-               zw2d(ji,jj,15) = zw2d(ji,jj,15) + ( zno3phy + znh4phy - zphynh4 - zphydom - zphyzoo - zphydet ) * ze3t
-               zw2d(ji,jj,16) = zw2d(ji,jj,16) + ( zphyzoo + zdetzoo - zzoodet - zzoobod - zzoonh4 - zzoodom ) * ze3t
-               zw2d(ji,jj,17) = zw2d(ji,jj,17) + zdetdom * ze3t
-#endif
-#if defined key_diatrc 
-# if ! defined key_iomput
-               trc3d(ji,jj,jk,jp_lob0_3d    ) = zno3phy * 86400     
-               trc3d(ji,jj,jk,jp_lob0_3d + 1) = znh4phy * 86400     
-               trc3d(ji,jj,jk,jp_lob0_3d + 2) = znh4no3 * 86400   
-# else
-               zw3d(ji,jj,jk,1) = zno3phy * 86400     
-               zw3d(ji,jj,jk,2) = znh4phy * 86400     
-               zw3d(ji,jj,jk,3) = znh4no3 * 86400   
-# endif
-#endif  
-#endif
+                IF( ln_diatrc ) THEN
+                  ! convert fluxes in per day
+                  ze3t = fse3t(ji,jj,jk) * 86400.
+                  IF( lk_iomput ) THEN
+                     zw2d(ji,jj,1)  = zw2d(ji,jj,1)  + zno3phy * ze3t 
+                     zw2d(ji,jj,2)  = zw2d(ji,jj,2)  + znh4phy * ze3t
+                     zw2d(ji,jj,3)  = zw2d(ji,jj,3)  + zphydom * ze3t
+                     zw2d(ji,jj,4)  = zw2d(ji,jj,4)  + zphynh4 * ze3t
+                     zw2d(ji,jj,5)  = zw2d(ji,jj,5)  + zphyzoo * ze3t
+                     zw2d(ji,jj,6)  = zw2d(ji,jj,6)  + zphydet * ze3t
+                     zw2d(ji,jj,7)  = zw2d(ji,jj,7)  + zdetzoo * ze3t
+                     zw2d(ji,jj,8)  = zw2d(ji,jj,8)  + zzoodet * ze3t
+                     zw2d(ji,jj,9)  = zw2d(ji,jj,9)  + zzoobod * ze3t
+                     zw2d(ji,jj,10) = zw2d(ji,jj,10) + zzoonh4 * ze3t
+                     zw2d(ji,jj,11) = zw2d(ji,jj,11) + zzoodom * ze3t
+                     zw2d(ji,jj,12) = zw2d(ji,jj,12) + znh4no3 * ze3t
+                     zw2d(ji,jj,13) = zw2d(ji,jj,13) + zdomnh4 * ze3t
+                     zw2d(ji,jj,14) = zw2d(ji,jj,14) + zdetnh4 * ze3t             
+                     zw2d(ji,jj,15) = zw2d(ji,jj,15) + ( zno3phy + znh4phy - zphynh4 - zphydom - zphyzoo - zphydet ) * ze3t
+                     zw2d(ji,jj,16) = zw2d(ji,jj,16) + ( zphyzoo + zdetzoo - zzoodet - zzoobod - zzoonh4 - zzoodom ) * ze3t
+                     zw2d(ji,jj,17) = zw2d(ji,jj,17) + zdetdom * ze3t
+                     !
+                     zw3d(ji,jj,jk,1) = zno3phy * 86400     
+                     zw3d(ji,jj,jk,2) = znh4phy * 86400     
+                     zw3d(ji,jj,jk,3) = znh4no3 * 86400   
+                  ELSE
+                     trc2d(ji,jj,jp_lob0_2d    ) = trc2d(ji,jj, jp_lob0_2d    ) + zno3phy * ze3t 
+                     trc2d(ji,jj,jp_lob0_2d + 1) = trc2d(ji,jj, jp_lob0_2d + 1) + znh4phy * ze3t
+                     trc2d(ji,jj,jp_lob0_2d + 2) = trc2d(ji,jj, jp_lob0_2d + 2) + zphydom * ze3t
+                     trc2d(ji,jj,jp_lob0_2d + 3) = trc2d(ji,jj, jp_lob0_2d + 3) + zphynh4 * ze3t
+                     trc2d(ji,jj,jp_lob0_2d + 4) = trc2d(ji,jj, jp_lob0_2d + 4) + zphyzoo * ze3t
+                     trc2d(ji,jj,jp_lob0_2d + 5) = trc2d(ji,jj, jp_lob0_2d + 5) + zphydet * ze3t
+                     trc2d(ji,jj,jp_lob0_2d + 6) = trc2d(ji,jj, jp_lob0_2d + 6) + zdetzoo * ze3t
+                     ! trend number 8 is in trcsed.F            
+                     trc2d(ji,jj,jp_lob0_2d +  8) = trc2d(ji,jj,jp_lob0_2d +  8) + zzoodet * ze3t
+                     trc2d(ji,jj,jp_lob0_2d +  9) = trc2d(ji,jj,jp_lob0_2d +  9) + zzoobod * ze3t
+                     trc2d(ji,jj,jp_lob0_2d + 10) = trc2d(ji,jj,jp_lob0_2d + 10) + zzoonh4 * ze3t
+                     trc2d(ji,jj,jp_lob0_2d + 11) = trc2d(ji,jj,jp_lob0_2d + 11) + zzoodom * ze3t
+                     trc2d(ji,jj,jp_lob0_2d + 12) = trc2d(ji,jj,jp_lob0_2d + 12) + znh4no3 * ze3t
+                     trc2d(ji,jj,jp_lob0_2d + 13) = trc2d(ji,jj,jp_lob0_2d + 13) + zdomnh4 * ze3t
+                     trc2d(ji,jj,jp_lob0_2d + 14) = trc2d(ji,jj,jp_lob0_2d + 14) + zdetnh4 * ze3t             
+                     trc2d(ji,jj,jp_lob0_2d + 15) = trc2d(ji,jj,jp_lob0_2d + 15) + (  zno3phy + znh4phy - zphynh4   &
+                        &                                 - zphydom - zphyzoo - zphydet ) * ze3t
+                     trc2d(ji,jj,jp_lob0_2d + 16) = trc2d(ji,jj,jp_lob0_2d + 16) + (  zphyzoo + zdetzoo - zzoodet   &
+                        &                                 - zzoobod - zzoonh4 - zzoodom ) * ze3t
+                     trc2d(ji,jj,jp_lob0_2d + 17) = trc2d(ji,jj,jp_lob0_2d + 17) + zdetdom * ze3t
+                     ! trend number 19 is in trcexp.F
+                     trc3d(ji,jj,jk,jp_lob0_3d    ) = zno3phy * 86400     
+                     trc3d(ji,jj,jk,jp_lob0_3d + 1) = znh4phy * 86400     
+                     trc3d(ji,jj,jk,jp_lob0_3d + 2) = znh4no3 * 86400   
+                     !
+                  ENDIF
+                   !
+                ENDIF
             END DO
          END DO
       END DO
 
-      !                                      ! -------------------------- !
-      DO jk = jpkb, jpkm1                    !  Upper ocean (bio-layers)  !
-         !                                   ! -------------------------- !
-         DO jj = 2, jpjm1
-            DO ji = fs_2, fs_jpim1 
-               ! remineralisation of all quantities towards nitrate 
-
-               !    trophic variables( det, zoo, phy, no3, nh4, dom)
-               !       negative trophic variables DO not contribute to the fluxes
-               zdet = MAX( 0.e0, trn(ji,jj,jk,jp_lob_det) )
-               zzoo = MAX( 0.e0, trn(ji,jj,jk,jp_lob_zoo) )
-               zphy = MAX( 0.e0, trn(ji,jj,jk,jp_lob_phy) )
-               zno3 = MAX( 0.e0, trn(ji,jj,jk,jp_lob_no3) )
-               znh4 = MAX( 0.e0, trn(ji,jj,jk,jp_lob_nh4) )
-               zdom = MAX( 0.e0, trn(ji,jj,jk,jp_lob_dom) )
-
-               !    Limitations
-               zlt   = 0.e0
-               zle   = 0.e0
-               zlno3 = 0.e0
-               zlnh4 = 0.e0
-
-               !    sinks and sources
-               !       phytoplankton production and exsudation
-               zno3phy = 0.e0
-               znh4phy = 0.e0
-               zphydom = 0.e0
-               zphynh4 = 0.e0
-
-               !    zooplankton production
-               zphyzoo = 0.e0      ! grazing
-               zdetzoo = 0.e0
-
-               zzoodet = 0.e0      ! fecal pellets production
-
-               zzoonh4 = tauzn * fzoolab * zzoo         ! zooplankton liquide excretion
-               zzoodom = tauzn * (1 - fzoolab) * zzoo
-
-               !    mortality
-               zphydet = tmminp * zphy      ! phytoplankton mortality 
-
-               zzoobod = 0.e0               ! zooplankton mortality
-               zboddet = 0.e0               ! closure : flux fbod is redistributed below level jpkbio
-
-               !    detritus and dom breakdown
-               zdetnh4 = taudn * fdetlab * zdet
-               zdetdom = taudn * (1 - fdetlab) * zdet 
-
-               zdomnh4 = taudomn * zdom
-               zdomaju = (1 - redf/reddom) * (zphydom + zzoodom + zdetdom)
-
-               !    Nitrification
-               znh4no3 = taunn * znh4
-
-
-               ! determination of trends
-               !     total trend for each biological tracer
-               zphya =   zno3phy + znh4phy - zphynh4 - zphydom - zphyzoo - zphydet
-               zzooa =   zphyzoo + zdetzoo - zzoodet - zzoodom - zzoonh4 - zzoobod
-               zno3a = - zno3phy + znh4no3
-               znh4a = - znh4phy - znh4no3 + zphynh4 + zzoonh4 + zdomnh4 + zdetnh4 + zdomaju
-               zdeta = zphydet + zzoodet  - zdetzoo - zdetnh4 - zdetdom + zboddet
-               zdoma = zphydom + zzoodom + zdetdom - zdomnh4 - zdomaju
-
-               ! tracer flux at totox-point added to the general trend
-               tra(ji,jj,jk,jp_lob_det) = tra(ji,jj,jk,jp_lob_det) + zdeta
-               tra(ji,jj,jk,jp_lob_zoo) = tra(ji,jj,jk,jp_lob_zoo) + zzooa
-               tra(ji,jj,jk,jp_lob_phy) = tra(ji,jj,jk,jp_lob_phy) + zphya
-               tra(ji,jj,jk,jp_lob_no3) = tra(ji,jj,jk,jp_lob_no3) + zno3a
-               tra(ji,jj,jk,jp_lob_nh4) = tra(ji,jj,jk,jp_lob_nh4) + znh4a
-               tra(ji,jj,jk,jp_lob_dom) = tra(ji,jj,jk,jp_lob_dom) + zdoma
-               !
-#if defined key_diabio
-               trbio(ji,jj,jk,jp_lob0_trd     ) = zno3phy
-               trbio(ji,jj,jk,jp_lob0_trd +  1) = znh4phy
-               trbio(ji,jj,jk,jp_lob0_trd +  2) = zphynh4
-               trbio(ji,jj,jk,jp_lob0_trd +  3) = zphydom
-               trbio(ji,jj,jk,jp_lob0_trd +  4) = zphyzoo
-               trbio(ji,jj,jk,jp_lob0_trd +  5) = zphydet
-               trbio(ji,jj,jk,jp_lob0_trd +  6) = zdetzoo
-               trbio(ji,jj,jk,jp_lob0_trd +  8) = zzoodet
-               trbio(ji,jj,jk,jp_lob0_trd +  9) = zzoobod
-               trbio(ji,jj,jk,jp_lob0_trd + 10) = zzoonh4
-               trbio(ji,jj,jk,jp_lob0_trd + 11) = zzoodom
-               trbio(ji,jj,jk,jp_lob0_trd + 12) = znh4no3
-               trbio(ji,jj,jk,jp_lob0_trd + 13) = zdomnh4
-               trbio(ji,jj,jk,jp_lob0_trd + 14) = zdetnh4
-               trbio(ji,jj,jk,jp_lob0_trd + 15) = zdetdom
-#endif
-               IF( l_trdtrc ) THEN
-                  ztrbio(ji,jj,jk,jp_lob0_trd     ) = zno3phy
-                  ztrbio(ji,jj,jk,jp_lob0_trd +  1) = znh4phy
-                  ztrbio(ji,jj,jk,jp_lob0_trd +  2) = zphynh4
-                  ztrbio(ji,jj,jk,jp_lob0_trd +  3) = zphydom
-                  ztrbio(ji,jj,jk,jp_lob0_trd +  4) = zphyzoo
-                  ztrbio(ji,jj,jk,jp_lob0_trd +  5) = zphydet
-                  ztrbio(ji,jj,jk,jp_lob0_trd +  6) = zdetzoo
-                  !  trend number 8 in trcsed
-                  ztrbio(ji,jj,jk,jp_lob0_trd +  8) = zzoodet
-                  ztrbio(ji,jj,jk,jp_lob0_trd +  9) = zzoobod
-                  ztrbio(ji,jj,jk,jp_lob0_trd + 10) = zzoonh4
-                  ztrbio(ji,jj,jk,jp_lob0_trd + 11) = zzoodom
-                  ztrbio(ji,jj,jk,jp_lob0_trd + 12) = znh4no3
-                  ztrbio(ji,jj,jk,jp_lob0_trd + 13) = zdomnh4
-                  ztrbio(ji,jj,jk,jp_lob0_trd + 14) = zdetnh4
-                  ztrbio(ji,jj,jk,jp_lob0_trd + 15) = zdetdom
-                  !  trend number 17 in trcexp
-                ENDIF
-#if defined key_diatrc
-# if ! defined key_iomput
-               trc3d(ji,jj,jk,jp_lob0_3d    ) =  zno3phy * 86400     
-               trc3d(ji,jj,jk,jp_lob0_3d + 1) =  znh4phy * 86400     
-               trc3d(ji,jj,jk,jp_lob0_3d + 2) =  znh4no3 * 86400     
-# else
-               zw3d(ji,jj,jk,1) = zno3phy * 86400     
-               zw3d(ji,jj,jk,2) = znh4phy * 86400     
-               zw3d(ji,jj,jk,3) = znh4no3 * 86400   
-# endif
-#endif
+      IF( ln_diatrc ) THEN
+         !
+         IF( lk_iomput ) THEN
+            DO jl = 1, 17 
+               CALL lbc_lnk( zw2d(:,:,jl),'T', 1. )
             END DO
-         END DO
-      END DO
-
-#if defined key_diatrc
-      ! Lateral boundary conditions 
-# if ! defined key_iomput
-      DO jl = jp_lob0_2d, jp_lob1_2d
-          CALL lbc_lnk( trc2d(:,:,jl),'T', 1. )
-      END DO 
-# else
-      DO jl = 1, 17 
-          CALL lbc_lnk( zw2d(:,:,jl),'T', 1. )
-      END DO
-      ! Save diagnostics
-      CALL iom_put( "TNO3PHY", zw2d(:,:,1) )
-      CALL iom_put( "TNH4PHY", zw2d(:,:,2) )
-      CALL iom_put( "TPHYDOM", zw2d(:,:,3) )
-      CALL iom_put( "TPHYNH4", zw2d(:,:,4) )
-      CALL iom_put( "TPHYZOO", zw2d(:,:,5) )
-      CALL iom_put( "TPHYDET", zw2d(:,:,6) )
-      CALL iom_put( "TDETZOO", zw2d(:,:,7) )
-      CALL iom_put( "TZOODET", zw2d(:,:,8) )
-      CALL iom_put( "TZOOBOD", zw2d(:,:,9) )
-      CALL iom_put( "TZOONH4", zw2d(:,:,10) )
-      CALL iom_put( "TZOODOM", zw2d(:,:,11) )
-      CALL iom_put( "TNH4NO3", zw2d(:,:,12) )
-      CALL iom_put( "TDOMNH4", zw2d(:,:,13) )
-      CALL iom_put( "TDETNH4", zw2d(:,:,14) )
-      CALL iom_put( "TPHYTOT", zw2d(:,:,15) )
-      CALL iom_put( "TZOOTOT", zw2d(:,:,16) )
-      CALL iom_put( "TDETDOM", zw2d(:,:,17) )
-# endif
-#endif
-
-#if defined key_diatrc
-      ! Lateral boundary conditions 
-# if ! defined key_iomput
-      DO jl = jp_lob0_3d, jp_lob1_3d
-          CALL lbc_lnk( trc3d(:,:,1,jl),'T', 1. )
-      END DO 
-# else
-      DO jl = 1, 3
-          CALL lbc_lnk( zw3d(:,:,:,jl),'T', 1. )
-      END DO
-      ! save diagnostics
-      CALL iom_put( "FNO3PHY", zw3d(:,:,:,1) )
-      CALL iom_put( "FNH4PHY", zw3d(:,:,:,2) )
-      CALL iom_put( "FNH4NO3", zw3d(:,:,:,3) )
-# endif 
-#endif
-
-#if defined key_diabio
-      ! Lateral boundary conditions on trcbio
-      DO jl = jp_lob0_trd, jp_lob1_trd
-          CALL lbc_lnk( trbio(:,:,1,jl),'T', 1. )
-      END DO 
-#endif
+            DO jl = 1, 3
+               CALL lbc_lnk( zw3d(:,:,:,jl),'T', 1. )
+            END DO
+            ! Save diagnostics
+            CALL iom_put( "TNO3PHY", zw2d(:,:,1) )
+            CALL iom_put( "TNH4PHY", zw2d(:,:,2) )
+            CALL iom_put( "TPHYDOM", zw2d(:,:,3) )
+            CALL iom_put( "TPHYNH4", zw2d(:,:,4) )
+            CALL iom_put( "TPHYZOO", zw2d(:,:,5) )
+            CALL iom_put( "TPHYDET", zw2d(:,:,6) )
+            CALL iom_put( "TDETZOO", zw2d(:,:,7) )
+            CALL iom_put( "TZOODET", zw2d(:,:,8) )
+            CALL iom_put( "TZOOBOD", zw2d(:,:,9) )
+            CALL iom_put( "TZOONH4", zw2d(:,:,10) )
+            CALL iom_put( "TZOODOM", zw2d(:,:,11) )
+            CALL iom_put( "TNH4NO3", zw2d(:,:,12) )
+            CALL iom_put( "TDOMNH4", zw2d(:,:,13) )
+            CALL iom_put( "TDETNH4", zw2d(:,:,14) )
+            CALL iom_put( "TPHYTOT", zw2d(:,:,15) )
+            CALL iom_put( "TZOOTOT", zw2d(:,:,16) )
+            ! 
+            CALL iom_put( "FNO3PHY", zw3d(:,:,:,1) )
+            CALL iom_put( "FNH4PHY", zw3d(:,:,:,2) )
+            CALL iom_put( "FNH4NO3", zw3d(:,:,:,3) )
+            !
+         ELSE
+            !
+           DO jl = jp_lob0_2d, jp_lob1_2d
+              CALL lbc_lnk( trc2d(:,:,jl),'T', 1. )
+           END DO 
+           !
+           DO jl = jp_lob0_3d, jp_lob1_3d
+             CALL lbc_lnk( trc3d(:,:,1,jl),'T', 1. )
+           END DO 
+           !
+        ENDIF
+        !
+      ENDIF
+
+      IF( ln_diabio .AND. .NOT. lk_iomput )  THEN
+         DO jl = jp_lob0_trd, jp_lob1_trd
+            CALL lbc_lnk( trbio(:,:,1,jl),'T', 1. )
+         END DO 
+      ENDIF
       !
       IF( l_trdtrc ) THEN
          DO jl = jp_lob0_trd, jp_lob1_trd
-            CALL trd_mod_trc( ztrbio(:,:,:,jl), jl, kt )   ! handle the trend
+            CALL trd_mod_trc( trbio(:,:,:,jl), jl, kt )   ! handle the trend
          END DO
       ENDIF
-
-      IF( l_trdtrc ) DEALLOCATE( ztrbio )
 
       IF(ln_ctl)   THEN  ! print mean trends (used for debugging)
@@ -500,8 +384,8 @@
       ENDIF
       !
-#if defined key_diatrc && defined key_iomput
-      IF( ( wrk_not_released(3, 2) ) .OR. ( wrk_not_released(4, 1) ) )  &
-        &   CALL ctl_stop('trc_bio : failed to release workspace arrays.')
-#endif
+      IF( ln_diatrc .AND. lk_iomput ) THEN
+         IF( ( wrk_not_released(3, 2) ) .OR. ( wrk_not_released(4, 1) ) )  &
+           &   CALL ctl_stop('trc_bio : failed to release workspace arrays.')
+      ENDIF
       !
    END SUBROUTINE trc_bio
Index: /branches/2011/dev_r2787_LOCEAN3_TRA_TRP/NEMOGCM/NEMO/TOP_SRC/LOBSTER/trcexp.F90
===================================================================
--- /branches/2011/dev_r2787_LOCEAN3_TRA_TRP/NEMOGCM/NEMO/TOP_SRC/LOBSTER/trcexp.F90	(revision 2818)
+++ /branches/2011/dev_r2787_LOCEAN3_TRA_TRP/NEMOGCM/NEMO/TOP_SRC/LOBSTER/trcexp.F90	(revision 2819)
@@ -53,9 +53,10 @@
       !!              COLUMN BELOW THE SURFACE LAYER.
       !!---------------------------------------------------------------------
+      !!
       INTEGER, INTENT( in ) ::   kt      ! ocean time-step index      
       !!
-      INTEGER  ::   ji, jj, jk, jl, ikt
+      INTEGER  ::   ji, jj, jk, jl, ikt, ierr
       REAL(wp) ::   zgeolpoc, zfact, zwork, ze3t, zsedpocd
-      REAL(wp), DIMENSION(:,:,:), ALLOCATABLE ::   ztrbio
+      REAL(wp), DIMENSION(:,:,:), ALLOCATABLE ::  ztrbio
       CHARACTER (len=25) :: charout
       !!---------------------------------------------------------------------
@@ -67,4 +68,12 @@
       ENDIF
 
+      IF( l_trdtrc )  THEN
+         ALLOCATE( ztrbio(jpi,jpj,jpk) , STAT = ierr )   ! temporary save of trends
+         IF( ierr > 0 ) THEN
+            CALL ctl_stop( 'trc_exp: unable to allocate ztrbio array' )   ;   RETURN
+         ENDIF
+         ztrbio(:,:,:) = tra(:,:,:,jp_lob_no3)
+      ENDIF
+
       ! VERTICAL DISTRIBUTION OF NEWLY PRODUCED BIOGENIC
       ! POC IN THE WATER COLUMN
@@ -72,10 +81,4 @@
       ! LAYERS IS DETERMINED BY DMIN3 DEFINED IN sms_lobster.F90
       ! ----------------------------------------------------------------------
-
-      IF( l_trdtrc )THEN
-         ALLOCATE( ztrbio(jpi,jpj,jpk) )
-         ztrbio(:,:,:) = tra(:,:,:,jp_lob_no3)
-      ENDIF
-
       DO jk = 1, jpkm1
          DO jj = 2, jpjm1
@@ -114,11 +117,9 @@
  
       ! Oa & Ek: diagnostics depending on jpdia2d !          left as example
-#if defined key_diatrc
-# if ! defined key_iomput
-      trc2d(:,:,jp_lob0_2d + 18) = sedpocn(:,:)
-# else
-     CALL iom_put( "SEDPOC" , sedpocn )
-# endif
-#endif
+      IF( ln_diatrc ) THEN
+         IF( lk_iomput ) THEN   ;   CALL iom_put( "SEDPOC" , sedpocn )
+         ELSE                   ;   trc2d(:,:,jp_lob0_2d + 18) = sedpocn(:,:)
+         ENDIF
+      ENDIF
 
       
@@ -146,7 +147,6 @@
          jl = jp_lob0_trd + 16
          CALL trd_mod_trc( ztrbio, jl, kt )   ! handle the trend
+         DEALLOCATE( ztrbio ) 
       ENDIF
-
-      IF( l_trdtrc ) DEALLOCATE( ztrbio )
 
       IF(ln_ctl)   THEN  ! print mean trends (used for debugging)
Index: /branches/2011/dev_r2787_LOCEAN3_TRA_TRP/NEMOGCM/NEMO/TOP_SRC/LOBSTER/trcnam_lobster.F90
===================================================================
--- /branches/2011/dev_r2787_LOCEAN3_TRA_TRP/NEMOGCM/NEMO/TOP_SRC/LOBSTER/trcnam_lobster.F90	(revision 2818)
+++ /branches/2011/dev_r2787_LOCEAN3_TRA_TRP/NEMOGCM/NEMO/TOP_SRC/LOBSTER/trcnam_lobster.F90	(revision 2819)
@@ -12,8 +12,10 @@
    !! trc_nam_lobster   : LOBSTER model namelist read
    !!----------------------------------------------------------------------
-   USE oce_trc          ! Ocean variables
-   USE par_trc          ! TOP parameters
-   USE trc              ! TOP variables
-   USE sms_lobster      ! sms trends
+   USE oce_trc                                   ! Ocean variables
+   USE par_trc                                   ! TOP parameters
+   USE trc                                       ! TOP variables
+   USE trdmod_trc_oce , ONLY :  lk_trdmld_trc    !  tracers  trend flag
+   USE sms_lobster                               ! sms trends
+   USE iom                                       ! I/O manager
 
    IMPLICIT NONE
@@ -41,27 +43,8 @@
       INTEGER ::   numnatl
       !!
-#if defined key_diatrc && ! defined key_iomput
       INTEGER :: jl, jn
-      ! definition of additional diagnostic as a structure
-      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_lobster_2d) :: lobdia2d
-      TYPE(DIAG) , DIMENSION(jp_lobster_3d) :: lobdia3d
-#endif
-#if defined key_diabio || defined key_trdmld_trc
-      INTEGER :: js, jd
-      ! definition of additional diagnostic as a structure
-      TYPE DIABIO
-         CHARACTER(len = 20)  :: snamebio   !: short name
-         CHARACTER(len = 80 ) :: lnamebio   !: long name
-         CHARACTER(len = 20 ) :: unitbio    !: unit
-      END TYPE DIABIO
-
-      TYPE(DIABIO) , DIMENSION(jp_lobster_trd) :: lobdiabio
-#endif
+      TYPE(DIAG), DIMENSION(jp_lobster_2d )  :: lobdia2d
+      TYPE(DIAG), DIMENSION(jp_lobster_3d )  :: lobdia3d
+      TYPE(DIAG), DIMENSION(jp_lobster_trd)  :: lobdiabio
 
       NAMELIST/namlobphy/ apmin, tmumax, rgamma, fphylab, tmmaxp, tmminp, &
@@ -77,10 +60,6 @@
 
       NAMELIST/namlobopt/ xkg0, xkr0, xkgp, xkrp, xlg, xlr, rpig
-#if defined key_diatrc && ! defined key_iomput
-      NAMELIST/namlobdia/nn_writedia, lobdia3d, lobdia2d     ! additional diagnostics
-#endif
-#if defined key_diabio || defined key_trdmld_trc
-      NAMELIST/namlobdbi/nwritebio, lobdiabio
-#endif
+      NAMELIST/namlobdia/ lobdia3d, lobdia2d     ! additional diagnostics
+      NAMELIST/namlobdbi/ lobdiabio
       !!----------------------------------------------------------------------
 
@@ -278,103 +257,93 @@
       ENDIF
 
-#if defined key_diatrc && ! defined key_iomput
-
-      ! Namelist namlobdia
-      ! -------------------
-      nn_writedia = 10                   ! default values
-
-      DO jl = 1, jp_lobster_2d
-         jn = jp_lob0_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_lobster_3d
-         jn = jp_lob0_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( numnatl )               ! read natrtd
-      READ  ( numnatl, namlobdia )
-
-      DO jl = 1, jp_lobster_2d
-         jn = jp_lob0_2d + jl - 1
-         ctrc2d(jn) = lobdia2d(jl)%snamedia
-         ctrc2l(jn) = lobdia2d(jl)%lnamedia
-         ctrc2u(jn) = lobdia2d(jl)%unitdia
-      END DO
-
-      DO jl = 1, jp_lobster_3d
-         jn = jp_lob0_3d + jl - 1
-         ctrc3d(jn) = lobdia3d(jl)%snamedia
-         ctrc3l(jn) = lobdia3d(jl)%lnamedia
-         ctrc3u(jn) = lobdia3d(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
+      !
+      IF( .NOT.lk_iomput .AND. ln_diatrc ) THEN
+         !
+         ! Namelist namlobdia
+         ! -------------------
+         DO jl = 1, jp_lobster_2d
+            WRITE(lobdia2d(jl)%sname,'("2D_",I1)') jl                      ! short name
+            WRITE(lobdia2d(jl)%lname,'("2D DIAGNOSTIC NUMBER ",I2)') jl    ! long name
+            lobdia2d(jl)%units = ' '                                        ! units
+         END DO
+         !                                 ! 3D output arrays
+         DO jl = 1, jp_lobster_3d
+            WRITE(lobdia3d(jl)%sname,'("3D_",I1)') jl                      ! short name
+            WRITE(lobdia3d(jl)%lname,'("3D DIAGNOSTIC NUMBER ",I2)') jl    ! long name
+            lobdia3d(jl)%units = ' '                                        ! units
+         END DO
+
+         REWIND( numnatl )               ! read natrtd
+         READ  ( numnatl, namlobdia )
+
+         DO jl = 1, jp_lobster_2d
+            jn = jp_lob0_2d + jl - 1
+            ctrc2d(jn) = lobdia2d(jl)%sname
+            ctrc2l(jn) = lobdia2d(jl)%lname
+            ctrc2u(jn) = lobdia2d(jl)%units
+         END DO
+
          DO jl = 1, jp_lobster_3d
             jn = jp_lob0_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))
+            ctrc3d(jn) = lobdia3d(jl)%sname
+            ctrc3l(jn) = lobdia3d(jl)%lname
+            ctrc3u(jn) = lobdia3d(jl)%units
+         END DO
+
+         IF(lwp) THEN                   ! control print
+            WRITE(numout,*)
+            WRITE(numout,*) ' Namelist : natadd'
+            DO jl = 1, jp_lobster_3d
+               jn = jp_lob0_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_lobster_2d
-            jn = jp_lob0_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))
+
+            DO jl = 1, jp_lobster_2d
+               jn = jp_lob0_2d + jl - 1
+               WRITE(numout,*) '  2d diag nb : ', jn, '    short name : ', ctrc2d(jn), &
+                 &             '  long name  : ', ctrc2l(jn), '   unit : ', ctrc2u(jn)
+            END DO
             WRITE(numout,*) ' '
-         END DO
-      ENDIF
-#endif
-
-#if defined key_diabio || defined key_trdmld_trc
-      ! namlobdbi : bio diagnostics
-      nwritebio = 10                     ! default values
-
-      DO js = 1, jp_lobster_trd
-         jd = jp_lob0_trd + js - 1
-         IF(     jd <  10 ) THEN   ;   WRITE (ctrbio(jd),'("BIO_",I1)') jd      ! short name
-         ELSEIF (jd < 100 ) THEN   ;   WRITE (ctrbio(jd),'("BIO_",I2)') jd   
-         ELSE                      ;   WRITE (ctrbio(jd),'("BIO_",I3)') jd
          ENDIF
-         WRITE(ctrbil(jd),'("BIOLOGICAL TREND NUMBER ",I2)') jd                 ! long name
-         ctrbiu(jd) = 'mmoleN/m3/s '                                            ! units
-      END DO
-
-      REWIND( numnatl )
-      READ  ( numnatl, namlobdbi ) 
+         !
+      ENDIF
+
+      IF( ( .NOT.lk_iomput .AND. ln_diabio ) .OR. lk_trdmld_trc ) THEN
+         !
+         ! Namelist namlobdbi
+         ! -------------------
+         DO jl = 1, jp_lobster_trd
+            IF(     jl <  10 ) THEN   ;   WRITE (lobdiabio(jl)%sname,'("BIO_",I1)') jl      ! short name
+            ELSEIF (jl < 100 ) THEN   ;   WRITE (lobdiabio(jl)%sname,'("BIO_",I2)') jl  
+            ELSE                      ;   WRITE (lobdiabio(jl)%sname,'("BIO_",I3)') jl
+            ENDIF
+            WRITE(lobdiabio(jl)%lname,'("BIOLOGICAL TREND NUMBER ",I2)') jl                 ! long name
+            lobdiabio(jl)%units = 'mmoleN/m3/s '                                            ! units
+         END DO
+
+         REWIND( numnatl )
+         READ  ( numnatl, namlobdbi ) 
  
-      DO js = 1, jp_lobster_trd
-         jd = jp_lob0_trd + js - 1
-         ctrbio(jd) = lobdiabio(js)%snamebio
-         ctrbil(jd) = lobdiabio(js)%lnamebio
-         ctrbiu(jd) = lobdiabio(js)%unitbio
-      END DO
-
-      IF(lwp) THEN                   ! control print
-         WRITE(numout,*)
-         WRITE(numout,*) ' Namelist : namlobdbi'
-         WRITE(numout,*) '    frequency of outputs for biological trends nwritebio = ', nwritebio
-         DO js = 1, jp_lobster_trd
-            jd = jp_lob0_trd + js - 1
-            WRITE(numout,*) '   biological trend No : ',jd
-            WRITE(numout,*) '   short name         : ', TRIM(ctrbio(jd))
-            WRITE(numout,*) '   long name          : ', TRIM(ctrbil(jd))
-            WRITE(numout,*) '   unit               : ', TRIM(ctrbiu(jd))
+         DO jl = 1, jp_lobster_trd
+            jn = jp_lob0_trd + jl - 1
+            ctrbio(jl) = lobdiabio(jl)%sname
+            ctrbil(jl) = lobdiabio(jl)%lname
+            ctrbiu(jl) = lobdiabio(jl)%units
+         END DO
+
+         IF(lwp) THEN                   ! control print
+            WRITE(numout,*)
+            WRITE(numout,*) ' Namelist : namlobdbi'
+            DO jl = 1, jp_lobster_trd
+               jn = jp_lob0_trd + jl - 1
+               WRITE(numout,*) '  biological trend No : ', jn, '    short name : ', ctrbio(jn), &
+                 &             '  long name  : ', ctrbio(jn), '   unit : ', ctrbio(jn)
+            END DO
             WRITE(numout,*) ' '
-         END DO
+         END IF
+         !
       END IF
-#endif
       !
    END SUBROUTINE trc_nam_lobster
Index: /branches/2011/dev_r2787_LOCEAN3_TRA_TRP/NEMOGCM/NEMO/TOP_SRC/LOBSTER/trcsed.F90
===================================================================
--- /branches/2011/dev_r2787_LOCEAN3_TRA_TRP/NEMOGCM/NEMO/TOP_SRC/LOBSTER/trcsed.F90	(revision 2818)
+++ /branches/2011/dev_r2787_LOCEAN3_TRA_TRP/NEMOGCM/NEMO/TOP_SRC/LOBSTER/trcsed.F90	(revision 2819)
@@ -57,20 +57,13 @@
       !!---------------------------------------------------------------------
       USE wrk_nemo, ONLY: wrk_in_use, wrk_not_released
-      USE wrk_nemo, ONLY: zwork => wrk_3d_2
-      USE wrk_nemo, ONLY: zw2d  => wrk_2d_1 ! only used (if defined 
-                                            ! key_diatrc && defined key_iomput)
+      USE wrk_nemo, ONLY: zw2d  => wrk_2d_1, zwork => wrk_3d_2
       !!
       INTEGER, INTENT( in ) ::   kt      ! ocean time-step index      
       !!
-      INTEGER  ::   ji, jj, jk, jl
-      REAL(wp) ::   ztra
-      REAL(wp), DIMENSION(:,:,:), ALLOCATABLE ::   ztrbio
+      INTEGER  ::   ji, jj, jk, jl, ierr
+      REAL(wp) ::   ztra, ze3t
+      REAL(wp), DIMENSION(:,:,:), ALLOCATABLE ::  ztrbio
       CHARACTER (len=25) :: charout
       !!---------------------------------------------------------------------
-
-      IF( ( wrk_in_use(3,2)) .OR. ( wrk_in_use(2,1)) ) THEN
-         CALL ctl_stop('trc_sed : requested workspace arrays unavailable.')
-         RETURN
-      END IF
 
       IF( kt == nit000 ) THEN
@@ -80,4 +73,18 @@
       ENDIF
 
+      IF( wrk_in_use(2, 1) .OR. wrk_in_use(3, 2) ) THEN
+         CALL ctl_stop('trc_sed : requested workspace arrays unavailable.')  ;  RETURN
+      END IF
+
+      IF( l_trdtrc )  THEN
+         ALLOCATE( ztrbio(jpi,jpj,jpk) , STAT = ierr )   ! temporary save of trends
+         IF( ierr > 0 ) THEN
+            CALL ctl_stop( 'trc_sed: unable to allocate ztrbio array' )   ;   RETURN
+         ENDIF
+         ztrbio(:,:,:) = tra(:,:,:,jp_lob_det)
+      ENDIF
+
+      IF( ln_diatrc .AND. lk_iomput )  zw2d(:,:) = 0.
+
       ! sedimentation of detritus  : upstream scheme
       ! --------------------------------------------
@@ -86,13 +93,4 @@
       zwork(:,:,1  ) = 0.e0      ! surface value set to zero
       zwork(:,:,jpk) = 0.e0      ! bottom value  set to zero
-
-#if defined key_diatrc && defined key_iomput
-      zw2d(:,:) = 0.
-# endif
-
-      IF( l_trdtrc )THEN
-         ALLOCATE( ztrbio(jpi,jpj,jpk) )
-         ztrbio(:,:,:) = tra(:,:,:,jp_lob_det)
-      ENDIF
 
       ! tracer flux at w-point: we use -vsed (downward flux)  with simplification : no e1*e2
@@ -104,35 +102,21 @@
       DO jk = 1, jpkm1
          DO jj = 1, jpj
-            DO ji = 1,jpi
+            DO ji = 1, jpi
                ztra  = - ( zwork(ji,jj,jk) - zwork(ji,jj,jk+1) ) / fse3t(ji,jj,jk)
                tra(ji,jj,jk,jp_lob_det) = tra(ji,jj,jk,jp_lob_det) + ztra
-#if defined key_diabio
-               trbio(ji,jj,jk,jp_lob0_trd + 7) = ztra
-#endif
-#if defined key_diatrc
-# if ! defined key_iomput
-               trc2d(ji,jj,jp_lob0_2d + 7) = trc2d(ji,jj,jp_lob0_2d + 7) + ztra * fse3t(ji,jj,jk) * 86400.
-# else
-               zw2d(ji,jj) = zw2d(ji,jj) + ztra * fse3t(ji,jj,jk) * 86400.
-# endif
-#endif
+               !
+               IF( ln_diabio )  trbio(ji,jj,jk,jp_lob0_trd + 7) = ztra
+               IF( ln_diatrc ) THEN
+                  ze3t = ztra * fse3t(ji,jj,jk) * 86400.
+                  IF( lk_iomput ) THEN   ;  zw2d(ji,jj) = zw2d(ji,jj) + ze3t 
+                  ELSE                   ;  trc2d(ji,jj,jp_lob0_2d + 7) = trc2d(ji,jj,jp_lob0_2d + 7) + ze3t
+                  ENDIF
+               ENDIF
+               !
             END DO
          END DO
       END DO
 
-#if defined key_diabio
-      jl = jp_lob0_trd + 7
-      CALL lbc_lnk (trbio(:,:,1,jl), 'T', 1. )    ! Lateral boundary conditions on trcbio
-#endif
-#if defined key_diatrc
-# if ! defined key_iomput
-      jl = jp_lob0_2d + 7
-      CALL lbc_lnk( trc2d(:,:,jl), 'T', 1. )      ! Lateral boundary conditions on trc2d
-# else
-      CALL lbc_lnk( zw2d(:,:), 'T', 1. )      ! Lateral boundary conditions on zw2d
-      CALL iom_put( "TDETSED", zw2d )
-# endif
-#endif
-      !
+      IF( ln_diatrc .AND. lk_iomput )  CALL iom_put( "TDETSED", zw2d )
 
       IF( l_trdtrc ) THEN
@@ -140,7 +124,6 @@
          jl = jp_lob0_trd + 7
          CALL trd_mod_trc( ztrbio, jl, kt )   ! handle the trend
+         DEALLOCATE( ztrbio ) 
       ENDIF
-
-      IF( l_trdtrc ) DEALLOCATE( ztrbio )
 
       IF(ln_ctl)   THEN  ! print mean trends (used for debugging)
@@ -150,5 +133,5 @@
       ENDIF
 
-      IF( ( wrk_not_released(3, 2) ) .OR. ( wrk_not_released(2, 1) ) )  &
+      IF( ( wrk_not_released(2, 1) ) .OR. ( wrk_not_released(3, 2) ) )  &
        &         CALL ctl_stop('trc_sed : failed to release workspace arrays.')
 
Index: /branches/2011/dev_r2787_LOCEAN3_TRA_TRP/NEMOGCM/NEMO/TOP_SRC/LOBSTER/trcsms_lobster.F90
===================================================================
--- /branches/2011/dev_r2787_LOCEAN3_TRA_TRP/NEMOGCM/NEMO/TOP_SRC/LOBSTER/trcsms_lobster.F90	(revision 2818)
+++ /branches/2011/dev_r2787_LOCEAN3_TRA_TRP/NEMOGCM/NEMO/TOP_SRC/LOBSTER/trcsms_lobster.F90	(revision 2819)
@@ -45,14 +45,9 @@
       !! ** Method  : - ???
       !! --------------------------------------------------------------------
-      USE wrk_nemo, ONLY: wrk_in_use, wrk_not_released
-      USE wrk_nemo, ONLY: ztrlob => wrk_3d_1   ! used for lobster sms trends
       !!
       INTEGER, INTENT( in ) ::   kt      ! ocean time-step index      
+      !
       INTEGER :: jn
       !! --------------------------------------------------------------------
-
-      IF( wrk_in_use(3, 1) ) THEN
-         CALL ctl_stop('trc_sms_lobster : requested workspace array unavailable')   ;   RETURN
-      ENDIF
 
       CALL trc_opt( kt )      ! optical model
@@ -62,13 +57,10 @@
 
       IF( l_trdtrc ) THEN
-          DO jn = jp_lob0, jp_lob1
-            ztrlob(:,:,:) = tra(:,:,:,jn)
-            CALL trd_mod_trc( ztrlob, jn, jptra_trd_sms, kt )   ! save trends
-          END DO
+         DO jn = jp_lob0, jp_lob1
+           CALL trd_mod_trc( tra(:,:,:,jn), jn, jptra_trd_sms, kt )   ! save trends
+         END DO
       END IF
 
       IF( lk_trdmld_trc )  CALL trd_mld_bio( kt )   ! trends: Mixed-layer
-
-      IF( wrk_not_released(3, 1) )   CALL ctl_stop('trc_sms_lobster : failed to release workspace array.')
       !
    END SUBROUTINE trc_sms_lobster
Index: /branches/2011/dev_r2787_LOCEAN3_TRA_TRP/NEMOGCM/NEMO/TOP_SRC/PISCES/p4zbio.F90
===================================================================
--- /branches/2011/dev_r2787_LOCEAN3_TRA_TRP/NEMOGCM/NEMO/TOP_SRC/PISCES/p4zbio.F90	(revision 2818)
+++ /branches/2011/dev_r2787_LOCEAN3_TRA_TRP/NEMOGCM/NEMO/TOP_SRC/PISCES/p4zbio.F90	(revision 2819)
@@ -14,17 +14,17 @@
    !!                      compartments of PISCES
    !!----------------------------------------------------------------------
-   USE oce_trc         !
-   USE trc         ! 
-   USE sms_pisces      ! 
-   USE p4zsink         ! 
-   USE p4zopt          ! 
-   USE p4zlim          ! 
-   USE p4zprod         !
-   USE p4zmort         !
-   USE p4zmicro        ! 
-   USE p4zmeso         ! 
-   USE p4zrem          ! 
-   USE prtctl_trc
-   USE iom
+   USE oce_trc         !  shared variables between ocean and passive tracers
+   USE trc             !  passive tracers common variables 
+   USE sms_pisces      !  PISCES Source Minus Sink variables
+   USE p4zsink         !  vertical flux of particulate matter due to sinking
+   USE p4zopt          !  optical model
+   USE p4zlim          !  Co-limitations of differents nutrients
+   USE p4zprod         !  Growth rate of the 2 phyto groups
+   USE p4zmort         !  Mortality terms for phytoplankton
+   USE p4zmicro        !  Sources and sinks of microzooplankton
+   USE p4zmeso         !  Sources and sinks of mesozooplankton
+   USE p4zrem          !  Remineralisation of organic matter
+   USE prtctl_trc      !  print control for debugging
+   USE iom             !  I/O manager
   
    IMPLICIT NONE
Index: /branches/2011/dev_r2787_LOCEAN3_TRA_TRP/NEMOGCM/NEMO/TOP_SRC/PISCES/p4zche.F90
===================================================================
--- /branches/2011/dev_r2787_LOCEAN3_TRA_TRP/NEMOGCM/NEMO/TOP_SRC/PISCES/p4zche.F90	(revision 2818)
+++ /branches/2011/dev_r2787_LOCEAN3_TRA_TRP/NEMOGCM/NEMO/TOP_SRC/PISCES/p4zche.F90	(revision 2819)
@@ -17,8 +17,8 @@
    !!   p4z_che      :  Sea water chemistry computed following OCMIP protocol
    !!----------------------------------------------------------------------
-   USE oce_trc       !
-   USE trc           !
-   USE sms_pisces    ! 
-   USE lib_mpp       ! MPP library
+   USE oce_trc       !  shared variables between ocean and passive tracers
+   USE trc           !  passive tracers common variables
+   USE sms_pisces    !  PISCES Source Minus Sink variables
+   USE lib_mpp       !  MPP library
 
    IMPLICIT NONE
Index: /branches/2011/dev_r2787_LOCEAN3_TRA_TRP/NEMOGCM/NEMO/TOP_SRC/PISCES/p4zflx.F90
===================================================================
--- /branches/2011/dev_r2787_LOCEAN3_TRA_TRP/NEMOGCM/NEMO/TOP_SRC/PISCES/p4zflx.F90	(revision 2818)
+++ /branches/2011/dev_r2787_LOCEAN3_TRA_TRP/NEMOGCM/NEMO/TOP_SRC/PISCES/p4zflx.F90	(revision 2819)
@@ -17,13 +17,12 @@
    !!   p4z_flx_init  :   Read the namelist
    !!----------------------------------------------------------------------
-   USE trc
-   USE oce_trc         !
-   USE trc
-   USE sms_pisces
-   USE prtctl_trc
-   USE p4zche
-   USE iom
+   USE oce_trc                      !  shared variables between ocean and passive tracers 
+   USE trc                          !  passive tracers common variables
+   USE sms_pisces                   !  PISCES Source Minus Sink variables
+   USE p4zche                       !  Chemical model
+   USE prtctl_trc                   !  print control for debugging
+   USE iom                          !  I/O manager
 #if defined key_cpl_carbon_cycle
-   USE sbc_oce , ONLY :  atm_co2
+   USE sbc_oce, ONLY :  atm_co2     !  atmospheric pCO2               
 #endif
 
@@ -137,8 +136,7 @@
             ! Compute the piston velocity for O2 and CO2
             zkgwan = 0.3 * zws  + 2.5 * ( 0.5246 + 0.016256 * ztc + 0.00049946  * ztc2 )
+            zkgwan = zkgwan * xconv * ( 1.- fr_i(ji,jj) ) * tmask(ji,jj,1)
 # if defined key_degrad
-            zkgwan = zkgwan * xconv * ( 1.- fr_i(ji,jj) ) * tmask(ji,jj,1) * facvol(ji,jj,1)
-#else
-            zkgwan = zkgwan * xconv * ( 1.- fr_i(ji,jj) ) * tmask(ji,jj,1)
+            zkgwan = zkgwan * facvol(ji,jj,1)
 #endif 
             ! compute gas exchange for CO2 and O2
@@ -161,30 +159,25 @@
             zflu16 = trn(ji,jj,1,jpoxy) * tmask(ji,jj,1) * zkgo2(ji,jj)
             tra(ji,jj,1,jpoxy) = tra(ji,jj,1,jpoxy) + ( zfld16 - zflu16 ) / fse3t(ji,jj,1)
-
-#if defined key_diatrc 
-            ! Save diagnostics
-#  if ! defined key_iomput
+#if defined key_iomput
+            zoflx(ji,jj) = ( zfld16 - zflu16 ) * 1000. * tmask(ji,jj,1)
+            zkg  (ji,jj) = zkgco2(ji,jj) * tmask(ji,jj,1)
+            zdpco2(ji,jj) = ( satmco2(ji,jj) - zh2co3(ji,jj) / ( chemc(ji,jj,1) + rtrn ) ) * tmask(ji,jj,1)
+            zdpo2 (ji,jj) = ( atcox  - trn(ji,jj,1,jpoxy)    / ( chemc(ji,jj,2) + rtrn ) ) * tmask(ji,jj,1)
+# else
             zfact = 1. / e1e2t(ji,jj) / rfact
             trc2d(ji,jj,jp_pcs0_2d    ) = oce_co2(ji,jj) * zfact
             trc2d(ji,jj,jp_pcs0_2d + 1) = ( zfld16 - zflu16 ) * 1000. * tmask(ji,jj,1)
             trc2d(ji,jj,jp_pcs0_2d + 2) = zkgco2(ji,jj) * tmask(ji,jj,1)
-            trc2d(ji,jj,jp_pcs0_2d + 3) = ( satmco2(ji,jj) - zh2co3(ji,jj) / ( chemc(ji,jj,1) + rtrn ) ) &
-               &                            * tmask(ji,jj,1)
-#  else
-            zoflx(ji,jj) = ( zfld16 - zflu16 ) * 1000. * tmask(ji,jj,1)
-            zkg  (ji,jj) = zkgco2(ji,jj) * tmask(ji,jj,1)
-            zdpco2(ji,jj) = ( satmco2(ji,jj) - zh2co3(ji,jj) / ( chemc(ji,jj,1) + rtrn ) ) * tmask(ji,jj,1)
-            zdpo2 (ji,jj) = ( atcox  - trn(ji,jj,1,jpoxy) / ( chemc(ji,jj,2) + rtrn ) ) * tmask(ji,jj,1)
-#  endif
-#endif
+            trc2d(ji,jj,jp_pcs0_2d + 3) = ( satmco2(ji,jj) - zh2co3(ji,jj) / ( chemc(ji,jj,1) + rtrn ) ) * tmask(ji,jj,1)
+# endif
          END DO
       END DO
 
-      t_oce_co2_flx = t_oce_co2_flx + glob_sum( oce_co2(:,:) )                     ! Cumulative Total Flux of Carbon
+      t_oce_co2_flx = t_oce_co2_flx + glob_sum( oce_co2(:,:) )            ! Cumulative Total Flux of Carbon
       IF( kt == nitend ) THEN
          t_atm_co2_flx = glob_sum( satmco2(:,:) * e1e2t(:,:) )            ! Total atmospheric pCO2
          !
-         t_oce_co2_flx = (-1.) * t_oce_co2_flx  * 12. / 1.e15                      ! Conversion in PgC ; negative for out of the ocean
-         t_atm_co2_flx = t_atm_co2_flx  / area                                     ! global mean of atmospheric pCO2
+         t_oce_co2_flx = (-1.) * t_oce_co2_flx  * 12. / 1.e15             ! Conversion in PgC ; negative for out of the ocean
+         t_atm_co2_flx = t_atm_co2_flx  / area                            ! global mean of atmospheric pCO2
          !
          IF( lwp) THEN
@@ -205,11 +198,11 @@
       ENDIF
 
-# if defined key_diatrc && defined key_iomput
-      CALL iom_put( "Cflx" , oce_co2(:,:) / e1e2t(:,:) / rfact ) 
-      CALL iom_put( "Oflx" , zoflx  )
-      CALL iom_put( "Kg"   , zkg    )
-      CALL iom_put( "Dpco2", zdpco2 )
-      CALL iom_put( "Dpo2" , zdpo2  )
-#endif
+      IF( ln_diatrc ) THEN
+         CALL iom_put( "Cflx" , oce_co2(:,:) / e1e2t(:,:) / rfact ) 
+         CALL iom_put( "Oflx" , zoflx  )
+         CALL iom_put( "Kg"   , zkg    )
+         CALL iom_put( "Dpco2", zdpco2 )
+         CALL iom_put( "Dpo2" , zdpo2  )
+      ENDIF
       !
       IF( wrk_not_released(2, 1,2,3,4,5,6,7) )   CALL ctl_stop('p4z_flx: failed to release workspace arrays')
@@ -231,6 +224,6 @@
       !!----------------------------------------------------------------------
       !
-      REWIND( numnat )                     ! read numnat
-      READ  ( numnat, nampisext )
+      REWIND( numnatp )                     ! read numnatp
+      READ  ( numnatp, nampisext )
       !
       IF(lwp) THEN                         ! control print
Index: /branches/2011/dev_r2787_LOCEAN3_TRA_TRP/NEMOGCM/NEMO/TOP_SRC/PISCES/p4zint.F90
===================================================================
--- /branches/2011/dev_r2787_LOCEAN3_TRA_TRP/NEMOGCM/NEMO/TOP_SRC/PISCES/p4zint.F90	(revision 2818)
+++ /branches/2011/dev_r2787_LOCEAN3_TRA_TRP/NEMOGCM/NEMO/TOP_SRC/PISCES/p4zint.F90	(revision 2819)
@@ -13,7 +13,7 @@
    !!   p4z_int        :  interpolation and computation of various accessory fields
    !!----------------------------------------------------------------------
-   USE oce_trc         !
-   USE trc
-   USE sms_pisces
+   USE oce_trc         !  shared variables between ocean and passive tracers
+   USE trc             !  passive tracers common variables 
+   USE sms_pisces      !  PISCES Source Minus Sink variables
 
    IMPLICIT NONE
@@ -21,9 +21,4 @@
 
    PUBLIC   p4z_int  
-   PUBLIC   p4z_int_alloc
-
-   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::   tgfunc    !: Temp. dependancy of various biological rates
-   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::   tgfunc2   !: Temp. dependancy of mesozooplankton rates
-
    REAL(wp) ::   xksilim = 16.5e-6_wp   ! Half-saturation constant for the Si half-saturation constant computation
 
@@ -41,8 +36,7 @@
       !! ** Purpose :   interpolation and computation of various accessory fields
       !!
-      !! ** Method  : - ???
       !!---------------------------------------------------------------------
-      INTEGER  ::   ji, jj
-      REAL(wp) ::   zdum
+      INTEGER  ::   ji, jj                 ! dummy loop indices
+      REAL(wp) ::   zvar                   ! local variable
       !!---------------------------------------------------------------------
 
@@ -57,6 +51,6 @@
       DO ji = 1, jpi
          DO jj = 1, jpj
-            zdum = trn(ji,jj,1,jpsil) * trn(ji,jj,1,jpsil)
-            xksimax(ji,jj) = MAX( xksimax(ji,jj), ( 1.+ 7.* zdum / ( xksilim * xksilim + zdum ) ) * 1e-6 )
+            zvar = trn(ji,jj,1,jpsil) * trn(ji,jj,1,jpsil)
+            xksimax(ji,jj) = MAX( xksimax(ji,jj), ( 1.+ 7.* zvar / ( xksilim * xksilim + zvar ) ) * 1e-6 )
          END DO
       END DO
@@ -68,15 +62,4 @@
       !
    END SUBROUTINE p4z_int
-
-
-   INTEGER FUNCTION p4z_int_alloc()
-      !!----------------------------------------------------------------------
-      !!                     ***  ROUTINE p4z_int_alloc  ***
-      !!----------------------------------------------------------------------
-      ALLOCATE( tgfunc(jpi,jpj,jpk), tgfunc2(jpi,jpj,jpk), STAT=p4z_int_alloc )
-      !
-      IF( p4z_int_alloc /= 0 )   CALL ctl_warn('p4z_int_alloc : failed to allocate arrays.')
-      !
-   END FUNCTION p4z_int_alloc
 
 #else
Index: /branches/2011/dev_r2787_LOCEAN3_TRA_TRP/NEMOGCM/NEMO/TOP_SRC/PISCES/p4zlim.F90
===================================================================
--- /branches/2011/dev_r2787_LOCEAN3_TRA_TRP/NEMOGCM/NEMO/TOP_SRC/PISCES/p4zlim.F90	(revision 2818)
+++ /branches/2011/dev_r2787_LOCEAN3_TRA_TRP/NEMOGCM/NEMO/TOP_SRC/PISCES/p4zlim.F90	(revision 2819)
@@ -14,8 +14,7 @@
    !!   p4z_lim_init   :   Read the namelist 
    !!----------------------------------------------------------------------
-   USE trc
-   USE oce_trc         !
-   USE trc         ! 
-   USE sms_pisces      ! 
+   USE oce_trc         !  shared variables between ocean and passive tracers
+   USE trc             !  passive tracers common variables 
+   USE sms_pisces      !  PISCES Source Minus Sink variables
 
    IMPLICIT NONE
@@ -184,6 +183,6 @@
          &             concnnh4, concdnh4, xksi1, xksi2, xkdoc, caco3r
 
-      REWIND( numnat )                     ! read numnat
-      READ  ( numnat, nampislim )
+      REWIND( numnatp )                     ! read numnat
+      READ  ( numnatp, nampislim )
 
       IF(lwp) THEN                         ! control print
Index: /branches/2011/dev_r2787_LOCEAN3_TRA_TRP/NEMOGCM/NEMO/TOP_SRC/PISCES/p4zlys.F90
===================================================================
--- /branches/2011/dev_r2787_LOCEAN3_TRA_TRP/NEMOGCM/NEMO/TOP_SRC/PISCES/p4zlys.F90	(revision 2818)
+++ /branches/2011/dev_r2787_LOCEAN3_TRA_TRP/NEMOGCM/NEMO/TOP_SRC/PISCES/p4zlys.F90	(revision 2819)
@@ -17,10 +17,9 @@
    !!   p4z_lys_init   :   Read the namelist parameters
    !!----------------------------------------------------------------------
-   USE trc
-   USE oce_trc         !
-   USE trc
-   USE sms_pisces
-   USE prtctl_trc
-   USE iom
+   USE oce_trc         !  shared variables between ocean and passive tracers
+   USE trc             !  passive tracers common variables 
+   USE sms_pisces      !  PISCES Source Minus Sink variables
+   USE prtctl_trc      !  print control for debugging
+   USE iom             !  I/O manager
 
    IMPLICIT NONE
@@ -62,10 +61,8 @@
       INTEGER, INTENT(in) ::   kt ! ocean time step
       INTEGER  ::   ji, jj, jk, jn
-      REAL(wp) ::   zbot, zalk, zdic, zph, zremco3, zah2
+      REAL(wp) ::   zbot, zalk, zdic, zph, zah2
       REAL(wp) ::   zdispot, zfact, zalka
       REAL(wp) ::   zomegaca, zexcess, zexcess0
-#if defined key_diatrc && defined key_iomput
       REAL(wp) ::   zrfact2
-#endif
       CHARACTER (len=25) :: charout
       !!---------------------------------------------------------------------
@@ -75,8 +72,6 @@
       END IF
 
-      zco3(:,:,:) = 0.
-# if defined key_diatrc && defined key_iomput
+      zco3    (:,:,:) = 0.
       zcaldiss(:,:,:) = 0.
-# endif
       !     -------------------------------------------
       !     COMPUTE [CO3--] and [H+] CONCENTRATIONS
@@ -91,23 +86,15 @@
 !CDIR NOVERRCHK
                DO ji = 1, jpi
-
                   ! SET DUMMY VARIABLE FOR TOTAL BORATE
-                  zbot  = borat(ji,jj,jk)
-
-                  ! SET DUMMY VARIABLE FOR TOTAL BORATE
-                  zbot  = borat(ji,jj,jk)
+                  zbot  = borat(ji,jj,jk)    
                   zfact = rhop (ji,jj,jk) / 1000. + rtrn
-
                   ! SET DUMMY VARIABLE FOR [H+]
                   zph   = hi(ji,jj,jk) * tmask(ji,jj,jk) / zfact + ( 1.-tmask(ji,jj,jk) ) * 1.e-9
-
                   ! SET DUMMY VARIABLE FOR [SUM(CO2)]GIVEN 
                   zdic  = trn(ji,jj,jk,jpdic) / zfact
                   zalka = trn(ji,jj,jk,jptal) / zfact
-
                   ! CALCULATE [ALK]([CO3--], [HCO3-])
                   zalk  = zalka - (  akw3(ji,jj,jk) / zph - zph   &
                      &             + zbot / (1.+ zph / akb3(ji,jj,jk) )  )
-
                   ! CALCULATE [H+] and [CO3--]
                   zah2 = SQRT( (zdic-zalk)*(zdic-zalk)+   &
@@ -146,38 +133,32 @@
                !       (ACCORDING TO THIS FORMULATION ALSO SOME PARTICULATE
                !       CACO3 GETS DISSOLVED EVEN IN THE CASE OF OVERSATURATION)
+               zdispot = kdca * zexcess * trn(ji,jj,jk,jpcal)
 # if defined key_degrad
-              zdispot = kdca * zexcess * trn(ji,jj,jk,jpcal) * facvol(ji,jj,jk)
-# else
-              zdispot = kdca * zexcess * trn(ji,jj,jk,jpcal)
+               zdispot = zdispot * facvol(ji,jj,jk)
 # endif
-
               !  CHANGE OF [CO3--] , [ALK], PARTICULATE [CACO3],
               !       AND [SUM(CO2)] DUE TO CACO3 DISSOLUTION/PRECIPITATION
-              zremco3 = zdispot / rmtss
-              zco3(ji,jj,jk) = zco3(ji,jj,jk) + zremco3 * rfact
-              tra(ji,jj,jk,jptal) = tra(ji,jj,jk,jptal) + 2. * zremco3
-              tra(ji,jj,jk,jpcal) = tra(ji,jj,jk,jpcal) -      zremco3
-              tra(ji,jj,jk,jpdic) = tra(ji,jj,jk,jpdic) +      zremco3
-
-# if defined key_diatrc && defined key_iomput
-              zcaldiss(ji,jj,jk) = zremco3  ! calcite dissolution
-# endif
+              zcaldiss(ji,jj,jk)  = zdispot / rmtss  ! calcite dissolution
+              zco3(ji,jj,jk)      = zco3(ji,jj,jk) + zcaldiss(ji,jj,jk) * rfact
+              !
+              tra(ji,jj,jk,jptal) = tra(ji,jj,jk,jptal) + 2. * zcaldiss(ji,jj,jk)
+              tra(ji,jj,jk,jpcal) = tra(ji,jj,jk,jpcal) -      zcaldiss(ji,jj,jk)
+              tra(ji,jj,jk,jpdic) = tra(ji,jj,jk,jpdic) +      zcaldiss(ji,jj,jk)
             END DO
          END DO
       END DO
 
-# if defined key_diatrc
-#  if ! defined key_iomput
-      trc3d(:,:,:,jp_pcs0_3d    ) = hi  (:,:,:)          * tmask(:,:,:)
-      trc3d(:,:,:,jp_pcs0_3d + 1) = zco3(:,:,:)          * tmask(:,:,:)
-      trc3d(:,:,:,jp_pcs0_3d + 2) = aksp(:,:,:) / calcon * tmask(:,:,:)
-#  else
-      zrfact2 = 1.e3 * rfact2r
-      CALL iom_put( "PH"    , hi      (:,:,:)           * tmask(:,:,:) )
-      CALL iom_put( "CO3"   , zco3    (:,:,:)           * tmask(:,:,:) )
-      CALL iom_put( "CO3sat", aksp    (:,:,:) / calcon  * tmask(:,:,:) )
-      CALL iom_put( "DCAL"  , zcaldiss(:,:,:) * zrfact2 * tmask(:,:,:) )
-#  endif
+      IF( ln_diatrc )  THEN
+         zrfact2 = 1.e3 * rfact2r
+         CALL iom_put( "PH"    , hi      (:,:,:)           * tmask(:,:,:) )
+         CALL iom_put( "CO3"   , zco3    (:,:,:)           * tmask(:,:,:) )
+         CALL iom_put( "CO3sat", aksp    (:,:,:) / calcon  * tmask(:,:,:) )
+         CALL iom_put( "DCAL"  , zcaldiss(:,:,:) * zrfact2 * tmask(:,:,:) )
+# if ! defined key_iomput
+         trc3d(:,:,:,jp_pcs0_3d    ) = hi  (:,:,:)          * tmask(:,:,:)
+         trc3d(:,:,:,jp_pcs0_3d + 1) = zco3(:,:,:)          * tmask(:,:,:)
+         trc3d(:,:,:,jp_pcs0_3d + 2) = aksp(:,:,:) / calcon * tmask(:,:,:)
 # endif
+      ENDIF
       !
        IF(ln_ctl)   THEN  ! print mean trends (used for debugging)
@@ -207,6 +188,6 @@
       NAMELIST/nampiscal/ kdca, nca
 
-      REWIND( numnat )                     ! read numnat
-      READ  ( numnat, nampiscal )
+      REWIND( numnatp )                     ! read numnatp
+      READ  ( numnatp, nampiscal )
 
       IF(lwp) THEN                         ! control print
Index: /branches/2011/dev_r2787_LOCEAN3_TRA_TRP/NEMOGCM/NEMO/TOP_SRC/PISCES/p4zmeso.F90
===================================================================
--- /branches/2011/dev_r2787_LOCEAN3_TRA_TRP/NEMOGCM/NEMO/TOP_SRC/PISCES/p4zmeso.F90	(revision 2818)
+++ /branches/2011/dev_r2787_LOCEAN3_TRA_TRP/NEMOGCM/NEMO/TOP_SRC/PISCES/p4zmeso.F90	(revision 2819)
@@ -14,12 +14,11 @@
    !!   p4z_meso_init  :   Initialization of the parameters for mesozooplankton
    !!----------------------------------------------------------------------
-   USE trc
-   USE oce_trc         !
-   USE trc         ! 
-   USE sms_pisces      ! 
-   USE prtctl_trc
-   USE p4zint
-   USE p4zsink
-   USE iom
+   USE oce_trc         !  shared variables between ocean and passive tracers
+   USE trc             !  passive tracers common variables 
+   USE sms_pisces      !  PISCES Source Minus Sink variables
+   USE p4zsink         !  vertical flux of particulate matter due to sinking
+   USE prtctl_trc      !  print control for debugging
+   USE iom             !  I/O manager
+
 
    IMPLICIT NONE
@@ -75,7 +74,5 @@
       REAL(wp) :: zgrazfff,zgrazffe
       CHARACTER (len=25) :: charout
-#if defined key_diatrc && defined key_iomput
       REAL(wp) :: zrfact2
-#endif
 
       !!---------------------------------------------------------------------
@@ -84,12 +81,10 @@
          DO jj = 1, jpj
             DO ji = 1, jpi
-
                zcompam = MAX( ( trn(ji,jj,jk,jpmes) - 1.e-9 ), 0.e0 )
+               zstep   = xstep
 # if defined key_degrad
-               zstep   = xstep * facvol(ji,jj,jk)
-# else
-               zstep   = xstep
-# endif
-               zfact   = zstep * tgfunc(ji,jj,jk) * zcompam
+               zstep = zstep * facvol(ji,jj,jk)
+# endif
+               zfact = zstep * tgfunc(ji,jj,jk) * zcompam
 
                !  Respiration rates of both zooplankton
@@ -132,4 +127,7 @@
                zgrazffe = grazflux * zstep * wsbio4(ji,jj,jk)          &
                   &                 * tgfunc2(ji,jj,jk) * trn(ji,jj,jk,jpgoc) * trn(ji,jj,jk,jpmes)
+# if defined key_degrad
+               zgrazffe = zgrazffe  * facvol(ji,jj,jk)
+# endif
                zgrazfff = zgrazffe * trn(ji,jj,jk,jpbfe) / (trn(ji,jj,jk,jpgoc) + rtrn)
 # else
@@ -143,13 +141,14 @@
                !!--------------------------- KRIEST3 -------------------------------------------
 
-              zgrazffe = grazflux * zstep * wsbio3(ji,jj,jk)     &
+               zgrazffe = grazflux * zstep * wsbio3(ji,jj,jk)     &
                   &                * tgfunc2(ji,jj,jk) * trn(ji,jj,jk,jppoc) * trn(ji,jj,jk,jpmes)
-              zgrazfff = zgrazffe * trn(ji,jj,jk,jpsfe) / (trn(ji,jj,jk,jppoc) + rtrn)
+# if defined key_degrad
+               zgrazffe = zgrazffe  * facvol(ji,jj,jk)
+# endif
+               zgrazfff = zgrazffe * trn(ji,jj,jk,jpsfe) / (trn(ji,jj,jk,jppoc) + rtrn)
 # endif
       
-#if defined key_diatrc
-              ! Total grazing ( grazing by microzoo is already computed in p4zmicro ) 
+              ! Total grazing ( grazing by microzoo is already computed in p4zmicro )
               grazing(ji,jj,jk) = grazing(ji,jj,jk) + (  zgrazd + zgrazz + zgrazn + zgrazpoc + zgrazffe )
-#endif
 
               !    Mesozooplankton efficiency
@@ -200,7 +199,7 @@
 
                zprcaca = xfracal(ji,jj,jk) * unass2 * zgrazn
-#if defined key_diatrc
+               ! calcite production
                prodcal(ji,jj,jk) = prodcal(ji,jj,jk) + zprcaca  ! prodcal=prodcal(nanophy)+prodcal(microzoo)+prodcal(mesozoo)
-#endif
+               !
                zprcaca = part * zprcaca
                tra(ji,jj,jk,jpdic) = tra(ji,jj,jk,jpdic) - zprcaca
@@ -226,15 +225,13 @@
       END DO
       !
-#if defined key_diatrc && defined key_iomput
-      zrfact2 = 1.e3 * rfact2r
-      ! Total grazing of phyto by zoo
-      grazing(:,:,:) = grazing(:,:,:) * zrfact2 * tmask(:,:,:)
-      ! Calcite production
-      prodcal(:,:,:) = prodcal(:,:,:) * zrfact2 * tmask(:,:,:)
-      IF( jnt == nrdttrc ) then 
-         CALL iom_put( "GRAZ" , grazing  )  ! Total grazing of phyto by zooplankton
-         CALL iom_put( "PCAL" , prodcal  )  ! Calcite production
+      IF( ln_diatrc ) THEN
+         zrfact2 = 1.e3 * rfact2r
+         grazing(:,:,:) = grazing(:,:,:) * zrfact2 * tmask(:,:,:)   ! Total grazing of phyto by zoo
+         prodcal(:,:,:) = prodcal(:,:,:) * zrfact2 * tmask(:,:,:)   ! Calcite production
+         IF( jnt == nrdttrc ) THEN
+            CALL iom_put( "GRAZ" , grazing  )  ! Total grazing of phyto by zooplankton
+            CALL iom_put( "PCAL" , prodcal  )  ! Calcite production
+         ENDIF
       ENDIF
-#endif
 
        IF(ln_ctl)   THEN  ! print mean trends (used for debugging)
@@ -263,6 +260,6 @@
          &             xprefz, xprefpoc, xkgraz2, epsher2, sigma2, unass2, grazflux
 
-      REWIND( numnat )                     ! read numnat
-      READ  ( numnat, nampismes )
+      REWIND( numnatp )                     ! read numnatp
+      READ  ( numnatp, nampismes )
 
 
Index: /branches/2011/dev_r2787_LOCEAN3_TRA_TRP/NEMOGCM/NEMO/TOP_SRC/PISCES/p4zmicro.F90
===================================================================
--- /branches/2011/dev_r2787_LOCEAN3_TRA_TRP/NEMOGCM/NEMO/TOP_SRC/PISCES/p4zmicro.F90	(revision 2818)
+++ /branches/2011/dev_r2787_LOCEAN3_TRA_TRP/NEMOGCM/NEMO/TOP_SRC/PISCES/p4zmicro.F90	(revision 2819)
@@ -14,12 +14,9 @@
    !!   p4z_micro_init  :   Initialize and read the appropriate namelist
    !!----------------------------------------------------------------------
-   USE trc
-   USE oce_trc         !
-   USE trc         ! 
-   USE sms_pisces      ! 
-   USE prtctl_trc
-   USE p4zint
-   USE p4zsink
-   USE iom
+   USE oce_trc         !  shared variables between ocean and passive tracers
+   USE trc             !  passive tracers common variables 
+   USE sms_pisces      !  PISCES Source Minus Sink variables
+   USE p4zsink         !  vertical flux of particulate matter due to sinking
+   USE prtctl_trc      !  print control for debugging
 
    IMPLICIT NONE
@@ -28,4 +25,5 @@
    PUBLIC   p4z_micro         ! called in p4zbio.F90
    PUBLIC   p4z_micro_init    ! called in trcsms_pisces.F90
+   PUBLIC   p4z_micro_alloc    ! called in trcsms_pisces.F90
 
    !! * Shared module variables
@@ -74,9 +72,5 @@
       !!---------------------------------------------------------------------
 
-
-#if defined key_diatrc
-      grazing(:,:,:) = 0.  !: Initialisation of  grazing
-#endif
-
+      grazing(:,:,:) = 0.  !: grazing set to zero
       zstep = rfact2 / rday      ! Time step duration for biology
 
@@ -85,8 +79,7 @@
             DO ji = 1, jpi
                zcompaz = MAX( ( trn(ji,jj,jk,jpzoo) - 1.e-9 ), 0.e0 )
+               zstep   = xstep
 # if defined key_degrad
-               zstep   = xstep * facvol(ji,jj,jk)
-# else
-               zstep   = xstep
+               zstep = zstep * facvol(ji,jj,jk)
 # endif
                zfact   = zstep * tgfunc(ji,jj,jk) * zcompaz
@@ -126,8 +119,7 @@
                zgrazmf = zgrazm  * trn(ji,jj,jk,jpsfe) / (trn(ji,jj,jk,jppoc) + rtrn)
                zgrazsf = zgrazsd * trn(ji,jj,jk,jpdfe) / (trn(ji,jj,jk,jpdia) + rtrn)
-#if defined key_diatrc
+
                ! Grazing by microzooplankton
-               grazing(ji,jj,jk) = grazing(ji,jj,jk) + zgrazp + zgrazm + zgrazsd 
-#endif
+               grazing(ji,jj,jk) = grazing(ji,jj,jk) + zgrazp + zgrazm + zgrazsd
 
                !    Various remineralization and excretion terms
@@ -172,7 +164,7 @@
                tra(ji,jj,jk,jpsfe) = tra(ji,jj,jk,jpsfe) + ferat3 * zmortz + unass * ( zgrazpf + zgrazsf ) - (1.-unass) * zgrazmf
                zprcaca = xfracal(ji,jj,jk) * unass * zgrazp
-#if defined key_diatrc
+               !
                prodcal(ji,jj,jk) = prodcal(ji,jj,jk) + zprcaca  ! prodcal=prodcal(nanophy)+prodcal(microzoo)+prodcal(mesozoo)
-#endif
+               !
                zprcaca = part * zprcaca
                tra(ji,jj,jk,jpdic) = tra(ji,jj,jk,jpdic) - zprcaca
@@ -212,6 +204,6 @@
          &             xpref2d, xkgraz, epsher, sigma1, unass
 
-      REWIND( numnat )                     ! read numnat
-      READ  ( numnat, nampiszoo )
+      REWIND( numnatp )                     ! read numnatp
+      READ  ( numnatp, nampiszoo )
 
       IF(lwp) THEN                         ! control print
@@ -233,4 +225,13 @@
    END SUBROUTINE p4z_micro_init
 
+   INTEGER FUNCTION p4z_micro_alloc()
+      !!----------------------------------------------------------------------
+      !!                     ***  ROUTINE p4z_micro_alloc  ***
+      !!----------------------------------------------------------------------
+      ALLOCATE( grazing(jpi,jpj,jpk), STAT=p4z_micro_alloc )
+      IF( p4z_micro_alloc /= 0 ) CALL ctl_warn('p4z_micro_alloc : failed to allocate arrays.')
+
+   END FUNCTION p4z_micro_alloc
+
 #else
    !!======================================================================
Index: /branches/2011/dev_r2787_LOCEAN3_TRA_TRP/NEMOGCM/NEMO/TOP_SRC/PISCES/p4zmort.F90
===================================================================
--- /branches/2011/dev_r2787_LOCEAN3_TRA_TRP/NEMOGCM/NEMO/TOP_SRC/PISCES/p4zmort.F90	(revision 2818)
+++ /branches/2011/dev_r2787_LOCEAN3_TRA_TRP/NEMOGCM/NEMO/TOP_SRC/PISCES/p4zmort.F90	(revision 2819)
@@ -14,10 +14,9 @@
    !!   p4z_mort_init  :   Initialize the mortality params for phytoplankton
    !!----------------------------------------------------------------------
-   USE trc
-   USE oce_trc         !
-   USE trc         ! 
-   USE sms_pisces      ! 
-   USE p4zsink
-   USE prtctl_trc
+   USE oce_trc         !  shared variables between ocean and passive tracers
+   USE trc             !  passive tracers common variables 
+   USE sms_pisces      !  PISCES Source Minus Sink variables
+   USE p4zsink         !  vertical flux of particulate matter due to sinking
+   USE prtctl_trc      !  print control for debugging
 
    IMPLICIT NONE
@@ -26,5 +25,5 @@
    PUBLIC   p4z_mort    
    PUBLIC   p4z_mort_init    
-
+   PUBLIC   p4z_mort_alloc    
 
    !! * Shared module variables
@@ -81,19 +80,12 @@
       !!---------------------------------------------------------------------
 
-
-#if defined key_diatrc
-     prodcal(:,:,:) = 0.  !: Initialisation of calcite production variable
-#endif
-
+      prodcal(:,:,:) = 0.  !: calcite production variable set to zero
       DO jk = 1, jpkm1
          DO jj = 1, jpj
             DO ji = 1, jpi
-
                zcompaph = MAX( ( trn(ji,jj,jk,jpphy) - 1e-8 ), 0.e0 )
-
+               zstep   = xstep
 # if defined key_degrad
-               zstep =  xstep * facvol(ji,jj,jk)  
-# else
-               zstep =  xstep  
+               zstep = zstep * facvol(ji,jj,jk)
 # endif
                !     Squared mortality of Phyto similar to a sedimentation term during
@@ -117,7 +109,8 @@
                tra(ji,jj,jk,jpnfe) = tra(ji,jj,jk,jpnfe) - zmortp * zfactfe
                zprcaca = xfracal(ji,jj,jk) * zmortp
-#if defined key_diatrc
+
+               ! calcite production
                prodcal(ji,jj,jk) = prodcal(ji,jj,jk) + zprcaca  ! prodcal=prodcal(nanophy)+prodcal(microzoo)+prodcal(mesozoo)
-#endif
+               !
                zfracal = 0.5 * xfracal(ji,jj,jk)
                tra(ji,jj,jk,jpdic) = tra(ji,jj,jk,jpdic) - zprcaca
@@ -177,9 +170,7 @@
                !    sticky and coagulate to sink quickly out of the euphotic zone
                !     ------------------------------------------------------------
-
+               zstep   = xstep
 # if defined key_degrad
-               zstep =  xstep * facvol(ji,jj,jk)  
-# else
-               zstep =  xstep  
+               zstep = zstep * facvol(ji,jj,jk)
 # endif
                !  Phytoplankton respiration 
@@ -243,6 +234,6 @@
       NAMELIST/nampismort/ wchl, wchld, mprat, mprat2, mpratm
 
-      REWIND( numnat )                     ! read numnat
-      READ  ( numnat, nampismort )
+      REWIND( numnatp )                     ! read numnatp
+      READ  ( numnatp, nampismort )
 
       IF(lwp) THEN                         ! control print
@@ -259,4 +250,13 @@
    END SUBROUTINE p4z_mort_init
 
+   INTEGER FUNCTION p4z_mort_alloc()
+      !!----------------------------------------------------------------------
+      !!                     ***  ROUTINE p4z_mort_alloc  ***
+      !!----------------------------------------------------------------------
+      ALLOCATE( prodcal(jpi,jpj,jpk), STAT=p4z_mort_alloc )
+      IF( p4z_mort_alloc /= 0 ) CALL ctl_warn('p4z_mort_alloc : failed to allocate arrays.')
+
+   END FUNCTION p4z_mort_alloc
+
 #else
    !!======================================================================
Index: /branches/2011/dev_r2787_LOCEAN3_TRA_TRP/NEMOGCM/NEMO/TOP_SRC/PISCES/p4zopt.F90
===================================================================
--- /branches/2011/dev_r2787_LOCEAN3_TRA_TRP/NEMOGCM/NEMO/TOP_SRC/PISCES/p4zopt.F90	(revision 2818)
+++ /branches/2011/dev_r2787_LOCEAN3_TRA_TRP/NEMOGCM/NEMO/TOP_SRC/PISCES/p4zopt.F90	(revision 2819)
@@ -215,17 +215,17 @@
       END DO
 
-#if defined key_diatrc
-# if ! defined key_iomput
-      ! save for outputs
-      trc2d(:,:,  jp_pcs0_2d + 10) = heup(:,:  ) * tmask(:,:,1)  
-      trc3d(:,:,:,jp_pcs0_3d + 3)  = etot(:,:,:) * tmask(:,:,:)
-# else
-      ! write diagnostics 
-      IF( jnt == nrdttrc ) then 
-         CALL iom_put( "Heup", heup(:,:  ) * tmask(:,:,1) )  ! euphotic layer deptht
-         CALL iom_put( "PAR" , etot(:,:,:) * tmask(:,:,:) )  ! Photosynthetically Available Radiation
+      IF( ln_diatrc ) THEN        ! save output diagnostics
+        !
+        IF( lk_iomput ) THEN
+           IF( jnt == nrdttrc ) THEN
+              CALL iom_put( "Heup", heup(:,:  ) * tmask(:,:,1) )  ! euphotic layer deptht
+              CALL iom_put( "PAR" , etot(:,:,:) * tmask(:,:,:) )  ! Photosynthetically Available Radiation
+           ENDIF
+        ELSE
+           trc2d(:,:,  jp_pcs0_2d + 10) = heup(:,:  ) * tmask(:,:,1)  
+           trc3d(:,:,:,jp_pcs0_3d + 3)  = etot(:,:,:) * tmask(:,:,:)
+        ENDIF
+        !
       ENDIF
-# endif
-#endif
       !
       IF(  wrk_not_released(2, 1,2)           .OR.   &
Index: /branches/2011/dev_r2787_LOCEAN3_TRA_TRP/NEMOGCM/NEMO/TOP_SRC/PISCES/p4zprod.F90
===================================================================
--- /branches/2011/dev_r2787_LOCEAN3_TRA_TRP/NEMOGCM/NEMO/TOP_SRC/PISCES/p4zprod.F90	(revision 2818)
+++ /branches/2011/dev_r2787_LOCEAN3_TRA_TRP/NEMOGCM/NEMO/TOP_SRC/PISCES/p4zprod.F90	(revision 2819)
@@ -2,5 +2,5 @@
    !!======================================================================
    !!                         ***  MODULE p4zprod  ***
-   !! TOP :   PISCES 
+   !! TOP :  Growth Rate of the two phytoplanktons groups 
    !!======================================================================
    !! History :   1.0  !  2004     (O. Aumont) Original code
@@ -11,14 +11,15 @@
    !!   'key_pisces'                                       PISCES bio-model
    !!----------------------------------------------------------------------
-   !!   p4z_prod       :  
-   !!----------------------------------------------------------------------
-   USE trc
-   USE oce_trc         !
-   USE sms_pisces      ! 
-   USE prtctl_trc
-   USE p4zopt
-   USE p4zint
-   USE p4zlim
-   USE iom
+   !!   p4z_prod       :   Compute the growth Rate of the two phytoplanktons groups
+   !!   p4z_prod_init  :   Initialization of the parameters for growth
+   !!   p4z_prod_alloc :   Allocate variables for growth
+   !!----------------------------------------------------------------------
+   USE oce_trc         !  shared variables between ocean and passive tracers
+   USE trc             !  passive tracers common variables 
+   USE sms_pisces      !  PISCES Source Minus Sink variables
+   USE p4zopt          !  optical model
+   USE p4zlim          !  Co-limitations of differents nutrients
+   USE prtctl_trc      !  print control for debugging
+   USE iom             !  I/O manager
 
    IMPLICIT NONE
@@ -84,7 +85,5 @@
       REAL(wp) ::   zpislopen  , zpislope2n
       REAL(wp) ::   zrum, zcodel, zargu, zval, zvol
-#if defined key_diatrc
       REAL(wp) ::   zrfact2
-#endif
       CHARACTER (len=25) :: charout
       !!---------------------------------------------------------------------
@@ -108,9 +107,6 @@
 
       ! Computation of the optimal production
-# if defined key_degrad
-      prmax(:,:,:) = rday1 * tgfunc(:,:,:) * facvol(:,:,:)
-# else
-      prmax(:,:,:) = rday1 * tgfunc(:,:,:)
-# endif
+      prmax(:,:,:) = rday1 * tgfunc(:,:,:) 
+      IF( lk_degrad )  prmax(:,:,:) = prmax(:,:,:) * facvol(:,:,:) 
 
       ! compute the day length depending on latitude and the day
@@ -321,11 +317,11 @@
      ! Total primary production per year
 
-#if defined key_degrad
-     tpp = tpp + glob_sum( ( zprorca(:,:,:) + zprorcad(:,:,:) ) * cvol(:,:,:) * facvol(:,:,:) )
-#else
-     tpp = tpp + glob_sum( ( zprorca(:,:,:) + zprorcad(:,:,:) ) * cvol(:,:,:) )
-#endif
-
-     IF( kt == nitend .AND. jnt == nrdttrc .AND. lwp ) THEN
+     IF( lk_degrad )  THEN
+        tpp = tpp + glob_sum( ( zprorca(:,:,:) + zprorcad(:,:,:) ) * cvol(:,:,:) * facvol(:,:,:) )
+     ELSE
+        tpp = tpp + glob_sum( ( zprorca(:,:,:) + zprorcad(:,:,:) ) * cvol(:,:,:) )
+     ENDIF
+
+     IF( kt == nitend .AND. jnt == nrdttrc ) THEN
         WRITE(numout,*) 'Total PP (Gtc) :'
         WRITE(numout,*) '-------------------- : ',tpp * 12. / 1.E12
@@ -333,30 +329,29 @@
       ENDIF
 
-#if defined key_diatrc && ! defined key_iomput
-      !   Supplementary diagnostics
-      zrfact2 = 1.e3 * rfact2r
-      trc3d(:,:,:,jp_pcs0_3d + 4)  = zprorca (:,:,:) * zrfact2 * tmask(:,:,:)
-      trc3d(:,:,:,jp_pcs0_3d + 5)  = zprorcad(:,:,:) * zrfact2 * tmask(:,:,:)
-      trc3d(:,:,:,jp_pcs0_3d + 6)  = zpronew (:,:,:) * zrfact2 * tmask(:,:,:)
-      trc3d(:,:,:,jp_pcs0_3d + 7)  = zpronewd(:,:,:) * zrfact2 * tmask(:,:,:)
-      trc3d(:,:,:,jp_pcs0_3d + 8)  = zprorcad(:,:,:) * zrfact2 * tmask(:,:,:) * zysopt(:,:,:)
-      trc3d(:,:,:,jp_pcs0_3d + 9)  = zprofed (:,:,:) * zrfact2 * tmask(:,:,:)
+      IF( ln_diatrc ) THEN
+         !
+         zrfact2 = 1.e3 * rfact2r
+         IF( jnt == nrdttrc ) THEN
+            CALL iom_put( "PPPHY" , zprorca (:,:,:) * zrfact2 * tmask(:,:,:) )  ! primary production by nanophyto
+            CALL iom_put( "PPPHY2", zprorcad(:,:,:) * zrfact2 * tmask(:,:,:) )  ! primary production by diatom
+            CALL iom_put( "PPNEWN", zpronew (:,:,:) * zrfact2 * tmask(:,:,:) )  ! new primary production by nanophyto
+            CALL iom_put( "PPNEWD", zpronewd(:,:,:) * zrfact2 * tmask(:,:,:) )  ! new primary production by diatom
+            CALL iom_put( "PBSi"  , zprorcad(:,:,:) * zrfact2 * tmask(:,:,:) * zysopt(:,:,:) ) ! biogenic silica production
+            CALL iom_put( "PFeD"  , zprofed (:,:,:) * zrfact2 * tmask(:,:,:) )  ! biogenic iron production by diatom
+            CALL iom_put( "PFeN"  , zprofen (:,:,:) * zrfact2 * tmask(:,:,:) )  ! biogenic iron production by nanophyto
+         ENDIF
+#if ! defined key_iomput
+         trc3d(:,:,:,jp_pcs0_3d + 4)  = zprorca (:,:,:) * zrfact2 * tmask(:,:,:)
+         trc3d(:,:,:,jp_pcs0_3d + 5)  = zprorcad(:,:,:) * zrfact2 * tmask(:,:,:)
+         trc3d(:,:,:,jp_pcs0_3d + 6)  = zpronew (:,:,:) * zrfact2 * tmask(:,:,:)
+         trc3d(:,:,:,jp_pcs0_3d + 7)  = zpronewd(:,:,:) * zrfact2 * tmask(:,:,:)
+         trc3d(:,:,:,jp_pcs0_3d + 8)  = zprorcad(:,:,:) * zrfact2 * tmask(:,:,:) * zysopt(:,:,:)
+         trc3d(:,:,:,jp_pcs0_3d + 9)  = zprofed (:,:,:) * zrfact2 * tmask(:,:,:)
 #  if ! defined key_kriest
-      trc3d(:,:,:,jp_pcs0_3d + 10) = zprofen (:,:,:) * zrfact2 * tmask(:,:,:)
+         trc3d(:,:,:,jp_pcs0_3d + 10) = zprofen (:,:,:) * zrfact2 * tmask(:,:,:)
 #  endif
 #endif
-
-#if defined key_diatrc && defined key_iomput
-      zrfact2 = 1.e3 * rfact2r
-      IF ( jnt == nrdttrc ) then
-         CALL iom_put( "PPPHY" , zprorca (:,:,:) * zrfact2 * tmask(:,:,:) )  ! primary production by nanophyto
-         CALL iom_put( "PPPHY2", zprorcad(:,:,:) * zrfact2 * tmask(:,:,:) )  ! primary production by diatom
-         CALL iom_put( "PPNEWN", zpronew (:,:,:) * zrfact2 * tmask(:,:,:) )  ! new primary production by nanophyto
-         CALL iom_put( "PPNEWD", zpronewd(:,:,:) * zrfact2 * tmask(:,:,:) )  ! new primary production by diatom
-         CALL iom_put( "PBSi"  , zprorcad(:,:,:) * zrfact2 * tmask(:,:,:) * zysopt(:,:,:) ) ! biogenic silica production
-         CALL iom_put( "PFeD"  , zprofed (:,:,:) * zrfact2 * tmask(:,:,:) )  ! biogenic iron production by diatom
-         CALL iom_put( "PFeN"  , zprofen (:,:,:) * zrfact2 * tmask(:,:,:) )  ! biogenic iron production by nanophyto
+         !
       ENDIF
-#endif
 
       IF(ln_ctl)   THEN  ! print mean trends (used for debugging)
@@ -388,6 +383,6 @@
       !!----------------------------------------------------------------------
 
-      REWIND( numnat )                     ! read numnat
-      READ  ( numnat, nampisprod )
+      REWIND( numnatp )                     ! read numnatp
+      READ  ( numnatp, nampisprod )
 
       IF(lwp) THEN                         ! control print
Index: /branches/2011/dev_r2787_LOCEAN3_TRA_TRP/NEMOGCM/NEMO/TOP_SRC/PISCES/p4zrem.F90
===================================================================
--- /branches/2011/dev_r2787_LOCEAN3_TRA_TRP/NEMOGCM/NEMO/TOP_SRC/PISCES/p4zrem.F90	(revision 2818)
+++ /branches/2011/dev_r2787_LOCEAN3_TRA_TRP/NEMOGCM/NEMO/TOP_SRC/PISCES/p4zrem.F90	(revision 2819)
@@ -12,15 +12,16 @@
    !!   'key_pisces'                                       PISCES bio-model
    !!----------------------------------------------------------------------
-   !!   p4z_rem       :   Compute remineralization/scavenging of organic compounds
-   !!----------------------------------------------------------------------
-   USE trc
-   USE oce_trc         !
-   USE sms_pisces      ! 
-   USE prtctl_trc
-   USE p4zint
-   USE p4zopt
-   USE p4zmeso
-   USE p4zprod
-   USE p4zche
+   !!   p4z_rem       :  Compute remineralization/scavenging of organic compounds
+   !!   p4z_rem_init  :  Initialisation of parameters for remineralisation
+   !!   p4z_rem_alloc :  Allocate remineralisation variables
+   !!----------------------------------------------------------------------
+   USE oce_trc         !  shared variables between ocean and passive tracers
+   USE trc             !  passive tracers common variables 
+   USE sms_pisces      !  PISCES Source Minus Sink variables
+   USE p4zopt          !  optical model
+   USE p4zche          !  chemical model
+   USE p4zprod         !  Growth rate of the 2 phyto groups
+   USE p4zmeso         !  Sources and sinks of mesozooplankton
+   USE prtctl_trc      !  print control for debugging
 
    IMPLICIT NONE
@@ -61,5 +62,5 @@
       USE wrk_nemo, ONLY:   wrk_in_use, wrk_not_released
       USE wrk_nemo, ONLY:   ztempbac => wrk_2d_1
-      USE wrk_nemo, ONLY:   zdepbac  => wrk_3d_2 , zolimi => wrk_3d_3
+      USE wrk_nemo, ONLY:   zdepbac  => wrk_3d_2, zolimi => wrk_3d_3
       !
       INTEGER, INTENT(in) ::   kt ! ocean time step
@@ -117,8 +118,7 @@
          DO jj = 1, jpj
             DO ji = 1, jpi
+               zstep   = xstep
 # if defined key_degrad
-               zstep = xstep * facvol(ji,jj,jk)
-# else
-               zstep = xstep
+               zstep = zstep * facvol(ji,jj,jk)
 # endif
                ! DOC ammonification. Depends on depth, phytoplankton biomass
@@ -153,8 +153,7 @@
          DO jj = 1, jpj
             DO ji = 1, jpi
+               zstep   = xstep
 # if defined key_degrad
-               zstep = xstep * facvol(ji,jj,jk)
-# else
-               zstep = xstep
+               zstep = zstep * facvol(ji,jj,jk)
 # endif
                !    NH4 nitrification to NO3. Ceased for oxygen concentrations
@@ -214,8 +213,7 @@
          DO jj = 1, jpj
             DO ji = 1, jpi
+               zstep   = xstep
 # if defined key_degrad
-               zstep = xstep * facvol(ji,jj,jk)
-# else
-               zstep = xstep
+               zstep = zstep * facvol(ji,jj,jk)
 # endif
                !    POC disaggregation by turbulence and bacterial activity. 
@@ -266,8 +264,7 @@
          DO jj = 1, jpj
             DO ji = 1, jpi
+               zstep   = xstep
 # if defined key_degrad
-               zstep = xstep * facvol(ji,jj,jk)
-# else
-               zstep = xstep
+               zstep = zstep * facvol(ji,jj,jk)
 # endif
                !     Remineralization rate of BSi depedant on T and saturation
@@ -300,8 +297,7 @@
 !CDIR NOVERRCHK
             DO ji = 1, jpi
+               zstep   = xstep
 # if defined key_degrad
-               zstep = xstep * facvol(ji,jj,jk)
-# else
-               zstep = xstep
+               zstep = zstep * facvol(ji,jj,jk)
 # endif
                !  Compute de different ratios for scavenging of iron
@@ -414,6 +410,6 @@
       !!----------------------------------------------------------------------
 
-      REWIND( numnat )                     ! read numnat
-      READ  ( numnat, nampisrem )
+      REWIND( numnatp )                     ! read numnatp
+      READ  ( numnatp, nampisrem )
 
       IF(lwp) THEN                         ! control print
Index: /branches/2011/dev_r2787_LOCEAN3_TRA_TRP/NEMOGCM/NEMO/TOP_SRC/PISCES/p4zsed.F90
===================================================================
--- /branches/2011/dev_r2787_LOCEAN3_TRA_TRP/NEMOGCM/NEMO/TOP_SRC/PISCES/p4zsed.F90	(revision 2818)
+++ /branches/2011/dev_r2787_LOCEAN3_TRA_TRP/NEMOGCM/NEMO/TOP_SRC/PISCES/p4zsed.F90	(revision 2819)
@@ -15,16 +15,13 @@
    !!   p4z_sed_init   :  Initialization of p4z_sed
    !!----------------------------------------------------------------------
-   USE trc
-   USE oce_trc         !
-   USE sms_pisces
-   USE prtctl_trc
-   USE p4zbio
-   USE p4zint
-   USE p4zopt
-   USE p4zsink
-   USE p4zrem
-   USE p4zlim
-   USE iom
-
+   USE oce_trc         !  shared variables between ocean and passive tracers
+   USE trc             !  passive tracers common variables 
+   USE sms_pisces      !  PISCES Source Minus Sink variables
+   USE p4zsink         !  vertical flux of particulate matter due to sinking
+   USE p4zopt          !  optical model
+   USE p4zlim          !  Co-limitations of differents nutrients
+   USE p4zrem          !  Remineralisation of organic matter
+   USE prtctl_trc      !  print control for debugging
+   USE iom             !  I/O manager
 
    IMPLICIT NONE
@@ -247,9 +244,9 @@
                IF( zlim <= 0.2 )   zlim = 0.01
                znitrpot(ji,jj,jk) = MAX( 0.e0, ( 0.6 * tgfunc(ji,jj,jk) - 2.15 ) * rday1 )   &
+                  &                  * zlim * rfact2 * trn(ji,jj,jk,jpfer)   &
 # if defined key_degrad
-               &                  * facvol(ji,jj,jk)   &
+                  &                  * facvol(ji,jj,jk)
 # endif
-               &                  * zlim * rfact2 * trn(ji,jj,jk,jpfer)   &
-               &                  / ( conc3 + trn(ji,jj,jk,jpfer) ) * ( 1.- EXP( -etot(ji,jj,jk) / 50.) )
+                  &                  / ( conc3 + trn(ji,jj,jk,jpfer) ) * ( 1.- EXP( -etot(ji,jj,jk) / 50.) )
             END DO
          END DO 
@@ -272,18 +269,19 @@
       END DO
 
-#if defined key_diatrc
-      zfact = 1.e+3 * rfact2r
-#  if  ! defined key_iomput
-      trc2d(:,:,jp_pcs0_2d + 11) = zirondep(:,:,1)         * zfact * fse3t(:,:,1) * tmask(:,:,1)
-      trc2d(:,:,jp_pcs0_2d + 12) = znitrpot(:,:,1) * 1.e-7 * zfact * fse3t(:,:,1) * tmask(:,:,1)
-#  else
-      zwork (:,:)  =  ( zirondep(:,:,1) + ironsed(:,:,1) * rfact2 ) * zfact * fse3t(:,:,1) * tmask(:,:,1) 
-      zwork1(:,:)  =  znitrpot(:,:,1) * 1.e-7                       * zfact * fse3t(:,:,1) * tmask(:,:,1)
-      IF( jnt == nrdttrc ) THEN
-         CALL iom_put( "Irondep", zwork  )  ! surface downward net flux of iron
-         CALL iom_put( "Nfix"   , zwork1 )  ! nitrogen fixation at surface
+      IF( ln_diatrc ) THEN
+         !
+         zfact = 1.e+3 * rfact2r
+         zwork (:,:)  =  ( zirondep(:,:,1) + ironsed(:,:,1) * rfact2 ) * zfact * fse3t(:,:,1) * tmask(:,:,1) 
+         zwork1(:,:)  =    znitrpot(:,:,1) * 1.e-7                     * zfact * fse3t(:,:,1) * tmask(:,:,1)
+         IF( jnt == nrdttrc ) THEN
+            CALL iom_put( "Irondep", zwork  )  ! surface downward net flux of iron
+            CALL iom_put( "Nfix"   , zwork1 )  ! nitrogen fixation at surface
+         ENDIF
+# if ! defined key_iomput
+         trc2d(:,:,jp_pcs0_2d + 11) = zirondep(:,:,1)         * zfact * fse3t(:,:,1) * tmask(:,:,1)
+         trc2d(:,:,jp_pcs0_2d + 12) = znitrpot(:,:,1) * 1.e-7 * zfact * fse3t(:,:,1) * tmask(:,:,1)
+# endif
+         !
       ENDIF
-#  endif
-#endif
       !
        IF(ln_ctl)   THEN  ! print mean trends (used for debugging)
@@ -355,5 +353,4 @@
 
    END SUBROUTINE p4z_sbc
-
 
    SUBROUTINE p4z_sed_init
@@ -385,7 +382,7 @@
          CALL ctl_stop('p4z_sed_init: requested workspace arrays unavailable')  ;  RETURN
       END IF
-      !
-      REWIND( numnat )                     ! read numnat
-      READ  ( numnat, nampissed )
+
+      REWIND( numnatp )                     ! read numnatp
+      READ  ( numnatp, nampissed )
 
       IF(lwp) THEN
Index: /branches/2011/dev_r2787_LOCEAN3_TRA_TRP/NEMOGCM/NEMO/TOP_SRC/PISCES/p4zsink.F90
===================================================================
--- /branches/2011/dev_r2787_LOCEAN3_TRA_TRP/NEMOGCM/NEMO/TOP_SRC/PISCES/p4zsink.F90	(revision 2818)
+++ /branches/2011/dev_r2787_LOCEAN3_TRA_TRP/NEMOGCM/NEMO/TOP_SRC/PISCES/p4zsink.F90	(revision 2819)
@@ -2,5 +2,5 @@
    !!======================================================================
    !!                         ***  MODULE p4zsink  ***
-   !! TOP :   PISCES Compute vertical flux of particulate matter due to gravitational sinking
+   !! TOP :  PISCES  vertical flux of particulate matter due to gravitational sinking
    !!======================================================================
    !! History :   1.0  !  2004     (O. Aumont) Original code
@@ -9,10 +9,12 @@
    !!----------------------------------------------------------------------
    !!   p4z_sink       :  Compute vertical flux of particulate matter due to gravitational sinking
+   !!   p4z_sink_init  :  Unitialisation of sinking speed parameters
+   !!   p4z_sink_alloc :  Allocate sinking speed variables
    !!----------------------------------------------------------------------
-   USE trc
-   USE oce_trc         !
-   USE sms_pisces
-   USE prtctl_trc
-   USE iom
+   USE oce_trc         !  shared variables between ocean and passive tracers
+   USE trc             !  passive tracers common variables 
+   USE sms_pisces      !  PISCES Source Minus Sink variables
+   USE prtctl_trc      !  print control for debugging
+   USE iom             !  I/O manager
 
    IMPLICIT NONE
@@ -91,8 +93,6 @@
       REAL(wp) :: zdiv , zdiv1, zdiv2, zdiv3, zdiv4, zdiv5
       REAL(wp) :: zval1, zval2, zval3, zval4
-#if defined key_diatrc
       REAL(wp) :: zrfact2
       INTEGER  :: ik1
-#endif
       CHARACTER (len=25) :: charout
       !!---------------------------------------------------------------------
@@ -193,9 +193,5 @@
                      &            * (zeps-1)/zdiv1 + 3.*(zfm*xkr_mass_max-xkr_mass_min)    &
                      &            * (zfm*xkr_mass_max**2-xkr_mass_min**2)                  &
-                     &            * (zeps-1.)**2/(zdiv2*zdiv3))            &
-# if defined key_degrad
-                     &                 *facvol(ji,jj,jk)       &
-# endif
-                     &    )
+                     &            * (zeps-1.)**2/(zdiv2*zdiv3))           ) 
 
                   zagg2 = (  2*0.163*trn(ji,jj,jk,jpnum)**2*zfm*                       &
@@ -205,16 +201,13 @@
                      &                    +xkr_mass_min**3*(zeps-1)/zdiv1)                  &
                      &                    -zfm*xkr_mass_max**3*(1.+3.*((zeps-1.)/           &
-                     &                    (zeps-2.)+(zeps-1.)/zdiv3)+(zeps-1.)/zdiv1))      &
-#    if defined key_degrad
-                     &                 *facvol(ji,jj,jk)             &
-#    endif
-                     &    )
-
-                  zagg3 = (  0.163*trn(ji,jj,jk,jpnum)**2*zfm**2*8. * xkr_mass_max**3   &
-#    if defined key_degrad
-                     &                 *facvol(ji,jj,jk)             &
-#    endif
-                     &    )
-
+                     &                    (zeps-2.)+(zeps-1.)/zdiv3)+(zeps-1.)/zdiv1))  ) 
+
+                  zagg3 = (  0.163*trn(ji,jj,jk,jpnum)**2*zfm**2*8. * xkr_mass_max**3 ) 
+
+                  IF( lk_degrad ) THEN
+                     zagg1 = zagg1 * facvol(ji,jj,jk)
+                     zagg2 = zagg2 * facvol(ji,jj,jk)
+                     zagg3 = zagg3 * facvol(ji,jj,jk)
+                  ENDIF
                   zaggsh = ( zagg1 + zagg2 + zagg3 ) * rfact2 * xdiss(ji,jj,jk) / 1000.
 
@@ -228,9 +221,5 @@
                      &                 -(1.-zfm)/(zdiv*(zeps-1.)))-                       &
                      &                 ((zfm*zfm*xkr_mass_max**2*zsm-xkr_mass_min**2)     &
-                     &                 *xkr_eta)/(zdiv*zdiv3*zdiv5) )                     &
-# if defined key_degrad
-                     &                 *facvol(ji,jj,jk)        &
-# endif
-                     &    )
+                     &                 *xkr_eta)/(zdiv*zdiv3*zdiv5) )  ) 
 
                   zagg5 = (  2.*3.141*0.125*trn(ji,jj,jk,jpnum)**2                         &
@@ -238,10 +227,9 @@
                      &                 *(zsm*(xkr_mass_min**2-zfm*xkr_mass_max**2)         &
                      &                 /zdiv3-(xkr_mass_min**2-zfm*zsm*xkr_mass_max**2)    &
-                     &                 /zdiv)                   &
+                     &                 /zdiv)    ) 
 # if defined key_degrad
-                     &                 *facvol(ji,jj,jk)        &
+                  zagg4 = zagg4 * facvol(ji,jj,jk)
+                  zagg5 = zagg5 * facvol(ji,jj,jk)
 # endif
-                     &    )
-
                   zaggsi = ( zagg4 + zagg5 ) * xstep / 10.
 
@@ -254,5 +242,5 @@
                      &        + 1018.  * trn(ji,jj,jk,jppoc)  ) * xstep    &
 # if defined key_degrad
-                     &        * facvol(ji,jj,jk)                              &
+                     &        * facvol(ji,jj,jk)
 # endif
                      &        * xdiss(ji,jj,jk) * trn(ji,jj,jk,jpdoc)
@@ -268,38 +256,38 @@
       END DO
 
-#if defined key_diatrc
-      zrfact2 = 1.e3 * rfact2r
-      ik1 = iksed + 1
-#  if ! defined key_iomput
-      trc2d(:,:  ,jp_pcs0_2d + 4)  = sinking (:,:,ik1) * zrfact2 * tmask(:,:,1)
-      trc2d(:,:  ,jp_pcs0_2d + 5)  = sinking2(:,:,ik1) * zrfact2 * tmask(:,:,1)
-      trc2d(:,:  ,jp_pcs0_2d + 6)  = sinkfer (:,:,ik1) * zrfact2 * tmask(:,:,1)
-      trc2d(:,:  ,jp_pcs0_2d + 7)  = sinksil (:,:,ik1) * zrfact2 * tmask(:,:,1)
-      trc2d(:,:  ,jp_pcs0_2d + 8)  = sinkcal (:,:,ik1) * zrfact2 * tmask(:,:,1)
-      trc3d(:,:,:,jp_pcs0_3d + 11) = sinking (:,:,:)      * zrfact2 * tmask(:,:,:)
-      trc3d(:,:,:,jp_pcs0_3d + 12) = sinking2(:,:,:)      * zrfact2 * tmask(:,:,:)
-      trc3d(:,:,:,jp_pcs0_3d + 13) = sinksil (:,:,:)      * zrfact2 * tmask(:,:,:)
-      trc3d(:,:,:,jp_pcs0_3d + 14) = sinkcal (:,:,:)      * zrfact2 * tmask(:,:,:)
-      trc3d(:,:,:,jp_pcs0_3d + 15) = znum3d  (:,:,:)                * tmask(:,:,:)
-      trc3d(:,:,:,jp_pcs0_3d + 16) = wsbio3  (:,:,:)                * tmask(:,:,:)
-      trc3d(:,:,:,jp_pcs0_3d + 17) = wsbio4  (:,:,:)                * tmask(:,:,:)
-#else
-      IF( jnt == nrdttrc ) then
-        CALL iom_put( "POCFlx"  , sinking (:,:,:)      * zrfact2 * tmask(:,:,:) )  ! POC export
-        CALL iom_put( "NumFlx"  , sinking2 (:,:,:)     * zrfact2 * tmask(:,:,:) )  ! Num export
-        CALL iom_put( "SiFlx"   , sinksil (:,:,:)      * zrfact2 * tmask(:,:,:) )  ! Silica export
-        CALL iom_put( "CaCO3Flx", sinkcal (:,:,:)      * zrfact2 * tmask(:,:,:) )  ! Calcite export
-        CALL iom_put( "xnum"    , znum3d  (:,:,:)                * tmask(:,:,:) )  ! Number of particles in aggregats
-        CALL iom_put( "W1"      , wsbio3  (:,:,:)                * tmask(:,:,:) )  ! sinking speed of POC
-        CALL iom_put( "W2"      , wsbio4  (:,:,:)                * tmask(:,:,:) )  ! sinking speed of aggregats
-        CALL iom_put( "PMO"     , sinking (:,:,ik1) * zrfact2 * tmask(:,:,1) )  ! POC export at 100m
-        CALL iom_put( "PMO2"    , sinking2(:,:,ik1) * zrfact2 * tmask(:,:,1) )  ! Num export at 100m
-        CALL iom_put( "ExpFe1"  , sinkfer (:,:,ik1) * zrfact2 * tmask(:,:,1) )  ! Export of iron at 100m
-        CALL iom_put( "ExpSi"   , sinksil (:,:,ik1) * zrfact2 * tmask(:,:,1) )  ! export of silica at 100m
-        CALL iom_put( "ExpCaCO3", sinkcal (:,:,ik1) * zrfact2 * tmask(:,:,1) )  ! export of calcite at 100m
-     ENDIF
-#  endif
-
-#endif
+      IF( ln_diatrc ) THEN
+         !
+         ik1 = iksed + 1
+         zrfact2 = 1.e3 * rfact2r
+         IF( jnt == nrdttrc ) THEN
+           CALL iom_put( "POCFlx"  , sinking (:,:,:)      * zrfact2 * tmask(:,:,:) )  ! POC export
+           CALL iom_put( "NumFlx"  , sinking2 (:,:,:)     * zrfact2 * tmask(:,:,:) )  ! Num export
+           CALL iom_put( "SiFlx"   , sinksil (:,:,:)      * zrfact2 * tmask(:,:,:) )  ! Silica export
+           CALL iom_put( "CaCO3Flx", sinkcal (:,:,:)      * zrfact2 * tmask(:,:,:) )  ! Calcite export
+           CALL iom_put( "xnum"    , znum3d  (:,:,:)                * tmask(:,:,:) )  ! Number of particles in aggregats
+           CALL iom_put( "W1"      , wsbio3  (:,:,:)                * tmask(:,:,:) )  ! sinking speed of POC
+           CALL iom_put( "W2"      , wsbio4  (:,:,:)                * tmask(:,:,:) )  ! sinking speed of aggregats
+           CALL iom_put( "PMO"     , sinking (:,:,ik1)    * zrfact2 * tmask(:,:,1) )  ! POC export at 100m
+           CALL iom_put( "PMO2"    , sinking2(:,:,ik1)    * zrfact2 * tmask(:,:,1) )  ! Num export at 100m
+           CALL iom_put( "ExpFe1"  , sinkfer (:,:,ik1)    * zrfact2 * tmask(:,:,1) )  ! Export of iron at 100m
+           CALL iom_put( "ExpSi"   , sinksil (:,:,ik1)    * zrfact2 * tmask(:,:,1) )  ! export of silica at 100m
+           CALL iom_put( "ExpCaCO3", sinkcal (:,:,ik1)    * zrfact2 * tmask(:,:,1) )  ! export of calcite at 100m
+         ENDIF
+# if ! defined key_iomput
+         trc2d(:,:  ,jp_pcs0_2d + 4)  = sinking (:,:,ik1)    * zrfact2 * tmask(:,:,1)
+         trc2d(:,:  ,jp_pcs0_2d + 5)  = sinking2(:,:,ik1)    * zrfact2 * tmask(:,:,1)
+         trc2d(:,:  ,jp_pcs0_2d + 6)  = sinkfer (:,:,ik1)    * zrfact2 * tmask(:,:,1)
+         trc2d(:,:  ,jp_pcs0_2d + 7)  = sinksil (:,:,ik1)    * zrfact2 * tmask(:,:,1)
+         trc2d(:,:  ,jp_pcs0_2d + 8)  = sinkcal (:,:,ik1)    * zrfact2 * tmask(:,:,1)
+         trc3d(:,:,:,jp_pcs0_3d + 11) = sinking (:,:,:)      * zrfact2 * tmask(:,:,:)
+         trc3d(:,:,:,jp_pcs0_3d + 12) = sinking2(:,:,:)      * zrfact2 * tmask(:,:,:)
+         trc3d(:,:,:,jp_pcs0_3d + 13) = sinksil (:,:,:)      * zrfact2 * tmask(:,:,:)
+         trc3d(:,:,:,jp_pcs0_3d + 14) = sinkcal (:,:,:)      * zrfact2 * tmask(:,:,:)
+         trc3d(:,:,:,jp_pcs0_3d + 15) = znum3d  (:,:,:)                * tmask(:,:,:)
+         trc3d(:,:,:,jp_pcs0_3d + 16) = wsbio3  (:,:,:)                * tmask(:,:,:)
+         trc3d(:,:,:,jp_pcs0_3d + 17) = wsbio4  (:,:,:)                * tmask(:,:,:)
+# endif
+        !
+      ENDIF
       !
       IF(ln_ctl)   THEN  ! print mean trends (used for debugging)
@@ -335,6 +323,6 @@
       !!----------------------------------------------------------------------
       !
-      REWIND( numnat )                     ! read nampiskrs
-      READ  ( numnat, nampiskrs )
+      REWIND( numnatp )                     ! read nampiskrs
+      READ  ( numnatp, nampiskrs )
 
       IF(lwp) THEN
@@ -459,8 +447,6 @@
       REAL(wp) ::   zagg , zaggfe, zaggdoc, zaggdoc2
       REAL(wp) ::   zfact, zwsmax, zstep
-#if defined key_diatrc
       REAL(wp) ::   zrfact2
       INTEGER  ::   ik1
-#endif
       CHARACTER (len=25) :: charout
       !!---------------------------------------------------------------------
@@ -526,8 +512,8 @@
          DO jj = 1, jpj
             DO ji = 1, jpi
+               !
+               zstep = xstep 
 # if defined key_degrad
-               zstep = xstep * facvol(ji,jj,jk)
-# else
-               zstep = xstep 
+               zstep = zstep * facvol(ji,jj,jk)
 # endif
                zfact = zstep * xdiss(ji,jj,jk)
@@ -560,23 +546,24 @@
       END DO
 
-#if defined key_diatrc
-      zrfact2 = 1.e3 * rfact2r
-      ik1  = iksed + 1
-#  if ! defined key_iomput
-      trc2d(:,:,jp_pcs0_2d + 4) = sinking (:,:,ik1) * zrfact2 * tmask(:,:,1)
-      trc2d(:,:,jp_pcs0_2d + 5) = sinking2(:,:,ik1) * zrfact2 * tmask(:,:,1)
-      trc2d(:,:,jp_pcs0_2d + 6) = sinkfer (:,:,ik1) * zrfact2 * tmask(:,:,1)
-      trc2d(:,:,jp_pcs0_2d + 7) = sinkfer2(:,:,ik1) * zrfact2 * tmask(:,:,1)
-      trc2d(:,:,jp_pcs0_2d + 8) = sinksil (:,:,ik1) * zrfact2 * tmask(:,:,1)
-      trc2d(:,:,jp_pcs0_2d + 9) = sinkcal (:,:,ik1) * zrfact2 * tmask(:,:,1)
-#  else
-      IF( jnt == nrdttrc )  then
-         CALL iom_put( "EPC100"  , ( sinking(:,:,ik1) + sinking2(:,:,ik1) ) * zrfact2 * tmask(:,:,1) ) ! Export of carbon at 100m
-         CALL iom_put( "EPFE100" , ( sinkfer(:,:,ik1) + sinkfer2(:,:,ik1) ) * zrfact2 * tmask(:,:,1) ) ! Export of iron at 100m
-         CALL iom_put( "EPCAL100",   sinkcal(:,:,ik1)                       * zrfact2 * tmask(:,:,1) ) ! Export of calcite  at 100m
-         CALL iom_put( "EPSI100" ,   sinksil(:,:,ik1)                       * zrfact2 * tmask(:,:,1) ) ! Export of biogenic silica at 100m
+      IF( ln_diatrc ) THEN
+         !
+         zrfact2 = 1.e3 * rfact2r
+         ik1  = iksed + 1
+         IF( jnt == nrdttrc ) THEN
+            CALL iom_put( "EPC100"  , ( sinking(:,:,ik1) + sinking2(:,:,ik1) ) * zrfact2 * tmask(:,:,1) ) ! Export of carbon at 100m
+            CALL iom_put( "EPFE100" , ( sinkfer(:,:,ik1) + sinkfer2(:,:,ik1) ) * zrfact2 * tmask(:,:,1) ) ! Export of iron at 100m
+            CALL iom_put( "EPCAL100",   sinkcal(:,:,ik1)                       * zrfact2 * tmask(:,:,1) ) ! Export of calcite  at 100m
+            CALL iom_put( "EPSI100" ,   sinksil(:,:,ik1)                       * zrfact2 * tmask(:,:,1) ) ! Export of biogenic silica at 100m
+         ENDIF
+# if ! defined key_iomput
+         trc2d(:,:,jp_pcs0_2d + 4) = sinking (:,:,ik1) * zrfact2 * tmask(:,:,1)
+         trc2d(:,:,jp_pcs0_2d + 5) = sinking2(:,:,ik1) * zrfact2 * tmask(:,:,1)
+         trc2d(:,:,jp_pcs0_2d + 6) = sinkfer (:,:,ik1) * zrfact2 * tmask(:,:,1)
+         trc2d(:,:,jp_pcs0_2d + 7) = sinkfer2(:,:,ik1) * zrfact2 * tmask(:,:,1)
+         trc2d(:,:,jp_pcs0_2d + 8) = sinksil (:,:,ik1) * zrfact2 * tmask(:,:,1)
+         trc2d(:,:,jp_pcs0_2d + 9) = sinkcal (:,:,ik1) * zrfact2 * tmask(:,:,1)
+# endif
+         !
       ENDIF
-#endif
-#endif
       !
       IF(ln_ctl)   THEN  ! print mean trends (used for debugging)
@@ -630,11 +617,10 @@
 
       DO jk = 1, jpkm1
-# if defined key_degrad
-         zwsink2(:,:,jk+1) = -pwsink(:,:,jk) / rday * tmask(:,:,jk+1) * facvol(:,:,jk)
-# else
-         zwsink2(:,:,jk+1) = -pwsink(:,:,jk) / rday * tmask(:,:,jk+1)
-# endif
+         zwsink2(:,:,jk+1) = -pwsink(:,:,jk) / rday * tmask(:,:,jk+1) 
       END DO
       zwsink2(:,:,1) = 0.e0
+      IF( lk_degrad ) THEN
+         zwsink2(:,:,:) = zwsink2(:,:,:) * facvol(:,:,:)
+      ENDIF
 
 
Index: /branches/2011/dev_r2787_LOCEAN3_TRA_TRP/NEMOGCM/NEMO/TOP_SRC/PISCES/par_pisces.F90
===================================================================
--- /branches/2011/dev_r2787_LOCEAN3_TRA_TRP/NEMOGCM/NEMO/TOP_SRC/PISCES/par_pisces.F90	(revision 2818)
+++ /branches/2011/dev_r2787_LOCEAN3_TRA_TRP/NEMOGCM/NEMO/TOP_SRC/PISCES/par_pisces.F90	(revision 2819)
@@ -29,6 +29,6 @@
    LOGICAL, PUBLIC, PARAMETER ::   lk_kriest     = .TRUE.  !: Kriest flag 
    INTEGER, PUBLIC, PARAMETER ::   jp_pisces     =  23     !: number of passive tracers
-   INTEGER, PUBLIC, PARAMETER ::   jp_pisces_2d  =  13     !: additional 2d output ('key_diatrc')
-   INTEGER, PUBLIC, PARAMETER ::   jp_pisces_3d  =  18     !: additional 3d output ('key_diatrc')
+   INTEGER, PUBLIC, PARAMETER ::   jp_pisces_2d  =  13     !: additional 2d output 
+   INTEGER, PUBLIC, PARAMETER ::   jp_pisces_3d  =  18     !: additional 3d output 
    INTEGER, PUBLIC, PARAMETER ::   jp_pisces_trd =   1     !: number of sms trends for PISCES
 
@@ -67,6 +67,6 @@
    LOGICAL, PUBLIC, PARAMETER ::   lk_kriest     = .FALSE. !: Kriest flag 
    INTEGER, PUBLIC, PARAMETER ::   jp_pisces     = 24      !: number of PISCES passive tracers
-   INTEGER, PUBLIC, PARAMETER ::   jp_pisces_2d  = 13      !: additional 2d output ('key_diatrc')
-   INTEGER, PUBLIC, PARAMETER ::   jp_pisces_3d  = 11      !: additional 3d output ('key_diatrc')
+   INTEGER, PUBLIC, PARAMETER ::   jp_pisces_2d  = 13      !: additional 2d output 
+   INTEGER, PUBLIC, PARAMETER ::   jp_pisces_3d  = 11      !: additional 3d output 
    INTEGER, PUBLIC, PARAMETER ::   jp_pisces_trd =  1      !: number of sms trends for PISCES
 
Index: /branches/2011/dev_r2787_LOCEAN3_TRA_TRP/NEMOGCM/NEMO/TOP_SRC/PISCES/sms_pisces.F90
===================================================================
--- /branches/2011/dev_r2787_LOCEAN3_TRA_TRP/NEMOGCM/NEMO/TOP_SRC/PISCES/sms_pisces.F90	(revision 2818)
+++ /branches/2011/dev_r2787_LOCEAN3_TRA_TRP/NEMOGCM/NEMO/TOP_SRC/PISCES/sms_pisces.F90	(revision 2819)
@@ -16,4 +16,6 @@
    IMPLICIT NONE
    PUBLIC
+
+   INTEGER ::   numnatp
 
    !!*  Time variables
@@ -61,8 +63,6 @@
    REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::   xlimbac    !: ??
    REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::   xdiss      !: ??
-#if defined key_diatrc
    REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::   prodcal    !: Calcite production
    REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::   grazing    !: Total zooplankton grazing
-#endif
 
    !!* Variable for chemistry of the CO2 cycle
@@ -74,4 +74,8 @@
    REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::   borat      !: ???
    REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::   hi         !: ???
+
+   !!* Temperature dependancy of SMS terms
+   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::   tgfunc    !: Temp. dependancy of various biological rates
+   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::   tgfunc2   !: Temp. dependancy of mesozooplankton rates
 
    !!* Array used to indicate negative tracer values
@@ -98,32 +102,33 @@
       !!----------------------------------------------------------------------
       USE lib_mpp , ONLY: ctl_warn
-      INTEGER ::   ierr(5)        ! Local variables
+      INTEGER ::   ierr(6)        ! Local variables
       !!----------------------------------------------------------------------
       ierr(:) = 0
       !
       !*  Biological fluxes for light
-      ALLOCATE( neln(jpi,jpj), heup(jpi,jpj),                           STAT=ierr(1) )
+      ALLOCATE( neln(jpi,jpj), heup(jpi,jpj),                   STAT=ierr(1) )
       !
       !*  Biological fluxes for primary production
-      ALLOCATE( xksimax(jpi,jpj)     , xksi(jpi,jpj)        ,               &
-         &      xnanono3(jpi,jpj,jpk), xdiatno3(jpi,jpj,jpk),               &
-         &      xnanonh4(jpi,jpj,jpk), xdiatnh4(jpi,jpj,jpk),               &
-         &      xlimphy (jpi,jpj,jpk), xlimdia (jpi,jpj,jpk),               &
-         &      concdfe (jpi,jpj,jpk), concnfe (jpi,jpj,jpk),           STAT=ierr(2) ) 
+      ALLOCATE( xksimax(jpi,jpj)     , xksi(jpi,jpj)        ,       &
+         &      xnanono3(jpi,jpj,jpk), xdiatno3(jpi,jpj,jpk),       &
+         &      xnanonh4(jpi,jpj,jpk), xdiatnh4(jpi,jpj,jpk),       &
+         &      xlimphy (jpi,jpj,jpk), xlimdia (jpi,jpj,jpk),       &
+         &      concdfe (jpi,jpj,jpk), concnfe (jpi,jpj,jpk),   STAT=ierr(2) ) 
          !
       !*  SMS for the organic matter
-      ALLOCATE( xfracal (jpi,jpj,jpk), nitrfac (jpi,jpj,jpk),               &
-#if defined key_diatrc
-         &      prodcal(jpi,jpj,jpk) , grazing(jpi,jpj,jpk) ,               &
-#endif 
-         &      xlimbac (jpi,jpj,jpk), xdiss(jpi,jpj,jpk)   ,           STAT=ierr(3) )  
+      ALLOCATE( xfracal (jpi,jpj,jpk), nitrfac (jpi,jpj,jpk),       &
+         &      xlimbac (jpi,jpj,jpk), xdiss(jpi,jpj,jpk)   ,   STAT=ierr(3) )  
          !
       !* Variable for chemistry of the CO2 cycle
-      ALLOCATE( akb3(jpi,jpj,jpk), ak13(jpi,jpj,jpk) ,                      &
-         &      ak23(jpi,jpj,jpk), aksp(jpi,jpj,jpk) ,                      &
-         &      akw3(jpi,jpj,jpk), borat(jpi,jpj,jpk), hi(jpi,jpj,jpk), STAT=ierr(4) )
+      ALLOCATE( akb3(jpi,jpj,jpk)    , ak13(jpi,jpj,jpk)    ,       &
+         &      ak23(jpi,jpj,jpk)    , aksp(jpi,jpj,jpk)    ,       &
+         &      akw3(jpi,jpj,jpk)    , borat(jpi,jpj,jpk)   ,       &
+         &      hi  (jpi,jpj,jpk)    ,                          STAT=ierr(4) )
+         !
+      !* Temperature dependancy of SMS terms
+      ALLOCATE( tgfunc(jpi,jpj,jpk)  , tgfunc2(jpi,jpj,jpk) ,   STAT=ierr(5) )
          !
       !* Array used to indicate negative tracer values  
-      ALLOCATE( xnegtr(jpi,jpj,jpk),                                    STAT=ierr(5) )
+      ALLOCATE( xnegtr(jpi,jpj,jpk)  ,                          STAT=ierr(6) )
       !
       sms_pisces_alloc = MAXVAL( ierr )
Index: /branches/2011/dev_r2787_LOCEAN3_TRA_TRP/NEMOGCM/NEMO/TOP_SRC/PISCES/trcini_pisces.F90
===================================================================
--- /branches/2011/dev_r2787_LOCEAN3_TRA_TRP/NEMOGCM/NEMO/TOP_SRC/PISCES/trcini_pisces.F90	(revision 2818)
+++ /branches/2011/dev_r2787_LOCEAN3_TRA_TRP/NEMOGCM/NEMO/TOP_SRC/PISCES/trcini_pisces.F90	(revision 2819)
@@ -17,15 +17,13 @@
    !!----------------------------------------------------------------------
    USE par_trc         ! TOP parameters
-   USE sms_pisces      ! Source Minus Sink variables
-   USE trc
-   USE oce_trc         ! ocean variables
-   USE p4zche 
-   USE p4zche          ! 
-   USE p4zsink         ! 
-   USE p4zopt          ! 
-   USE p4zprod         !
-   USE p4zrem          ! 
-   USE p4zsed          ! 
-   USE p4zflx          ! 
+   USE oce_trc         !  shared variables between ocean and passive tracers
+   USE trc             !  passive tracers common variables 
+   USE sms_pisces      !  PISCES Source Minus Sink variables
+   USE p4zche          !  Chemical model
+   USE p4zsink         !  vertical flux of particulate matter due to sinking
+   USE p4zopt          !  optical model
+   USE p4zrem          !  Remineralisation of organic matter
+   USE p4zflx          !  Gas exchange
+   USE p4zsed          !  Sedimentation
 
    IMPLICIT NONE
@@ -136,11 +134,12 @@
       !! ** Purpose :   Allocate all the dynamic arrays of PISCES 
       !!----------------------------------------------------------------------
-      USE p4zint , ONLY : p4z_int_alloc      
-      USE p4zsink, ONLY : p4z_sink_alloc      
-      USE p4zopt , ONLY : p4z_opt_alloc           
-      USE p4zprod, ONLY : p4z_prod_alloc         
-      USE p4zrem , ONLY : p4z_rem_alloc           
-      USE p4zsed , ONLY : p4z_sed_alloc          
-      USE p4zflx , ONLY : p4z_flx_alloc
+      USE p4zsink , ONLY : p4z_sink_alloc      
+      USE p4zopt  , ONLY : p4z_opt_alloc           
+      USE p4zprod , ONLY : p4z_prod_alloc         
+      USE p4zmort , ONLY : p4z_mort_alloc         
+      USE p4zmicro, ONLY : p4z_micro_alloc         
+      USE p4zrem  , ONLY : p4z_rem_alloc           
+      USE p4zsed  , ONLY : p4z_sed_alloc          
+      USE p4zflx  , ONLY : p4z_flx_alloc
       !
       INTEGER :: ierr
@@ -148,12 +147,13 @@
       !
       ierr =         sms_pisces_alloc()          ! Start of PISCES-related alloc routines...
-      ierr = ierr +     p4z_che_alloc()
-      ierr = ierr +     p4z_int_alloc()
-      ierr = ierr +    p4z_sink_alloc()
-      ierr = ierr +     p4z_opt_alloc()
-      ierr = ierr +    p4z_prod_alloc()
-      ierr = ierr +     p4z_rem_alloc()
-      ierr = ierr +     p4z_sed_alloc()
-      ierr = ierr +     p4z_flx_alloc()
+      ierr = ierr +  p4z_che_alloc()
+      ierr = ierr +  p4z_sink_alloc()
+      ierr = ierr +  p4z_opt_alloc()
+      ierr = ierr +  p4z_prod_alloc()
+      ierr = ierr +  p4z_mort_alloc()
+      ierr = ierr +  p4z_micro_alloc()
+      ierr = ierr +  p4z_rem_alloc()
+      ierr = ierr +  p4z_sed_alloc()
+      ierr = ierr +  p4z_flx_alloc()
       !
       IF( lk_mpp    )   CALL mpp_sum( ierr )
Index: /branches/2011/dev_r2787_LOCEAN3_TRA_TRP/NEMOGCM/NEMO/TOP_SRC/PISCES/trcnam_pisces.F90
===================================================================
--- /branches/2011/dev_r2787_LOCEAN3_TRA_TRP/NEMOGCM/NEMO/TOP_SRC/PISCES/trcnam_pisces.F90	(revision 2818)
+++ /branches/2011/dev_r2787_LOCEAN3_TRA_TRP/NEMOGCM/NEMO/TOP_SRC/PISCES/trcnam_pisces.F90	(revision 2819)
@@ -19,4 +19,5 @@
    USE trc             ! TOP variables
    USE sms_pisces      ! sms trends
+   USE iom             ! I/O manager
 
 
@@ -46,24 +47,13 @@
       !!----------------------------------------------------------------------
       !!
-#if defined key_diatrc && ! defined key_iomput
-      INTEGER ::  jl, jn
-      ! definition of additional diagnostic as a structure
-      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_pisces_2d) :: pisdia2d
-      TYPE(DIAG) , DIMENSION(jp_pisces_3d) :: pisdia3d
-#endif
-
+      INTEGER :: jl, jn
+      TYPE(DIAG), DIMENSION(jp_pisces_2d) :: pisdia2d
+      TYPE(DIAG), DIMENSION(jp_pisces_3d) :: pisdia3d
+      !!
       NAMELIST/nampisbio/ part, nrdttrc, wsbio, xkmort, ferat3, wsbio2
 #if defined key_kriest
       NAMELIST/nampiskrp/ xkr_eta, xkr_zeta, xkr_mass_min, xkr_mass_max
 #endif
-#if defined key_diatrc && ! defined key_iomput
-      NAMELIST/nampisdia/ nn_writedia, pisdia3d, pisdia2d     ! additional diagnostics
-#endif
+      NAMELIST/nampisdia/ pisdia3d, pisdia2d     ! additional diagnostics
       NAMELIST/nampisdmp/ ln_pisdmp, ln_pisclo
 
@@ -77,8 +67,8 @@
       !                               ! Open the namelist file
       !                               ! ----------------------
-      CALL ctl_opn( numnat, 'namelist_pisces', 'OLD', 'FORMATTED', 'SEQUENTIAL', -1, numout, .FALSE. )
+      CALL ctl_opn( numnatp, 'namelist_pisces', 'OLD', 'FORMATTED', 'SEQUENTIAL', -1, numout, .FALSE. )
 
-      REWIND( numnat )                    
-      READ  ( numnat, nampisbio )
+      REWIND( numnatp )                    
+      READ  ( numnatp, nampisbio )
 
       IF(lwp) THEN                         ! control print
@@ -101,6 +91,6 @@
       xkr_mass_max = 1.      
 
-      REWIND( numnat )                     ! read natkriest
-      READ  ( numnat, nampiskrp )
+      REWIND( numnatp )                     ! read natkriest
+      READ  ( numnatp, nampiskrp )
 
       IF(lwp) THEN
@@ -120,67 +110,59 @@
 #endif
       !
-#if defined key_diatrc && ! defined key_iomput
+      IF( .NOT.lk_iomput .AND. ln_diatrc ) THEN
+         !
+         ! Namelist nampisdia
+         ! -------------------
+         DO jl = 1, jp_pisces_2d
+            WRITE(pisdia2d(jl)%sname,'("2D_",I1)') jl                      ! short name
+            WRITE(pisdia2d(jl)%lname,'("2D DIAGNOSTIC NUMBER ",I2)') jl    ! long name
+            pisdia2d(jl)%units = ' '                                       ! units
+         END DO
+         !                                 ! 3D output arrays
+         DO jl = 1, jp_pisces_3d
+            WRITE(pisdia3d(jl)%sname,'("3D_",I1)') jl                      ! short name
+            WRITE(pisdia3d(jl)%lname,'("3D DIAGNOSTIC NUMBER ",I2)') jl    ! long name
+            pisdia3d(jl)%units = ' '                                       ! units
+         END DO
 
-      ! Namelist namlobdia
-      ! -------------------
-      nn_writedia = 10                   ! default values
-
-      DO jl = 1, jp_pisces_2d
-         jn = jp_pcs0_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_pisces_3d
-         jn = jp_pcs0_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( numnat )               ! read natrtd
-      READ  ( numnat, nampisdia )
-
-      DO jl = 1, jp_pisces_2d
-         jn = jp_pcs0_2d + jl - 1
-         ctrc2d(jn) = pisdia2d(jl)%snamedia
-         ctrc2l(jn) = pisdia2d(jl)%lnamedia
-         ctrc2u(jn) = pisdia2d(jl)%unitdia
-      END DO
-
-      DO jl = 1, jp_pisces_3d
-         jn = jp_pcs0_3d + jl - 1
-         ctrc3d(jn) = pisdia3d(jl)%snamedia
-         ctrc3l(jn) = pisdia3d(jl)%lnamedia
-         ctrc3u(jn) = pisdia3d(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_pisces_3d
-            jn = jp_pcs0_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( numnatp )               ! 
+         READ  ( numnatp, nampisdia )
 
          DO jl = 1, jp_pisces_2d
             jn = jp_pcs0_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) = pisdia2d(jl)%sname
+            ctrc2l(jn) = pisdia2d(jl)%lname
+            ctrc2u(jn) = pisdia2d(jl)%units
+         END DO
+
+         DO jl = 1, jp_pisces_3d
+            jn = jp_pcs0_3d + jl - 1
+            ctrc3d(jn) = pisdia3d(jl)%sname
+            ctrc3l(jn) = pisdia3d(jl)%lname
+            ctrc3u(jn) = pisdia3d(jl)%units
+         END DO
+
+         IF(lwp) THEN                   ! control print
+            WRITE(numout,*)
+            WRITE(numout,*) ' Namelist : natadd'
+            DO jl = 1, jp_pisces_3d
+               jn = jp_pcs0_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_pisces_2d
+               jn = jp_pcs0_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
 
-      REWIND( numnat )
-      READ  ( numnat, nampisdmp )
+      REWIND( numnatp )
+      READ  ( numnatp, nampisdmp )
 
       IF(lwp) THEN                         ! control print
Index: /branches/2011/dev_r2787_LOCEAN3_TRA_TRP/NEMOGCM/NEMO/TOP_SRC/PISCES/trcrst_pisces.F90
===================================================================
--- /branches/2011/dev_r2787_LOCEAN3_TRA_TRP/NEMOGCM/NEMO/TOP_SRC/PISCES/trcrst_pisces.F90	(revision 2818)
+++ /branches/2011/dev_r2787_LOCEAN3_TRA_TRP/NEMOGCM/NEMO/TOP_SRC/PISCES/trcrst_pisces.F90	(revision 2819)
@@ -43,5 +43,5 @@
 
       !
-      IF( lk_dtatrc .AND. ln_pisclo ) CALL pis_dmp_clo  ! restoring of nutrients on close seas
+      IF( ln_trcdta .AND. ln_pisclo ) CALL pis_dmp_clo  ! restoring of nutrients on close seas
       IF( ln_pisdmp )                 CALL pis_dmp_ini  ! relaxation of some tracers
       !
@@ -53,18 +53,19 @@
          CALL iom_get( knum, jpdom_autoglo, 'PH' , hi(:,:,:)  )
       ELSE
+         hi(:,:,:) = 1.e-9 
          ! Set PH from  total alkalinity, borat (???), akb3 (???) and ak23 (???)
          ! --------------------------------------------------------
-         DO jk = 1, jpk
-            DO jj = 1, jpj
-               DO ji = 1, jpi
-                  ztmas   = tmask(ji,jj,jk)
-                  ztmas1  = 1. - tmask(ji,jj,jk)
-                  zcaralk = trn(ji,jj,jk,jptal) - borat(ji,jj,jk) / (  1. + 1.E-8 / ( rtrn + akb3(ji,jj,jk) )  )
-                  zco3    = ( zcaralk - trn(ji,jj,jk,jpdic) ) * ztmas + 0.5e-3 * ztmas1
-                  zbicarb = ( 2. * trn(ji,jj,jk,jpdic) - zcaralk )
-                  hi(ji,jj,jk) = ( ak23(ji,jj,jk) * zbicarb / zco3 ) * ztmas + 1.e-9 * ztmas1
-               END DO
-            END DO
-         END DO
+      !   DO jk = 1, jpk
+      !      DO jj = 1, jpj
+      !         DO ji = 1, jpi
+      !            ztmas   = tmask(ji,jj,jk)
+      !            ztmas1  = 1. - tmask(ji,jj,jk)
+      !            zcaralk = trn(ji,jj,jk,jptal) - borat(ji,jj,jk) / (  1. + 1.E-8 / ( rtrn + akb3(ji,jj,jk) )  )
+      !            zco3    = ( zcaralk - trn(ji,jj,jk,jpdic) ) * ztmas + 0.5e-3 * ztmas1
+      !            zbicarb = ( 2. * trn(ji,jj,jk,jpdic) - zcaralk )
+      !           hi(ji,jj,jk) = ( ak23(ji,jj,jk) * zbicarb / zco3 ) * ztmas + 1.e-9 * ztmas1
+      !         END DO
+      !      END DO
+      !   END DO
       ENDIF
       CALL iom_get( knum, jpdom_autoglo, 'Silicalim', xksi(:,:) ) 
@@ -120,15 +121,15 @@
 
          zarea   = 1. / areatot * 1.e6
-# if defined key_degrad
-         zalksum = glob_sum( trn(:,:,:,jptal) * cvol(:,:,:) * facvol(:,:,:) ) * zarea
-         zpo4sum = glob_sum( trn(:,:,:,jppo4) * cvol(:,:,:) * facvol(:,:,:) ) * zarea / 122.
-         zno3sum = glob_sum( trn(:,:,:,jpno3) * cvol(:,:,:) * facvol(:,:,:) ) * zarea / 7.6
-         zsilsum = glob_sum( trn(:,:,:,jpsil) * cvol(:,:,:) * facvol(:,:,:) ) * zarea
-# else
-         zalksum = glob_sum( trn(:,:,:,jptal) * cvol(:,:,:)  ) * zarea
-         zpo4sum = glob_sum( trn(:,:,:,jppo4) * cvol(:,:,:)  ) * zarea / 122.
-         zno3sum = glob_sum( trn(:,:,:,jpno3) * cvol(:,:,:)  ) * zarea / 7.6
-         zsilsum = glob_sum( trn(:,:,:,jpsil) * cvol(:,:,:)  ) * zarea
-# endif
+         IF( lk_degrad ) THEN
+            zalksum = glob_sum( trn(:,:,:,jptal) * cvol(:,:,:) * facvol(:,:,:) ) * zarea
+            zpo4sum = glob_sum( trn(:,:,:,jppo4) * cvol(:,:,:) * facvol(:,:,:) ) * zarea / 122.
+            zno3sum = glob_sum( trn(:,:,:,jpno3) * cvol(:,:,:) * facvol(:,:,:) ) * zarea / 7.6
+            zsilsum = glob_sum( trn(:,:,:,jpsil) * cvol(:,:,:) * facvol(:,:,:) ) * zarea
+         ELSE
+            zalksum = glob_sum( trn(:,:,:,jptal) * cvol(:,:,:)  ) * zarea
+            zpo4sum = glob_sum( trn(:,:,:,jppo4) * cvol(:,:,:)  ) * zarea / 122.
+            zno3sum = glob_sum( trn(:,:,:,jpno3) * cvol(:,:,:)  ) * zarea / 7.6
+            zsilsum = glob_sum( trn(:,:,:,jpsil) * cvol(:,:,:)  ) * zarea
+         ENDIF
 
          IF(lwp) WRITE(numout,*) '       TALK mean : ', zalksum
@@ -168,8 +169,10 @@
       !!                ictsi2(), ictsj2() : north-east Closed sea limits (i,j)
       !!----------------------------------------------------------------------
-      INTEGER, PARAMETER           ::   npicts   = 4       !: number of closed sea
-      INTEGER, DIMENSION(npicts)   ::   ictsi1, ictsj1     !: south-west closed sea limits (i,j)
-      INTEGER, DIMENSION(npicts)   ::   ictsi2, ictsj2     !: north-east closed sea limits (i,j)
-      INTEGER :: ji, jj, jk, jn, jc            ! dummy loop indices
+      INTEGER, PARAMETER           ::   npicts   = 4        ! number of closed sea
+      INTEGER, DIMENSION(npicts)   ::   ictsi1, ictsj1      ! south-west closed sea limits (i,j)
+      INTEGER, DIMENSION(npicts)   ::   ictsi2, ictsj2      ! north-east closed sea limits (i,j)
+      INTEGER :: ji, jj, jk, jn, jl, jc                     ! dummy loop indices
+      INTEGER :: ierr                                       ! local integer
+      REAL(wp), ALLOCATABLE, DIMENSION(:,:,:,:) ::  ztrcdta ! 4D  workspace
       !!----------------------------------------------------------------------
 
@@ -243,23 +246,31 @@
       END DO
 
-#if defined key_dtatrc
       ! Restore close seas values to initial data
-      CALL trc_dta( nit000 ) 
-      DO jn = 1, jptra
-         IF( lutini(jn) ) THEN
-            DO jc = 1, npicts
-               DO jk = 1, jpkm1
-                  DO jj = ictsj1(jc), ictsj2(jc)
-                     DO ji = ictsi1(jc), ictsi2(jc)
-                        trn(ji,jj,jk,jn) = trdta(ji,jj,jk,jn) * tmask(ji,jj,jk) 
-                        trb(ji,jj,jk,jn) = trn(ji,jj,jk,jn)
-                     ENDDO
-                  ENDDO
-               ENDDO
-            ENDDO
-         ENDIF
-      ENDDO
-#endif
-   !
+      IF( nb_trcdta > 0 ) THEN  ! Initialisation of tracer from a file that may also be used for damping
+        ALLOCATE( ztrcdta(jpi,jpj,jpk,nb_trcdta), STAT=ierr )
+        IF( ierr > 0 ) THEN
+           CALL ctl_stop( 'trc_ini: unable to allocate ztrcdta array' )   ;   RETURN
+        ENDIF
+        !
+        CALL trc_dta( nit000, ztrcdta )   ! read tracer data at nit000
+        !
+        DO jn = 1, jptra
+           IF( ln_trc_ini(jn) ) THEN      ! update passive tracers arrays with input data read from file
+              jl = n_trc_index(jn)
+              DO jc = 1, npicts
+                 DO jk = 1, jpkm1
+                    DO jj = ictsj1(jc), ictsj2(jc)
+                       DO ji = ictsi1(jc), ictsi2(jc)
+                          trn(ji,jj,jk,jn) = ztrcdta(ji,jj,jk,jl) * tmask(ji,jj,jk) 
+                          trb(ji,jj,jk,jn) = trn(ji,jj,jk,jn)
+                       ENDDO
+                    ENDDO
+                 ENDDO
+              ENDDO
+           ENDIF
+        ENDDO
+        DEALLOCATE( ztrcdta )
+      ENDIF
+      !
    END SUBROUTINE pis_dmp_clo
 
Index: /branches/2011/dev_r2787_LOCEAN3_TRA_TRP/NEMOGCM/NEMO/TOP_SRC/PISCES/trcsms_pisces.F90
===================================================================
--- /branches/2011/dev_r2787_LOCEAN3_TRA_TRP/NEMOGCM/NEMO/TOP_SRC/PISCES/trcsms_pisces.F90	(revision 2818)
+++ /branches/2011/dev_r2787_LOCEAN3_TRA_TRP/NEMOGCM/NEMO/TOP_SRC/PISCES/trcsms_pisces.F90	(revision 2819)
@@ -13,29 +13,25 @@
    !!   trcsms_pisces        :  Time loop of passive tracers sms
    !!----------------------------------------------------------------------
-   USE oce_trc         !
-   USE trc
-   USE sms_pisces
-   
-   USE p4zint          ! 
-   USE p4zche          ! 
-   USE p4zbio          ! 
-   USE p4zsink         ! 
-   USE p4zopt          ! 
-   USE p4zlim          ! 
-   USE p4zprod         !
-   USE p4zmort         !
-   USE p4zmicro        ! 
-   USE p4zmeso         ! 
-   USE p4zrem          ! 
-   USE p4zsed          ! 
-   USE p4zlys          ! 
-   USE p4zflx          ! 
-
-   USE prtctl_trc
-
-   USE trdmod_oce
-   USE trdmod_trc
-
-   USE sedmodel
+   USE oce_trc         !  shared variables between ocean and passive tracers
+   USE trc             !  passive tracers common variables 
+   USE sms_pisces      !  PISCES Source Minus Sink variables
+   USE p4zbio          !  Biological model
+   USE p4zche          !  Chemical model
+   USE p4zsink         !  vertical flux of particulate matter due to sinking
+   USE p4zopt          !  optical model
+   USE p4zlim          !  Co-limitations of differents nutrients
+   USE p4zprod         !  Growth rate of the 2 phyto groups
+   USE p4zmort         !  Mortality terms for phytoplankton
+   USE p4zmicro        !  Sources and sinks of microzooplankton
+   USE p4zmeso         !  Sources and sinks of mesozooplankton
+   USE p4zrem          !  Remineralisation of organic matter
+   USE p4zlys          !  Calcite saturation
+   USE p4zflx          !  Gas exchange
+   USE p4zsed          !  Sedimentation
+   USE p4zint          !  time interpolation
+   USE trdmod_oce      !  Ocean trends variables
+   USE trdmod_trc      !  TOP trends variables
+   USE sedmodel        !  Sediment model
+   USE prtctl_trc      !  print control for debugging
 
    IMPLICIT NONE
@@ -64,5 +60,4 @@
       !!---------------------------------------------------------------------
       USE wrk_nemo, ONLY: wrk_in_use, wrk_not_released
-      USE wrk_nemo, ONLY: ztrpis => wrk_3d_1   ! used for pisces sms trends
       !
       INTEGER, INTENT( in ) ::   kt      ! ocean time-step index      
@@ -74,8 +69,4 @@
       IF( kt == nit000 )   CALL trc_sms_pisces_init    ! Initialization (first time-step only)
 
-      IF( wrk_in_use(3,1) )  THEN
-        CALL ctl_stop('trc_sms_pisces : requested workspace array unavailable.')  ;  RETURN
-      ENDIF
-
       IF( ndayflxtr /= nday_year ) THEN      ! New days
          !
@@ -86,6 +77,6 @@
          IF(lwp) write(numout,*) '~~~~~~'
 
-         CALL p4z_che          ! computation of chemical constants
-         CALL p4z_int          ! computation of various rates for biogeochemistry
+         CALL p4z_che              ! computation of chemical constants
+         CALL p4z_int              ! computation of various rates for biogeochemistry
          !
       ENDIF
@@ -112,8 +103,6 @@
       IF( l_trdtrc ) THEN
           DO jn = jp_pcs0, jp_pcs1
-            ztrpis(:,:,:) = tra(:,:,:,jn)
-            CALL trd_mod_trc( ztrpis, jn, jptra_trd_sms, kt )   ! save trends
+            CALL trd_mod_trc( tra(:,:,:,jn), jn, jptra_trd_sms, kt )   ! save trends
           END DO
-          DEALLOCATE( ztrpis )
       END IF
 
@@ -127,7 +116,5 @@
          !
       ENDIF
-
-      IF( wrk_not_released(3,1) ) CALL ctl_stop('trc_sms_pisces : failed to release workspace array.') 
-
+      !
    END SUBROUTINE trc_sms_pisces
 
@@ -164,15 +151,15 @@
       xstep = rfact2 / rday
 
-      CALL p4z_sink_init      ! vertical flux of particulate organic matter
-      CALL p4z_opt_init       ! Optic: PAR in the water column
-      CALL p4z_lim_init       ! co-limitations by the various nutrients
-      CALL p4z_prod_init      ! phytoplankton growth rate over the global ocean. 
-      CALL p4z_rem_init       ! remineralisation
-      CALL p4z_mort_init      ! phytoplankton mortality
-      CALL p4z_micro_init     ! microzooplankton
-      CALL p4z_meso_init      ! mesozooplankton
-      CALL p4z_sed_init       ! sedimentation
-      CALL p4z_lys_init       ! calcite saturation
-      CALL p4z_flx_init       ! gas exchange
+      CALL p4z_sink_init      !  vertical flux of particulate organic matter
+      CALL p4z_opt_init       !  Optic: PAR in the water column
+      CALL p4z_lim_init       !  co-limitations by the various nutrients
+      CALL p4z_prod_init      !  phytoplankton growth rate over the global ocean. 
+      CALL p4z_rem_init       !  remineralisation
+      CALL p4z_mort_init      !  phytoplankton mortality
+      CALL p4z_micro_init     !  microzooplankton
+      CALL p4z_meso_init      !  mesozooplankton
+      CALL p4z_sed_init       !  sedimentation
+      CALL p4z_lys_init       !  calcite saturation
+      CALL p4z_flx_init       !  gas exchange
 
       ndayflxtr = 0
Index: /branches/2011/dev_r2787_LOCEAN3_TRA_TRP/NEMOGCM/NEMO/TOP_SRC/TRP/trcldf.F90
===================================================================
--- /branches/2011/dev_r2787_LOCEAN3_TRA_TRP/NEMOGCM/NEMO/TOP_SRC/TRP/trcldf.F90	(revision 2818)
+++ /branches/2011/dev_r2787_LOCEAN3_TRA_TRP/NEMOGCM/NEMO/TOP_SRC/TRP/trcldf.F90	(revision 2819)
@@ -18,5 +18,4 @@
    USE trc             ! ocean passive tracers variables
    USE trcnam_trp      ! passive tracers transport namelist variables
-   USE ldftra_oce      ! lateral diffusion coefficient on tracers
    USE ldfslp          ! ???
    USE traldf_bilapg   ! lateral mixing            (tra_ldf_bilapg routine)
@@ -33,5 +32,6 @@
    PUBLIC   trc_ldf    ! called by step.F90 
    !                                                 !!: ** lateral mixing namelist (nam_trcldf) **
-   INTEGER ::   nldf = 0   ! type of lateral diffusion used defined from ln_trcldf_... namlist logicals)
+   REAL(wp) ::  rldf_rat    ! ratio between active and passive tracers diffusive coefficient
+   INTEGER  ::  nldf = 0   ! type of lateral diffusion used defined from ln_trcldf_... namlist logicals)
    !! * Substitutions
 #  include "domzgr_substitute.h90"
@@ -61,4 +61,6 @@
       IF( kt == nit000 )   CALL ldf_ctl          ! initialisation & control of options
 
+      rldf = rldf_rat
+
       IF( l_trdtrc )  THEN 
          ALLOCATE( ztrtrd(jpi,jpj,jpk,jptra) )  ! temporary save of trends
@@ -67,20 +69,20 @@
 
       SELECT CASE ( nldf )                       ! compute lateral mixing trend and add it to the general trend
-      CASE ( 0 )   ;   CALL tra_ldf_lap   ( kt, 'TRC', gtru, gtrv, trb, tra, jptra            )  ! iso-level laplacian
-      CASE ( 1 )   ;   CALL tra_ldf_iso   ( kt, 'TRC', gtru, gtrv, trb, tra, jptra, rn_ahtb_0 )  ! rotated laplacian 
-      CASE ( 2 )   ;   CALL tra_ldf_bilap ( kt, 'TRC', gtru, gtrv, trb, tra, jptra            )  ! iso-level bilaplacian
-      CASE ( 3 )   ;   CALL tra_ldf_bilapg( kt, 'TRC',             trb, tra, jptra            )  ! s-coord. horizontal bilaplacian
+      CASE ( 0 )   ;   CALL tra_ldf_lap   ( kt, 'TRC', gtru, gtrv, trb, tra, jptra             )  ! iso-level laplacian
+      CASE ( 1 )   ;   CALL tra_ldf_iso   ( kt, 'TRC', gtru, gtrv, trb, tra, jptra, rn_ahtrb_0 )  ! rotated laplacian 
+      CASE ( 2 )   ;   CALL tra_ldf_bilap ( kt, 'TRC', gtru, gtrv, trb, tra, jptra             )  ! iso-level bilaplacian
+      CASE ( 3 )   ;   CALL tra_ldf_bilapg( kt, 'TRC',             trb, tra, jptra             )  ! s-coord. horizontal bilaplacian
          !
       CASE ( -1 )                                     ! esopa: test all possibility with control print
-         CALL tra_ldf_lap   ( kt, 'TRC', gtru, gtrv, trb, tra, jptra            )
+         CALL tra_ldf_lap   ( kt, 'TRC', gtru, gtrv, trb, tra, jptra             )
          WRITE(charout, FMT="('ldf0 ')") ;  CALL prt_ctl_trc_info(charout)
                                             CALL prt_ctl_trc( tab4d=tra, mask=tmask, clinfo=ctrcnm, clinfo2='trd' )
-         CALL tra_ldf_iso   ( kt, 'TRC', gtru, gtrv, trb, tra, jptra, rn_ahtb_0 )
+         CALL tra_ldf_iso   ( kt, 'TRC', gtru, gtrv, trb, tra, jptra, rn_ahtrb_0 )
          WRITE(charout, FMT="('ldf1 ')") ;  CALL prt_ctl_trc_info(charout)
                                             CALL prt_ctl_trc( tab4d=tra, mask=tmask, clinfo=ctrcnm, clinfo2='trd' )
-         CALL tra_ldf_bilap ( kt, 'TRC', gtru, gtrv, trb, tra, jptra            )
+         CALL tra_ldf_bilap ( kt, 'TRC', gtru, gtrv, trb, tra, jptra             )
          WRITE(charout, FMT="('ldf2 ')") ;  CALL prt_ctl_trc_info(charout)
                                             CALL prt_ctl_trc( tab4d=tra, mask=tmask, clinfo=ctrcnm, clinfo2='trd' )
-         CALL tra_ldf_bilapg( kt, 'TRC',             trb, tra, jptra            )
+         CALL tra_ldf_bilapg( kt, 'TRC',             trb, tra, jptra             )
          WRITE(charout, FMT="('ldf3 ')") ;  CALL prt_ctl_trc_info(charout)
                                             CALL prt_ctl_trc( tab4d=tra, mask=tmask, clinfo=ctrcnm, clinfo2='trd' )
@@ -119,4 +121,6 @@
       INTEGER ::   ioptio, ierr         ! temporary integers 
       !!----------------------------------------------------------------------
+
+      rldf_rat = rn_ahtrc_0 / rn_aht_0
 
       !  Define the lateral mixing oparator for tracers
@@ -206,4 +210,21 @@
       ENDIF
 
+      IF( ln_trcldf_bilap ) THEN
+         IF(lwp) WRITE(numout,*) '          biharmonic tracer diffusion'
+         IF( rn_ahtrc_0 > 0 .AND. .NOT. lk_esopa )   CALL ctl_stop( 'The horizontal diffusivity coef. rn_ahtrc_0 must be negative' )
+      ELSE
+         IF(lwp) WRITE(numout,*) '          harmonic tracer diffusion (default)'
+         IF( rn_ahtrc_0 < 0 .AND. .NOT. lk_esopa )   CALL ctl_stop('The horizontal diffusivity coef. rn_ahtrc_0 must be positive' )
+      ENDIF
+
+      ! ratio between active and passive tracers diffusive coef.
+      rldf_rat = rn_ahtrc_0 / rn_aht_0
+      IF( rldf_rat < 0 ) THEN
+         IF( .NOT.lk_offline ) THEN 
+            CALL ctl_stop( 'Choose the same type of diffusive scheme both for active & passive tracers' )
+         ELSE
+            CALL ctl_stop( 'Change the sign of rn_aht_0 in namelist to -/+1' )
+         ENDIF 
+      ENDIF
       !
    END SUBROUTINE ldf_ctl
Index: /branches/2011/dev_r2787_LOCEAN3_TRA_TRP/NEMOGCM/NEMO/TOP_SRC/TRP/trcnam_trp.F90
===================================================================
--- /branches/2011/dev_r2787_LOCEAN3_TRA_TRP/NEMOGCM/NEMO/TOP_SRC/TRP/trcnam_trp.F90	(revision 2818)
+++ /branches/2011/dev_r2787_LOCEAN3_TRA_TRP/NEMOGCM/NEMO/TOP_SRC/TRP/trcnam_trp.F90	(revision 2819)
@@ -36,4 +36,5 @@
    LOGICAL , PUBLIC ::   ln_trcldf_hor   = .FALSE.    !: horizontal (geopotential) direction
    LOGICAL , PUBLIC ::   ln_trcldf_iso   = .TRUE.     !: iso-neutral direction
+   REAL(wp), PUBLIC ::   rn_ahtrc_0                   !: diffusivity coefficient for passive tracer (m2/s)
    REAL(wp), PUBLIC ::   rn_ahtrb_0                   !: background diffusivity coefficient for passive tracer (m2/s)
 
@@ -76,5 +77,5 @@
       NAMELIST/namtrc_ldf/ ln_trcldf_diff , ln_trcldf_lap  ,     &
          &                 ln_trcldf_bilap, ln_trcldf_level,     &
-         &                 ln_trcldf_hor  , ln_trcldf_iso  , rn_ahtrb_0
+         &                 ln_trcldf_hor  , ln_trcldf_iso  , rn_ahtrc_0, rn_ahtrb_0
       NAMELIST/namtrc_zdf/ ln_trczdf_exp  , nn_trczdf_exp
       NAMELIST/namtrc_rad/ ln_trcrad
@@ -119,4 +120,5 @@
          WRITE(numout,*) '      horizontal (geopotential)                          ln_trcldf_hor   = ', ln_trcldf_hor
          WRITE(numout,*) '      iso-neutral                                        ln_trcldf_iso   = ', ln_trcldf_iso
+         WRITE(numout,*) '      diffusivity coefficient                                 rn_ahtrc_0 = ', rn_ahtrc_0
          WRITE(numout,*) '      background hor. diffusivity                             rn_ahtrb_0 = ', rn_ahtrb_0
       ENDIF
Index: /branches/2011/dev_r2787_LOCEAN3_TRA_TRP/NEMOGCM/NEMO/TOP_SRC/oce_trc.F90
===================================================================
--- /branches/2011/dev_r2787_LOCEAN3_TRA_TRP/NEMOGCM/NEMO/TOP_SRC/oce_trc.F90	(revision 2818)
+++ /branches/2011/dev_r2787_LOCEAN3_TRA_TRP/NEMOGCM/NEMO/TOP_SRC/oce_trc.F90	(revision 2819)
@@ -196,8 +196,4 @@
    USE oce , ONLY :   gru     =>    gru     !:
    USE oce , ONLY :   grv     =>    grv     !: 
-# if defined key_degrad
-   USE dommsk , ONLY :   facvol     =>   facvol     !: volume factor for degradation
-# endif
-
 #endif
 
@@ -224,19 +220,22 @@
 
    !* lateral diffusivity (tracers) *
-   USE ldftra_oce , ONLY :   aht0    =>   aht0     !: horizontal eddy diffusivity for tracers (m2/s)
-   USE ldftra_oce , ONLY :   ahtb0   =>   ahtb0    !: background eddy diffusivity for isopycnal diff. (m2/s)
-   USE ldftra_oce , ONLY :   ahtu    =>   ahtu     !: lateral diffusivity coef. at u-points 
-   USE ldftra_oce , ONLY :   ahtv    =>   ahtv     !: lateral diffusivity coef. at v-points 
-   USE ldftra_oce , ONLY :   ahtw    =>   ahtw     !: lateral diffusivity coef. at w-points 
-   USE ldftra_oce , ONLY :   ahtt    =>   ahtt     !: lateral diffusivity coef. at t-points
-   USE ldftra_oce , ONLY :   aeiv0   =>   aeiv0    !: eddy induced velocity coefficient (m2/s) 
-   USE ldftra_oce , ONLY :   aeiu    =>   aeiu     !: eddy induced velocity coef. at u-points (m2/s)   
-   USE ldftra_oce , ONLY :   aeiv    =>   aeiv     !: eddy induced velocity coef. at v-points (m2/s) 
-   USE ldftra_oce , ONLY :   aeiw    =>   aeiw     !: eddy induced velocity coef. at w-points (m2/s) 
+   USE ldftra_oce , ONLY :  rldf     =>   rldf        !: multiplicative coef. for lateral diffusivity
+   USE ldftra_oce , ONLY :  rn_aht_0 =>   rn_aht_0    !: horizontal eddy diffusivity for tracers (m2/s)
+   USE ldftra_oce , ONLY :  aht0     =>   aht0        !: horizontal eddy diffusivity for tracers (m2/s)
+   USE ldftra_oce , ONLY :  ahtb0    =>   ahtb0       !: background eddy diffusivity for isopycnal diff. (m2/s)
+   USE ldftra_oce , ONLY :  ahtu     =>   ahtu        !: lateral diffusivity coef. at u-points 
+   USE ldftra_oce , ONLY :  ahtv     =>   ahtv        !: lateral diffusivity coef. at v-points 
+   USE ldftra_oce , ONLY :  ahtw     =>   ahtw        !: lateral diffusivity coef. at w-points 
+   USE ldftra_oce , ONLY :  ahtt     =>   ahtt        !: lateral diffusivity coef. at t-points
+   USE ldftra_oce , ONLY :  aeiv0    =>   aeiv0       !: eddy induced velocity coefficient (m2/s) 
+   USE ldftra_oce , ONLY :  aeiu     =>   aeiu        !: eddy induced velocity coef. at u-points (m2/s)   
+   USE ldftra_oce , ONLY :  aeiv     =>   aeiv        !: eddy induced velocity coef. at v-points (m2/s) 
+   USE ldftra_oce , ONLY :  aeiw     =>   aeiw        !: eddy induced velocity coef. at w-points (m2/s) 
+   USE ldftra_oce , ONLY :  lk_traldf_eiv  =>  lk_traldf_eiv     !: eddy induced velocity flag
 
    !* vertical diffusion *
    USE zdf_oce , ONLY :   avt        =>   avt         !: vert. diffusivity coef. at w-point for temp  
 # if defined key_zdfddm
-   USE zdfddm  , ONLY :   avs        =>   avs        !: salinity vertical diffusivity coeff. at w-point
+   USE zdfddm  , ONLY :   avs        =>   avs         !: salinity vertical diffusivity coeff. at w-point
 # endif
 
Index: /branches/2011/dev_r2787_LOCEAN3_TRA_TRP/NEMOGCM/NEMO/TOP_SRC/trc.F90
===================================================================
--- /branches/2011/dev_r2787_LOCEAN3_TRA_TRP/NEMOGCM/NEMO/TOP_SRC/trc.F90	(revision 2818)
+++ /branches/2011/dev_r2787_LOCEAN3_TRA_TRP/NEMOGCM/NEMO/TOP_SRC/trc.F90	(revision 2819)
@@ -21,81 +21,79 @@
    PUBLIC   trc_alloc   ! called by nemogcm.F90
 
-   !! passive tracers names and units (read in namelist)
-   !! --------------------------------------------------
-   CHARACTER(len=12), PUBLIC, DIMENSION(jptra) ::   ctrcnm     !: tracer name 
-   CHARACTER(len=12), PUBLIC, DIMENSION(jptra) ::   ctrcun     !: tracer unit
-   CHARACTER(len=80), PUBLIC, DIMENSION(jptra) ::   ctrcnl     !: tracer long name 
-   
-   
    !! parameters for the control of passive tracers
    !! --------------------------------------------------
-   INTEGER, PUBLIC                   ::   numnat   !: the number of the passive tracer NAMELIST
-   LOGICAL, PUBLIC, DIMENSION(jptra) ::   lutini   !:  initialisation from FILE or not (NAMELIST)
-   LOGICAL, PUBLIC, DIMENSION(jptra) ::   lutsav   !:  save the tracer or not
+   INTEGER, PUBLIC                                                 ::   numnat        !: the number of the passive tracer NAMELIST
 
    !! passive tracers fields (before,now,after)
    !! --------------------------------------------------
-   REAL(wp), PUBLIC ::   trai                          !: initial total tracer
-   REAL(wp), PUBLIC ::   areatot                       !: total volume 
-   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION (:,:,:)   ::   cvol   !: volume correction -degrad option- 
-   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION (:,:,:,:) ::   trn    !: traceur concentration for now time step
-   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION (:,:,:,:) ::   tra    !: traceur concentration for next time step
-   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION (:,:,:,:) ::   trb    !: traceur concentration for before time step
+   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:)               ::  trai           !: initial total tracer
+   REAL(wp), PUBLIC                                                ::  areatot        !: total volume 
+   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:  )         ::  cvol           !: volume correction -degrad option- 
+   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:,:)         ::  trn            !: traceur concentration for now time step
+   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:,:)         ::  tra            !: traceur concentration for next time step
+   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:,:)         ::  trb            !: traceur concentration for before time step
 
    !! interpolated gradient
    !!--------------------------------------------------  
-   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION (:,:,:) ::   gtru   !: hor. gradient at u-points at bottom ocean level
-   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION (:,:,:) ::   gtrv   !: hor. gradient at v-points at bottom ocean level
+   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:)           ::  gtru           !: hor. gradient at u-points at bottom ocean level
+   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:)           ::  gtrv           !: hor. gradient at v-points at bottom ocean level
    
-   !! passive tracers restart (input and output)
+   !! passive tracers  (input and output)
    !! ------------------------------------------  
-   LOGICAL          , PUBLIC ::  ln_rsttr        !: boolean term for restart i/o for passive tracers (namelist)
-   LOGICAL          , PUBLIC ::  lrst_trc        !: logical to control the trc restart write
-   INTEGER          , PUBLIC ::  nn_dttrc        !: frequency of step on passive tracers
-   INTEGER          , PUBLIC ::  nutwrs          !: output FILE for passive tracers restart
-   INTEGER          , PUBLIC ::  nutrst          !: logical unit for restart FILE for passive tracers
-   INTEGER          , PUBLIC ::  nn_rsttr        !: control of the time step ( 0 or 1 ) for pass. tr.
-   CHARACTER(len=50), PUBLIC ::  cn_trcrst_in    !: suffix of pass. tracer restart name (input)
-   CHARACTER(len=50), PUBLIC ::  cn_trcrst_out   !: suffix of pass. tracer restart name (output)
-   
+   LOGICAL             , PUBLIC                                    ::  ln_rsttr       !: boolean term for restart i/o for passive tracers (namelist)
+   LOGICAL             , PUBLIC                                    ::  lrst_trc       !: logical to control the trc restart write
+   INTEGER             , PUBLIC                                    ::  nn_dttrc       !: frequency of step on passive tracers
+   INTEGER             , PUBLIC                                    ::  nn_writetrc    !: time step frequency for concentration outputs (namelist)
+   INTEGER             , PUBLIC                                    ::  nutwrs         !: output FILE for passive tracers restart
+   INTEGER             , PUBLIC                                    ::  nutrst         !: logical unit for restart FILE for passive tracers
+   INTEGER             , PUBLIC                                    ::  nn_rsttr       !: control of the time step ( 0 or 1 ) for pass. tr.
+   CHARACTER(len = 80) , PUBLIC                                    ::  cn_trcrst_in   !: suffix of pass. tracer restart name (input)
+   CHARACTER(len = 80) , PUBLIC                                    ::  cn_trcrst_out  !: suffix of pass. tracer restart name (output)
+   REAL(wp)            , PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:)   ::  rdttrc         !: vertical profile of passive tracer time step
+   LOGICAL             , PUBLIC                                    ::  ln_trcdta      !: Read inputs data from files
+   LOGICAL             , PUBLIC                                    ::  ln_trcdmp      !: internal damping flag
+
    !! information for outputs
    !! --------------------------------------------------
-   INTEGER , PUBLIC ::   nn_writetrc   !: time step frequency for concentration outputs (namelist)
-   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:) ::   rdttrc        !: vertical profile of passive tracer time step
-   
-# if defined key_diatrc && ! defined key_iomput
+   TYPE, PUBLIC :: PTRACER                                                            !: Passive tracer type
+       CHARACTER(len = 20)  :: clsname  !: short name
+       CHARACTER(len = 80)  :: cllname  !: long name
+       CHARACTER(len = 20)  :: clunit   !: unit
+       LOGICAL              :: llinit   !: read in a file or not
+       LOGICAL              :: llsave   !: save the tracer or not
+   END TYPE PTRACER
+   CHARACTER(len = 20), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:)    ::  ctrcnm         !: tracer name 
+   CHARACTER(len = 80), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:)    ::  ctrcln         !: trccer field long name
+   CHARACTER(len = 20), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:)    ::  ctrcun         !: tracer unit
+   LOGICAL            , PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:)    ::  ln_trc_ini     !: Initialisation from data input file
+   LOGICAL            , PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:)    ::  ln_trc_wri     !: save the tracer or not
+
+   TYPE, PUBLIC :: DIAG                                                               !: passive trcacer ddditional diagnostic type
+      CHARACTER(len = 20)  :: sname    !: short name
+      CHARACTER(len = 80)  :: lname    !: long name
+      CHARACTER(len = 20)  :: units    !: unit
+   END TYPE DIAG
+
    !! additional 2D/3D outputs namelist
    !! --------------------------------------------------
-   INTEGER         , PUBLIC                      ::   nn_writedia   !: frequency of additional arrays outputs(namelist)
-   CHARACTER(len= 8), PUBLIC, DIMENSION(jpdia2d) ::   ctrc2d      !: 2d output field name
-   CHARACTER(len= 8), PUBLIC, DIMENSION(jpdia2d) ::   ctrc2u      !: 2d output field unit   
-   CHARACTER(len= 8), PUBLIC, DIMENSION(jpdia3d) ::   ctrc3d      !: 3d output field name
-   CHARACTER(len= 8), PUBLIC, DIMENSION(jpdia3d) ::   ctrc3u      !: 3d output field unit
-   CHARACTER(len=80), PUBLIC, DIMENSION(jpdia2d) ::   ctrc2l      !: 2d output field long name
-   CHARACTER(len=80), PUBLIC, DIMENSION(jpdia3d) ::   ctrc3l      !: 3d output field long name
+   REAL(wp)           , PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,  :) ::   trc2d         !: additional 2d outputs array 
+   REAL(wp)           , PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:,:) ::   trc3d         !: additional 3d outputs array 
+   CHARACTER(len = 20), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:)       ::   ctrc2d        !: 2d field short name
+   CHARACTER(len = 80), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:)       ::   ctrc2l        !: 2d field long name
+   CHARACTER(len = 20), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:)       ::   ctrc2u        !: 2d field unit
+   CHARACTER(len = 20), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:)       ::   ctrc3d        !: 3d field short name
+   CHARACTER(len = 80), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:)       ::   ctrc3l        !: 3d field long name
+   CHARACTER(len = 20), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:)       ::   ctrc3u        !: 3d field unit
+   LOGICAL            , PUBLIC                                        ::  ln_diatrc      !: boolean term for additional diagnostic
+   INTEGER            , PUBLIC                                        ::  nn_writedia    !: frequency of additional outputs
 
-   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,  :) ::   trc2d    !:  additional 2d outputs  
-   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:,:) ::   trc3d    !:  additional 3d outputs  
-# endif
-
-# if defined key_diabio || defined key_trdmld_trc
-   !                                                              !!*  namtop_XXX namelist *
-   INTEGER , PUBLIC                               ::   nn_writebio   !: time step frequency for biological outputs 
-   CHARACTER(len=8 ), PUBLIC, DIMENSION(jpdiabio) ::   ctrbio      !: biological trends name      
-   CHARACTER(len=20), PUBLIC, DIMENSION(jpdiabio) ::   ctrbiu      !: biological trends unit   
-   CHARACTER(len=80), PUBLIC, DIMENSION(jpdiabio) ::   ctrbil      !: biological trends long name
-# endif
-# if defined key_diabio
    !! Biological trends
    !! -----------------
-   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:,:) ::   trbio   !: biological trends
-# endif
-
-   
-   !! passive tracers data read and at given time_step
-   !! --------------------------------------------------
-# if defined key_dtatrc
-   INTEGER , PUBLIC, DIMENSION(jptra) ::   numtr   !: logical unit for passive tracers data
-# endif
+   LOGICAL            , PUBLIC                                        ::  ln_diabio      !: boolean term for biological diagnostic
+   INTEGER            , PUBLIC                                        ::  nn_writebio    !: frequency of biological outputs
+   REAL(wp)           , PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:,:) ::  trbio          !: biological trends
+   CHARACTER(len = 20), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:)       ::  ctrbio         !: bio field short name
+   CHARACTER(len = 80), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:)       ::  ctrbil         !: bio field long name
+   CHARACTER(len = 20), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:)       ::  ctrbiu         !: bio field unit
 
    !!----------------------------------------------------------------------
@@ -113,16 +111,9 @@
       !!-------------------------------------------------------------------
       !
-      ALLOCATE( cvol(jpi,jpj,jpk      ) ,                           &
-         &      trn (jpi,jpj,jpk,jptra) ,                           &
-         &      tra (jpi,jpj,jpk,jptra) ,                           &
-         &      trb (jpi,jpj,jpk,jptra) ,                           &
-         &      gtru(jpi,jpj    ,jptra) , gtrv(jpi,jpj,jptra) ,     &
-# if defined key_diatrc && ! defined key_iomput
-         &      trc2d(jpi,jpj,jpdia2d), trc3d(jpi,jpj,jpk,jpdia3d), &
-# endif
-# if defined key_diabio
-         &      trbio(jpi,jpj,jpk,jpdiabio),                        &
-#endif
-               rdttrc(jpk) ,  STAT=trc_alloc )      
+      ALLOCATE( trn(jpi,jpj,jpk,jptra), trb(jpi,jpj,jpk,jptra), tra(jpi,jpj,jpk,jptra),       &  
+         &      gtru(jpi,jpj,jpk)     , gtrv(jpi,jpj,jpk)                             ,       &
+         &      cvol(jpi,jpj,jpk)     , rdttrc(jpk)           , trai(jptra)           ,       &
+         &      ctrcnm(jptra)         , ctrcln(jptra)         , ctrcun(jptra)         ,       & 
+         &      ln_trc_ini(jptra)     , ln_trc_wri(jptra)                             ,  STAT = trc_alloc  )  
 
       IF( trc_alloc /= 0 )   CALL ctl_warn('trc_alloc: failed to allocate arrays')
Index: /branches/2011/dev_r2787_LOCEAN3_TRA_TRP/NEMOGCM/NEMO/TOP_SRC/trcdia.F90
===================================================================
--- /branches/2011/dev_r2787_LOCEAN3_TRA_TRP/NEMOGCM/NEMO/TOP_SRC/trcdia.F90	(revision 2818)
+++ /branches/2011/dev_r2787_LOCEAN3_TRA_TRP/NEMOGCM/NEMO/TOP_SRC/trcdia.F90	(revision 2819)
@@ -11,5 +11,5 @@
    !!                  !  2008-05 (C. Ethe re-organization)
    !!----------------------------------------------------------------------
-#if defined key_top && ! defined key_iomput
+#if defined key_top 
    !!----------------------------------------------------------------------
    !!   'key_top'                                                TOP models
@@ -25,5 +25,7 @@
    USE par_trc
    USE dianam    ! build name of file (routine)
-   USE ioipsl
+   USE ioipsl    ! I/O manager
+   USE iom       ! I/O manager
+   USE lib_mpp   ! MPP library
 
    IMPLICIT NONE
@@ -31,5 +33,4 @@
 
    PUBLIC   trc_dia        ! called by XXX module 
-   PUBLIC   trc_dia_alloc  ! called by nemogcm.F90
 
    INTEGER  ::   nit5      !: id for tracer output file
@@ -41,14 +42,12 @@
    INTEGER , ALLOCATABLE, SAVE, DIMENSION (:) ::   ndext50   !: integer arrays for ocean 3D index
    INTEGER , ALLOCATABLE, SAVE, DIMENSION (:) ::   ndext51   !: integer arrays for ocean surface index
-# if defined key_diatrc
+
    INTEGER  ::   nitd      !: id for additional array output file
    INTEGER  ::   ndepitd   !: id for depth mesh
    INTEGER  ::   nhoritd   !: id for horizontal mesh
-# endif
-# if defined key_diabio
+
    INTEGER  ::   nitb        !:         id.         for additional array output file
    INTEGER  ::   ndepitb   !:  id for depth mesh
    INTEGER  ::   nhoritb   !:  id for horizontal mesh
-# endif
 
    !! * Substitutions
@@ -67,12 +66,21 @@
       !! ** Purpose :   output passive tracers fields 
       !!---------------------------------------------------------------------
-      INTEGER, INTENT(in) ::   kt   ! ocean time-step
-      !
-      INTEGER ::   kindic   ! local integer
+      INTEGER, INTENT(in) ::   kt             ! ocean time-step
+      !
+      INTEGER             ::  ierr,  kindic   ! local integer
       !!---------------------------------------------------------------------
       !
-      CALL trcdit_wr( kt, kindic )      ! outputs for tracer concentration
-      CALL trcdii_wr( kt, kindic )      ! outputs for additional arrays
-      CALL trcdib_wr( kt, kindic )      ! outputs for biological trends
+      IF( kt == nit000 )  THEN
+         ALLOCATE( ndext50(jpij*jpk), ndext51(jpij), STAT=ierr )
+         IF( ierr > 0 ) THEN
+            CALL ctl_stop( 'STOP', 'trc_diat: unable to allocate arrays' )  ;   RETURN
+         ENDIF
+      ENDIF
+      !
+      IF( .NOT.lk_iomput ) THEN
+                          CALL trcdit_wr( kt, kindic )      ! outputs for tracer concentration
+         IF( ln_diatrc )  CALL trcdii_wr( kt, kindic )      ! outputs for additional arrays
+         IF( ln_diabio )  CALL trcdib_wr( kt, kindic )      ! outputs for biological trends
+      ENDIF
       !
    END SUBROUTINE trc_dia
@@ -145,4 +153,13 @@
       
       IF( kt == nit000 ) THEN
+
+         IF(lwp) THEN                   ! control print
+            WRITE(numout,*)
+            WRITE(numout,*) '    frequency of outputs for passive tracers nn_writetrc = ', nn_writetrc
+            DO jn = 1, jptra
+               IF( ln_trc_wri(jn) )  WRITE(numout,*) ' ouput tracer nb : ', jn, '    short name : ', ctrcnm(jn) 
+            END DO
+            WRITE(numout,*) ' '
+         ENDIF
 
          ! Compute julian date from starting date of the run
@@ -182,7 +199,7 @@
          ! Declare all the output fields as NETCDF variables
          DO jn = 1, jptra
-            IF( lutsav(jn) ) THEN
+            IF( ln_trc_wri(jn) ) THEN
                cltra  = TRIM( ctrcnm(jn) )   ! short title for tracer
-               cltral = TRIM( ctrcnl(jn) )   ! long title for tracer
+               cltral = TRIM( ctrcln(jn) )   ! long title for tracer
                cltrau = TRIM( ctrcun(jn) )   ! UNIT for tracer
                CALL histdef( nit5, cltra, cltral, cltrau, jpi, jpj, nhorit5,  &
@@ -209,5 +226,5 @@
       DO jn = 1, jptra
          cltra  = TRIM( ctrcnm(jn) )   ! short title for tracer
-         IF( lutsav(jn) ) CALL histwrite( nit5, cltra, it, trn(:,:,:,jn), ndimt50, ndext50 )
+         IF( ln_trc_wri(jn) ) CALL histwrite( nit5, cltra, it, trn(:,:,:,jn), ndimt50, ndext50 )
       END DO
 
@@ -217,6 +234,4 @@
       !
    END SUBROUTINE trcdit_wr
-
-#if defined key_diatrc
 
    SUBROUTINE trcdii_wr( kt, kindic )
@@ -360,12 +375,4 @@
 
    END SUBROUTINE trcdii_wr
-
-# else
-   SUBROUTINE trcdii_wr( kt, kindic )                      ! Dummy routine
-      INTEGER, INTENT (in) :: kt, kindic
-   END SUBROUTINE trcdii_wr
-# endif
-
-# if defined key_diabio
 
    SUBROUTINE trcdib_wr( kt, kindic )
@@ -485,21 +492,4 @@
    END SUBROUTINE trcdib_wr
 
-# else
-
-   SUBROUTINE trcdib_wr( kt, kindic )                      ! Dummy routine
-      INTEGER, INTENT ( in ) ::   kt, kindic
-   END SUBROUTINE trcdib_wr
-
-# endif 
-
-   INTEGER FUNCTION trc_dia_alloc()
-      !!---------------------------------------------------------------------
-      !!                     ***  ROUTINE trc_dia_alloc  ***
-      !!---------------------------------------------------------------------
-      ALLOCATE( ndext50(jpij*jpk), ndext51(jpij), STAT=trc_dia_alloc )
-      !
-      IF( trc_dia_alloc /= 0 )   CALL ctl_warn('trc_dia_alloc : failed to allocate arrays')
-      !
-   END FUNCTION trc_dia_alloc
 #else
    !!----------------------------------------------------------------------
Index: /branches/2011/dev_r2787_LOCEAN3_TRA_TRP/NEMOGCM/NEMO/TOP_SRC/trcdta.F90
===================================================================
--- /branches/2011/dev_r2787_LOCEAN3_TRA_TRP/NEMOGCM/NEMO/TOP_SRC/trcdta.F90	(revision 2818)
+++ /branches/2011/dev_r2787_LOCEAN3_TRA_TRP/NEMOGCM/NEMO/TOP_SRC/trcdta.F90	(revision 2819)
@@ -7,16 +7,18 @@
    !!              -   !  2004-03  (C. Ethe)  module
    !!              -   !  2005-03  (O. Aumont, A. El Moussaoui) F90
-   !!----------------------------------------------------------------------
-#if  defined key_top  &&  defined key_dtatrc
-   !!----------------------------------------------------------------------
-   !!   'key_top'  and  'key_dtatrc'        TOP model + passive tracer data
-   !!----------------------------------------------------------------------
-   !!   trc_dta      : read ocean passive tracer data
-   !!----------------------------------------------------------------------
-   USE oce_trc
-   USE par_trc
-   USE trc
-   USE lib_print
-   USE iom
+   !!            3.4   !  2010-11  (C. Ethe, G. Madec)  use of fldread + dynamical allocation 
+   !!----------------------------------------------------------------------
+#if  defined key_top 
+   !!----------------------------------------------------------------------
+   !!   'key_top'                                                TOP model 
+   !!----------------------------------------------------------------------
+   !!   trc_dta    : read and time interpolated passive tracer data
+   !!----------------------------------------------------------------------
+   USE par_trc       !  passive tracers parameters
+   USE oce_trc       !  shared variables between ocean and passive tracers
+   USE trc           !  passive tracers common variables
+   USE iom           !  I/O manager
+   USE lib_mpp       !  MPP library
+   USE fldread       !  read input fields
 
    IMPLICIT NONE
@@ -24,18 +26,16 @@
 
    PUBLIC   trc_dta         ! called in trcini.F90 and trcdmp.F90
-   PUBLIC   trc_dta_alloc   ! called in nemogcm.F90
-
-   LOGICAL , PUBLIC, PARAMETER ::   lk_dtatrc = .TRUE.   !: temperature data flag
-   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:,:) ::   trdta   !: tracer data at given time-step
-
-   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:,:,:,:) ::   tracdta       ! tracer data at two consecutive times
-   INTEGER , ALLOCATABLE, SAVE, DIMENSION(:) ::   nlectr      !: switch for reading once
-   INTEGER , ALLOCATABLE, SAVE, DIMENSION(:) ::   ntrc1       !: number of 1st month when reading 12 monthly value
-   INTEGER , ALLOCATABLE, SAVE, DIMENSION(:) ::   ntrc2       !: number of 2nd month when reading 12 monthly value
+   PUBLIC   trc_dta_init    ! called in trcini.F90 
+
+   INTEGER  , SAVE, PUBLIC                             :: nb_trcdta   ! number of tracers to be initialised with data
+   INTEGER  , SAVE, PUBLIC, ALLOCATABLE, DIMENSION(:)  :: n_trc_index ! indice of tracer which is initialised with data
+   INTEGER  , SAVE                                     :: ntra        ! MAX( 1, nb_trcdta ) to avoid compilation error with bounds checking
+   REAL(wp) , SAVE,         ALLOCATABLE, DIMENSION(:)  :: rf_trfac    ! multiplicative factor for tracer values
+   TYPE(FLD), SAVE,         ALLOCATABLE, DIMENSION(:)  :: sf_trcdta   ! structure of input SST (file informations, fields read)
 
    !! * Substitutions
-#  include "top_substitute.h90"
-   !!----------------------------------------------------------------------
-   !! NEMO/TOP 3.3 , NEMO Consortium (2010)
+#  include "domzgr_substitute.h90"
+   !!----------------------------------------------------------------------
+   !! NEMO/OPA 3.3 , NEMO Consortium (2010)
    !! $Id$ 
    !! Software governed by the CeCILL licence     (NEMOGCM/NEMO_CeCILL.txt)
@@ -43,178 +43,225 @@
 CONTAINS
 
-   SUBROUTINE trc_dta( kt )
+   SUBROUTINE trc_dta_init
+      !!----------------------------------------------------------------------
+      !!                   ***  ROUTINE trc_dta_init  ***
+      !!                    
+      !! ** Purpose :   initialisation of passive tracer input data 
+      !! 
+      !! ** Method  : - Read namtsd namelist
+      !!              - allocates passive tracer data structure 
+      !!----------------------------------------------------------------------
+      !
+      INTEGER            :: jl, jn                   ! dummy loop indicies
+      INTEGER            :: ierr0, ierr1, ierr2, ierr3       ! temporary integers
+      CHARACTER(len=100) :: clndta, clntrc
+      REAL(wp)           :: zfact
+      !
+      CHARACTER(len=100) :: cn_dir
+      TYPE(FLD_N), DIMENSION(jptra) :: slf_i     ! array of namelist informations on the fields to read
+      TYPE(FLD_N), DIMENSION(jptra) :: sn_trcdta
+      REAL(wp)   , DIMENSION(jptra) :: rn_trfac    ! multiplicative factor for tracer values
+      !!
+      NAMELIST/namtrc_dta/ sn_trcdta, cn_dir, rn_trfac 
+      !!----------------------------------------------------------------------
+      !
+      !  Initialisation
+      ierr0 = 0  ;  ierr1 = 0  ;  ierr2 = 0  ;  ierr3 = 0  
+      ! Compute the number of tracers to be initialised with data
+      ALLOCATE( n_trc_index(jptra), STAT=ierr0 )
+      IF( ierr0 > 0 ) THEN
+         CALL ctl_stop( 'trc_nam: unable to allocate n_trc_index' )   ;   RETURN
+      ENDIF
+      nb_trcdta      = 0
+      n_trc_index(:) = 0
+      DO jn = 1, jptra
+         IF( ln_trc_ini(jn) ) THEN
+             nb_trcdta       = nb_trcdta + 1 
+             n_trc_index(jn) = nb_trcdta 
+         ENDIF
+      ENDDO
+      !
+      ntra = MAX( 1, nb_trcdta )   ! To avoid compilation error with bounds checking
+      WRITE(numout,*) ' '
+      WRITE(numout,*) ' number of passive tracers to be initialize by data :', ntra
+      WRITE(numout,*) ' '
+      !                         ! allocate the arrays (if necessary)
+      !
+      cn_dir  = './'            ! directory in which the model is executed
+      DO jn = 1, jptra
+         WRITE( clndta,'("TR_",I1)' ) jn
+         clndta = TRIM( clndta )
+         !                 !  file      ! frequency ! variable  ! time intep !  clim   ! 'yearly' or ! weights  ! rotation !
+         !                 !  name      !  (hours)  !  name     !   (T/F)    !  (T/F)  !  'monthly'  ! filename ! pairs    !
+         sn_trcdta(jn)  = FLD_N( clndta ,   -1      , clndta    ,  .false.   , .true.  ,  'monthly'  , ''       , ''       )
+         !
+         rn_trfac(jn) = 1._wp
+      END DO
+      !
+      REWIND( numnat )               ! read nattrc
+      READ  ( numnat, namtrc_dta )
+
+      IF( lwp ) THEN
+         DO jn = 1, jptra
+            IF( ln_trc_ini(jn) )  THEN    ! open input file only if ln_trc_ini(jn) is true
+               clndta = TRIM( sn_trcdta(jn)%clvar ) 
+               clntrc = TRIM( ctrcnm   (jn)       ) 
+               zfact  = rn_trfac(jn)
+               IF( clndta /=  clntrc ) THEN 
+                  CALL ctl_warn( 'trc_dta_init: passive tracer data initialisation :  ',   &
+                  &              'the variable name in the data file : '//clndta//   & 
+                  &              '  must be the same than the name of the passive tracer : '//clntrc//' ')
+               ENDIF
+               WRITE(numout,*) ' read an initial file for passive tracer number :', jn, ' name : ', clndta, & 
+               &               ' multiplicative factor : ', zfact
+            ENDIF
+         END DO
+      ENDIF
+      !
+      IF( nb_trcdta > 0 ) THEN       !  allocate only if the number of tracer to initialise is greater than zero
+         ALLOCATE( sf_trcdta(nb_trcdta), rf_trfac(nb_trcdta), STAT=ierr1 )
+         IF( ierr1 > 0 ) THEN
+            CALL ctl_stop( 'trc_dta_ini: unable to allocate  sf_trcdta structure' )   ;   RETURN
+         ENDIF
+         !
+         DO jn = 1, jptra
+            IF( ln_trc_ini(jn) ) THEN      ! update passive tracers arrays with input data read from file
+               jl = n_trc_index(jn)
+               slf_i(jl)    = sn_trcdta(jn)
+               rf_trfac(jl) = rn_trfac(jn)
+                                            ALLOCATE( sf_trcdta(jl)%fnow(jpi,jpj,jpk)   , STAT=ierr2 )
+               IF( sn_trcdta(jn)%ln_tint )  ALLOCATE( sf_trcdta(jl)%fdta(jpi,jpj,jpk,2) , STAT=ierr3 )
+               IF( ierr2 + ierr3 > 0 ) THEN
+                 CALL ctl_stop( 'trc_dta : unable to allocate passive tracer data arrays' )   ;   RETURN
+               ENDIF
+            ENDIF
+            !   
+         ENDDO
+         !                         ! fill sf_trcdta with slf_i and control print
+         CALL fld_fill( sf_trcdta, slf_i, cn_dir, 'trc_dta', 'Passive tracer data', 'namtrc' )
+         !
+      ENDIF
+      !
+   END SUBROUTINE trc_dta_init
+
+
+   SUBROUTINE trc_dta( kt, ptrc )
       !!----------------------------------------------------------------------
       !!                   ***  ROUTINE trc_dta  ***
+      !!                    
+      !! ** Purpose :   provides passive tracer data at kt
+      !! 
+      !! ** Method  : - call fldread routine
+      !!              - s- or mixed z-s coordinate: vertical interpolation on model mesh
+      !!              - ln_trcdmp=F: deallocates the data structure as they are not used
       !!
-      !! ** Purpose :   Reads passive tracer data (Levitus monthly data)
-      !!
-      !! ** Method  :   Read on unit numtr the interpolated tracer concentra-
-      !!      tion onto the global grid. Data begin at january. 
-      !!      The value is centered at the middle of month. 
-      !!      In the opa model, kt=1 agree with january 1. 
-      !!      At each time step, a linear interpolation is applied between 
-      !!      two monthly values.
-      !!----------------------------------------------------------------------
-      INTEGER, INTENT(in) ::   kt     ! ocean time-step
-      !!
-      CHARACTER (len=39) ::   clname(jptra)
-      INTEGER, PARAMETER ::   jpmonth = 12    ! number of months
-      INTEGER ::   ji, jj, jn, jl 
-      INTEGER ::   imois, iman, i15, ik  ! temporary integers 
-      REAL(wp) ::   zxy, zl
-!!gm HERE the daymod should be used instead of computation of month and co !!
-!!gm      better in case of real calandar and leap-years !
-      !!----------------------------------------------------------------------
-
-      DO jn = 1, jptra
-
-         IF( lutini(jn) ) THEN 
-
-            IF ( kt == nit000 ) THEN
-               !! 3D tracer data
-               IF(lwp)WRITE(numout,*)
-               IF(lwp)WRITE(numout,*) ' dta_trc: reading tracer' 
-               IF(lwp)WRITE(numout,*) ' data file ', jn, ctrcnm(jn)
-               IF(lwp)WRITE(numout,*)
-               nlectr(jn) = 0
+      !! ** Action  :   ptrc   passive tracer data on medl mesh and interpolated at time-step kt
+      !!----------------------------------------------------------------------
+      INTEGER                     , INTENT(in   ) ::   kt     ! ocean time-step
+      REAL(wp), DIMENSION(:,:,:,:), INTENT(  out) ::   ptrc   ! passive tracer data
+      !
+      INTEGER ::   ji, jj, jk, jl, jn, jkk, ik    ! dummy loop indicies
+      REAL(wp)::   zl, zi
+      REAL(wp), DIMENSION(jpk) ::  ztp                ! 1D workspace
+      CHARACTER(len=100) :: clndta
+      !!----------------------------------------------------------------------
+      !
+      IF( nb_trcdta > 0 ) THEN
+         !
+         CALL fld_read( kt, 1, sf_trcdta )      !==   read data at kt time step   ==!
+         !
+         DO jn = 1, ntra
+            ptrc(:,:,:,jn) = sf_trcdta(jn)%fnow(:,:,:)    ! NO mask
+         ENDDO
+         !
+         IF( ln_sco ) THEN                   !==   s- or mixed s-zps-coordinate   ==!
+            !
+            IF( kt == nit000 .AND. lwp )THEN
+               WRITE(numout,*)
+               WRITE(numout,*) 'trc_dta: interpolates passive tracer data onto the s- or mixed s-z-coordinate mesh'
             ENDIF
-            ! Initialization
-            iman = jpmonth
-            i15  = nday / 16
-            imois = nmonth + i15 -1
-            IF( imois == 0 ) imois = iman
-
-
-            ! First call kt=nit000
-            ! --------------------
-
-            IF ( kt == nit000 .AND. nlectr(jn) == 0 ) THEN
-               ntrc1(jn) = 0
-               IF(lwp) WRITE(numout,*) ' trc_dta : Levitus tracer data monthly fields'
-               ! open file 
-# if defined key_pisces
-               clname(jn) = 'data_1m_'//TRIM(ctrcnm(jn))//'_nomask'
-# else
-               clname(jn) = TRIM(ctrcnm(jn))
-# endif
-               CALL iom_open ( clname(jn), numtr(jn) )              
-
-            ENDIF
-
-# if defined key_pisces
-            ! Read montly file
-            IF( ( kt == nit000 .AND. nlectr(jn) == 0)  .OR. imois /= ntrc1(jn) ) THEN
-               nlectr(jn) = 1
-
-               ! Calendar computation
-
-               ! ntrc1 number of the first file record used in the simulation
-               ! ntrc2 number of the last  file record
-
-               ntrc1(jn) = imois
-               ntrc2(jn) = ntrc1(jn) + 1
-               ntrc1(jn) = MOD( ntrc1(jn), iman )
-               IF ( ntrc1(jn) == 0 ) ntrc1(jn) = iman
-               ntrc2(jn) = MOD( ntrc2(jn), iman )
-               IF ( ntrc2(jn) == 0 ) ntrc2(jn) = iman
-               IF(lwp) WRITE(numout,*) 'first record file used ntrc1 ', ntrc1(jn) 
-               IF(lwp) WRITE(numout,*) 'last  record file used ntrc2 ', ntrc2(jn)
-
-               ! Read montly passive tracer data Levitus 
-
-               CALL iom_get ( numtr(jn), jpdom_data, ctrcnm(jn), tracdta(:,:,:,jn,1), ntrc1(jn) )
-               CALL iom_get ( numtr(jn), jpdom_data, ctrcnm(jn), tracdta(:,:,:,jn,2), ntrc2(jn) )
-
-               IF(lwp) THEN
-                  WRITE(numout,*)
-                  WRITE(numout,*) ' read tracer data ', ctrcnm(jn),' ok'
-                  WRITE(numout,*)
+            !
+            DO jn = 1, ntra
+               DO jj = 1, jpj                         ! vertical interpolation of T & S
+                  DO ji = 1, jpi
+                     DO jk = 1, jpk                        ! determines the intepolated T-S profiles at each (i,j) points
+                        zl = fsdept_0(ji,jj,jk)
+                        IF(     zl < gdept_0(1  ) ) THEN          ! above the first level of data
+                           ztp(jk) =  ptrc(ji,jj,1    ,jn)
+                        ELSEIF( zl > gdept_0(jpk) ) THEN          ! below the last level of data
+                           ztp(jk) =  ptrc(ji,jj,jpkm1,jn)
+                        ELSE                                      ! inbetween : vertical interpolation between jkk & jkk+1
+                           DO jkk = 1, jpkm1                                  ! when  gdept(jkk) < zl < gdept(jkk+1)
+                              IF( (zl-gdept_0(jkk)) * (zl-gdept_0(jkk+1)) <= 0._wp ) THEN
+                                 zi = ( zl - gdept_0(jkk) ) / (gdept_0(jkk+1)-gdept_0(jkk))
+                                 ztp(jk) = ptrc(ji,jj,jkk,jn) + ( ptrc(ji,jj,jkk+1,jn) - ptrc(ji,jj,jkk,jn) ) * zi 
+                              ENDIF
+                           END DO
+                        ENDIF
+                     END DO
+                     DO jk = 1, jpkm1
+                        ptrc(ji,jj,jk,jn) = ztp(jk) * tmask(ji,jj,jk)     ! mask required for mixed zps-s-coord
+                     END DO
+                     ptrc(ji,jj,jpk,jn) = 0._wp
+                  END DO
+               END DO
+            ENDDO 
+            ! 
+         ELSE                                !==   z- or zps- coordinate   ==!
+            !                             
+            DO jn = 1, ntra
+               ptrc(:,:,:,jn) = ptrc(:,:,:,jn) * tmask(:,:,:)    ! Mask
+               !
+               IF( ln_zps ) THEN                      ! zps-coordinate (partial steps) interpolation at the last ocean level
+                  DO jj = 1, jpj
+                     DO ji = 1, jpi
+                        ik = mbkt(ji,jj) 
+                        IF( ik > 1 ) THEN
+                           zl = ( gdept_0(ik) - fsdept_0(ji,jj,ik) ) / ( gdept_0(ik) - gdept_0(ik-1) )
+                           ptrc(ji,jj,ik,jn) = (1.-zl) * ptrc(ji,jj,ik,jn) + zl * ptrc(ji,jj,ik-1,jn)
+                        ENDIF
+                     END DO
+                  END DO
                ENDIF
-
-               ! Apply Mask
-               DO jl = 1, 2
-                  tracdta(:,:,:  ,jn,jl) = tracdta(:,:,:,jn,jl) * tmask(:,:,:) 
-                  tracdta(:,:,jpk,jn,jl) = 0.
-                  IF( ln_zps ) THEN                ! z-coord. with partial steps
-                     DO jj = 1, jpj                ! interpolation of temperature at the last level
-                        DO ji = 1, jpi
-                           ik = mbkt(ji,jj)
-                           IF( ik > 2 ) THEN
-                              zl = ( gdept_0(ik) - fsdept_0(ji,jj,ik) ) / ( gdept_0(ik) - gdept_0(ik-1) )
-                              tracdta(ji,jj,ik,jn,jl) = (1.-zl) * tracdta(ji,jj,ik  ,jn,jl)    &
-                                 &                    +     zl  * tracdta(ji,jj,ik-1,jn,jl)
-                           ENDIF
-                        END DO
-                     END DO
-                  ENDIF
-
-               END DO
-
-            ENDIF
-
-            IF(lwp) THEN
-               WRITE(numout,*) ctrcnm(jn), 'Levitus month ', ntrc1(jn), ntrc2(jn)
+            ENDDO 
+            !
+         ENDIF
+         !
+         DO jn = 1, ntra
+            ptrc(:,:,:,jn) = ptrc(:,:,:,jn) * rf_trfac(jn)   !  multiplicative factor
+         ENDDO 
+         !
+         IF( lwp .AND. kt == nit000 ) THEN
+            DO jn = 1, ntra
+               clndta = TRIM( sf_trcdta(jn)%clvar ) 
+               WRITE(numout,*) ''//clndta//' data '
                WRITE(numout,*)
-               WRITE(numout,*) ' Levitus month = ', ntrc1(jn), '  level = 1'
-               CALL prihre( tracdta(1,1,1,jn,1), jpi, jpj, 1, jpi, 20, 1   &
-                  &        ,jpj, 20, 1., numout )
-               WRITE(numout,*) ' Levitus month = ', ntrc1(jn), '  level = ',jpk/2
-               CALL prihre( tracdta(1,1,jpk/2,jn,1), jpi, jpj, 1, jpi,    &
-                  &         20, 1, jpj, 20, 1., numout )
-               WRITE(numout,*) ' Levitus month = ',ntrc1(jn),'  level = ',jpkm1
-               CALL prihre( tracdta(1,1,jpkm1,jn,1), jpi, jpj, 1, jpi,     &
-                  &         20, 1, jpj, 20, 1., numout )
-            ENDIF
-
-            ! At every time step compute temperature data
-            zxy = FLOAT( nday + 15 - 30 * i15 ) / 30.
-            trdta(:,:,:,jn) =  ( 1. - zxy ) * tracdta(:,:,:,jn,1)    &
-               &              +       zxy   * tracdta(:,:,:,jn,2) 
-
-            IF( jn == jpno3 )   trdta(:,:,:,jn) = trdta(:,:,:,jn) *   7.6e-6
-            IF( jn == jpdic )   trdta(:,:,:,jn) = trdta(:,:,:,jn) *   1.0e-6
-            IF( jn == jptal )   trdta(:,:,:,jn) = trdta(:,:,:,jn) *   1.0e-6
-            IF( jn == jpoxy )   trdta(:,:,:,jn) = trdta(:,:,:,jn) *  44.6e-6
-            IF( jn == jpsil )   trdta(:,:,:,jn) = trdta(:,:,:,jn) *   1.0e-6
-            IF( jn == jppo4 )   trdta(:,:,:,jn) = trdta(:,:,:,jn) * 122.0e-6
-
-            ! Close the file
-            ! --------------
-            
-            IF( kt == nitend )   CALL iom_close( numtr(jn) )
-
-# else
-            ! Read init file only
-            IF( kt == nit000  ) THEN
-               ntrc1(jn) = 1
-               CALL iom_get ( numtr(jn), jpdom_data, ctrcnm(jn), trdta(:,:,:,jn), ntrc1(jn) )
-               trdta(:,:,:,jn) = trdta(:,:,:,jn) * tmask(:,:,:)
-               CALL iom_close ( numtr(jn) )
-            ENDIF 
-# endif
-         ENDIF
-
-      END DO
-      !
+               WRITE(numout,*)'  level = 1'
+               CALL prihre( ptrc(:,:,1    ,jn), jpi, jpj, 1, jpi, 20, 1, jpj, 20, 1., numout )
+               WRITE(numout,*)'  level = ', jpk/2
+               CALL prihre( ptrc(:,:,jpk/2,jn), jpi, jpj, 1, jpi, 20, 1, jpj, 20, 1., numout )
+               WRITE(numout,*)'  level = ', jpkm1
+               CALL prihre( ptrc(:,:,jpkm1,jn), jpi, jpj, 1, jpi, 20, 1, jpj, 20, 1., numout )
+               WRITE(numout,*)
+            ENDDO
+         ENDIF
+         !
+         IF( .NOT.ln_trcdmp ) THEN                   !==   deallocate data structure   ==! 
+            !                                              (data used only for initialisation)
+            IF(lwp) WRITE(numout,*) 'trc_dta: deallocate data arrays as they are only use to initialize the run'
+            DO jn = 1, ntra
+                                             DEALLOCATE( sf_trcdta(jn)%fnow )     !  arrays in the structure
+               IF( sf_trcdta(jn)%ln_tint )   DEALLOCATE( sf_trcdta(jn)%fdta )
+            ENDDO
+            !
+         ENDIF
+         !
+      ENDIF
+      ! 
    END SUBROUTINE trc_dta
-
-
-   INTEGER FUNCTION trc_dta_alloc()
-      !!----------------------------------------------------------------------
-      !!                   ***  ROUTINE trc_dta_alloc  ***
-      !!----------------------------------------------------------------------
-      ALLOCATE( trdta  (jpi,jpj,jpk,jptra  ) ,                    &
-         &      tracdta(jpi,jpj,jpk,jptra,2) ,                    &
-         &      nlectr(jptra) , ntrc1(jptra) , ntrc2(jptra) , STAT=trc_dta_alloc)
-         !
-      IF( trc_dta_alloc /= 0 )   CALL ctl_warn('trc_dta_alloc : failed to allocate arrays')
-      !
-   END FUNCTION trc_dta_alloc
-
 #else
    !!----------------------------------------------------------------------
    !!   Dummy module                              NO 3D passive tracer data
    !!----------------------------------------------------------------------
-   LOGICAL , PUBLIC, PARAMETER ::   lk_dtatrc = .FALSE.   !: temperature data flag
 CONTAINS
    SUBROUTINE trc_dta( kt )        ! Empty routine
@@ -222,5 +269,4 @@
    END SUBROUTINE trc_dta
 #endif
-
    !!======================================================================
 END MODULE trcdta
Index: /branches/2011/dev_r2787_LOCEAN3_TRA_TRP/NEMOGCM/NEMO/TOP_SRC/trcini.F90
===================================================================
--- /branches/2011/dev_r2787_LOCEAN3_TRA_TRP/NEMOGCM/NEMO/TOP_SRC/trcini.F90	(revision 2818)
+++ /branches/2011/dev_r2787_LOCEAN3_TRA_TRP/NEMOGCM/NEMO/TOP_SRC/trcini.F90	(revision 2819)
@@ -16,7 +16,7 @@
    !!   top_alloc :   allocate the TOP arrays
    !!----------------------------------------------------------------------
-   USE oce_trc
-   USE trc
-   USE trcrst
+   USE oce_trc         ! shared variables between ocean and passive tracers
+   USE trc             ! passive tracers common variables
+   USE trcrst          ! passive tracers restart
    USE trcnam          ! Namelist read
    USE trcini_cfc      ! CFC      initialisation
@@ -25,6 +25,6 @@
    USE trcini_c14b     ! C14 bomb initialisation
    USE trcini_my_trc   ! MY_TRC   initialisation
-   USE trcdta   
-   USE daymod
+   USE trcdta          ! initialisation form files
+   USE daymod          ! calendar manager
    USE zpshde          ! partial step: hor. derivative   (zps_hde routine)
    USE prtctl_trc      ! Print control passive tracers (prt_ctl_trc_init routine)
@@ -56,6 +56,8 @@
       !!                or read data or analytical formulation
       !!---------------------------------------------------------------------
-      INTEGER ::   jk, jn    ! dummy loop indices
+      INTEGER ::   jk, jn, jl    ! dummy loop indices
+      INTEGER ::   ierr          ! local integer
       CHARACTER (len=25) :: charout
+      REAL(wp), ALLOCATABLE, DIMENSION(:,:,:,:) ::  ztrcdta   ! 4D  workspace
       !!---------------------------------------------------------------------
 
@@ -65,4 +67,10 @@
 
       CALL top_alloc()              ! allocate TOP arrays
+
+      IF( ln_dm2dc .AND. ( lk_pisces .OR. lk_lobster ) )    &
+         &  CALL ctl_stop( ' The diurnal cycle is not compatible with PISCES or LOBSTER  ' )
+
+      IF( nn_cla == 1 )   &
+         &  CALL ctl_stop( ' Cross Land Advection not yet implemented with passive tracer ; nn_cla must be 0' )
 
       !                             ! masked grid volume
@@ -71,32 +79,10 @@
       END DO
 
-      !                             ! total volume of the ocean
-#if ! defined key_degrad
-      areatot = glob_sum( cvol(:,:,:) )
-#else
-      areatot = glob_sum( cvol(:,:,:) * facvol(:,:,:) )  ! degrad option: reduction by facvol
-#endif
+      !                           ! total volume of the ocean ( degrad option: reduction by facvol )
+      IF( .NOT.lk_degrad )  THEN  ;  areatot = glob_sum( cvol(:,:,:) )
+      ELSE                        ;  areatot = glob_sum( cvol(:,:,:) * facvol(:,:,:) )
+      ENDIF
 
       CALL trc_nam                  ! read passive tracers namelists
-
-      !                             ! restart for passive tracer (input)
-      IF( ln_rsttr ) THEN
-         IF(lwp) WRITE(numout,*) '       read a restart file for passive tracer : ', cn_trcrst_in
-         IF(lwp) WRITE(numout,*) ' '
-      ELSE
-         IF( lwp .AND. lk_dtatrc ) THEN
-            DO jn = 1, jptra
-               IF( lutini(jn) )  &                  ! open input FILE only IF lutini(jn) is true
-                  &  WRITE(numout,*) ' read an initial file for passive tracer number :', jn, ' traceur : ', ctrcnm(jn) 
-             END DO
-          ENDIF
-          IF( lwp ) WRITE(numout,*)
-      ENDIF
-
-      IF( ln_dm2dc .AND. ( lk_pisces .OR. lk_lobster ) )    &
-         &       CALL ctl_stop( ' The diurnal cycle is not compatible with PISCES or LOBSTER  ' )
-
-      IF( nn_cla == 1 )   &
-         &       CALL ctl_stop( ' Cross Land Advection not yet implemented with passive tracer ; nn_cla must be 0' )
 
       IF( lk_lobster ) THEN   ;   CALL trc_ini_lobster      ! LOBSTER bio-model
@@ -119,4 +105,6 @@
       ELSE                    ;   IF(lwp) WRITE(numout,*) '          MY_TRC not used'
       ENDIF
+
+      IF( ln_trcdta )             CALL trc_dta_init
 
       IF( ln_rsttr ) THEN
@@ -130,10 +118,21 @@
            CALL day_init               ! set calendar
         ENDIF
-#if defined key_dtatrc
-        CALL trc_dta( nit000 )      ! Initialization of tracer from a file that may also be used for damping
-        DO jn = 1, jptra
-           IF( lutini(jn) )   trn(:,:,:,jn) = trdta(:,:,:,jn) * tmask(:,:,:)   ! initialisation from file if required
-        END DO
-#endif
+        IF( ln_trcdta .AND. nb_trcdta > 0 ) THEN  ! Initialisation of tracer from a file that may also be used for damping
+            ALLOCATE( ztrcdta(jpi,jpj,jpk,nb_trcdta), STAT=ierr )
+            IF( ierr > 0 ) THEN
+               CALL ctl_stop( 'trc_ini: unable to allocate ztrcdta array' )   ;   RETURN
+            ENDIF
+            !
+            CALL trc_dta( nit000, ztrcdta )   ! read tracer data at nit000
+            !
+            DO jn = 1, jptra
+               IF( ln_trc_ini(jn) ) THEN      ! update passive tracers arrays with input data read from file
+                  jl = n_trc_index(jn) 
+                  trn(:,:,:,jn) = ztrcdta(:,:,:,jl) * tmask(:,:,:)  
+               ENDIF
+            ENDDO
+            DEALLOCATE( ztrcdta ) 
+        ENDIF
+        !
         trb(:,:,:,:) = trn(:,:,:,:)
         ! 
@@ -147,11 +146,9 @@
 
       !           
-      trai = 0._wp         ! Computation content of all tracers
+      trai(:) = 0._wp         ! Computation content of all tracers ( degrad option: reduction by facvol )
       DO jn = 1, jptra
-#if ! defined key_degrad
-         trai = trai + glob_sum( trn(:,:,:,jn) * cvol(:,:,:) )
-#else
-         trai = trai + glob_sum( trn(:,:,:,jn) * cvol(:,:,:) * facvol(:,:,:) ) ! degrad option: reduction by facvol
-#endif
+         IF( .NOT.lk_degrad )  THEN  ;  trai(jn) =  glob_sum( trn(:,:,:,jn) * cvol(:,:,:) ) 
+         ELSE                        ;  trai(jn) =  glob_sum( trn(:,:,:,jn) * cvol(:,:,:) * facvol(:,:,:) )
+         ENDIF
       END DO      
 
@@ -161,5 +158,8 @@
          WRITE(numout,*) '          *** Total number of passive tracer jptra = ', jptra
          WRITE(numout,*) '          *** Total volume of ocean                = ', areatot
-         WRITE(numout,*) '          *** Total inital content of all tracers  = ', trai
+         WRITE(numout,*) '          *** Total inital content of all tracers '
+         DO jn = 1, jptra
+            WRITE(numout,*) ' tracer nb : ', jn, '  name : ', ctrcnm(jn), ' initial content :', trai(jn)
+         ENDDO
          WRITE(numout,*)
       ENDIF
@@ -186,14 +186,5 @@
       USE trczdf        , ONLY:   trc_zdf_alloc
       USE trdmod_trc_oce, ONLY:   trd_mod_trc_oce_alloc
-#if ! defined key_iomput
-      USE trcdia        , ONLY:   trc_dia_alloc
-#endif
-#if defined key_trcdmp 
-      USE trcdmp        , ONLY:   trc_dmp_alloc
-#endif
-#if defined key_dtatrc
-      USE trcdta        , ONLY:   trc_dta_alloc
-#endif
-#if defined key_trdmld_trc   ||   defined key_esopa
+#if defined key_trdmld_trc 
       USE trdmld_trc    , ONLY:   trd_mld_trc_alloc
 #endif
@@ -207,14 +198,5 @@
       ierr = ierr + trc_zdf_alloc()
       ierr = ierr + trd_mod_trc_oce_alloc()
-#if ! defined key_iomput
-      ierr = ierr + trc_dia_alloc()
-#endif
-#if defined key_trcdmp 
-      ierr = ierr + trc_dmp_alloc()
-#endif
-#if defined key_dtatrc
-      ierr = ierr + trc_dta_alloc()
-#endif
-#if defined key_trdmld_trc   ||   defined key_esopa
+#if defined key_trdmld_trc 
       ierr = ierr + trd_mld_trc_alloc()
 #endif
Index: /branches/2011/dev_r2787_LOCEAN3_TRA_TRP/NEMOGCM/NEMO/TOP_SRC/trcnam.F90
===================================================================
--- /branches/2011/dev_r2787_LOCEAN3_TRA_TRP/NEMOGCM/NEMO/TOP_SRC/trcnam.F90	(revision 2818)
+++ /branches/2011/dev_r2787_LOCEAN3_TRA_TRP/NEMOGCM/NEMO/TOP_SRC/trcnam.F90	(revision 2819)
@@ -18,6 +18,6 @@
    !!   trc_nam    :  Read and print options for the passive tracer run (namelist)
    !!----------------------------------------------------------------------
-   USE oce_trc
-   USE trc
+   USE oce_trc           ! shared variables between ocean and passive tracers
+   USE trc               ! passive tracers common variables
    USE trcnam_trp        ! Transport namelist
    USE trcnam_lobster    ! LOBSTER namelist
@@ -26,5 +26,7 @@
    USE trcnam_c14b       ! C14 SMS namelist
    USE trcnam_my_trc     ! MY_TRC SMS namelist
+   USE trdmod_oce       
    USE trdmod_trc_oce
+   USE iom               ! I/O manager
 
    IMPLICIT NONE
@@ -53,25 +55,16 @@
       !!                ( (LOBSTER, PISCES, CFC, MY_TRC )
       !!---------------------------------------------------------------------
-      INTEGER ::  jn
-
+      INTEGER ::  jn, ierr
       ! Definition of a tracer as a structure
-      TYPE PTRACER
-         CHARACTER(len = 20)  :: clsname  !: short name
-         CHARACTER(len = 80 ) :: cllname  !: long name
-         CHARACTER(len = 20 ) :: clunit   !: unit
-         LOGICAL              :: llinit   !: read in a file or not
-         LOGICAL              :: llsave   !: save the tracer or not
-      END TYPE PTRACER
-
-      TYPE(PTRACER) , DIMENSION(jptra) :: sn_tracer
-
+      TYPE(PTRACER), DIMENSION(jptra) :: sn_tracer  ! type of tracer for saving if not key_iomput
       !!
-      NAMELIST/namtrc/    nn_dttrc, nn_writetrc, ln_rsttr, nn_rsttr, &
-                          cn_trcrst_in, cn_trcrst_out, sn_tracer
+      NAMELIST/namtrc/ nn_dttrc, nn_writetrc, ln_rsttr, nn_rsttr, &
+         &             cn_trcrst_in, cn_trcrst_out, sn_tracer, ln_trcdta
 #if defined key_trdmld_trc  || defined key_trdtrc
       NAMELIST/namtrc_trd/ nn_trd_trc, nn_ctls_trc, rn_ucf_trc, &
-                         ln_trdmld_trc_restart, ln_trdmld_trc_instant, &
-                         cn_trdrst_trc_in, cn_trdrst_trc_out, ln_trdtrc
+         &                ln_trdmld_trc_restart, ln_trdmld_trc_instant, &
+         &                cn_trdrst_trc_in, cn_trdrst_trc_out, ln_trdtrc
 #endif
+      NAMELIST/namtrc_dia/ ln_diatrc, ln_diabio, nn_writedia, nn_writebio
 
       !!---------------------------------------------------------------------
@@ -84,17 +77,20 @@
       ! Namelist nattrc (files)
       ! ----------------------------------------------
-      nn_dttrc    = 1                 ! default values
-      nn_writetrc = 10      
-      ln_rsttr    = .FALSE.
-      nn_rsttr    =  0
+      nn_dttrc      = 1                 ! default values
+      nn_writetrc   = 10 
+      ln_rsttr      = .FALSE.
+      nn_rsttr      =  0
       cn_trcrst_in  = 'restart_trc'
       cn_trcrst_out = 'restart_trc'
+      !
       DO jn = 1, jptra
-         WRITE(ctrcnm(jn),'("TR_",I1)'           ) jn
-         WRITE(ctrcnl(jn),'("TRACER NUMBER ",I1)') jn
-         ctrcun(jn) = 'mmole/m3'
-         lutini(jn) = .FALSE. 
-         lutsav(jn) = .TRUE. 
+         WRITE( sn_tracer(jn)%clsname,'("TR_",I1)'           ) jn
+         WRITE( sn_tracer(jn)%cllname,'("TRACER NUMBER ",I1)') jn
+         sn_tracer(jn)%clunit  = 'mmole/m3'
+         sn_tracer(jn)%llinit  = .FALSE.
+         sn_tracer(jn)%llsave  = .TRUE.
       END DO
+      ln_trcdta = .FALSE.
+
 
       REWIND( numnat )               ! read nattrc
@@ -102,9 +98,9 @@
 
       DO jn = 1, jptra
-         ctrcnm(jn) = TRIM( sn_tracer(jn)%clsname )
-         ctrcnl(jn) = TRIM( sn_tracer(jn)%cllname )
-         ctrcun(jn) = TRIM( sn_tracer(jn)%clunit  )
-         lutini(jn) =       sn_tracer(jn)%llinit 
-         lutsav(jn) =       sn_tracer(jn)%llsave
+         ctrcnm    (jn) = TRIM( sn_tracer(jn)%clsname )
+         ctrcln    (jn) = TRIM( sn_tracer(jn)%cllname )
+         ctrcun    (jn) = TRIM( sn_tracer(jn)%clunit  )
+         ln_trc_ini(jn) =       sn_tracer(jn)%llinit
+         ln_trc_wri(jn) =       sn_tracer(jn)%llsave
       END DO
 
@@ -113,57 +109,118 @@
          WRITE(numout,*)
          WRITE(numout,*) ' Namelist : namtrc'
-         WRITE(numout,*) '    time step freq. for pass. trac. nn_dttrc             = ', nn_dttrc
-         WRITE(numout,*) '    frequency of outputs for passive tracers nn_writetrc = ', nn_writetrc  
-         WRITE(numout,*) '    restart LOGICAL for passive tr. ln_rsttr             = ', ln_rsttr
-         WRITE(numout,*) '    control of time step for p. tr. nn_rsttr             = ', nn_rsttr
+         WRITE(numout,*) '   time step freq. for passive tracer           nn_dttrc      = ', nn_dttrc
+         WRITE(numout,*) '   restart  for passive tracer                  ln_rsttr      = ', ln_rsttr
+         WRITE(numout,*) '   control of time step for passive tracer      nn_rsttr      = ', nn_rsttr
+         WRITE(numout,*) '   Read inputs data from file                   ln_trcdta     = ', ln_trcdta
          WRITE(numout,*) ' '
          DO jn = 1, jptra
-            WRITE(numout,*) '   tracer nb             : ', jn 
-            WRITE(numout,*) '   short name            : ', ctrcnm(jn)
-            WRITE(numout,*) '   long name             : ', ctrcnl(jn)
-            WRITE(numout,*) '   unit                  : ', ctrcun(jn)
-            WRITE(numout,*) '   initial value in FILE : ', lutini(jn) 
-            WRITE(numout,*) ' '
+            WRITE(numout,*) '  tracer nb : ', jn, '    short name : ', ctrcnm(jn)
          END DO
+         WRITE(numout,*) ' '
       ENDIF
 
       rdttrc(:) = rdttra(:) * FLOAT( nn_dttrc )   ! vertical profile of passive tracer time-step
   
-      IF(lwp) WRITE(numout,*) 
-      IF(lwp) WRITE(numout,*) '    Passive Tracer  time step    rdttrc  = ', rdttrc(1)
-      IF(lwp) WRITE(numout,*) 
-
-#if defined key_trdmld_trc || defined key_trdtrc
-      nn_trd_trc  = 20
-      nn_ctls_trc =  9
-      rn_ucf_trc   =  1.
-      ln_trdmld_trc_instant = .TRUE.
-      ln_trdmld_trc_restart =.FALSE.
-      cn_trdrst_trc_in  = "restart_mld_trc"
-      cn_trdrst_trc_out = "restart_mld_trc"
-      ln_trdtrc(:) = .FALSE.
+      IF(lwp) THEN                   ! control print
+        WRITE(numout,*) 
+        WRITE(numout,*) '    Passive Tracer  time step    rdttrc  = ', rdttrc(1)
+        WRITE(numout,*) 
+      ENDIF
+
+      ln_diatrc = .FALSE.
+      ln_diabio = .FALSE.
+      nn_writedia = 10
+      nn_writebio = 10
 
       REWIND( numnat )               !  namelist namtoptrd : passive tracer trends diagnostic
-      READ  ( numnat, namtrc_trd )
-
-     IF(lwp) THEN
+      READ  ( numnat, namtrc_dia )
+
+      IF(lwp) THEN
          WRITE(numout,*)
-         WRITE(numout,*) ' trd_mld_trc_init : read namelist namtrc_trd                    '
-         WRITE(numout,*) ' ~~~~~~~~~~~~~~~~                                               '
-         WRITE(numout,*) '   * frequency of trends diagnostics   nn_trd_trc             = ', nn_trd_trc
-         WRITE(numout,*) '   * control surface type              nn_ctls_trc            = ', nn_ctls_trc
-         WRITE(numout,*) '   * restart for ML diagnostics        ln_trdmld_trc_restart  = ', ln_trdmld_trc_restart
-         WRITE(numout,*) '   * flag to diagnose trends of                                 '
-         WRITE(numout,*) '     instantantaneous or mean ML T/S   ln_trdmld_trc_instant  = ', ln_trdmld_trc_instant
-         WRITE(numout,*) '   * unit conversion factor            rn_ucf_trc             = ', rn_ucf_trc
-         DO jn = 1, jptra
-            IF( ln_trdtrc(jn) ) WRITE(numout,*) '    compute ML trends for tracer number :', jn
-         END DO
-      ENDIF
-#endif
+         WRITE(numout,*)
+         WRITE(numout,*) ' Namelist : namtrc_dia'
+         WRITE(numout,*) '    save additionnal diagnostics arrays         ln_diatrc   = ', ln_diatrc
+         WRITE(numout,*) '    save additionnal biology diagnostics arrays ln_diabio   = ', ln_diabio
+         WRITE(numout,*) '    frequency of outputs for additional arrays  nn_writedia = ', nn_writedia
+         WRITE(numout,*) '    frequency of outputs for biological trends  nn_writebio = ', nn_writebio
+         WRITE(numout,*) ' '
+      ENDIF
+
+      IF( ln_diatrc .AND. .NOT. lk_iomput ) THEN 
+         ALLOCATE( trc2d(jpi,jpj,jpdia2d), trc3d(jpi,jpj,jpk,jpdia3d),  &
+           &       ctrc2d(jpdia2d), ctrc2l(jpdia2d), ctrc2u(jpdia2d) ,  & 
+           &       ctrc3d(jpdia3d), ctrc3l(jpdia3d), ctrc3u(jpdia3d) ,  STAT = ierr ) 
+         IF( ierr > 0 )   CALL ctl_stop( 'STOP', 'trcnam: unable to allocate add. diag. array' )
+      ENDIF
+
+      IF( ( ln_diabio .AND. .NOT. lk_iomput ) .OR. l_trdtrc ) THEN
+         ALLOCATE( trbio (jpi,jpj,jpk,jpdiabio) , &
+           &       ctrbio(jpdiabio), ctrbil(jpdiabio), ctrbiu(jpdiabio), STAT = ierr ) 
+         IF( ierr > 0 )   CALL ctl_stop( 'STOP', 'trcnam: unable to allocate bio. diag. array' )
+      ENDIF
 
       ! namelist of transport
       ! ---------------------
       CALL trc_nam_trp
+
+
+      IF( ln_trcdmp .AND. .NOT.ln_trcdta ) THEN
+         CALL ctl_warn( 'trc_nam: passive tracer damping requires data from files we set ln_trcdta to TRUE' )
+         ln_trcdta = .TRUE.
+      ENDIF
+      !
+      IF( ln_rsttr .AND. .NOT.ln_trcdmp .AND. ln_trcdta ) THEN
+          CALL ctl_warn( 'trc_nam: passive tracer restart and  data intialisation, ',   &
+             &           'we keep the restart values and set ln_trcdta to FALSE' )
+         ln_trcdta = .FALSE.
+      ENDIF
+      !
+      IF( .NOT.ln_trcdta ) THEN
+         ln_trc_ini(:) = .FALSE.
+      ENDIF
+
+      IF(lwp) THEN                   ! control print
+         IF( ln_rsttr ) THEN
+            WRITE(numout,*)
+            WRITE(numout,*) '    read a restart file for passive tracer : ', TRIM( cn_trcrst_in )
+            WRITE(numout,*)
+         ELSE
+            IF( .NOT.ln_trcdta ) THEN
+                WRITE(numout,*)
+                WRITE(numout,*) '  All the passive tracers are initialised with constant values '
+                WRITE(numout,*)
+            ENDIF
+         ENDIF
+      ENDIF
+
+
+#if defined key_trdmld_trc || defined key_trdtrc
+         nn_trd_trc  = 20
+         nn_ctls_trc =  9
+         rn_ucf_trc   =  1.
+         ln_trdmld_trc_instant = .TRUE.
+         ln_trdmld_trc_restart =.FALSE.
+         cn_trdrst_trc_in  = "restart_mld_trc"
+         cn_trdrst_trc_out = "restart_mld_trc"
+         ln_trdtrc(:) = .FALSE.
+
+         REWIND( numnat )               !  namelist namtoptrd : passive tracer trends diagnostic
+         READ  ( numnat, namtrc_trd )
+
+         IF(lwp) THEN
+            WRITE(numout,*)
+            WRITE(numout,*) ' trd_mld_trc_init : read namelist namtrc_trd                    '
+            WRITE(numout,*) ' ~~~~~~~~~~~~~~~~                                               '
+            WRITE(numout,*) '   * frequency of trends diagnostics   nn_trd_trc             = ', nn_trd_trc
+            WRITE(numout,*) '   * control surface type              nn_ctls_trc            = ', nn_ctls_trc
+            WRITE(numout,*) '   * restart for ML diagnostics        ln_trdmld_trc_restart  = ', ln_trdmld_trc_restart
+            WRITE(numout,*) '   * flag to diagnose trends of                                 '
+            WRITE(numout,*) '     instantantaneous or mean ML T/S   ln_trdmld_trc_instant  = ', ln_trdmld_trc_instant
+            WRITE(numout,*) '   * unit conversion factor            rn_ucf_trc             = ', rn_ucf_trc
+            DO jn = 1, jptra
+               IF( ln_trdtrc(jn) ) WRITE(numout,*) '    compute ML trends for tracer number :', jn
+            END DO
+         ENDIF
+#endif
 
 
Index: /branches/2011/dev_r2787_LOCEAN3_TRA_TRP/NEMOGCM/NEMO/TOP_SRC/trcrst.F90
===================================================================
--- /branches/2011/dev_r2787_LOCEAN3_TRA_TRP/NEMOGCM/NEMO/TOP_SRC/trcrst.F90	(revision 2818)
+++ /branches/2011/dev_r2787_LOCEAN3_TRA_TRP/NEMOGCM/NEMO/TOP_SRC/trcrst.F90	(revision 2819)
@@ -285,6 +285,5 @@
 
       INTEGER  :: jn
-      REAL(wp) :: zdiag_var, zdiag_varmin, zdiag_varmax, zdiag_tot
-      REAL(wp) :: zder
+      REAL(wp) :: ztraf, zmin, zmax, zmean, zdrift
       !!----------------------------------------------------------------------
 
@@ -296,26 +295,20 @@
       ENDIF
       
-      zdiag_tot = 0.e0
-      DO jn = 1, jptra
-#  if defined key_degrad
-         zdiag_var = glob_sum( trn(:,:,:,jn) * cvol(:,:,:) * facvol(:,:,:) )
-#  else
-         zdiag_var = glob_sum( trn(:,:,:,jn) * cvol(:,:,:)  )
-#  endif
-         zdiag_varmin = MINVAL( trn(:,:,:,jn), mask= ((tmask*SPREAD(tmask_i,DIM=3,NCOPIES=jpk).NE.0.)) )
-         zdiag_varmax = MAXVAL( trn(:,:,:,jn), mask= ((tmask*SPREAD(tmask_i,DIM=3,NCOPIES=jpk).NE.0.)) )
+      DO jn = 1, jptra
+         IF( .NOT.lk_degrad )  THEN  ;  ztraf = glob_sum( trn(:,:,:,jn) * cvol(:,:,:) )
+         ELSE                        ;  ztraf = glob_sum( trn(:,:,:,jn) * cvol(:,:,:) * facvol(:,:,:) )
+         ENDIF
+         zmin = MINVAL( trn(:,:,:,jn), mask= ((tmask*SPREAD(tmask_i,DIM=3,NCOPIES=jpk).NE.0.)) )
+         zmax = MAXVAL( trn(:,:,:,jn), mask= ((tmask*SPREAD(tmask_i,DIM=3,NCOPIES=jpk).NE.0.)) )
          IF( lk_mpp ) THEN
-            CALL mpp_min( zdiag_varmin )      ! min over the global domain
-            CALL mpp_max( zdiag_varmax )      ! max over the global domain
+            CALL mpp_min( zmin )      ! min over the global domain
+            CALL mpp_max( zmax )      ! max over the global domain
          END IF
-         zdiag_tot = zdiag_tot + zdiag_var
-         zdiag_var = zdiag_var / areatot
-         IF(lwp) WRITE(numout,*) '   MEAN NO ', jn, ctrcnm(jn), ' = ', zdiag_var,   &
-            &                    ' MIN = ', zdiag_varmin, ' MAX = ', zdiag_varmax
-      END DO
-      
-      zder = ( ( zdiag_tot - trai ) / ( trai + 1.e-12 )  ) * 100._wp
-      IF(lwp) WRITE(numout,*) '   Integral of all tracers over the full domain  = ', zdiag_tot
-      IF(lwp) WRITE(numout,*) '   Drift of the sum of all tracers =', zder, ' %'
+         zmean  = ztraf / areatot
+         zdrift = ( ( ztraf - trai(jn) ) / ( trai(jn) + 1.e-12 )  ) * 100._wp
+         IF(lwp) WRITE(numout,*) ' tracer nb : ', jn,'   ', TRIM( ctrcnm(jn) ) , &
+            &    ' mean = ', zmean, ' min = ', zmin, ' max = ', zmax, ' drift = ', zdrift, ' %'
+      END DO
+      WRITE(numout,*) 
       
    END SUBROUTINE trc_rst_stat
Index: /branches/2011/dev_r2787_LOCEAN3_TRA_TRP/NEMOGCM/NEMO/TOP_SRC/trcsms.F90
===================================================================
--- /branches/2011/dev_r2787_LOCEAN3_TRA_TRP/NEMOGCM/NEMO/TOP_SRC/trcsms.F90	(revision 2818)
+++ /branches/2011/dev_r2787_LOCEAN3_TRA_TRP/NEMOGCM/NEMO/TOP_SRC/trcsms.F90	(revision 2819)
@@ -47,6 +47,4 @@
       !!---------------------------------------------------------------------
 
-      IF ( MOD( kt, nn_dttrc) /= 0 ) RETURN      ! this ROUTINE is called only every ndttrc time step
-
       IF( lk_lobster )   CALL trc_sms_lobster( kt )    ! main program of LOBSTER
       IF( lk_pisces  )   CALL trc_sms_pisces ( kt )    ! main program of PISCES 
Index: /branches/2011/dev_r2787_LOCEAN3_TRA_TRP/NEMOGCM/NEMO/TOP_SRC/trcstp.F90
===================================================================
--- /branches/2011/dev_r2787_LOCEAN3_TRA_TRP/NEMOGCM/NEMO/TOP_SRC/trcstp.F90	(revision 2818)
+++ /branches/2011/dev_r2787_LOCEAN3_TRA_TRP/NEMOGCM/NEMO/TOP_SRC/trcstp.F90	(revision 2819)
@@ -49,4 +49,9 @@
       !!-------------------------------------------------------------------
 
+      IF( kt == nit000 ) THEN
+                               CALL iom_close( numrtr )     ! close input  passive tracers restart file
+         IF( lk_trdmld_trc  )  CALL trd_mld_trc_init        ! trends: Mixed-layer
+      ENDIF
+      !
       IF( MOD( kt - 1 , nn_dttrc ) == 0 ) THEN      ! only every nn_dttrc time step
          !
@@ -58,13 +63,10 @@
          tra(:,:,:,:) = 0.e0
          !
-         IF( kt == nit000 .AND. lk_trdmld_trc  )  &
-            &                      CALL trd_mld_trc_init        ! trends: Mixed-layer
                                    CALL trc_rst_opn( kt )       ! Open tracer restart file 
-         IF( lk_iomput ) THEN  ;   CALL trc_wri( kt )           ! output of passive tracers
-         ELSE                  ;   CALL trc_dia( kt )
+         IF( lk_iomput ) THEN  ;   CALL trc_wri    ( kt )       ! output of passive tracers with iom I/O manager
+         ELSE                  ;   CALL trc_dia    ( kt )       ! output of passive tracers with old I/O manager
          ENDIF
-                                   CALL trc_sms( kt )           ! tracers: sink and source
-                                   CALL trc_trp( kt )           ! transport of passive tracers
-         IF( kt == nit000 )     CALL iom_close( numrtr )     ! close input  passive tracers restart file
+                                   CALL trc_sms    ( kt )       ! tracers: sources minus sinks
+                                   CALL trc_trp    ( kt )       ! transport of passive tracers
          IF( lrst_trc )            CALL trc_rst_wri( kt )       ! write tracer restart file
          IF( lk_trdmld_trc  )      CALL trd_mld_trc( kt )       ! trends: Mixed-layer
Index: /branches/2011/dev_r2787_LOCEAN3_TRA_TRP/NEMOGCM/NEMO/TOP_SRC/trcwri.F90
===================================================================
--- /branches/2011/dev_r2787_LOCEAN3_TRA_TRP/NEMOGCM/NEMO/TOP_SRC/trcwri.F90	(revision 2818)
+++ /branches/2011/dev_r2787_LOCEAN3_TRA_TRP/NEMOGCM/NEMO/TOP_SRC/trcwri.F90	(revision 2819)
@@ -1,20 +1,20 @@
 MODULE trcwri
-   !!===================================================================================
+   !!======================================================================
    !!                       *** MODULE trcwri ***
    !!    TOP :   Output of passive tracers
-   !!====================================================================================
+   !!======================================================================
    !! History :   1.0  !  2009-05 (C. Ethe)  Original code
    !!----------------------------------------------------------------------
-#if defined key_top &&  defined key_iomput
+#if defined key_top && defined key_iomput
    !!----------------------------------------------------------------------
-   !!   'key_top' && 'key_iomput'                              TOP models
+   !!   'key_top'                                           TOP models
    !!----------------------------------------------------------------------
    !! trc_wri_trc   :  outputs of concentration fields
    !!----------------------------------------------------------------------
-   USE dom_oce         ! ocean space and time domain variables
-   USE oce_trc
-   USE trc
-   USE iom
-   USE dianam
+   USE dom_oce     ! ocean space and time domain variables
+   USE oce_trc     ! shared variables between ocean and passive tracers
+   USE trc         ! passive tracers common variables 
+   USE iom         ! I/O manager
+   USE dianam      ! Output file name
 
    IMPLICIT NONE
@@ -50,8 +50,8 @@
       !! ** Purpose :   output passive tracers fields 
       !!---------------------------------------------------------------------
-      INTEGER, INTENT( in ) :: kt       ! ocean time-step
-      INTEGER               :: jn
-      CHARACTER (len=20)    :: cltra
-      CHARACTER (len=40) :: clhstnam
+      INTEGER, INTENT( in )     :: kt       ! ocean time-step
+      INTEGER                   :: jn
+      CHARACTER (len=20)        :: cltra
+      CHARACTER (len=40)        :: clhstnam
       INTEGER ::   inum = 11            ! temporary logical unit
       !!---------------------------------------------------------------------
Index: /branches/2011/dev_r2787_LOCEAN3_TRA_TRP/NEMOGCM/TOOLS/COMPILE/cfg.txt
===================================================================
--- /branches/2011/dev_r2787_LOCEAN3_TRA_TRP/NEMOGCM/TOOLS/COMPILE/cfg.txt	(revision 2818)
+++ /branches/2011/dev_r2787_LOCEAN3_TRA_TRP/NEMOGCM/TOOLS/COMPILE/cfg.txt	(revision 2819)
@@ -6,2 +6,4 @@
 ORCA2_LIM3 OPA_SRC LIM_SRC_3
 ORCA2_LIM OPA_SRC LIM_SRC_2 NST_SRC
+ORCA2_LIM_CFC OPA_SRC LIM_SRC_2 NST_SRC TOP_SRC
+ORCA2_OFF_CFC OPA_SRC OFF_SRC TOP_SRC
