Index: branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/CONFIG/GYRE_PISCES/EXP00/namelist_pisces_cfg
===================================================================
--- branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/CONFIG/GYRE_PISCES/EXP00/namelist_pisces_cfg	(revision 7383)
+++ branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/CONFIG/GYRE_PISCES/EXP00/namelist_pisces_cfg	(revision 7391)
@@ -1,4 +1,95 @@
 !!>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
-!! GYRE_PISCES: Configuration namelist used to overwrite SHARED/namelist_pisces_ref
+!! PISCES  (key_pisces) reference namelist (see below for key_pisces_reduced)
+!!              1  - air-sea exchange                         (nampisext)
+!!              2  - biological parameters                    (nampisbio)
+!!              3  - parameters for nutrient limitations      (nampislim)    
+!!              4  - parameters for phytoplankton             (nampisprod,nampismort)
+!!              5  - parameters for zooplankton               (nampismes,nampiszoo)
+!!              6  - parameters for remineralization          (nampisrem)
+!!              7  - parameters for calcite chemistry         (nampiscal)
+!!              8  - parameters for inputs deposition         (nampissed)
+!!              11 - Damping                                  (nampisdmp)
+!>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
+!'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
+&nampismod     !  Model used 
+!,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
+    ln_p4z = .false.
+    ln_p2z = .true.
+/
+!'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
+&nampisext     !   air-sea exchange
+!,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
+/
+!'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
+&nampisatm     !  Atmospheric prrssure 
+!,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
+/
+!'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
+&nampisbio     !   biological parameters
+!,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
+/
+!'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
+&nampislim     !   parameters for nutrient limitations
+!,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
+/
+!'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
+&nampisopt     !   parameters for optics
+!,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
+/ 
+!'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
+&nampisprod     !   parameters for phytoplankton growth
+!,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
+/
+!'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
+&nampismort     !   parameters for phytoplankton sinks
+!,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
+/
+!'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
+&nampismes     !   parameters for mesozooplankton
+!,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
+/
+!'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
+&nampiszoo     !   parameters for microzooplankton
+!,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
+/
+!'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
+&nampisfer     !   parameters for iron chemistry
+!,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
+/  
+!'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
+&nampisrem     !   parameters for remineralization
+!,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
+/
+!'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
+&nampiscal     !   parameters for Calcite chemistry
+!,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
+/
+!'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
+&nampissbc     !   parameters for inputs deposition
+!,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
+/
+!'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
+&nampisice      !  Prescribed sea ice tracers
+!,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
+/
+!'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
+&nampisdmp     !  Damping 
+!,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
+/
+!'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
+&nampismass     !  Mass conservation
+!,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
+/
+!!>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
+!! PISCES reduced (key_pisces_reduced, ex LOBSTER) : namelists
+!!              1  - biological parameters for phytoplankton    (namlobphy)
+!!              2  - biological parameters for nutrients        (namlobnut)
+!!              3  - biological parameters for zooplankton      (namlobzoo)    
+!!              4  - biological parameters for detritus         (namlobdet)
+!!              5  - biological parameters for DOM              (namlobdom)
+!!              6  - parameters from aphotic layers to sediment (namlobsed)
+!!              7  - general coefficients                       (namlobrat)
+!!              8  - optical parameters                         (namlobopt)
+!>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
 !'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
 &namlobphy     !   biological parameters for phytoplankton
@@ -15,5 +106,5 @@
 !'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
 &namlobdet     !   biological parameters for detritus
-!,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,       
+!,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
 /
 !'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Index: branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/CONFIG/GYRE_PISCES/EXP00/namelist_top_cfg
===================================================================
--- branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/CONFIG/GYRE_PISCES/EXP00/namelist_top_cfg	(revision 7383)
+++ branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/CONFIG/GYRE_PISCES/EXP00/namelist_top_cfg	(revision 7391)
@@ -1,35 +1,43 @@
 !!>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
-!! NEMO-TOP Configuration namelist for GYRE_PISCES configuration used to overwrite SHARED/namelist_top_ref
+!! NEMO/TOP1 :  Configuration namelist : used to overwrite defaults values defined in SHARED/namelist_top_ref
+!>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
 !-----------------------------------------------------------------------
 &namtrc_run     !   run information
 !-----------------------------------------------------------------------
-   nn_writetrc   =  60     !  time step frequency for sn_tracer outputs
 /
 !-----------------------------------------------------------------------
 &namtrc     !   tracers definition
 !-----------------------------------------------------------------------
-   ln_trcdta     =   .false.    !  Initialisation from data input file (T) or not (F)
+   jp_bgc        =  6
 !
-!                ! 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.
+   ln_pisces     =  .true.
+   ln_age        =  .false.
+   ln_cfc11      =  .false.
+   ln_cfc12      =  .false.
+   ln_c14        =  .false.
+   ln_my_trc     =  .false.
+!
+!                 !           !                             !               !
+!                 !    name   !   title of the field        !   units       ! initial data from file or not !
+!                 !           !                                             !                               !
+   sn_tracer(1)   = 'DET'     , 'Detritus                   ',  'mmole-N/m3' ,  .false.    
+   sn_tracer(2)   = 'ZOO'     , 'Zooplankton concentration  ',  'mmole-N/m3' ,  .false.   
+   sn_tracer(3)   = 'PHY'     , 'Phytoplankton concentration',  'mmole-N/m3' ,  .false.  
+   sn_tracer(4)   = 'NO3'     , 'Nitrate concentration      ',  'mmole-N/m3' ,  .false. 
+   sn_tracer(5)   = 'NH4'     , 'Ammonium concentration     ',  'mmole-N/m3' ,  .false.   
+   sn_tracer(6)   = 'DOM'     , 'Dissolved organic matter   ',  'mmole-N/m3' ,  .false.  
 /
 !-----------------------------------------------------------------------
-&namtrc_adv    !   advection scheme for passive tracer 
-!-----------------------------------------------------------------------   
+&namtrc_dta      !    Initialisation from data input file
+!-----------------------------------------------------------------------
+/
    ln_trcadv_fct =  .true.   !  FCT scheme
-      nn_fct_h   =  2               !  =2/4, horizontal 2nd / 4th order 
-      nn_fct_v   =  2               !  =2/4, vertical   2nd / COMPACT 4th order 
+      nn_fct_h   =  2               !  =2/4, horizontal 2nd / 4th order
+      nn_fct_v   =  2               !  =2/4, vertical   2nd / COMPACT 4th order
       nn_fct_zts =  0               !  >=1,  2nd order FCT scheme with vertical sub-timestepping
       !                             !        (number of sub-timestep = nn_fct_zts)
 /
 !-----------------------------------------------------------------------
-&namtrc_ldf    !   lateral diffusion scheme for passive tracer 
+&namtrc_ldf    !   lateral diffusion scheme for passive tracer
 !-----------------------------------------------------------------------
    rn_ahtrc_0       =  1000.    !  horizontal eddy diffusivity for tracers [m2/s]
@@ -40,15 +48,27 @@
 /
 !-----------------------------------------------------------------------
-&namtrc_rad        !  treatment of negative concentrations 
+&namtrc_rad        !  treatment of negative concentrations
 !-----------------------------------------------------------------------
    ln_trcrad   =  .false.  !  artificially correct negative concentrations (T) or not (F)
 /
 !-----------------------------------------------------------------------
-&namtrc_dia       !   parameters for passive tracer additional diagnostics
+&namtrc_dmp      !   passive tracer newtonian damping
+!-----------------------------------------------------------------------
+/
+!-----------------------------------------------------------------------
+&namtrc_ice      !    Representation of sea ice growth & melt effects
+!-----------------------------------------------------------------------
+/
+!-----------------------------------------------------------------------
+&namtrc_trd      !   diagnostics on tracer trends                       ('key_trdtrc')
+!                          or mixed-layer trends                        ('key_trdmld_trc')
 !----------------------------------------------------------------------
-   nn_writedia   =  60     !  time step frequency for diagnostics
 /
 !----------------------------------------------------------------------
-&namtrc_bc        !   data for boundary conditions
+&namtrc_bc       !   data for boundary conditions
 !-----------------------------------------------------------------------
 /
+!----------------------------------------------------------------------
+&namtrc_bdy      !   Setup of tracer boundary conditions
+!-----------------------------------------------------------------------
+/
Index: branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/CONFIG/GYRE_PISCES/cpp_GYRE_PISCES.fcm
===================================================================
--- branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/CONFIG/GYRE_PISCES/cpp_GYRE_PISCES.fcm	(revision 7383)
+++ branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/CONFIG/GYRE_PISCES/cpp_GYRE_PISCES.fcm	(revision 7391)
@@ -1,1 +1,1 @@
-bld::tool::fppkeys key_zdftke key_top key_pisces_reduced key_mpp_mpi
+bld::tool::fppkeys key_zdftke key_top key_mpp_mpi
Index: branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/CONFIG/ORCA2_LIM3_TRC/EXP00/atmc14.dat
===================================================================
--- branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/CONFIG/ORCA2_LIM3_TRC/EXP00/atmc14.dat	(revision 7391)
+++ branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/CONFIG/ORCA2_LIM3_TRC/EXP00/atmc14.dat	(revision 7391)
@@ -0,0 +1,245 @@
+ Year    South 30S-30N   North 
+ 1765.5       0        0      0
+ 1766.5       0        0      0
+ 1767.5       0        0      0
+ 1768.5       0        0      0
+ 1769.5       0        0      0
+ 1770.5       0        0      0
+ 1771.5       0        0      0
+ 1772.5       0        0      0
+ 1773.5       0        0      0
+ 1774.5       0        0      0
+ 1775.5       0        0      0
+ 1776.5       0        0      0
+ 1777.5       0        0      0
+ 1778.5       0        0      0
+ 1779.5       0        0      0
+ 1780.5       0        0      0
+ 1781.5       0        0      0
+ 1782.5       0        0      0
+ 1783.5       0        0      0
+ 1784.5       0        0      0
+ 1785.5       0        0      0
+ 1786.5       0        0      0
+ 1787.5       0        0      0
+ 1788.5       0        0      0
+ 1789.5       0        0      0
+ 1790.5       0        0      0
+ 1791.5       0        0      0
+ 1792.5       0        0      0
+ 1793.5       0        0      0
+ 1794.5       0        0      0
+ 1795.5       0        0      0
+ 1796.5       0        0      0
+ 1797.5       0        0      0
+ 1798.5       0        0      0
+ 1799.5       0        0      0
+ 1800.5       0        0      0
+ 1801.5       0        0      0
+ 1802.5       0        0      0
+ 1803.5       0        0      0
+ 1804.5       0        0      0
+ 1805.5       0        0      0
+ 1806.5       0        0      0
+ 1807.5       0        0      0
+ 1808.5       0        0      0
+ 1809.5       0        0      0
+ 1810.5       0        0      0
+ 1811.5       0        0      0
+ 1812.5       0        0      0
+ 1813.5       0        0      0
+ 1814.5       0        0      0
+ 1815.5       0        0      0
+ 1816.5       0        0      0
+ 1817.5       0        0      0
+ 1818.5       0        0      0
+ 1819.5       0        0      0
+ 1820.5       0        0      0
+ 1821.5       0        0      0
+ 1822.5       0        0      0
+ 1823.5       0        0      0
+ 1824.5       0        0      0
+ 1825.5       0        0      0
+ 1826.5       0        0      0
+ 1827.5       0        0      0
+ 1828.5       0        0      0
+ 1829.5       0        0      0
+ 1830.5       0        0      0
+ 1831.5       0        0      0
+ 1832.5       0        0      0
+ 1833.5       0        0      0
+ 1834.5       0        0      0
+ 1835.5       0        0      0
+ 1836.5       0        0      0
+ 1837.5       0        0      0
+ 1838.5       0        0      0
+ 1839.5       0        0      0
+ 1840.5    -0.9     -0.9   -0.9
+ 1841.5      -1       -1     -1
+ 1842.5    -1.2     -1.2   -1.2
+ 1843.5    -1.3     -1.3   -1.3
+ 1844.5    -1.5     -1.5   -1.5
+ 1845.5    -1.6     -1.6   -1.6
+ 1846.5    -1.7     -1.7   -1.7
+ 1847.5    -1.9     -1.9   -1.9
+ 1848.5      -2       -2     -2
+ 1849.5    -2.2     -2.2   -2.2
+ 1850.5    -2.3     -2.3   -2.3
+ 1851.5    -2.5     -2.5   -2.5
+ 1852.5    -2.6     -2.6   -2.6
+ 1853.5    -2.8     -2.8   -2.8
+ 1854.5      -3       -3     -3
+ 1855.5    -3.1     -3.1   -3.1
+ 1856.5    -3.3     -3.3   -3.3
+ 1857.5    -3.6     -3.6   -3.6
+ 1858.5    -3.8     -3.8   -3.8
+ 1859.5      -4       -4     -4
+ 1860.5    -4.2     -4.2   -4.2
+ 1861.5    -4.5     -4.5   -4.5
+ 1862.5    -4.7     -4.7   -4.7
+ 1863.5    -4.9     -4.9   -4.9
+ 1864.5    -5.2     -5.2   -5.2
+ 1865.5    -5.4     -5.4   -5.4
+ 1866.5    -5.4     -5.4   -5.4
+ 1867.5    -5.4     -5.4   -5.4
+ 1868.5    -5.4     -5.4   -5.4
+ 1869.5    -5.4     -5.4   -5.4
+ 1870.5    -5.4     -5.4   -5.4
+ 1871.5    -5.3     -5.3   -5.3
+ 1872.5    -5.3     -5.3   -5.3
+ 1873.5    -5.3     -5.3   -5.3
+ 1874.5    -5.3     -5.3   -5.3
+ 1875.5    -5.3     -5.3   -5.3
+ 1876.5    -5.3     -5.3   -5.3
+ 1877.5    -5.3     -5.3   -5.3
+ 1878.5    -5.2     -5.2   -5.2
+ 1879.5    -5.2     -5.2   -5.2
+ 1880.5    -5.2     -5.2   -5.2
+ 1881.5    -5.2     -5.2   -5.2
+ 1882.5    -5.2     -5.2   -5.2
+ 1883.5    -5.1     -5.1   -5.1
+ 1884.5    -5.1     -5.1   -5.1
+ 1885.5    -5.1     -5.1   -5.1
+ 1886.5    -4.9     -4.9   -4.9
+ 1887.5    -4.8     -4.8   -4.8
+ 1888.5    -4.6     -4.6   -4.6
+ 1889.5    -4.5     -4.5   -4.5
+ 1890.5      -7     -4.5     -2
+ 1891.5      -7     -4.5     -2
+ 1892.5      -7     -4.5     -2
+ 1893.5      -7     -4.5     -2
+ 1894.5      -7     -4.5     -2
+ 1895.5      -7     -4.5     -2
+ 1896.5    -7.3     -4.8   -2.3
+ 1897.5    -7.7     -5.2   -2.7
+ 1898.5      -8     -5.5     -3
+ 1899.5    -8.3     -5.8   -3.3
+ 1900.5    -8.7     -6.2   -3.7
+ 1901.5      -9     -6.5     -4
+ 1902.5    -9.3     -6.8   -4.3
+ 1903.5    -9.7     -7.2   -4.7
+ 1904.5     -10     -7.5     -5
+ 1905.5   -10.3     -7.8   -5.3
+ 1906.5   -10.7     -8.2   -5.7
+ 1907.5     -11     -8.5     -6
+ 1908.5   -11.3     -8.8   -6.3
+ 1909.5   -11.7     -9.2   -6.7
+ 1910.5     -12     -9.5     -7
+ 1911.5   -12.3     -9.8   -7.3
+ 1912.5   -12.7    -10.2   -7.7
+ 1913.5     -13    -10.5     -8
+ 1914.5   -13.3    -10.8   -8.3
+ 1915.5   -13.7    -11.2   -8.7
+ 1916.5     -14    -11.5     -9
+ 1917.5   -14.3    -11.8   -9.3
+ 1918.5   -14.7    -12.2   -9.7
+ 1919.5     -15    -12.5    -10
+ 1920.5   -15.3    -12.8  -10.3
+ 1921.5   -15.7    -13.2  -10.7
+ 1922.5     -16    -13.5    -11
+ 1923.5   -16.3    -13.8  -11.3
+ 1924.5   -16.7    -14.2  -11.7
+ 1925.5     -17    -14.5    -12
+ 1926.5   -17.3    -14.8  -12.3
+ 1927.5   -17.7    -15.2  -12.7
+ 1928.5     -18    -15.5    -13
+ 1929.5   -18.3    -15.8  -13.3
+ 1930.5   -18.7    -16.2  -13.7
+ 1931.5     -19    -16.5    -14
+ 1932.5   -19.3    -16.8  -14.3
+ 1933.5   -19.7    -17.2  -14.7
+ 1934.5     -20    -17.5    -15
+ 1935.5   -20.3    -17.8  -15.3
+ 1936.5   -20.7    -18.2  -15.7
+ 1937.5     -21    -18.5    -16
+ 1938.5   -21.3    -18.8  -16.3
+ 1939.5   -21.7    -19.2  -16.7
+ 1940.5   -22.2    -21.5  -20.2
+ 1941.5   -21.4    -20.8  -19.4
+ 1942.5   -21.6      -21  -19.6
+ 1943.5   -24.5    -23.9  -22.5
+ 1944.5   -23.7      -23  -21.7
+ 1945.5   -24.1    -23.4  -22.1
+ 1946.5   -23.6    -22.8  -21.6
+ 1947.5   -23.1    -22.2  -21.1
+ 1948.5   -24.3    -23.4  -22.3
+ 1949.5   -26.6    -25.9  -24.6
+ 1950.5   -26.8    -26.1  -24.8
+ 1951.5   -26.8      -26  -24.8
+ 1952.5   -26.9    -25.7  -24.9
+ 1953.5   -25.9    -23.5  -23.9
+ 1954.5   -23.8    -14.4  -21.1
+ 1955.5     -11     -6.4   -8.2
+ 1956.5    14.7     23.4   26.5
+ 1957.5    35.8     51.9     73
+ 1958.5    81.8    105.7  140.2
+ 1959.5   141.1    176.8    228
+ 1960.5   185.6    200.3  212.3
+ 1961.5   198.7    205.8  221.6
+ 1962.5   215.9    256.2  358.5
+ 1963.5   330.6    474.3  718.3
+ 1964.5   520.6    672.3  835.7
+ 1965.5   637.3    697.5  756.3
+ 1966.5   619.7    658.5  691.9
+ 1967.5   585.6    605.4  623.6
+ 1968.5   549.7    559.6  564.5
+ 1969.5   528.5    537.1  545.4
+ 1970.5     506    519.1  529.1
+ 1971.5     489    495.4  499.4
+ 1972.5   461.6    466.6  465.6
+ 1973.5   430.9    426.1  418.6
+ 1974.5   394.9    400.7  400.8
+ 1975.5   378.2    378.7  369.8
+ 1976.5   349.8    354.4  352.5
+ 1977.5   326.7      330  333.9
+ 1978.5   310.2    320.6  325.8
+ 1979.5     291    296.1  295.8
+ 1980.5   274.8      272  264.5
+ 1981.5   257.5    254.8  256.7
+ 1982.5   241.1    241.1  238.3
+ 1983.5   221.5      225  224.2
+ 1984.5   206.7    209.7  209.3
+ 1985.5   197.1      204  201.1
+ 1986.5   187.4    193.9  191.1
+ 1987.5   175.5    186.5  183.6
+ 1988.5   171.6    177.6  174.7
+ 1989.5   157.3    166.6  163.7
+ 1990.5   148.3    155.1  152.2
+ 1991.5   141.2    145.3  142.4
+ 1992.5   132.2    137.6  136.3
+ 1993.5   127.2    131.8  128.7
+ 1994.5   120.4    125.5  122.1
+ 1995.5   114.9      120  115.8
+ 1996.5   110.3    109.6  109.8
+ 1997.5   105.2    109.7    104
+ 1998.5   100.2    103.2  100.3
+ 1999.5    92.7     98.6   95.7
+ 2000.5    86.5     92.6   89.7
+ 2001.5    80.7     87.6   84.8
+ 2002.5    72.9     80.4   77.5
+ 2003.5    79.5     77.4   73.5
+ 2004.5    77.7       75   70.6
+ 2005.5    75.7       73     67
+ 2006.5      75       72     66
+ 2007.5      74       71     65
+ 2008.5      73       70     64
Index: branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/CONFIG/ORCA2_LIM3_TRC/EXP00/cfc1112.atm
===================================================================
--- branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/CONFIG/ORCA2_LIM3_TRC/EXP00/cfc1112.atm	(revision 7391)
+++ branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/CONFIG/ORCA2_LIM3_TRC/EXP00/cfc1112.atm	(revision 7391)
@@ -0,0 +1,84 @@
+ % Atmospheric lifetimes are  44.0 for CFC-11 
+ %                       and 125.0 for CFC-12 
+ % rel=  0 
+ %        <-Northern Data-> <-Southern Data->
+ % Year    CFC-11  CFC-12    CFC-11  CFC-12 
+ %         (ppt)   (ppt)      (ppt)   (ppt)
+ 1931.50    0.00    0.00       0.00    0.00   
+ 1932.50    0.00    0.01       0.00    0.01   
+ 1933.50    0.00    0.02       0.00    0.01   
+ 1934.50    0.00    0.03       0.00    0.02   
+ 1935.50    0.00    0.04       0.00    0.03   
+ 1936.50    0.00    0.07       0.00    0.04   
+ 1937.50    0.00    0.11       0.00    0.07   
+ 1938.50    0.00    0.17       0.00    0.11   
+ 1939.50    0.01    0.25       0.00    0.17   
+ 1940.50    0.01    0.37       0.01    0.25   
+ 1941.50    0.02    0.53       0.01    0.36   
+ 1942.50    0.02    0.72       0.02    0.51   
+ 1943.50    0.03    0.94       0.02    0.69   
+ 1944.50    0.04    1.25       0.03    0.91   
+ 1945.50    0.05    1.65       0.04    1.21   
+ 1946.50    0.08    2.33       0.05    1.64   
+ 1947.50    0.14    3.42       0.08    2.33   
+ 1948.50    0.24    4.73       0.14    3.32   
+ 1949.50    0.42    6.10       0.25    4.48   
+ 1950.50    0.67    7.58       0.42    5.77   
+ 1951.50    1.02    9.23       0.66    7.19   
+ 1952.50    1.53   10.94       1.01    8.72   
+ 1953.50    2.21   12.82       1.49   10.37   
+ 1954.50    3.07   14.97       2.13   12.20   
+ 1955.50    4.11   17.40       2.93   14.25   
+ 1956.50    5.39   20.22       3.92   16.59   
+ 1957.50    6.84   23.45       5.11   19.28   
+ 1958.50    8.19   26.86       6.39   22.28   
+ 1959.50    9.47   30.58       7.63   25.52   
+ 1960.50   11.13   35.03       8.96   29.18   
+ 1961.50   13.38   40.12      10.63   33.42   
+ 1962.50   16.23   45.89      12.78   38.25   
+ 1963.50   19.72   52.66      15.47   43.80   
+ 1964.50   23.87   60.57      18.75   50.28   
+ 1965.50   28.57   69.53      22.61   57.76   
+ 1966.50   33.78   79.46      26.99   66.21   
+ 1967.50   39.63   90.60      31.91   75.67   
+ 1968.50   46.27  103.16      37.46   86.31   
+ 1969.50   53.96  117.17      43.80   98.25   
+ 1970.50   62.75  132.52      51.07  111.52   
+ 1971.50   72.36  149.00      59.27  126.02   
+ 1972.50   83.04  166.85      68.34  141.70   
+ 1973.50   95.27  186.59      78.54  158.82   
+ 1974.50  108.81  208.14      90.04  177.62   
+ 1975.50  121.86  229.37     102.29  197.54   
+ 1976.50  134.47  249.51     114.40  217.31   
+ 1977.50  146.47  268.67     126.28  236.49   
+ 1978.50  157.18  286.35     137.45  254.72   
+ 1979.50  166.67  303.74     147.60  272.00   
+ 1980.50  175.11  320.96     158.08  290.34   
+ 1981.50  182.81  337.33     166.54  306.90   
+ 1982.50  189.88  352.01     174.69  323.74   
+ 1983.50  197.72  367.69     183.03  341.15   
+ 1984.50  206.34  383.86     190.95  357.80   
+ 1985.50  216.12  401.25     200.50  376.45   
+ 1986.50  227.48  420.96     209.82  394.00   
+ 1987.50  239.67  441.49     220.60  412.82   
+ 1988.50  251.05  463.22     231.46  433.46   
+ 1989.50  257.28  481.80     240.38  452.97   
+ 1990.50  263.65  493.96     249.23  470.55   
+ 1991.50  266.33  504.64     254.53  484.07   
+ 1992.50  266.00  512.87     258.80  495.65   
+ 1993.50  267.58  520.12     260.56  504.49   
+ 1994.50  267.24  526.58     261.73  512.31   
+ 1995.50  266.38  531.59     261.29  518.39   
+ 1996.50  265.25  534.81     261.08  523.50   
+ 1997.50  263.84  537.67     260.16  528.18   
+ 1998.50  262.24  999.99     258.96  999.99   
+ 1999.50  260.72  999.99     257.75  999.99   
+ 2000.50  259.34  999.99     255.69  999.99   
+ 2001.50  257.13  999.99     253.54  999.99   
+ 2002.50  254.89  999.99     252.93  999.99   
+ 2003.50  251.89  999.99     250.62  999.99   
+ 2004.50  250.67  999.99     249.52  999.99   
+ 2005.50  249.49  999.99     247.45  999.99   
+ 2006.50  248.31  999.99     245.38  999.99
+ 2007.50  247.13  999.99     243.31  999.99
+ 2008.50  245.95  999.99     241.24  999.99
Index: branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/CONFIG/ORCA2_LIM3_TRC/EXP00/domain_def.xml
===================================================================
--- branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/CONFIG/ORCA2_LIM3_TRC/EXP00/domain_def.xml	(revision 7391)
+++ branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/CONFIG/ORCA2_LIM3_TRC/EXP00/domain_def.xml	(revision 7391)
@@ -0,0 +1,1 @@
+link ../../SHARED/domain_def.xml
Index: branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/CONFIG/ORCA2_LIM3_TRC/EXP00/field_def.xml
===================================================================
--- branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/CONFIG/ORCA2_LIM3_TRC/EXP00/field_def.xml	(revision 7391)
+++ branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/CONFIG/ORCA2_LIM3_TRC/EXP00/field_def.xml	(revision 7391)
@@ -0,0 +1,1 @@
+link ../../SHARED/field_def.xml
Index: branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/CONFIG/ORCA2_LIM3_TRC/EXP00/iodef.xml
===================================================================
--- branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/CONFIG/ORCA2_LIM3_TRC/EXP00/iodef.xml	(revision 7391)
+++ branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/CONFIG/ORCA2_LIM3_TRC/EXP00/iodef.xml	(revision 7391)
@@ -0,0 +1,223 @@
+<?xml version="1.0"?>
+<simulation> 
+
+ <context id="nemo" time_origin="1950-01-01 00:00:00" >
+    
+    <!-- $id$ -->
+    
+    <!-- 
+============================================================================================================
+=                                  definition of all existing variables                                    =
+=                                            DO NOT CHANGE                                                 =
+============================================================================================================
+    -->
+    <field_definition src="./field_def.xml"/>
+    <!-- 
+============================================================================================================
+=                                           output files definition                                        =
+=                                            Define your own files                                         =
+=                                         put the variables you want...                                    =
+============================================================================================================
+    -->
+    
+    <file_definition type="multiple_file" name="@expname@_@freq@_@startdate@_@enddate@" sync_freq="10d" min_digits="4">
+    
+      <file_group id="1ts" output_freq="1ts"  output_level="10" enabled=".TRUE."/> <!-- 1 time step files -->
+
+      <file_group id="1h" output_freq="1h"  output_level="10" enabled=".TRUE."/> <!-- 1h files -->
+
+      <file_group id="2h" output_freq="2h"  output_level="10" enabled=".TRUE."/> <!-- 2h files -->
+
+      <file_group id="3h" output_freq="3h"  output_level="10" enabled=".TRUE."/> <!-- 3h files -->     
+
+      <file_group id="4h" output_freq="4h"  output_level="10" enabled=".TRUE."/> <!-- 4h files -->
+
+      <file_group id="6h" output_freq="6h"  output_level="10" enabled=".TRUE."/> <!-- 6h files -->     
+
+      <file_group id="1d" output_freq="1d"  output_level="10" enabled=".TRUE."/> <!-- 1d files -->
+      
+      <file_group id="3d" output_freq="3d"  output_level="10" enabled=".TRUE."/> <!-- 3d files -->
+      
+      <file_group id="5d" output_freq="5d"  output_level="10" enabled=".TRUE.">  <!-- 5d files -->   
+	
+	<file id="file1" name_suffix="_grid_T" description="ocean T grid variables" >
+	  <field field_ref="e3t"      />
+	  <field field_ref="toce"         name="thetao"                                                                      operation="instant" freq_op="5d" > @toce_e3t / @e3t </field>
+	  <field field_ref="soce"         name="so"                                                                          operation="instant" freq_op="5d" > @soce_e3t / @e3t </field>
+	  <field field_ref="sst"          name="tos"   />
+	  <field field_ref="sss"          name="sos"   />
+	  <field field_ref="ssh"          name="zos"   />
+	  <field field_ref="sst"          name="tosstd"       long_name="sea surface temperature standard deviation"         operation="instant" freq_op="5d" > sqrt( @sst2 - @sst * @sst ) </field>
+	  <field field_ref="ssh"          name="zosstd"       long_name="sea surface height above geoid standard deviation"  operation="instant" freq_op="5d" > sqrt( @ssh2 - @ssh * @ssh ) </field>
+	  <field field_ref="sst"          name="sstdcy"       long_name="amplitude of sst diurnal cycle"                     operation="average" freq_op="1d" > @sstmax - @sstmin </field>
+	  <field field_ref="mldkz5"   />
+	  <field field_ref="mldr10_1" />
+	  <field field_ref="mldr10_1"     name="mldr10_1dcy"  long_name="amplitude of mldr10_1 diurnal cycle"                operation="average" freq_op="1d" > @mldr10_1max - @mldr10_1min </field>
+	  <field field_ref="sbt"      />
+	  <field field_ref="heatc"        name="heatc" />
+	  <field field_ref="saltc"        name="saltc" />
+	</file>
+
+	<file id="file2" name_suffix="_SBC" description="surface fluxes variables" > <!-- time step automaticaly defined based on nn_fsbc -->
+	  <field field_ref="empmr"        name="wfo"      />
+	  <field field_ref="qsr_oce"      name="qsr_oce"  />
+	  <field field_ref="qns_oce"      name="qns_oce"  />
+	  <field field_ref="qt_oce"       name="qt_oce"   />
+	  <field field_ref="qsr_ice"      name="qsr_ice"  />
+	  <field field_ref="qns_ice"      name="qns_ice"  />
+	  <field field_ref="qtr_ice"      name="qtr_ice"  />
+	  <field field_ref="qt_ice"       name="qt_ice"   />
+	  <field field_ref="saltflx"      name="sfx"      />
+	  <field field_ref="taum"         name="taum"     />
+	  <field field_ref="wspd"         name="windsp"   />
+	  <field field_ref="precip"       name="precip"   />
+	  <!-- ice and snow -->
+	  <field field_ref="snowpre" />
+	  <field field_ref="utau_ice"     name="utau_ice" />
+	  <field field_ref="vtau_ice"     name="vtau_ice" />
+	</file>
+
+	<file id="file3" name_suffix="_grid_U" description="ocean U grid variables" >
+	  <field field_ref="e3u" />
+	  <field field_ref="ssu"          name="uos"      />
+	  <field field_ref="uoce"         name="uo"       operation="instant" freq_op="5d" > @uoce_e3u / @e3u </field>
+	  <field field_ref="utau"         name="tauuo"    />
+          <!-- available with key_diaar5 -->
+	  <field field_ref="u_masstr"     name="vozomatr" />
+	  <field field_ref="u_heattr"     name="sozohetr" />
+      <field field_ref="u_salttr"     name="sozosatr" />
+	</file>
+	
+	<file id="file4" name_suffix="_grid_V" description="ocean V grid variables" >
+	  <field field_ref="e3v" />
+	  <field field_ref="ssv"          name="vos"      />
+	  <field field_ref="voce"         name="vo"       operation="instant" freq_op="5d" > @voce_e3v / @e3v </field>
+	  <field field_ref="vtau"         name="tauvo"    />
+          <!-- available with key_diaar5 -->
+	  <field field_ref="v_masstr"     name="vomematr" />
+	  <field field_ref="v_heattr"     name="somehetr" />
+      <field field_ref="v_salttr"     name="somesatr" />
+	</file>
+	
+	<file id="file5" name_suffix="_grid_W" description="ocean W grid variables" >
+	  <field field_ref="e3w" />
+	  <field field_ref="woce"         name="wo"       />
+	  <field field_ref="avt"          name="difvho"   />
+	  <field field_ref="w_masstr"     name="vovematr" />
+	</file>
+
+	<file id="file6" name_suffix="_icemod" description="ice variables" enabled=".true." >
+          <field field_ref="snowthic_cea"    name="snthic" />
+          <field field_ref="icethic_cea"     name="sithic" />
+          <field field_ref="icevolu"         name="sivolu" />
+          <field field_ref="snowvol"         name="snvolu" />
+          <field field_ref="iceconc"         name="siconc" />
+
+          <field field_ref="isst"            name="sst"    />
+          <field field_ref="isss"            name="sss"    />
+          <field field_ref="micesalt"        name="sisali" />
+          <field field_ref="micet"           name="sitemp" />
+          <field field_ref="icest"           name="sistem" />
+          <field field_ref="icehc"           name="siheco" />
+          <field field_ref="isnowhc"         name="snheco" />
+          <field field_ref="miceage"         name="siages" />
+
+          <field field_ref="uice_ipa"        name="sivelu" />
+          <field field_ref="vice_ipa"        name="sivelv" />
+          <field field_ref="icevel"          name="sivelo" />
+          <field field_ref="idive"           name="sidive" />
+          <field field_ref="ishear"          name="sishea" />
+          <field field_ref="icestr"          name="sistre" />
+
+          <field field_ref="ibrinv"          name="sibrin" />
+          <field field_ref="icecolf"         name="sicolf" />
+
+          <field field_ref="iceage_cat"      name="siagecat" />
+          <field field_ref="iceconc_cat"     name="siconcat" />
+          <field field_ref="icethic_cat"     name="sithicat" />
+          <field field_ref="snowthic_cat"    name="snthicat" />
+          <field field_ref="salinity_cat"    name="salincat" />
+          <field field_ref="brinevol_cat"    name="sibricat" />
+	  <field field_ref="icetemp_cat"     name="sitemcat" />
+	  <field field_ref="snwtemp_cat"     name="sntemcat" />
+
+	</file>
+
+        <file id="file9" name_suffix="_ptrc_T" description="passive tracers variables" >
+           <field field_ref="Age"    operation="average" freq_op="1d" > @Age_e3t / @e3t </field>
+           <field field_ref="CFC11"  operation="average" freq_op="1d" > @CFC11_e3t / @e3t </field>
+           <field field_ref="CFC12"  operation="average" freq_op="1d" > @CFC12_e3t / @e3t </field>
+           <field field_ref="SF6"    operation="average" freq_op="1d" > @SF6_e3t / @e3t </field>
+           <field field_ref="RC14"   operation="average" freq_op="1d" > @RC14_e3t / @e3t </field>
+         </file>
+
+      </file_group>
+
+      <file_group id="1m" output_freq="1mo" output_level="10" enabled=".TRUE."/> <!-- real monthly files -->
+      <file_group id="2m" output_freq="2mo" output_level="10" enabled=".TRUE."/> <!-- real 2m files -->
+      <file_group id="3m" output_freq="3mo" output_level="10" enabled=".TRUE."/> <!-- real 3m files -->
+      <file_group id="4m" output_freq="4mo" output_level="10" enabled=".TRUE."/> <!-- real 4m files -->
+      <file_group id="6m" output_freq="6mo" output_level="10" enabled=".TRUE."/> <!-- real 6m files -->
+
+      <file_group id="1y"  output_freq="1y" output_level="10" enabled=".TRUE."/> <!-- real yearly files -->
+      <file_group id="2y"  output_freq="2y" output_level="10" enabled=".TRUE."/> <!-- real 2y files -->
+      <file_group id="5y"  output_freq="5y" output_level="10" enabled=".TRUE."/> <!-- real 5y files -->
+      <file_group id="10y" output_freq="10y" output_level="10" enabled=".TRUE."/> <!-- real 10y files -->
+
+   </file_definition>
+    
+    <!-- 
+============================================================================================================
+= grid definition = = DO NOT CHANGE =
+============================================================================================================
+    -->
+    
+   <axis_definition>  
+      <axis id="deptht"  long_name="Vertical T levels"  unit="m" positive="down" />
+      <axis id="depthu"  long_name="Vertical U levels"  unit="m" positive="down" />
+      <axis id="depthv"  long_name="Vertical V levels"  unit="m" positive="down" />
+      <axis id="depthw"  long_name="Vertical W levels"  unit="m" positive="down" />
+      <axis id="nfloat"  long_name="Float number"       unit="1"                 />
+      <axis id="icbcla"  long_name="Iceberg class"      unit="1"                 />
+      <axis id="ncatice" long_name="Ice category"       unit="1"                 />
+      <axis id="iax_20C" long_name="20 degC isotherm"   unit="degC"              />
+      <axis id="iax_28C" long_name="28 degC isotherm"   unit="degC"              />
+   </axis_definition> 
+    
+   <domain_definition src="./domain_def.xml"/>
+   
+   <grid_definition>    
+     <grid id="grid_T_2D" domain_ref="grid_T"/>
+     <grid id="grid_T_3D" domain_ref="grid_T" axis_ref="deptht"/>
+     <grid id="grid_U_2D" domain_ref="grid_U"/>
+     <grid id="grid_U_3D" domain_ref="grid_U" axis_ref="depthu"/>
+     <grid id="grid_V_2D" domain_ref="grid_V"/>
+     <grid id="grid_V_3D" domain_ref="grid_V" axis_ref="depthv"/>
+     <grid id="grid_W_2D" domain_ref="grid_W"/>
+     <grid id="grid_W_3D" domain_ref="grid_W" axis_ref="depthw"/>
+     <grid id="gznl_T_2D" domain_ref="gznl"/>
+     <grid id="gznl_T_3D" domain_ref="gznl" axis_ref="deptht"/>
+     <grid id="gznl_W_3D" domain_ref="gznl" axis_ref="depthw"/>
+    </grid_definition>   
+  </context>
+  
+
+  <context id="xios">
+
+      <variable_definition>
+	
+     <!-- 
+        We must have buffer_size > jpi*jpj*jpk*8 (with jpi and jpj the subdomain size)
+-->
+	  <variable id="buffer_size"               type="integer">50000000</variable>
+	  <variable id="buffer_server_factor_size" type="integer">2</variable>
+	  <variable id="info_level"                type="integer">0</variable>
+	  <variable id="using_server"              type="boolean">false</variable>
+	  <variable id="using_oasis"               type="boolean">false</variable>
+	  <variable id="oasis_codes_id"            type="string" >oceanx</variable>
+	
+      </variable_definition>
+               
+  </context>
+  
+</simulation>
Index: branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/CONFIG/ORCA2_LIM3_TRC/EXP00/namelist_cfg
===================================================================
--- branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/CONFIG/ORCA2_LIM3_TRC/EXP00/namelist_cfg	(revision 7391)
+++ branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/CONFIG/ORCA2_LIM3_TRC/EXP00/namelist_cfg	(revision 7391)
@@ -0,0 +1,258 @@
+!!>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
+!! NEMO/OPA  Configuration namelist : used to overwrite defaults values defined in SHARED/namelist_ref
+!!>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
+!
+!-----------------------------------------------------------------------
+&namrun        !   parameters of the run
+!-----------------------------------------------------------------------
+   nn_no       =       0   !  job number (no more used...)
+   cn_exp      =  "ORCA2"  !  experience name
+   nn_it000    =       1   !  first time step
+   nn_itend    =      75   !  last  time step (std 5475)
+   nn_date0    = 19600101  
+   nn_stock    =    5475   !  frequency of creation of a restart file (modulo referenced to 1)
+   ln_mskland  = .true.   !  mask land points in NetCDF outputs (costly: + ~15%)
+   ln_clobber  = .true.    !  clobber (overwrite) an existing file
+/
+!-----------------------------------------------------------------------
+&namcfg        !   parameters of the configuration
+!-----------------------------------------------------------------------
+   cp_cfg      =  "orca"               !  name of the configuration
+   jp_cfg      =       2               !  resolution of the configuration
+   jpidta      =     182               !  1st lateral dimension ( >= jpi )
+   jpjdta      =     149               !  2nd    "         "    ( >= jpj )
+   jpkdta      =      31               !  number of levels      ( >= jpk )
+   jpiglo      =     182               !  1st dimension of global domain --> i =jpidta
+   jpjglo      =     149               !  2nd    -                  -    --> j  =jpjdta
+   jpizoom     =       1               !  left bottom (i,j) indices of the zoom
+   jpjzoom     =       1               !  in data domain indices
+   jperio      =       4               !  lateral cond. type (between 0 and 6)
+/
+!-----------------------------------------------------------------------
+&namzgr        !   vertical coordinate
+!-----------------------------------------------------------------------
+   ln_zps      = .true.    !  z-coordinate - partial steps
+   ln_linssh   = .true.    !  linear free surface
+/
+!-----------------------------------------------------------------------
+&namdom        !   space and time domain (bathymetry, mesh, timestep)
+!-----------------------------------------------------------------------
+   nn_msh      =    0      !  create (=1) a mesh file or not (=0)
+   jphgr_msh   =       0               !  type of horizontal mesh
+   ppglam0     =  999999.0             !  longitude of first raw and column T-point (jphgr_msh = 1)
+   ppgphi0     =  999999.0             ! latitude  of first raw and column T-point (jphgr_msh = 1)
+   ppe1_deg    =  999999.0             !  zonal      grid-spacing (degrees)
+   ppe2_deg    =  999999.0             !  meridional grid-spacing (degrees)
+   ppe1_m      =  999999.0             !  zonal      grid-spacing (degrees)
+   ppe2_m      =  999999.0             !  meridional grid-spacing (degrees)
+   ppsur       =   -4762.96143546300   !  ORCA r4, r2 and r05 coefficients
+   ppa0        =     255.58049070440   ! (default coefficients)
+   ppa1        =     245.58132232490   !
+   ppkth       =      21.43336197938   !
+   ppacr       =       3.0             !
+   ppdzmin     =  999999.              !  Minimum vertical spacing
+   pphmax      =  999999.              !  Maximum depth
+   ldbletanh   =  .FALSE.              !  Use/do not use double tanf function for vertical coordinates
+   ppa2        =  999999.              !  Double tanh function parameters
+   ppkth2      =  999999.              !
+   ppacr2      =  999999.              !
+/
+!-----------------------------------------------------------------------
+&namcrs        !   Grid coarsening for dynamics output and/or
+               !   passive tracer coarsened online simulations
+!-----------------------------------------------------------------------
+/
+!-----------------------------------------------------------------------
+&namtsd    !   data : Temperature  & Salinity
+!-----------------------------------------------------------------------
+/
+!-----------------------------------------------------------------------
+&namsbc        !   Surface Boundary Condition (surface module)
+!-----------------------------------------------------------------------
+/
+!-----------------------------------------------------------------------
+&namsbc_core   !   namsbc_core  CORE bulk formulae
+!-----------------------------------------------------------------------
+/
+!-----------------------------------------------------------------------
+&namtra_qsr    !   penetrative solar radiation
+!-----------------------------------------------------------------------
+/
+!-----------------------------------------------------------------------
+&namsbc_rnf    !   runoffs namelist surface boundary condition
+!-----------------------------------------------------------------------
+/
+!-----------------------------------------------------------------------
+&namsbc_ssr    !   surface boundary condition : sea surface restoring
+!-----------------------------------------------------------------------
+/
+!-----------------------------------------------------------------------
+&namsbc_alb    !   albedo parameters
+!-----------------------------------------------------------------------
+/
+!-----------------------------------------------------------------------
+&namberg       !   iceberg parameters
+!-----------------------------------------------------------------------
+/
+!-----------------------------------------------------------------------
+&namlbc        !   lateral momentum boundary condition
+!-----------------------------------------------------------------------
+/
+!-----------------------------------------------------------------------
+&nambfr        !   bottom friction
+!-----------------------------------------------------------------------
+/
+!-----------------------------------------------------------------------
+&nambbc        !   bottom temperature boundary condition                (default: NO)
+!-----------------------------------------------------------------------
+   ln_trabbc   = .true.    !  Apply a geothermal heating at the ocean bottom
+/
+!-----------------------------------------------------------------------
+&nambbl        !   bottom boundary layer scheme
+!-----------------------------------------------------------------------
+/
+!-----------------------------------------------------------------------
+&nameos        !   ocean physical parameters
+!-----------------------------------------------------------------------
+   ln_teos10    = .true.         !  = Use TEOS-10 equation of state
+/
+!-----------------------------------------------------------------------
+&namtra_adv    !   advection scheme for tracer
+!-----------------------------------------------------------------------
+   ln_traadv_fct =  .true.    !  FCT scheme
+      nn_fct_h   =  2               !  =2/4, horizontal 2nd / 4th order 
+      nn_fct_v   =  2               !  =2/4, vertical   2nd / COMPACT 4th order 
+      nn_fct_zts =  0               !  > 1 , 2nd order FCT scheme with vertical sub-timestepping
+      !                             !        (number of sub-timestep = nn_fct_zts)
+/
+!-----------------------------------------------------------------------
+&namtra_adv_mle !  mixed layer eddy parametrisation (Fox-Kemper param)
+!-----------------------------------------------------------------------
+/
+!----------------------------------------------------------------------------------
+&namtra_ldf    !   lateral diffusion scheme for tracers
+!----------------------------------------------------------------------------------
+   !                       !  Operator type:
+   ln_traldf_lap   =  .true.   !    laplacian operator
+   ln_traldf_blp   =  .false.  !  bilaplacian operator
+   !                       !  Direction of action:
+   ln_traldf_lev   =  .false.  !  iso-level
+   ln_traldf_hor   =  .false.  !  horizontal (geopotential)
+   ln_traldf_iso   =  .true.   !  iso-neutral (standard operator)
+   ln_traldf_triad =  .false.  !  iso-neutral (triad    operator)
+   !
+   !		       	         !  iso-neutral options:        
+   ln_traldf_msc   =  .true.   !  Method of Stabilizing Correction (both operators)
+   rn_slpmax       =   0.01    !  slope limit                      (both operators)
+   ln_triad_iso    =  .false.  !  pure horizontal mixing in ML              (triad only)
+   rn_sw_triad     =  1        !  =1 switching triad ; =0 all 4 triads used (triad only)
+   ln_botmix_triad =  .false.  !  lateral mixing on bottom                  (triad only)
+   !
+   !                       !  Coefficients:
+   nn_aht_ijk_t    = 20        !  space/time variation of eddy coef
+   !                                !   =-20 (=-30)    read in eddy_diffusivity_2D.nc (..._3D.nc) file
+   !                                !   =  0           constant
+   !                                !   = 10 F(k)      =ldf_c1d
+   !                                !   = 20 F(i,j)    =ldf_c2d
+   !                                !   = 21 F(i,j,t)  =Treguier et al. JPO 1997 formulation
+   !                                !   = 30 F(i,j,k)  =ldf_c2d + ldf_c1d
+   !                                !   = 31 F(i,j,k,t)=F(local velocity)
+   rn_aht_0        = 2000.     !  lateral eddy diffusivity   (lap. operator) [m2/s]
+   rn_bht_0        = 1.e+12    !  lateral eddy diffusivity (bilap. operator) [m4/s]
+/
+!----------------------------------------------------------------------------------
+&namtra_ldfeiv !   eddy induced velocity param.
+!----------------------------------------------------------------------------------
+   ln_ldfeiv     =.true.   ! use eddy induced velocity parameterization
+   ln_ldfeiv_dia =.true.   ! diagnose eiv stream function and velocities
+   rn_aeiv_0     = 2000.   ! eddy induced velocity coefficient   [m2/s]
+   nn_aei_ijk_t  = 21      ! space/time variation of the eiv coeficient
+   !                                !   =-20 (=-30)    read in eddy_induced_velocity_2D.nc (..._3D.nc) file
+   !                                !   =  0           constant
+   !                                !   = 10 F(k)      =ldf_c1d
+   !                                !   = 20 F(i,j)    =ldf_c2d
+   !                                !   = 21 F(i,j,t)  =Treguier et al. JPO 1997 formulation
+   !                                !   = 30 F(i,j,k)  =ldf_c2d + ldf_c1d
+/
+!-----------------------------------------------------------------------
+&namtra_dmp    !   tracer: T & S newtonian damping
+!-----------------------------------------------------------------------
+/
+!-----------------------------------------------------------------------
+&namdyn_adv    !   formulation of the momentum advection
+!-----------------------------------------------------------------------
+/
+!-----------------------------------------------------------------------
+&namdyn_vor    !   option of physics/algorithm (not control by CPP keys)
+!-----------------------------------------------------------------------
+   ln_dynvor_ene = .false. !  enstrophy conserving scheme
+   ln_dynvor_ens = .false. !  energy conserving scheme
+   ln_dynvor_mix = .false. !  mixed scheme
+   ln_dynvor_een = .true.  !  energy & enstrophy scheme
+      nn_een_e3f = 0             !  e3f = masked averaging of e3t divided by 4 (=0) or by the sum of mask (=1)
+/
+!-----------------------------------------------------------------------
+&namdyn_hpg    !   Hydrostatic pressure gradient option
+!-----------------------------------------------------------------------
+/
+!-----------------------------------------------------------------------
+&namdyn_spg    !   surface pressure gradient
+!-----------------------------------------------------------------------
+   ln_dynspg_ts  = .true.  !  split-explicit free surface
+/
+!-----------------------------------------------------------------------
+&namdyn_ldf    !   lateral diffusion on momentum
+!-----------------------------------------------------------------------
+   !                       !  Type of the operator :
+   !                           !  no diffusion: set ln_dynldf_lap=..._blp=F 
+   ln_dynldf_lap =  .true.     !    laplacian operator
+   ln_dynldf_blp =  .false.    !  bilaplacian operator
+   !                       !  Direction of action  :
+   ln_dynldf_lev =  .true.     !  iso-level
+   ln_dynldf_hor =  .false.    !  horizontal (geopotential)
+   ln_dynldf_iso =  .false.    !  iso-neutral
+   !                       !  Coefficient
+   nn_ahm_ijk_t  = -30         !  space/time variation of eddy coef
+   !                                !  =-30  read in eddy_viscosity_3D.nc file
+   !                                !  =-20  read in eddy_viscosity_2D.nc file
+   !                                !  =  0  constant 
+   !                                !  = 10  F(k)=c1d
+   !                                !  = 20  F(i,j)=F(grid spacing)=c2d
+   !                                !  = 30  F(i,j,k)=c2d*c1d
+   !                                !  = 31  F(i,j,k)=F(grid spacing and local velocity)
+   rn_ahm_0      =  40000.     !  horizontal laplacian eddy viscosity   [m2/s]
+   rn_ahm_b      =      0.     !  background eddy viscosity for ldf_iso [m2/s]
+   rn_bhm_0      = 1.e+12      !  horizontal bilaplacian eddy viscosity [m4/s]
+/
+!-----------------------------------------------------------------------
+&namzdf        !   vertical physics
+!-----------------------------------------------------------------------
+/
+!-----------------------------------------------------------------------
+&namzdf_tke    !   turbulent eddy kinetic dependent vertical diffusion  ("key_zdftke")
+!-----------------------------------------------------------------------
+/
+!-----------------------------------------------------------------------
+&namzdf_ddm    !   double diffusive mixing parameterization             ("key_zdfddm")
+!-----------------------------------------------------------------------
+/
+!-----------------------------------------------------------------------
+&namzdf_tmx    !   tidal mixing parameterization                        ("key_zdftmx")
+!-----------------------------------------------------------------------
+/
+!-----------------------------------------------------------------------
+&nammpp        !   Massively Parallel Processing                        ("key_mpp_mpi)
+!-----------------------------------------------------------------------
+/
+!-----------------------------------------------------------------------
+&namctl        !   Control prints & Benchmark
+!-----------------------------------------------------------------------
+/
+!-----------------------------------------------------------------------
+&namptr       !   Poleward Transport Diagnostic
+!-----------------------------------------------------------------------
+/
+!-----------------------------------------------------------------------
+&namhsb       !  Heat and salt budgets
+!-----------------------------------------------------------------------
+/
Index: branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/CONFIG/ORCA2_LIM3_TRC/EXP00/namelist_ice_cfg
===================================================================
--- branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/CONFIG/ORCA2_LIM3_TRC/EXP00/namelist_ice_cfg	(revision 7391)
+++ branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/CONFIG/ORCA2_LIM3_TRC/EXP00/namelist_ice_cfg	(revision 7391)
@@ -0,0 +1,137 @@
+!!>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
+!! LIM3 namelist :  
+!!              1 - Generic parameters                 (namicerun)
+!!              2 - Ice initialization                 (namiceini)
+!!              3 - Ice discretization                 (namiceitd)
+!!              4 - Ice dynamics and transport         (namicedyn)
+!!              5 - Ice thermodynamics                 (namicethd)
+!!              6 - Ice salinity                       (namicesal)
+!!              7 - Ice mechanical redistribution      (namiceitdme)
+!>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
+!
+!------------------------------------------------------------------------------
+&namicerun     !   Generic parameters
+!------------------------------------------------------------------------------
+   jpl            =    5           !  number of ice  categories
+   nlay_i         =    2           !  number of ice  layers
+   nlay_s         =    1           !  number of snow layers (only 1 is working)
+   cn_icerst_in  = "restart_ice"   !  suffix of ice restart name (input)
+   cn_icerst_indir = "."           !  directory from which to read input ice restarts
+   cn_icerst_out = "restart_ice"   !  suffix of ice restart name (output)
+   cn_icerst_outdir = "."          !  directory in which to write output ice restarts
+   ln_limdyn     = .true.          !  ice dynamics (T) or thermodynamics only (F)
+   rn_amax_n     = 0.999           !  maximum tolerated ice concentration NH
+   rn_amax_s     = 0.999           !  maximum tolerated ice concentration SH
+   ln_limdiahsb  = .false.         !  check the heat and salt budgets (T) or not (F)
+   ln_limdiaout  = .true.          !  output the heat and salt budgets (T) or not (F)
+   ln_icectl     = .false.         !  ice points output for debug (T or F)
+   iiceprt       = 10              !  i-index for debug
+   jiceprt       = 10              !  j-index for debug
+/
+!------------------------------------------------------------------------------
+&namiceini     !   Ice initialization
+!------------------------------------------------------------------------------
+   ln_iceini      = .true.         !  activate ice initialization (T) or not (F)
+   rn_thres_sst   =  2.0           !  maximum water temperature with initial ice (degC)
+   rn_hts_ini_n   =  0.3           !  initial real snow thickness (m), North
+   rn_hts_ini_s   =  0.3           !        "            "             South
+   rn_hti_ini_n   =  3.0           !  initial real ice thickness  (m), North
+   rn_hti_ini_s   =  1.0           !        "            "             South
+   rn_ati_ini_n   =  0.9           !  initial ice concentration   (-), North
+   rn_ati_ini_s   =  0.9           !        "            "             South
+   rn_smi_ini_n   =  6.3           !  initial ice salinity     (g/kg), North
+   rn_smi_ini_s   =  6.3           !        "            "             South
+   rn_tmi_ini_n   =  270.          !  initial ice/snw temperature (K), North
+   rn_tmi_ini_s   =  270.          !        "            "             South
+/
+!------------------------------------------------------------------------------
+&namiceitd     !   Ice discretization
+!------------------------------------------------------------------------------
+   nn_catbnd      =    2           !  computation of ice category boundaries based on
+                                   !      1: tanh function
+                                   !      2: h^(-alpha), function of rn_himean
+   rn_himean      =    2.0         !  expected domain-average ice thickness (m), nn_catbnd = 2 only
+/
+!------------------------------------------------------------------------------
+&namicedyn     !   Ice dynamics and transport
+!------------------------------------------------------------------------------
+   nn_icestr      =    0           !  ice strength parameteriztaion                      
+                                   !     0: Hibler_79     P = pstar*<h>*exp(-c_rhg*A)
+                                   !     1: Rothrock_75   P = Cf*coeff*integral(wr.h^2)    
+   ln_icestr_bvf  =    .false.     !  ice strength function brine volume (T) or not (F)     
+   rn_pe_rdg      =   17.0         !  ridging work divided by pot. energy change in ridging, if nn_icestr = 1
+   rn_pstar       =    2.0e+04     !  ice strength thickness parameter (N/m2), nn_icestr = 0 
+   rn_crhg        =   20.0         !  ice strength conc. parameter (-), nn_icestr = 0       
+   rn_cio         =    5.0e-03     !  ice-ocean drag coefficient           (-)             
+   rn_creepl      =    1.0e-12     !  creep limit (s-1)                                   
+   rn_ecc         =    2.0         !  eccentricity of the elliptical yield curve          
+   nn_nevp        =  120           !  number of EVP subcycles                             
+   rn_relast      =    0.333       !  ratio of elastic timescale to ice time step: Telast = dt_ice * rn_relast 
+                                   !     advised value: 1/3 (rn_nevp=120) or 1/9 (rn_nevp=300)
+   nn_ahi0        =    2           !  horizontal diffusivity computation
+                                   !     0: use rn_ahi0_ref
+                                   !     1: use rn_ahi0_ref x mean grid cell length / ( 2deg mean grid cell length )
+                                   !     2: use rn_ahi0_ref x grid cell length      / ( 2deg mean grid cell length )
+   rn_ahi0_ref    = 350.0          !  horizontal sea ice diffusivity (m2/s) 
+                                   !     if nn_ahi0 > 0, rn_ahi0_ref is the reference value at a nominal 2 deg resolution
+/
+!------------------------------------------------------------------------------
+&namicehdf     !   Ice horizontal diffusion
+!------------------------------------------------------------------------------
+   nn_convfrq     = 5              !  convergence check frequency of the Crant-Nicholson scheme (perf. optimization)
+/
+!------------------------------------------------------------------------------
+&namicethd     !   Ice thermodynamics
+!------------------------------------------------------------------------------
+   rn_hnewice  = 0.1               !  thickness for new ice formation in open water (m)
+   ln_frazil   = .false.           !  use frazil ice collection thickness as a function of wind (T) or not (F)
+   rn_maxfrazb = 1.0               !  maximum fraction of frazil ice collecting at the ice base
+   rn_vfrazb   = 0.417             !  thresold drift speed for frazil ice collecting at the ice bottom (m/s)
+   rn_Cfrazb   = 5.0               !  squeezing coefficient for frazil ice collecting at the ice bottom
+   rn_himin    = 0.10              !  minimum ice thickness (m) used in remapping, must be smaller than rn_hnewice
+   rn_betas    = 0.66              !  exponent in lead-ice repratition of snow precipitation
+                                   !     betas = 1 -> equipartition, betas < 1 -> more on leads
+   rn_kappa_i  = 1.0               !  radiation attenuation coefficient in sea ice (m-1)
+   nn_conv_dif = 50                !  maximal number of iterations for heat diffusion computation
+   rn_terr_dif = 0.0001            !  maximum temperature after heat diffusion (degC)
+   nn_ice_thcon= 1                 !  sea ice thermal conductivity
+                                   !     0: k = k0 + beta.S/T (Untersteiner, 1964)
+                                   !     1: k = k0 + beta1.S/T - beta2.T (Pringle et al., 2007)
+   nn_monocat  = 0                 !  virtual ITD mono-category parameterizations (1, jpl = 1 only) or not (0)
+                                   !     2: simple piling instead of ridging --- temporary option
+                                   !     3: activate G(he) only              --- temporary option
+                                   !     4: activate lateral melting only    --- temporary option
+  ln_it_qnsice = .true.            !  iterate the surface non-solar flux with surface temperature (T) or not (F)
+/
+!------------------------------------------------------------------------------
+&namicesal     !   Ice salinity
+!------------------------------------------------------------------------------
+   nn_icesal   =  2                !  ice salinity option
+                                   !     1: constant ice salinity (S=rn_icesal)
+                                   !     2: varying salinity parameterization S(z,t)
+                                   !     3: prescribed salinity profile S(z), Schwarzacher, 1959
+   rn_icesal   =  4.               !  ice salinity (g/kg, nn_icesal = 1 only)
+   rn_sal_gd   =  5.               !  restoring ice salinity, gravity drainage (g/kg)
+   rn_time_gd  =  1.73e+6          !  restoring time scale, gravity drainage  (s)
+   rn_sal_fl   =  2.               !  restoring ice salinity, flushing (g/kg)
+   rn_time_fl  =  8.64e+5          !  restoring time scale, flushing (s)
+   rn_simax    = 20.               !  maximum tolerated ice salinity (g/kg)
+   rn_simin    =  0.1              !  minimum tolerated ice salinity (g/kg)
+/
+!------------------------------------------------------------------------------
+&namiceitdme   !   Ice mechanical redistribution (ridging and rafting)
+!------------------------------------------------------------------------------
+   rn_Cs       =   0.5             !  fraction of shearing energy contributing to ridging
+   rn_fsnowrdg =   0.5             !  snow volume fraction that survives in ridging
+   rn_fsnowrft =   0.5             !  snow volume fraction that survives in rafting
+   nn_partfun  =   1               !  type of ridging participation function
+                                   !     0: linear (Thorndike et al, 1975)
+                                   !     1: exponential (Lipscomb, 2007
+   rn_gstar    =   0.15            !  fractional area of thin ice being ridged (nn_partfun = 0)
+   rn_astar    =   0.05            !  exponential measure of ridging ice fraction (nn_partfun = 1)
+   rn_hstar    = 100.0             !  determines the maximum thickness of ridged ice (m) (Hibler, 1980)
+   ln_rafting  =   .true.          !  rafting activated (T) or not (F)
+   rn_hraft    =   0.75            !  threshold thickness for rafting (m)
+   rn_craft    =   5.0             !  squeezing coefficient used in the rafting function
+   rn_por_rdg  =   0.3             !  porosity of newly ridged ice (Lepparanta et al., 1995)
+/
Index: branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/CONFIG/ORCA2_LIM3_TRC/EXP00/namelist_ice_ref
===================================================================
--- branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/CONFIG/ORCA2_LIM3_TRC/EXP00/namelist_ice_ref	(revision 7391)
+++ branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/CONFIG/ORCA2_LIM3_TRC/EXP00/namelist_ice_ref	(revision 7391)
@@ -0,0 +1,1 @@
+link ../../SHARED/namelist_ice_lim3_ref
Index: branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/CONFIG/ORCA2_LIM3_TRC/EXP00/namelist_ref
===================================================================
--- branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/CONFIG/ORCA2_LIM3_TRC/EXP00/namelist_ref	(revision 7391)
+++ branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/CONFIG/ORCA2_LIM3_TRC/EXP00/namelist_ref	(revision 7391)
@@ -0,0 +1,1 @@
+link ../../SHARED/namelist_ref
Index: branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/CONFIG/ORCA2_LIM3_TRC/EXP00/namelist_top_cfg
===================================================================
--- branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/CONFIG/ORCA2_LIM3_TRC/EXP00/namelist_top_cfg	(revision 7391)
+++ branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/CONFIG/ORCA2_LIM3_TRC/EXP00/namelist_top_cfg	(revision 7391)
@@ -0,0 +1,71 @@
+!!>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
+!! NEMO/TOP1 :   - tracer run information                (namtrc_run)
+!!               - tracer definition                     (namtrc    )
+!!               - tracer data initialisation            (namtrc_dta)
+!!               - tracer advection                      (namtrc_adv)
+!!               - tracer lateral diffusion              (namtrc_ldf)
+!!               - tracer vertical physics               (namtrc_zdf)
+!!               - tracer newtonian damping              (namtrc_dmp)
+!!               - dynamical tracer trends               (namtrc_trd)
+!>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
+!-----------------------------------------------------------------------
+&namtrc_run      !   run information
+!-----------------------------------------------------------------------
+/
+!-----------------------------------------------------------------------
+&namtrc          !   tracers definition
+!-----------------------------------------------------------------------
+   jp_bgc        =  0           !  Number of passive tracers of the BGC model
+!
+   ln_pisces     =  .false.     !  Run PISCES BGC model
+   ln_my_trc     =  .false.     !  Run MY_TRC BGC model
+   ln_age        =  .true.      !  Run the sea water age tracer
+   ln_cfc11      =  .true.      !  Run the CFC11 passive tracer
+   ln_cfc12      =  .false.     !  Run the CFC12 passive tracer
+   ln_sf6        =  .false.     !  Run the SF6 passive tracer
+   ln_c14        =  .true.      !  Run the Radiocarbon passive tracer
+/
+!-----------------------------------------------------------------------
+&namtrc_dta      !    Initialisation from data input file
+!-----------------------------------------------------------------------
+/
+!-----------------------------------------------------------------------
+&namtrc_adv      !   advection scheme for passive tracer 
+!-----------------------------------------------------------------------
+   ln_trcadv_fct =  .true.  !  FCT scheme
+      nn_fct_h   =  2               !  =2/4, horizontal 2nd / 4th order 
+      nn_fct_v   =  2               !  =2/4, vertical   2nd / COMPACT 4th order 
+/
+!-----------------------------------------------------------------------
+&namtrc_ldf      !   lateral diffusion scheme for passive tracer 
+!-----------------------------------------------------------------------
+/
+!-----------------------------------------------------------------------
+&namtrc_zdf      !   vertical physics
+!-----------------------------------------------------------------------
+/
+!-----------------------------------------------------------------------
+&namtrc_rad      !  treatment of negative concentrations 
+!-----------------------------------------------------------------------
+/
+!-----------------------------------------------------------------------
+&namtrc_dmp      !   passive tracer newtonian damping   
+!-----------------------------------------------------------------------
+/
+!-----------------------------------------------------------------------
+&namtrc_ice      !    Representation of sea ice growth & melt effects
+!-----------------------------------------------------------------------
+/
+!-----------------------------------------------------------------------
+&namtrc_trd      !   diagnostics on tracer trends                       ('key_trdtrc')
+!                          or mixed-layer trends                        ('key_trdmld_trc')
+!----------------------------------------------------------------------
+/
+!----------------------------------------------------------------------
+&namtrc_bc       !   data for boundary conditions
+!-----------------------------------------------------------------------
+/
+!----------------------------------------------------------------------
+&namtrc_bdy      !   Setup of tracer boundary conditions
+!-----------------------------------------------------------------------
+/
Index: branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/CONFIG/ORCA2_LIM3_TRC/EXP00/namelist_top_ref
===================================================================
--- branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/CONFIG/ORCA2_LIM3_TRC/EXP00/namelist_top_ref	(revision 7391)
+++ branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/CONFIG/ORCA2_LIM3_TRC/EXP00/namelist_top_ref	(revision 7391)
@@ -0,0 +1,1 @@
+link ../../SHARED/namelist_top_ref
Index: branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/CONFIG/ORCA2_LIM3_TRC/EXP00/namelist_trc_cfg
===================================================================
--- branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/CONFIG/ORCA2_LIM3_TRC/EXP00/namelist_trc_cfg	(revision 7391)
+++ branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/CONFIG/ORCA2_LIM3_TRC/EXP00/namelist_trc_cfg	(revision 7391)
@@ -0,0 +1,32 @@
+!!>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
+!! Inert tracers reference namelist 
+!!       1  - AGE                (namage)
+!!       1  - CFC                (namcfc)
+!!       2  - C14               (namc14_typ, namc14_sbc, namc14_fcg)
+!>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
+!'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
+&namage         !   AGE - dates
+!,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
+/
+!'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
+&namcfc     !   CFC 
+!,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
+/
+!
+!'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
+&namc14_typ     !  C14 - type of C14 tracer, default values of C14/C and pco2
+!,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
+/
+!
+!'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
+&namc14_sbc     !  C14 - surface BC
+!,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
+/
+!
+!'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
+&namc14_fcg     !  files & dates
+!               !  For Paleo-historical: specify tyrc14_beg in yr BP
+!               !  For Bomb: tyrc14_beg=0
+!,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
+/
+!
Index: branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/CONFIG/ORCA2_LIM3_TRC/EXP00/namelist_trc_ref
===================================================================
--- branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/CONFIG/ORCA2_LIM3_TRC/EXP00/namelist_trc_ref	(revision 7391)
+++ branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/CONFIG/ORCA2_LIM3_TRC/EXP00/namelist_trc_ref	(revision 7391)
@@ -0,0 +1,1 @@
+link ../../SHARED/namelist_trc_ref
Index: branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/CONFIG/ORCA2_LIM3_TRC/EXP00/splco2.dat
===================================================================
--- branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/CONFIG/ORCA2_LIM3_TRC/EXP00/splco2.dat	(revision 7391)
+++ branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/CONFIG/ORCA2_LIM3_TRC/EXP00/splco2.dat	(revision 7391)
@@ -0,0 +1,482 @@
+#  4  452
+#   Weighted smoothing spline fit
+# Ice core and Mauna Loa CO2                                       
+# 50% attenuation at     23.4968    ; REG =     100.000 
+#     Time     Smoothed data   
+ 1765.0  277.9514
+ 1765.5  277.9652
+ 1766.0  277.9797
+ 1766.5  277.9949
+ 1767.0  278.0108
+ 1767.5  278.0275
+ 1768.0  278.0448
+ 1768.5  278.0628
+ 1769.0  278.0816
+ 1769.5  278.1011
+ 1770.0  278.1213
+ 1770.5  278.1423
+ 1771.0  278.1640
+ 1771.5  278.1864
+ 1772.0  278.2096
+ 1772.5  278.2335
+ 1773.0  278.2581
+ 1773.5  278.2835
+ 1774.0  278.3097
+ 1774.5  278.3366
+ 1775.0  278.3642
+ 1775.5  278.3927
+ 1776.0  278.4218
+ 1776.5  278.4518
+ 1777.0  278.4825
+ 1777.5  278.5140
+ 1778.0  278.5463
+ 1778.5  278.5793
+ 1779.0  278.6132
+ 1779.5  278.6478
+ 1780.0  278.6832
+ 1780.5  278.7194
+ 1781.0  278.7564
+ 1781.5  278.7942
+ 1782.0  278.8327
+ 1782.5  278.8721
+ 1783.0  278.9123
+ 1783.5  278.9533
+ 1784.0  278.9951
+ 1784.5  279.0378
+ 1785.0  279.0812
+ 1785.5  279.1255
+ 1786.0  279.1706
+ 1786.5  279.2165
+ 1787.0  279.2633
+ 1787.5  279.3109
+ 1788.0  279.3593
+ 1788.5  279.4085
+ 1789.0  279.4586
+ 1789.5  279.5096
+ 1790.0  279.5614
+ 1790.5  279.6140
+ 1791.0  279.6676
+ 1791.5  279.7219
+ 1792.0  279.7772
+ 1792.5  279.8332
+ 1793.0  279.8902
+ 1793.5  279.9480
+ 1794.0  280.0067
+ 1794.5  280.0662
+ 1795.0  280.1266
+ 1795.5  280.1878
+ 1796.0  280.2499
+ 1796.5  280.3129
+ 1797.0  280.3767
+ 1797.5  280.4414
+ 1798.0  280.5069
+ 1798.5  280.5732
+ 1799.0  280.6401
+ 1799.5  280.7077
+ 1800.0  280.7759
+ 1800.5  280.8447
+ 1801.0  280.9139
+ 1801.5  280.9836
+ 1802.0  281.0537
+ 1802.5  281.1241
+ 1803.0  281.1948
+ 1803.5  281.2657
+ 1804.0  281.3369
+ 1804.5  281.4081
+ 1805.0  281.4794
+ 1805.5  281.5508
+ 1806.0  281.6221
+ 1806.5  281.6933
+ 1807.0  281.7644
+ 1807.5  281.8354
+ 1808.0  281.9060
+ 1808.5  281.9764
+ 1809.0  282.0465
+ 1809.5  282.1161
+ 1810.0  282.1853
+ 1810.5  282.2540
+ 1811.0  282.3222
+ 1811.5  282.3897
+ 1812.0  282.4566
+ 1812.5  282.5228
+ 1813.0  282.5882
+ 1813.5  282.6528
+ 1814.0  282.7166
+ 1814.5  282.7794
+ 1815.0  282.8412
+ 1815.5  282.9021
+ 1816.0  282.9619
+ 1816.5  283.0205
+ 1817.0  283.0779
+ 1817.5  283.1343
+ 1818.0  283.1896
+ 1818.5  283.2438
+ 1819.0  283.2971
+ 1819.5  283.3495
+ 1820.0  283.4011
+ 1820.5  283.4519
+ 1821.0  283.5020
+ 1821.5  283.5513
+ 1822.0  283.6001
+ 1822.5  283.6483
+ 1823.0  283.6959
+ 1823.5  283.7432
+ 1824.0  283.7900
+ 1824.5  283.8365
+ 1825.0  283.8827
+ 1825.5  283.9286
+ 1826.0  283.9745
+ 1826.5  284.0201
+ 1827.0  284.0658
+ 1827.5  284.1115
+ 1828.0  284.1573
+ 1828.5  284.2032
+ 1829.0  284.2494
+ 1829.5  284.2958
+ 1830.0  284.3426
+ 1830.5  284.3898
+ 1831.0  284.4375
+ 1831.5  284.4857
+ 1832.0  284.5346
+ 1832.5  284.5842
+ 1833.0  284.6345
+ 1833.5  284.6856
+ 1834.0  284.7376
+ 1834.5  284.7906
+ 1835.0  284.8445
+ 1835.5  284.8995
+ 1836.0  284.9557
+ 1836.5  285.0131
+ 1837.0  285.0718
+ 1837.5  285.1318
+ 1838.0  285.1932
+ 1838.5  285.2561
+ 1839.0  285.3206
+ 1839.5  285.3866
+ 1840.0  285.4543
+ 1840.5  285.5233
+ 1841.0  285.5936
+ 1841.5  285.6647
+ 1842.0  285.7366
+ 1842.5  285.8088
+ 1843.0  285.8812
+ 1843.5  285.9535
+ 1844.0  286.0255
+ 1844.5  286.0971
+ 1845.0  286.1683
+ 1845.5  286.2390
+ 1846.0  286.3091
+ 1846.5  286.3786
+ 1847.0  286.4475
+ 1847.5  286.5157
+ 1848.0  286.5831
+ 1848.5  286.6498
+ 1849.0  286.7157
+ 1849.5  286.7808
+ 1850.0  286.8451
+ 1850.5  286.9087
+ 1851.0  286.9714
+ 1851.5  287.0332
+ 1852.0  287.0943
+ 1852.5  287.1544
+ 1853.0  287.2138
+ 1853.5  287.2722
+ 1854.0  287.3298
+ 1854.5  287.3865
+ 1855.0  287.4423
+ 1855.5  287.4972
+ 1856.0  287.5515
+ 1856.5  287.6052
+ 1857.0  287.6583
+ 1857.5  287.7111
+ 1858.0  287.7635
+ 1858.5  287.8158
+ 1859.0  287.8680
+ 1859.5  287.9202
+ 1860.0  287.9725
+ 1860.5  288.0250
+ 1861.0  288.0778
+ 1861.5  288.1310
+ 1862.0  288.1848
+ 1862.5  288.2392
+ 1863.0  288.2942
+ 1863.5  288.3501
+ 1864.0  288.4070
+ 1864.5  288.4648
+ 1865.0  288.5238
+ 1865.5  288.5840
+ 1866.0  288.6455
+ 1866.5  288.7084
+ 1867.0  288.7726
+ 1867.5  288.8382
+ 1868.0  288.9053
+ 1868.5  288.9737
+ 1869.0  289.0437
+ 1869.5  289.1151
+ 1870.0  289.1880
+ 1870.5  289.2624
+ 1871.0  289.3384
+ 1871.5  289.4160
+ 1872.0  289.4954
+ 1872.5  289.5764
+ 1873.0  289.6592
+ 1873.5  289.7439
+ 1874.0  289.8304
+ 1874.5  289.9188
+ 1875.0  290.0092
+ 1875.5  290.1014
+ 1876.0  290.1957
+ 1876.5  290.2918
+ 1877.0  290.3899
+ 1877.5  290.4898
+ 1878.0  290.5917
+ 1878.5  290.6954
+ 1879.0  290.8010
+ 1879.5  290.9083
+ 1880.0  291.0174
+ 1880.5  291.1281
+ 1881.0  291.2405
+ 1881.5  291.3543
+ 1882.0  291.4697
+ 1882.5  291.5864
+ 1883.0  291.7044
+ 1883.5  291.8237
+ 1884.0  291.9442
+ 1884.5  292.0658
+ 1885.0  292.1885
+ 1885.5  292.3122
+ 1886.0  292.4368
+ 1886.5  292.5622
+ 1887.0  292.6884
+ 1887.5  292.8154
+ 1888.0  292.9430
+ 1888.5  293.0711
+ 1889.0  293.1996
+ 1889.5  293.3284
+ 1890.0  293.4572
+ 1890.5  293.5860
+ 1891.0  293.7147
+ 1891.5  293.8430
+ 1892.0  293.9709
+ 1892.5  294.0982
+ 1893.0  294.2247
+ 1893.5  294.3504
+ 1894.0  294.4751
+ 1894.5  294.5987
+ 1895.0  294.7210
+ 1895.5  294.8422
+ 1896.0  294.9626
+ 1896.5  295.0822
+ 1897.0  295.2014
+ 1897.5  295.3202
+ 1898.0  295.4390
+ 1898.5  295.5578
+ 1899.0  295.6769
+ 1899.5  295.7964
+ 1900.0  295.9167
+ 1900.5  296.0378
+ 1901.0  296.1599
+ 1901.5  296.2834
+ 1902.0  296.4082
+ 1902.5  296.5348
+ 1903.0  296.6631
+ 1903.5  296.7935
+ 1904.0  296.9261
+ 1904.5  297.0609
+ 1905.0  297.1977
+ 1905.5  297.3365
+ 1906.0  297.4772
+ 1906.5  297.6196
+ 1907.0  297.7637
+ 1907.5  297.9093
+ 1908.0  298.0562
+ 1908.5  298.2043
+ 1909.0  298.3535
+ 1909.5  298.5036
+ 1910.0  298.6545
+ 1910.5  298.8061
+ 1911.0  298.9584
+ 1911.5  299.1113
+ 1912.0  299.2648
+ 1912.5  299.4189
+ 1913.0  299.5734
+ 1913.5  299.7285
+ 1914.0  299.8839
+ 1914.5  300.0397
+ 1915.0  300.1958
+ 1915.5  300.3522
+ 1916.0  300.5088
+ 1916.5  300.6656
+ 1917.0  300.8225
+ 1917.5  300.9796
+ 1918.0  301.1368
+ 1918.5  301.2941
+ 1919.0  301.4514
+ 1919.5  301.6087
+ 1920.0  301.7659
+ 1920.5  301.9232
+ 1921.0  302.0803
+ 1921.5  302.2373
+ 1922.0  302.3942
+ 1922.5  302.5508
+ 1923.0  302.7071
+ 1923.5  302.8628
+ 1924.0  303.0179
+ 1924.5  303.1723
+ 1925.0  303.3258
+ 1925.5  303.4783
+ 1926.0  303.6298
+ 1926.5  303.7800
+ 1927.0  303.9290
+ 1927.5  304.0764
+ 1928.0  304.2224
+ 1928.5  304.3668
+ 1929.0  304.5098
+ 1929.5  304.6515
+ 1930.0  304.7920
+ 1930.5  304.9312
+ 1931.0  305.0694
+ 1931.5  305.2066
+ 1932.0  305.3428
+ 1932.5  305.4782
+ 1933.0  305.6128
+ 1933.5  305.7468
+ 1934.0  305.8803
+ 1934.5  306.0135
+ 1935.0  306.1465
+ 1935.5  306.2795
+ 1936.0  306.4126
+ 1936.5  306.5461
+ 1937.0  306.6801
+ 1937.5  306.8148
+ 1938.0  306.9503
+ 1938.5  307.0871
+ 1939.0  307.2251
+ 1939.5  307.3647
+ 1940.0  307.5059
+ 1940.5  307.6490
+ 1941.0  307.7943
+ 1941.5  307.9417
+ 1942.0  308.0917
+ 1942.5  308.2444
+ 1943.0  308.3999
+ 1943.5  308.5586
+ 1944.0  308.7204
+ 1944.5  308.8857
+ 1945.0  309.0544
+ 1945.5  309.2267
+ 1946.0  309.4026
+ 1946.5  309.5824
+ 1947.0  309.7661
+ 1947.5  309.9538
+ 1948.0  310.1455
+ 1948.5  310.3415
+ 1949.0  310.5418
+ 1949.5  310.7465
+ 1950.0  310.9557
+ 1950.5  311.1696
+ 1951.0  311.3883
+ 1951.5  311.6119
+ 1952.0  311.8406
+ 1952.5  312.0746
+ 1953.0  312.3139
+ 1953.5  312.5587
+ 1954.0  312.8091
+ 1954.5  313.0653
+ 1955.0  313.3275
+ 1955.5  313.5958
+ 1956.0  313.8704
+ 1956.5  314.1514
+ 1957.0  314.4390
+ 1957.5  314.7334
+ 1958.0  315.0347
+ 1958.5  315.3430
+ 1959.0  315.6585
+ 1959.5  315.9810
+ 1960.0  316.3099
+ 1960.5  316.6444
+ 1961.0  316.9835
+ 1961.5  317.3266
+ 1962.0  317.6732
+ 1962.5  318.0236
+ 1963.0  318.3782
+ 1963.5  318.7385
+ 1964.0  319.1062
+ 1964.5  319.4833
+ 1965.0  319.8721
+ 1965.5  320.2745
+ 1966.0  320.6922
+ 1966.5  321.1253
+ 1967.0  321.5737
+ 1967.5  322.0377
+ 1968.0  322.5174
+ 1968.5  323.0131
+ 1969.0  323.5248
+ 1969.5  324.0520
+ 1970.0  324.5937
+ 1970.5  325.1487
+ 1971.0  325.7158
+ 1971.5  326.2941
+ 1972.0  326.8828
+ 1972.5  327.4806
+ 1973.0  328.0859
+ 1973.5  328.6966
+ 1974.0  329.3108
+ 1974.5  329.9296
+ 1975.0  330.5549
+ 1975.5  331.1889
+ 1976.0  331.8340
+ 1976.5  332.4917
+ 1977.0  333.1631
+ 1977.5  333.8474
+ 1978.0  334.5436
+ 1978.5  335.2500
+ 1979.0  335.9649
+ 1979.5  336.6871
+ 1980.0  337.4153
+ 1980.5  338.1481
+ 1981.0  338.8848
+ 1981.5  339.6254
+ 1982.0  340.3708
+ 1982.5  341.1221
+ 1983.0  341.8802
+ 1983.5  342.6460
+ 1984.0  343.4197
+ 1984.5  344.2017
+ 1985.0  344.9922
+ 1985.5  345.7917
+ 1986.0  346.6006
+ 1986.5  347.4193
+ 1987.0  348.2476
+ 1987.5  349.0837
+ 1988.0  349.9257
+ 1988.5  350.7702
+ 1989.0  351.6200
+ 1989.5  352.4700
+ 1990.0  353.3200
+ 1990.5  354.1700
+ 1991.0  354.9666
+ 1991.5  355.4840
+ 1992.0  355.9125
+ 1992.5  356.2656
+ 1993.0  356.4832
+ 1993.5  356.9545
+ 1994.0  357.6902
+ 1994.5  358.6209
+ 1995.0  359.6369
+ 1995.5  360.6260
+ 1996.0  361.5229
+ 1996.5  362.3600
+ 1997.0  362.8839
+ 1997.5  363.4538
+ 1998.0  364.7527
+ 1998.5  366.5040
+ 1999.0  367.6363
+ 1999.5  368.1512
+ 2000.0  368.5849
+ 2000.5  369.4103
+ 2001.0  370.3523
+ 2001.5  371.0773
+ 2002.0  371.9717
+ 2002.5  373.1636
+ 2003.0  374.4362
Index: branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/CONFIG/ORCA2_LIM3_TRC/cpp_ORCA2_LIM3_TRC.fcm
===================================================================
--- branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/CONFIG/ORCA2_LIM3_TRC/cpp_ORCA2_LIM3_TRC.fcm	(revision 7391)
+++ branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/CONFIG/ORCA2_LIM3_TRC/cpp_ORCA2_LIM3_TRC.fcm	(revision 7391)
@@ -0,0 +1,1 @@
+bld::tool::fppkeys key_trabbl key_lim3 key_zdftke key_zdfddm key_zdftmx key_top key_iomput key_mpp_mpi key_nosignedzero
Index: branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/CONFIG/ORCA2_LIM_PISCES/EXP00/iodef.xml
===================================================================
--- branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/CONFIG/ORCA2_LIM_PISCES/EXP00/iodef.xml	(revision 7383)
+++ branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/CONFIG/ORCA2_LIM_PISCES/EXP00/iodef.xml	(revision 7391)
@@ -176,6 +176,6 @@
           <field field_ref="CO3sat"   />
           <field field_ref="PAR"      />
-          <field field_ref="PPPHY"    />
-          <field field_ref="PPPHY2"   />
+          <field field_ref="PPPHYN"    />
+          <field field_ref="PPPHYD"   />
           <field field_ref="PPNEWN"   />
           <field field_ref="PPNEWD"   />
Index: branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/CONFIG/ORCA2_LIM_PISCES/EXP00/namelist_pisces_cfg
===================================================================
--- branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/CONFIG/ORCA2_LIM_PISCES/EXP00/namelist_pisces_cfg	(revision 7383)
+++ branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/CONFIG/ORCA2_LIM_PISCES/EXP00/namelist_pisces_cfg	(revision 7391)
@@ -1,63 +1,154 @@
 !!>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
-!! PISCES  :   Configuration namelist : used to overwrite defaults values defined in SHARED/namelist_pis_ref
-!>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
+!! PISCES reference namelist 
+!!              1  - air-sea exchange                         (nampisext)
+!!              2  - biological parameters                    (nampisbio)
+!!              3  - parameters for nutrient limitations      (nampislim)    
+!!              4  - parameters for phytoplankton             (nampisprod,nampismort)
+!!              5  - parameters for zooplankton               (nampismes,nampiszoo)
+!!              6  - parameters for remineralization          (nampisrem)
+!!              7  - parameters for calcite chemistry         (nampiscal)
+!!              8  - parameters for inputs deposition         (nampissed)
+!!              11 - Damping                                  (nampisdmp)
+!-----------------------------------------------------------------------
+&nampismod     !  Model used 
+!-----------------------------------------------------------------------
+/
+!-----------------------------------------------------------------------
+&nampisext     !   air-sea exchange
+!-----------------------------------------------------------------------
+/
+!-----------------------------------------------------------------------
+&nampisatm     !  Atmospheric prrssure 
+!-----------------------------------------------------------------------
+/
+!-----------------------------------------------------------------------
+&nampisbio     !   biological parameters
+!-----------------------------------------------------------------------
+/
+!-----------------------------------------------------------------------
+&namp4zlim     !   parameters for nutrient limitations for PISCES std - ln_p4z
+!-----------------------------------------------------------------------
+/
+!-----------------------------------------------------------------------
+&namp5zlim     !   parameters for nutrient limitations PISCES QUOTA - ln_p5z
+!-----------------------------------------------------------------------
+/
+!-----------------------------------------------------------------------
+&namp5zquota    !   parameters for nutrient limitations PISCES quota - ln_p5z
+!-----------------------------------------------------------------------
+/
+!-----------------------------------------------------------------------
+&nampisopt     !   parameters for optics
+!-----------------------------------------------------------------------
+/ 
+!-----------------------------------------------------------------------
+&namp4zprod     !   parameters for phytoplankton growth for PISCES std - ln_p4z
+!-----------------------------------------------------------------------
+/
 !'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
-&nampisext     !   air-sea exchange
+&namp5zprod     !   parameters for phytoplankton growth for PISCES quota - ln_p5z
 !,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
 /
-!'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
-&nampisatm     !  Atmospheric prrssure 
-!,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
+!-----------------------------------------------------------------------
+&namp4zmort     !   parameters for phytoplankton sinks for PISCES std - ln_p4z
+!-----------------------------------------------------------------------
 /
-!'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
-&nampisbio     !   biological parameters
-!,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
+!-----------------------------------------------------------------------
+&namp5zmort     !   parameters for phytoplankton sinks for PISCES quota - ln_p5z
+!-----------------------------------------------------------------------
 /
-!'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
-&nampislim     !   parameters for nutrient limitations
-!,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
+!-----------------------------------------------------------------------
+&namp4zmes     !   parameters for mesozooplankton for PISCES std - ln_p4z
+!-----------------------------------------------------------------------
 /
-!'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
-&nampisopt     !   parameters for optics
-!,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
-/ 
-!'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
-&nampisprod     !   parameters for phytoplankton growth
-!,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
+!-----------------------------------------------------------------------
+&namp5zmes     !   parameters for mesozooplankton
+!-----------------------------------------------------------------------
 /
-!'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
-&nampismort     !   parameters for phytoplankton sinks
-!,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
+!-----------------------------------------------------------------------
+&namp4zzoo     !   parameters for microzooplankton for PISCES std - ln_p4z
+!-----------------------------------------------------------------------
 /
-!'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
-&nampismes     !   parameters for mesozooplankton
-!,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
+!-----------------------------------------------------------------------
+&namp5zzoo     !   parameters for microzooplankton
+!-----------------------------------------------------------------------
 /
-!'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
-&nampiszoo     !   parameters for microzooplankton
-!,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
+!-----------------------------------------------------------------------
+&nampisfer     !   parameters for iron chemistry
+!-----------------------------------------------------------------------
 /
-!'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
-&nampisfer     !   parameters for iron chemistry
-!,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
-/  
-!'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
+!-----------------------------------------------------------------------  
 &nampisrem     !   parameters for remineralization
-!,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
+!-----------------------------------------------------------------------
 /
-!'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
+!-----------------------------------------------------------------------
+&nampispoc     !   parameters for organic particles
+!-----------------------------------------------------------------------
+/
+!-----------------------------------------------------------------------
 &nampiscal     !   parameters for Calcite chemistry
-!,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
+!-----------------------------------------------------------------------
 /
-!'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
+!-----------------------------------------------------------------------
 &nampissbc     !   parameters for inputs deposition
-!,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
+!-----------------------------------------------------------------------
 /
-!'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
+!-----------------------------------------------------------------------
+&nampislig      !  Namelist parameters for ligands, nampislig
+!-----------------------------------------------------------------------
+/
+!-----------------------------------------------------------------------
+&nampisice      !  Prescribed sea ice tracers
+!-----------------------------------------------------------------------
+/
+!-----------------------------------------------------------------------
 &nampisdmp     !  Damping 
-!,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
+!-----------------------------------------------------------------------
 /
-!'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
+!-----------------------------------------------------------------------
 &nampismass     !  Mass conservation
-!,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
+!-----------------------------------------------------------------------
 /
+!!>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
+!! PISCES reduced (key_pisces_reduced, ex LOBSTER) : namelists
+!!              1  - biological parameters for phytoplankton    (namlobphy)
+!!              2  - biological parameters for nutrients        (namlobnut)
+!!              3  - biological parameters for zooplankton      (namlobzoo)    
+!!              4  - biological parameters for detritus         (namlobdet)
+!!              5  - biological parameters for DOM              (namlobdom)
+!!              6  - parameters from aphotic layers to sediment (namlobsed)
+!!              7  - general coefficients                       (namlobrat)
+!!              8  - optical parameters                         (namlobopt)
+!>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
+!-----------------------------------------------------------------------
+&namlobphy     !   biological parameters for phytoplankton
+!-----------------------------------------------------------------------
+/
+!-----------------------------------------------------------------------
+&namlobnut     !   biological parameters for nutrients
+!-----------------------------------------------------------------------
+/
+!-----------------------------------------------------------------------
+&namlobzoo     !   biological parameters for zooplankton
+!-----------------------------------------------------------------------
+/
+!-----------------------------------------------------------------------
+&namlobdet     !   biological parameters for detritus
+!-----------------------------------------------------------------------
+/
+!-----------------------------------------------------------------------
+&namlobdom     !   biological parameters for DOM
+!-----------------------------------------------------------------------
+/
+!-----------------------------------------------------------------------
+&namlobsed     !   parameters from aphotic layers to sediment
+!-----------------------------------------------------------------------
+/
+!-----------------------------------------------------------------------
+&namlobrat     !   general coefficients
+!-----------------------------------------------------------------------
+/
+!-----------------------------------------------------------------------
+&namlobopt     !   optical parameters
+!-----------------------------------------------------------------------
+/
Index: branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/CONFIG/ORCA2_LIM_PISCES/EXP00/namelist_top_cfg
===================================================================
--- branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/CONFIG/ORCA2_LIM_PISCES/EXP00/namelist_top_cfg	(revision 7383)
+++ branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/CONFIG/ORCA2_LIM_PISCES/EXP00/namelist_top_cfg	(revision 7391)
@@ -5,35 +5,46 @@
 &namtrc_run     !   run information
 !-----------------------------------------------------------------------
+   ln_top_euler  = .true.
 /
 !-----------------------------------------------------------------------
 &namtrc     !   tracers definition
 !-----------------------------------------------------------------------
-!                !    name   !           title of the field              ! initial data ! initial data ! save   !
-!                !           !                                           !  units       ! from file    ! or not ! 
-!                !           !                                           !              ! or not       !        !
-   sn_tracer(1)   = 'DIC     ' , 'Dissolved inorganic Concentration      ',  'mol-C/L' ,  .true.     ,  .true.
-   sn_tracer(2)   = 'Alkalini' , 'Total Alkalinity Concentration         ',  'eq/L '   ,  .true.     ,  .true.
-   sn_tracer(3)   = 'O2      ' , 'Dissolved Oxygen Concentration         ',  'mol-C/L' ,  .true.     ,  .true.
-   sn_tracer(4)   = 'CaCO3   ' , 'Calcite Concentration                  ',  'mol-C/L' ,  .false.    ,  .true.
-   sn_tracer(5)   = 'PO4     ' , 'Phosphate Concentration                ',  'mol-C/L' ,  .true.     ,  .true.
-   sn_tracer(6)   = 'POC     ' , 'Small organic carbon Concentration     ',  'mol-C/L' ,  .false.    ,  .true.
-   sn_tracer(7)   = 'Si      ' , 'Silicate Concentration                 ',  'mol-C/L' ,  .true.     ,  .true.
-   sn_tracer(8)   = 'PHY     ' , 'Nanophytoplankton Concentration        ',  'mol-C/L' ,  .false.    ,  .true.
-   sn_tracer(9)   = 'ZOO     ' , 'Microzooplankton Concentration         ',  'mol-C/L' ,  .false.    ,  .true.
-   sn_tracer(10)  = 'DOC     ' , 'Dissolved organic Concentration        ',  'mol-C/L' ,  .true.     ,  .true.
-   sn_tracer(11)  = 'PHY2    ' , 'Diatoms Concentration                  ',  'mol-C/L' ,  .false.    ,  .true.
-   sn_tracer(12)  = 'ZOO2    ' , 'Mesozooplankton Concentration          ',  'mol-C/L' ,  .false.    ,  .true.
-   sn_tracer(13)  = 'DSi     ' , 'Diatoms Silicate Concentration         ',  'mol-C/L' ,  .false.    ,  .true.
-   sn_tracer(14)  = 'Fer     ' , 'Dissolved Iron Concentration           ',  'mol-C/L' ,  .true.     ,  .true.
-   sn_tracer(15)  = 'BFe     ' , 'Big iron particles Concentration       ',  'mol-C/L' ,  .false.    ,  .true.
-   sn_tracer(16)  = 'GOC     ' , 'Big organic carbon Concentration       ',  'mol-C/L' ,  .false.    ,  .true.
-   sn_tracer(17)  = 'SFe     ' , 'Small iron particles Concentration     ',  'mol-C/L' ,  .false.    ,  .true.
-   sn_tracer(18)  = 'DFe     ' , 'Diatoms iron  Concentration            ',  'mol-C/L' ,  .false.    ,  .true.
-   sn_tracer(19)  = 'GSi     ' , 'Sinking biogenic Silicate Concentration',  'mol-C/L' ,  .false.    ,  .true.
-   sn_tracer(20)  = 'NFe     ' , 'Nano iron Concentration                ',  'mol-C/L' ,  .false.    ,  .true.
-   sn_tracer(21)  = 'NCHL    ' , 'Nano chlorophyl Concentration          ',  'mol-C/L' ,  .false.    ,  .true.
-   sn_tracer(22)  = 'DCHL    ' , 'Diatoms chlorophyl Concentration       ',  'mol-C/L' ,  .false.    ,  .true.
-   sn_tracer(23)  = 'NO3     ' , 'Nitrates Concentration                 ',  'mol-C/L' ,  .true.     ,  .true.
-   sn_tracer(24)  = 'NH4     ' , 'Ammonium Concentration                 ',  'mol-C/L' ,  .false.    ,  .true.
+   jp_bgc        =  24
+!
+   ln_pisces     =  .true.
+   ln_age        =  .false.
+   ln_cfc11      =  .false.
+   ln_cfc12      =  .false.
+   ln_c14        =  .false.
+   ln_my_trc     =  .false.
+!
+   ln_trcdta     =  .true.  !  Initialisation from data input file (T) or not (F)
+!                 !           !                                          !             !
+!                 !    name   !           title of the field             !   units     ! initial data from file or not !
+!                 !           !                                          !             !
+   sn_tracer(1)   = 'DIC     ' , 'Dissolved inorganic Concentration      ',  'mol-C/L' ,  .true.
+   sn_tracer(2)   = 'Alkalini' , 'Total Alkalinity Concentration         ',  'eq/L '   ,  .true.
+   sn_tracer(3)   = 'O2      ' , 'Dissolved Oxygen Concentration         ',  'mol-C/L' ,  .true.
+   sn_tracer(4)   = 'CaCO3   ' , 'Calcite Concentration                  ',  'mol-C/L' ,  .false.
+   sn_tracer(5)   = 'PO4     ' , 'Phosphate Concentration                ',  'mol-C/L' ,  .true.
+   sn_tracer(6)   = 'POC     ' , 'Small organic carbon Concentration     ',  'mol-C/L' ,  .false.
+   sn_tracer(7)   = 'Si      ' , 'Silicate Concentration                 ',  'mol-C/L' ,  .true.
+   sn_tracer(8)   = 'PHY     ' , 'Nanophytoplankton Concentration        ',  'mol-C/L' ,  .false.
+   sn_tracer(9)   = 'ZOO     ' , 'Microzooplankton Concentration         ',  'mol-C/L' ,  .false.
+   sn_tracer(10)  = 'DOC     ' , 'Dissolved organic Concentration        ',  'mol-C/L' ,  .true.
+   sn_tracer(11)  = 'PHY2    ' , 'Diatoms Concentration                  ',  'mol-C/L' ,  .false.
+   sn_tracer(12)  = 'ZOO2    ' , 'Mesozooplankton Concentration          ',  'mol-C/L' ,  .false.
+   sn_tracer(13)  = 'DSi     ' , 'Diatoms Silicate Concentration         ',  'mol-C/L' ,  .false.
+   sn_tracer(14)  = 'Fer     ' , 'Dissolved Iron Concentration           ',  'mol-C/L' ,  .true.
+   sn_tracer(15)  = 'BFe     ' , 'Big iron particles Concentration       ',  'mol-C/L' ,  .false.
+   sn_tracer(16)  = 'GOC     ' , 'Big organic carbon Concentration       ',  'mol-C/L' ,  .false.
+   sn_tracer(17)  = 'SFe     ' , 'Small iron particles Concentration     ',  'mol-C/L' ,  .false.
+   sn_tracer(18)  = 'DFe     ' , 'Diatoms iron  Concentration            ',  'mol-C/L' ,  .false.
+   sn_tracer(19)  = 'GSi     ' , 'Sinking biogenic Silicate Concentration',  'mol-C/L' ,  .false.
+   sn_tracer(20)  = 'NFe     ' , 'Nano iron Concentration                ',  'mol-C/L' ,  .false.
+   sn_tracer(21)  = 'NCHL    ' , 'Nano chlorophyl Concentration          ',  'mol-C/L' ,  .false.
+   sn_tracer(22)  = 'DCHL    ' , 'Diatoms chlorophyl Concentration       ',  'mol-C/L' ,  .false.
+   sn_tracer(23)  = 'NO3     ' , 'Nitrates Concentration                 ',  'mol-C/L' ,  .true.
+   sn_tracer(24)  = 'NH4     ' , 'Ammonium Concentration                 ',  'mol-C/L' ,  .false.
 /
 !-----------------------------------------------------------------------
@@ -78,9 +89,21 @@
 /
 !-----------------------------------------------------------------------
-&namtrc_dia       !   parameters for passive tracer additional diagnostics
+&namtrc_dmp      !   passive tracer newtonian damping
+!-----------------------------------------------------------------------
+/
+!-----------------------------------------------------------------------
+&namtrc_ice      !    Representation of sea ice growth & melt effects
+!-----------------------------------------------------------------------
+/
+!-----------------------------------------------------------------------
+&namtrc_trd      !   diagnostics on tracer trends                       ('key_trdtrc')
+!                          or mixed-layer trends                        ('key_trdmld_trc')
 !----------------------------------------------------------------------
 /
 !----------------------------------------------------------------------
-&namtrc_bc        !   data for boundary conditions
+&namtrc_bc       !   data for boundary conditions
 !-----------------------------------------------------------------------
 /
+!----------------------------------------------------------------------
+&namtrc_bdy      !   Setup of tracer boundary conditions
+!-----------------------------------------------------------------------
Index: branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/CONFIG/ORCA2_LIM_PISCES/cpp_ORCA2_LIM_PISCES.fcm
===================================================================
--- branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/CONFIG/ORCA2_LIM_PISCES/cpp_ORCA2_LIM_PISCES.fcm	(revision 7383)
+++ branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/CONFIG/ORCA2_LIM_PISCES/cpp_ORCA2_LIM_PISCES.fcm	(revision 7391)
@@ -1,1 +1,1 @@
-bld::tool::fppkeys key_trabbl key_lim2 key_zdftke key_zdfddm key_zdftmx key_top key_pisces key_mpp_mpi key_iomput
+bld::tool::fppkeys key_trabbl key_lim2 key_zdftke key_zdfddm key_zdftmx key_top key_mpp_mpi key_iomput
Index: branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/CONFIG/ORCA2_OFF_PISCES/EXP00/iodef.xml
===================================================================
--- branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/CONFIG/ORCA2_OFF_PISCES/EXP00/iodef.xml	(revision 7383)
+++ branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/CONFIG/ORCA2_OFF_PISCES/EXP00/iodef.xml	(revision 7391)
@@ -108,6 +108,6 @@
           <field field_ref="CO3sat"   />
           <field field_ref="PAR"      />
-          <field field_ref="PPPHY"    />
-          <field field_ref="PPPHY2"   />
+          <field field_ref="PPPHYN"    />
+          <field field_ref="PPPHYD"   />
           <field field_ref="PPNEWN"   />
           <field field_ref="PPNEWD"   />
Index: branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/CONFIG/ORCA2_OFF_PISCES/EXP00/namelist_pisces_cfg
===================================================================
--- branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/CONFIG/ORCA2_OFF_PISCES/EXP00/namelist_pisces_cfg	(revision 7383)
+++ branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/CONFIG/ORCA2_OFF_PISCES/EXP00/namelist_pisces_cfg	(revision 7391)
@@ -1,65 +1,156 @@
 !!>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
-!! PISCES  :   ORCA2_OFF_PISCES configuration namelsit used to overwrite SHARED/namelist_pisces_ref
-!>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
+!! PISCES reference namelist 
+!!              1  - air-sea exchange                         (nampisext)
+!!              2  - biological parameters                    (nampisbio)
+!!              3  - parameters for nutrient limitations      (nampislim)    
+!!              4  - parameters for phytoplankton             (nampisprod,nampismort)
+!!              5  - parameters for zooplankton               (nampismes,nampiszoo)
+!!              6  - parameters for remineralization          (nampisrem)
+!!              7  - parameters for calcite chemistry         (nampiscal)
+!!              8  - parameters for inputs deposition         (nampissed)
+!!              11 - Damping                                  (nampisdmp)
+!-----------------------------------------------------------------------
+&nampismod     !  Model used 
+!-----------------------------------------------------------------------
+/
+!-----------------------------------------------------------------------
+&nampisext     !   air-sea exchange
+!-----------------------------------------------------------------------
+/
+!-----------------------------------------------------------------------
+&nampisatm     !  Atmospheric prrssure 
+!-----------------------------------------------------------------------
+/
+!-----------------------------------------------------------------------
+&nampisbio     !   biological parameters
+!-----------------------------------------------------------------------
+   nrdttrc    =  4        ! time step frequency for biology
+/
+!-----------------------------------------------------------------------
+&namp4zlim     !   parameters for nutrient limitations for PISCES std - ln_p4z
+!-----------------------------------------------------------------------
+/
+!-----------------------------------------------------------------------
+&namp5zlim     !   parameters for nutrient limitations PISCES QUOTA - ln_p5z
+!-----------------------------------------------------------------------
+/
+!-----------------------------------------------------------------------
+&namp5zquota    !   parameters for nutrient limitations PISCES quota - ln_p5z
+!-----------------------------------------------------------------------
+/
+!-----------------------------------------------------------------------
+&nampisopt     !   parameters for optics
+!-----------------------------------------------------------------------
+/ 
+!-----------------------------------------------------------------------
+&namp4zprod     !   parameters for phytoplankton growth for PISCES std - ln_p4z
+!-----------------------------------------------------------------------
+/
 !'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
-&nampisext     !   air-sea exchange
+&namp5zprod     !   parameters for phytoplankton growth for PISCES quota - ln_p5z
 !,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
 /
-!'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
-&nampisatm     !  Atmospheric prrssure 
-!,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
+!-----------------------------------------------------------------------
+&namp4zmort     !   parameters for phytoplankton sinks for PISCES std - ln_p4z
+!-----------------------------------------------------------------------
 /
-!'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
-&nampisbio     !   biological parameters
-!,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
-   nrdttrc    =  4        ! time step frequency for biology
+!-----------------------------------------------------------------------
+&namp5zmort     !   parameters for phytoplankton sinks for PISCES quota - ln_p5z
+!-----------------------------------------------------------------------
 /
-!'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
-&nampislim     !   parameters for nutrient limitations
-!,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
+!-----------------------------------------------------------------------
+&namp4zmes     !   parameters for mesozooplankton for PISCES std - ln_p4z
+!-----------------------------------------------------------------------
 /
-!'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
-&nampisopt     !   parameters for optics
-!,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
-/ 
-!'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
-&nampisprod     !   parameters for phytoplankton growth
-!,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
+!-----------------------------------------------------------------------
+&namp5zmes     !   parameters for mesozooplankton
+!-----------------------------------------------------------------------
 /
-!'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
-&nampismort     !   parameters for phytoplankton sinks
-!,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
+!-----------------------------------------------------------------------
+&namp4zzoo     !   parameters for microzooplankton for PISCES std - ln_p4z
+!-----------------------------------------------------------------------
 /
-!'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
-&nampismes     !   parameters for mesozooplankton
-!,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
+!-----------------------------------------------------------------------
+&namp5zzoo     !   parameters for microzooplankton
+!-----------------------------------------------------------------------
 /
-!'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
-&nampiszoo     !   parameters for microzooplankton
-!,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
+!-----------------------------------------------------------------------
+&nampisfer     !   parameters for iron chemistry
+!-----------------------------------------------------------------------
 /
-!'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
-&nampisfer     !   parameters for iron chemistry
-!,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
-/  
-!'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
+!-----------------------------------------------------------------------  
 &nampisrem     !   parameters for remineralization
-!,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
+!-----------------------------------------------------------------------
 /
-!'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
+!-----------------------------------------------------------------------
+&nampispoc     !   parameters for organic particles
+!-----------------------------------------------------------------------
+/
+!-----------------------------------------------------------------------
 &nampiscal     !   parameters for Calcite chemistry
-!,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
+!-----------------------------------------------------------------------
 /
-!'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
+!-----------------------------------------------------------------------
 &nampissbc     !   parameters for inputs deposition
-!,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
+!-----------------------------------------------------------------------
 /
-!'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
+!-----------------------------------------------------------------------
+&nampislig      !  Namelist parameters for ligands, nampislig
+!-----------------------------------------------------------------------
+/
+!-----------------------------------------------------------------------
+&nampisice      !  Prescribed sea ice tracers
+!-----------------------------------------------------------------------
+/
+!-----------------------------------------------------------------------
 &nampisdmp     !  Damping 
-!,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
-   nn_pisdmp    =  1460       !  Frequency of Relaxation 
+!-----------------------------------------------------------------------
+   nn_pisdmp    =  1460       !  Frequency of Relaxation
 /
-!'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
+!-----------------------------------------------------------------------
 &nampismass     !  Mass conservation
-!,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
+!-----------------------------------------------------------------------
 /
+!!>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
+!! PISCES reduced (key_pisces_reduced, ex LOBSTER) : namelists
+!!              1  - biological parameters for phytoplankton    (namlobphy)
+!!              2  - biological parameters for nutrients        (namlobnut)
+!!              3  - biological parameters for zooplankton      (namlobzoo)    
+!!              4  - biological parameters for detritus         (namlobdet)
+!!              5  - biological parameters for DOM              (namlobdom)
+!!              6  - parameters from aphotic layers to sediment (namlobsed)
+!!              7  - general coefficients                       (namlobrat)
+!!              8  - optical parameters                         (namlobopt)
+!>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
+!-----------------------------------------------------------------------
+&namlobphy     !   biological parameters for phytoplankton
+!-----------------------------------------------------------------------
+/
+!-----------------------------------------------------------------------
+&namlobnut     !   biological parameters for nutrients
+!-----------------------------------------------------------------------
+/
+!-----------------------------------------------------------------------
+&namlobzoo     !   biological parameters for zooplankton
+!-----------------------------------------------------------------------
+/
+!-----------------------------------------------------------------------
+&namlobdet     !   biological parameters for detritus
+!-----------------------------------------------------------------------
+/
+!-----------------------------------------------------------------------
+&namlobdom     !   biological parameters for DOM
+!-----------------------------------------------------------------------
+/
+!-----------------------------------------------------------------------
+&namlobsed     !   parameters from aphotic layers to sediment
+!-----------------------------------------------------------------------
+/
+!-----------------------------------------------------------------------
+&namlobrat     !   general coefficients
+!-----------------------------------------------------------------------
+/
+!-----------------------------------------------------------------------
+&namlobopt     !   optical parameters
+!-----------------------------------------------------------------------
+/
Index: branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/CONFIG/ORCA2_OFF_PISCES/EXP00/namelist_top_cfg
===================================================================
--- branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/CONFIG/ORCA2_OFF_PISCES/EXP00/namelist_top_cfg	(revision 7383)
+++ branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/CONFIG/ORCA2_OFF_PISCES/EXP00/namelist_top_cfg	(revision 7391)
@@ -1,57 +1,64 @@
 !!>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
-!! NEMO/TOP1 : ORCA2_OFF_PISCES configuration namelist used to overwrite SHARED/namelist_top
+!! NEMO/TOP1 :  Configuration namelist : used to overwrite defaults values defined in SHARED/namelist_top_ref
 !>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
 !-----------------------------------------------------------------------
 &namtrc_run     !   run information
 !-----------------------------------------------------------------------
-   nn_writetrc   =  1460     !  time step frequency for sn_tracer outputs
+   ln_top_euler  = .true.
 /
 !-----------------------------------------------------------------------
 &namtrc     !   tracers definition
 !-----------------------------------------------------------------------
+   jp_bgc        =  24
 !
-!              !    name   !           title of the field              !   units    ! initial data ! save   !
-!              !           !                                           !            ! from file    ! or not ! 
-!              !           !                                           !            ! or not       !        !
-   sn_tracer(1)   = 'DIC     ' , 'Dissolved inorganic Concentration      ',  'mol-C/L' ,  .true.     ,  .true.
-   sn_tracer(2)   = 'Alkalini' , 'Total Alkalinity Concentration         ',  'eq/L '   ,  .true.     ,  .true.
-   sn_tracer(3)   = 'O2      ' , 'Dissolved Oxygen Concentration         ',  'mol-C/L' ,  .true.     ,  .true.
-   sn_tracer(4)   = 'CaCO3   ' , 'Calcite Concentration                  ',  'mol-C/L' ,  .false.    ,  .true.
-   sn_tracer(5)   = 'PO4     ' , 'Phosphate Concentration                ',  'mol-C/L' ,  .true.     ,  .true.
-   sn_tracer(6)   = 'POC     ' , 'Small organic carbon Concentration     ',  'mol-C/L' ,  .false.    ,  .true.
-   sn_tracer(7)   = 'Si      ' , 'Silicate Concentration                 ',  'mol-C/L' ,  .true.     ,  .true.
-   sn_tracer(8)   = 'PHY     ' , 'Nanophytoplankton Concentration        ',  'mol-C/L' ,  .false.    ,  .true.
-   sn_tracer(9)   = 'ZOO     ' , 'Microzooplankton Concentration         ',  'mol-C/L' ,  .false.    ,  .true.
-   sn_tracer(10)  = 'DOC     ' , 'Dissolved organic Concentration        ',  'mol-C/L' ,  .false.    ,  .true.
-   sn_tracer(11)  = 'PHY2    ' , 'Diatoms Concentration                  ',  'mol-C/L' ,  .false.    ,  .true.
-   sn_tracer(12)  = 'ZOO2    ' , 'Mesozooplankton Concentration          ',  'mol-C/L' ,  .false.    ,  .true.
-   sn_tracer(13)  = 'DSi     ' , 'Diatoms Silicate Concentration         ',  'mol-C/L' ,  .false.    ,  .true.
-   sn_tracer(14)  = 'Fer     ' , 'Dissolved Iron Concentration           ',  'mol-C/L' ,  .true.     ,  .true.
-   sn_tracer(15)  = 'BFe     ' , 'Big iron particles Concentration       ',  'mol-C/L' ,  .false.    ,  .true.
-   sn_tracer(16)  = 'GOC     ' , 'Big organic carbon Concentration       ',  'mol-C/L' ,  .false.    ,  .true.
-   sn_tracer(17)  = 'SFe     ' , 'Small iron particles Concentration     ',  'mol-C/L' ,  .false.    ,  .true.
-   sn_tracer(18)  = 'DFe     ' , 'Diatoms iron  Concentration            ',  'mol-C/L' ,  .false.    ,  .true.
-   sn_tracer(19)  = 'GSi     ' , 'Sinking biogenic Silicate Concentration',  'mol-C/L' ,  .false.    ,  .true.
-   sn_tracer(20)  = 'NFe     ' , 'Nano iron Concentration                ',  'mol-C/L' ,  .false.    ,  .true.
-   sn_tracer(21)  = 'NCHL    ' , 'Nano chlorophyl Concentration          ',  'mol-C/L' ,  .false.    ,  .true.
-   sn_tracer(22)  = 'DCHL    ' , 'Diatoms chlorophyl Concentration       ',  'mol-C/L' ,  .false.    ,  .true.
-   sn_tracer(23)  = 'NO3     ' , 'Nitrates Concentration                 ',  'mol-C/L' ,  .true.     ,  .true.
-   sn_tracer(24)  = 'NH4     ' , 'Ammonium Concentration                 ',  'mol-C/L' ,  .false.    ,  .true.
+   ln_pisces     =  .true.
+   ln_my_trc     =  .false.
+   ln_age        =  .false.
+   ln_cfc11      =  .false.
+   ln_cfc12      =  .false.
+   ln_c14        =  .false.
+!
+   ln_trcdta     =  .true.  !  Initialisation from data input file (T) or not (F)
+!                 !           !                                          !             !
+!                 !    name   !           title of the field             !   units     ! initial data from file or not !
+!                 !           !                                          !             !
+   sn_tracer(1)   = 'DIC     ' , 'Dissolved inorganic Concentration      ',  'mol-C/L' ,  .true.
+   sn_tracer(2)   = 'Alkalini' , 'Total Alkalinity Concentration         ',  'eq/L '   ,  .true.
+   sn_tracer(3)   = 'O2      ' , 'Dissolved Oxygen Concentration         ',  'mol-C/L' ,  .true.
+   sn_tracer(4)   = 'CaCO3   ' , 'Calcite Concentration                  ',  'mol-C/L' ,  .false.
+   sn_tracer(5)   = 'PO4     ' , 'Phosphate Concentration                ',  'mol-C/L' ,  .true.
+   sn_tracer(6)   = 'POC     ' , 'Small organic carbon Concentration     ',  'mol-C/L' ,  .false.
+   sn_tracer(7)   = 'Si      ' , 'Silicate Concentration                 ',  'mol-C/L' ,  .true.
+   sn_tracer(8)   = 'PHY     ' , 'Nanophytoplankton Concentration        ',  'mol-C/L' ,  .false.
+   sn_tracer(9)   = 'ZOO     ' , 'Microzooplankton Concentration         ',  'mol-C/L' ,  .false.
+   sn_tracer(10)  = 'DOC     ' , 'Dissolved organic Concentration        ',  'mol-C/L' ,  .true.
+   sn_tracer(11)  = 'PHY2    ' , 'Diatoms Concentration                  ',  'mol-C/L' ,  .false.
+   sn_tracer(12)  = 'ZOO2    ' , 'Mesozooplankton Concentration          ',  'mol-C/L' ,  .false.
+   sn_tracer(13)  = 'DSi     ' , 'Diatoms Silicate Concentration         ',  'mol-C/L' ,  .false.
+   sn_tracer(14)  = 'Fer     ' , 'Dissolved Iron Concentration           ',  'mol-C/L' ,  .true.
+   sn_tracer(15)  = 'BFe     ' , 'Big iron particles Concentration       ',  'mol-C/L' ,  .false.
+   sn_tracer(16)  = 'GOC     ' , 'Big organic carbon Concentration       ',  'mol-C/L' ,  .false.
+   sn_tracer(17)  = 'SFe     ' , 'Small iron particles Concentration     ',  'mol-C/L' ,  .false.
+   sn_tracer(18)  = 'DFe     ' , 'Diatoms iron  Concentration            ',  'mol-C/L' ,  .false.
+   sn_tracer(19)  = 'GSi     ' , 'Sinking biogenic Silicate Concentration',  'mol-C/L' ,  .false.
+   sn_tracer(20)  = 'NFe     ' , 'Nano iron Concentration                ',  'mol-C/L' ,  .false.
+   sn_tracer(21)  = 'NCHL    ' , 'Nano chlorophyl Concentration          ',  'mol-C/L' ,  .false.
+   sn_tracer(22)  = 'DCHL    ' , 'Diatoms chlorophyl Concentration       ',  'mol-C/L' ,  .false.
+   sn_tracer(23)  = 'NO3     ' , 'Nitrates Concentration                 ',  'mol-C/L' ,  .true.
+   sn_tracer(24)  = 'NH4     ' , 'Ammonium Concentration                 ',  'mol-C/L' ,  .false.
 /
 !-----------------------------------------------------------------------
 &namtrc_dta      !    Initialisation from data input file
 !-----------------------------------------------------------------------
-!
 !          !  file name  ! frequency (hours) ! variable  ! time interp. !  clim  ! 'yearly'/ ! weights  ! rotation ! land/sea mask !
 !          !             !  (if <0  months)  !   name    !   (logical)  !  (T/F) ! 'monthly' ! filename ! pairing  ! filename      !
-   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(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
+   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'  , ''       , ''   , ''
    rn_trfac(1)   =   1.0e-06  !  multiplicative factor
    rn_trfac(2)   =   1.0e-06  !  -      -      -     -
@@ -59,4 +66,5 @@
    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  !  -      -      -     -
@@ -81,10 +89,21 @@
 /
 !-----------------------------------------------------------------------
-&namtrc_dia       !   parameters for passive tracer additional diagnostics
+&namtrc_dmp      !   passive tracer newtonian damping
+!-----------------------------------------------------------------------
+/
+!-----------------------------------------------------------------------
+&namtrc_ice      !    Representation of sea ice growth & melt effects
+!-----------------------------------------------------------------------
+/
+!-----------------------------------------------------------------------
+&namtrc_trd      !   diagnostics on tracer trends                       ('key_trdtrc')
+!                          or mixed-layer trends                        ('key_trdmld_trc')
 !----------------------------------------------------------------------
-   nn_writedia   =  1460     !  time step frequency for diagnostics
 /
 !----------------------------------------------------------------------
-&namtrc_bc        !   data for boundary conditions
+&namtrc_bc       !   data for boundary conditions
 !-----------------------------------------------------------------------
 /
+!----------------------------------------------------------------------
+&namtrc_bdy      !   Setup of tracer boundary conditions
+!-----------------------------------------------------------------------
Index: branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/CONFIG/ORCA2_OFF_PISCES/cpp_ORCA2_OFF_PISCES.fcm
===================================================================
--- branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/CONFIG/ORCA2_OFF_PISCES/cpp_ORCA2_OFF_PISCES.fcm	(revision 7383)
+++ branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/CONFIG/ORCA2_OFF_PISCES/cpp_ORCA2_OFF_PISCES.fcm	(revision 7391)
@@ -1,1 +1,1 @@
-bld::tool::fppkeys key_trabbl key_top key_offline key_pisces key_iomput key_mpp_mpi
+bld::tool::fppkeys key_trabbl key_top key_offline key_iomput key_mpp_mpi
Index: branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/CONFIG/SHARED/field_def.xml
===================================================================
--- branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/CONFIG/SHARED/field_def.xml	(revision 7383)
+++ branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/CONFIG/SHARED/field_def.xml	(revision 7391)
@@ -901,69 +901,119 @@
 
      <field_group id="ptrc_T" grid_ref="grid_T_3D">
+       <!-- PISCES standard : variables available with ln_p4z  -->
        <field id="DIC"          long_name="Dissolved inorganic Concentration"        unit="mmol/m3" />
-       <field id="DIC_E3T"      long_name="DIC * E3T"                                unit="mmol/m2" > DIC * e3t </field >
+       <field id="DIC_e3t"      long_name="DIC * e3t"                                unit="mmol/m2" > DIC * e3t </field >
        <field id="Alkalini"     long_name="Total Alkalinity Concentration"           unit="mmol/m3" />
-       <field id="Alkalini_E3T" long_name="Alkalini * E3T"                           unit="mmol/m2"  > Alkalini * e3t </field >
+       <field id="Alkalini_e3t" long_name="Alkalini * e3t"                           unit="mmol/m2"  > Alkalini * e3t </field >
        <field id="O2"           long_name="Oxygen Concentration"                     unit="mmol/m3" />
-       <field id="O2_E3T"       long_name="O2 * E3T"                                 unit="mmol/m2"  > O2 * e3t </field >
+       <field id="O2_e3t"       long_name="O2 * e3t"                                 unit="mmol/m2"  > O2 * e3t </field >
        <field id="CaCO3"        long_name="Calcite Concentration"                    unit="mmol/m3" />
-       <field id="CaCO3_E3T"    long_name="CaCO3 * E3T"                              unit="mmol/m2"  > CaCO3 * e3t </field >
+       <field id="CaCO3_e3t"    long_name="CaCO3 * e3t"                              unit="mmol/m2"  > CaCO3 * e3t </field >
        <field id="PO4"          long_name="Phosphate Concentration"                  unit="mmol/m3" />
-       <field id="PO4_E3T"      long_name="PO4 * E3T"                                unit="mmol/m2"  > PO4 * e3t </field >
+       <field id="PO4_e3t"      long_name="PO4 * e3t"                                unit="mmol/m2"  > PO4 * e3t </field >
        <field id="POC"          long_name="Small organic carbon Concentration"       unit="mmol/m3" />
-       <field id="POC_E3T"      long_name="POC * E3T"                                unit="mmol/m2"  > POC * e3t </field >
+       <field id="POC_e3t"      long_name="POC * e3t"                                unit="mmol/m2"  > POC * e3t </field >
        <field id="Si"           long_name="Silicate Concentration"                   unit="mmol/m3" />
-       <field id="Si_E3T"       long_name="Si * E3T"                                 unit="mmol/m2"  > Si * e3t </field >
+       <field id="Si_e3t"       long_name="Si * e3t"                                 unit="mmol/m2"  > Si * e3t </field >
        <field id="PHY"          long_name="(Nano)Phytoplankton Concentration"        unit="mmol/m3" />
-       <field id="PHY_E3T"      long_name="PHY * E3T"                                unit="mmol/m2"  > PHY * e3t </field >
+       <field id="PHY_e3t"      long_name="PHY * e3t"                                unit="mmol/m2"  > PHY * e3t </field >
        <field id="ZOO"          long_name="(Micro)Zooplankton Concentration"         unit="mmol/m3" />
-       <field id="ZOO_E3T"      long_name="ZOO2 * E3T"                               unit="mmol/m2"  > ZOO * e3t </field >
+       <field id="ZOO_e3t"      long_name="ZOO2 * e3t"                               unit="mmol/m2"  > ZOO * e3t </field >
        <field id="DOC"          long_name="Dissolved organic Concentration"          unit="mmol/m3" />
-       <field id="DOC_E3T"      long_name="DOC * E3T"                                unit="mmol/m2"  > DOC * e3t </field >
+       <field id="DOC_e3t"      long_name="DOC * e3t"                                unit="mmol/m2"  > DOC * e3t </field >
        <field id="PHY2"         long_name="Diatoms Concentration"                    unit="mmol/m3" />
-       <field id="PHY2_E3T"     long_name="PHY2 * E3T"                               unit="mmol/m2"  > PHY2 * e3t </field >
+       <field id="PHY2_e3t"     long_name="PHY2 * e3t"                               unit="mmol/m2"  > PHY2 * e3t </field >
        <field id="ZOO2"         long_name="Mesozooplankton Concentration"            unit="mmol/m3" />
-       <field id="ZOO2_E3T"     long_name="ZOO2 * E3T"                               unit="mmol/m2"  > ZOO2 * e3t </field >
+       <field id="ZOO2_e3t"     long_name="ZOO2 * e3t"                               unit="mmol/m2"  > ZOO2 * e3t </field >
        <field id="DSi"          long_name="Diatoms Silicate Concentration"           unit="mmol/m3" />
-       <field id="DSi_E3T"      long_name="Dsi * E3T"                                unit="mmol/m2"  > DSi * e3t </field >
+       <field id="DSi_e3t"      long_name="Dsi * e3t"                                unit="mmol/m2"  > DSi * e3t </field >
        <field id="Fer"          long_name="Dissolved Iron Concentration"             unit="mmol/m3" />
-       <field id="Fer_E3T"      long_name="Fer * E3T"                                unit="mmol/m2"  > Fer * e3t </field >
+       <field id="Fer_e3t"      long_name="Fer * e3t"                                unit="mmol/m2"  > Fer * e3t </field >
        <field id="BFe"          long_name="Big iron particles Concentration"         unit="mmol/m3" />
-       <field id="BFe_E3T"      long_name="BFe * E3T"                                unit="mmol/m2"  > BFe * e3t </field >
+       <field id="BFe_e3t"      long_name="BFe * e3t"                                unit="mmol/m2"  > BFe * e3t </field >
        <field id="GOC"          long_name="Big organic carbon Concentration"         unit="mmol/m3" />
-       <field id="GOC_E3T"      long_name="GOC * E3T"                                unit="mmol/m2"  > GOC * e3t </field >
+       <field id="GOC_e3t"      long_name="GOC * e3t"                                unit="mmol/m2"  > GOC * e3t </field >
        <field id="SFe"          long_name="Small iron particles Concentration"       unit="mmol/m3" />
-       <field id="SFe_E3T"      long_name="SFe * E3T"                                unit="mmol/m2"  > SFe * e3t </field >
+       <field id="SFe_e3t"      long_name="SFe * e3t"                                unit="mmol/m2"  > SFe * e3t </field >
        <field id="DFe"          long_name="Diatoms iron  Concentration"              unit="mmol/m3" />
-       <field id="DFe_E3T"      long_name="DFe * E3T"                                unit="mmol/m2"  > DFe * e3t </field >
+       <field id="DFe_e3t"      long_name="DFe * e3t"                                unit="mmol/m2"  > DFe * e3t </field >
        <field id="GSi"          long_name="Sinking biogenic Silicate Concentration"  unit="mmol/m3" />
-       <field id="GSi_E3T"      long_name="GSi * E3T"                                unit="mmol/m2"  > GSi * e3t </field >
+       <field id="GSi_e3t"      long_name="GSi * e3t"                                unit="mmol/m2"  > GSi * e3t </field >
        <field id="NFe"          long_name="Nano iron Concentration"                  unit="mmol/m3" />
-       <field id="NFe_E3T"      long_name="NFe * E3T"                                unit="mmol/m2"  > NFe * e3t </field >
+       <field id="NFe_e3t"      long_name="NFe * e3t"                                unit="mmol/m2"  > NFe * e3t </field >
        <field id="NCHL"         long_name="Nano chlorophyl Concentration"            unit="mg/m3"   />
-       <field id="NCHL_E3T"     long_name="NCHL * E3T"                               unit="mmol/m2"  > NCHL * e3t </field >
+       <field id="NCHL_e3t"     long_name="NCHL * e3t"                               unit="mmol/m2"  > NCHL * e3t </field >
        <field id="DCHL"         long_name="Diatoms chlorophyl Concentration"         unit="mg/m3"   />
-       <field id="DCHL_E3T"     long_name="DCHL * E3T"                               unit="mmol/m2"  > DCHL * e3t </field >
+       <field id="DCHL_e3t"     long_name="DCHL * e3t"                               unit="mmol/m2"  > DCHL * e3t </field >
        <field id="NO3"          long_name="Nitrate Concentration"                    unit="mmol/m3" />
-       <field id="NO3_E3T"      long_name="NO3 * E3T"                                unit="mmol/m2"  > NO3 * e3t </field >
+       <field id="NO3_e3t"      long_name="NO3 * e3t"                                unit="mmol/m2"  > NO3 * e3t </field >
        <field id="NH4"          long_name="Ammonium Concentration"                   unit="mmol/m3" />
-       <field id="NH4_E3T"      long_name="NH4 * E3T"                                unit="mmol/m2"  > NH4 * e3t </field >
-
-       <!-- PISCES with Kriest parametisation : variables available with key_kriest -->
-       <field id="Num"         long_name="Number of organic particles"              unit="1" />
-       <field id="Num_E3T"     long_name="Num * E3T"                                unit="m"  > Num * e3t </field >
-
-       <!-- PISCES light : variables available with key_pisces_reduced -->
+       <field id="NH4_e3t"      long_name="NH4 * e3t"                                unit="mmol/m2"  > NH4 * e3t </field >
+
+       <!-- PISCES quota : variables available with ln_p5z  -->
+
+       <field id="DON"          long_name="Dissolved organic N Concentration"        unit="mmol/m3" />
+       <field id="DON_e3t"      long_name="DON * e3t"                                unit="mmol/m2"  > DON * e3t </field >
+       <field id="DOP"          long_name="Dissolved organic P Concentration"        unit="mmol/m3" />
+       <field id="DOP_e3t"      long_name="DOP * e3t"                                unit="mmol/m2"  > DOP * e3t </field >
+       <field id="PON"          long_name="Small PON Concentration"                  unit="mmol/m3" />
+       <field id="PON_e3t"      long_name="PON * e3t"                                unit="mmol/m2"  > PON * e3t </field >
+       <field id="POP"          long_name="Small POP Concentration"                  unit="mmol/m3" />
+       <field id="POP_e3t"      long_name="POP * e3t"                                unit="mmol/m2"  > POP * e3t </field >
+       <field id="GON"          long_name="Big PON Concentration"                    unit="mmol/m3" />
+       <field id="GON_e3t"      long_name="GON * e3t"                                unit="mmol/m2"  > GON * e3t </field >
+       <field id="GOP"          long_name="Big POP Concentration"                    unit="mmol/m3" />
+       <field id="GOP_e3t"      long_name="GOP * e3t"                                unit="mmol/m2"  > GOP * e3t </field >
+       <field id="PHYN"         long_name="Nanophytoplankton N biomass"              unit="mmol/m3" />
+       <field id="PHYN_e3t"     long_name="PHYN * e3t"                               unit="mmol/m2"  > PHYN * e3t </field >
+       <field id="PHYP"         long_name="Nanophytoplankton P biomass"              unit="mmol/m3" />
+       <field id="PHYP_e3t"     long_name="PHYP * e3t"                               unit="mmol/m2"  > PHYP * e3t </field >
+       <field id="DIAN"         long_name="Diatoms N biomass"                        unit="mmol/m3" />
+       <field id="DIAN_e3t"     long_name="DIAN * e3t"                               unit="mmol/m2"  > DIAN * e3t </field >
+       <field id="DIAP"         long_name="Diatoms P biomass"                        unit="mmol/m3" />
+       <field id="DIAP_e3t"     long_name="DIAP * e3t"                               unit="mmol/m2"  > DIAP * e3t </field >
+       <field id="PIC"          long_name="Picophytoplankton C biomass"              unit="mmol/m3" />
+       <field id="PIC_e3t"      long_name="PIC * e3t"                                unit="mmol/m2"  > PIC * e3t </field >
+       <field id="PICN"         long_name="Picophytoplankton N biomass"              unit="mmol/m3" />
+       <field id="PICN_e3t"     long_name="PICN * e3t"                               unit="mmol/m2"  > PICN * e3t </field >
+       <field id="PICP"         long_name="Picophytoplankton P biomass"              unit="mmol/m3" />
+       <field id="PICP_e3t"     long_name="PICP * e3t"                               unit="mmol/m2"  > PICP * e3t </field >
+       <field id="PFe"          long_name="Picophytoplankton Fe biomass"             unit="mmol/m3" />
+       <field id="PFe_e3t"      long_name="PFe * e3t"                                unit="mmol/m2"  > PFe * e3t </field >
+       <field id="PCHL"         long_name="Picophytoplankton Chl biomass"            unit="mg/m3" />
+       <field id="PCHL_e3t"     long_name="PCHL * e3t"                               unit="mmol/m2"  > PCHL * e3t </field >
+
+      <!-- PISCES with ligand parametisation : variables available namelist paramter ln_ligand -->
+       <field id="LGW"         long_name="Weak ligands concentration"                unit="mmol/m3" />
+       <field id="LGW_e3t"     long_name="LGW * e3t"                                 unit="mmol/m2"  > LGW * e3t </field >
+       <field id="LFe"         long_name="Lithogenic iron concentration"             unit="mmol/m3" />
+       <field id="LFe_e3t"     long_name="LFe * e3t"                                 unit="mmol/m2"  > LFe * e3t </field >
+
+       <!-- PISCES light : variables available with ln_p2z  -->
        <field id="DET"         long_name="Detritus"                                 unit="mmol-N/m3" />
-       <field id="DET_E3T"     long_name="DET * E3T"                                unit="mmol-N/m2"  > DET * e3t </field >
+       <field id="DET_e3t"     long_name="DET * e3t"                                unit="mmol-N/m2"  > DET * e3t </field >
        <field id="DOM"         long_name="Dissolved Organic Matter"                 unit="mmol-N/m3" />
-       <field id="DOM_E3T"     long_name="DOM * E3T"                                unit="mmol-N/m2"  > DOM * e3t </field >
-
-       <!-- CFC11 : variables available with key_cfc -->
-       <field id="CFC11"       long_name="CFC-11 Concentration"                     unit="umol/m3" />
-       <field id="CFC11_E3T"   long_name="CFC11 * E3T"                              unit="umol/m2"  > CFC11 * e3t </field >
-       <!-- Bomb C14 : variables available with key_c14b -->
-       <field id="C14B"     long_name="Bomb C14 Concentration"                      unit="1"         />
-       <field id="C14B_E3T"    long_name="C14B * E3T"                               unit="m"  > C14B * e3t </field >
+       <field id="DOM_e3t"     long_name="DOM * e3t"                                unit="mmol-N/m2"  > DOM * e3t </field >
+
+       <!-- CFC11 : variables available with ln_cfc11 -->
+       <field id="CFC11"       long_name="Chlorofluoro carbon11 Concentration"      unit="umol/m3" />
+       <field id="CFC11_e3t"   long_name="CFC11 * e3t"                              unit="umol/m2"  > CFC11 * e3t </field >
+
+       <!-- CFC12 : variables available with ln_cfc12 -->
+       <field id="CFC12"       long_name="Chlorofluoro carbon12 Concentration"      unit="umol/m3" />
+       <field id="CFC12_e3t"   long_name="CFC12 * e3t"                              unit="umol/m2"  > CFC12 * e3t </field >
+
+       <!-- SF6 : variables available with ln_sf6 -->
+       <field id="SF6"       long_name="Sulfur hexafluoride Concentration"      unit="umol/m3" />
+       <field id="SF6_e3t"   long_name="SF6 * e3t"                              unit="umol/m2"  > SF6 * e3t </field >
+
+       <!-- C14 : variables available with ln_c14 -->
+       <field id="RC14"        long_name="Radiocarbon ratio"                        unit="-"         />
+       <field id="RC14_e3t"    long_name="RC14 * e3t"                               unit="m"  > RC14 * e3t </field >
+
+       <!-- AGE : variables available with ln_age -->
+       <field id="Age"        long_name="Sea water age since surface contact"       unit="yr"         />
+       <field id="Age_e3t"    long_name="Age * e3t"                                 unit="yr * m"  > Age * e3t </field >
+
      </field_group>
 
@@ -976,10 +1026,13 @@
        <field id="PAR"         long_name="Photosynthetically Available Radiation"  unit="W/m2"       grid_ref="grid_T_3D" />
        <field id="PARDM"       long_name="Daily mean PAR"                          unit="W/m2"       grid_ref="grid_T_3D" />
-       <field id="PPPHY"       long_name="Primary production of nanophyto"         unit="mol/m3/s"   grid_ref="grid_T_3D" />
-       <field id="PPPHY2"      long_name="Primary production of diatoms"           unit="mol/m3/s"   grid_ref="grid_T_3D" />
-       <field id="PPNEWN"      long_name="New Primary production of nanophyto"     unit="mol/m3/s"   grid_ref="grid_T_3D" />
-       <field id="PPNEWD"      long_name="New Primary production of diatoms"       unit="mol/m3/s"   grid_ref="grid_T_3D" />
-       <field id="PBSi"        long_name="Primary production of Si diatoms"        unit="mol/m3/s"   grid_ref="grid_T_3D" />
-       <field id="PFeN"        long_name="Primary production of nano iron"         unit="mol/m3/s"   grid_ref="grid_T_3D" />
+       <field id="PPPHYN"      long_name="Primary production of nanophyto"         unit="molC/m3/s"  grid_ref="grid_T_3D" />
+       <field id="PPPHYP"      long_name="Primary production of picophyto"         unit="molC/m3/s"  grid_ref="grid_T_3D" />
+       <field id="PPPHYD"      long_name="Primary production of diatoms"           unit="molC/m3/s"  grid_ref="grid_T_3D" />
+       <field id="PPNEWN"      long_name="New Primary production of nanophyto"     unit="molC/m3/s"  grid_ref="grid_T_3D" />
+       <field id="PPNEWP"      long_name="New Primary production of picophyto"     unit="molC/m3/s"  grid_ref="grid_T_3D" />
+       <field id="PPNEWD"      long_name="New Primary production of diatoms"       unit="molC/m3/s"  grid_ref="grid_T_3D" />
+       <field id="PBSi"        long_name="Primary production of Si diatoms"        unit="molC/m3/s"  grid_ref="grid_T_3D" />
+       <field id="PFeN"        long_name="Primary production of nano iron"         unit="molC/m3/s"  grid_ref="grid_T_3D" />
+       <field id="PFeP"        long_name="Primary production of pico iron"         unit="molC/m3/s"  grid_ref="grid_T_3D" />
        <field id="PFeD"        long_name="Primary production of diatoms iron"      unit="mol/m3/s"   grid_ref="grid_T_3D" />
        <field id="xfracal"     long_name="Calcifying fraction"                     unit="1"          grid_ref="grid_T_3D" />
@@ -990,14 +1043,26 @@
        <field id="REMIN"       long_name="Oxic remineralization of OM"             unit="mol/m3/s"   grid_ref="grid_T_3D" />
        <field id="DENIT"       long_name="Anoxic remineralization of OM"           unit="mol/m3/s"   grid_ref="grid_T_3D" />
+       <field id="REMINP"       long_name="Oxic remineralization rate of POC"      unit="d-1"        grid_ref="grid_T_3D" />
+       <field id="REMING"       long_name="Oxic remineralization rate of GOC"      unit="d-1"        grid_ref="grid_T_3D" />
        <field id="Nfix"        long_name="Nitrogen fixation"                       unit="mol/m3/s"   grid_ref="grid_T_3D" />
        <field id="Mumax"       long_name="Maximum growth rate"                     unit="s-1"        grid_ref="grid_T_3D" />
        <field id="MuN"         long_name="Realized growth rate for nanophyto"      unit="s-1"        grid_ref="grid_T_3D" />
+       <field id="MuP"         long_name="Realized growth rate for picophyto"      unit="s-1"        grid_ref="grid_T_3D" />
        <field id="MuD"         long_name="Realized growth rate for diatomes"       unit="s-1"        grid_ref="grid_T_3D" />
+       <field id="MunetN"      long_name="Net growth rate for nanophyto"           unit="s-1"        grid_ref="grid_T_3D" />
+       <field id="MunetP"      long_name="Net growth rate for picophyto"           unit="s-1"        grid_ref="grid_T_3D" />
+       <field id="MunetD"      long_name="Net growth rate for diatomes"            unit="s-1"        grid_ref="grid_T_3D" />
        <field id="LNnut"       long_name="Nutrient limitation term in Nanophyto"   unit=""           grid_ref="grid_T_3D" />
+       <field id="LPnut"       long_name="Nutrient limitation term in Picophyto"   unit="-"          grid_ref="grid_T_3D" />
        <field id="LDnut"       long_name="Nutrient limitation term in Diatoms"     unit=""           grid_ref="grid_T_3D" />
        <field id="LNFe"        long_name="Iron limitation term in Nanophyto"       unit=""           grid_ref="grid_T_3D" />
+       <field id="LPFe"        long_name="Iron limitation term in Picophyto"       unit="-"          grid_ref="grid_T_3D" />
        <field id="LDFe"        long_name="Iron limitation term in Diatoms"         unit=""           grid_ref="grid_T_3D" />
        <field id="LNlight"     long_name="Light limitation term in Nanophyto"      unit=""           grid_ref="grid_T_3D" />
+       <field id="LPlight"     long_name="Light limitation term in Picophyto"      unit="-"          grid_ref="grid_T_3D" />
        <field id="LDlight"     long_name="Light limitation term in Diatoms"        unit=""           grid_ref="grid_T_3D" />
+       <field id="SIZEN"       long_name="Mean relative size of nanophyto."        unit="-"          grid_ref="grid_T_3D" />
+       <field id="SIZEP"       long_name="Mean relative size of picophyto."        unit="-"          grid_ref="grid_T_3D" />
+       <field id="SIZED"       long_name="Mean relative size of diatoms"           unit="-"          grid_ref="grid_T_3D" />
        <field id="Fe2"         long_name="Iron II concentration"                   unit="nmol/m3"    grid_ref="grid_T_3D" />
        <field id="Fe3"         long_name="Iron III concentration"                  unit="nmol/m3"    grid_ref="grid_T_3D" />
@@ -1012,4 +1077,7 @@
        <field id="Sdenit"      long_name="Nitrate reduction in the sediments"      unit="mol/m2/s"                        />
        <field id="Ironice"     long_name="Iron input/uptake due to sea ice"        unit="mol/m2/s"                        />
+       <field id="SedCal"      long_name="Calcite burial in the sediments"         unit="molC/m2/s"                       />
+       <field id="SedSi"       long_name="Silicon burial in the sediments"         unit="molSi/m2/s"                      />
+       <field id="SedC"        long_name="Organic C burial in the sediments"       unit="molC/m2/s"                       />
        <field id="HYDR"        long_name="Iron input from hydrothemal vents"       unit="mol/m2/s"   grid_ref="grid_T_3D" />
        <field id="EPC100"      long_name="Export of carbon particles at 100 m"     unit="mol/m2/s"                        />
@@ -1030,12 +1098,4 @@
        <field id="Ironsed"     long_name="Iron deposition from sediment"           unit="mol/m2/s"   grid_ref="grid_T_3D" />
 
-
-       <!-- PISCES with Kriest parametisation : variables available with key_kriest -->
-       <field id="EPN100"      long_name="Particulate number flux at 100 m"        unit="mol/m2/s"                        />
-       <field id="EXPN"        long_name="Particulate number flux"                 unit="mol/m2/s"   grid_ref="grid_T_3D" />
-       <field id="XNUM"        long_name="Number of particles in aggregats"        unit="1"          grid_ref="grid_T_3D" />
-       <field id="WSC"         long_name="sinking speed of mass flux"              unit="m2/s"       grid_ref="grid_T_3D" />
-       <field id="WSN"         long_name="sinking speed of number flux"            unit="m2/s"       grid_ref="grid_T_3D" />
-
        <!-- dbio_T on T grid : variables available with key_diaar5 -->
        <field id="TPP"         long_name="Total Primary production of phyto"                   unit="mol/m3/s"  grid_ref="grid_T_3D" />
@@ -1046,6 +1106,6 @@
        <field id="ZO2MIN"      long_name="Depth of oxygen minimum concentration"               unit="m"                              />
        <field id="INTNFIX"     long_name="Nitrogen fixation rate : vert. integrated"           unit="mol/m2/s"                       />
-       <field id="INTPPPHY"    long_name="Vertically integrated primary production by nanophy" unit="mol/m2/s"                       />
-       <field id="INTPPPHY2"   long_name="Vertically integrated primary production by diatom"  unit="mol/m2/s"                       />
+       <field id="INTPPPHYN"    long_name="Vertically integrated primary production by nanophy" unit="mol/m2/s"                       />
+       <field id="INTPPPHYD"   long_name="Vertically integrated primary production by diatom"  unit="mol/m2/s"                       />
        <field id="INTPP"       long_name="Vertically integrated primary production by phyto"   unit="mol/m2/s"                       />
        <field id="INTPNEW"     long_name="Vertically integrated new primary production"        unit="mol/m2/s"                       />
@@ -1077,26 +1137,43 @@
        <field id="TDETSED"     long_name="TDETSED"                                 unit=""  /> 
 
-       <!-- CFC11 : variables available with key_cfc -->
-       <field id="qtrCFC11"    long_name="Air-sea flux of CFC-11"                  unit="mol/m2/s"   />
-       <field id="qintCFC11"   long_name="Cumulative air-sea flux of CFC-11"       unit="mol/m2"     />
-
-       <!-- Bomb C14 : variables available with key_c14b -->
-       <field id="qtrC14b"     long_name="Air-sea flux of Bomb C14"                unit="mol/m2/s"   />
-       <field id="qintC14b"    long_name="Cumulative air-sea flux of Bomb C14"     unit="mol/m2"     />
-       <field id="fdecay"      long_name="Radiactive decay of Bomb C14"            unit="mol/m3"  grid_ref="grid_T_3D"  />
+       <!-- CFC11 : variables available with ln_cfc11 -->
+       <field id="qtr_CFC11"    long_name="Air-sea flux of CFC-11"                  unit="mol/m2/s"   />
+       <field id="qint_CFC11"   long_name="Cumulative air-sea flux of CFC-11"       unit="mol/m2"     />
+
+       <!-- CFC12 : variables available with ln_cfc12 -->
+       <field id="qtr_CFC12"    long_name="Air-sea flux of CFC12"                  unit="mol/m2/s"   />
+       <field id="qint_CFC12"   long_name="Cumulative air-sea flux of CFC12"       unit="mol/m2"     />
+
+       <!-- SF6 : variables available with ln_sf6 -->
+       <field id="qtr_SF6"      long_name="Air-sea flux of SF6"                    unit="mol/m2/s"   />
+       <field id="qint_SF6"     long_name="Cumulative air-sea flux of SF6"         unit="mol/m2"     />
+
+       <!--  C14 : variables available with ln_c14 -->
+       <field id="DeltaC14"     long_name="Delta C14"                              unit="permil" grid_ref="grid_T_3D"   />
+       <field id="C14Age"       long_name="Radiocarbon age"                        unit="yr"     grid_ref="grid_T_3D"   />
+       <field id="RAge"         long_name="Reservoir Age"                          unit="yr"     />
+       <field id="qtr_C14"      long_name="Air-sea flux of C14"                    unit="1/m2/s"   />
+       <field id="qint_C14"     long_name="Cumulative air-sea flux of C14"         unit="1/m2"     />
      </field_group>
 
-     <field_group id="PISCES_scalar"  domain_ref="1point" >
-       <field id="pno3tot"         long_name="global mean nitrate concentration"                  unit="mol/m3"   />
+     <field_group id="tracer_scalar"  domain_ref="1point" >
+     <!-- PISCES scalar  -->
+       <field id="pno3tot"         long_name="Global mean nitrate concentration"                  unit="mol/m3"   />
        <field id="ppo4tot"         long_name="global mean phosphorus concentration"               unit="mol/m3"   />
-       <field id="psiltot"         long_name="global mean silicate concentration"                 unit="mol/m3"   />
-       <field id="palktot"         long_name="global mean alkalinity concentration"               unit="mol/m3"   />
-       <field id="pfertot"         long_name="global mean iron concentration"                     unit="mol/m3"   />
-       <field id="tcflx"           long_name="total Flux of Carbon out of the ocean"              unit="mol/s"   />
-       <field id="tcflxcum"        long_name="cumulative total Flux of Carbon out of the ocean"   unit="mol/s"   />
-       <field id="tcexp"           long_name="total Carbon export at 100m"                        unit="mol/s"   />
-       <field id="tintpp"          long_name="global total integrated primary production"         unit="mol/s"   />
-       <field id="tnfix"           long_name="global total nitrogen fixation"                     unit="mol/s"   />
+       <field id="psiltot"         long_name="Global mean silicate concentration"                 unit="mol/m3"   />
+       <field id="palktot"         long_name="Global mean alkalinity concentration"               unit="mol/m3"   />
+       <field id="pfertot"         long_name="Global mean iron concentration"                     unit="mol/m3"   />
+       <field id="tcflx"           long_name="Total Flux of Carbon out of the ocean"              unit="mol/s"   />
+       <field id="tcflxcum"        long_name="Cumulative total Flux of Carbon out of the ocean"   unit="mol/s"   />
+       <field id="tcexp"           long_name="Total Carbon export at 100m"                        unit="mol/s"   />
+       <field id="tintpp"          long_name="Global total integrated primary production"         unit="mol/s"   />
+       <field id="tnfix"           long_name="Global total nitrogen fixation"                     unit="mol/s"   />
        <field id="tdenit"          long_name="Total denitrification"                              unit="mol/s"   />
+     <!-- C14 scalar  -->
+       <field id="AtmCO2"          long_name="Global atmospheric CO2"                             unit="ppm"   />
+       <field id="AtmC14"          long_name="Global atmospheric DeltaC14"                        unit="permil"   />
+       <field id="K_C14"           long_name="Global 14C/C exchange velocity"                     unit="m/yr"   />
+       <field id="K_CO2"           long_name="Global CO2 piston velocity"                         unit="cm/h"   />
+       <field id="C14Inv"          long_name="global Radiocarbon ocean inventory"                 unit="10^26 atoms"   />
      </field_group>
 
Index: branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/CONFIG/SHARED/namelist_c14b_ref
===================================================================
--- branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/CONFIG/SHARED/namelist_c14b_ref	(revision 7383)
+++ 	(revision )
@@ -1,19 +1,0 @@
-!!>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
-!! Bomb C14  :       1  - dates                             (namc14date)
-!! namelists    
-!>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
-!'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
-&namc14date     !   dates
-!,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
-   ndate_beg_b  = 650101    !  datedeb1
-   nyear_res_b  = 1955      !  iannee1
-/
-!'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
-&namc14dia     !   additional 2D/3D tracers diagnostics ("key_trc_diaadd")
-!,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
-!              !    name   !           title of the field          !     units      !
-!              !           !                                       !                !
-   c14dia2d(1)  = 'qtr_c14  ' , 'Air-sea flux                      ',  'mol/m2/s    '
-   c14dia2d(2)  = 'qint_c14 ' , 'Cumulative air-sea flux           ',  'mol/m2      '
-   c14dia3d(1)  = 'decay    ' , 'Radiactive decay                  ',  'mol/m3      '
-/
Index: branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/CONFIG/SHARED/namelist_cfc_ref
===================================================================
--- branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/CONFIG/SHARED/namelist_cfc_ref	(revision 7383)
+++ 	(revision )
@@ -1,18 +1,0 @@
-!!>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
-!! CFC  :       1  - dates                                 (namcfcdate)
-!! namelists    
-!>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
-!'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
-&namcfcdate     !   dates
-!,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
-   ndate_beg  = 300101    !  datedeb1
-   nyear_res  = 1932      !  iannee1
-/
-!'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
-&namcfcdia     !   additional 2D/3D tracers diagnostics 
-!,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
-!              !    name   !           title of the field          !     units      !
-!              !           !                                       !                !
-   cfcdia2d(1)  = 'qtr_c11 ' , 'Air-sea flux of CFC-11           ',  'mol/m2/s    '
-   cfcdia2d(2)  = 'qint_c11' , 'Cumulative air-sea flux of CFC-11 ', 'mol/m2      '
-/
Index: branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/CONFIG/SHARED/namelist_pisces_ref
===================================================================
--- branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/CONFIG/SHARED/namelist_pisces_ref	(revision 7383)
+++ branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/CONFIG/SHARED/namelist_pisces_ref	(revision 7391)
@@ -1,4 +1,4 @@
 !!>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
-!! PISCES  (key_pisces) reference namelist (see below for key_pisces_reduced)
+!! PISCES reference namelist 
 !!              1  - air-sea exchange                         (nampisext)
 !!              2  - biological parameters                    (nampisbio)
@@ -9,11 +9,16 @@
 !!              7  - parameters for calcite chemistry         (nampiscal)
 !!              8  - parameters for inputs deposition         (nampissed)
-!!              9  - parameters for Kriest parameterization   (nampiskrp, nampiskrs)
-!!              10 - additional 2D/3D  diagnostics            (nampisdia)
 !!              11 - Damping                                  (nampisdmp)
-!>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
-!'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
+!-----------------------------------------------------------------------
+&nampismod     !  Model used 
+!-----------------------------------------------------------------------
+  ln_p2z    = .false.        !  LOBSTER model used
+  ln_p4z    = .true.         !  PISCES model used
+  ln_p5z    = .false.        !  PISCES QUOTA model used
+  ln_ligand = .false.        !  Enable  organic ligands
+/
+!-----------------------------------------------------------------------
 &nampisext     !   air-sea exchange
-!,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
+!-----------------------------------------------------------------------
    ln_co2int  =  .false. ! read atm pco2 from a file (T) or constant (F)
    atcco2     =  280.    ! Constant value atmospheric pCO2 - ln_co2int = F
@@ -23,28 +28,40 @@
 !                        ! then the first atmospheric CO2 record read is at years(1)
 /
-!'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
+!-----------------------------------------------------------------------
 &nampisatm     !  Atmospheric prrssure 
-!,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
+!-----------------------------------------------------------------------
 !              !  file name   ! frequency (hours) ! variable  ! time interp. !  clim  ! 'yearly'/ ! weights  ! rotation ! land/sea mask !
 !              !              !  (if <0  months)  !   name    !   (logical)  !  (T/F) ! 'monthly' ! filename ! pairing  ! filename      !
    sn_patm     = 'presatm'    ,     -1            , 'patm'    ,  .true.      , .true. , 'yearly'  , ''       , ''       , ''
+   sn_atmco2   = 'presatmco2' ,     -1            , 'xco2'    ,  .true.      , .true. , 'yearly'  , ''       , ''       , ''
    cn_dir      = './'     !  root directory for the location of the dynamical files
 !
-   ln_presatm  = .false.   ! constant atmopsheric pressure (F) or from a file (T)
-/
-!'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
+   ln_presatm    = .false.   ! constant atmopsheric pressure (F) or from a file (T)
+   ln_presatmco2 = .false.   ! Read spatialized atm co2 files [ppm] if TRUE
+/
+!-----------------------------------------------------------------------
 &nampisbio     !   biological parameters
-!,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
+!-----------------------------------------------------------------------
    nrdttrc    =  1        ! time step frequency for biology
    wsbio      =  2.       ! POC sinking speed
    xkmort     =  2.E-7    ! half saturation constant for mortality
    ferat3     =  10.E-6   ! Fe/C in zooplankton 
-   wsbio2     =  30.      ! Big particles sinking speed
+   wsbio2     =  50.      ! Big particles sinking speed
+   wsbio2max  =  50.      ! Big particles maximum sinking speed
+   wsbio2scale=  5000.    ! Big particles length scale of sinking
    niter1max  =  1        ! Maximum number of iterations for POC
-   niter2max  =  1        ! Maximum number of iterations for GOC
-/
-!'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
-&nampislim     !   parameters for nutrient limitations
-!,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
+   niter2max  =  2        ! Maximum number of iterations for GOC
+!                         !  ln_ligand enabled
+   wfep       =  0.2      ! FeP sinking speed 
+   ldocp      =  1.E-5    ! Phyto ligand production per unit doc 
+   ldocz      =  1.E-5    ! Zoo ligand production per unit doc 
+   lthet      =  0.5      ! Proportional loss of ligands due to Fe uptake 
+!                         !  ln_p5z enabled
+   no3rat3    =  0.182    ! N/C ratio in zooplankton
+   po4rat3    =  0.0094   ! P/C ratio in zooplankton
+/
+!-----------------------------------------------------------------------
+&namp4zlim     !   parameters for nutrient limitations for PISCES std - ln_p4z
+!-----------------------------------------------------------------------
    concnno3   =  1.e-6    ! Nitrate half saturation of nanophytoplankton
    concdno3   =  3.E-6    ! Nitrate half saturation for diatoms
@@ -66,9 +83,62 @@
    qdfelim    =  7.E-6    ! Optimal quota of diatoms
    caco3r     =  0.3      ! mean rain ratio
-   oxymin    =  1.E-6     ! Half-saturation constant for anoxia
-/
-!'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
+   oxymin     =  1.E-6    ! Half-saturation constant for anoxia
+/
+!-----------------------------------------------------------------------
+&namp5zlim     !   parameters for nutrient limitations PISCES QUOTA - ln_p5z
+!-----------------------------------------------------------------------
+   concnno3   =  3e-6     ! Nitrate half saturation of nanophytoplankton
+   concpno3   =  1e-6
+   concdno3   =  4E-6     ! Phosphate half saturation for diatoms
+   concnnh4   =  1.5E-6   ! NH4 half saturation for phyto
+   concpnh4   =  4E-7
+   concdnh4   =  2E-6     ! NH4 half saturation for diatoms
+   concnpo4   =  3E-6     ! PO4 half saturation for phyto
+   concppo4   =  1.5E-6
+   concdpo4   =  4E-6     ! PO4 half saturation for diatoms
+   concnfer   =  3E-9   ! Iron half saturation for phyto
+   concpfer   =  1.5E-9
+   concdfer   =  4E-9   ! Iron half saturation for diatoms
+   concbfe    =  1.E-11   ! Half-saturation for Fe limitation of Bacteria
+   concbnh4   =  1.E-7    ! NH4 half saturation for phyto
+   concbno3   =  5.E-7    ! Phosphate half saturation for diatoms
+   concbpo4   =  1E-7     ! Phosphate half saturation for bacteria
+   xsizedia   =  1.E-6    ! Minimum size criteria for diatoms
+   xsizephy   =  1.E-6    ! Minimum size criteria for phyto
+   xsizepic   =  1.E-6
+   xsizern    =  1.0      ! Size ratio for nanophytoplankton
+   xsizerp    =  1.0
+   xsizerd    =  4.0      ! Size ratio for diatoms
+   xksi1      =  2.E-6    ! half saturation constant for Si uptake
+   xksi2      =  20E-6  ! half saturation constant for Si/C
+   xkdoc      =  417.E-6  ! half-saturation constant of DOC remineralization
+   caco3r     =  0.35     ! mean rain ratio
+   oxymin     =  1.E-6    ! Half-saturation constant for anoxia
+/
+!-----------------------------------------------------------------------
+&namp5zquota    !   parameters for nutrient limitations PISCES quota - ln_p5z
+!-----------------------------------------------------------------------
+   qfnopt     =  7.E-6    ! Optimal Fe quota of nanophyto
+   qfpopt     =  7.E-6    ! Optimal Fe quota of picophyto
+   qfdopt     =  7.E-6    ! Optimal quota of diatoms
+   qnnmin     =  0.29     ! Minimal N quota for nano
+   qnnmax     =  1.39     ! Maximal N quota for nano
+   qpnmin     =  0.28     ! Minimal P quota for nano
+   qpnmax     =  1.06     ! Maximal P quota for nano
+   qnpmin     =  0.42     ! Minimal N quota for pico
+   qnpmax     =  1.39     ! Maximal N quota for pico
+   qppmin     =  0.25     ! Minimal P quota for pico
+   qppmax     =  0.7      ! Maximal P quota for pico
+   qndmin     =  0.25     ! Minimal N quota for diatoms
+   qndmax     =  1.39     ! Maximal N quota for diatoms
+   qpdmin     =  0.29     ! Minimal P quota for diatoms
+   qpdmax     =  1.32     ! Maximal P quota for diatoms
+   qfnmax     =  40E-6    ! Maximal Fe quota for nano
+   qfpmax     =  40E-6    ! Maximal Fe quota for pico
+   qfdmax     =  40E-6    ! Maximal Fe quota for diatoms
+/
+!-----------------------------------------------------------------------
 &nampisopt     !   parameters for optics
-!,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
+!-----------------------------------------------------------------------
 !              !  file name       ! frequency (hours) ! variable  ! time interp. !  clim  ! 'yearly'/ ! weights  ! rotation ! land/sea mask !
 !              !                  !  (if <0  months)  !   name    !   (logical)  !  (T/F) ! 'monthly' ! filename ! pairing  ! filename      !
@@ -78,12 +148,12 @@
    parlux      =  0.43      ! Fraction of shortwave as PAR
 / 
-!'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
-&nampisprod     !   parameters for phytoplankton growth
-!,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
-   pislope    =  2.       ! P-I slope
-   pislope2   =  2.       ! P-I slope  for diatoms
+!-----------------------------------------------------------------------
+&namp4zprod     !   parameters for phytoplankton growth for PISCES std - ln_p4z
+!-----------------------------------------------------------------------
+   pislopen   =  2.       ! P-I slope
+   pisloped   =  2.       ! P-I slope  for diatoms
    xadap      =  0.       ! Adaptation factor to low light
-   excret     =  0.05     ! excretion ratio of phytoplankton
-   excret2    =  0.05     ! excretion ratio of diatoms
+   excretn    =  0.05     ! excretion ratio of phytoplankton
+   excretd    =  0.05     ! excretion ratio of diatoms
    ln_newprod =  .true.   ! Enable new parame. of production (T/F) 
    bresp      =  0.033    ! Basal respiration rate
@@ -95,8 +165,25 @@
    grosip     =  0.159    ! mean Si/C ratio
 /
-!'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
-&nampismort     !   parameters for phytoplankton sinks
-!,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
-   wchl       =  0.01    ! quadratic mortality of phytoplankton
+!-----------------------------------------------------------------------
+&namp5zprod     !   parameters for phytoplankton growth for PISCES quota - ln_p5z
+!-----------------------------------------------------------------------
+   pislopen   =  3.       ! P-I slope
+   pislopep   =  3.       ! P-I slope for picophytoplankton
+   pisloped   =  3.       ! P-I slope  for diatoms
+   excretn    =  0.05     ! excretion ratio of phytoplankton
+   excretp    =  0.05     ! excretion ratio of picophytoplankton
+   excretd    =  0.05     ! excretion ratio of diatoms
+   xadap      =  0.       ! Adaptation factor to low light
+   bresp      =  0.02     ! Basal respiration rate
+   thetannm   =  0.25     ! Maximum Chl/N in nanophytoplankton
+   thetanpm   =  0.25     ! Maximum Chl/N in picophytoplankton
+   thetandm   =  0.3      ! Maximum Chl/N in diatoms
+   chlcmin    =  0.004    ! Minimum Chl/c in phytoplankton
+   grosip     =  0.131    ! mean Si/C ratio
+/
+!-----------------------------------------------------------------------
+&namp4zmort     !   parameters for phytoplankton sinks for PISCES std - ln_p4z
+!-----------------------------------------------------------------------
+   wchl       =  0.01     ! quadratic mortality of phytoplankton
    wchld      =  0.01     ! maximum quadratic mortality of diatoms
    wchldm     =  0.03     ! maximum quadratic mortality of diatoms
@@ -104,7 +191,18 @@
    mprat2     =  0.01     ! Diatoms mortality rate
 /
-!'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
-&nampismes     !   parameters for mesozooplankton
-!,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
+!-----------------------------------------------------------------------
+&namp5zmort     !   parameters for phytoplankton sinks for PISCES quota - ln_p5z
+!-----------------------------------------------------------------------
+   wchln      =  0.01     ! quadratic mortality of nanophytoplankton
+   wchlp      =  0.01     ! quadratic mortality of picophytoplankton
+   wchld      =  0.01     ! maximum quadratic mortality of diatoms
+   wchldm     =  0.02     ! maximum quadratic mortality of diatoms
+   mpratn     =  0.01     ! nanophytoplankton mortality rate
+   mpratp     =  0.01     ! picophytoplankton mortality rate
+   mprat2     =  0.01     ! Diatoms mortality rate
+/
+!-----------------------------------------------------------------------
+&namp4zmes     !   parameters for mesozooplankton for PISCES std - ln_p4z
+!-----------------------------------------------------------------------
    part2      =  0.75     ! part of calcite not dissolved in mesozoo guts
    grazrat2   =  0.75     ! maximal mesozoo grazing rate
@@ -126,8 +224,36 @@
    grazflux   =  2.e3     ! flux-feeding rate
 /
-!'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
-&nampiszoo     !   parameters for microzooplankton
-!,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
-   part       =  0.5      ! part of calcite not dissolved in microzoo gutsa
+!-----------------------------------------------------------------------
+&namp5zmes     !   parameters for mesozooplankton
+!-----------------------------------------------------------------------
+   part2      =  0.75     ! part of calcite not dissolved in mesozoo guts
+   grazrat2   =  0.85     ! maximal mesozoo grazing rate
+   bmetexc2   =  .true.   ! Metabolic use of excess carbon 
+   resrat2    =  0.005    ! exsudation rate of mesozooplankton
+   mzrat2     =  0.02     ! mesozooplankton mortality rate
+   xpref2d    =  1.       ! zoo preference for phyto
+   xpref2p    =  1.       ! zoo preference for POC
+   xpref2z    =  1.       ! zoo preference for zoo
+   xpref2m    =  0.2      ! meso preference for zoo
+   xpref2c    =  0.3      ! zoo preference for poc
+   xthresh2zoo = 1E-8     ! zoo feeding threshold for mesozooplankton
+   xthresh2dia = 1E-8     ! diatoms feeding threshold for mesozooplankton
+   xthresh2phy = 1E-8     ! nanophyto feeding threshold for mesozooplankton
+   xthresh2mes = 1E-8     ! meso feeding threshold for mesozooplankton
+   xthresh2poc = 1E-8     ! poc feeding threshold for mesozooplankton
+   xthresh2    =  3E-7     ! Food threshold for grazing
+   xkgraz2     =  20.E-6   ! half sturation constant for meso grazing
+   epsher2     =  0.5      ! Efficicency of Mesozoo growth
+   ssigma2     =  0.5     ! Fraction excreted as semi-labile DOM
+   srespir2    =  0.2     ! Active respiration
+   unass2c     =  0.3     ! non assimilated fraction of P by mesozoo
+   unass2n     =  0.3     ! non assimilated fraction of N by mesozoo
+   unass2p     =  0.3     ! non assimilated fraction of P by mesozoo
+   grazflux   =  3.e3     ! flux-feeding rate
+/
+!-----------------------------------------------------------------------
+&namp4zzoo     !   parameters for microzooplankton for PISCES std - ln_p4z
+!-----------------------------------------------------------------------
+   part       =  0.5      ! part of calcite not dissolved in microzoo guts
    grazrat    =  3.0      ! maximal zoo grazing rate
    resrat     =  0.03     ! exsudation rate of zooplankton
@@ -145,32 +271,79 @@
    unass      =  0.3      ! non assimilated fraction of phyto by zoo
 /
-!'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
+!-----------------------------------------------------------------------
+&namp5zzoo     !   parameters for microzooplankton
+!-----------------------------------------------------------------------
+   part       =  0.5      ! part of calcite not dissolved in microzoo gutsa
+   grazrat    =  2.75     ! maximal zoo grazing rate
+   bmetexc    =  .true.   ! Metabolic use of excess carbon
+   resrat     =  0.03     ! exsudation rate of zooplankton
+   mzrat      =  0.005    ! zooplankton mortality rate
+   xprefc     =  0.1      ! Microzoo preference for POM
+   xprefn     =  1.       ! Microzoo preference for Nanophyto
+   xprefp     =  1.6      ! Microzoo preference for picophyto
+   xprefd     =  1.0      ! Microzoo preference for Diatoms
+   xprefz     =  0.3      ! Microzoo preference for microzooplankton
+   xthreshdia =  1.E-8    ! Diatoms feeding threshold for microzooplankton
+   xthreshphy =  1.E-8    ! Nanophyto feeding threshold for microzooplankton
+   xthreshpic =  1.E-8
+   xthreshzoo =  1.E-8    ! Nanophyto feeding threshold for microzooplankton
+   xthreshpoc =  1.E-8    ! POC feeding threshold for microzooplankton
+   xthresh    =  3.E-7    ! Food threshold for feeding
+   xkgraz     =  20.E-6   ! half sturation constant for grazing
+   epsher     =  0.5      ! Efficiency of microzoo growth
+   ssigma     =  0.5      ! Fraction excreted as semi-labile DOM
+   srespir    =  0.2      ! Active respiration
+   unassc     =  0.3      ! non assimilated fraction of C by zoo
+   unassn     =  0.3      ! non assimilated fraction of C by zoo
+   unassp     =  0.3      ! non assimilated fraction of C by zoo
+/
+!-----------------------------------------------------------------------
 &nampisfer     !   parameters for iron chemistry
-!,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
+!-----------------------------------------------------------------------
    ln_fechem =  .false.   ! complex iron chemistry ( T/F )
    ln_ligvar =  .false.   ! variable ligand concentration
-   xlam1     =  0.005     ! scavenging rate of Iron
-   xlamdust  =  150.0     ! Scavenging rate of dust
-   ligand    =  0.6E-9    ! Ligands concentration 
-/  
-!'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
+   ln_fecolloid = .false. ! variable colloidal fraction
+   xlam1        =  0.005  ! scavenging rate of Iron
+   xlamdust     =  150.0  ! Scavenging rate of dust
+   ligand       =  0.6E-9 ! Ligands concentration 
+   kfep         =  0.     ! Nanoparticle formation rate constant
+/
+!-----------------------------------------------------------------------  
 &nampisrem     !   parameters for remineralization
-!,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
+!-----------------------------------------------------------------------
    xremik    =  0.3       ! remineralization rate of DOC
-   xremip    =  0.025     ! remineralisation rate of POC
    nitrif    =  0.05      ! NH4 nitrification rate
    xsirem    =  0.003     ! remineralization rate of Si
    xsiremlab =  0.03      ! fast remineralization rate of Si
    xsilab    =  0.5       ! Fraction of labile biogenic silica
-/
-!'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
+   feratb    =  10.E-6    ! Fe/C quota in bacteria
+   xkferb    =  2.5E-10   ! Half-saturation constant for bacteria Fe/C
+!                         ! ln_p5z
+   xremikc   =  0.25      ! remineralization rate of DOC
+   xremikn   =  0.35      ! remineralization rate of DON
+   xremikp   =  0.4       ! remineralization rate of DOP
+!   feratb    =  20E-6     ! Bacterial Fe/C ratio
+!   xkferb    =  3E-10     ! Half-saturation constant for bact. Fe/C
+/
+!-----------------------------------------------------------------------
+&nampispoc     !   parameters for organic particles
+!-----------------------------------------------------------------------
+   xremip    =  0.035     ! remineralisation rate of PON
+   jcpoc     =  15        ! Number of lability classes
+   rshape    =  1.0       ! Shape of the gamma function
+!                         ! ln_p5z
+   xremipc   =  0.02      ! remineralisation rate of POC
+   xremipn   =  0.025     ! remineralisation rate of PON
+   xremipp   =  0.03      ! remineralisation rate of POP
+/
+!-----------------------------------------------------------------------
 &nampiscal     !   parameters for Calcite chemistry
-!,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
+!-----------------------------------------------------------------------
    kdca       =  6.       ! calcite dissolution rate constant (1/time)
    nca        =  1.       ! order of dissolution reaction (dimensionless)
 /
-!'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
+!-----------------------------------------------------------------------
 &nampissbc     !   parameters for inputs deposition
-!,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
+!-----------------------------------------------------------------------
 !              !  file name        ! frequency (hours) ! variable      ! time interp. !  clim  ! 'yearly'/ ! weights  ! rotation ! land/sea mask !
 !              !                   !  (if <0  months)  !   name        !   (logical)  !  (T/F) ! 'monthly' ! filename ! pairing  ! filename      !
@@ -205,8 +378,21 @@
    concfediaz  =  1.e-10   ! Diazotrophs half-saturation Cste for Iron
    hratio      =  1.e+7    ! Fe to 3He ratio assumed for vent iron supply 
-/
-!'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
+!                          ! ln_ligand
+   fep_rats    =  1.       ! Fep/Fer ratio from sed sources 
+   fep_rath    =  1.       ! Fep/Fer ratio from sed hydro sources 
+   lgw_rath    =  0.5      ! Weak ligand ratio from sed hydro sources 
+/
+!-----------------------------------------------------------------------
+&nampislig      !  Namelist parameters for ligands, nampislig
+!-----------------------------------------------------------------------
+   rfep        =  0.001    ! Dissolution rate of FeP
+   rlgw        =  1.       ! Lifetime (years) of weak ligands
+   rlig        =  1.E-4    ! Remin ligand production per unit C
+   prlgw       =  1.E-4    ! Photolysis of weak ligand
+   rlgs        =  1000.    ! Lifetime (years) of strong ligands
+/
+!-----------------------------------------------------------------------
 &nampisice      !  Prescribed sea ice tracers
-!,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
+!-----------------------------------------------------------------------
 ! constant ocean tracer concentrations are defined in trcice_pisces.F90 (Global, Arctic, Antarctic and Baltic)
 ! trc_ice_ratio     * betw 0 and 1: prescribed ice/ocean tracer concentration ratio
@@ -219,5 +405,5 @@
 ! cn_trc_o          * 'GL' use global ocean values making the Baltic distinction only
 !                     'AA' use specific Arctic/Antarctic/Baltic values
-!,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
+!-----------------------------------------------------------------------
 !    sn_tri_ ! trc_ice_ratio ! trc_ice_prescr !     cn_trc_o
    sn_tri_dic =           -1.,           -99.,          'AA'
@@ -247,62 +433,13 @@
    sn_tri_nh4 =            1.,           -99.,          'AA'
 /
-!'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
-&nampiskrp     !   Kriest parameterization : parameters     "key_kriest"
-!,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
-   xkr_eta      = 1.17    ! Sinking  exponent
-   xkr_zeta     = 2.28    ! N content exponent
-   xkr_ncontent = 5.7E-6  ! N content factor
-   xkr_mass_min = 0.0002  ! Minimum mass for Aggregates
-   xkr_mass_max = 1.      ! Maximum mass for Aggregates
-/
-!'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
-&nampiskrs     !   Kriest parameterization : size classes  "key_kriest"
-!,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
-   xkr_sfact    = 942.    ! Sinking factor
-   xkr_stick    = 0.5     ! Stickiness
-   xkr_nnano    = 2.337   ! Nbr of cell in nano size class
-   xkr_ndiat    = 3.718   ! Nbr of cell in diatoms size class
-   xkr_nmeso    = 7.147   ! Nbr of cell in mesozoo size class
-   xkr_naggr    = 9.877   ! Nbr of cell in aggregates  size class
-/
-!'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
-&nampisdia     !   additional 2D/3D tracers diagnostics 
-!,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
-!              !    name   !           title of the field          !     units      !
-!              !           !                                       !                !  
-   pisdia2d(1)  = 'Cflx     ' , 'DIC flux                          ',  'molC/m2/s    '
-   pisdia2d(2)  = 'Oflx     ' , 'Oxygen flux                       ',  'molC/m2/s    '
-   pisdia2d(3)  = 'Kg       ' , 'Gas transfer                      ',  'mol/m2/s/uatm'
-   pisdia2d(4)  = 'Delc     ' , 'Delta CO2                         ',  'uatm         '
-   pisdia2d(5)  = 'PMO      ' , 'POC export                        ',  'molC/m2/s    '
-   pisdia2d(6)  = 'PMO2     ' , 'GOC export                        ',  'molC/m2/s    '
-   pisdia2d(7)  = 'ExpFe1   ' , 'Nano iron export                  ',  'molFe/m2/s   '
-   pisdia2d(8)  = 'ExpFe2   ' , 'Diatoms iron export               ',  'molFe/m2/s   '
-   pisdia2d(9)  = 'ExpSi    ' , 'Silicate export                   ',  'molSi/m2/s   '
-   pisdia2d(10) = 'ExpCaCO3 ' , 'Calcite export                    ',  'molC/m2/s    '
-   pisdia2d(11) = 'heup     ' , 'euphotic layer depth              ',  'm            '
-   pisdia2d(12) = 'Fedep    ' , 'Iron dep                          ',  'molFe/m2/s   '
-   pisdia2d(13) = 'Nfix     ' , 'Nitrogen Fixation                 ',  'molN/m2/s    '
-   pisdia3d(1)  = 'PH       ' , 'PH                                ',  '-            '
-   pisdia3d(2)  = 'CO3      ' , 'Bicarbonates                      ',  'mol/l        '
-   pisdia3d(3)  = 'CO3sat   ' , 'CO3 saturation                    ',  'mol/l        '
-   pisdia3d(4)  = 'PAR      ' , 'light penetration                 ',  'W/m2         '
-   pisdia3d(5)  = 'PPPHY    ' , 'Primary production of nanophyto   ',  'molC/m3/s    '
-   pisdia3d(6)  = 'PPPHY2   ' , 'Primary production of diatoms     ',  'molC/m3/s    '
-   pisdia3d(7)  = 'PPNEWN   ' , 'New Primary production of nano    ',  'molC/m3/s    '
-   pisdia3d(8)  = 'PPNEWD   ' , 'New Primary production of diat    ',  'molC/m3/s    '
-   pisdia3d(9)  = 'PBSi     ' , 'Primary production of Si diatoms  ',  'molSi/m3/s   '
-   pisdia3d(10) = 'PFeN     ' , 'Primary production of nano iron   ',  'molFe/m3/s   '
-   pisdia3d(11) = 'PFeD     ' , 'Primary production of diatoms iron',  'molFe/m3/s   '
-/
-!'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
+!-----------------------------------------------------------------------
 &nampisdmp     !  Damping 
-!,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
+!-----------------------------------------------------------------------
    ln_pisdmp    =  .true.     !  Relaxation fo some tracers to a mean value
    nn_pisdmp    =  5475       !  Frequency of Relaxation 
 /
-!'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
+!-----------------------------------------------------------------------
 &nampismass     !  Mass conservation
-!,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
+!-----------------------------------------------------------------------
    ln_check_mass =  .false.    !  Check mass conservation
 /
@@ -317,10 +454,8 @@
 !!              7  - general coefficients                       (namlobrat)
 !!              8  - optical parameters                         (namlobopt)
-
-!!              10 - biological diagnostics trends              (namlobdbi) 
 !>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
-!'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
+!-----------------------------------------------------------------------
 &namlobphy     !   biological parameters for phytoplankton
-!,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
+!-----------------------------------------------------------------------
    tmumax  =  1.21e-5   ! maximal phytoplankton growth rate            [s-1] 
    rgamma  =  0.05      ! phytoplankton exudation fraction             [%]
@@ -329,7 +464,7 @@
    aki     =  33.       ! light photosynthesis half saturation constant[W/m2]
 /
-!'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
+!-----------------------------------------------------------------------
 &namlobnut     !   biological parameters for nutrients
-!,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
+!-----------------------------------------------------------------------
    akno3   =  0.7       ! nitrate limitation half-saturation value     [mmol/m3]
    aknh4   =  0.001     ! ammonium limitation half-saturation value    [mmol/m3]
@@ -337,7 +472,7 @@
    psinut  =  3.        ! inhibition of nitrate uptake by ammonium
 /
-!'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
+!-----------------------------------------------------------------------
 &namlobzoo     !   biological parameters for zooplankton
-!,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
+!-----------------------------------------------------------------------
    rppz    = 0.8        ! zooplankton nominal preference for phytoplancton food  [%]
    taus    = 9.26E-6    ! specific zooplankton maximal grazing rate              [s-1] 
@@ -351,19 +486,19 @@
    tmminz  = 2.31e-6    ! minimal zooplankton mortality rate                     [(mmolN/m3)-1 d-1]
 /
-!'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
+!-----------------------------------------------------------------------
 &namlobdet     !   biological parameters for detritus
-!,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
+!-----------------------------------------------------------------------
    taudn   = 5.80e-7    ! detritus breakdown rate                        [0.1/86400 s-1=10 days]
    fdetlab = 0.         ! NH4 fraction of detritus dissolution           
 /
-!'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
+!-----------------------------------------------------------------------
 &namlobdom     !   biological parameters for DOM
-!,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
+!-----------------------------------------------------------------------
    taudomn = 6.43e-8    ! DOM breakdown rate                             [s-1] 
 !                       ! slow remineralization rate of semi-labile dom to nh4 (1 month)
 /
-!'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
+!-----------------------------------------------------------------------
 &namlobsed     !   parameters from aphotic layers to sediment
-!,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
+!-----------------------------------------------------------------------
    sedlam     = 3.86e-7    ! time coefficient of POC remineralization in sediments [s-1]
    sedlostpoc = 0.         ! mass of POC lost in sediments
@@ -371,14 +506,14 @@
    xhr        = -0.858     ! coeff for martin''s remineralisation profile
 /
-!'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
+!-----------------------------------------------------------------------
 &namlobrat     !   general coefficients
-!,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
+!-----------------------------------------------------------------------
    rcchl   = 60.       ! Carbone/Chlorophyl ratio                     [mgC.mgChla-1]
    redf    = 6.56       ! redfield ratio (C:N) for phyto
    reddom  = 6.56       ! redfield ratio (C:N) for DOM
 /
-!'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
+!-----------------------------------------------------------------------
 &namlobopt     !   optical parameters
-!,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
+!-----------------------------------------------------------------------
    xkg0   = 0.0232     ! green absorption coefficient of water
    xkr0   = 0.225      ! red absorption coefficent of water
@@ -389,25 +524,2 @@
    rpig   = 0.7        ! chla/chla+pheo ratio
 /
-!'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
-&nampisdbi     !   biological diagnostics trends     
-!,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
-!                !  2D bio diagnostics   units : mmole/m2/s   ("key_trdmld_trc")
-!                !  name    !       title of the field      !     units      !
-   pisdiabio(1)  = 'NO3PHY' , 'Flux from NO3 to PHY          ',  'mmole/m3/s'
-   pisdiabio(2)  = 'NH4PHY' , 'Flux from NH4 to PHY          ',  'mmole/m3/s'
-   pisdiabio(3)  = 'PHYNH4' , 'Flux from PHY to NH4          ',  'mmole/m3/s'
-   pisdiabio(4)  = 'PHYDOM' , 'Flux from PHY to DOM          ',  'mmole/m3/s'
-   pisdiabio(5)  = 'PHYZOO' , 'Flux from PHY to ZOO          ',  'mmole/m3/s'
-   pisdiabio(6)  = 'PHYDET' , 'Flux from PHY to DET          ',  'mmole/m3/s'
-   pisdiabio(7)  = 'DETZOO' , 'Flux from DET to ZOO          ',  'mmole/m3/s'
-   pisdiabio(8)  = 'DETSED' , 'Flux from DET to SED          ',  'mmole/m3/s'
-   pisdiabio(9)  = 'ZOODET' , 'Flux from ZOO to DET          ',  'mmole/m3/s'
-   pisdiabio(10)  = 'ZOOBOD' , 'Zooplankton closure          ',  'mmole/m3/s'
-   pisdiabio(11)  = 'ZOONH4' , 'Flux from ZOO to NH4         ',  'mmole/m3/s'
-   pisdiabio(12)  = 'ZOODOM' , 'Flux from ZOO to DOM         ',  'mmole/m3/s'
-   pisdiabio(13)  = 'NH4NO3' , 'Flux from NH4 to NO3         ',  'mmole/m3/s'
-   pisdiabio(14)  = 'DOMNH4' , 'Flux from DOM to NH4         ',  'mmole/m3/s'
-   pisdiabio(15)  = 'DETNH4' , 'Flux from DET to NH4         ',  'mmole/m3/s'
-   pisdiabio(16)  = 'DETDOM' , 'Flux from DET to DOM         ',  'mmole/m3/s'
-   pisdiabio(17)  = 'SEDNO3' , 'NO3 remineralization from SED',  'mmole/m3/s'
-/
Index: branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/CONFIG/SHARED/namelist_top_ref
===================================================================
--- branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/CONFIG/SHARED/namelist_top_ref	(revision 7383)
+++ branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/CONFIG/SHARED/namelist_top_ref	(revision 7391)
@@ -8,5 +8,4 @@
 !!               - tracer newtonian damping              (namtrc_dmp)
 !!               - dynamical tracer trends               (namtrc_trd)
-!!               - tracer output diagonstics             (namtrc_dia)
 !>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
 !-----------------------------------------------------------------------
@@ -14,5 +13,4 @@
 !-----------------------------------------------------------------------
    nn_dttrc      =  1        !  time step frequency for passive sn_tracers
-   nn_writetrc   =  5475     !  time step frequency for sn_tracer outputs
    ln_top_euler  = .false.   !  use Euler time-stepping for TOP
    ln_rsttr      = .false.   !  start from a restart file (T) or not (F)
@@ -28,7 +26,29 @@
 &namtrc          !   tracers definition
 !-----------------------------------------------------------------------
-   ln_trcdta     =   .true.  !  Initialisation from data input file (T) or not (F)
+   jp_bgc        =  0           !  Number of passive tracers of the BGC model
+!
+   ln_pisces     =  .false.     !  Run PISCES BGC model 
+   ln_my_trc     =  .false.     !  Run MY_TRC BGC model
+   ln_age        =  .false.     !  Run the sea water age tracer
+   ln_cfc11      =  .false.     !  Run the CFC11 passive tracer
+   ln_cfc12      =  .false.     !  Run the CFC12 passive tracer
+   ln_sf6        =  .false.     !  Run the SF6 passive tracer
+   ln_c14        =  .false.     !  Run the Radiocarbon passive tracer
+!
+   ln_trcdta     =  .false.  !  Initialisation from data input file (T) or not (F)
    ln_trcdmp     =  .false.  !  add a damping termn (T) or not (F)
    ln_trcdmp_clo =  .false.  !  damping term (T) or not (F) on closed seas
+!
+   jp_dia3d      = 0         ! Number of 3D diagnostic variables
+   jp_dia2d      = 0         ! Number of 2D diagnostic variables
+!                !           !                                         !            !                               !
+!                !    name   !           title of the field            !   units    ! initial data from file or not ! 
+!  sn_tracer(1)  = 'tracer  ' , 'Tracer  Concentration                 ',   ' - '    ,           .false.
+/
+!-----------------------------------------------------------------------
+&namage         !   AGE 
+!-----------------------------------------------------------------------
+   rn_age_depth      = 10            ! depth over which age tracer reset to zero
+   rn_age_kill_rate  = -0.000138888  !  = -1/7200 recip of relaxation timescale (s) for  age tracer shallower than age_depth
 /
 !-----------------------------------------------------------------------
@@ -36,4 +56,7 @@
 !-----------------------------------------------------------------------
    cn_dir        =  './'     !  root directory for the location of the data files
+!          !  file name  ! frequency (hours) ! variable  ! time interp. !  clim  ! 'yearly'/ ! weights  ! rotation ! land/sea mask !
+!          !             !  (if <0  months)  !   name    !   (logical)  !  (T/F) ! 'monthly' ! filename ! pairing  ! filename      !
+   sn_trcdta(1)  = 'data_TRC_nomask'        ,        -12        ,  'TRC'     ,    .false.   , .true. , 'yearly'  , ''       , ''   , ''
 /
 !-----------------------------------------------------------------------
@@ -111,12 +134,4 @@
    ln_trdtrc(23) = .true.
 /
-!-----------------------------------------------------------------------
-&namtrc_dia      !   parameters for passive tracer additional diagnostics
-!----------------------------------------------------------------------
-   ln_diatrc     =  .true.   !  save additional diag. (T) or not (F)
-   ln_diabio     =  .true.   !  output biological trends
-   nn_writedia   =  5475     !  time step frequency for diagnostics
-   nn_writebio   =    10     !  frequency of biological outputs
-/
 !----------------------------------------------------------------------
 &namtrc_bc       !   data for boundary conditions
@@ -125,4 +140,6 @@
    cn_dir_cbc    =  './'     !  root directory for the location of COASTAL data files
    cn_dir_obc    =  './'     !  root directory for the location of OPEN data files
+   ln_rnf_ctl    = .false.   !  Remove runoff dilution on tracers with absent river load
+   rn_bc_time    =  86400.   !  Time scaling factor for SBC and CBC data (seconds in a day)
 /
 !----------------------------------------------------------------------
Index: branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/CONFIG/SHARED/namelist_trc_ref
===================================================================
--- branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/CONFIG/SHARED/namelist_trc_ref	(revision 7391)
+++ branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/CONFIG/SHARED/namelist_trc_ref	(revision 7391)
@@ -0,0 +1,45 @@
+!!>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
+!! Inert tracers reference namelist 
+!!       1  - CFC                (namcfc)
+!!       2  - C14               (namc14_typ, namc14_sbc, namc14_fcg)
+!>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
+!-----------------------------------------------------------------------
+&namcfc     !   CFC 
+!-----------------------------------------------------------------------
+   ndate_beg  = 300101    !  datedeb1
+   nyear_res  = 1932      !  iannee1
+   !
+   ! Formatted file of annual hemisperic CFCs concentration in the atmosphere (ppt)
+   clname     = 'CFCs_in_air_CMIP6.dat'
+/
+!
+!-----------------------------------------------------------------------
+&namc14_typ     !  C14 - type of C14 tracer, default values of C14/C and pco2
+!-----------------------------------------------------------------------
+   kc14typ  = 0          ! Type of C14 tracer (0=equilibrium; 1=bomb transient; 2=past transient)
+   rc14at   = 1.0        ! Default value for atmospheric C14/C (used for equil run)
+   pco2at   = 280.0      ! Default value for atmospheric pcO2 [atm] (used for equil run)
+   rc14init = 0.85       ! Default value for initialization of ocean C14/C (when no restart)
+/
+!
+!-----------------------------------------------------------------------
+&namc14_sbc     !  C14 - surface BC
+!-----------------------------------------------------------------------
+   ln_chemh = .true.     ! Chemical enhancement in piston vel.: yes/no
+   xkwind   = 0.360      ! Coefficient for gas exchange velocity
+   xdicsur  = 2.0        ! Reference DIC surface concentration (mol/m3)
+/
+!
+!-----------------------------------------------------------------------
+&namc14_fcg     !  files & dates
+!               !  For Paleo-historical: specify tyrc14_beg in yr BP
+!               !  For Bomb: tyrc14_beg=0
+!-----------------------------------------------------------------------
+   cfileco2    = 'splco2.dat'  !  atmospheric co2 - Bomb
+   cfilec14    = 'atmc14.dat'  !  atmospheric c14 - Bomb
+   tyrc14_beg  = 0.00          !  starting year of experiment - Bomb
+!   cfileco2    = 'ByrdEdcCO2.txt' !  atmospheric co2 - Paleo
+!   cfilec14    = 'intcal13.14c'   !  atmospheric c14 - Paleo
+!   tyrc14_beg  =  35000.00        !  starting year of experiment - Paleo (yr BP)
+/
+!
Index: branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/CONFIG/cfg.txt
===================================================================
--- branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/CONFIG/cfg.txt	(revision 7383)
+++ branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/CONFIG/cfg.txt	(revision 7391)
@@ -11,2 +11,3 @@
 GYRE OPA_SRC
 ORCA2_LIM_PISCES OPA_SRC LIM_SRC_2 NST_SRC TOP_SRC
+ORCA2_LIM3_TRC OPA_SRC LIM_SRC_3 NST_SRC TOP_SRC
Index: branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/NEMO/LIM_SRC_3/limistate.F90
===================================================================
--- branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/NEMO/LIM_SRC_3/limistate.F90	(revision 7383)
+++ branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/NEMO/LIM_SRC_3/limistate.F90	(revision 7391)
@@ -313,5 +313,4 @@
 
                   IF(lwp) THEN 
-                     WRITE(numout,*) ' ztests : ', ztests
                      IF( ztests .NE. 4 )THEN
                         WRITE(numout,*)
Index: branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/NEMO/OPA_SRC/SBC/sbc_oce.F90
===================================================================
--- branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/NEMO/OPA_SRC/SBC/sbc_oce.F90	(revision 7383)
+++ branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/NEMO/OPA_SRC/SBC/sbc_oce.F90	(revision 7391)
@@ -122,7 +122,5 @@
    REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   sprecip           !: solid precipitation                          [Kg/m2/s]
    REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   fr_i              !: ice fraction = 1 - lead fraction      (between 0 to 1)
-#if defined key_cpl_carbon_cycle
    REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   atm_co2           !: atmospheric pCO2                             [ppm]
-#endif
    REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) :: xcplmask          !: coupling mask for ln_mixcpl (warning: allocated in sbccpl)
 
@@ -168,7 +166,5 @@
          !
       ALLOCATE( tprecip(jpi,jpj) , sprecip(jpi,jpj) , fr_i(jpi,jpj) ,     &
-#if defined key_cpl_carbon_cycle
          &      atm_co2(jpi,jpj) ,                                        &
-#endif
          &      ssu_m  (jpi,jpj) , sst_m(jpi,jpj) , frq_m(jpi,jpj) ,      &
          &      ssv_m  (jpi,jpj) , sss_m(jpi,jpj) , ssh_m(jpi,jpj) , STAT=ierr(4) )
Index: branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/NEMO/OPA_SRC/SBC/sbccpl.F90
===================================================================
--- branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/NEMO/OPA_SRC/SBC/sbccpl.F90	(revision 7383)
+++ branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/NEMO/OPA_SRC/SBC/sbccpl.F90	(revision 7391)
@@ -21,5 +21,5 @@
    USE sbc_oce         ! Surface boundary condition: ocean fields
    USE sbc_ice         ! Surface boundary condition: ice fields
-   USE sbcapr
+   USE sbcapr          ! Stochastic param. : ???
    USE sbcdcy          ! surface boundary condition: diurnal cycle
    USE sbcwave         ! surface boundary condition: waves
@@ -37,8 +37,5 @@
    USE albedo         ! 
    USE eosbn2         ! 
-   USE sbcrnf  , ONLY : l_rnfcpl
-#if defined key_cpl_carbon_cycle
-   USE p4zflx, ONLY : oce_co2
-#endif
+   USE sbcrnf, ONLY : l_rnfcpl
 #if defined key_cice
    USE ice_domain_size, only: ncat
@@ -509,5 +506,12 @@
       !                                                      !      Atmospheric CO2      !
       !                                                      ! ------------------------- !
-      srcv(jpr_co2 )%clname = 'O_AtmCO2'   ;   IF( TRIM(sn_rcv_co2%cldes   ) == 'coupled' )    srcv(jpr_co2 )%laction = .TRUE.
+      srcv(jpr_co2 )%clname = 'O_AtmCO2'   
+      IF( TRIM(sn_rcv_co2%cldes   ) == 'coupled' )  THEN
+         srcv(jpr_co2 )%laction = .TRUE.
+         l_co2cpl = .TRUE.
+         IF(lwp) WRITE(numout,*)
+         IF(lwp) WRITE(numout,*) '   Atmospheric pco2 received from oasis '
+         IF(lwp) WRITE(numout,*)
+      ENDIF
 
       !                                                      ! ------------------------- ! 
@@ -1105,10 +1109,8 @@
       ENDIF
 
-#if defined key_cpl_carbon_cycle
       !                                                      ! ================== !
       !                                                      ! atmosph. CO2 (ppm) !
       !                                                      ! ================== !
       IF( srcv(jpr_co2)%laction )   atm_co2(:,:) = frcv(jpr_co2)%z3(:,:,1)
-#endif
       ! 
       !                                                      ! ========================= ! 
@@ -2098,12 +2100,9 @@
          IF( ssnd(jps_hsnw)%laction )   CALL cpl_snd( jps_hsnw, isec, ztmp4, info )
       ENDIF
-      !
-#if defined key_cpl_carbon_cycle
       !                                                      ! ------------------------- !
       !                                                      !  CO2 flux from PISCES     ! 
       !                                                      ! ------------------------- !
-      IF( ssnd(jps_co2)%laction )   CALL cpl_snd( jps_co2, isec, RESHAPE ( oce_co2, (/jpi,jpj,1/) ) , info )
-      !
-#endif
+      IF( ssnd(jps_co2)%laction .AND. l_co2cpl )   CALL cpl_snd( jps_co2, isec, RESHAPE ( oce_co2, (/jpi,jpj,1/) ) , info )
+      !
       !                                                      ! ------------------------- !
       IF( ssnd(jps_ocx1)%laction ) THEN                      !      Surface current      !
Index: branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/NEMO/OPA_SRC/trc_oce.F90
===================================================================
--- branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/NEMO/OPA_SRC/trc_oce.F90	(revision 7383)
+++ branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/NEMO/OPA_SRC/trc_oce.F90	(revision 7391)
@@ -24,8 +24,9 @@
    PUBLIC   trc_oce_alloc      ! function called by nemogcm.F90
 
+   LOGICAL , PUBLIC                                      ::   l_co2cpl = .false.   !: atmospheric pco2 recieved from oasis
    INTEGER , PUBLIC                                      ::   nn_dttrc      !: frequency of step on passive tracers
    REAL(wp), PUBLIC                                      ::   r_si2         !: largest depth of extinction (blue & 0.01 mg.m-3)  (RGB)
    REAL(wp), PUBLIC, SAVE, ALLOCATABLE, DIMENSION(:,:,:) ::   etot3         !: light absortion coefficient
-   REAL(wp), PUBLIC, SAVE, ALLOCATABLE, DIMENSION(:,:,:) ::   facvol        !: volume for degraded regions
+   REAL(wp), PUBLIC, SAVE, ALLOCATABLE, DIMENSION(:,:)   ::   oce_co2   !: ocean carbon flux
 
 #if defined key_top 
@@ -75,12 +76,7 @@
       !!                  ***  trc_oce_alloc  ***
       !!----------------------------------------------------------------------
-      INTEGER ::   ierr(2)        ! Local variables
-      !!----------------------------------------------------------------------
-      ierr(:) = 0
-                     ALLOCATE( etot3 (jpi,jpj,jpk), STAT=ierr(1) )
-      IF( lk_degrad) ALLOCATE( facvol(jpi,jpj,jpk), STAT=ierr(2) )
-      trc_oce_alloc  = MAXVAL( ierr )
-      !
+      ALLOCATE( etot3(jpi,jpj,jpk), oce_co2(jpi,jpj), STAT=trc_oce_alloc )
       IF( trc_oce_alloc /= 0 )   CALL ctl_warn('trc_oce_alloc: failed to allocate etot3 array')
+      !
    END FUNCTION trc_oce_alloc
 
Index: branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/NEMO/TOP_SRC/AGE/par_age.F90
===================================================================
--- branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/NEMO/TOP_SRC/AGE/par_age.F90	(revision 7391)
+++ branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/NEMO/TOP_SRC/AGE/par_age.F90	(revision 7391)
@@ -0,0 +1,17 @@
+MODULE par_age
+   !!======================================================================
+   !!                        ***  par_age  ***
+   !! TOP :   set the AGE parameters
+   !!======================================================================
+   !! History :   2.0  !  2007-12  (C. Ethe, G. Madec)  revised architecture
+   !!----------------------------------------------------------------------
+   !! NEMO/TOP 3.3 , NEMO Consortium (2010)
+   !! $Id$ 
+   !! Software governed by the CeCILL licence (NEMOGCM/NEMO_CeCILL.txt)
+   !!----------------------------------------------------------------------
+   IMPLICIT NONE
+
+   INTEGER, PUBLIC  :: jp_age    !: number of passive tracers in PISCES
+
+   !!======================================================================
+END MODULE par_age
Index: branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/NEMO/TOP_SRC/AGE/trcice_age.F90
===================================================================
--- branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/NEMO/TOP_SRC/AGE/trcice_age.F90	(revision 7391)
+++ branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/NEMO/TOP_SRC/AGE/trcice_age.F90	(revision 7391)
@@ -0,0 +1,31 @@
+MODULE trcice_age
+   !!======================================================================
+   !!                         ***  MODULE trcice_age  ***
+   !!======================================================================
+   USE par_trc         ! TOP parameters
+   USE oce_trc         ! Ocean variables
+   USE trc             ! TOP variables
+
+   IMPLICIT NONE
+   PRIVATE
+
+   PUBLIC   trc_ice_ini_age       ! called by trcice.F90 module
+
+   !!----------------------------------------------------------------------
+   !! NEMO/TOP 3.3 , NEMO Consortium (2010)
+   !! $Id: trcice_ageb.F90 4990 2014-12-15 16:42:49Z timgraham $
+   !! Software governed by the CeCILL licence     (NEMOGCM/NEMO_CeCILL.txt)
+   !!----------------------------------------------------------------------
+CONTAINS
+
+   SUBROUTINE trc_ice_ini_age
+      !!----------------------------------------------------------------------
+      !!                     ***  trc_ice_ageb  ***
+      !!
+      !!----------------------------------------------------------------------
+      !
+      !
+   END SUBROUTINE trc_ice_ini_age
+
+   !!======================================================================
+END MODULE trcice_age
Index: branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/NEMO/TOP_SRC/AGE/trcini_age.F90
===================================================================
--- branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/NEMO/TOP_SRC/AGE/trcini_age.F90	(revision 7391)
+++ branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/NEMO/TOP_SRC/AGE/trcini_age.F90	(revision 7391)
@@ -0,0 +1,64 @@
+MODULE trcini_age
+   !!======================================================================
+   !!                         ***  MODULE trcini_age  ***
+   !! TOP :   initialisation of the AGE tracer
+   !!======================================================================
+   !! History :   2.0  !  2007-12  (G. Nurser, G. Madec, C. Ethe ) Original code
+   !!----------------------------------------------------------------------
+   !! trc_ini_age   : MY_TRC model initialisation
+   !!----------------------------------------------------------------------
+   USE oce_trc
+   USE trc
+   USE trcnam_age
+   USE trcsms_age
+
+   IMPLICIT NONE
+   PRIVATE
+
+   PUBLIC   trc_ini_age   ! called by trcini.F90 module
+
+   !!----------------------------------------------------------------------
+   !! NEMO/TOP 3.3 , NEMO Consortium (2010)
+   !! $Id$ 
+   !! Software governed by the CeCILL licence     (NEMOGCM/NEMO_CeCILL.txt)
+   !!----------------------------------------------------------------------
+CONTAINS
+
+   SUBROUTINE trc_ini_age
+      !!----------------------------------------------------------------------
+      !!                     ***  trc_ini_age  ***  
+      !!
+      !! ** Purpose :   initialization for AGE model
+      !!
+      !!----------------------------------------------------------------------
+      INTEGER    ::  jn
+      CHARACTER(len = 20)  ::  cltra
+      !!----------------------------------------------------------------------
+      !
+      CALL trc_nam_age
+      !
+      IF(lwp) WRITE(numout,*)
+      IF(lwp) WRITE(numout,*) ' trc_ini_age: passive tracer age'
+      IF(lwp) WRITE(numout,*) ' ~~~~~~~~~~~~~~'
+      IF(lwp) WRITE(numout,*)
+
+      rryear  = 1._wp / ( nyear_len(1) * rday )    ! recip number of seconds in one year
+
+      !! BUG in s-coordinate this does not work!
+      nlb_age = MINLOC( gdepw_1d, mask = gdepw_1d > rn_age_depth, dim = 1 ) ! shallowest W level Below age_depth
+                                                                            !  = shallowest T level wholly below age_depth
+      nl_age  = nlb_age - 1                                                 ! deepest    W level Above age_depth
+                                                                            !  = T level surrounding age_depth
+
+      nla_age = nl_age - 1                                                   ! deepest    T level wholly above age_depth
+
+      frac_kill_age = ( rn_age_depth - gdepw_1d(nl_age) ) / e3t_1d(nl_age)      ! fraction of level nl_age above age_depth
+      frac_add_age  = 1._wp -  frac_kill_age                                    ! fraction of level nl_age below age_depth
+
+      
+      IF( .NOT. ln_rsttr ) trn(:,:,:,jp_age) = 0.
+      !
+   END SUBROUTINE trc_ini_age
+
+   !!======================================================================
+END MODULE trcini_age
Index: branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/NEMO/TOP_SRC/AGE/trcnam_age.F90
===================================================================
--- branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/NEMO/TOP_SRC/AGE/trcnam_age.F90	(revision 7391)
+++ branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/NEMO/TOP_SRC/AGE/trcnam_age.F90	(revision 7391)
@@ -0,0 +1,72 @@
+MODULE trcnam_age
+   !!======================================================================
+   !!                         ***  MODULE trcnam_age  ***
+   !! TOP :   initialisation of some run parameters for Age tracer
+   !!======================================================================
+   !! History :   2.0  !  2007-12  (C. Ethe, G. Madec) 
+   !!----------------------------------------------------------------------
+   !! trc_nam_age      : AGE  tracer initialisation
+   !!----------------------------------------------------------------------
+   USE oce_trc         ! Ocean variables
+   USE trc             ! Ocean variables
+   USE trcsms_age      ! AGE specific variable
+
+   IMPLICIT NONE
+   PRIVATE
+
+   PUBLIC   trc_nam_age   ! called by trcnam.F90 module
+
+   !!----------------------------------------------------------------------
+   !! NEMO/TOP 3.3 , NEMO Consortium (2010)
+   !! $Id$
+   !! Software governed by the CeCILL licence (NEMOGCM/NEMO_CeCILL.txt)
+   !!----------------------------------------------------------------------
+
+CONTAINS
+
+   SUBROUTINE trc_nam_age
+      !!-------------------------------------------------------------------
+      !!                  ***  ROUTINE trc_nam_age  ***
+      !!                 
+      !! ** Purpose :   Definition some run parameter for AGE model
+      !!
+      !! ** input   :   Namelist namage
+      !!----------------------------------------------------------------------
+      INTEGER :: ios                 ! Local integer output status for namelist read
+      !!
+      NAMELIST/namage/ rn_age_depth, rn_age_kill_rate 
+      !!----------------------------------------------------------------------
+      ! Variable setting
+      ctrcnm    (jp_age) = 'Age'
+      ctrcln    (jp_age) = 'Sea water age since surface contact'
+      ctrcun    (jp_age) = 'year'
+      ln_trc_ini(jp_age) = .false.
+      ln_trc_sbc(jp_age) = .false.
+      ln_trc_cbc(jp_age) = .false.
+      ln_trc_obc(jp_age) = .false.
+      !
+      REWIND( numnat_ref )              ! Namelist namagedate in reference namelist : AGE parameters
+      READ  ( numnat_ref, namage, IOSTAT = ios, ERR = 901)
+901   IF( ios /= 0 ) CALL ctl_nam ( ios , 'namage in reference namelist', lwp )
+
+      REWIND( numnat_cfg )              ! Namelist namagedate in configuration namelist : AGE parameters
+      READ  ( numnat_cfg, namage, IOSTAT = ios, ERR = 902 )
+902   IF( ios /= 0 ) CALL ctl_nam ( ios , 'namage in configuration namelist', lwp )
+      IF(lwm) WRITE ( numont, namage )
+
+      IF(lwp) THEN                  ! control print
+         WRITE(numout,*) ' '
+         WRITE(numout,*) ' Sea Age Tracer'
+         WRITE(numout,*)
+         WRITE(numout,*) ' trc_nam_age: Read namage, namelist for Age passive tracer'
+         WRITE(numout,*) ' ~~~~~~~'
+         WRITE(numout,*) '  depth over which age tracer reset to zero                              rn_age_depth      = ', rn_age_depth 
+         WRITE(numout,*) '  recip of relax. timescale (s) for age tracer shallower than age_depth  rn_age_kill_rate  = ', rn_age_kill_rate 
+         WRITE(numout,*) ''
+      ENDIF
+
+      !
+   END SUBROUTINE trc_nam_age
+   
+   !!======================================================================
+END MODULE trcnam_age
Index: branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/NEMO/TOP_SRC/AGE/trcsms_age.F90
===================================================================
--- branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/NEMO/TOP_SRC/AGE/trcsms_age.F90	(revision 7391)
+++ branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/NEMO/TOP_SRC/AGE/trcsms_age.F90	(revision 7391)
@@ -0,0 +1,77 @@
+MODULE trcsms_age
+   !!======================================================================
+   !!                         ***  MODULE trcsms_age  ***
+   !! TOP :   Main module of the AGE tracers
+   !!======================================================================
+   !! History :   2.0  !  2007-12  (C. Ethe, G. Madec) Original code
+   !!----------------------------------------------------------------------
+   !! trc_sms_age       : AGE model main routine
+   !!----------------------------------------------------------------------
+   USE oce_trc         ! Ocean variables
+   USE trc             ! TOP variables
+   USE trd_oce
+   USE trdtrc
+
+   IMPLICIT NONE
+   PRIVATE
+
+   PUBLIC   trc_sms_age       ! called by trcsms.F90 module
+
+   INTEGER , PUBLIC :: nl_age             ! T level surrounding age_depth
+   INTEGER , PUBLIC :: nla_age            ! T level wholly above age_depth
+   INTEGER , PUBLIC :: nlb_age            ! T level wholly below age_depth
+
+   REAL(wp), PUBLIC :: rn_age_depth       ! = 10       depth over which age tracer reset to zero
+   REAL(wp), PUBLIC :: rn_age_kill_rate   ! = -1./7200  recip of relaxation timescale (s) for  age tracer shallower than age_depth
+   
+   REAL(wp), PUBLIC :: rryear          !: recip number of seconds in one year
+   REAL(wp), PUBLIC :: frac_kill_age   !: fraction of level nl_age above age_depth where it is relaxed towards zero
+   REAL(wp), PUBLIC :: frac_add_age    !: fraction of level nl_age below age_depth where it is incremented
+
+
+   !!----------------------------------------------------------------------
+   !! NEMO/TOP 3.3 , NEMO Consortium (2010)
+   !! $Id$
+   !! Software governed by the CeCILL licence     (NEMOGCM/NEMO_CeCILL.txt)
+   !!----------------------------------------------------------------------
+CONTAINS
+
+   SUBROUTINE trc_sms_age( kt )
+      !!----------------------------------------------------------------------
+      !!                     ***  trc_sms_age  ***
+      !!
+      !! ** Purpose :   main routine of AGE model
+      !!
+      !! ** Method  : -
+      !!----------------------------------------------------------------------
+      !
+      INTEGER, INTENT(in) ::   kt   ! ocean time-step index
+      INTEGER ::   jn, jk   ! dummy loop index
+      !!----------------------------------------------------------------------
+      !
+      IF( nn_timing == 1 )  CALL timing_start('trc_sms_age')
+      !
+      IF(lwp) WRITE(numout,*)
+      IF(lwp) WRITE(numout,*) ' trc_sms_age:  AGE model'
+      IF(lwp) WRITE(numout,*) ' ~~~~~~~~~~~~~~'
+
+
+      DO jk = 1, nla_age
+         tra(:,:,jk,jp_age) = rn_age_kill_rate * trb(:,:,jk,jp_age)
+      ENDDO
+      !
+      tra(:,:,nl_age,jp_age) = frac_kill_age * rn_age_kill_rate * trb(:,:,nl_age,jp_age)  &
+          &                   + frac_add_age  * rryear * tmask(:,:,nl_age)
+      !
+      DO jk = nlb_age, jpk
+         tra(:,:,jk,jp_age) = tmask(:,:,jk) * rryear
+      ENDDO
+      !
+      IF( l_trdtrc ) CALL trd_trc( tra(:,:,:,jp_age), jn, jptra_sms, kt )   ! save trends
+      !
+      IF( nn_timing == 1 )  CALL timing_stop('trc_sms_age')
+      !
+   END SUBROUTINE trc_sms_age
+
+   !!======================================================================
+END MODULE trcsms_age
Index: branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/NEMO/TOP_SRC/AGE/trcwri_age.F90
===================================================================
--- branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/NEMO/TOP_SRC/AGE/trcwri_age.F90	(revision 7391)
+++ branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/NEMO/TOP_SRC/AGE/trcwri_age.F90	(revision 7391)
@@ -0,0 +1,56 @@
+MODULE trcwri_age
+   !!======================================================================
+   !!                       *** MODULE trcwri ***
+   !!    age :   Output of age tracers
+   !!======================================================================
+   !! History :   1.0  !  2009-05 (C. Ethe)  Original code
+   !!----------------------------------------------------------------------
+#if defined key_top &&  defined key_iomput
+   !!----------------------------------------------------------------------
+   !! trc_wri_age   :  outputs of concentration fields
+   !!----------------------------------------------------------------------
+   USE par_age     
+   USE trc         
+   USE iom
+
+   IMPLICIT NONE
+   PRIVATE
+
+   PUBLIC trc_wri_age 
+
+CONTAINS
+
+   SUBROUTINE trc_wri_age
+      !!---------------------------------------------------------------------
+      !!                     ***  ROUTINE trc_wri_trc  ***
+      !!
+      !! ** Purpose :   output passive tracers fields 
+      !!---------------------------------------------------------------------
+      CHARACTER (len=20)   :: cltra
+      INTEGER              :: jn
+      !!---------------------------------------------------------------------
+
+      ! write the tracer concentrations in the file
+
+      cltra = TRIM( ctrcnm(jp_age) )                  ! short title for tracer
+      CALL iom_put( cltra, trn(:,:,:,jp_age) )
+
+      !
+   END SUBROUTINE trc_wri_age
+
+#else
+   !!----------------------------------------------------------------------
+   !!  Dummy module :                                     No passive tracer
+   !!----------------------------------------------------------------------
+   PUBLIC trc_wri_age
+CONTAINS
+   SUBROUTINE trc_wri_age                     ! Empty routine  
+   END SUBROUTINE trc_wri_age
+#endif
+
+   !!----------------------------------------------------------------------
+   !! NEMO/TOP 3.3 , NEMO Consortium (2010)
+   !! $Id: trcwri_age.F90 3160 2011-11-20 14:27:18Z cetlod $ 
+   !! Software governed by the CeCILL licence (NEMOGCM/NEMO_CeCILL.txt)
+   !!======================================================================
+END MODULE trcwri_age
Index: branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/NEMO/TOP_SRC/C14/par_c14.F90
===================================================================
--- branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/NEMO/TOP_SRC/C14/par_c14.F90	(revision 7391)
+++ branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/NEMO/TOP_SRC/C14/par_c14.F90	(revision 7391)
@@ -0,0 +1,13 @@
+MODULE par_c14
+   !!======================================================================
+   !!                        ***  par_c14 ***
+   !! TOP :   set the C14 parameters
+   !!======================================================================
+   !! History :   2.0  !  2008-12  (C. Ethe, G. Madec)  revised architecture
+   !! History :        !  2015 (A.Mouchet) equilibrium + transient C14
+   !!----------------------------------------------------------------------
+
+   IMPLICIT NONE
+   INTEGER, PUBLIC ::  jp_c14    !: number of c14 tracer
+
+END MODULE par_c14
Index: branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/NEMO/TOP_SRC/C14/sms_c14.F90
===================================================================
--- branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/NEMO/TOP_SRC/C14/sms_c14.F90	(revision 7391)
+++ branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/NEMO/TOP_SRC/C14/sms_c14.F90	(revision 7391)
@@ -0,0 +1,75 @@
+MODULE sms_c14
+   !!======================================================================
+   !!                      ***  MODULE trcsms_c14  ***
+   !! TOP :  C14 main module
+   !!======================================================================
+   !! History     -   ! 1994-05 ( J. Orr ) original code
+   !!            1.0  ! 2006-02 ( J.M. Molines )  Free form + modularity
+   !!            2.0  ! 2008-12 ( C. Ethe ) reorganisation
+   !!            4.0  ! 2011-02 ( A.R. Porter, STFC Daresbury ) Dynamic memory
+   !!                 ! 2015    (A. Mouchet) general C14 + update formulas
+   !!----------------------------------------------------------------------
+   !!   sms_c14 :  compute and add C14 suface forcing to C14 trends
+   !!----------------------------------------------------------------------
+   USE par_oce
+   USE par_trc
+
+
+   IMPLICIT NONE
+   PUBLIC  
+
+
+   LOGICAL  :: ln_chemh                             ! Chemical enhancement (yes/no)
+   INTEGER  :: kc14typ                              ! C14 tracer type
+   REAL(wp) :: tyrc14_beg                           ! year start atmospheric scenario !! See below
+   REAL(wp) :: pco2at, rc14at                       ! atm co2, atm 14C ratio (global, reference)
+   REAL(wp) :: rc14init                             ! ocean 14C ratio for initialization
+   REAL(wp) :: xkwind, xdicsur                      ! wind coeff, ref DIC
+   REAL(wp) :: rlam14                               ! C14 decay  rate
+
+   !
+   CHARACTER (len=20)                           :: cfileco2, cfilec14  ! Name of atmospheric forcing files
+   !
+   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:)  ::   c14sbc   ! atmospheric c14 ratio
+   REAL(wp)                                     ::   co2sbc   ! atmospheric co2 pressure
+  
+   REAL(wp),  ALLOCATABLE, SAVE, DIMENSION(:,:) ::   exch_c14   ! exch. vel. for C14/C
+   REAL(wp),  ALLOCATABLE, SAVE, DIMENSION(:,:) ::   exch_co2   ! CO2 invasion rate
+   REAL(wp),  ALLOCATABLE, SAVE, DIMENSION(:,:) ::   qtr_c14    ! flux at surface
+   REAL(wp),  ALLOCATABLE, SAVE, DIMENSION(:,:) ::   qint_c14   ! cumulative flux
+
+   INTEGER , PARAMETER                          ::   nc14zon     = 3  ! number of zones for bomb c14
+   !
+   INTEGER                                       ::   nrecco2, nrecc14  ! nb record atm co2 & cc14
+   REAL(wp)                                      ::   tyrc14_now ! current yr for transient experiment relative to tyrc14_beg
+   INTEGER                                       ::   m1_co2, m1_c14  ! index of first co2 and c14 records to consider
+   INTEGER                                       ::   m2_co2, m2_c14  ! index of second co2 and c14 records to consider
+   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:)   ::   bomb       ! C14 atm data (bomb - 3 zones)
+   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:)     ::   atmc14     ! C14 atm data (paleo - 1 zone)
+   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:)     ::   tyrc14     ! Time (yr) atmospheric C14 data
+   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::   fareaz     ! Spatial Interpolation Factors
+   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:)     ::   spco2      ! Atmospheric CO2
+   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:)     ::   tyrco2     ! Time (yr) atmospheric CO2 data
+
+   !!----------------------------------------------------------------------
+   !! NEMO/TOP 3.3 , NEMO Consortium (2010)
+   !! $                                                                    $ 
+   !! Software governed by the CeCILL licence     (NEMOGCM/NEMO_CeCILL.txt)
+   !!----------------------------------------------------------------------
+CONTAINS
+
+
+   INTEGER FUNCTION sms_c14_alloc()
+      !!----------------------------------------------------------------------
+      !!                  ***  ROUTINE trc_sms_c14_alloc  ***
+      !!----------------------------------------------------------------------
+      sms_c14_alloc = 0
+      ALLOCATE( exch_c14(jpi,jpj)        ,  exch_co2(jpi,jpj)        ,   &
+         &      qtr_c14(jpi,jpj)         ,  qint_c14(jpi,jpj)        ,   &
+         &      c14sbc(jpi,jpj)          ,  STAT = sms_c14_alloc )
+         !
+      !
+   END FUNCTION sms_c14_alloc
+
+  !!======================================================================
+END MODULE sms_c14
Index: branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/NEMO/TOP_SRC/C14/trcatm_c14.F90
===================================================================
--- branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/NEMO/TOP_SRC/C14/trcatm_c14.F90	(revision 7391)
+++ branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/NEMO/TOP_SRC/C14/trcatm_c14.F90	(revision 7391)
@@ -0,0 +1,304 @@
+MODULE trcatm_c14
+   !!======================================================================
+   !!                     ***  MODULE  trcatm_c14  ***
+   !! TOP :  read and manages atmospheric values for radiocarbon model  
+   !!=====================================================================
+   !! History: Based on trcini_c14b & trcsms_c14b : 
+   !!          Anne Mouchet
+   !!----------------------------------------------------------------------
+   !!   trc_atm_c14_ini  : initialize c14atm & pco2atm
+   !!   trc_atm_c14      : read and time interpolate  c14atm & pco2atm
+   !!----------------------------------------------------------------------
+   USE par_trc       !  passive tracers parameters
+   USE oce_trc       !  shared variables between ocean and passive tracers
+   USE trc           !  passive tracers common variables
+   USE sms_c14    ! c14 simulation type, atm default values...
+
+   IMPLICIT NONE
+   PRIVATE
+
+   PUBLIC   trc_atm_c14         ! called in trcsms_c14.F90
+   PUBLIC   trc_atm_c14_ini     ! called in trcini_c14.F90
+   !
+   !!----------------------------------------------------------------------
+   !! NEMO/OPA 3.3 , NEMO Consortium (2010)
+   !! $Id: trcatm_c14.F90 .... $ 
+   !! Software governed by the CeCILL licence     (NEMOGCM/NEMO_CeCILL.txt)
+   !!----------------------------------------------------------------------
+CONTAINS
+
+   SUBROUTINE trc_atm_c14_ini
+      !!----------------------------------------------------------------------
+      !!                   ***  ROUTINE trc_c14_ini  ***
+      !!                    
+      !! ** Purpose :   initialisation of sbc for radiocarbon
+      !! 
+      !! ** Method  : 
+      !!----------------------------------------------------------------------
+      !
+      CHARACTER (len=20)        :: clfile                        ! forcing file name
+      INTEGER                   :: ji,jj,jn                        ! dummy loop indice
+      INTEGER                   :: ierr1,ierr2,ierr3,izco2         ! temporary integers
+      INTEGER                   :: inum1,inum2,incom,iyear         ! temporary integers
+      REAL(wp) ::   ys40 = -40.     ! 40 degrees south
+      REAL(wp) ::   ys20 = -20.     ! 20 degrees south
+      REAL(wp) ::   yn20 =  20.     ! 20 degrees north
+      REAL(wp) ::   yn40 =  40.     ! 40 degrees north
+      REAL(wp), POINTER, DIMENSION(:)   :: zco2, zyrco2  ! temporary arrays for swap
+      !
+      !!----------------------------------------------------------------------
+      !
+      IF( nn_timing == 1 )  CALL timing_start('trc_atm_c14_ini')
+      !
+      
+      IF( lwp ) WRITE(numout,*) ' '
+      IF( lwp ) WRITE(numout,*) ' trc_atm_c14_ini : initialize atm CO2 & C14-ratio '
+      IF( lwp ) WRITE(numout,*) ' '
+      !
+      tyrc14_now = 0._wp   ! initialize
+      !
+      IF(kc14typ >= 1) THEN  ! Transient atmospheric forcing: CO2
+      !
+         clfile = TRIM( cfileco2 )
+         IF(lwp) WRITE(numout,*) 'Read CO2 atmospheric concentrations file ',clfile
+         CALL ctl_opn( inum1, clfile, 'OLD', 'FORMATTED', 'SEQUENTIAL', -1, numout, .FALSE. )
+         REWIND(inum1)
+      
+         READ(inum1,*) nrecco2,incom
+         DO jn = 1, incom        ! Skip over descriptor lines
+            READ(inum1,'(1x)')
+         END DO
+         ALLOCATE( spco2(nrecco2), tyrco2(nrecco2)       , STAT=ierr1 )
+         IF( ierr1 /= 0 )   CALL ctl_stop( 'STOP', 'trc_atm_c14_ini: unable to allocate co2 arrays' )
+      ! get  CO2 data
+         DO jn = 1, nrecco2
+            READ(inum1, *)  tyrco2(jn), spco2(jn)
+         END DO
+         CLOSE(inum1)
+      !
+         IF(kc14typ==2) THEN
+            CALL wrk_alloc( nrecco2,zco2)
+            CALL wrk_alloc( nrecco2,zyrco2)
+            zco2(:)=spco2(:)
+            zyrco2(:)=tyrco2(:)
+      ! Set CO2 times on AD time scale & swap records : In CO2 file : youngest first
+            DO jn = 1, nrecco2
+               izco2=nrecco2-jn+1
+               spco2(izco2)=zco2(jn)
+               tyrco2(izco2)=1950._wp-zyrco2(jn)         ! BP to AD dates
+            END DO
+            CALL wrk_dealloc(nrecco2,zco2)
+            CALL wrk_dealloc(nrecco2,zyrco2)
+         ENDIF
+      !
+      !        ! Transient atmospheric forcing: Bomb C14 & Paleo C14 : open file
+      !
+         clfile = TRIM( cfilec14 )
+         IF (lwp) WRITE(numout,*) 'Read C-14 atmospheric concentrations file ',clfile
+         CALL ctl_opn( inum2, clfile, 'OLD', 'FORMATTED', 'SEQUENTIAL', -1, numout, .FALSE. )
+         REWIND(inum2)
+      !
+      ! Bomb C14: 3 zones for atm C14 !
+         IF(kc14typ == 1) THEN  ! Transient atmospheric forcing: Bomb C14
+      ! 
+            READ(inum2,*) nrecc14,incom
+            DO jn = 1, incom        ! Skip over descriptor lines
+               READ(inum2,'(1x)')
+            END DO
+            ALLOCATE( bomb(nrecc14,nc14zon), tyrc14(nrecc14)       , STAT=ierr2 )
+            IF( ierr2 /= 0 )   CALL ctl_stop( 'STOP', 'trc_atm_c14_ini: unable to allocate c14 arrays' )
+      ! get bomb c14 data
+            DO jn = 1, nrecc14
+               READ(inum2,*) tyrc14(jn), bomb(jn,1), bomb(jn,2), bomb(jn,3)
+            END DO
+            CLOSE(inum2)
+
+       ! Linear  interpolation of the C-14 source fonction
+       ! in linear latitude bands  (20N,40N) and (20S,40S)
+       !------------------------------------------------------
+            ALLOCATE( fareaz  (jpi,jpj ,nc14zon) , STAT=ierr3 )
+            IF( ierr3 /= 0 )   CALL ctl_stop( 'STOP', 'trc_atm_c14_ini: unable to allocate fareaz' )
+      !
+            DO jj = 1 , jpj                       ! from C14b package
+              DO ji = 1 , jpi
+                 IF( gphit(ji,jj) >= yn40 ) THEN
+                    fareaz(ji,jj,1) = 0.
+                    fareaz(ji,jj,2) = 0.
+                    fareaz(ji,jj,3) = 1.
+                 ELSE IF( gphit(ji,jj ) <= ys40) THEN
+                    fareaz(ji,jj,1) = 1.
+                    fareaz(ji,jj,2) = 0.
+                    fareaz(ji,jj,3) = 0.
+                 ELSE IF( gphit(ji,jj) >= yn20 ) THEN
+                    fareaz(ji,jj,1) = 0.
+                    fareaz(ji,jj,2) = 2. * ( 1. - gphit(ji,jj) / yn40 )
+                    fareaz(ji,jj,3) = 2. * gphit(ji,jj) / yn40 - 1.
+                 ELSE IF( gphit(ji,jj) <= ys20 ) THEN
+                    fareaz(ji,jj,1) = 2. * gphit(ji,jj) / ys40 - 1.
+                    fareaz(ji,jj,2) = 2. * ( 1. - gphit(ji,jj) / ys40 )
+                    fareaz(ji,jj,3) = 0.
+                 ELSE
+                    fareaz(ji,jj,1) = 0.
+                    fareaz(ji,jj,2) = 1.
+                    fareaz(ji,jj,3) = 0.
+                 ENDIF
+              END DO
+           END DO
+      !
+         ENDIF
+      !
+      ! Paleo C14: 1 zone for atm C14 !
+         IF(kc14typ == 2) THEN  ! Transient atmospheric forcing: Paleo C14
+      ! 
+            READ(inum2,*) nrecc14,incom
+            DO jn = 1, incom        ! Skip over descriptor lines
+               READ(inum2,'(1x)')
+            END DO
+            ALLOCATE( atmc14(nrecc14), tyrc14(nrecc14)       , STAT=ierr2 )
+            IF( ierr2 /= 0 )   CALL ctl_stop( 'STOP', 'trc_atm_c14_ini: unable to allocate c14 arrays' )
+      ! get past c14 data
+            DO jn = 1, nrecc14
+               READ(inum2,*) iyear,incom,incom,atmc14(jn)
+               tyrc14(jn)=1950._wp-REAL(iyear,wp)                ! BP to AD dates
+            END DO
+            CLOSE(inum2)
+      !
+         ENDIF
+      !
+      ! Note on dates: 
+      !   In files dates have dimension yr; either AD or BP; if BP date is changed into AD here
+      !   When dealing with dates previous to 0. AD one needs to set tyrc14_beg to the actual starting year
+      !   Do not forget to appropriately set nn_date0 and nn_rstctl in namelist
+      !                           AND        nn_rsttr in namelist_top  if offline run
+      !   All details are given in NEMO-C14.pdf report
+      !  
+         tyrc14_now=nyear                                ! actual initial yr - Bomb 
+         if(kc14typ == 2) tyrc14_now=nyear+tyrc14_beg-1  ! actual initial yr - Paleo
+      !                                     ! we suppose we start on tyrc14_now/01/01 @ 0h
+         m1_c14= 1
+         m1_co2= 1
+         DO jn = 1,nrecco2
+            IF ( tyrc14_now >= tyrco2(jn) ) m1_co2 = jn  ! index of first co2 record to consider
+         END DO
+         DO jn = 1,nrecc14
+            IF ( tyrc14_now >= tyrc14(jn) ) m1_c14 = jn  ! index of first c14 record to consider
+         END DO
+         IF (lwp) WRITE(numout,*) 'Initial yr for experiment', tyrc14_now
+         IF (lwp) WRITE(numout,*) '   CO2 & C14 start years:', tyrco2(m1_co2),tyrc14(m1_c14)
+      !
+         m2_c14= m1_c14
+         m2_co2= m1_co2
+      !
+      ENDIF
+      !
+      IF( nn_timing == 1 )  CALL timing_stop('trc_atm_c14_ini')
+      !
+   END SUBROUTINE trc_atm_c14_ini
+
+
+   SUBROUTINE trc_atm_c14( kt, co2sbc, c14sbc )
+      !!----------------------------------------------------------------------
+      !!                   ***  ROUTINE trc_flx  ***
+      !!                    
+      !! ** Purpose :   provides sbc for co2 & c14 at kt
+      !! 
+      !! ** Method  :  read files
+      !!
+      !! ** Action  :   atmospheric values interpolated at time-step kt
+      !!----------------------------------------------------------------------
+      INTEGER                 , INTENT(in   )   ::   kt       ! ocean time-step
+      REAL(wp), DIMENSION(:,:), INTENT(  out)   ::   c14sbc   ! atm c14 ratio
+      REAL(wp),                 INTENT(  out)   ::   co2sbc   ! atm co2 p
+      INTEGER                                   ::   jz       ! dummy loop indice
+      REAL(wp)                              ::   zdint,zint   ! work
+      REAL(wp), DIMENSION(nc14zon)              ::   zonbc14  ! work
+      !
+      !!----------------------------------------------------------------------
+      !
+      IF( nn_timing == 1 )  CALL timing_start('trc_atm_c14')
+      !
+      IF( kc14typ == 0) THEN
+         co2sbc=pco2at
+         c14sbc(:,:)=rc14at
+      ENDIF
+      !
+      IF(kc14typ >= 1) THEN  ! Transient C14 & CO2
+      !
+         tyrc14_now = tyrc14_now + ( rdt / ( rday * nyear_len(1)) )    !  current time step in yr relative to tyrc14_beg
+      !
+      ! CO2 --------------------------------------------------------
+      !
+      ! time interpolation of CO2 concentrations     ! if out of record keeps first/last value
+         IF( tyrc14_now > tyrco2(m2_co2) ) THEN     ! next interval
+           m1_co2 = m2_co2
+           m2_co2 = MIN ( m2_co2 + 1 , nrecco2 )
+         ENDIF
+      !
+         zdint  = tyrco2(m2_co2) - tyrco2(m1_co2)
+         co2sbc = spco2(m2_co2)                        ! if out of record keeps first/last value
+         zint = 0._wp
+         IF ( zdint > 0._wp ) THEN                     ! if within record interpolate:
+            zint = ( tyrco2(m2_co2) - tyrc14_now ) / zdint
+            co2sbc = spco2(m2_co2) + zint * ( spco2(m1_co2) - spco2(m2_co2) )
+         ENDIF
+      !
+         IF( lwp .AND.  kt == nitend )  THEN
+            WRITE(numout, '(3(A,F12.4))') 't1/tn/t2:',tyrco2(m1_co2),'/', tyrc14_now,'/',tyrco2(m2_co2)
+            WRITE(numout, *) 'CO2:',spco2(m1_co2),co2sbc ,spco2(m2_co2)
+         ENDIF
+      !
+      ! C14 --------------------------------------------------------
+      !
+      ! time interpolation of C14 concentrations 
+         IF ( tyrc14_now > tyrc14(m2_c14) ) THEN     ! next interval
+           m1_c14 = m2_c14
+           m2_c14 = MIN ( m2_c14 + 1 , nrecc14 )
+         ENDIF
+         zdint = tyrc14(m2_c14) - tyrc14(m1_c14)
+         zint=0._wp
+         IF ( zdint > 0._wp ) zint = ( tyrc14(m2_c14) - tyrc14_now ) / zdint ! if  within record
+         IF( lwp .AND.  kt == nitend )  &
+            &     WRITE(numout,'(3(A,F12.4))') 't1/tn/t2:',tyrc14(m1_c14),'/', tyrc14_now,'/',tyrc14(m2_c14)
+      !
+      ! ------- Bomb C14  ------------------------------------------
+      !
+         IF( kc14typ == 1) THEN
+      !                                          ! time interpolation
+          zonbc14(:) = bomb(m2_c14,:)                ! if out of record keeps first/last value
+      !                                          !    if within record interpolate:
+          IF ( zdint > 0._wp ) zonbc14(:) = bomb(m2_c14,:) + zint * ( bomb(m1_c14,:)  - bomb(m2_c14,:)  )
+      ! 
+            IF(lwp .AND.  kt == nitend )  &
+                 &      WRITE(numout, *)  'C14:',bomb(m1_c14,1),zonbc14(1),bomb(m2_c14,1)
+      !   Transform DeltaC14 --> C14 ratio
+            zonbc14(:) = 1._wp + zonbc14(:)/1.d03
+      !
+      !  For each (i,j)-box, with information from the fractional area
+      !  (zonmean), computes area-weighted mean to give the atmospheric C-14
+      !  ----------------------------------------------------------------
+            c14sbc(:,:) = zonbc14(1) * fareaz(:,:,1)   &
+               &          + zonbc14(2) * fareaz(:,:,2)   &
+               &          + zonbc14(3) * fareaz(:,:,3)
+         ENDIF
+      !
+      ! ------- Paleo C14  -----------------------------------------
+      !
+         IF( kc14typ == 2 ) THEN
+      !                                          ! time interpolation
+            zonbc14(1) = atmc14(m2_c14)          ! if out of record keeps first/last value
+         !                                       !    if within record interpolate:
+            IF ( zdint > 0._wp ) zonbc14(1) = atmc14(m2_c14) + zint * ( atmc14(m1_c14) - atmc14(m2_c14) )
+            IF(lwp .AND.  kt == nitend )  &
+                 &      WRITE(numout, *)  'C14: ',atmc14(m1_c14),zonbc14(1),atmc14(m2_c14)
+      !   Transform DeltaC14 --> C14 ratio
+            c14sbc(:,:) = 1._wp + zonbc14(1)/1.d03
+         ENDIF
+      !
+      ENDIF
+      !
+      IF( nn_timing == 1 )  CALL timing_stop('trc_atm_c14')
+      !
+   END SUBROUTINE trc_atm_c14
+
+   !!======================================================================
+END MODULE trcatm_c14
Index: branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/NEMO/TOP_SRC/C14/trcice_c14.F90
===================================================================
--- branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/NEMO/TOP_SRC/C14/trcice_c14.F90	(revision 7391)
+++ branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/NEMO/TOP_SRC/C14/trcice_c14.F90	(revision 7391)
@@ -0,0 +1,31 @@
+MODULE trcice_c14
+   !!======================================================================
+   !!                         ***  MODULE trcice_c14  ***
+   !!======================================================================
+   USE par_trc         ! TOP parameters
+   USE oce_trc         ! Ocean variables
+   USE trc             ! TOP variables
+
+   IMPLICIT NONE
+   PRIVATE
+
+   PUBLIC   trc_ice_ini_c14       ! called by trcice.F90 module
+
+   !!----------------------------------------------------------------------
+   !! NEMO/TOP 3.3 , NEMO Consortium (2010)
+   !! $Id: trcice_c14b.F90 4990 2014-12-15 16:42:49Z timgraham $
+   !! Software governed by the CeCILL licence     (NEMOGCM/NEMO_CeCILL.txt)
+   !!----------------------------------------------------------------------
+CONTAINS
+
+   SUBROUTINE trc_ice_ini_c14
+      !!----------------------------------------------------------------------
+      !!                     ***  trc_ice_c14b  ***
+      !!
+      !!----------------------------------------------------------------------
+      !
+      !
+   END SUBROUTINE trc_ice_ini_c14
+
+   !!======================================================================
+END MODULE trcice_c14
Index: branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/NEMO/TOP_SRC/C14/trcini_c14.F90
===================================================================
--- branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/NEMO/TOP_SRC/C14/trcini_c14.F90	(revision 7391)
+++ branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/NEMO/TOP_SRC/C14/trcini_c14.F90	(revision 7391)
@@ -0,0 +1,97 @@
+MODULE trcini_c14
+   !!======================================================================
+   !!                         ***  MODULE trcini_c14  ***
+   !! TOP :   initialisation of the C14 tracers
+   !!======================================================================
+   !! History :   2.0  !  2007-12  (C. Ethe, G. Madec) Original code
+   !! History :   3.0  !  2015 (A. Mouchet) C14 Code
+   !!----------------------------------------------------------------------
+   !! trc_ini_c14   : C14 model initialisation
+   !!----------------------------------------------------------------------
+   USE par_trc         ! TOP parameters
+   USE oce_trc
+   USE trc
+   USE sms_c14
+   USE trcatm_c14
+   USE trcnam_c14
+   USE iom
+
+   IMPLICIT NONE
+   PRIVATE
+
+   PUBLIC   trc_ini_c14   ! called by trcini.F90 module
+   
+   !
+
+   !!----------------------------------------------------------------------
+   !! NEMO/TOP 3.3 , NEMO Consortium (2010)
+   !! $Id:               $ 
+   !! Software governed by the CeCILL licence     (NEMOGCM/NEMO_CeCILL.txt)
+   !!----------------------------------------------------------------------
+CONTAINS
+
+   SUBROUTINE trc_ini_c14
+      !!----------------------------------------------------------------------
+      !!                     ***  trc_ini_c14  ***  
+      !!
+      !! ** Purpose :   initialization for C14 model
+      !!
+      !! ** Method  : 
+      !!----------------------------------------------------------------------
+      !
+      REAL(wp) :: ztrai
+      INTEGER  :: jn
+      CHARACTER(len = 20)  ::  cltra
+      !!----------------------------------------------------------------------
+      !
+      CALL trc_nam_c14
+      !                       ! Allocate c14 arrays
+      IF( sms_c14_alloc() /= 0 )   CALL ctl_stop( 'STOP', 'trc_ini_c14: unable to allocate C14 arrays' )
+
+      IF(lwp) WRITE(numout,*)
+      IF(lwp) WRITE(numout,*) ' trc_ini_c14: initialisation of C14 model'
+      !
+      IF( .NOT. ln_rsttr )  THEN
+         !
+         IF(lwp) WRITE(numout,*) '                      ==>    PRESCRIBED initial VALUES'
+         IF(lwp) WRITE(numout,*) '                      ==>    Ocean C14/C :', rc14init 
+         !
+         trn(:,:,:,jp_c14) = rc14init * tmask(:,:,:)
+         !
+         qtr_c14(:,:) = 0._wp           ! Init of air-sea BC
+         !
+      ELSE
+
+        IF(lwp) WRITE(numout,*)
+        IF(lwp) WRITE(numout,*) ' trc_rst_read_c14 : Read specific variables for c14 model '
+        IF(lwp) WRITE(numout,*) ' ~~~~~~~~~~~~~~'
+        ! 
+        CALL iom_get( numrtr, 'co2sbc', co2sbc ) 
+        CALL iom_get( numrtr, jpdom_autoglo, 'c14sbc', c14sbc ) 
+        CALL iom_get( numrtr, jpdom_autoglo, 'exch_co2', exch_co2 ) 
+        CALL iom_get( numrtr, jpdom_autoglo, 'exch_c14', exch_c14 ) 
+        CALL iom_get( numrtr, jpdom_autoglo, 'qtr_c14', qtr_c14 )
+        !
+      END IF
+      !
+      IF( ( nn_rsttr == 0 ) .OR. ( .NOT. ln_rsttr ) ) THEN
+      !
+      !                         !  qint set to zero <=== Initial of transient
+      !                         !                   <=== Restart=false
+         IF(lwp) WRITE(numout,*) '                    ==>    qint reset to ZERO '
+         qint_c14(:,:) = 0._wp
+      !
+      ELSE
+        !
+        CALL iom_get( numrtr, jpdom_autoglo, 'qint_c14', qint_c14 ) 
+        !
+      ENDIF
+      !
+      CALL trc_atm_c14_ini   ! Init atm values
+      !
+      IF(lwp) WRITE(numout,*) ' ~~~~~~~~~~~~~~'
+      !
+   END SUBROUTINE trc_ini_c14
+
+   !!======================================================================
+END MODULE trcini_c14
Index: branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/NEMO/TOP_SRC/C14/trcnam_c14.F90
===================================================================
--- branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/NEMO/TOP_SRC/C14/trcnam_c14.F90	(revision 7391)
+++ branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/NEMO/TOP_SRC/C14/trcnam_c14.F90	(revision 7391)
@@ -0,0 +1,120 @@
+MODULE trcnam_c14
+   !!======================================================================
+   !!                         ***  MODULE trcnam_c14  ***
+   !! TOP :   initialisation of some run parameters for C14 chemical model
+   !!======================================================================
+   !! History :   2.0  !  2007-12  (C. Ethe, G. Madec) from trcnam.cfc.h90
+   !! History :        !  2015 (A.Mouchet) equilibrium + transient C14
+   !!----------------------------------------------------------------------
+   !! trc_nam_c14      : C14 model initialisation
+   !!----------------------------------------------------------------------
+   USE oce_trc         ! Ocean variables
+   USE trc             ! TOP variables
+   USE sms_c14
+
+   IMPLICIT NONE
+   PRIVATE
+   !!
+   PUBLIC   trc_nam_c14   ! called by trcnam.F90 module
+   !!
+   !!----------------------------------------------------------------------
+   !! NEMO/TOP 3.3 , NEMO Consortium (2010)
+   !! $Id: trcnam_c14.F90                       $ 
+   !! Software governed by the CeCILL licence (NEMOGCM/NEMO_CeCILL.txt)
+   !!----------------------------------------------------------------------
+
+CONTAINS
+
+   SUBROUTINE trc_nam_c14
+      !!-------------------------------------------------------------------
+      !!                  ***  ROUTINE trc_nam_c14  ***
+      !!                 
+      !! ** Purpose :   Definition some run parameter for C14 model
+      !!
+      !! ** Method  :   Read the namc14 namelist and check the parameter 
+      !!       values called at the first timestep (nittrc000)
+      !!
+      !! ** input   :   Namelist namelist_c14
+      !!----------------------------------------------------------------------
+      INTEGER :: ios                 ! Local integer output status for namelist read
+      !! 
+      NAMELIST/namc14_typ/ kc14typ,rc14at, pco2at, rc14init   ! type of C14 tracer, default values of C14/C, pco2, & ocean r14
+      NAMELIST/namc14_sbc/ ln_chemh, xkwind, xdicsur          ! chem enh, wind coeff, ref DIC 
+      NAMELIST/namc14_fcg/ cfileco2, cfilec14, tyrc14_beg  ! for transient exps; atm forcing
+      !!-------------------------------------------------------------------
+      ! Variable setting
+      ctrcnm    (jp_c14) = 'RC14'
+      ctrcln    (jp_c14) = 'Radiocarbon ratio'
+      ctrcun    (jp_c14) = '-'
+      ln_trc_ini(jp_c14) = .false.
+      ln_trc_sbc(jp_c14) = .false.
+      ln_trc_cbc(jp_c14) = .false.
+      ln_trc_obc(jp_c14) = .false.
+      !
+      REWIND( numtrc_ref )              ! Namelist namc14_typ in reference namelist :
+      READ  ( numtrc_ref, namc14_typ, IOSTAT = ios, ERR = 901)
+901   IF( ios /= 0 ) CALL ctl_nam ( ios , 'namc14_typ in reference namelist', lwp )
+
+      REWIND( numtrc_cfg )              ! Namelist namcfcdate in configuration namelist 
+      READ  ( numtrc_cfg, namc14_typ, IOSTAT = ios, ERR = 902)
+902   IF( ios /= 0 ) CALL ctl_nam ( ios , 'namc14_typ in configuration namelist', lwp )
+      IF(lwm) WRITE ( numonr, namc14_typ )
+
+      IF(lwp) THEN                  ! control print
+         WRITE(numout,*) ' '
+         WRITE(numout,*) ' Radiocarbon C14'
+         WRITE(numout,*) ' '
+         WRITE(numout,*) ' Namelist namc14_typ'
+         WRITE(numout,*)
+         WRITE(numout,*) ' Type of C14 tracer (0=equilibrium; 1=bomb transient; 2=past transient) kc14typ = ', kc14typ
+         WRITE(numout,*) ' Default value for atmospheric C14/C (used for equil run)               rc14at  = ', rc14at
+         WRITE(numout,*) ' Default value for atmospheric pcO2 [atm] (used for equil run)          pco2at  = ', pco2at
+         WRITE(numout,*) ' Default value for initial C14/C in the ocean (used for equil run)      rc14init= ', rc14init
+         WRITE(numout,*) '  '
+      ENDIF
+
+      REWIND( numtrc_ref )              ! Namelist namc14_typ in reference namelist :
+      READ  ( numtrc_ref, namc14_sbc, IOSTAT = ios, ERR = 903)
+903   IF( ios /= 0 ) CALL ctl_nam ( ios , 'namc14_sbc in reference namelist', lwp )
+
+      REWIND( numtrc_cfg )              ! Namelist namcfcdate in configuration namelist 
+      READ  ( numtrc_cfg, namc14_sbc, IOSTAT = ios, ERR = 904)
+904   IF( ios /= 0 ) CALL ctl_nam ( ios , 'namc14_sbc in configuration namelist', lwp )
+      IF(lwm) WRITE ( numonr, namc14_sbc )
+
+      IF(lwp) THEN                  ! control print
+         WRITE(numout,*) ' Namelist namc14_sbc'
+         WRITE(numout,*)
+         WRITE(numout,*) ' Chemical enhancement in piston velocity   ln_chemh = ', ln_chemh
+         WRITE(numout,*) ' Coefficient for gas exchange velocity     xkwind   = ', xkwind
+         WRITE(numout,*) ' Reference DIC concentration (mol/m3)      xdicsur  = ', xdicsur
+         WRITE(numout,*) '  '
+      ENDIF
+
+      REWIND( numtrc_ref )              ! Namelist namc14_typ in reference namelist :
+      READ  ( numtrc_ref, namc14_fcg, IOSTAT = ios, ERR = 905)
+905   IF( ios /= 0 ) CALL ctl_nam ( ios , 'namc14_fcg in reference namelist', lwp )
+
+      REWIND( numtrc_cfg )              ! Namelist namcfcdate in configuration namelist 
+      READ  ( numtrc_cfg, namc14_fcg, IOSTAT = ios, ERR = 906)
+906   IF( ios /= 0 ) CALL ctl_nam ( ios , 'namc14_fcg in configuration namelist', lwp )
+      IF(lwm) WRITE ( numonr, namc14_fcg )
+
+      IF(lwp) THEN                  ! control print
+         WRITE(numout,*) ' Namelist namc14_fcg'
+         WRITE(numout,*)
+         WRITE(numout,*) ' Atmospheric co2 file ( bomb )  cfileco2   = ', TRIM( cfileco2 )
+         WRITE(numout,*) ' Atmospheric c14 file ( bomb )  cfilec14   = ', TRIM( cfilec14 )
+         WRITE(numout,*) ' Starting year of experiment    tyrc14_beg = ', tyrc14_beg
+         WRITE(numout,*) '  '
+      ENDIF
+
+      !
+      IF( kc14typ == 2)    tyrc14_beg = 1950._wp - tyrc14_beg  ! BP to AD dates
+      ! set units 
+      rlam14 = LOG(2._wp) / 5730._wp / rsiyea    ! C14 decay  rate: yr^-1 --> s^-1
+      !                                          ! radiocarbon half-life is 5730 yr
+   END SUBROUTINE trc_nam_c14
+   
+   !!======================================================================
+END MODULE trcnam_c14
Index: branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/NEMO/TOP_SRC/C14/trcsms_c14.F90
===================================================================
--- branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/NEMO/TOP_SRC/C14/trcsms_c14.F90	(revision 7391)
+++ branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/NEMO/TOP_SRC/C14/trcsms_c14.F90	(revision 7391)
@@ -0,0 +1,169 @@
+MODULE trcsms_c14
+   !!======================================================================
+   !!                      ***  MODULE trcsms_c14  ***
+   !! TOP : Bomb C14 main module
+   !!======================================================================
+   !! History     -   ! 1994-05 ( J. Orr ) original code
+   !!            1.0  ! 2006-02 ( J.M. Molines )  Free form + modularity
+   !!            2.0  ! 2008-12 ( C. Ethe ) reorganisation
+   !!            4.0  ! 2011-02 ( A.R. Porter, STFC Daresbury ) Dynamic memory
+   !!                 ! 2015    (A. Mouchet) general C14 + update formulas
+   !!----------------------------------------------------------------------
+   !!   trc_sms_c14 :  compute and add C14 suface forcing to C14 trends
+   !!----------------------------------------------------------------------
+   USE oce_trc       ! Ocean variables
+   USE par_trc       ! TOP parameters
+   USE trc           ! TOP variables
+   USE trd_oce    ! trends
+   USE trdtrc    ! trends
+   USE sms_c14    ! atmospheric forcing
+   USE trcatm_c14    ! atmospheric forcing
+   USE iom
+
+   IMPLICIT NONE
+   PRIVATE
+
+   PUBLIC   trc_sms_c14       ! called in trcsms.F90
+
+   !!----------------------------------------------------------------------
+   !! NEMO/TOP 3.3 , NEMO Consortium (2010)
+   !! $                                                                    $ 
+   !! Software governed by the CeCILL licence     (NEMOGCM/NEMO_CeCILL.txt)
+   !!----------------------------------------------------------------------
+CONTAINS
+
+   SUBROUTINE trc_sms_c14( kt )
+      !!----------------------------------------------------------------------
+      !!                  ***  ROUTINE trc_sms_c14  ***
+      !!
+      !! ** Purpose :   Compute the surface boundary contition on C14
+      !!      passive tracer associated with air-sea fluxes and add it to 
+      !!      the general trend of tracers equations.
+      !
+      !    Method: 
+      !          - transport the ratio C14/C as in Toggweiler et al. (JGR,1989)
+      !          - if on-line a passive tracer (jpcref; NO sms) allows compensating for
+      !            freshwater fluxes which should not impact the C14/C ratio
+      !
+      !        =>   Delta-C14= ( trn(...jp_c14) -1)*1000.
+      !!
+      !!----------------------------------------------------------------------
+      !
+      INTEGER, INTENT(in) ::   kt    ! ocean time-step index
+      !
+      INTEGER  :: ji, jj, jk         ! dummy loop indices 
+      REAL(wp) :: zt, ztp, zsk      ! dummy variables
+      REAL(wp) :: zsol              ! solubility
+      REAL(wp) :: zsch              ! schmidt number
+      REAL(wp) :: zv2               ! wind speed ( square)
+      REAL(wp) :: zpv               ! piston velocity
+      !!----------------------------------------------------------------------
+      !
+      IF( nn_timing == 1 )  CALL timing_start('trc_sms_c14')
+      !
+      IF( kt ==  nittrc000 ) THEN
+         IF(lwp) WRITE(numout,*)
+         IF(lwp) WRITE(numout,*) ' trc_sms_c14:  C14 model'
+         IF(lwp) WRITE(numout,*) ' ~~~~~~~~~~~~~~'
+      ENDIF
+      !
+ 
+      ! Get co2sbc & c14sbc(ji,jj): at 1st iter for all, at each time step for transient
+      IF( kc14typ >= 1 .OR.  kt ==  nittrc000 )   CALL trc_atm_c14( kt, co2sbc, c14sbc ) 
+
+      ! -------------------------------------------------------------------
+      !  Gas exchange coefficient (Wanninkhof, 1992, JGR, 97,7373-7382)
+      !  Schmidt number of CO2 in seawater (Wanninkhof, 1992 & 2014)
+      !  CO2 solubility (Weiss, 1974; Wanninkhof, 2014) 
+      ! -------------------------------------------------------------------
+
+      DO jj = 1, jpj
+         DO ji = 1, jpi  
+            IF( tmask(ji,jj,1) >  0.) THEN
+
+               zt   = MIN( 40., tsn(ji,jj,1,jp_tem))
+
+               !  Computation of solubility zsol in [mol/(L * atm)]
+               !   after Wanninkhof (2014) referencing Weiss (1974)
+               ztp  = ( zt + 273.16 ) * 0.01
+               zsk  = 0.027766 + ztp * ( -0.025888 + 0.0050578 * ztp )   ! [mol/(L * atm)]
+               zsol = EXP( -58.0931 + 90.5069 / ztp  + 22.2940 * LOG( ztp ) + zsk * tsn(ji,jj,1,jp_sal) )
+               ! convert solubilities [mol/(L * atm)] -> [mol/(m^3 * ppm)]
+               zsol = zsol * 1.e-03
+
+               ! Computes the Schmidt number of CO2 in seawater
+               !               Wanninkhof-2014
+               zsch = 2116.8 + zt * ( -136.25 + zt * (4.7353 + zt * (-0.092307 + 0.0007555 * zt ) ) )
+
+               ! Wanninkhof Piston velocity: zpv in units [m/s]
+               zv2 = xkwind * (wndm(ji,jj) * wndm(ji,jj))              ! wind speed module at T points
+               ! chemical enhancement (Wanninkhof & Knox, 1996)
+               IF( ln_chemh ) zv2 = zv2 + 2.5 * ( 0.5246 + zt * (0.016256 + 0.00049946  * zt ) )
+               zv2 = zv2/360000._wp                                    ! conversion cm/h -> m/s
+               !
+               zpv  = ( zv2 * SQRT( 660./ zsch ) ) * ( 1. - fr_i(ji,jj) ) * tmask(ji,jj,1)
+
+               ! CO2 piston velocity (m/s)
+               exch_co2(ji,jj)= zpv
+               ! CO2 invasion rate (mol/ppm/m2/s) = 1st part of 14C/C exchange velocity
+               exch_c14(ji,jj)= zpv * zsol
+            ELSE
+               exch_co2(ji,jj) = 0._wp
+               exch_c14(ji,jj) = 0._wp
+            ENDIF
+         END DO
+      END DO
+
+      ! Exchange velocity for 14C/C ratio (m/s)
+      zt = co2sbc / xdicsur
+      exch_c14(:,:) = zt * exch_c14(:,:)
+      !
+      ! Flux of C-14 from air-to-sea; units: (C14/C ratio) x m/s
+      !                               already masked
+      qtr_c14(:,:) = exch_c14(:,:) * ( c14sbc(:,:) - trb(:,:,1,jp_c14) )
+            
+      ! cumulation of air-to-sea flux at each time step
+      qint_c14(:,:) = qint_c14(:,:) + qtr_c14(:,:) * rdttrc
+      !
+      ! Add the surface flux to the trend of jp_c14
+      DO jj = 1, jpj
+         DO ji = 1, jpi
+            tra(ji,jj,1,jp_c14) = tra(ji,jj,1,jp_c14) + qtr_c14(ji,jj) / e3t_n(ji,jj,1) 
+         END DO
+      END DO
+      !
+      ! Computation of decay effects on jp_c14
+      DO jk = 1, jpk
+         DO jj = 1, jpj
+            DO ji = 1, jpi
+               !
+               tra(ji,jj,jk,jp_c14) = tra(ji,jj,jk,jp_c14) - rlam14 * trb(ji,jj,jk,jp_c14) * tmask(ji,jj,jk) 
+               !
+            END DO
+         END DO
+      END DO
+
+      !
+      IF( lrst_trc ) THEN
+         IF(lwp) WRITE(numout,*)
+         IF(lwp) WRITE(numout,*) ' trc_rst_wri_c14 : Write specific variables from c14 model '
+         IF(lwp) WRITE(numout,*) ' ~~~~~~~~~~~~~~'
+      !
+         CALL iom_rstput( kt, nitrst, numrtw, 'co2sbc', co2sbc )       ! These five need      &
+         CALL iom_rstput( kt, nitrst, numrtw, 'c14sbc', c14sbc )     ! &    to be written   &
+         CALL iom_rstput( kt, nitrst, numrtw, 'exch_co2', exch_co2 ) ! &    for temporal    &
+         CALL iom_rstput( kt, nitrst, numrtw, 'exch_c14', exch_c14 ) ! &    averages        &
+         CALL iom_rstput( kt, nitrst, numrtw, 'qtr_c14', qtr_c14 )   ! &    to be coherent.
+         CALL iom_rstput( kt, nitrst, numrtw, 'qint_c14', qint_c14 ) ! Cumulative
+      !
+      ENDIF
+
+      IF( l_trdtrc )  CALL trd_trc( tra(:,:,:,jp_c14), 1, jptra_sms, kt )   ! save trends
+      !
+      IF( nn_timing == 1 )  CALL timing_stop('trc_sms_c14')
+      !
+   END SUBROUTINE trc_sms_c14
+
+
+  !!======================================================================
+END MODULE trcsms_c14
Index: branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/NEMO/TOP_SRC/C14/trcwri_c14.F90
===================================================================
--- branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/NEMO/TOP_SRC/C14/trcwri_c14.F90	(revision 7391)
+++ branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/NEMO/TOP_SRC/C14/trcwri_c14.F90	(revision 7391)
@@ -0,0 +1,138 @@
+MODULE trcwri_c14
+   !!======================================================================
+   !!                       *** MODULE trcwri ***
+   !!    MY_SRC :   Additional outputs for C14 tracers
+   !!======================================================================
+   !! History :   1.0  !  2009-05 (C. Ethe)  Original code
+   !! History :   2.0  !  2015 (A. Mouchet)  adapted code for C14
+   !!----------------------------------------------------------------------
+#if defined key_top && defined key_iomput
+   !!----------------------------------------------------------------------
+   !! trc_wri_c14   :  outputs of ventilation fields
+   !!----------------------------------------------------------------------
+   USE oce_trc       ! Ocean variables
+   USE trc         ! passive tracers common variables 
+   USE iom         ! I/O manager 
+   USE sms_c14
+
+   IMPLICIT NONE
+   PRIVATE
+
+   PUBLIC trc_wri_c14
+   !
+   !   Standard ratio: 1.176E-12 ; Avogadro's nbr = 6.022E+23 at/mol ; bomb C14 traditionally reported as 1.E+26 atoms
+   REAL(wp), PARAMETER  :: atomc14 = 1.176 * 6.022E-15   ! conversion factor 
+
+
+CONTAINS
+
+   SUBROUTINE trc_wri_c14
+      !!---------------------------------------------------------------------
+      !!                     ***  ROUTINE trc_wri_c14  ***
+      !!
+      !! ** Purpose :   output additional C14 tracers fields 
+      !!---------------------------------------------------------------------
+      CHARACTER (len=20)   :: cltra         ! short title for tracer
+      INTEGER              :: ji,jj,jk,jn   ! dummy loop indexes
+      REAL(wp)             :: zage,zarea,ztemp   ! temporary
+      REAL(wp), POINTER, DIMENSION(:,:)   :: zres, z2d ! temporary storage 2D
+      REAL(wp), POINTER, DIMENSION(:,:,:) :: z3d , zz3d ! temporary storage 3D
+      !!---------------------------------------------------------------------
+ 
+      ! write the tracer concentrations in the file
+      ! ---------------------------------------
+      cltra = TRIM( ctrcnm(jp_c14) )                  ! short title for tracer
+      CALL iom_put( cltra, trn(:,:,:,jp_c14) )
+
+      ! compute and write the tracer diagnostic in the file
+      ! ---------------------------------------
+      
+      IF( iom_use("DeltaC14") .OR. iom_use("C14Age") .OR. iom_use("RAge")   ) THEN
+         !
+         CALL wrk_alloc( jpi, jpj     , z2d, zres )
+         CALL wrk_alloc( jpi, jpj, jpk, z3d, zz3d )
+         !
+         zage = -1._wp / rlam14 / rsiyea  ! factor for radioages in year
+         z3d(:,:,:)  = 1._wp
+         zz3d(:,:,:) = 0._wp
+         !
+         DO jk = 1, jpkm1
+            DO jj = 1, jpj
+               DO ji = 1, jpi
+                  IF( tmask(ji,jj,jk) > 0._wp) THEN
+                     z3d (ji,jj,jk) = trn(ji,jj,jk,jp_c14)
+                     zz3d(ji,jj,jk) = LOG( z3d(ji,jj,jk) )
+                  ENDIF
+               ENDDO
+            ENDDO
+         ENDDO
+         zres(:,:) = z3d(:,:,1)
+
+         ! Reservoir age [yr]
+         z2d(:,:) =0._wp
+         jk = 1
+         DO jj = 1, jpj
+            DO ji = 1, jpi
+               ztemp = zres(ji,jj) / c14sbc(ji,jj)
+               IF( ztemp > 0._wp .AND. tmask(ji,jj,jk) > 0._wp ) z2d(ji,jj) = LOG( ztemp )
+            ENDDO
+         ENDDO
+         !
+         z3d(:,:,:) = 1.d03 * ( z3d(:,:,:) - 1._wp )
+         CALL iom_put( "DeltaC14" , z3d(:,:,:)  )  ! Delta C14 [permil]
+         CALL iom_put( "C14Age"   , zage * zz3d(:,:,:) )            !  Radiocarbon age [yr]
+
+         CALL iom_put( "qtr_c14", rsiyea * qtr_c14(:,:)  )            !  Radiocarbon surf flux [./m2/yr]
+         CALL iom_put( "qint_c14" , qint_c14  )                       ! cumulative flux [./m2]
+         CALL iom_put( "RAge" , zage * z2d(:,:) )                     ! Reservoir age [yr]
+         !
+         CALL wrk_dealloc( jpi, jpj     , z2d, zres )
+         CALL wrk_dealloc( jpi, jpj, jpk, z3d, zz3d )
+         !
+      ENDIF
+      !
+      !  0-D fields
+      !
+      CALL iom_put( "AtmCO2", co2sbc )  !     global atmospheric CO2 [ppm]
+    
+      IF( iom_use("AtmC14") ) THEN
+         zarea = glob_sum( e1e2t(:,:) )           ! global ocean surface
+         ztemp = glob_sum( c14sbc(:,:) * e1e2t(:,:) )
+         ztemp = ( ztemp / zarea - 1._wp ) * 1000._wp
+         CALL iom_put( "AtmC14" , ztemp )   ! Global atmospheric DeltaC14 [permil]
+      ENDIF
+      IF( iom_use("K_C14") ) THEN
+         ztemp = glob_sum ( exch_c14(:,:) * e1e2t(:,:) )
+         ztemp = rsiyea * ztemp / zarea
+         CALL iom_put( "K_C14" , ztemp )   ! global mean exchange velocity for C14/C ratio [m/yr]
+      ENDIF
+      IF( iom_use("K_CO2") ) THEN
+         zarea = glob_sum( e1e2t(:,:) )           ! global ocean surface
+         ztemp = glob_sum ( exch_co2(:,:) * e1e2t(:,:) )
+         ztemp = 360000._wp * ztemp / zarea       ! cm/h units: directly comparable with literature
+         CALL iom_put( "K_CO2", ztemp )  !  global mean CO2 piston velocity [cm/hr]
+      ENDIF
+      IF( iom_use("C14Inv") ) THEN
+         ztemp = glob_sum( trn(:,:,:,jp_c14) * cvol(:,:,:) )
+         ztemp = atomc14 * xdicsur * ztemp
+         CALL iom_put( "C14Inv", ztemp )  !  Radiocarbon ocean inventory [10^26 atoms]
+      END IF
+      !
+   END SUBROUTINE trc_wri_c14
+
+#else
+   !!----------------------------------------------------------------------
+   !!  Dummy module :                                     No C14 tracer
+   !!----------------------------------------------------------------------
+   PUBLIC trc_wri_c14
+CONTAINS
+   SUBROUTINE trc_wri_c14                     ! Empty routine  
+   END SUBROUTINE trc_wri_c14
+#endif
+
+   !!----------------------------------------------------------------------
+   !! NEMO/TOP 3.3 , NEMO Consortium (2010)
+   !! $Id: trcwri_c14 
+   !! Software governed by the CeCILL licence (NEMOGCM/NEMO_CeCILL.txt)
+   !!======================================================================
+END MODULE trcwri_c14
Index: branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/NEMO/TOP_SRC/CFC/par_cfc.F90
===================================================================
--- branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/NEMO/TOP_SRC/CFC/par_cfc.F90	(revision 7383)
+++ branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/NEMO/TOP_SRC/CFC/par_cfc.F90	(revision 7391)
@@ -10,49 +10,7 @@
    !! Software governed by the CeCILL licence (NEMOGCM/NEMO_CeCILL.txt)
    !!----------------------------------------------------------------------
-   USE par_pisces , ONLY : jp_pisces       !: number of tracers in PISCES
-   USE par_pisces , ONLY : jp_pisces_2d    !: number of 2D diag in PISCES
-   USE par_pisces , ONLY : jp_pisces_3d    !: number of 3D diag in PISCES
-   USE par_pisces , ONLY : jp_pisces_trd   !: number of biological diag in PISCES
 
    IMPLICIT NONE
-
-   INTEGER, PARAMETER ::   jp_lc      =  jp_pisces     !: cumulative number of passive tracers
-   INTEGER, PARAMETER ::   jp_lc_2d   =  jp_pisces_2d  !:
-   INTEGER, PARAMETER ::   jp_lc_3d   =  jp_pisces_3d  !:
-   INTEGER, PARAMETER ::   jp_lc_trd  =  jp_pisces_trd !:
-   
-#if defined key_cfc
-   !!---------------------------------------------------------------------
-   !!   'key_cfc'   :                                          CFC tracers
-   !!---------------------------------------------------------------------
-   LOGICAL, PUBLIC, PARAMETER ::   lk_cfc     = .TRUE.      !: CFC flag 
-   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')
-   INTEGER, PUBLIC, PARAMETER ::   jp_cfc_trd =  0          !: number of sms trends for CFC
-   
-   ! assign an index in trc arrays for each CFC prognostic variables
-   INTEGER, PUBLIC, PARAMETER ::   jpc11       = jp_lc + 1   !: CFC-11 
-   INTEGER, PUBLIC, PARAMETER ::   jpc12       = jp_lc + 2   !: CFC-12   
-#else
-   !!---------------------------------------------------------------------
-   !!   Default     :                                       No CFC tracers
-   !!---------------------------------------------------------------------
-   LOGICAL, PUBLIC, PARAMETER ::   lk_cfc     = .FALSE.     !: CFC flag 
-   INTEGER, PUBLIC, PARAMETER ::   jp_cfc     =  0          !: No CFC tracers
-   INTEGER, PUBLIC, PARAMETER ::   jp_cfc_2d  =  0          !: No CFC additional 2d output arrays 
-   INTEGER, PUBLIC, PARAMETER ::   jp_cfc_3d  =  0          !: No CFC additional 3d output arrays 
-   INTEGER, PUBLIC, PARAMETER ::   jp_cfc_trd =  0          !: number of sms trends for CFC
-#endif
-
-   ! Starting/ending CFC do-loop indices (N.B. no CFC : jp_cfc0 > jp_cfc1 the do-loop are never done)
-   INTEGER, PUBLIC, PARAMETER ::   jp_cfc0     = jp_lc + 1       !: First index of CFC tracers
-   INTEGER, PUBLIC, PARAMETER ::   jp_cfc1     = jp_lc + jp_cfc  !: Last  index of CFC tracers
-   INTEGER, PUBLIC, PARAMETER ::   jp_cfc0_2d  = jp_lc_2d  + 1       !: First index of CFC tracers
-   INTEGER, PUBLIC, PARAMETER ::   jp_cfc1_2d  = jp_lc_2d  + jp_cfc_2d  !: Last  index of CFC tracers
-   INTEGER, PUBLIC, PARAMETER ::   jp_cfc0_3d  = jp_lc_3d  + 1       !: First index of CFC tracers
-   INTEGER, PUBLIC, PARAMETER ::   jp_cfc1_3d  = jp_lc_3d  + jp_cfc_3d  !: Last  index of CFC tracers
-   INTEGER, PUBLIC, PARAMETER ::   jp_cfc0_trd = jp_lc_trd + 1       !: First index of CFC tracers
-   INTEGER, PUBLIC, PARAMETER ::   jp_cfc1_trd = jp_lc_trd + jp_cfc_trd  !: Last  index of CFC tracers
+   INTEGER, PUBLIC  :: jp_cfc0, jp_cfc1  !:  First/last index of CFC tracers
 
    !!======================================================================
Index: branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/NEMO/TOP_SRC/CFC/trcice_cfc.F90
===================================================================
--- branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/NEMO/TOP_SRC/CFC/trcice_cfc.F90	(revision 7383)
+++ branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/NEMO/TOP_SRC/CFC/trcice_cfc.F90	(revision 7391)
@@ -5,8 +5,4 @@
    !!======================================================================
    !! History :   2.0  !  2007-12  (C. Ethe, G. Madec) Original code
-   !!----------------------------------------------------------------------
-#if defined key_cfc
-   !!----------------------------------------------------------------------
-   !!   'key_cfc'                                               CFC tracers
    !!----------------------------------------------------------------------
    !! trc_ice_cfc       : MY_TRC model main routine
@@ -40,14 +36,4 @@
    END SUBROUTINE trc_ice_ini_cfc
 
-
-#else
-   !!----------------------------------------------------------------------
-   !!   Dummy module                                        No MY_TRC model
-   !!----------------------------------------------------------------------
-CONTAINS
-   SUBROUTINE trc_ice_ini_cfc             ! Empty routine
-   END SUBROUTINE trc_ice_ini_cfc
-#endif
-
    !!======================================================================
 END MODULE trcice_cfc
Index: branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/NEMO/TOP_SRC/CFC/trcini_cfc.F90
===================================================================
--- branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/NEMO/TOP_SRC/CFC/trcini_cfc.F90	(revision 7383)
+++ branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/NEMO/TOP_SRC/CFC/trcini_cfc.F90	(revision 7391)
@@ -6,7 +6,4 @@
    !! History :   2.0  !  2007-12  (C. Ethe, G. Madec) 
    !!----------------------------------------------------------------------
-#if defined key_cfc
-   !!----------------------------------------------------------------------
-   !!   'key_cfc'                                               CFC tracers
    !!----------------------------------------------------------------------
    !! trc_ini_cfc      : CFC model initialisation
@@ -15,4 +12,5 @@
    USE par_trc         ! TOP parameters
    USE trc             ! TOP variables
+   USE trcnam_cfc      ! CFC SMS namelist
    USE trcsms_cfc      ! CFC sms trends
 
@@ -21,6 +19,4 @@
 
    PUBLIC   trc_ini_cfc   ! called by trcini.F90 module
-
-   CHARACTER (len=34) ::   clname = 'cfc1112.atm'   ! ???
 
    INTEGER  ::   inum                   ! unit number
@@ -46,12 +42,14 @@
       INTEGER  ::  iskip = 6   ! number of 1st descriptor lines
       REAL(wp) ::  zyy, zyd
+      CHARACTER(len = 20)  ::  cltra
       !!----------------------------------------------------------------------
-
+      !
+      CALL trc_nam_cfc
+      !
       IF(lwp) WRITE(numout,*)
       IF(lwp) WRITE(numout,*) ' trc_ini_cfc: initialisation of CFC chemical model'
       IF(lwp) WRITE(numout,*) ' ~~~~~~~~~~~'
-
-
-      IF(lwp) WRITE(numout,*) 'read of formatted file cfc1112atm'
+      !
+      IF(lwp) WRITE(numout,*) 'Read annual atmospheric concentratioins from formatted file : ' // TRIM(clname)
       
       CALL ctl_opn( inum, clname, 'OLD', 'FORMATTED', 'SEQUENTIAL', -1, numout, .FALSE. )
@@ -66,8 +64,8 @@
       END DO
  100  jpyear = jn - 1 - iskip
-      IF ( lwp) WRITE(numout,*) '    ', jpyear ,' years read'
+      IF ( lwp) WRITE(numout,*) '   --->  ', jpyear ,' years read'
       !                                ! Allocate CFC arrays
 
-      ALLOCATE( p_cfc(jpyear,jphem,2), STAT=ierr )
+      ALLOCATE( p_cfc(jpyear,jphem,3), STAT=ierr )
       IF( ierr > 0 ) THEN
          CALL ctl_stop( 'trc_ini_cfc: unable to allocate p_cfc array' )   ;   RETURN
@@ -87,5 +85,5 @@
          IF(lwp) THEN
             WRITE(numout,*)
-            WRITE(numout,*) 'Initialization de qint ; No restart : qint equal zero '
+            WRITE(numout,*) 'Initialisation of qint ; No restart : qint equal zero '
          ENDIF
          qint_cfc(:,:,:) = 0._wp
@@ -105,23 +103,22 @@
       jn = 31
       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)
+        READ(inum,*, IOSTAT=io) zyy, p_cfc(jn,1:2,1), p_cfc(jn,1:2,2), p_cfc(jn,1:2,3)
         IF( io < 0 ) exit
         jn = jn + 1
       END DO
 
-      p_cfc(32,1:2,1) = 5.e-4      ! modify the values of the first years
-      p_cfc(33,1:2,1) = 8.e-4
-      p_cfc(34,1:2,1) = 1.e-6
-      p_cfc(35,1:2,1) = 2.e-3
-      p_cfc(36,1:2,1) = 4.e-3
-      p_cfc(37,1:2,1) = 6.e-3
-      p_cfc(38,1:2,1) = 8.e-3
-      p_cfc(39,1:2,1) = 1.e-2
-      
+      !p_cfc(32,1:2,1) = 5.e-4      ! modify the values of the first years
+      !p_cfc(33,1:2,1) = 8.e-4
+      !p_cfc(34,1:2,1) = 1.e-6
+      !p_cfc(35,1:2,1) = 2.e-3
+      !p_cfc(36,1:2,1) = 4.e-3
+      !p_cfc(37,1:2,1) = 6.e-3
+      !p_cfc(38,1:2,1) = 8.e-3
+      !p_cfc(39,1:2,1) = 1.e-2
       IF(lwp) THEN        ! Control print
          WRITE(numout,*)
-         WRITE(numout,*) ' Year   p11HN    p11HS    p12HN    p12HS '
+         WRITE(numout,*) ' Year   c11NH     c11SH     c12NH     c12SH     SF6NH     SF6SH'
          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)
+            WRITE(numout, '( 1I4, 6F10.4)') jn, p_cfc(jn,1:2,1), p_cfc(jn,1:2,2), p_cfc(jn,1:2,3)
          END DO
       ENDIF
@@ -145,13 +142,4 @@
       !
    END SUBROUTINE trc_ini_cfc
-   
-#else
-   !!----------------------------------------------------------------------
-   !!   Dummy module                                         No CFC tracers
-   !!----------------------------------------------------------------------
-CONTAINS
-   SUBROUTINE trc_ini_cfc             ! Empty routine
-   END SUBROUTINE trc_ini_cfc
-#endif
 
    !!======================================================================
Index: branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/NEMO/TOP_SRC/CFC/trcnam_cfc.F90
===================================================================
--- branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/NEMO/TOP_SRC/CFC/trcnam_cfc.F90	(revision 7383)
+++ branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/NEMO/TOP_SRC/CFC/trcnam_cfc.F90	(revision 7391)
@@ -6,18 +6,14 @@
    !! History :   2.0  !  2007-12  (C. Ethe, G. Madec) from trcnam.cfc.h90
    !!----------------------------------------------------------------------
-#if defined key_cfc
-   !!----------------------------------------------------------------------
-   !!   'key_cfc'                                               CFC tracers
-   !!----------------------------------------------------------------------
    !! trc_nam_cfc      : CFC model initialisation
    !!----------------------------------------------------------------------
    USE oce_trc         ! Ocean variables
-   USE par_trc         ! TOP parameters
    USE trc             ! TOP variables
    USE trcsms_cfc      ! CFC specific variable
-   USE iom             ! I/O manager
 
    IMPLICIT NONE
    PRIVATE
+
+   CHARACTER(len=34), PUBLIC ::   clname ! Input filename of CFCs atm. concentrations
 
    PUBLIC   trc_nam_cfc   ! called by trcnam.F90 module
@@ -42,30 +38,58 @@
       !! ** input   :   Namelist namcfc
       !!----------------------------------------------------------------------
-      INTEGER ::  numnatc_ref = -1   ! Logical unit for reference CFC namelist
-      INTEGER ::  numnatc_cfg = -1   ! Logical unit for configuration CFC namelist
-      INTEGER ::  numonc      = -1   ! Logical unit for output namelist
       INTEGER :: ios                 ! Local integer output status for namelist read
       INTEGER :: jl, jn
-      TYPE(DIAG), DIMENSION(jp_cfc_2d) :: cfcdia2d
       !!
-      NAMELIST/namcfcdate/ ndate_beg, nyear_res
-      NAMELIST/namcfcdia/  cfcdia2d     ! additional diagnostics
+      NAMELIST/namcfc/ ndate_beg, nyear_res, clname
       !!----------------------------------------------------------------------
-      !                             ! Open namelist files
-      CALL ctl_opn( numnatc_ref, 'namelist_cfc_ref'   ,     'OLD', 'FORMATTED', 'SEQUENTIAL', -1, numout, .FALSE. )
-      CALL ctl_opn( numnatc_cfg, 'namelist_cfc_cfg'   ,     'OLD', 'FORMATTED', 'SEQUENTIAL', -1, numout, .FALSE. )
-      IF(lwm) CALL ctl_opn( numonc, 'output.namelist.cfc', 'UNKNOWN', 'FORMATTED', 'SEQUENTIAL', -1, numout, .FALSE. )
+      !
+      jn = jp_cfc0 - 1
+      ! Variables setting
+      IF( ln_cfc11 ) THEN
+         jn = jn + 1
+         ctrcnm    (jn) = 'CFC11'
+         ctrcln    (jn) = 'Chlorofluoro carbon 11 Concentration'
+         ctrcun    (jn) = 'umolC/L'
+         ln_trc_ini(jn) = .false.
+         ln_trc_sbc(jn) = .false.
+         ln_trc_cbc(jn) = .false.
+         ln_trc_obc(jn) = .false.
+      ENDIF
+      !
+      IF( ln_cfc12 ) THEN
+         jn = jn + 1
+         ctrcnm    (jn) = 'CFC12'
+         ctrcln    (jn) = 'Chlorofluoro carbon 12 Concentration'
+         ctrcun    (jn) = 'umolC/L'
+         ln_trc_ini(jn) = .false.
+         ln_trc_sbc(jn) = .false.
+         ln_trc_cbc(jn) = .false.
+         ln_trc_obc(jn) = .false.
+      ENDIF
+      !
+      IF( ln_sf6 ) THEN
+         jn = jn + 1
+         ctrcnm    (jn) = 'SF6'
+         ctrcln    (jn) = 'Sulfur hexafluoride Concentration'
+         ctrcun    (jn) = 'umol/L'
+         ln_trc_ini(jn) = .false.
+         ln_trc_sbc(jn) = .false.
+         ln_trc_cbc(jn) = .false.
+         ln_trc_obc(jn) = .false.
+      ENDIF
+      !
+      REWIND( numtrc_ref )              ! Namelist namcfcdate in reference namelist : CFC parameters
+      READ  ( numtrc_ref, namcfc, IOSTAT = ios, ERR = 901)
+901   IF( ios /= 0 ) CALL ctl_nam ( ios , 'namcfc in reference namelist', lwp )
 
-      REWIND( numnatc_ref )              ! Namelist namcfcdate in reference namelist : CFC parameters
-      READ  ( numnatc_ref, namcfcdate, IOSTAT = ios, ERR = 901)
-901   IF( ios /= 0 ) CALL ctl_nam ( ios , 'namcfcdate in reference namelist', lwp )
-
-      REWIND( numnatc_cfg )              ! Namelist namcfcdate in configuration namelist : CFC parameters
-      READ  ( numnatc_cfg, namcfcdate, IOSTAT = ios, ERR = 902 )
-902   IF( ios /= 0 ) CALL ctl_nam ( ios , 'namcfcdate in configuration namelist', lwp )
-      IF(lwm) WRITE ( numonc, namcfcdate )
+      REWIND( numtrc_cfg )              ! Namelist namcfcdate in configuration namelist : CFC parameters
+      READ  ( numtrc_cfg, namcfc, IOSTAT = ios, ERR = 902 )
+902   IF( ios /= 0 ) CALL ctl_nam ( ios , 'namcfc in configuration namelist', lwp )
+      IF(lwm) WRITE ( numonr, namcfc )
 
       IF(lwp) THEN                  ! control print
-         WRITE(numout,*)
+         WRITE(numout,*) ' '
+         WRITE(numout,*) ' CFCs'
+         WRITE(numout,*) ' '
          WRITE(numout,*) ' trc_nam: Read namdates, namelist for CFC chemical model'
          WRITE(numout,*) ' ~~~~~~~'
@@ -76,51 +100,8 @@
       IF(lwp) WRITE(numout,*) '    initial year (aa)                       nyear_beg = ', nyear_beg
       !
-
-      IF( .NOT.lk_iomput .AND. ln_diatrc ) THEN
-         !
-         ! Namelist namcfcdia
-         ! -------------------
-         REWIND( numnatc_ref )              ! Namelist namcfcdia in reference namelist : CFC diagnostics
-         READ  ( numnatc_ref, namcfcdia, IOSTAT = ios, ERR = 903)
-903      IF( ios /= 0 ) CALL ctl_nam ( ios , 'namcfcdia in reference namelist', lwp )
-
-         REWIND( numnatc_cfg )              ! Namelist namcfcdia in configuration namelist : CFC diagnostics
-         READ  ( numnatc_cfg, namcfcdia, IOSTAT = ios, ERR = 904 )
-904      IF( ios /= 0 ) CALL ctl_nam ( ios , 'namcfcdia in configuration namelist', lwp )
-         IF(lwm) WRITE ( numonc, namcfcdia )
-
-         DO jl = 1, jp_cfc_2d
-            jn = jp_cfc0_2d + jl - 1
-            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,*) ' '
-         ENDIF
-         !
-      ENDIF
-
-   IF(lwm) CALL FLUSH ( numonc )     ! flush output namelist CFC
+      IF(lwm) CALL FLUSH ( numonr )     ! flush output namelist CFC
 
    END SUBROUTINE trc_nam_cfc
    
-#else
-   !!----------------------------------------------------------------------
-   !!  Dummy module :                                                No CFC
-   !!----------------------------------------------------------------------
-CONTAINS
-   SUBROUTINE trc_nam_cfc                      ! Empty routine
-   END  SUBROUTINE  trc_nam_cfc
-#endif  
-
    !!======================================================================
 END MODULE trcnam_cfc
Index: branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/NEMO/TOP_SRC/CFC/trcsms_cfc.F90
===================================================================
--- branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/NEMO/TOP_SRC/CFC/trcsms_cfc.F90	(revision 7383)
+++ branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/NEMO/TOP_SRC/CFC/trcsms_cfc.F90	(revision 7391)
@@ -7,8 +7,5 @@
    !!  NEMO      1.0  !  2004-03  (C. Ethe) free form + modularity
    !!            2.0  !  2007-12  (C. Ethe, G. Madec)  reorganisation
-   !!----------------------------------------------------------------------
-#if defined key_cfc
-   !!----------------------------------------------------------------------
-   !!   'key_cfc'                                               CFC tracers
+   !!            4.0  !  2016-11  (T. Lovato) Add SF6, Update Schmidt number
    !!----------------------------------------------------------------------
    !!   trc_sms_cfc  :  compute and add CFC suface forcing to CFC trends
@@ -29,18 +26,19 @@
 
    INTEGER , PUBLIC, PARAMETER ::   jphem  =   2   ! parameter for the 2 hemispheres
-   INTEGER , PUBLIC            ::   jpyear         ! Number of years read in CFC1112 file
+   INTEGER , PUBLIC            ::   jpyear         ! Number of years read in input data file (in trcini_cfc)
    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, ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::   p_cfc    ! partial hemispheric pressure for CFC
+   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::   p_cfc    ! partial hemispheric pressure for all 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(:,:,:) ::   atm_cfc  ! partial hemispheric pressure for used CFC
    REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:)   ::   patm     ! atmospheric function
 
-   REAL(wp), DIMENSION(4,2) ::   soa   ! coefficient for solubility of CFC [mol/l/atm]
-   REAL(wp), DIMENSION(3,2) ::   sob   !    "               "
-   REAL(wp), DIMENSION(4,2) ::   sca   ! coefficients for schmidt number in degre Celcius
+   REAL(wp),         ALLOCATABLE, SAVE, DIMENSION(:,:)   ::   soa      ! coefficient for solubility of CFC [mol/l/atm]
+   REAL(wp),         ALLOCATABLE, SAVE, DIMENSION(:,:)   ::   sob      !    "               "
+   REAL(wp),         ALLOCATABLE, SAVE, DIMENSION(:,:)   ::   sca      ! coefficients for schmidt number in degrees Celsius
       
    !                          ! coefficients for conversion
@@ -79,5 +77,5 @@
       INTEGER  ::   im1, im2, ierr
       REAL(wp) ::   ztap, zdtap        
-      REAL(wp) ::   zt1, zt2, zt3, zv2
+      REAL(wp) ::   zt1, zt2, zt3, zt4, zv2
       REAL(wp) ::   zsol      ! solubility
       REAL(wp) ::   zsch      ! schmidt number 
@@ -117,6 +115,6 @@
          ! time interpolation at time kt
          DO jm = 1, jphem
-            zpatm(jm,jl) = (  p_cfc(iyear_beg, jm, jl) * FLOAT (im1)  &
-               &           +  p_cfc(iyear_end, jm, jl) * FLOAT (im2) ) / 12.
+            zpatm(jm,jl) = (  atm_cfc(iyear_beg, jm, jl) * REAL(im1, wp)  &
+               &           +  atm_cfc(iyear_end, jm, jl) * REAL(im2, wp) ) / 12.
          END DO
          
@@ -145,21 +143,19 @@
   
                ! Computation of speed transfert
-               !    Schmidt number
+               !    Schmidt number revised in Wanninkhof (2014)
                zt1  = tsn(ji,jj,1,jp_tem)
                zt2  = zt1 * zt1 
                zt3  = zt1 * zt2
-               zsch = sca(1,jl) + sca(2,jl) * zt1 + sca(3,jl) * zt2 + sca(4,jl) * zt3
-
-               !    speed transfert : formulae of wanninkhof 1992
+               zt4  = zt2 * zt2
+               zsch = sca(1,jl) + sca(2,jl) * zt1 + sca(3,jl) * zt2 + sca(4,jl) * zt3 + sca(5,jl) * zt4
+
+               !    speed transfert : formulae revised in Wanninkhof (2014)
                zv2     = wndm(ji,jj) * wndm(ji,jj)
                zsch    = zsch / 660.
-               zak_cfc = ( 0.39 * xconv2 * zv2 / SQRT(zsch) ) * tmask(ji,jj,1)
+               zak_cfc = ( 0.31 * xconv2 * zv2 / SQRT(zsch) ) * tmask(ji,jj,1)
 
                ! Input function  : speed *( conc. at equil - concen at surface )
                ! 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
-                  &                         * facvol(ji,jj,1)                           &
-#endif
                   &                         * tmask(ji,jj,1) * ( 1. - fr_i(ji,jj) )
                ! Add the surface flux to the trend
@@ -185,11 +181,8 @@
       !
       IF( lk_iomput ) THEN
-         CALL iom_put( "qtrCFC11"  , qtr_cfc (:,:,1) )
-         CALL iom_put( "qintCFC11" , qint_cfc(:,:,1) )
-      ELSE
-         IF( ln_diatrc ) THEN
-            trc2d(:,:,jp_cfc0_2d    ) = qtr_cfc (:,:,1)
-            trc2d(:,:,jp_cfc0_2d + 1) = qint_cfc(:,:,1)
-         END IF
+         DO jn = jp_cfc0, jp_cfc1
+            CALL iom_put( 'qtr_'//ctrcnm(jn) , qtr_cfc (:,:,jn) )
+            CALL iom_put( 'qint_'//ctrcnm(jn), qint_cfc(:,:,jn) )
+         ENDDO
       END IF
       !
@@ -212,42 +205,81 @@
       !!---------------------------------------------------------------------
       INTEGER :: jn
-
+      !!----------------------------------------------------------------------
+      !
+      jn = 0 
       ! coefficient for CFC11 
       !----------------------
-
-      ! Solubility
-      soa(1,1) = -229.9261 
-      soa(2,1) =  319.6552
-      soa(3,1) =  119.4471
-      soa(4,1) =  -1.39165
-
-      sob(1,1) =  -0.142382
-      sob(2,1) =   0.091459
-      sob(3,1) =  -0.0157274
-
-      ! Schmidt number 
-      sca(1,1) = 3501.8
-      sca(2,1) = -210.31
-      sca(3,1) =  6.1851
-      sca(4,1) = -0.07513
+      if ( ln_cfc11 ) then
+         jn = jn + 1
+         ! Solubility
+         soa(1,jn) = -229.9261 
+         soa(2,jn) =  319.6552
+         soa(3,jn) =  119.4471
+         soa(4,jn) =  -1.39165
+
+         sob(1,jn) =  -0.142382
+         sob(2,jn) =   0.091459
+         sob(3,jn) =  -0.0157274
+
+         ! Schmidt number 
+         sca(1,jn) = 3579.2
+         sca(2,jn) = -222.63
+         sca(3,jn) = 7.5749
+         sca(4,jn) = -0.14595
+         sca(5,jn) = 0.0011874
+
+         ! atm. concentration
+         atm_cfc(:,:,jn) = p_cfc(:,:,1)
+      endif
 
       ! coefficient for CFC12 
       !----------------------
-
-      ! Solubility
-      soa(1,2) = -218.0971
-      soa(2,2) =  298.9702
-      soa(3,2) =  113.8049
-      soa(4,2) =  -1.39165
-
-      sob(1,2) =  -0.143566
-      sob(2,2) =   0.091015
-      sob(3,2) =  -0.0153924
-
-      ! schmidt number 
-      sca(1,2) =  3845.4 
-      sca(2,2) =  -228.95
-      sca(3,2) =  6.1908 
-      sca(4,2) =  -0.067430
+      if ( ln_cfc12 ) then
+         jn = jn + 1
+         ! Solubility
+         soa(1,jn) = -218.0971
+         soa(2,jn) =  298.9702
+         soa(3,jn) =  113.8049
+         soa(4,jn) =  -1.39165
+
+         sob(1,jn) =  -0.143566
+         sob(2,jn) =   0.091015
+         sob(3,jn) =  -0.0153924
+
+         ! schmidt number 
+         sca(1,jn) = 3828.1
+         sca(2,jn) = -249.86
+         sca(3,jn) = 8.7603
+         sca(4,jn) = -0.1716
+         sca(5,jn) = 0.001408
+
+         ! atm. concentration
+         atm_cfc(:,:,jn) = p_cfc(:,:,2)
+      endif
+
+      ! coefficient for SF6
+      !----------------------
+      if ( ln_sf6 ) then
+         jn = jn + 1
+         ! Solubility
+         soa(1,jn) = -80.0343
+         soa(2,jn) = 117.232
+         soa(3,jn) =  29.5817
+         soa(4,jn) =   0.0
+
+         sob(1,jn) =  0.0335183 
+         sob(2,jn) = -0.0373942 
+         sob(3,jn) =  0.00774862
+
+         ! schmidt number
+         sca(1,jn) = 3177.5
+         sca(2,jn) = -200.57
+         sca(3,jn) = 6.8865
+         sca(4,jn) = -0.13335
+         sca(5,jn) = 0.0010877
+  
+         ! atm. concentration
+         atm_cfc(:,:,jn) = p_cfc(:,:,3)
+       endif
 
       IF( ln_rsttr ) THEN
@@ -269,7 +301,8 @@
       !!                     ***  ROUTINE trc_sms_cfc_alloc  ***
       !!----------------------------------------------------------------------
-      ALLOCATE( xphem   (jpi,jpj)        ,     &
-         &      qtr_cfc (jpi,jpj,jp_cfc) ,     &
-         &      qint_cfc(jpi,jpj,jp_cfc) , STAT=trc_sms_cfc_alloc )
+      ALLOCATE( xphem   (jpi,jpj)        , atm_cfc(jpyear,jphem,jp_cfc)  ,    &
+         &      qtr_cfc (jpi,jpj,jp_cfc) , qint_cfc(jpi,jpj,jp_cfc)      ,    &
+         &      soa(4,jp_cfc)    ,  sob(3,jp_cfc)   ,  sca(5,jp_cfc)     ,    &
+         &      STAT=trc_sms_cfc_alloc )
          !
       IF( trc_sms_cfc_alloc /= 0 ) CALL ctl_warn('trc_sms_cfc_alloc : failed to allocate arrays.')
@@ -277,14 +310,4 @@
    END FUNCTION trc_sms_cfc_alloc
 
-#else
-   !!----------------------------------------------------------------------
-   !!   Dummy module                                         No CFC tracers
-   !!----------------------------------------------------------------------
-CONTAINS
-   SUBROUTINE trc_sms_cfc( kt )       ! Empty routine
-      WRITE(*,*) 'trc_sms_cfc: You should not have seen this print! error?', kt
-   END SUBROUTINE trc_sms_cfc
-#endif
-
    !!======================================================================
 END MODULE trcsms_cfc
Index: branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/NEMO/TOP_SRC/CFC/trcwri_cfc.F90
===================================================================
--- branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/NEMO/TOP_SRC/CFC/trcwri_cfc.F90	(revision 7383)
+++ branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/NEMO/TOP_SRC/CFC/trcwri_cfc.F90	(revision 7391)
@@ -6,7 +6,5 @@
    !! History :   1.0  !  2009-05 (C. Ethe)  Original code
    !!----------------------------------------------------------------------
-#if defined key_top && defined key_cfc && defined key_iomput
-   !!----------------------------------------------------------------------
-   !!   'key_cfc'                                           cfc model
+#if defined key_top && defined key_iomput
    !!----------------------------------------------------------------------
    !! trc_wri_cfc   :  outputs of concentration fields
Index: branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/NEMO/TOP_SRC/MY_TRC/par_my_trc.F90
===================================================================
--- branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/NEMO/TOP_SRC/MY_TRC/par_my_trc.F90	(revision 7383)
+++ branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/NEMO/TOP_SRC/MY_TRC/par_my_trc.F90	(revision 7391)
@@ -10,60 +10,10 @@
    !! Software governed by the CeCILL licence (NEMOGCM/NEMO_CeCILL.txt)
    !!----------------------------------------------------------------------
-   USE par_pisces , ONLY : jp_pisces       !: number of tracers in PISCES
-   USE par_pisces , ONLY : jp_pisces_2d    !: number of 2D diag in PISCES
-   USE par_pisces , ONLY : jp_pisces_3d    !: number of 3D diag in PISCES
-   USE par_pisces , ONLY : jp_pisces_trd   !: number of biological diag in PISCES
-
-   USE par_cfc    , ONLY : jp_cfc          !: number of tracers in CFC
-   USE par_cfc    , ONLY : jp_cfc_2d       !: number of tracers in CFC
-   USE par_cfc    , ONLY : jp_cfc_3d       !: number of tracers in CFC
-   USE par_cfc    , ONLY : jp_cfc_trd      !: number of tracers in CFC
-
-   USE par_c14b   , ONLY : jp_c14b         !: number of tracers in C14
-   USE par_c14b   , ONLY : jp_c14b_2d      !: number of tracers in C14
-   USE par_c14b   , ONLY : jp_c14b_3d      !: number of tracers in C14
-   USE par_c14b   , ONLY : jp_c14b_trd     !: number of tracers in C14
 
    IMPLICIT NONE
 
-   INTEGER, PARAMETER ::   jp_lm      =  jp_pisces     + jp_cfc     + jp_c14b     !: 
-   INTEGER, PARAMETER ::   jp_lm_2d   =  jp_pisces_2d  + jp_cfc_2d  + jp_c14b_2d  !:
-   INTEGER, PARAMETER ::   jp_lm_3d   =  jp_pisces_3d  + jp_cfc_3d  + jp_c14b_3d  !:
-   INTEGER, PARAMETER ::   jp_lm_trd  =  jp_pisces_trd + jp_cfc_trd + jp_c14b_trd !:
-
-#if defined key_my_trc
-   !!---------------------------------------------------------------------
-   !!   'key_my_trc'                     user defined tracers (MY_TRC)
-   !!---------------------------------------------------------------------
-   LOGICAL, PUBLIC, PARAMETER ::   lk_my_trc     = .TRUE.   !: PTS flag 
-   INTEGER, PUBLIC, PARAMETER ::   jp_my_trc     =  1       !: number of PTS tracers
-   INTEGER, PUBLIC, PARAMETER ::   jp_my_trc_2d  =  0       !: additional 2d output arrays ('key_trc_diaadd')
-   INTEGER, PUBLIC, PARAMETER ::   jp_my_trc_3d  =  0       !: additional 3d output arrays ('key_trc_diaadd')
-   INTEGER, PUBLIC, PARAMETER ::   jp_my_trc_trd =  0       !: number of sms trends for MY_TRC
-
-   ! assign an index in trc arrays for each PTS prognostic variables
-   INTEGER, PUBLIC, PARAMETER ::   jpmyt1 = jp_lm + 1     !: 1st MY_TRC tracer
-
-#else
-   !!---------------------------------------------------------------------
-   !!   Default                           No user defined tracers (MY_TRC)
-   !!---------------------------------------------------------------------
-   LOGICAL, PUBLIC, PARAMETER ::   lk_my_trc     = .FALSE.  !: MY_TRC flag 
-   INTEGER, PUBLIC, PARAMETER ::   jp_my_trc     =  0       !: No MY_TRC tracers
-   INTEGER, PUBLIC, PARAMETER ::   jp_my_trc_2d  =  0       !: No MY_TRC additional 2d output arrays 
-   INTEGER, PUBLIC, PARAMETER ::   jp_my_trc_3d  =  0       !: No MY_TRC additional 3d output arrays 
-   INTEGER, PUBLIC, PARAMETER ::   jp_my_trc_trd =  0       !: number of sms trends for MY_TRC
-#endif
-
    ! Starting/ending PISCES do-loop indices (N.B. no PISCES : jpl_pcs < jpf_pcs the do-loop are never done)
-   INTEGER, PUBLIC, PARAMETER ::   jp_myt0     = jp_lm     + 1              !: First index of MY_TRC passive tracers
-   INTEGER, PUBLIC, PARAMETER ::   jp_myt1     = jp_lm     + jp_my_trc      !: Last  index of MY_TRC passive tracers
-   INTEGER, PUBLIC, PARAMETER ::   jp_myt0_2d  = jp_lm_2d  + 1              !: First index of MY_TRC passive tracers
-   INTEGER, PUBLIC, PARAMETER ::   jp_myt1_2d  = jp_lm_2d  + jp_my_trc_2d   !: Last  index of MY_TRC passive tracers
-   INTEGER, PUBLIC, PARAMETER ::   jp_myt0_3d  = jp_lm_3d  + 1              !: First index of MY_TRC passive tracers
-   INTEGER, PUBLIC, PARAMETER ::   jp_myt1_3d  = jp_lm_3d  + jp_my_trc_3d   !: Last  index of MY_TRC passive tracers
-   INTEGER, PUBLIC, PARAMETER ::   jp_myt0_trd = jp_lm_trd + 1              !: First index of MY_TRC passive tracers
-   INTEGER, PUBLIC, PARAMETER ::   jp_myt1_trd = jp_lm_trd + jp_my_trc_trd  !: Last  index of MY_TRC passive tracers
-
+   INTEGER, PUBLIC ::   jp_myt0             !: First index of MY_TRC passive tracers
+   INTEGER, PUBLIC ::   jp_myt1             !: Last  index of MY_TRC passive tracers
    !!======================================================================
 END MODULE par_my_trc
Index: branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/NEMO/TOP_SRC/MY_TRC/trcice_my_trc.F90
===================================================================
--- branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/NEMO/TOP_SRC/MY_TRC/trcice_my_trc.F90	(revision 7383)
+++ branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/NEMO/TOP_SRC/MY_TRC/trcice_my_trc.F90	(revision 7391)
@@ -3,9 +3,7 @@
    !!                         ***  MODULE trcice_my_trc  ***
    !!----------------------------------------------------------------------
-#if defined key_my_trc
+   !! trc_ice_my_trc       : MY_TRC model seaice coupling routine
    !!----------------------------------------------------------------------
-   !!   'key_my_trc'                                               CFC tracers
-   !!----------------------------------------------------------------------
-   !! trc_ice_my_trc       : MY_TRC model main routine
+   !! History :        !  2016  (C. Ethe, T. Lovato) Revised architecture
    !!----------------------------------------------------------------------
    USE par_trc         ! TOP parameters
@@ -19,6 +17,6 @@
 
    !!----------------------------------------------------------------------
-   !! NEMO/TOP 3.3 , NEMO Consortium (2010)
-   !! $Id: trcice_my_trc.F90 4990 2014-12-15 16:42:49Z timgraham $
+   !! NEMO/TOP 4.0 , NEMO Consortium (2016)
+   !! $Id$
    !! Software governed by the CeCILL licence     (NEMOGCM/NEMO_CeCILL.txt)
    !!----------------------------------------------------------------------
@@ -34,13 +32,4 @@
    END SUBROUTINE trc_ice_ini_my_trc
 
-#else
-   !!----------------------------------------------------------------------
-   !!   Dummy module                                        No MY_TRC model
-   !!----------------------------------------------------------------------
-CONTAINS
-   SUBROUTINE trc_ice_ini_my_trc             ! Empty routine
-   END SUBROUTINE trc_ice_ini_my_trc
-#endif
-
    !!======================================================================
 END MODULE trcice_my_trc
Index: branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/NEMO/TOP_SRC/MY_TRC/trcini_my_trc.F90
===================================================================
--- branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/NEMO/TOP_SRC/MY_TRC/trcini_my_trc.F90	(revision 7383)
+++ branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/NEMO/TOP_SRC/MY_TRC/trcini_my_trc.F90	(revision 7391)
@@ -4,9 +4,6 @@
    !! TOP :   initialisation of the MY_TRC tracers
    !!======================================================================
-   !! History :   2.0  !  2007-12  (C. Ethe, G. Madec) Original code
-   !!----------------------------------------------------------------------
-#if defined key_my_trc
-   !!----------------------------------------------------------------------
-   !!   'key_my_trc'                                               CFC tracers
+   !! History :        !  2007  (C. Ethe, G. Madec) Original code
+   !!                  !  2016  (C. Ethe, T. Lovato) Revised architecture
    !!----------------------------------------------------------------------
    !! trc_ini_my_trc   : MY_TRC model initialisation
@@ -15,4 +12,6 @@
    USE oce_trc
    USE trc
+   USE par_my_trc
+   USE trcnam_my_trc     ! MY_TRC SMS namelist
    USE trcsms_my_trc
 
@@ -23,5 +22,5 @@
 
    !!----------------------------------------------------------------------
-   !! NEMO/TOP 3.3 , NEMO Consortium (2010)
+   !! NEMO/TOP 4.0 , NEMO Consortium (2016)
    !! $Id$ 
    !! Software governed by the CeCILL licence     (NEMOGCM/NEMO_CeCILL.txt)
@@ -37,5 +36,7 @@
       !! ** Method  : - Read the namcfc namelist and check the parameter values
       !!----------------------------------------------------------------------
-
+      !
+      CALL trc_nam_my_trc
+      !
       !                       ! Allocate MY_TRC arrays
       IF( trc_sms_my_trc_alloc() /= 0 )   CALL ctl_stop( 'STOP', 'trc_ini_my_trc: unable to allocate MY_TRC arrays' )
@@ -53,13 +54,4 @@
    END SUBROUTINE trc_ini_my_trc
 
-#else
-   !!----------------------------------------------------------------------
-   !!   Dummy module                                        No MY_TRC model
-   !!----------------------------------------------------------------------
-CONTAINS
-   SUBROUTINE trc_ini_my_trc             ! Empty routine
-   END SUBROUTINE trc_ini_my_trc
-#endif
-
    !!======================================================================
 END MODULE trcini_my_trc
Index: branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/NEMO/TOP_SRC/MY_TRC/trcnam_my_trc.F90
===================================================================
--- branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/NEMO/TOP_SRC/MY_TRC/trcnam_my_trc.F90	(revision 7383)
+++ branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/NEMO/TOP_SRC/MY_TRC/trcnam_my_trc.F90	(revision 7391)
@@ -4,9 +4,6 @@
    !! TOP :   initialisation of some run parameters for MY_TRC bio-model
    !!======================================================================
-   !! History :   2.0  !  2007-12  (C. Ethe, G. Madec) Original code
-   !!----------------------------------------------------------------------
-#if defined key_my_trc
-   !!----------------------------------------------------------------------
-   !!   'key_my_trc'   :                                       MY_TRC model
+   !! History :      !  2007  (C. Ethe, G. Madec) Original code
+   !!                !  2016  (C. Ethe, T. Lovato) Revised architecture
    !!----------------------------------------------------------------------
    !! trc_nam_my_trc      : MY_TRC model initialisation
@@ -22,5 +19,5 @@
 
    !!----------------------------------------------------------------------
-   !! NEMO/TOP 3.3 , NEMO Consortium (2010)
+   !! NEMO/TOP 4.0 , NEMO Consortium (2016)
    !! $Id$ 
    !! Software governed by the CeCILL licence (NEMOGCM/NEMO_CeCILL.txt)
@@ -43,13 +40,4 @@
    END SUBROUTINE trc_nam_my_trc
    
-#else
-   !!----------------------------------------------------------------------
-   !!  Dummy module :                                             No MY_TRC
-   !!----------------------------------------------------------------------
-CONTAINS
-   SUBROUTINE trc_nam_my_trc                      ! Empty routine
-   END  SUBROUTINE  trc_nam_my_trc
-#endif  
-
    !!======================================================================
 END MODULE trcnam_my_trc
Index: branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/NEMO/TOP_SRC/MY_TRC/trcsms_my_trc.F90
===================================================================
--- branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/NEMO/TOP_SRC/MY_TRC/trcsms_my_trc.F90	(revision 7383)
+++ branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/NEMO/TOP_SRC/MY_TRC/trcsms_my_trc.F90	(revision 7391)
@@ -4,9 +4,6 @@
    !! TOP :   Main module of the MY_TRC tracers
    !!======================================================================
-   !! History :   2.0  !  2007-12  (C. Ethe, G. Madec) Original code
-   !!----------------------------------------------------------------------
-#if defined key_my_trc
-   !!----------------------------------------------------------------------
-   !!   'key_my_trc'                                               CFC tracers
+   !! History :      !  2007  (C. Ethe, G. Madec)  Original code
+   !!                !  2016  (C. Ethe, T. Lovato) Revised architecture
    !!----------------------------------------------------------------------
    !! trc_sms_my_trc       : MY_TRC model main routine
@@ -18,5 +15,5 @@
    USE trd_oce
    USE trdtrc
-   USE trcbc, only : trc_bc_read
+   USE trcbc, only : trc_bc
 
    IMPLICIT NONE
@@ -29,5 +26,5 @@
 
    !!----------------------------------------------------------------------
-   !! NEMO/TOP 3.3 , NEMO Consortium (2010)
+   !! NEMO/TOP 4.0 , NEMO Consortium (2016)
    !! $Id$
    !! Software governed by the CeCILL licence     (NEMOGCM/NEMO_CeCILL.txt)
@@ -57,5 +54,5 @@
       IF( l_trdtrc )  CALL wrk_alloc( jpi, jpj, jpk, ztrmyt )
 
-      CALL trc_bc_read  ( kt )       ! tracers: surface and lateral Boundary Conditions
+      CALL trc_bc ( kt )       ! tracers: surface and lateral Boundary Conditions
 
       ! add here the call to BGC model
@@ -74,5 +71,4 @@
    END SUBROUTINE trc_sms_my_trc
 
-
    INTEGER FUNCTION trc_sms_my_trc_alloc()
       !!----------------------------------------------------------------------
@@ -88,16 +84,4 @@
    END FUNCTION trc_sms_my_trc_alloc
 
-
-#else
-   !!----------------------------------------------------------------------
-   !!   Dummy module                                        No MY_TRC model
-   !!----------------------------------------------------------------------
-CONTAINS
-   SUBROUTINE trc_sms_my_trc( kt )             ! Empty routine
-      INTEGER, INTENT( in ) ::   kt
-      WRITE(*,*) 'trc_sms_my_trc: You should not have seen this print! error?', kt
-   END SUBROUTINE trc_sms_my_trc
-#endif
-
    !!======================================================================
 END MODULE trcsms_my_trc
Index: branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/NEMO/TOP_SRC/MY_TRC/trcwri_my_trc.F90
===================================================================
--- branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/NEMO/TOP_SRC/MY_TRC/trcwri_my_trc.F90	(revision 7383)
+++ branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/NEMO/TOP_SRC/MY_TRC/trcwri_my_trc.F90	(revision 7391)
@@ -2,14 +2,12 @@
    !!======================================================================
    !!                       *** MODULE trcwri ***
-   !!    my_trc :   Output of my_trc tracers
+   !!     trc_wri_my_trc   :  outputs of concentration fields
    !!======================================================================
-   !! History :   1.0  !  2009-05 (C. Ethe)  Original code
+#if defined key_top && defined key_iomput
    !!----------------------------------------------------------------------
-#if defined key_top && defined key_my_trc && defined key_iomput
+   !! History :      !  2007  (C. Ethe, G. Madec)  Original code
+   !!                !  2016  (C. Ethe, T. Lovato) Revised architecture
    !!----------------------------------------------------------------------
-   !!   'key_my_trc'                                           my_trc model
-   !!----------------------------------------------------------------------
-   !! trc_wri_my_trc   :  outputs of concentration fields
-   !!----------------------------------------------------------------------
+   USE par_trc         ! passive tracers common variables
    USE trc         ! passive tracers common variables 
    USE iom         ! I/O manager
@@ -20,4 +18,9 @@
    PUBLIC trc_wri_my_trc 
 
+   !!----------------------------------------------------------------------
+   !! NEMO/TOP 4.0 , NEMO Consortium (2016)
+   !! $Id$
+   !! Software governed by the CeCILL licence     (NEMOGCM/NEMO_CeCILL.txt)
+   !!----------------------------------------------------------------------
 CONTAINS
 
@@ -36,5 +39,5 @@
       DO jn = jp_myt0, jp_myt1
          cltra = TRIM( ctrcnm(jn) )                  ! short title for tracer
-         IF( ln_trc_wri(jn) ) CALL iom_put( cltra, trn(:,:,:,jn) )
+         CALL iom_put( cltra, trn(:,:,:,jn) )
       END DO
       !
@@ -42,17 +45,12 @@
 
 #else
-   !!----------------------------------------------------------------------
-   !!  Dummy module :                                     No passive tracer
-   !!----------------------------------------------------------------------
-   PUBLIC trc_wri_my_trc
+
 CONTAINS
-   SUBROUTINE trc_wri_my_trc                     ! Empty routine  
+
+   SUBROUTINE trc_wri_my_trc
+      !
    END SUBROUTINE trc_wri_my_trc
+
 #endif
 
-   !!----------------------------------------------------------------------
-   !! NEMO/TOP 3.3 , NEMO Consortium (2010)
-   !! $Id: trcwri_my_trc.F90 3160 2011-11-20 14:27:18Z cetlod $ 
-   !! Software governed by the CeCILL licence (NEMOGCM/NEMO_CeCILL.txt)
-   !!======================================================================
 END MODULE trcwri_my_trc
Index: branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/NEMO/TOP_SRC/PISCES/P2Z/p2zbio.F90
===================================================================
--- branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/NEMO/TOP_SRC/PISCES/P2Z/p2zbio.F90	(revision 7383)
+++ branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/NEMO/TOP_SRC/PISCES/P2Z/p2zbio.F90	(revision 7391)
@@ -8,8 +8,4 @@
    !!              -   !  2001-03  (M. Levy)  LNO3 + dia2d 
    !!             2.0  !  2007-12  (C. Deltel, G. Madec)  F90
-   !!----------------------------------------------------------------------
-#if defined key_pisces_reduced
-   !!----------------------------------------------------------------------
-   !!   'key_pisces_reduced'                                     LOBSTER bio-model
    !!----------------------------------------------------------------------
    !!   p2z_bio        :  
@@ -86,6 +82,4 @@
       !!                                  source      sink
       !!        
-      !!              IF 'key_diabio' defined , the biogeochemical trends
-      !!              for passive tracers are saved for futher diagnostics.
       !!---------------------------------------------------------------------
       !!
@@ -109,5 +103,5 @@
       IF( nn_timing == 1 )  CALL timing_start('p2z_bio')
       !
-      IF( ln_diatrc .OR. lk_iomput ) THEN
+      IF( lk_iomput ) THEN
          CALL wrk_alloc( jpi, jpj,     17, zw2d )
          CALL wrk_alloc( jpi, jpj, jpk, 3, zw3d )
@@ -121,5 +115,5 @@
 
       xksi(:,:) = 0.e0        ! zooplakton closure ( fbod)
-      IF( ln_diatrc .OR. lk_iomput ) THEN
+      IF( lk_iomput ) THEN
          zw2d  (:,:,:) = 0.e0
          zw3d(:,:,:,:) = 0.e0
@@ -218,25 +212,5 @@
                tra(ji,jj,jk,jpdom) = tra(ji,jj,jk,jpdom) + zdoma
 
-
-               IF( ( ln_diabio .AND. .NOT. lk_iomput ) .OR. l_trdtrc ) THEN
-                  trbio(ji,jj,jk,jp_pcs0_trd     ) = zno3phy
-                  trbio(ji,jj,jk,jp_pcs0_trd +  1) = znh4phy
-                  trbio(ji,jj,jk,jp_pcs0_trd +  2) = zphynh4
-                  trbio(ji,jj,jk,jp_pcs0_trd +  3) = zphydom
-                  trbio(ji,jj,jk,jp_pcs0_trd +  4) = zphyzoo
-                  trbio(ji,jj,jk,jp_pcs0_trd +  5) = zphydet
-                  trbio(ji,jj,jk,jp_pcs0_trd +  6) = zdetzoo
-                  !  trend number 8 in p2zsed
-                  trbio(ji,jj,jk,jp_pcs0_trd +  8) = zzoodet
-                  trbio(ji,jj,jk,jp_pcs0_trd +  9) = zzoobod
-                  trbio(ji,jj,jk,jp_pcs0_trd + 10) = zzoonh4
-                  trbio(ji,jj,jk,jp_pcs0_trd + 11) = zzoodom
-                  trbio(ji,jj,jk,jp_pcs0_trd + 12) = znh4no3
-                  trbio(ji,jj,jk,jp_pcs0_trd + 13) = zdomnh4
-                  trbio(ji,jj,jk,jp_pcs0_trd + 14) = zdetnh4
-                  trbio(ji,jj,jk,jp_pcs0_trd + 15) = zdetdom
-                  !  trend number 17 in p2zexp
-                ENDIF
-                IF( ln_diatrc .OR. lk_iomput ) THEN
+                IF( lk_iomput ) THEN
                   ! convert fluxes in per day
                   ze3t = e3t_n(ji,jj,jk) * 86400._wp
@@ -340,24 +314,5 @@
                tra(ji,jj,jk,jpdom) = tra(ji,jj,jk,jpdom) + zdoma
                !
-               IF( ( ln_diabio .AND. .NOT. lk_iomput ) .OR. l_trdtrc ) THEN
-                  trbio(ji,jj,jk,jp_pcs0_trd     ) = zno3phy
-                  trbio(ji,jj,jk,jp_pcs0_trd +  1) = znh4phy
-                  trbio(ji,jj,jk,jp_pcs0_trd +  2) = zphynh4
-                  trbio(ji,jj,jk,jp_pcs0_trd +  3) = zphydom
-                  trbio(ji,jj,jk,jp_pcs0_trd +  4) = zphyzoo
-                  trbio(ji,jj,jk,jp_pcs0_trd +  5) = zphydet
-                  trbio(ji,jj,jk,jp_pcs0_trd +  6) = zdetzoo
-                  !  trend number 8 in p2zsed
-                  trbio(ji,jj,jk,jp_pcs0_trd +  8) = zzoodet
-                  trbio(ji,jj,jk,jp_pcs0_trd +  9) = zzoobod
-                  trbio(ji,jj,jk,jp_pcs0_trd + 10) = zzoonh4
-                  trbio(ji,jj,jk,jp_pcs0_trd + 11) = zzoodom
-                  trbio(ji,jj,jk,jp_pcs0_trd + 12) = znh4no3
-                  trbio(ji,jj,jk,jp_pcs0_trd + 13) = zdomnh4
-                  trbio(ji,jj,jk,jp_pcs0_trd + 14) = zdetnh4
-                  trbio(ji,jj,jk,jp_pcs0_trd + 15) = zdetdom
-                  !  trend number 17 in p2zexp 
-                ENDIF
-                IF( ln_diatrc .OR. lk_iomput ) THEN
+                IF( lk_iomput ) THEN
                   ! convert fluxes in per day
                   ze3t = e3t_n(ji,jj,jk) * 86400._wp
@@ -389,5 +344,5 @@
       END DO
 
-      IF( ln_diatrc .OR. lk_iomput ) THEN
+      IF( lk_iomput ) THEN
          DO jl = 1, 17 
             CALL lbc_lnk( zw2d(:,:,jl),'T', 1. )
@@ -420,43 +375,4 @@
         CALL iom_put( "FNH4NO3", zw3d(:,:,:,3) )
          !
-       ELSE
-          IF( ln_diatrc ) THEN
-            !
-            trc2d(:,:,jp_pcs0_2d    ) = zw2d(:,:,1) 
-            trc2d(:,:,jp_pcs0_2d + 1) = zw2d(:,:,2) 
-            trc2d(:,:,jp_pcs0_2d + 2) = zw2d(:,:,3) 
-            trc2d(:,:,jp_pcs0_2d + 3) = zw2d(:,:,4) 
-            trc2d(:,:,jp_pcs0_2d + 4) = zw2d(:,:,5) 
-            trc2d(:,:,jp_pcs0_2d + 5) = zw2d(:,:,6) 
-            trc2d(:,:,jp_pcs0_2d + 6) = zw2d(:,:,7) 
-                     ! trend number 8 is in p2zsed.F
-            trc2d(:,:,jp_pcs0_2d +  8) = zw2d(:,:,8) 
-            trc2d(:,:,jp_pcs0_2d +  9) = zw2d(:,:,9) 
-            trc2d(:,:,jp_pcs0_2d + 10) = zw2d(:,:,10) 
-            trc2d(:,:,jp_pcs0_2d + 11) = zw2d(:,:,11) 
-            trc2d(:,:,jp_pcs0_2d + 12) = zw2d(:,:,12) 
-            trc2d(:,:,jp_pcs0_2d + 13) = zw2d(:,:,13) 
-            trc2d(:,:,jp_pcs0_2d + 14) = zw2d(:,:,14) 
-            trc2d(:,:,jp_pcs0_2d + 15) = zw2d(:,:,15) 
-            trc2d(:,:,jp_pcs0_2d + 16) = zw2d(:,:,16) 
-            trc2d(:,:,jp_pcs0_2d + 17) = zw2d(:,:,17) 
-            ! trend number 19 is in p2zexp.F
-            trc3d(:,:,:,jp_pcs0_3d    ) = zw3d(:,:,:,1) 
-            trc3d(:,:,:,jp_pcs0_3d + 1) = zw3d(:,:,:,2) 
-            trc3d(:,:,:,jp_pcs0_3d + 2) = zw3d(:,:,:,3) 
-         ENDIF
-        !
-      ENDIF
-
-      IF( ln_diabio .AND. .NOT. lk_iomput )  THEN
-         DO jl = jp_pcs0_trd, jp_pcs1_trd
-            CALL lbc_lnk( trbio(:,:,1,jl),'T', 1. )
-         END DO 
-      ENDIF
-      !
-      IF( l_trdtrc ) THEN
-         DO jl = jp_pcs0_trd, jp_pcs1_trd
-            CALL trd_trc( trbio(:,:,:,jl), jl, kt )   ! handle the trend
-         END DO
       ENDIF
 
@@ -467,5 +383,5 @@
       ENDIF
       !
-      IF( ln_diatrc .OR. lk_iomput ) THEN
+      IF( lk_iomput ) THEN
          CALL wrk_dealloc( jpi, jpj,     17, zw2d )
          CALL wrk_dealloc( jpi, jpj, jpk, 3, zw3d )
@@ -586,15 +502,4 @@
    END SUBROUTINE p2z_bio_init
 
-#else
-   !!======================================================================
-   !!  Dummy module :                                   No PISCES bio-model
-   !!======================================================================
-CONTAINS
-   SUBROUTINE p2z_bio( kt )                   ! Empty routine
-      INTEGER, INTENT( in ) ::   kt
-      WRITE(*,*) 'p2z_bio: You should not have seen this print! error?', kt
-   END SUBROUTINE p2z_bio
-#endif 
-
    !!======================================================================
 END MODULE p2zbio
Index: branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/NEMO/TOP_SRC/PISCES/P2Z/p2zexp.F90
===================================================================
--- branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/NEMO/TOP_SRC/PISCES/P2Z/p2zexp.F90	(revision 7383)
+++ branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/NEMO/TOP_SRC/PISCES/P2Z/p2zexp.F90	(revision 7391)
@@ -10,8 +10,4 @@
    !!             3.5  !  2012-03  (C. Ethe)  Merge PISCES-LOBSTER
    !!----------------------------------------------------------------------
-#if defined key_pisces_reduced
-   !!----------------------------------------------------------------------
-   !!   'key_pisces_reduced'                                     LOBSTER bio-model
-   !!----------------------------------------------------------------------
    !!   p2z_exp        :  Compute loss of organic matter in the sediments
    !!----------------------------------------------------------------------
@@ -68,5 +64,4 @@
       INTEGER  ::   ji, jj, jk, jl, ikt
       REAL(wp) ::   zgeolpoc, zfact, zwork, ze3t, zsedpocd, zmaskt
-      REAL(wp), POINTER, DIMENSION(:,:,:) ::  ztrbio
       REAL(wp), POINTER, DIMENSION(:,:)   ::  zsedpoca
       CHARACTER (len=25) :: charout
@@ -80,8 +75,4 @@
       zsedpoca(:,:) = 0.
 
-      IF( l_trdtrc )  THEN
-         CALL wrk_alloc( jpi, jpj, jpk, ztrbio )   ! temporary save of trends
-         ztrbio(:,:,:) = tra(:,:,:,jpno3)
-      ENDIF
 
       ! VERTICAL DISTRIBUTION OF NEWLY PRODUCED BIOGENIC
@@ -126,9 +117,5 @@
  
       ! Oa & Ek: diagnostics depending on jpdia2d !          left as example
-      IF( lk_iomput ) THEN  
-         CALL iom_put( "SEDPOC" , sedpocn )
-      ELSE
-         IF( ln_diatrc )           trc2d(:,:,jp_pcs0_2d + 18) = sedpocn(:,:)
-      ENDIF
+      IF( lk_iomput )  CALL iom_put( "SEDPOC" , sedpocn )
 
       
@@ -160,11 +147,4 @@
       ENDIF
       !
-      IF( l_trdtrc ) THEN
-         ztrbio(:,:,:) = tra(:,:,:,jpno3) - ztrbio(:,:,:)
-         jl = jp_pcs0_trd + 16
-         CALL trd_trc( ztrbio, jl, kt )   ! handle the trend
-         CALL wrk_dealloc( jpi, jpj, jpk, ztrbio )   ! temporary save of trends
-      ENDIF
-      !
       CALL wrk_dealloc( jpi, jpj, zsedpoca)   ! temporary save of trends
 
@@ -281,15 +261,4 @@
    END FUNCTION p2z_exp_alloc
 
-#else
-   !!======================================================================
-   !!  Dummy module :                                   No PISCES bio-model
-   !!======================================================================
-CONTAINS
-   SUBROUTINE p2z_exp( kt )                   ! Empty routine
-      INTEGER, INTENT( in ) ::   kt
-      WRITE(*,*) 'p2z_exp: You should not have seen this print! error?', kt
-   END SUBROUTINE p2z_exp
-#endif 
-
    !!======================================================================
 END MODULE  p2zexp
Index: branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/NEMO/TOP_SRC/PISCES/P2Z/p2zopt.F90
===================================================================
--- branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/NEMO/TOP_SRC/PISCES/P2Z/p2zopt.F90	(revision 7383)
+++ branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/NEMO/TOP_SRC/PISCES/P2Z/p2zopt.F90	(revision 7391)
@@ -10,8 +10,4 @@
    !!   NEMO      2.0  !  2007-12  (C. Deltel, G. Madec)  F90
    !!             3.2  !  2009-04  (C. Ethe, G. Madec)  minor optimisation + style
-   !!----------------------------------------------------------------------
-#if defined key_pisces_reduced
-   !!----------------------------------------------------------------------
-   !!   'key_pisces_reduced'                                     LOBSTER bio-model
    !!----------------------------------------------------------------------
    !!   p2z_opt        :   Compute the light availability in the water column
@@ -208,15 +204,4 @@
    END SUBROUTINE p2z_opt_init
 
-#else
-   !!======================================================================
-   !!  Dummy module :                                   No PISCES bio-model
-   !!======================================================================
-CONTAINS
-   SUBROUTINE p2z_opt( kt )                   ! Empty routine
-      INTEGER, INTENT( in ) ::   kt
-      WRITE(*,*) 'p2z_opt: You should not have seen this print! error?', kt
-   END SUBROUTINE p2z_opt
-#endif 
-
    !!======================================================================
 END MODULE  p2zopt
Index: branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/NEMO/TOP_SRC/PISCES/P2Z/p2zsed.F90
===================================================================
--- branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/NEMO/TOP_SRC/PISCES/P2Z/p2zsed.F90	(revision 7383)
+++ branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/NEMO/TOP_SRC/PISCES/P2Z/p2zsed.F90	(revision 7391)
@@ -7,8 +7,4 @@
    !!              -   !  2000-12 (E. Kestenare)  clean up
    !!             2.0  !  2007-12  (C. Deltel, G. Madec)  F90 + simplifications
-   !!----------------------------------------------------------------------
-#if defined key_pisces_reduced
-   !!----------------------------------------------------------------------
-   !!   'key_pisces_reduced'                                     LOBSTER bio-model
    !!----------------------------------------------------------------------
    !!   p2z_sed        :  Compute loss of organic matter in the sediments
@@ -66,5 +62,5 @@
       CHARACTER (len=25) :: charout
       REAL(wp), POINTER, DIMENSION(:,:  ) :: zw2d
-      REAL(wp), POINTER, DIMENSION(:,:,:) :: zwork, ztra, ztrbio
+      REAL(wp), POINTER, DIMENSION(:,:,:) :: zwork, ztra
       !!---------------------------------------------------------------------
       !
@@ -79,8 +75,4 @@
       ! Allocate temporary workspace
       CALL wrk_alloc( jpi, jpj, jpk, zwork, ztra )
-      IF( l_trdtrc ) THEN
-         CALL wrk_alloc( jpi, jpj, jpk, ztrbio )
-         ztrbio(:,:,:) = tra(:,:,:,jpdet)
-      ENDIF
 
       ! sedimentation of detritus  : upstream scheme
@@ -116,25 +108,8 @@
             CALL wrk_dealloc( jpi, jpj, zw2d )
          ENDIF
-      ELSE
-         IF( ln_diatrc ) THEN 
-            CALL wrk_alloc( jpi, jpj, zw2d )
-            zw2d(:,:) =  ztra(:,:,1) * e3t_n(:,:,1) * 86400._wp
-            DO jk = 2, jpkm1
-               zw2d(:,:) = zw2d(:,:) + ztra(:,:,jk) * e3t_n(:,:,jk) * 86400._wp
-            END DO
-            trc2d(:,:,jp_pcs0_2d + 7) = zw2d(:,:)
-            CALL wrk_dealloc( jpi, jpj, zw2d )
-         ENDIF
       ENDIF
       !
-      IF( ln_diabio .AND. .NOT. lk_iomput )  trbio(:,:,:,jp_pcs0_trd + 7) = ztra(:,:,:)
       CALL wrk_dealloc( jpi, jpj, jpk, zwork, ztra )
       !
-      IF( l_trdtrc ) THEN
-         ztrbio(:,:,:) = tra(:,:,:,jpdet) - ztrbio(:,:,:)
-         jl = jp_pcs0_trd + 7
-         CALL trd_trc( ztrbio, jl, kt )   ! handle the trend
-         CALL wrk_dealloc( jpi, jpj, jpk, ztrbio )
-      ENDIF
 
       IF(ln_ctl)   THEN  ! print mean trends (used for debugging)
@@ -180,15 +155,4 @@
    END SUBROUTINE p2z_sed_init
 
-#else
-   !!======================================================================
-   !!  Dummy module :                                   No PISCES bio-model
-   !!======================================================================
-CONTAINS
-   SUBROUTINE p2z_sed( kt )                   ! Empty routine
-      INTEGER, INTENT( in ) ::   kt
-      WRITE(*,*) 'p2z_sed: You should not have seen this print! error?', kt
-   END SUBROUTINE p2z_sed
-#endif 
-
    !!======================================================================
 END MODULE  p2zsed
Index: branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/NEMO/TOP_SRC/PISCES/P2Z/p2zsms.F90
===================================================================
--- branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/NEMO/TOP_SRC/PISCES/P2Z/p2zsms.F90	(revision 7383)
+++ branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/NEMO/TOP_SRC/PISCES/P2Z/p2zsms.F90	(revision 7391)
@@ -6,8 +6,4 @@
    !! History :   1.0  !            M. Levy
    !!             2.0  !  2007-12  (C. Ethe, G. Madec)  revised architecture
-   !!----------------------------------------------------------------------
-#if defined key_pisces_reduced
-   !!----------------------------------------------------------------------
-   !!   'key_pisces_reduced'                              LOBSTER bio-model
    !!----------------------------------------------------------------------
    !!   p2zsms        :  Time loop of passive tracers sms
@@ -72,15 +68,4 @@
    END SUBROUTINE p2z_sms
 
-#else
-   !!======================================================================
-   !!  Dummy module :                                     No passive tracer
-   !!======================================================================
-CONTAINS
-   SUBROUTINE p2z_sms( kt )                   ! Empty routine
-      INTEGER, INTENT( in ) ::   kt
-      WRITE(*,*) 'p2z_sms: You should not have seen this print! error?', kt
-   END SUBROUTINE p2z_sms
-#endif 
-
    !!======================================================================
 END MODULE p2zsms
Index: branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/NEMO/TOP_SRC/PISCES/P4Z/p4zagg.F90
===================================================================
--- branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/NEMO/TOP_SRC/PISCES/P4Z/p4zagg.F90	(revision 7391)
+++ branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/NEMO/TOP_SRC/PISCES/P4Z/p4zagg.F90	(revision 7391)
@@ -0,0 +1,185 @@
+MODULE p4zagg
+   !!======================================================================
+   !!                         ***  MODULE p4zagg  ***
+   !! TOP :  PISCES  aggregation of particles
+   !!======================================================================
+   !! History :   1.0  !  2004     (O. Aumont) Original code
+   !!             2.0  !  2007-12  (C. Ethe, G. Madec)  F90
+   !!             3.4  !  2011-06  (O. Aumont, C. Ethe) Change aggregation formula
+   !!             3.5  !  2012-07  (O. Aumont) Introduce potential time-splitting
+   !!             3.6  !  2015-05  (O. Aumont) PISCES quota
+   !!----------------------------------------------------------------------
+   !!----------------------------------------------------------------------
+   !!   p4z_agg       :  Compute aggregation of particles
+   !!----------------------------------------------------------------------
+   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
+
+   IMPLICIT NONE
+   PRIVATE
+
+   PUBLIC   p4z_agg         ! called in p4zbio.F90
+
+   !!----------------------------------------------------------------------
+   !! NEMO/TOP 3.3 , NEMO Consortium (2010)
+   !! $Id: p4zagg.F90 3160 2011-11-20 14:27:18Z cetlod $ 
+   !! Software governed by the CeCILL licence     (NEMOGCM/NEMO_CeCILL.txt)
+   !!----------------------------------------------------------------------
+CONTAINS
+
+   SUBROUTINE p4z_agg ( kt, knt )
+      !!---------------------------------------------------------------------
+      !!                     ***  ROUTINE p4z_agg  ***
+      !!
+      !! ** Purpose :   Compute aggregation of particles
+      !!
+      !! ** Method  : - ???
+      !!---------------------------------------------------------------------
+      INTEGER, INTENT(in) :: kt, knt
+      INTEGER  ::   ji, jj, jk
+      REAL(wp) ::   zagg, zagg1, zagg2, zagg3, zagg4
+      REAL(wp) ::   zaggpoc1, zaggpoc2, zaggpoc3, zaggpoc4
+      REAL(wp) ::   zaggpoc , zaggfe, zaggdoc, zaggdoc2, zaggdoc3
+      REAL(wp) ::   zaggpon , zaggdon, zaggdon2, zaggdon3
+      REAL(wp) ::   zaggpop, zaggdop, zaggdop2, zaggdop3
+      REAL(wp) ::   zaggtmp, zfact, zmax
+      CHARACTER (len=25) :: charout
+      !!---------------------------------------------------------------------
+      !
+      IF( nn_timing == 1 )  CALL timing_start('p4z_agg')
+
+      !
+      !  Exchange between organic matter compartments due to coagulation/disaggregation
+      !  ---------------------------------------------------
+      IF( ln_p4z ) THEN
+         !
+         DO jk = 1, jpkm1
+            DO jj = 1, jpj
+               DO ji = 1, jpi
+                  !
+                  zfact = xstep * xdiss(ji,jj,jk)
+                  !  Part I : Coagulation dependent on turbulence
+                  zagg1 = 25.9  * zfact * trb(ji,jj,jk,jppoc) * trb(ji,jj,jk,jppoc)
+                  zagg2 = 4452. * zfact * trb(ji,jj,jk,jppoc) * trb(ji,jj,jk,jpgoc)
+
+                  ! Part II : Differential settling
+
+                  !  Aggregation of small into large particles
+                  zagg3 =  47.1 * xstep * trb(ji,jj,jk,jppoc) * trb(ji,jj,jk,jpgoc)
+                  zagg4 =  3.3  * xstep * trb(ji,jj,jk,jppoc) * trb(ji,jj,jk,jppoc)
+
+                  zagg   = zagg1 + zagg2 + zagg3 + zagg4
+                  zaggfe = zagg * trb(ji,jj,jk,jpsfe) / ( trb(ji,jj,jk,jppoc) + rtrn )
+
+                  ! Aggregation of DOC to POC : 
+                  ! 1st term is shear aggregation of DOC-DOC
+                  ! 2nd term is shear aggregation of DOC-POC
+                  ! 3rd term is differential settling of DOC-POC
+                  zaggdoc  = ( ( 0.369 * 0.3 * trb(ji,jj,jk,jpdoc) + 102.4 * trb(ji,jj,jk,jppoc) ) * zfact       &
+                  &            + 2.4 * xstep * trb(ji,jj,jk,jppoc) ) * 0.3 * trb(ji,jj,jk,jpdoc)
+                  ! transfer of DOC to GOC : 
+                  ! 1st term is shear aggregation
+                  ! 2nd term is differential settling 
+                  zaggdoc2 = ( 3.53E3 * zfact + 0.1 * xstep ) * trb(ji,jj,jk,jpgoc) * 0.3 * trb(ji,jj,jk,jpdoc)
+                  ! tranfer of DOC to POC due to brownian motion
+                  zaggdoc3 =  114. * 0.3 * trb(ji,jj,jk,jpdoc) *xstep * 0.3 * trb(ji,jj,jk,jpdoc)
+
+                  !  Update the trends
+                  tra(ji,jj,jk,jppoc) = tra(ji,jj,jk,jppoc) - zagg + zaggdoc + zaggdoc3
+                  tra(ji,jj,jk,jpgoc) = tra(ji,jj,jk,jpgoc) + zagg + zaggdoc2
+                  tra(ji,jj,jk,jpsfe) = tra(ji,jj,jk,jpsfe) - zaggfe
+                  tra(ji,jj,jk,jpbfe) = tra(ji,jj,jk,jpbfe) + zaggfe
+                  tra(ji,jj,jk,jpdoc) = tra(ji,jj,jk,jpdoc) - zaggdoc - zaggdoc2 - zaggdoc3
+                  !
+                  conspoc(ji,jj,jk) = conspoc(ji,jj,jk) - zagg + zaggdoc + zaggdoc3
+                  prodgoc(ji,jj,jk) = prodgoc(ji,jj,jk) + zagg + zaggdoc2
+                  !
+               END DO
+            END DO
+         END DO
+      ELSE    ! ln_p5z
+        !
+         DO jk = 1, jpkm1
+            DO jj = 1, jpj
+               DO ji = 1, jpi
+                  !
+                  zfact = xstep * xdiss(ji,jj,jk)
+                  !  Part I : Coagulation dependent on turbulence
+                  zaggtmp = 25.9  * zfact * trb(ji,jj,jk,jppoc)
+                  zaggpoc1 = zaggtmp * trb(ji,jj,jk,jppoc)
+                  zaggtmp = 4452. * zfact * trb(ji,jj,jk,jpgoc)
+                  zaggpoc2 = zaggtmp * trb(ji,jj,jk,jppoc)
+
+                  ! Part II : Differential settling
+   
+                  !  Aggregation of small into large particles
+                  zaggtmp =  47.1 * xstep * trb(ji,jj,jk,jpgoc)
+                  zaggpoc3 = zaggtmp * trb(ji,jj,jk,jppoc)
+                  zaggtmp =  3.3  * xstep * trb(ji,jj,jk,jppoc)
+                  zaggpoc4 = zaggtmp * trb(ji,jj,jk,jppoc)
+
+                  zaggpoc   = zaggpoc1 + zaggpoc2 + zaggpoc3 + zaggpoc4
+                  zaggpon = zaggpoc * trb(ji,jj,jk,jppon) / ( trb(ji,jj,jk,jppoc) + rtrn)
+                  zaggpop = zaggpoc * trb(ji,jj,jk,jppop) / ( trb(ji,jj,jk,jppoc) + rtrn)
+                  zaggfe = zaggpoc * trb(ji,jj,jk,jpsfe) / ( trb(ji,jj,jk,jppoc)  + rtrn )
+
+                  ! Aggregation of DOC to POC : 
+                  ! 1st term is shear aggregation of DOC-DOC
+                  ! 2nd term is shear aggregation of DOC-POC
+                  ! 3rd term is differential settling of DOC-POC
+                  zaggtmp = ( ( 0.369 * 0.3 * trb(ji,jj,jk,jpdoc) + 102.4 * trb(ji,jj,jk,jppoc) ) * zfact       &
+                  &            + 2.4 * xstep * trb(ji,jj,jk,jppoc) )
+                  zaggdoc  = zaggtmp * 0.3 * trb(ji,jj,jk,jpdoc)
+                  zaggdon  = zaggtmp * 0.3 * trb(ji,jj,jk,jpdon)
+                  zaggdop  = zaggtmp * 0.3 * trb(ji,jj,jk,jpdop)
+
+                  ! transfer of DOC to GOC : 
+                  ! 1st term is shear aggregation
+                  ! 2nd term is differential settling 
+                  zaggtmp = ( 3.53E3 * zfact + 0.1 * xstep ) * trb(ji,jj,jk,jpgoc)
+                  zaggdoc2 = zaggtmp * 0.3 * trb(ji,jj,jk,jpdoc)
+                  zaggdon2 = zaggtmp * 0.3 * trb(ji,jj,jk,jpdon)
+                  zaggdop2 = zaggtmp * 0.3 * trb(ji,jj,jk,jpdop)
+
+                  ! tranfer of DOC to POC due to brownian motion
+                  zaggtmp = ( 114. * 0.3 * trb(ji,jj,jk,jpdoc) ) * xstep
+                  zaggdoc3 =  zaggtmp * 0.3 * trb(ji,jj,jk,jpdoc)
+                  zaggdon3 =  zaggtmp * 0.3 * trb(ji,jj,jk,jpdon)
+                  zaggdop3 =  zaggtmp * 0.3 * trb(ji,jj,jk,jpdop)
+
+                  !  Update the trends
+                  tra(ji,jj,jk,jppoc) = tra(ji,jj,jk,jppoc) - zaggpoc + zaggdoc + zaggdoc3
+                  tra(ji,jj,jk,jppon) = tra(ji,jj,jk,jppon) - zaggpon + zaggdon + zaggdon3
+                  tra(ji,jj,jk,jppop) = tra(ji,jj,jk,jppop) - zaggpop + zaggdop + zaggdop3
+                  tra(ji,jj,jk,jpgoc) = tra(ji,jj,jk,jpgoc) + zaggpoc + zaggdoc2
+                  tra(ji,jj,jk,jpgon) = tra(ji,jj,jk,jpgon) + zaggpon + zaggdon2
+                  tra(ji,jj,jk,jpgop) = tra(ji,jj,jk,jpgop) + zaggpop + zaggdop2
+                  tra(ji,jj,jk,jpsfe) = tra(ji,jj,jk,jpsfe) - zaggfe
+                  tra(ji,jj,jk,jpbfe) = tra(ji,jj,jk,jpbfe) + zaggfe
+                  tra(ji,jj,jk,jpdoc) = tra(ji,jj,jk,jpdoc) - zaggdoc - zaggdoc2 - zaggdoc3
+                  tra(ji,jj,jk,jpdon) = tra(ji,jj,jk,jpdon) - zaggdon - zaggdon2 - zaggdon3
+                  tra(ji,jj,jk,jpdop) = tra(ji,jj,jk,jpdop) - zaggdop - zaggdop2 - zaggdop3
+                  !
+                  conspoc(ji,jj,jk) = conspoc(ji,jj,jk) - zaggpoc + zaggdoc + zaggdoc3
+                  prodgoc(ji,jj,jk) = prodgoc(ji,jj,jk) + zaggpoc + zaggdoc2
+                  !
+               END DO
+            END DO
+         END DO
+         !
+      ENDIF
+      !
+      IF(ln_ctl)   THEN  ! print mean trends (used for debugging)
+         WRITE(charout, FMT="('agg')")
+         CALL prt_ctl_trc_info(charout)
+         CALL prt_ctl_trc(tab4d=tra, mask=tmask, clinfo=ctrcnm)
+      ENDIF
+      !
+      IF( nn_timing == 1 )  CALL timing_stop('p4z_agg')
+      !
+   END SUBROUTINE p4z_agg
+
+   !!======================================================================
+END MODULE p4zagg
Index: branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/NEMO/TOP_SRC/PISCES/P4Z/p4zbio.F90
===================================================================
--- branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/NEMO/TOP_SRC/PISCES/P4Z/p4zbio.F90	(revision 7383)
+++ branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/NEMO/TOP_SRC/PISCES/P4Z/p4zbio.F90	(revision 7391)
@@ -6,8 +6,4 @@
    !! History :   1.0  !  2004     (O. Aumont) Original code
    !!             2.0  !  2007-12  (C. Ethe, G. Madec)  F90
-   !!----------------------------------------------------------------------
-#if defined key_pisces
-   !!----------------------------------------------------------------------
-   !!   'key_pisces'                                       PISCES bio-model
    !!----------------------------------------------------------------------
    !!   p4z_bio        :   computes the interactions between the different
@@ -24,6 +20,14 @@
    USE p4zmicro        !  Sources and sinks of microzooplankton
    USE p4zmeso         !  Sources and sinks of mesozooplankton
+   USE p5zlim          !  Co-limitations of differents nutrients
+   USE p5zprod         !  Growth rate of the 2 phyto groups
+   USE p5zmort         !  Mortality terms for phytoplankton
+   USE p5zmicro        !  Sources and sinks of microzooplankton
+   USE p5zmeso         !  Sources and sinks of mesozooplankton
    USE p4zrem          !  Remineralisation of organic matter
+   USE p4zpoc          !  Remineralization of organic particles
+   USE p4zagg          !  Aggregation of particles
    USE p4zfechem
+   USE p4zligand       !  Prognostic ligand model
    USE prtctl_trc      !  print control for debugging
    USE iom             !  I/O manager
@@ -73,16 +77,32 @@
       END DO
 
-      CALL p4z_opt  ( kt, knt )     ! Optic: PAR in the water column
-      CALL p4z_sink ( kt, knt )     ! vertical flux of particulate organic matter
-      CALL p4z_fechem(kt, knt )     ! Iron chemistry/scavenging
-      CALL p4z_lim  ( kt, knt )     ! co-limitations by the various nutrients
-      CALL p4z_prod ( kt, knt )     ! phytoplankton growth rate over the global ocean. 
-      !                             ! (for each element : C, Si, Fe, Chl )
-      CALL p4z_mort ( kt      )     ! phytoplankton mortality
-     !                             ! zooplankton sources/sinks routines 
-      CALL p4z_micro( kt, knt )           ! microzooplankton
-      CALL p4z_meso ( kt, knt )           ! mesozooplankton
-      CALL p4z_rem  ( kt, knt )     ! remineralization terms of organic matter+scavenging of Fe
-      !                             ! test if tracers concentrations fall below 0.
+      CALL p4z_opt     ( kt, knt )     ! Optic: PAR in the water column
+      CALL p4z_sink    ( kt, knt )     ! vertical flux of particulate organic matter
+      CALL p4z_fechem  ( kt, knt )     ! Iron chemistry/scavenging
+      !
+      IF( ln_p4z ) THEN
+         CALL p4z_lim  ( kt, knt )     ! co-limitations by the various nutrients
+         CALL p4z_prod ( kt, knt )     ! phytoplankton growth rate over the global ocean. 
+         !                             ! (for each element : C, Si, Fe, Chl )
+         CALL p4z_mort ( kt      )     ! phytoplankton mortality
+         !                             ! zooplankton sources/sinks routines 
+         CALL p4z_micro( kt, knt )           ! microzooplankton
+         CALL p4z_meso ( kt, knt )           ! mesozooplankton
+      ELSE
+         CALL p5z_lim  ( kt, knt )     ! co-limitations by the various nutrients
+         CALL p5z_prod ( kt, knt )     ! phytoplankton growth rate over the global ocean. 
+         !                             ! (for each element : C, Si, Fe, Chl )
+         CALL p5z_mort ( kt      )     ! phytoplankton mortality
+         !                             ! zooplankton sources/sinks routines 
+         CALL p5z_micro( kt, knt )           ! microzooplankton
+         CALL p5z_meso ( kt, knt )           ! mesozooplankton
+      ENDIF
+      !
+      CALL p4z_agg  ( kt, knt )     ! Aggregation of particles
+      CALL p4z_rem     ( kt, knt )     ! remineralization terms of organic matter+scavenging of Fe
+      CALL p4z_poc     ( kt, knt )     ! Remineralization of organic particles
+      IF( ln_ligand ) THEN
+        CALL p4z_ligand( kt, knt )
+      ENDIF
       !                                                             !
       IF(ln_ctl)   THEN  ! print mean trends (used for debugging)
@@ -96,13 +116,4 @@
    END SUBROUTINE p4z_bio
 
-#else
-   !!======================================================================
-   !!  Dummy module :                                   No PISCES bio-model
-   !!======================================================================
-CONTAINS
-   SUBROUTINE p4z_bio                         ! Empty routine
-   END SUBROUTINE p4z_bio
-#endif 
-
    !!======================================================================
 END MODULE p4zbio
Index: branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/NEMO/TOP_SRC/PISCES/P4Z/p4zche.F90
===================================================================
--- branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/NEMO/TOP_SRC/PISCES/P4Z/p4zche.F90	(revision 7383)
+++ branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/NEMO/TOP_SRC/PISCES/P4Z/p4zche.F90	(revision 7391)
@@ -11,8 +11,5 @@
    !!             2.0  !  2007-12  (C. Ethe, G. Madec)  F90
    !!                  !  2011-02  (J. Simeon, J.Orr ) update O2 solubility constants
-   !!----------------------------------------------------------------------
-#if defined key_pisces
-   !!----------------------------------------------------------------------
-   !!   'key_pisces'                                       PISCES bio-model
+   !!             3.6  !  2016-03  (O. Aumont) Change chemistry to MOCSY standards
    !!----------------------------------------------------------------------
    !!   p4z_che      :  Sea water chemistry computed following OCMIP protocol
@@ -22,78 +19,115 @@
    USE sms_pisces    !  PISCES Source Minus Sink variables
    USE lib_mpp       !  MPP library
+   USE eosbn2, ONLY : neos
 
    IMPLICIT NONE
    PRIVATE
 
-   PUBLIC   p4z_che         !
-   PUBLIC   p4z_che_alloc   !
-
-   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::   sio3eq   ! chemistry of Si
-   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::   fekeq    ! chemistry of Fe
-   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::   chemc    ! Solubilities of O2 and CO2
-   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::   chemo2   ! Solubilities of O2 and CO2
+   PUBLIC   p4z_che          !
+   PUBLIC   p4z_che_alloc    !
+   PUBLIC   ahini_for_at     !
+   PUBLIC   solve_at_general !
+
+   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:)   :: sio3eq   ! chemistry of Si
+   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:)   :: fekeq    ! chemistry of Fe
+   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:)   :: chemc    ! Solubilities of O2 and CO2
+   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:)   :: chemo2    ! Solubilities of O2 and CO2
+   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:,:) :: fesol    ! solubility of Fe
    REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::   tempis   ! In situ temperature
+   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::   salinprac  ! Practical salinity
+
+   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::   akb3       !: ???
+   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::   akw3       !: ???
+   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::   akf3       !: ???
+   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::   aks3       !: ???
+   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::   ak1p3      !: ???
+   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::   ak2p3      !: ???
+   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::   ak3p3      !: ???
+   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::   aksi3      !: ???
+   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::   borat      !: ???
+   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::   fluorid    !: ???
+   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::   sulfat     !: ???
+
+   !!* Variable for chemistry of the CO2 cycle
 
    REAL(wp), PUBLIC ::   atcox  = 0.20946         ! units atm
 
-   REAL(wp) ::   salchl = 1. / 1.80655    ! conversion factor for salinity --> chlorinity (Wooster et al. 1969)
    REAL(wp) ::   o2atm  = 1. / ( 1000. * 0.20946 )  
 
-   REAL(wp) ::   rgas   = 83.14472       ! universal gas constants
-   REAL(wp) ::   oxyco  = 1. / 22.4144   ! converts from liters of an ideal gas to moles
-
-   REAL(wp) ::   bor1   = 0.00023        ! borat constants
-   REAL(wp) ::   bor2   = 1. / 10.82
-
-   REAL(wp) ::   st1    =      0.14     ! constants for calculate concentrations for sulfate
-   REAL(wp) ::   st2    =  1./96.062    !  (Morris & Riley 1966)
-
-   REAL(wp) ::   ft1    =    0.000067   ! constants for calculate concentrations for fluorides
-   REAL(wp) ::   ft2    = 1./18.9984    ! (Dickson & Riley 1979 )
-
-   !                                    ! volumetric solubility constants for o2 in ml/L  
-   REAL(wp) ::   ox0    =  2.00856      ! from Table 1 for Eq 8 of Garcia and Gordon, 1992.
-   REAL(wp) ::   ox1    =  3.22400      ! corrects for moisture and fugacity, but not total atmospheric pressure
-   REAL(wp) ::   ox2    =  3.99063      !      Original PISCES code noted this was a solubility, but 
-   REAL(wp) ::   ox3    =  4.80299      ! was in fact a bunsen coefficient with units L-O2/(Lsw atm-O2)
-   REAL(wp) ::   ox4    =  9.78188e-1   ! Hence, need to divide EXP( zoxy ) by 1000, ml-O2 => L-O2
-   REAL(wp) ::   ox5    =  1.71069      ! and atcox = 0.20946 to add the 1/atm dimension.
-   REAL(wp) ::   ox6    = -6.24097e-3   
-   REAL(wp) ::   ox7    = -6.93498e-3 
-   REAL(wp) ::   ox8    = -6.90358e-3
-   REAL(wp) ::   ox9    = -4.29155e-3 
-   REAL(wp) ::   ox10   = -3.11680e-7 
+   REAL(wp) ::   rgas   = 83.14472      ! universal gas constants
+   REAL(wp) ::   oxyco  = 1. / 22.4144  ! converts from liters of an ideal gas to moles
 
    !                                    ! coeff. for seawater pressure correction : millero 95
    !                                    ! AGRIF doesn't like the DATA instruction
-   REAL(wp) :: devk11  = -25.5
-   REAL(wp) :: devk12  = -15.82
-   REAL(wp) :: devk13  = -29.48
-   REAL(wp) :: devk14  = -25.60
-   REAL(wp) :: devk15  = -48.76
+   REAL(wp) :: devk10  = -25.5
+   REAL(wp) :: devk11  = -15.82
+   REAL(wp) :: devk12  = -29.48
+   REAL(wp) :: devk13  = -20.02
+   REAL(wp) :: devk14  = -18.03
+   REAL(wp) :: devk15  = -9.78
+   REAL(wp) :: devk16  = -48.76
+   REAL(wp) :: devk17  = -14.51
+   REAL(wp) :: devk18  = -23.12
+   REAL(wp) :: devk19  = -26.57
+   REAL(wp) :: devk110  = -29.48
    !
-   REAL(wp) :: devk21  = 0.1271
-   REAL(wp) :: devk22  = -0.0219
-   REAL(wp) :: devk23  = 0.1622
-   REAL(wp) :: devk24  = 0.2324
-   REAL(wp) :: devk25  = 0.5304
+   REAL(wp) :: devk20  = 0.1271
+   REAL(wp) :: devk21  = -0.0219
+   REAL(wp) :: devk22  = 0.1622
+   REAL(wp) :: devk23  = 0.1119
+   REAL(wp) :: devk24  = 0.0466
+   REAL(wp) :: devk25  = -0.0090
+   REAL(wp) :: devk26  = 0.5304
+   REAL(wp) :: devk27  = 0.1211
+   REAL(wp) :: devk28  = 0.1758
+   REAL(wp) :: devk29  = 0.2020
+   REAL(wp) :: devk210  = 0.1622
    !
+   REAL(wp) :: devk30  = 0.
    REAL(wp) :: devk31  = 0.
-   REAL(wp) :: devk32  = 0.
-   REAL(wp) :: devk33  = 2.608E-3
-   REAL(wp) :: devk34  = -3.6246E-3
-   REAL(wp) :: devk35  = 0.
+   REAL(wp) :: devk32  = 2.608E-3
+   REAL(wp) :: devk33  = -1.409e-3
+   REAL(wp) :: devk34  = 0.316e-3
+   REAL(wp) :: devk35  = -0.942e-3
+   REAL(wp) :: devk36  = 0.
+   REAL(wp) :: devk37  = -0.321e-3
+   REAL(wp) :: devk38  = -2.647e-3
+   REAL(wp) :: devk39  = -3.042e-3
+   REAL(wp) :: devk310  = -2.6080e-3
    !
-   REAL(wp) :: devk41  = -3.08E-3
-   REAL(wp) :: devk42  = 1.13E-3
-   REAL(wp) :: devk43  = -2.84E-3
-   REAL(wp) :: devk44  = -5.13E-3
-   REAL(wp) :: devk45  = -11.76E-3
+   REAL(wp) :: devk40  = -3.08E-3
+   REAL(wp) :: devk41  = 1.13E-3
+   REAL(wp) :: devk42  = -2.84E-3
+   REAL(wp) :: devk43  = -5.13E-3
+   REAL(wp) :: devk44  = -4.53e-3
+   REAL(wp) :: devk45  = -3.91e-3
+   REAL(wp) :: devk46  = -11.76e-3
+   REAL(wp) :: devk47  = -2.67e-3
+   REAL(wp) :: devk48  = -5.15e-3
+   REAL(wp) :: devk49  = -4.08e-3
+   REAL(wp) :: devk410  = -2.84e-3
    !
-   REAL(wp) :: devk51  = 0.0877E-3
-   REAL(wp) :: devk52  = -0.1475E-3     
-   REAL(wp) :: devk53  = 0.
-   REAL(wp) :: devk54  = 0.0794E-3      
-   REAL(wp) :: devk55  = 0.3692E-3      
+   REAL(wp) :: devk50  = 0.0877E-3
+   REAL(wp) :: devk51  = -0.1475E-3     
+   REAL(wp) :: devk52  = 0.
+   REAL(wp) :: devk53  = 0.0794E-3      
+   REAL(wp) :: devk54  = 0.09e-3
+   REAL(wp) :: devk55  = 0.054e-3
+   REAL(wp) :: devk56  = 0.3692E-3
+   REAL(wp) :: devk57  = 0.0427e-3
+   REAL(wp) :: devk58  = 0.09e-3
+   REAL(wp) :: devk59  = 0.0714e-3
+   REAL(wp) :: devk510  = 0.0
+   !
+   ! General parameters
+   REAL(wp), PARAMETER :: pp_rdel_ah_target = 1.E-4_wp
+   REAL(wp), PARAMETER :: pp_ln10 = 2.302585092994045684018_wp
+
+   ! Maximum number of iterations for each method
+   INTEGER, PARAMETER :: jp_maxniter_atgen    = 20
+
+   ! Bookkeeping variables for each method
+   ! - SOLVE_AT_GENERAL
+   INTEGER :: niter_atgen    = jp_maxniter_atgen
 
    !!----------------------------------------------------------------------
@@ -113,14 +147,28 @@
       !!---------------------------------------------------------------------
       INTEGER  ::   ji, jj, jk
-      REAL(wp) ::   ztkel, zt   , zt2   , zsal  , zsal2 , zbuf1 , zbuf2
+      REAL(wp) ::   ztkel, ztkel1, zt , zsal  , zsal2 , zbuf1 , zbuf2
       REAL(wp) ::   ztgg , ztgg2, ztgg3 , ztgg4 , ztgg5
       REAL(wp) ::   zpres, ztc  , zcl   , zcpexp, zoxy  , zcpexp2
       REAL(wp) ::   zsqrt, ztr  , zlogt , zcek1, zc1, zplat
-      REAL(wp) ::   zis  , zis2 , zsal15, zisqrt, za1  , za2
+      REAL(wp) ::   zis  , zis2 , zsal15, zisqrt, za1, za2
       REAL(wp) ::   zckb , zck1 , zck2  , zckw  , zak1 , zak2  , zakb , zaksp0, zakw
+      REAL(wp) ::   zck1p, zck2p, zck3p, zcksi, zak1p, zak2p, zak3p, zaksi
       REAL(wp) ::   zst  , zft  , zcks  , zckf  , zaksp1
+      REAL(wp) ::   total2free, free2SWS, total2SWS, SWS2total
+
       !!---------------------------------------------------------------------
       !
       IF( nn_timing == 1 )  CALL timing_start('p4z_che')
+      !
+      ! Computation of chemical constants require practical salinity
+      ! Thus, when TEOS08 is used, absolute salinity is converted to 
+      ! practical salinity
+      ! -------------------------------------------------------------
+      IF (neos == -1) THEN
+         salinprac(:,:,:) = tsn(:,:,:,jp_sal) * 35.0 / 35.16504
+      ELSE
+         salinprac(:,:,:) = tsn(:,:,:,jp_sal)
+      ENDIF
+
       !
       ! Computations of chemical constants require in situ temperature
@@ -133,5 +181,5 @@
             DO ji = 1, jpi
                zpres = gdept_n(ji,jj,jk) / 1000.
-               za1 = 0.04 * ( 1.0 + 0.185 * tsn(ji,jj,jk,jp_tem) + 0.035 * (tsn(ji,jj,jk,jp_sal) - 35.0) )
+               za1 = 0.04 * ( 1.0 + 0.185 * tsn(ji,jj,jk,jp_tem) + 0.035 * (salinprac(ji,jj,jk) - 35.0) )
                za2 = 0.0075 * ( 1.0 - tsn(ji,jj,jk,jp_tem) / 30.0 )
                tempis(ji,jj,jk) = tsn(ji,jj,jk,jp_tem) - za1 * zpres + za2 * zpres**2
@@ -142,19 +190,17 @@
       ! CHEMICAL CONSTANTS - SURFACE LAYER
       ! ----------------------------------
+!CDIR NOVERRCHK
       DO jj = 1, jpj
+!CDIR NOVERRCHK
          DO ji = 1, jpi
             !                             ! SET ABSOLUTE TEMPERATURE
             ztkel = tempis(ji,jj,1) + 273.15
             zt    = ztkel * 0.01
-            zt2   = zt * zt
-            zsal  = tsn(ji,jj,1,jp_sal) + ( 1.- tmask(ji,jj,1) ) * 35.
-            zsal2 = zsal * zsal
-            zlogt = LOG( zt )
+            zsal  = salinprac(ji,jj,1) + ( 1.- tmask(ji,jj,1) ) * 35.
             !                             ! LN(K0) OF SOLUBILITY OF CO2 (EQ. 12, WEISS, 1980)
             !                             !     AND FOR THE ATMOSPHERE FOR NON IDEAL GAS
             zcek1 = 9345.17/ztkel - 60.2409 + 23.3585 * LOG(zt) + zsal*(0.023517 - 0.00023656*ztkel    &
             &       + 0.0047036e-4*ztkel**2)
-            !                             ! SET SOLUBILITIES OF O2 AND CO2 
-            chemc(ji,jj,1) = EXP( zcek1 ) * 1.e-6 * rhop(ji,jj,1) / 1000. ! mol/(kg uatm)
+            chemc(ji,jj,1) = EXP( zcek1 ) * 1E-6 * rhop(ji,jj,1) / 1000. ! mol/(L atm)
             chemc(ji,jj,2) = -1636.75 + 12.0408*ztkel - 0.0327957*ztkel**2 + 0.0000316528*ztkel**3
             chemc(ji,jj,3) = 57.7 - 0.118*ztkel
@@ -165,9 +211,12 @@
       ! OXYGEN SOLUBILITY - DEEP OCEAN
       ! -------------------------------
+!CDIR NOVERRCHK
       DO jk = 1, jpk
+!CDIR NOVERRCHK
          DO jj = 1, jpj
+!CDIR NOVERRCHK
             DO ji = 1, jpi
               ztkel = tempis(ji,jj,jk) + 273.15
-              zsal  = tsn(ji,jj,jk,jp_sal) + ( 1.- tmask(ji,jj,jk) ) * 35.
+              zsal  = salinprac(ji,jj,jk) + ( 1.- tmask(ji,jj,jk) ) * 35.
               zsal2 = zsal * zsal
               ztgg  = LOG( ( 298.15 - tempis(ji,jj,jk) ) / ztkel )  ! Set the GORDON & GARCIA scaled temperature
@@ -176,6 +225,9 @@
               ztgg4 = ztgg3 * ztgg
               ztgg5 = ztgg4 * ztgg
-              zoxy  = ox0 + ox1 * ztgg + ox2 * ztgg2 + ox3 * ztgg3 + ox4 * ztgg4 + ox5 * ztgg5   &
-                     + zsal * ( ox6 + ox7 * ztgg + ox8 * ztgg2 + ox9 * ztgg3 ) +  ox10 * zsal2
+
+              zoxy  = 2.00856 + 3.22400 * ztgg + 3.99063 * ztgg2 + 4.80299 * ztgg3    &
+              &       + 9.78188e-1 * ztgg4 + 1.71069 * ztgg5 + zsal * ( -6.24097e-3   &
+              &       - 6.93498e-3 * ztgg - 6.90358e-3 * ztgg2 - 4.29155e-3 * ztgg3 )   &
+              &       - 3.11680e-7 * zsal2
               chemo2(ji,jj,jk) = ( EXP( zoxy ) * o2atm ) * oxyco * atcox     ! mol/(L atm)
             END DO
@@ -187,6 +239,9 @@
       ! CHEMICAL CONSTANTS - DEEP OCEAN
       ! -------------------------------
+!CDIR NOVERRCHK
       DO jk = 1, jpk
+!CDIR NOVERRCHK
          DO jj = 1, jpj
+!CDIR NOVERRCHK
             DO ji = 1, jpi
 
@@ -199,5 +254,5 @@
                ! SET ABSOLUTE TEMPERATURE
                ztkel   = tempis(ji,jj,jk) + 273.15
-               zsal    = tsn(ji,jj,jk,jp_sal) + ( 1.-tmask(ji,jj,jk) ) * 35.
+               zsal    = salinprac(ji,jj,jk) + ( 1.-tmask(ji,jj,jk) ) * 35.
                zsqrt  = SQRT( zsal )
                zsal15  = zsqrt * zsal
@@ -210,11 +265,11 @@
 
                ! CHLORINITY (WOOSTER ET AL., 1969)
-               zcl     = zsal * salchl
+               zcl     = zsal / 1.80655
 
                ! TOTAL SULFATE CONCENTR. [MOLES/kg soln]
-               zst     = st1 * zcl * st2
+               zst     = 0.14 * zcl /96.062
 
                ! TOTAL FLUORIDE CONCENTR. [MOLES/kg soln]
-               zft     = ft1 * zcl * ft2
+               zft     = 0.000067 * zcl /18.9984
 
                ! DISSOCIATION CONSTANT FOR SULFATES on free H scale (Dickson 1990)
@@ -224,6 +279,4 @@
                &         - 2698. * ztr * zis**1.5 + 1776.* ztr * zis2         &
                &         + LOG(1.0 - 0.001005 * zsal))
-               !
-               aphscale(ji,jj,jk) = ( 1. + zst / zcks )
 
                ! DISSOCIATION CONSTANT FOR FLUORIDES on free H scale (Dickson and Riley 79)
@@ -239,5 +292,4 @@
                &      * zlogt + 0.053105*zsqrt*ztkel
 
-
                ! DISSOCIATION COEFFICIENT FOR CARBONATE ACCORDING TO 
                ! MEHRBACH (1973) REFIT BY MILLERO (1995), seawater scale
@@ -247,8 +299,27 @@
                   - 0.01781*zsal + 0.0001122*zsal*zsal)
 
-               ! PKW (H2O) (DICKSON AND RILEY, 1979)
-               zckw = -13847.26*ztr + 148.9652 - 23.6521 * zlogt    & 
-               &     + (118.67*ztr - 5.977 + 1.0495 * zlogt)        &
-               &     * zsqrt - 0.01615 * zsal
+               ! PKW (H2O) (MILLERO, 1995) from composite data
+               zckw    = -13847.26 * ztr + 148.9652 - 23.6521 * zlogt + ( 118.67 * ztr    &
+                         - 5.977 + 1.0495 * zlogt ) * zsqrt - 0.01615 * zsal
+
+               ! CONSTANTS FOR PHOSPHATE (MILLERO, 1995)
+              zck1p    = -4576.752*ztr + 115.540 - 18.453*zlogt   &
+              &          + (-106.736*ztr + 0.69171) * zsqrt       &
+              &          + (-0.65643*ztr - 0.01844) * zsal
+
+              zck2p    = -8814.715*ztr + 172.1033 - 27.927*zlogt  &
+              &          + (-160.340*ztr + 1.3566)*zsqrt          &
+              &          + (0.37335*ztr - 0.05778)*zsal
+
+              zck3p    = -3070.75*ztr - 18.126                    &
+              &          + (17.27039*ztr + 2.81197) * zsqrt       &
+              &          + (-44.99486*ztr - 0.09984) * zsal 
+
+              ! CONSTANT FOR SILICATE, MILLERO (1995)
+              zcksi    = -8904.2*ztr  + 117.400 - 19.334*zlogt   &
+              &          + (-458.79*ztr + 3.5913) * zisqrt       &
+              &          + (188.74*ztr - 1.5998) * zis           &
+              &          + (-12.1652*ztr + 0.07871) * zis2       &
+              &          + LOG(1.0 - 0.001005*zsal)
 
                ! APPARENT SOLUBILITY PRODUCT K'SP OF CALCITE IN SEAWATER
@@ -258,10 +329,21 @@
                   &      - 0.07711*zsal + 0.0041249*zsal15
 
+               ! CONVERT FROM DIFFERENT PH SCALES
+               total2free  = 1.0/(1.0 + zst/zcks)
+               free2SWS    = 1. + zst/zcks + zft/(zckf*total2free)
+               total2SWS   = total2free * free2SWS
+               SWS2total   = 1.0 / total2SWS
+
                ! K1, K2 OF CARBONIC ACID, KB OF BORIC ACID, KW (H2O) (LIT.?)
-               zak1    = 10**(zck1)
-               zak2    = 10**(zck2)
-               zakb    = EXP( zckb  )
+               zak1    = 10**(zck1) * total2SWS
+               zak2    = 10**(zck2) * total2SWS
+               zakb    = EXP( zckb ) * total2SWS
                zakw    = EXP( zckw )
                zaksp1  = 10**(zaksp0)
+               zak1p   = exp( zck1p )
+               zak2p   = exp( zck2p )
+               zak3p   = exp( zck3p )
+               zaksi   = exp( zcksi )
+               zckf    = zckf * total2SWS
 
                ! FORMULA FOR CPEXP AFTER EDMOND & GIESKES (1970)
@@ -275,6 +357,6 @@
                !        FORMULA ON P. 1286 IS RIGHT AND CONSISTENT WITH THE
                !        SIGN IN PARTIAL MOLAR VOLUME CHANGE AS SHOWN ON P. 1285))
-               zcpexp  = zpres /(rgas*ztkel)
-               zcpexp2 = zpres * zpres/(rgas*ztkel)
+               zcpexp  = zpres / (rgas*ztkel)
+               zcpexp2 = zpres * zcpexp
 
                ! KB OF BORIC ACID, K1,K2 OF CARBONIC ACID PRESSURE
@@ -282,35 +364,84 @@
                !        (CF. BROECKER ET AL., 1982)
 
-               zbuf1  = -     ( devk11 + devk21 * ztc + devk31 * ztc * ztc )
+               zbuf1  = -     ( devk10 + devk20 * ztc + devk30 * ztc * ztc )
+               zbuf2  = 0.5 * ( devk40 + devk50 * ztc )
+               ak13(ji,jj,jk) = zak1 * EXP( zbuf1 * zcpexp + zbuf2 * zcpexp2 )
+
+               zbuf1  =     - ( devk11 + devk21 * ztc + devk31 * ztc * ztc )
                zbuf2  = 0.5 * ( devk41 + devk51 * ztc )
-               ak13(ji,jj,jk) = zak1 * EXP( zbuf1 * zcpexp + zbuf2 * zcpexp2 )
+               ak23(ji,jj,jk) = zak2 * EXP( zbuf1 * zcpexp + zbuf2 * zcpexp2 )
 
                zbuf1  =     - ( devk12 + devk22 * ztc + devk32 * ztc * ztc )
                zbuf2  = 0.5 * ( devk42 + devk52 * ztc )
-               ak23(ji,jj,jk) = zak2 * EXP( zbuf1 * zcpexp + zbuf2 * zcpexp2 )
+               akb3(ji,jj,jk) = zakb * EXP( zbuf1 * zcpexp + zbuf2 * zcpexp2 )
 
                zbuf1  =     - ( devk13 + devk23 * ztc + devk33 * ztc * ztc )
                zbuf2  = 0.5 * ( devk43 + devk53 * ztc )
-               akb3(ji,jj,jk) = zakb * EXP( zbuf1 * zcpexp + zbuf2 * zcpexp2 )
+               akw3(ji,jj,jk) = zakw * EXP( zbuf1 * zcpexp + zbuf2 * zcpexp2 )
 
                zbuf1  =     - ( devk14 + devk24 * ztc + devk34 * ztc * ztc )
                zbuf2  = 0.5 * ( devk44 + devk54 * ztc )
-               akw3(ji,jj,jk) = zakw * EXP( zbuf1 * zcpexp + zbuf2 * zcpexp2 )
-
+               aks3(ji,jj,jk) = zcks * EXP( zbuf1 * zcpexp + zbuf2 * zcpexp2 )
+
+               zbuf1  =     - ( devk15 + devk25 * ztc + devk35 * ztc * ztc )
+               zbuf2  = 0.5 * ( devk45 + devk55 * ztc )
+               akf3(ji,jj,jk) = zckf * EXP( zbuf1 * zcpexp + zbuf2 * zcpexp2 )
+
+               zbuf1  =     - ( devk17 + devk27 * ztc + devk37 * ztc * ztc )
+               zbuf2  = 0.5 * ( devk47 + devk57 * ztc )
+               ak1p3(ji,jj,jk) = zak1p * EXP( zbuf1 * zcpexp + zbuf2 * zcpexp2 )
+
+               zbuf1  =     - ( devk18 + devk28 * ztc + devk38 * ztc * ztc )
+               zbuf2  = 0.5 * ( devk48 + devk58 * ztc )
+               ak2p3(ji,jj,jk) = zak2p * EXP( zbuf1 * zcpexp + zbuf2 * zcpexp2 )
+
+               zbuf1  =     - ( devk19 + devk29 * ztc + devk39 * ztc * ztc )
+               zbuf2  = 0.5 * ( devk49 + devk59 * ztc )
+               ak3p3(ji,jj,jk) = zak3p * EXP( zbuf1 * zcpexp + zbuf2 * zcpexp2 )
+
+               zbuf1  =     - ( devk110 + devk210 * ztc + devk310 * ztc * ztc )
+               zbuf2  = 0.5 * ( devk410 + devk510 * ztc )
+               aksi3(ji,jj,jk) = zaksi * EXP( zbuf1 * zcpexp + zbuf2 * zcpexp2 )
+
+               ! CONVERT FROM DIFFERENT PH SCALES
+               total2free  = 1.0/(1.0 + zst/aks3(ji,jj,jk))
+               free2SWS    = 1. + zst/aks3(ji,jj,jk) + zft/akf3(ji,jj,jk)
+               total2SWS   = total2free * free2SWS
+               SWS2total   = 1.0 / total2SWS
+
+               ! Convert to total scale
+               ak13(ji,jj,jk)  = ak13(ji,jj,jk)  * SWS2total
+               ak23(ji,jj,jk)  = ak23(ji,jj,jk)  * SWS2total
+               akb3(ji,jj,jk)  = akb3(ji,jj,jk)  * SWS2total
+               akw3(ji,jj,jk)  = akw3(ji,jj,jk)  * SWS2total
+               ak1p3(ji,jj,jk) = ak1p3(ji,jj,jk) * SWS2total
+               ak2p3(ji,jj,jk) = ak2p3(ji,jj,jk) * SWS2total
+               ak3p3(ji,jj,jk) = ak3p3(ji,jj,jk) * SWS2total
+               aksi3(ji,jj,jk) = aksi3(ji,jj,jk) * SWS2total
+               akf3(ji,jj,jk)  = akf3(ji,jj,jk)  / total2free
 
                ! APPARENT SOLUBILITY PRODUCT K'SP OF CALCITE 
                !        AS FUNCTION OF PRESSURE FOLLOWING MILLERO
                !        (P. 1285) AND BERNER (1976)
-               zbuf1  =     - ( devk15 + devk25 * ztc + devk35 * ztc * ztc )
-               zbuf2  = 0.5 * ( devk45 + devk55 * ztc )
+               zbuf1  =     - ( devk16 + devk26 * ztc + devk36 * ztc * ztc )
+               zbuf2  = 0.5 * ( devk46 + devk56 * ztc )
                aksp(ji,jj,jk) = zaksp1 * EXP( zbuf1 * zcpexp + zbuf2 * zcpexp2 )
 
-               ! TOTAL BORATE CONCENTR. [MOLES/L]
-               borat(ji,jj,jk) = bor1 * zcl * bor2
+               ! TOTAL F, S, and BORATE CONCENTR. [MOLES/L]
+               borat(ji,jj,jk) = 0.0002414 * zcl / 10.811
+               sulfat(ji,jj,jk) = zst
+               fluorid(ji,jj,jk) = zft 
 
                ! Iron and SIO3 saturation concentration from ...
                sio3eq(ji,jj,jk) = EXP(  LOG( 10.) * ( 6.44 - 968. / ztkel )  ) * 1.e-6
-               fekeq (ji,jj,jk) = 10**( 17.27 - 1565.7 / ( 273.15 + ztc ) )
-
+               fekeq (ji,jj,jk) = 10**( 17.27 - 1565.7 / ztkel )
+
+               ! Liu and Millero (1999) only valid 5 - 50 degC
+               ztkel1 = MAX( 5. , tempis(ji,jj,jk) ) + 273.16
+               fesol(ji,jj,jk,1) = 10**(-13.486 - 0.1856* zis**0.5 + 0.3073*zis + 5254.0/ztkel1)
+               fesol(ji,jj,jk,2) = 10**(2.517 - 0.8885*zis**0.5 + 0.2139 * zis - 1320.0/ztkel1 )
+               fesol(ji,jj,jk,3) = 10**(0.4511 - 0.3305*zis**0.5 - 1996.0/ztkel1 )
+               fesol(ji,jj,jk,4) = 10**(-0.2965 - 0.7881*zis**0.5 - 4086.0/ztkel1 )
+               fesol(ji,jj,jk,5) = 10**(4.4466 - 0.8505*zis**0.5 - 7980.0/ztkel1 )
             END DO
          END DO
@@ -321,4 +452,358 @@
    END SUBROUTINE p4z_che
 
+   SUBROUTINE ahini_for_at(p_hini)
+      !!---------------------------------------------------------------------
+      !!                     ***  ROUTINE ahini_for_at  ***
+      !!
+      !! Subroutine returns the root for the 2nd order approximation of the
+      !! DIC -- B_T -- A_CB equation for [H+] (reformulated as a cubic 
+      !! polynomial) around the local minimum, if it exists.
+      !! Returns * 1E-03_wp if p_alkcb <= 0
+      !!         * 1E-10_wp if p_alkcb >= 2*p_dictot + p_bortot
+      !!         * 1E-07_wp if 0 < p_alkcb < 2*p_dictot + p_bortot
+      !!                    and the 2nd order approximation does not have 
+      !!                    a solution
+      !!---------------------------------------------------------------------
+      REAL(wp), DIMENSION(jpi,jpj,jpk), INTENT(OUT)  ::  p_hini
+      INTEGER  ::   ji, jj, jk
+      REAL(wp)  ::  zca1, zba1
+      REAL(wp)  ::  zd, zsqrtd, zhmin
+      REAL(wp)  ::  za2, za1, za0
+      REAL(wp)  ::  p_dictot, p_bortot, p_alkcb 
+
+      IF( nn_timing == 1 )  CALL timing_start('ahini_for_at')
+      !
+      DO jk = 1, jpk
+        DO jj = 1, jpj
+          DO ji = 1, jpi
+            p_alkcb  = trb(ji,jj,jk,jptal) * 1000. / (rhop(ji,jj,jk) + rtrn)
+            p_dictot = trb(ji,jj,jk,jpdic) * 1000. / (rhop(ji,jj,jk) + rtrn)
+            p_bortot = borat(ji,jj,jk)
+            IF (p_alkcb <= 0.) THEN
+                p_hini(ji,jj,jk) = 1.e-3
+            ELSEIF (p_alkcb >= (2.*p_dictot + p_bortot)) THEN
+                p_hini(ji,jj,jk) = 1.e-10_wp
+            ELSE
+                zca1 = p_dictot/( p_alkcb + rtrn )
+                zba1 = p_bortot/ (p_alkcb + rtrn )
+           ! Coefficients of the cubic polynomial
+                za2 = aKb3(ji,jj,jk)*(1. - zba1) + ak13(ji,jj,jk)*(1.-zca1)
+                za1 = ak13(ji,jj,jk)*akb3(ji,jj,jk)*(1. - zba1 - zca1)    &
+                &     + ak13(ji,jj,jk)*ak23(ji,jj,jk)*(1. - (zca1+zca1))
+                za0 = ak13(ji,jj,jk)*ak23(ji,jj,jk)*akb3(ji,jj,jk)*(1. - zba1 - (zca1+zca1))
+                                        ! Taylor expansion around the minimum
+                zd = za2*za2 - 3.*za1   ! Discriminant of the quadratic equation
+                                        ! for the minimum close to the root
+
+                IF(zd > 0.) THEN        ! If the discriminant is positive
+                  zsqrtd = SQRT(zd)
+                  IF(za2 < 0) THEN
+                    zhmin = (-za2 + zsqrtd)/3.
+                  ELSE
+                    zhmin = -za1/(za2 + zsqrtd)
+                  ENDIF
+                  p_hini(ji,jj,jk) = zhmin + SQRT(-(za0 + zhmin*(za1 + zhmin*(za2 + zhmin)))/zsqrtd)
+                ELSE
+                  p_hini(ji,jj,jk) = 1.e-7
+                ENDIF
+             !
+             ENDIF
+          END DO
+        END DO
+      END DO
+      !
+      IF( nn_timing == 1 )  CALL timing_stop('ahini_for_at')
+      !
+   END SUBROUTINE ahini_for_at
+
+   !===============================================================================
+   SUBROUTINE anw_infsup( p_alknw_inf, p_alknw_sup )
+
+   ! Subroutine returns the lower and upper bounds of "non-water-selfionization"
+   ! contributions to total alkalinity (the infimum and the supremum), i.e
+   ! inf(TA - [OH-] + [H+]) and sup(TA - [OH-] + [H+])
+
+   ! Argument variables
+   REAL(wp), DIMENSION(jpi,jpj,jpk), INTENT(OUT) :: p_alknw_inf
+   REAL(wp), DIMENSION(jpi,jpj,jpk), INTENT(OUT) :: p_alknw_sup
+
+   p_alknw_inf(:,:,:) =  -trb(:,:,:,jppo4) * 1000. / (rhop(:,:,:) + rtrn) - sulfat(:,:,:)  &
+   &              - fluorid(:,:,:)
+   p_alknw_sup(:,:,:) =   (2. * trb(:,:,:,jpdic) + 2. * trb(:,:,:,jppo4) + trb(:,:,:,jpsil) )    &
+   &               * 1000. / (rhop(:,:,:) + rtrn) + borat(:,:,:) 
+
+   END SUBROUTINE anw_infsup
+
+
+   SUBROUTINE solve_at_general( p_hini, zhi )
+
+   ! Universal pH solver that converges from any given initial value,
+   ! determines upper an lower bounds for the solution if required
+
+   ! Argument variables
+   !--------------------
+   REAL(wp), DIMENSION(jpi,jpj,jpk), INTENT(IN)   :: p_hini
+   REAL(wp), DIMENSION(jpi,jpj,jpk), INTENT(OUT)  :: zhi
+
+   ! Local variables
+   !-----------------
+   INTEGER   ::  ji, jj, jk, jn
+   REAL(wp)  ::  zh_ini, zh, zh_prev, zh_lnfactor
+   REAL(wp)  ::  zdelta, zh_delta
+   REAL(wp)  ::  zeqn, zdeqndh, zalka
+   REAL(wp)  ::  aphscale
+   REAL(wp)  ::  znumer_dic, zdnumer_dic, zdenom_dic, zalk_dic, zdalk_dic
+   REAL(wp)  ::  znumer_bor, zdnumer_bor, zdenom_bor, zalk_bor, zdalk_bor
+   REAL(wp)  ::  znumer_po4, zdnumer_po4, zdenom_po4, zalk_po4, zdalk_po4
+   REAL(wp)  ::  znumer_sil, zdnumer_sil, zdenom_sil, zalk_sil, zdalk_sil
+   REAL(wp)  ::  znumer_so4, zdnumer_so4, zdenom_so4, zalk_so4, zdalk_so4
+   REAL(wp)  ::  znumer_flu, zdnumer_flu, zdenom_flu, zalk_flu, zdalk_flu
+   REAL(wp)  ::  zalk_wat, zdalk_wat
+   REAL(wp)  ::  zfact, p_alktot, zdic, zbot, zpt, zst, zft, zsit
+   LOGICAL   ::  l_exitnow
+   REAL(wp), PARAMETER :: pz_exp_threshold = 1.0
+   REAL(wp), POINTER, DIMENSION(:,:,:) :: zalknw_inf, zalknw_sup, rmask, zh_min, zh_max, zeqn_absmin
+
+   IF( nn_timing == 1 )  CALL timing_start('solve_at_general')
+      !  Allocate temporary workspace
+   CALL wrk_alloc( jpi, jpj, jpk, zalknw_inf, zalknw_sup, rmask )
+   CALL wrk_alloc( jpi, jpj, jpk, zh_min, zh_max, zeqn_absmin )
+
+   CALL anw_infsup( zalknw_inf, zalknw_sup )
+
+   rmask(:,:,:) = tmask(:,:,:)
+   zhi(:,:,:)   = 0.
+
+   ! TOTAL H+ scale: conversion factor for Htot = aphscale * Hfree
+   DO jk = 1, jpk
+      DO jj = 1, jpj
+         DO ji = 1, jpi
+            IF (rmask(ji,jj,jk) == 1.) THEN
+               p_alktot = trb(ji,jj,jk,jptal) * 1000. / (rhop(ji,jj,jk) + rtrn)
+               aphscale = 1. + sulfat(ji,jj,jk)/aks3(ji,jj,jk)
+               zh_ini = p_hini(ji,jj,jk)
+
+               zdelta = (p_alktot-zalknw_inf(ji,jj,jk))**2 + 4.*akw3(ji,jj,jk)/aphscale
+
+               IF(p_alktot >= zalknw_inf(ji,jj,jk)) THEN
+                 zh_min(ji,jj,jk) = 2.*akw3(ji,jj,jk) /( p_alktot-zalknw_inf(ji,jj,jk) + SQRT(zdelta) )
+               ELSE
+                 zh_min(ji,jj,jk) = aphscale*(-(p_alktot-zalknw_inf(ji,jj,jk)) + SQRT(zdelta) ) / 2.
+               ENDIF
+
+               zdelta = (p_alktot-zalknw_sup(ji,jj,jk))**2 + 4.*akw3(ji,jj,jk)/aphscale
+
+               IF(p_alktot <= zalknw_sup(ji,jj,jk)) THEN
+                 zh_max(ji,jj,jk) = aphscale*(-(p_alktot-zalknw_sup(ji,jj,jk)) + SQRT(zdelta) ) / 2.
+               ELSE
+                 zh_max(ji,jj,jk) = 2.*akw3(ji,jj,jk) /( p_alktot-zalknw_sup(ji,jj,jk) + SQRT(zdelta) )
+               ENDIF
+
+               zhi(ji,jj,jk) = MAX(MIN(zh_max(ji,jj,jk), zh_ini), zh_min(ji,jj,jk))
+            ENDIF
+         END DO
+      END DO
+   END DO
+
+   zeqn_absmin(:,:,:) = HUGE(1._wp)
+
+   DO jn = 1, jp_maxniter_atgen 
+   DO jk = 1, jpk
+      DO jj = 1, jpj
+         DO ji = 1, jpi
+            IF (rmask(ji,jj,jk) == 1.) THEN
+               zfact = rhop(ji,jj,jk) / 1000. + rtrn
+               p_alktot = trb(ji,jj,jk,jptal) / zfact
+               zdic  = trb(ji,jj,jk,jpdic) / zfact
+               zbot  = borat(ji,jj,jk)
+               zpt = trb(ji,jj,jk,jppo4) / zfact * po4r
+               zsit = trb(ji,jj,jk,jpsil) / zfact
+               zst = sulfat (ji,jj,jk)
+               zft = fluorid(ji,jj,jk)
+               aphscale = 1. + sulfat(ji,jj,jk)/aks3(ji,jj,jk)
+               zh = zhi(ji,jj,jk)
+               zh_prev = zh
+
+               ! H2CO3 - HCO3 - CO3 : n=2, m=0
+               znumer_dic = 2.*ak13(ji,jj,jk)*ak23(ji,jj,jk) + zh*ak13(ji,jj,jk)
+               zdenom_dic = ak13(ji,jj,jk)*ak23(ji,jj,jk) + zh*(ak13(ji,jj,jk) + zh)
+               zalk_dic   = zdic * (znumer_dic/zdenom_dic)
+               zdnumer_dic = ak13(ji,jj,jk)*ak13(ji,jj,jk)*ak23(ji,jj,jk) + zh     &
+                             *(4.*ak13(ji,jj,jk)*ak23(ji,jj,jk) + zh*ak13(ji,jj,jk))
+               zdalk_dic   = -zdic*(zdnumer_dic/zdenom_dic**2)
+
+
+               ! B(OH)3 - B(OH)4 : n=1, m=0
+               znumer_bor = akb3(ji,jj,jk)
+               zdenom_bor = akb3(ji,jj,jk) + zh
+               zalk_bor   = zbot * (znumer_bor/zdenom_bor)
+               zdnumer_bor = akb3(ji,jj,jk)
+               zdalk_bor   = -zbot*(zdnumer_bor/zdenom_bor**2)
+
+
+               ! H3PO4 - H2PO4 - HPO4 - PO4 : n=3, m=1
+               znumer_po4 = 3.*ak1p3(ji,jj,jk)*ak2p3(ji,jj,jk)*ak3p3(ji,jj,jk)  &
+               &            + zh*(2.*ak1p3(ji,jj,jk)*ak2p3(ji,jj,jk) + zh* ak1p3(ji,jj,jk))
+               zdenom_po4 = ak1p3(ji,jj,jk)*ak2p3(ji,jj,jk)*ak3p3(ji,jj,jk)     &
+               &            + zh*( ak1p3(ji,jj,jk)*ak2p3(ji,jj,jk) + zh*(ak1p3(ji,jj,jk) + zh))
+               zalk_po4   = zpt * (znumer_po4/zdenom_po4 - 1.) ! Zero level of H3PO4 = 1
+               zdnumer_po4 = ak1p3(ji,jj,jk)*ak2p3(ji,jj,jk)*ak1p3(ji,jj,jk)*ak2p3(ji,jj,jk)*ak3p3(ji,jj,jk)  &
+               &             + zh*(4.*ak1p3(ji,jj,jk)*ak1p3(ji,jj,jk)*ak2p3(ji,jj,jk)*ak3p3(ji,jj,jk)         &
+               &             + zh*(9.*ak1p3(ji,jj,jk)*ak2p3(ji,jj,jk)*ak3p3(ji,jj,jk)                         &
+               &             + ak1p3(ji,jj,jk)*ak1p3(ji,jj,jk)*ak2p3(ji,jj,jk)                                &
+               &             + zh*(4.*ak1p3(ji,jj,jk)*ak2p3(ji,jj,jk) + zh * ak1p3(ji,jj,jk) ) ) )
+               zdalk_po4   = -zpt * (zdnumer_po4/zdenom_po4**2)
+
+               ! H4SiO4 - H3SiO4 : n=1, m=0
+               znumer_sil = aksi3(ji,jj,jk)
+               zdenom_sil = aksi3(ji,jj,jk) + zh
+               zalk_sil   = zsit * (znumer_sil/zdenom_sil)
+               zdnumer_sil = aksi3(ji,jj,jk)
+               zdalk_sil   = -zsit * (zdnumer_sil/zdenom_sil**2)
+
+               ! HSO4 - SO4 : n=1, m=1
+               aphscale = 1.0 + zst/aks3(ji,jj,jk)
+               znumer_so4 = aks3(ji,jj,jk) * aphscale
+               zdenom_so4 = aks3(ji,jj,jk) * aphscale + zh
+               zalk_so4   = zst * (znumer_so4/zdenom_so4 - 1.)
+               zdnumer_so4 = aks3(ji,jj,jk)
+               zdalk_so4   = -zst * (zdnumer_so4/zdenom_so4**2)
+
+               ! HF - F : n=1, m=1
+               znumer_flu =  akf3(ji,jj,jk)
+               zdenom_flu =  akf3(ji,jj,jk) + zh
+               zalk_flu   =  zft * (znumer_flu/zdenom_flu - 1.)
+               zdnumer_flu = akf3(ji,jj,jk)
+               zdalk_flu   = -zft * (zdnumer_flu/zdenom_flu**2)
+
+               ! H2O - OH
+               aphscale = 1.0 + zst/aks3(ji,jj,jk)
+               zalk_wat   = akw3(ji,jj,jk)/zh - zh/aphscale
+               zdalk_wat  = -akw3(ji,jj,jk)/zh**2 - 1./aphscale
+
+               ! CALCULATE [ALK]([CO3--], [HCO3-])
+               zeqn = zalk_dic + zalk_bor + zalk_po4 + zalk_sil   &
+               &      + zalk_so4 + zalk_flu                       &
+               &      + zalk_wat - p_alktot
+
+               zalka = p_alktot - (zalk_bor + zalk_po4 + zalk_sil   &
+               &       + zalk_so4 + zalk_flu + zalk_wat)
+
+               zdeqndh = zdalk_dic + zdalk_bor + zdalk_po4 + zdalk_sil &
+               &         + zdalk_so4 + zdalk_flu + zdalk_wat
+
+               ! Adapt bracketing interval
+               IF(zeqn > 0._wp) THEN
+                 zh_min(ji,jj,jk) = zh_prev
+               ELSEIF(zeqn < 0._wp) THEN
+                 zh_max(ji,jj,jk) = zh_prev
+               ENDIF
+
+               IF(ABS(zeqn) >= 0.5_wp*zeqn_absmin(ji,jj,jk)) THEN
+               ! if the function evaluation at the current point is
+               ! not decreasing faster than with a bisection step (at least linearly)
+               ! in absolute value take one bisection step on [ph_min, ph_max]
+               ! ph_new = (ph_min + ph_max)/2d0
+               !
+               ! In terms of [H]_new:
+               ! [H]_new = 10**(-ph_new)
+               !         = 10**(-(ph_min + ph_max)/2d0)
+               !         = SQRT(10**(-(ph_min + phmax)))
+               !         = SQRT(zh_max * zh_min)
+                  zh = SQRT(zh_max(ji,jj,jk) * zh_min(ji,jj,jk))
+                  zh_lnfactor = (zh - zh_prev)/zh_prev ! Required to test convergence below
+               ELSE
+               ! dzeqn/dpH = dzeqn/d[H] * d[H]/dpH
+               !           = -zdeqndh * LOG(10) * [H]
+               ! \Delta pH = -zeqn/(zdeqndh*d[H]/dpH) = zeqn/(zdeqndh*[H]*LOG(10))
+               !
+               ! pH_new = pH_old + \deltapH
+               !
+               ! [H]_new = 10**(-pH_new)
+               !         = 10**(-pH_old - \Delta pH)
+               !         = [H]_old * 10**(-zeqn/(zdeqndh*[H]_old*LOG(10)))
+               !         = [H]_old * EXP(-LOG(10)*zeqn/(zdeqndh*[H]_old*LOG(10)))
+               !         = [H]_old * EXP(-zeqn/(zdeqndh*[H]_old))
+
+                  zh_lnfactor = -zeqn/(zdeqndh*zh_prev)
+
+                  IF(ABS(zh_lnfactor) > pz_exp_threshold) THEN
+                     zh          = zh_prev*EXP(zh_lnfactor)
+                  ELSE
+                     zh_delta    = zh_lnfactor*zh_prev
+                     zh          = zh_prev + zh_delta
+                  ENDIF
+
+                  IF( zh < zh_min(ji,jj,jk) ) THEN
+                     ! if [H]_new < [H]_min
+                     ! i.e., if ph_new > ph_max then
+                     ! take one bisection step on [ph_prev, ph_max]
+                     ! ph_new = (ph_prev + ph_max)/2d0
+                     ! In terms of [H]_new:
+                     ! [H]_new = 10**(-ph_new)
+                     !         = 10**(-(ph_prev + ph_max)/2d0)
+                     !         = SQRT(10**(-(ph_prev + phmax)))
+                     !         = SQRT([H]_old*10**(-ph_max))
+                     !         = SQRT([H]_old * zh_min)
+                     zh                = SQRT(zh_prev * zh_min(ji,jj,jk))
+                     zh_lnfactor       = (zh - zh_prev)/zh_prev ! Required to test convergence below
+                  ENDIF
+
+                  IF( zh > zh_max(ji,jj,jk) ) THEN
+                     ! if [H]_new > [H]_max
+                     ! i.e., if ph_new < ph_min, then
+                     ! take one bisection step on [ph_min, ph_prev]
+                     ! ph_new = (ph_prev + ph_min)/2d0
+                     ! In terms of [H]_new:
+                     ! [H]_new = 10**(-ph_new)
+                     !         = 10**(-(ph_prev + ph_min)/2d0)
+                     !         = SQRT(10**(-(ph_prev + ph_min)))
+                     !         = SQRT([H]_old*10**(-ph_min))
+                     !         = SQRT([H]_old * zhmax)
+                     zh                = SQRT(zh_prev * zh_max(ji,jj,jk))
+                     zh_lnfactor       = (zh - zh_prev)/zh_prev ! Required to test convergence below
+                  ENDIF
+               ENDIF
+
+               zeqn_absmin(ji,jj,jk) = MIN( ABS(zeqn), zeqn_absmin(ji,jj,jk))
+
+               ! Stop iterations once |\delta{[H]}/[H]| < rdel
+               ! <=> |(zh - zh_prev)/zh_prev| = |EXP(-zeqn/(zdeqndh*zh_prev)) -1| < rdel
+               ! |EXP(-zeqn/(zdeqndh*zh_prev)) -1| ~ |zeqn/(zdeqndh*zh_prev)|
+
+               ! Alternatively:
+               ! |\Delta pH| = |zeqn/(zdeqndh*zh_prev*LOG(10))|
+               !             ~ 1/LOG(10) * |\Delta [H]|/[H]
+               !             < 1/LOG(10) * rdel
+
+               ! Hence |zeqn/(zdeqndh*zh)| < rdel
+
+               ! rdel <-- pp_rdel_ah_target
+               l_exitnow = (ABS(zh_lnfactor) < pp_rdel_ah_target)
+
+               IF(l_exitnow) THEN 
+                  rmask(ji,jj,jk) = 0.
+               ENDIF
+
+               zhi(ji,jj,jk) =  zh
+
+               IF(jn >= jp_maxniter_atgen) THEN
+                  zhi(ji,jj,jk) = -1._wp
+               ENDIF
+
+            ENDIF
+         END DO
+      END DO
+   END DO
+   END DO
+   !
+   CALL wrk_dealloc( jpi, jpj, jpk, zalknw_inf, zalknw_sup, rmask )
+   CALL wrk_dealloc( jpi, jpj, jpk, zh_min, zh_max, zeqn_absmin )
+
+
+   IF( nn_timing == 1 )  CALL timing_stop('solve_at_general')
+
+
+   END SUBROUTINE solve_at_general
 
    INTEGER FUNCTION p4z_che_alloc()
@@ -326,6 +811,23 @@
       !!                     ***  ROUTINE p4z_che_alloc  ***
       !!----------------------------------------------------------------------
-      ALLOCATE( sio3eq(jpi,jpj,jpk), fekeq(jpi,jpj,jpk), chemc(jpi,jpj,3), chemo2(jpi,jpj,jpk),   &
-      &         tempis(jpi,jpj,jpk), STAT=p4z_che_alloc )
+      INTEGER ::   ierr(3)        ! Local variables
+      !!----------------------------------------------------------------------
+
+      ierr(:) = 0
+
+      ALLOCATE( sio3eq(jpi,jpj,jpk), fekeq(jpi,jpj,jpk), chemc(jpi,jpj,3), chemo2(jpi,jpj,jpk), STAT=ierr(1) )
+
+      ALLOCATE( akb3(jpi,jpj,jpk)     , tempis(jpi, jpj, jpk),       &
+         &      akw3(jpi,jpj,jpk)     , borat (jpi,jpj,jpk)  ,       &
+         &      aks3(jpi,jpj,jpk)     , akf3(jpi,jpj,jpk)    ,       &
+         &      ak1p3(jpi,jpj,jpk)    , ak2p3(jpi,jpj,jpk)   ,       &
+         &      ak3p3(jpi,jpj,jpk)    , aksi3(jpi,jpj,jpk)   ,       &
+         &      fluorid(jpi,jpj,jpk)  , sulfat(jpi,jpj,jpk)  ,       &
+         &      salinprac(jpi,jpj,jpk),                 STAT=ierr(2) )
+
+      ALLOCATE( fesol(jpi,jpj,jpk,5), STAT=ierr(3) )
+
+      !* Variable for chemistry of the CO2 cycle
+      p4z_che_alloc = MAXVAL( ierr )
       !
       IF( p4z_che_alloc /= 0 )   CALL ctl_warn('p4z_che_alloc : failed to allocate arrays.')
@@ -333,15 +835,4 @@
    END FUNCTION p4z_che_alloc
 
-#else
    !!======================================================================
-   !!  Dummy module :                                   No PISCES bio-model
-   !!======================================================================
-CONTAINS
-   SUBROUTINE p4z_che( kt )                   ! Empty routine
-      INTEGER, INTENT(in) ::   kt
-      WRITE(*,*) 'p4z_che: You should not have seen this print! error?', kt
-   END SUBROUTINE p4z_che
-#endif 
-
-   !!======================================================================
-END MODULE p4zche
+END MODULE  p4zche
Index: branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/NEMO/TOP_SRC/PISCES/P4Z/p4zfechem.F90
===================================================================
--- branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/NEMO/TOP_SRC/PISCES/P4Z/p4zfechem.F90	(revision 7383)
+++ branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/NEMO/TOP_SRC/PISCES/P4Z/p4zfechem.F90	(revision 7391)
@@ -5,9 +5,5 @@
    !!======================================================================
    !! History :   3.5  !  2012-07 (O. Aumont, A. Tagliabue, C. Ethe) Original code
-   !!----------------------------------------------------------------------
-#if defined key_pisces
-   !!----------------------------------------------------------------------
-   !!   'key_top'       and                                      TOP models
-   !!   'key_pisces'                                       PISCES bio-model
+   !!             3.6  !  2015-05  (O. Aumont) PISCES quota
    !!----------------------------------------------------------------------
    !!   p4z_fechem       :  Compute remineralization/scavenging of iron
@@ -18,5 +14,4 @@
    USE trc             !  passive tracers common variables 
    USE sms_pisces      !  PISCES Source Minus Sink variables
-   USE p4zopt          !  optical model
    USE p4zche          !  chemical model
    USE p4zsbc          !  Boundary conditions from sediments
@@ -30,11 +25,13 @@
    PUBLIC   p4z_fechem_init ! called in trcsms_pisces.F90
 
-   LOGICAL          ::   ln_fechem    !: boolean for complex iron chemistry following Tagliabue and voelker
-   LOGICAL          ::   ln_ligvar    !: boolean for variable ligand concentration following Tagliabue and voelker
-   REAL(wp), PUBLIC ::   xlam1        !: scavenging rate of Iron 
-   REAL(wp), PUBLIC ::   xlamdust     !: scavenging rate of Iron by dust 
-   REAL(wp), PUBLIC ::   ligand       !: ligand concentration in the ocean 
-
-!!gm Not DOCTOR norm !!!
+   !! * Shared module variables
+   LOGICAL          ::  ln_fechem    !: boolean for complex iron chemistry following Tagliabue and voelker
+   LOGICAL          ::  ln_ligvar    !: boolean for variable ligand concentration following Tagliabue and voelker
+   LOGICAL          ::  ln_fecolloid !: boolean for variable colloidal fraction
+   REAL(wp), PUBLIC ::  xlam1        !: scavenging rate of Iron 
+   REAL(wp), PUBLIC ::  xlamdust     !: scavenging rate of Iron by dust 
+   REAL(wp), PUBLIC ::  ligand       !: ligand concentration in the ocean 
+   REAL(wp), PUBLIC ::  kfep         !: rate constant for nanoparticle formation
+
    REAL(wp) :: kl1, kl2, kb1, kb2, ks, kpr, spd, con, kth
 
@@ -59,32 +56,37 @@
       !!                    and one particulate form (ln_fechem)
       !!---------------------------------------------------------------------
-      INTEGER, INTENT(in) ::   kt, knt   ! ocean time step
-      !
-      INTEGER  ::   ji, jj, jk, jic
-      CHARACTER (len=25) :: charout
+      !
+      INTEGER, INTENT(in) ::   kt, knt ! ocean time step
+      !
+      INTEGER  ::   ji, jj, jk, jic, jn
       REAL(wp) ::   zdep, zlam1a, zlam1b, zlamfac
-      REAL(wp) ::   zkeq, zfeequi, zfesatur, zfecoll
+      REAL(wp) ::   zkeq, zfeequi, zfesatur, zfecoll, fe3sol
       REAL(wp) ::   zdenom1, zscave, zaggdfea, zaggdfeb, zcoag
       REAL(wp) ::   ztrc, zdust
-#if ! defined key_kriest
-      REAL(wp) ::   zdenom, zdenom2
-#endif
-      REAL(wp), POINTER, DIMENSION(:,:,:) :: zTL1, zFe3, ztotlig
-      REAL(wp), POINTER, DIMENSION(:,:,:) :: zFeL1, zFeL2, zTL2, zFe2, zFeP
+      REAL(wp) ::   zdenom2
+      REAL(wp) ::   zzFeL1, zzFeL2, zzFe2, zzFeP, zzFe3, zzstrn2
+      REAL(wp) ::   zrum, zcodel, zargu, zlight
       REAL(wp) :: zkox, zkph1, zkph2, zph, zionic, ztligand
       REAL(wp) :: za, zb, zc, zkappa1, zkappa2, za0, za1, za2
       REAL(wp) :: zxs, zfunc, zp, zq, zd, zr, zphi, zfff, zp3, zq2
-      REAL(wp) :: ztfe, zoxy
-      REAL(wp) :: zstep
+      REAL(wp) :: ztfe, zoxy, zhplus
+      REAL(wp) :: zaggliga, zaggligb
+      REAL(wp) :: dissol, zligco
+      CHARACTER (len=25) :: charout
+      REAL(wp), POINTER, DIMENSION(:,:,:) :: zTL1, zFe3, ztotlig, precip
+      REAL(wp), POINTER, DIMENSION(:,:,:) :: zFeL1, zFeL2, zTL2, zFe2, zFeP
+      REAL(wp), POINTER, DIMENSION(:,:  ) :: zstrn, zstrn2
       !!---------------------------------------------------------------------
       !
       IF( nn_timing == 1 )  CALL timing_start('p4z_fechem')
       !
-      CALL wrk_alloc( jpi,jpj,jpk,   zFe3, zFeL1, zTL1, ztotlig )
+      ! Allocate temporary workspace
+      CALL wrk_alloc( jpi, jpj, jpk, zFe3, zFeL1, zTL1, ztotlig, precip )
       zFe3 (:,:,:) = 0.
       zFeL1(:,:,:) = 0.
       zTL1 (:,:,:) = 0.
       IF( ln_fechem ) THEN
-         CALL wrk_alloc( jpi,jpj,jpk,   zFe2, zFeL2, zTL2, zFeP )
+         CALL wrk_alloc( jpi, jpj,      zstrn, zstrn2 )
+         CALL wrk_alloc( jpi, jpj, jpk, zFe2, zFeL2, zTL2, zFeP )
          zFe2 (:,:,:) = 0.
          zFeL2(:,:,:) = 0.
@@ -100,8 +102,29 @@
          ztotlig(:,:,:) =  MIN( ztotlig(:,:,:), 10. )
       ELSE
-         ztotlig(:,:,:) = ligand * 1E9
+        IF( ln_ligand ) THEN  ;   ztotlig(:,:,:) = trb(:,:,:,jplgw) * 1E9
+        ELSE                  ;   ztotlig(:,:,:) = ligand * 1E9
+        ENDIF
       ENDIF
 
       IF( ln_fechem ) THEN
+         ! compute the day length depending on latitude and the day
+         zrum = REAL( nday_year - 80, wp ) / REAL( nyear_len(1), wp )
+         zcodel = ASIN(  SIN( zrum * rpi * 2._wp ) * SIN( rad * 23.5_wp )  )
+
+         ! day length in hours
+         zstrn(:,:) = 0.
+         DO jj = 1, jpj
+            DO ji = 1, jpi
+               zargu = TAN( zcodel ) * TAN( gphit(ji,jj) * rad )
+               zargu = MAX( -1., MIN(  1., zargu ) )
+               zstrn(ji,jj) = MAX( 0.0, 24. - 2. * ACOS( zargu ) / rad / 15. )
+            END DO
+         END DO
+
+         ! Maximum light intensity
+         zstrn2(:,:) = zstrn(:,:) / 24.
+         WHERE( zstrn(:,:) < 1.e0 ) zstrn(:,:) = 24.
+         zstrn(:,:) = 24. / zstrn(:,:)
+
          ! ------------------------------------------------------------
          ! NEW FE CHEMISTRY ROUTINE from Tagliabue and Volker (2009)
@@ -109,7 +132,10 @@
          ! Chemistry is supposed to be fast enough to be at equilibrium
          ! ------------------------------------------------------------
-         DO jk = 1, jpkm1
+         DO jn = 1, 2
+          DO jk = 1, jpkm1
             DO jj = 1, jpj
                DO ji = 1, jpi
+                  zlight = etot(ji,jj,jk) * zstrn(ji,jj) * REAL( 2-jn, wp )
+                  zzstrn2 = zstrn2(ji,jj) * REAL( 2-jn, wp ) + (1. - zstrn2(ji,jj) ) * REAL( jn-1, wp )
                   ! Calculate ligand concentrations : assume 2/3rd of excess goes to
                   ! strong ligands (L1) and 1/3rd to weak ligands (L2)
@@ -118,14 +144,13 @@
                   zTL2(ji,jj,jk) = ligand * 1E9 - 0.000001 + 0.33 * ztligand
                   ! ionic strength from Millero et al. 1987
-                  zionic = 19.9201 * tsn(ji,jj,jk,jp_sal) / ( 1000. - 1.00488 * tsn(ji,jj,jk,jp_sal) + rtrn )
                   zph    = -LOG10( MAX( hi(ji,jj,jk), rtrn) )
-                  zoxy   = trb(ji,jj,jk,jpoxy) * ( rhop(ji,jj,jk) / 1.e3 )
+                  zoxy   = trb(ji,jj,jk,jpoxy)
                   ! Fe2+ oxydation rate from Santana-Casiano et al. (2005)
-                  zkox   = 35.407 - 6.7109 * zph + 0.5342 * zph * zph - 5362.6 / ( tsn(ji,jj,jk,jp_tem) + 273.15 )  &
-                    &    - 0.04406 * SQRT( tsn(ji,jj,jk,jp_sal) ) - 0.002847 * tsn(ji,jj,jk,jp_sal)
+                  zkox   = 35.407 - 6.7109 * zph + 0.5342 * zph * zph - 5362.6 / ( tempis(ji,jj,jk) + 273.15 )  &
+                    &    - 0.04406 * SQRT( salinprac(ji,jj,jk) ) - 0.002847 * salinprac(ji,jj,jk)
                   zkox   = ( 10.** zkox ) * spd
                   zkox   = zkox * MAX( 1.e-6, zoxy) / ( chemo2(ji,jj,jk) + rtrn )
                   ! PHOTOREDUCTION of complexed iron : Tagliabue and Arrigo (2006)
-                  zkph2 = MAX( 0., 15. * etot(ji,jj,jk) / ( etot(ji,jj,jk) + 2. ) )
+                  zkph2 = MAX( 0., 15. * zlight / ( zlight + 2. ) ) * (1. - fr_i(ji,jj))
                   zkph1 = zkph2 / 5.
                   ! pass the dfe concentration from PISCES
@@ -167,5 +192,5 @@
                         zphi = ACOS( zfff )
                         DO jic = 1, 3
-                           zfunc = -2 * zr * COS( zphi / 3. + 2. * FLOAT( jic - 1 ) * rpi / 3. ) - za2 / 3.
+                           zfunc = -2 * zr * COS( zphi / 3. + 2. * REAL( jic - 1, wp ) * rpi / 3. ) - za2 / 3.
                            IF( zfunc > 0. .AND. zfunc <= ztfe)  zxs = zfunc
                         END DO
@@ -173,12 +198,18 @@
                   ENDIF
                   ! solve for the other Fe species
-                  zFe3(ji,jj,jk) = MAX( 0., zxs ) 
-                  zFep(ji,jj,jk) = MAX( 0., ( ks * zFe3(ji,jj,jk) / kpr ) )
+                  zzFe3 = MAX( 0., zxs )
+                  zzFep = MAX( 0., ( ks * zzFe3 / kpr ) )
                   zkappa2 = ( kb2 + zkph2 ) / kl2
-                  zFeL2(ji,jj,jk) = MAX( 0., ( zFe3(ji,jj,jk) * zTL2(ji,jj,jk) ) / ( zkappa2 + zFe3(ji,jj,jk) ) )
-                  zFeL1(ji,jj,jk) = MAX( 0., ( ztfe / zb - za / zb * zFe3(ji,jj,jk) - zc / zb * zFeL2(ji,jj,jk) ) )
-                  zFe2 (ji,jj,jk) = MAX( 0., ( ( zkph1 * zFeL1(ji,jj,jk) + zkph2 * zFeL2(ji,jj,jk) ) / zkox ) )
+                  zzFeL2 = MAX( 0., ( zzFe3 * zTL2(ji,jj,jk) ) / ( zkappa2 + zzFe3 ) )
+                  zzFeL1 = MAX( 0., ( ztfe / zb - za / zb * zzFe3 - zc / zb * zzFeL2 ) )
+                  zzFe2  = MAX( 0., ( ( zkph1 * zzFeL1 + zkph2 * zzFeL2 ) / zkox ) )
+                  zFe3(ji,jj,jk)  = zFe3(ji,jj,jk)  + zzFe3 * zzstrn2
+                  zFe2(ji,jj,jk)  = zFe2(ji,jj,jk)  + zzFe2 * zzstrn2
+                  zFeL2(ji,jj,jk) = zFeL2(ji,jj,jk) + zzFeL2 * zzstrn2
+                  zFeL1(ji,jj,jk) = zFeL1(ji,jj,jk) + zzFeL1 * zzstrn2
+                  zFeP(ji,jj,jk)  = zFeP(ji,jj,jk)  + zzFeP * zzstrn2
                END DO
             END DO
+         END DO
          END DO
       ELSE
@@ -206,14 +237,9 @@
          !
       ENDIF
-      !
+
       zdust = 0.         ! if no dust available
-      !
       DO jk = 1, jpkm1
          DO jj = 1, jpj
             DO ji = 1, jpi
-               zstep = xstep
-# if defined key_degrad
-               zstep = zstep * facvol(ji,jj,jk)
-# endif
                ! Scavenging rate of iron. This scavenging rate depends on the load of particles of sea water. 
                ! This parameterization assumes a simple second order kinetics (k[Particles][Fe]).
@@ -224,15 +250,21 @@
                   zfecoll = ( 0.3 * zFeL1(ji,jj,jk) + 0.5 * zFeL2(ji,jj,jk) ) * 1E-9
                ELSE
-                  zfeequi = zFe3(ji,jj,jk) * 1E-9 
-                  zfecoll = 0.5 * zFeL1(ji,jj,jk) * 1E-9
+                  zfeequi = zFe3(ji,jj,jk) * 1E-9
+                  IF (ln_fecolloid) THEN
+                     zhplus   = max( rtrn, hi(ji,jj,jk) )
+                     fe3sol  = fesol(ji,jj,jk,1) * ( zhplus**3 + fesol(ji,jj,jk,2) * zhplus**2  &
+                     &         + fesol(ji,jj,jk,3) * zhplus + fesol(ji,jj,jk,4)     &
+                     &         + fesol(ji,jj,jk,5) / zhplus )
+                     zfecoll = max( ( 0.1 * zFeL1(ji,jj,jk) * 1E-9 ), ( zFeL1(ji,jj,jk) * 1E-9 -fe3sol ) )
+                  ELSE
+                     zfecoll = 0.5 * zFeL1(ji,jj,jk) * 1E-9
+                     fe3sol  = 0.
+                  ENDIF
                ENDIF
-#if defined key_kriest
-               ztrc   = ( trb(ji,jj,jk,jppoc) + trb(ji,jj,jk,jpcal) + trb(ji,jj,jk,jpgsi) ) * 1.e6 
-#else
+               !
                ztrc   = ( trb(ji,jj,jk,jppoc) + trb(ji,jj,jk,jpgoc) + trb(ji,jj,jk,jpcal) + trb(ji,jj,jk,jpgsi) ) * 1.e6 
-#endif
                IF( ln_dust )  zdust  = dust(ji,jj) / ( wdust / rday ) * tmask(ji,jj,jk) ! dust in kg/m2/s
                zlam1b = 3.e-5 + xlamdust * zdust + xlam1 * ztrc
-               zscave = zfeequi * zlam1b * zstep
+               zscave = zfeequi * zlam1b * xstep
 
                ! Compute the different ratios for scavenging of iron
@@ -240,7 +272,5 @@
                ! ---------------------------------------------------------
                zdenom1 = xlam1 * trb(ji,jj,jk,jppoc) / zlam1b
-#if ! defined key_kriest
                zdenom2 = xlam1 * trb(ji,jj,jk,jpgoc) / zlam1b
-#endif
 
                !  Increased scavenging for very high iron concentrations found near the coasts 
@@ -249,8 +279,7 @@
                zlamfac = MAX( 0.e0, ( gphit(ji,jj) + 55.) / 30. )
                zlamfac = MIN( 1.  , zlamfac )
-!!gm very small BUG :  it is unlikely but possible that gdept_n = 0  .....
                zdep    = MIN( 1., 1000. / gdept_n(ji,jj,jk) )
                zlam1b  = xlam1 * MAX( 0.e0, ( trb(ji,jj,jk,jpfer) * 1.e9 - ztotlig(ji,jj,jk) ) )
-               zcoag   = zfeequi * zlam1b * zstep + 1E-4 * ( 1. - zlamfac ) * zdep * zstep * trb(ji,jj,jk,jpfer)
+               zcoag   = zfeequi * zlam1b * xstep + 1E-4 * ( 1. - zlamfac ) * zdep * xstep * trb(ji,jj,jk,jpfer)
 
                !  Compute the coagulation of colloidal iron. This parameterization 
@@ -259,19 +288,18 @@
                !  ----------------------------------------------------------------
                zlam1a  = ( 0.369  * 0.3 * trb(ji,jj,jk,jpdoc) + 102.4  * trb(ji,jj,jk,jppoc) ) * xdiss(ji,jj,jk)    &
-                   &   + ( 114.   * 0.3 * trb(ji,jj,jk,jpdoc) + 5.09E3 * trb(ji,jj,jk,jppoc) )
-               zaggdfea = zlam1a * zstep * zfecoll
-#if defined key_kriest
-               zaggdfeb = 0.
+                   &   + ( 114.   * 0.3 * trb(ji,jj,jk,jpdoc) )
+               zaggdfea = zlam1a * xstep * zfecoll
                !
-               tra(ji,jj,jk,jpfer) = tra(ji,jj,jk,jpfer) - zscave - zaggdfea - zaggdfeb - zcoag
-               tra(ji,jj,jk,jpsfe) = tra(ji,jj,jk,jpsfe) + zscave * zdenom1 + zaggdfea + zaggdfeb
-#else
                zlam1b = 3.53E3 *   trb(ji,jj,jk,jpgoc) * xdiss(ji,jj,jk)
-               zaggdfeb = zlam1b * zstep * zfecoll
+               zaggdfeb = zlam1b * xstep * zfecoll
                !
-               tra(ji,jj,jk,jpfer) = tra(ji,jj,jk,jpfer) - zscave - zaggdfea - zaggdfeb - zcoag
+               ! precipitation of Fe3+, creation of nanoparticles
+               precip(ji,jj,jk) = MAX( 0., ( zfeequi - fe3sol ) ) * kfep * xstep
+               !
+               tra(ji,jj,jk,jpfer) = tra(ji,jj,jk,jpfer) - zscave - zaggdfea - zaggdfeb &
+               &                     - zcoag - precip(ji,jj,jk)
                tra(ji,jj,jk,jpsfe) = tra(ji,jj,jk,jpsfe) + zscave * zdenom1 + zaggdfea
                tra(ji,jj,jk,jpbfe) = tra(ji,jj,jk,jpbfe) + zscave * zdenom2 + zaggdfeb
-#endif
+               !
             END DO
          END DO
@@ -280,13 +308,36 @@
       !  Define the bioavailable fraction of iron
       !  ----------------------------------------
-      IF( ln_fechem ) THEN
-          biron(:,:,:) = MAX( 0., trb(:,:,:,jpfer) - zFeP(:,:,:) * 1E-9 )
-      ELSE
-          biron(:,:,:) = trb(:,:,:,jpfer) 
-      ENDIF
-
+      IF( ln_fechem ) THEN  ;  biron(:,:,:) = MAX( 0., trb(:,:,:,jpfer) - zFeP(:,:,:) * 1E-9 )
+      ELSE                  ;  biron(:,:,:) = trb(:,:,:,jpfer) 
+      ENDIF
+      !
+      IF( ln_ligand ) THEN
+         !
+         DO jk = 1, jpkm1
+            DO jj = 1, jpj
+               DO ji = 1, jpi
+                  zlam1a   = ( 0.369  * 0.3 * trb(ji,jj,jk,jpdoc) + 102.4  * trb(ji,jj,jk,jppoc) ) * xdiss(ji,jj,jk)    &
+                      &    + ( 114.   * 0.3 * trb(ji,jj,jk,jpdoc) )
+                  !
+                  zlam1b   = 3.53E3 *   trb(ji,jj,jk,jpgoc) * xdiss(ji,jj,jk)
+                  zligco   = MAX( ( 0.1 * trb(ji,jj,jk,jplgw) ), ( trb(ji,jj,jk,jplgw) - fe3sol ) )
+                  zaggliga = zlam1a * xstep * zligco
+                  zaggligb = zlam1b * xstep * zligco
+                  tra(ji,jj,jk,jpfep) = tra(ji,jj,jk,jpfep) + precip(ji,jj,jk)
+                  tra(ji,jj,jk,jplgw) = tra(ji,jj,jk,jplgw) - zaggliga - zaggligb
+               END DO
+            END DO
+         END DO
+         !
+         IF( .NOT.ln_fechem) THEN
+            plig(:,:,:) =  MAX( 0., ( ( zFeL1(:,:,:) * 1E-9 ) / ( trb(:,:,:,jpfer) +rtrn ) ) )
+            plig(:,:,:) =  MAX( 0. , plig(:,:,:) )
+         ENDIF
+         !
+      ENDIF
       !  Output of some diagnostics variables
       !     ---------------------------------
-      IF( lk_iomput .AND. knt == nrdttrc ) THEN
+      IF( lk_iomput ) THEN
+         IF( knt == nrdttrc ) THEN
          IF( iom_use("Fe3")    )  CALL iom_put("Fe3"    , zFe3   (:,:,:)       * tmask(:,:,:) )   ! Fe3+
          IF( iom_use("FeL1")   )  CALL iom_put("FeL1"   , zFeL1  (:,:,:)       * tmask(:,:,:) )   ! FeL1
@@ -300,4 +351,5 @@
             IF( iom_use("TL2")  ) CALL iom_put("TL2"    , zTL2   (:,:,:)       * tmask(:,:,:) )   ! TL2
          ENDIF
+         ENDIF
       ENDIF
 
@@ -308,6 +360,9 @@
       ENDIF
       !
-                       CALL wrk_dealloc( jpi, jpj, jpk, zFe3, zFeL1, zTL1, ztotlig )
-      IF( ln_fechem )  CALL wrk_dealloc( jpi, jpj, jpk, zFe2, zFeL2, zTL2, zFeP )
+      CALL wrk_dealloc( jpi, jpj, jpk, zFe3, zFeL1, zTL1, ztotlig, precip )
+      IF( ln_fechem )  THEN
+         CALL wrk_dealloc( jpi, jpj,      zstrn, zstrn2 )
+         CALL wrk_dealloc( jpi, jpj, jpk, zFe2, zFeL2, zTL2, zFeP )
+      ENDIF
       !
       IF( nn_timing == 1 )  CALL timing_stop('p4z_fechem')
@@ -328,5 +383,5 @@
       !!
       !!----------------------------------------------------------------------
-      NAMELIST/nampisfer/ ln_fechem, ln_ligvar, xlam1, xlamdust, ligand 
+      NAMELIST/nampisfer/ ln_fechem, ln_ligvar, ln_fecolloid, xlam1, xlamdust, ligand, kfep 
       INTEGER :: ios                 ! Local integer output status for namelist read
 
@@ -344,9 +399,11 @@
          WRITE(numout,*) ' Namelist parameters for Iron chemistry, nampisfer'
          WRITE(numout,*) ' ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~'
-         WRITE(numout,*) '    enable complex iron chemistry scheme      ln_fechem =', ln_fechem
-         WRITE(numout,*) '    variable concentration of ligand          ln_ligvar =', ln_ligvar
-         WRITE(numout,*) '    scavenging rate of Iron                   xlam1     =', xlam1
-         WRITE(numout,*) '    scavenging rate of Iron by dust           xlamdust  =', xlamdust
-         WRITE(numout,*) '    ligand concentration in the ocean         ligand    =', ligand
+         WRITE(numout,*) '    enable complex iron chemistry scheme      ln_fechem    =', ln_fechem
+         WRITE(numout,*) '    variable concentration of ligand          ln_ligvar    =', ln_ligvar
+         WRITE(numout,*) '    Variable colloidal fraction of Fe3+       ln_fecolloid =', ln_fecolloid
+         WRITE(numout,*) '    scavenging rate of Iron                   xlam1        =', xlam1
+         WRITE(numout,*) '    scavenging rate of Iron by dust           xlamdust     =', xlamdust
+         WRITE(numout,*) '    ligand concentration in the ocean         ligand       =', ligand
+         WRITE(numout,*) '    rate constant for nanoparticle formation  kfep         =', kfep
       ENDIF
       !
@@ -377,14 +434,4 @@
       !
    END SUBROUTINE p4z_fechem_init
-
-#else
-   !!======================================================================
-   !!  Dummy module :                                   No PISCES bio-model
-   !!======================================================================
-CONTAINS
-   SUBROUTINE p4z_fechem                    ! Empty routine
-   END SUBROUTINE p4z_fechem
-#endif 
-
    !!======================================================================
 END MODULE p4zfechem
Index: branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/NEMO/TOP_SRC/PISCES/P4Z/p4zflx.F90
===================================================================
--- branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/NEMO/TOP_SRC/PISCES/P4Z/p4zflx.F90	(revision 7383)
+++ branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/NEMO/TOP_SRC/PISCES/P4Z/p4zflx.F90	(revision 7391)
@@ -11,8 +11,4 @@
    !!                  !  2011-02  (J. Simeon, J. Orr) Include total atm P correction 
    !!----------------------------------------------------------------------
-#if defined key_pisces
-   !!----------------------------------------------------------------------
-   !!   'key_pisces'                                       PISCES bio-model
-   !!----------------------------------------------------------------------
    !!   p4z_flx       :   CALCULATES GAS EXCHANGE AND CHEMISTRY AT SEA SURFACE
    !!   p4z_flx_init  :   Read the namelist
@@ -26,7 +22,4 @@
    USE iom                          !  I/O manager
    USE fldread                      !  read input fields
-#if defined key_cpl_carbon_cycle
-   USE sbc_oce, ONLY :  atm_co2     !  atmospheric pCO2               
-#endif
 
    IMPLICIT NONE
@@ -48,11 +41,11 @@
 
    !                               !!* nampisatm namelist (Atmospheric PRessure) *
-   LOGICAL, PUBLIC ::   ln_presatm  !: ref. pressure: global mean Patm (F) or a constant (F)
-
-   REAL(wp) , ALLOCATABLE, SAVE, DIMENSION(:,:)  ::  patm      ! atmospheric pressure at kt                 [N/m2]
-   TYPE(FLD), ALLOCATABLE,       DIMENSION(:)    ::  sf_patm   ! structure of input fields (file informations, fields read)
-
-
-   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) :: oce_co2   !: ocean carbon flux 
+   LOGICAL, PUBLIC ::   ln_presatm     !: ref. pressure: global mean Patm (F) or a constant (F)
+   LOGICAL, PUBLIC ::   ln_presatmco2  !: accounting for spatial atm CO2 in the compuation of carbon flux (T) or not (F)
+
+   REAL(wp) , ALLOCATABLE, SAVE, DIMENSION(:,:) ::  patm      ! atmospheric pressure at kt                 [N/m2]
+   TYPE(FLD), ALLOCATABLE,       DIMENSION(:)   ::  sf_patm   ! structure of input fields (file informations, fields read)
+   TYPE(FLD), ALLOCATABLE,       DIMENSION(:)   ::  sf_atmco2 ! structure of input fields (file informations, fields read)
+
    REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) :: satmco2   !: atmospheric pco2 
 
@@ -74,5 +67,4 @@
       !! ** Method  : 
       !!              - Include total atm P correction via Esbensen & Kushnir (1981) 
-      !!              - Pressure correction NOT done for key_cpl_carbon_cycle
       !!              - Remove Wanninkhof chemical enhancement;
       !!              - Add option for time-interpolation of atcco2.txt  
@@ -85,5 +77,5 @@
       REAL(wp) ::   zfld, zflu, zfld16, zflu16, zfact
       REAL(wp) ::   zvapsw, zsal, zfco2, zxc2, xCO2approx, ztkel, zfugcoeff
-      REAL(wp) ::   zph, zah2, zbot, zdic, zalk, zsch_o2, zalka, zsch_co2
+      REAL(wp) ::   zph, zdic, zsch_o2, zsch_co2
       REAL(wp) ::   zyr_dec, zdco2dt
       CHARACTER (len=25) :: charout
@@ -100,7 +92,7 @@
       !     IS USED TO COMPUTE AIR-SEA FLUX OF CO2
 
-      IF( kt /= nit000 .AND. knt == 1 ) CALL p4z_patm( kt )    ! Get sea-level pressure (E&K [1981] climatology) for use in flux calcs
-
-      IF( ln_co2int ) THEN 
+      IF( kt /= nit000 .AND. .NOT.l_co2cpl .AND. knt == 1 ) CALL p4z_patm( kt )    ! Get sea-level pressure (E&K [1981] climatology) for use in flux calcs
+
+      IF( ln_co2int .AND. .NOT.ln_presatmco2 .AND. .NOT.l_co2cpl ) THEN 
          ! Linear temporal interpolation  of atmospheric pco2.  atcco2.txt has annual values.
          ! Caveats: First column of .txt must be in years, decimal  years preferably. 
@@ -116,33 +108,16 @@
       ENDIF
 
-#if defined key_cpl_carbon_cycle
-      satmco2(:,:) = atm_co2(:,:)
-#endif
-
-      DO jm = 1, 10
-         DO jj = 1, jpj
-            DO ji = 1, jpi
-
-               ! DUMMY VARIABLES FOR DIC, H+, AND BORATE
-               zbot  = borat(ji,jj,1)
-               zfact = rhop(ji,jj,1) / 1000. + rtrn
-               zdic  = trb(ji,jj,1,jpdic) / zfact
-               zph   = MAX( hi(ji,jj,1), 1.e-10 ) / zfact
-               zalka = trb(ji,jj,1,jptal) / zfact
-
-               ! CALCULATE [ALK]([CO3--], [HCO3-])
-               zalk  = zalka - (  akw3(ji,jj,1) / zph - zph / aphscale(ji,jj,1)    &
-               &       + zbot / ( 1.+ zph / akb3(ji,jj,1) )  )
-
-               ! CALCULATE [H+] AND [H2CO3]
-               zah2   = SQRT(  (zdic-zalk)**2 + 4.* ( zalk * ak23(ji,jj,1)   &
-                  &                                        / ak13(ji,jj,1) ) * ( 2.* zdic - zalk )  )
-               zah2   = 0.5 * ak13(ji,jj,1) / zalk * ( ( zdic - zalk ) + zah2 )
-               zh2co3(ji,jj) = ( 2.* zdic - zalk ) / ( 2.+ ak13(ji,jj,1) / zah2 ) * zfact
-               hi(ji,jj,1)   = zah2 * zfact
-            END DO
+      IF( l_co2cpl )   satmco2(:,:) = atm_co2(:,:)
+
+      DO jj = 1, jpj
+         DO ji = 1, jpi
+            ! DUMMY VARIABLES FOR DIC, H+, AND BORATE
+            zfact = rhop(ji,jj,1) / 1000. + rtrn
+            zdic  = trb(ji,jj,1,jpdic)
+            zph   = MAX( hi(ji,jj,1), 1.e-10 ) / zfact
+            ! CALCULATE [H2CO3]
+            zh2co3(ji,jj) = zdic/(1. + ak13(ji,jj,1)/zph + ak13(ji,jj,1)*ak23(ji,jj,1)/zph**2)
          END DO
       END DO
-
 
       ! --------------
@@ -167,7 +142,4 @@
             zkgwan = 0.251 * zws
             zkgwan = zkgwan * xconv * ( 1.- fr_i(ji,jj) ) * tmask(ji,jj,1)
-# if defined key_degrad
-            zkgwan = zkgwan * facvol(ji,jj,1)
-#endif 
             ! compute gas exchange for CO2 and O2
             zkgco2(ji,jj) = zkgwan * SQRT( 660./ zsch_co2 )
@@ -176,8 +148,9 @@
       END DO
 
+
       DO jj = 1, jpj
          DO ji = 1, jpi
-            ztkel     = tsn(ji,jj,1,jp_tem) + 273.15
-            zsal      = tsn(ji,jj,1,jp_sal) + ( 1.- tmask(ji,jj,1) ) * 35.
+            ztkel = tempis(ji,jj,1) + 273.15
+            zsal  = salinprac(ji,jj,1) + ( 1.- tmask(ji,jj,1) ) * 35.
             zvapsw    = EXP(24.4543 - 67.4509*(100.0/ztkel) - 4.8489*LOG(ztkel/100) - 0.000544*zsal)
             zpco2atm(ji,jj) = satmco2(ji,jj) * ( patm(ji,jj) - zvapsw )
@@ -232,5 +205,5 @@
          ENDIF
          IF( iom_use( "Dpo2" ) )  THEN
-           zw2d(:,:) = ( atcox * patm(:,:) - atcox * trn(:,:,1,jpoxy) / ( chemo2(:,:,1) + rtrn ) ) * tmask(:,:,1)
+           zw2d(:,:) = ( atcox * patm(:,:) - atcox * trb(:,:,1,jpoxy) / ( chemo2(:,:,1) + rtrn ) ) * tmask(:,:,1)
            CALL iom_put( "Dpo2"  , zw2d )
          ENDIF
@@ -239,11 +212,4 @@
          !
          CALL wrk_dealloc( jpi, jpj, zw2d )
-      ELSE
-         IF( ln_diatrc ) THEN
-            trc2d(:,:,jp_pcs0_2d    ) = oce_co2(:,:) / e1e2t(:,:) * rfact2r 
-            trc2d(:,:,jp_pcs0_2d + 1) = zoflx(:,:) * 1000 * tmask(:,:,1) 
-            trc2d(:,:,jp_pcs0_2d + 2) = zkgco2(:,:) * tmask(:,:,1) 
-            trc2d(:,:,jp_pcs0_2d + 3) = ( zpco2atm(:,:) - zh2co3(:,:) / ( chemc(:,:,1) + rtrn ) ) * tmask(:,:,1) 
-         ENDIF
       ENDIF
       !
@@ -287,5 +253,5 @@
          WRITE(numout,*) ' '
       ENDIF
-      IF( .NOT.ln_co2int ) THEN
+     IF( .NOT.ln_co2int .AND. .NOT.ln_presatmco2 ) THEN
          IF(lwp) THEN                         ! control print
             WRITE(numout,*) '    Constant Atmospheric pCO2 value  atcco2    =', atcco2
@@ -293,5 +259,5 @@
          ENDIF
          satmco2(:,:)  = atcco2      ! Initialisation of atmospheric pco2
-      ELSE
+      ELSEIF( ln_co2int .AND. .NOT.ln_presatmco2 ) THEN
          IF(lwp)  THEN
             WRITE(numout,*) '    Atmospheric pCO2 value  from file clname      =', TRIM( clname )
@@ -315,5 +281,16 @@
          END DO
          CLOSE(numco2)
-      ENDIF
+      ELSEIF( .NOT.ln_co2int .AND. ln_presatmco2 ) THEN
+         IF(lwp)  THEN
+            WRITE(numout,*) '    Spatialized Atmospheric pCO2 from an external file'
+            WRITE(numout,*) ' '
+         ENDIF
+      ELSE
+         IF(lwp)  THEN
+            WRITE(numout,*) '    Spatialized Atmospheric pCO2 from an external file'
+            WRITE(numout,*) ' '
+         ENDIF
+      ENDIF
+
       !
       oce_co2(:,:)  = 0._wp                ! Initialization of Flux of Carbon
@@ -341,6 +318,7 @@
       CHARACTER(len=100) ::  cn_dir   ! Root directory for location of ssr files
       TYPE(FLD_N)        ::  sn_patm  ! informations about the fields to be read
-      !!
-      NAMELIST/nampisatm/ ln_presatm, sn_patm, cn_dir
+      TYPE(FLD_N)        ::  sn_atmco2 ! informations about the fields to be read
+      !!
+      NAMELIST/nampisatm/ ln_presatm, ln_presatmco2, sn_patm, sn_atmco2, cn_dir
 
       !                                         ! ----------------------- !
@@ -361,4 +339,5 @@
             WRITE(numout,*) '   Namelist nampisatm : Atmospheric Pressure as external forcing'
             WRITE(numout,*) '      constant atmopsheric pressure (F) or from a file (T)  ln_presatm = ', ln_presatm
+            WRITE(numout,*) '      spatial atmopsheric CO2 for flux calcs  ln_presatmco2 = ', ln_presatmco2
             WRITE(numout,*)
          ENDIF
@@ -373,4 +352,13 @@
          ENDIF
          !                                         
+         IF( ln_presatmco2 ) THEN
+            ALLOCATE( sf_atmco2(1), STAT=ierr )           !* allocate and fill sf_atmco2 (forcing structure) with sn_atmco2
+            IF( ierr > 0 )   CALL ctl_stop( 'STOP', 'p4z_flx: unable to allocate sf_atmco2 structure' )
+            !
+            CALL fld_fill( sf_atmco2, (/ sn_atmco2 /), cn_dir, 'p4z_flx', 'Atmospheric co2 partial pressure ', 'nampisatm' )
+                                   ALLOCATE( sf_atmco2(1)%fnow(jpi,jpj,1)   )
+            IF( sn_atmco2%ln_tint )  ALLOCATE( sf_atmco2(1)%fdta(jpi,jpj,1,2) )
+         ENDIF
+         !
          IF( .NOT.ln_presatm )   patm(:,:) = 1.e0    ! Initialize patm if no reading from a file
          !
@@ -382,26 +370,23 @@
       ENDIF
       !
+      IF( ln_presatmco2 ) THEN
+         CALL fld_read( kt, 1, sf_atmco2 )               !* input atmco2 provided at kt + 1/2
+         satmco2(:,:) = sf_atmco2(1)%fnow(:,:,1)                        ! atmospheric pressure
+      ELSE
+         satmco2(:,:) = atcco2    ! Initialize atmco2 if no reading from a file
+      ENDIF
+      !
    END SUBROUTINE p4z_patm
 
+
    INTEGER FUNCTION p4z_flx_alloc()
       !!----------------------------------------------------------------------
       !!                     ***  ROUTINE p4z_flx_alloc  ***
       !!----------------------------------------------------------------------
-      ALLOCATE( oce_co2(jpi,jpj), satmco2(jpi,jpj), patm(jpi,jpj), STAT=p4z_flx_alloc )
+      ALLOCATE( satmco2(jpi,jpj), patm(jpi,jpj), STAT=p4z_flx_alloc )
       !
       IF( p4z_flx_alloc /= 0 )   CALL ctl_warn('p4z_flx_alloc : failed to allocate arrays')
       !
    END FUNCTION p4z_flx_alloc
-
-#else
-   !!======================================================================
-   !!  Dummy module :                                   No PISCES bio-model
-   !!======================================================================
-CONTAINS
-   SUBROUTINE p4z_flx( kt )                   ! Empty routine
-      INTEGER, INTENT( in ) ::   kt
-      WRITE(*,*) 'p4z_flx: You should not have seen this print! error?', kt
-   END SUBROUTINE p4z_flx
-#endif 
 
    !!======================================================================
Index: branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/NEMO/TOP_SRC/PISCES/P4Z/p4zint.F90
===================================================================
--- branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/NEMO/TOP_SRC/PISCES/P4Z/p4zint.F90	(revision 7383)
+++ branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/NEMO/TOP_SRC/PISCES/P4Z/p4zint.F90	(revision 7391)
@@ -7,8 +7,4 @@
    !!             2.0  !  2007-12  (C. Ethe, G. Madec)  F90
    !!----------------------------------------------------------------------
-#if defined key_pisces
-   !!----------------------------------------------------------------------
-   !!   'key_pisces'                                       PISCES bio-model
-   !!----------------------------------------------------------------------
    !!   p4z_int        :  interpolation and computation of various accessory fields
    !!----------------------------------------------------------------------
@@ -16,5 +12,4 @@
    USE trc             !  passive tracers common variables 
    USE sms_pisces      !  PISCES Source Minus Sink variables
-   USE iom
 
    IMPLICIT NONE
@@ -70,14 +65,4 @@
    END SUBROUTINE p4z_int
 
-#else
-   !!======================================================================
-   !!  Dummy module :                                   No PISCES bio-model
-   !!======================================================================
-CONTAINS
-   SUBROUTINE p4z_int                   ! Empty routine
-      WRITE(*,*) 'p4z_int: You should not have seen this print! error?'
-   END SUBROUTINE p4z_int
-#endif 
-
    !!======================================================================
 END MODULE p4zint
Index: branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/NEMO/TOP_SRC/PISCES/P4Z/p4zligand.F90
===================================================================
--- branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/NEMO/TOP_SRC/PISCES/P4Z/p4zligand.F90	(revision 7391)
+++ branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/NEMO/TOP_SRC/PISCES/P4Z/p4zligand.F90	(revision 7391)
@@ -0,0 +1,142 @@
+MODULE p4zligand
+   !!======================================================================
+   !!                         ***  MODULE p4zligand  ***
+   !! TOP :   PISCES Compute remineralization/dissolution of organic ligands
+   !!=========================================================================
+   !! History :   3.6  !  2016-03  (O. Aumont, A. Tagliabue) Quota model and reorganization
+   !!----------------------------------------------------------------------
+   !!   p4z_ligand       :  Compute remineralization/dissolution of organic ligands
+   !!   p4z_ligand_init  :  Initialisation of parameters for remineralisation
+   !!----------------------------------------------------------------------
+   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
+
+   IMPLICIT NONE
+   PRIVATE
+
+   PUBLIC   p4z_ligand         ! called in p4zbio.F90
+   PUBLIC   p4z_ligand_init    ! called in trcsms_pisces.F90
+
+   !! * Shared module variables
+   REAL(wp), PUBLIC ::  rlgw     !: lifetime (years) of weak ligands
+   REAL(wp), PUBLIC ::  rlgs     !: lifetime (years) of strong ligands
+   REAL(wp), PUBLIC ::  rlig     !: Remin ligand production
+   REAL(wp), PUBLIC ::  prlgw    !: Photochemical of weak ligand
+   REAL(wp), PUBLIC ::  rfep     !: Dissolution rate of FeP
+
+   !!----------------------------------------------------------------------
+   !! NEMO/TOP 3.3 , NEMO Consortium (2010)
+   !! $Id: p4zligand.F90 3160 2011-11-20 14:27:18Z cetlod $ 
+   !! Software governed by the CeCILL licence     (NEMOGCM/NEMO_CeCILL.txt)
+   !!----------------------------------------------------------------------
+CONTAINS
+
+   SUBROUTINE p4z_ligand( kt, knt )
+      !!---------------------------------------------------------------------
+      !!                     ***  ROUTINE p4z_ligand  ***
+      !!
+      !! ** Purpose :   Compute remineralization/scavenging of organic ligands
+      !!
+      !! ** Method  : - ???
+      !!---------------------------------------------------------------------
+      !
+      INTEGER, INTENT(in) ::   kt, knt ! ocean time step
+      !
+      INTEGER  ::   ji, jj, jk
+      REAL(wp) ::   zlgwp, zlgwpr, zlgwr, zlablgw, zrfepa, zfepr
+      CHARACTER (len=25) :: charout
+      !!---------------------------------------------------------------------
+      !
+      IF( nn_timing == 1 )  CALL timing_start('p4z_ligand')
+      !
+      ! ------------------------------------------------------------------
+      ! Remineralization of iron ligands
+      ! ------------------------------------------------------------------
+      DO jk = 1, jpkm1
+         DO jj = 1, jpj
+            DO ji = 1, jpi
+               ! production from remineralisation of organic matter
+               zlgwp  = orem(ji,jj,jk) * rlig
+               ! decay of weak ligand
+               ! This is based on the idea that as LGW is lower
+               ! there is a larger fraction of refractory OM
+               zlgwr = max( rlgs , rlgw * exp( -2 * (trb(ji,jj,jk,jplgw)*1e9) ) ) ! years
+               zlgwr = 1. / zlgwr * tgfunc(ji,jj,jk) * ( xstep / nyear_len(1) ) * trb(ji,jj,jk,jplgw)
+               ! photochem loss of weak ligand
+               zlgwpr = prlgw * xstep * etot(ji,jj,jk) * trb(ji,jj,jk,jplgw) * (1. - fr_i(ji,jj))
+               tra(ji,jj,jk,jplgw) = tra(ji,jj,jk,jplgw) + zlgwp - zlgwr - zlgwpr
+            END DO
+         END DO
+      END DO
+
+      ! ----------------------------------------------------------
+      ! Dissolution of nanoparticle Fe
+      ! ----------------------------------------------------------
+
+      DO jk = 1, jpkm1
+         DO jj = 1, jpj
+            DO ji = 1, jpi
+               ! dissolution rate is maximal in the presence of light and 
+               ! lower in the aphotici zone
+               ! ! 25 Wm-2 constant
+               zrfepa = rfep * ( 1. - EXP( -1. * etot(ji,jj,jk) / 25. ) ) * (1.- fr_i(ji,jj))
+               zrfepa = MAX( (zrfepa / 10.0), zrfepa ) ! min of 10 days lifetime
+               zfepr = rfep * xstep * trb(ji,jj,jk,jpfep)
+               tra(ji,jj,jk,jpfep) = tra(ji,jj,jk,jpfep) - zfepr
+               tra(ji,jj,jk,jpfer) = tra(ji,jj,jk,jpfer) + zfepr
+            END DO
+         END DO
+      END DO
+
+      IF(ln_ctl)   THEN  ! print mean trends (used for debugging)
+         WRITE(charout, FMT="('ligand1')")
+         CALL prt_ctl_trc_info(charout)
+         CALL prt_ctl_trc(tab4d=tra, mask=tmask, clinfo=ctrcnm)
+       ENDIF
+      !
+      IF( nn_timing == 1 )  CALL timing_stop('p4z_ligand')
+      !
+   END SUBROUTINE p4z_ligand
+
+
+   SUBROUTINE p4z_ligand_init
+      !!----------------------------------------------------------------------
+      !!                  ***  ROUTINE p4z_ligand_init  ***
+      !!
+      !! ** Purpose :   Initialization of remineralization parameters
+      !!
+      !! ** Method  :   Read the nampislig namelist and check the parameters
+      !!      called at the first timestep
+      !!
+      !! ** input   :   Namelist nampislig
+      !!
+      !!----------------------------------------------------------------------
+      NAMELIST/nampislig/ rlgw, prlgw, rlgs, rfep, rlig
+      INTEGER :: ios                 ! Local integer output status for namelist read
+
+      REWIND( numnatp_ref )              ! Namelist nampislig in reference namelist : Pisces remineralization
+      READ  ( numnatp_ref, nampislig, IOSTAT = ios, ERR = 901)
+901   IF( ios /= 0 ) CALL ctl_nam ( ios , 'nampislig in reference namelist', lwp )
+
+      REWIND( numnatp_cfg )              ! Namelist nampislig in configuration namelist : Pisces remineralization
+      READ  ( numnatp_cfg, nampislig, IOSTAT = ios, ERR = 902 )
+902   IF( ios /= 0 ) CALL ctl_nam ( ios , 'nampislig in configuration namelist', lwp )
+      IF(lwm) WRITE ( numonp, nampislig )
+
+      IF(lwp) THEN                         ! control print
+         WRITE(numout,*) ' '
+         WRITE(numout,*) ' Namelist parameters for ligands, nampislig'
+         WRITE(numout,*) ' ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~'
+         WRITE(numout,*) '    Dissolution rate of FeP                        rfep =', rfep
+         WRITE(numout,*) '    Lifetime (years) of weak ligands               rlgw =', rlgw
+         WRITE(numout,*) '    Remin ligand production per unit C             rlig =', rlig
+         WRITE(numout,*) '    Photolysis of weak ligand                     prlgw =', prlgw
+         WRITE(numout,*) '    Lifetime (years) of strong ligands             rlgs =', rlgs
+      ENDIF
+      !
+   END SUBROUTINE p4z_ligand_init
+
+   !!======================================================================
+END MODULE p4zligand
Index: branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/NEMO/TOP_SRC/PISCES/P4Z/p4zlim.F90
===================================================================
--- branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/NEMO/TOP_SRC/PISCES/P4Z/p4zlim.F90	(revision 7383)
+++ branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/NEMO/TOP_SRC/PISCES/P4Z/p4zlim.F90	(revision 7391)
@@ -8,8 +8,4 @@
    !!             3.4  !  2011-04  (O. Aumont, C. Ethe) Limitation for iron modelled in quota 
    !!----------------------------------------------------------------------
-#if defined key_pisces
-   !!----------------------------------------------------------------------
-   !!   'key_pisces'                                       PISCES bio-model
-   !!----------------------------------------------------------------------
    !!   p4z_lim        :   Compute the nutrients limitation terms 
    !!   p4z_lim_init   :   Read the namelist 
@@ -18,5 +14,4 @@
    USE trc             ! Tracers defined
    USE sms_pisces      ! PISCES variables
-   USE p4zopt          ! Optical
    USE iom             !  I/O manager
 
@@ -26,4 +21,5 @@
    PUBLIC p4z_lim    
    PUBLIC p4z_lim_init    
+   PUBLIC p4z_lim_alloc
 
    !! * Shared module variables
@@ -48,4 +44,21 @@
    REAL(wp), PUBLIC ::  qdfelim     !:  optimal Fe quota for diatoms
    REAL(wp), PUBLIC ::  caco3r      !:  mean rainratio 
+
+   !!* Phytoplankton limitation terms
+   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:)  ::   xnanono3   !: ???
+   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:)  ::   xdiatno3   !: ???
+   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:)  ::   xnanonh4   !: ???
+   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:)  ::   xdiatnh4   !: ???
+   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:)  ::   xnanopo4   !: ???
+   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:)  ::   xdiatpo4   !: ???
+   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:)  ::   xlimphy    !: ???
+   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:)  ::   xlimdia    !: ???
+   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:)  ::   xlimnfe    !: ???
+   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:)  ::   xlimdfe    !: ???
+   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:)  ::   xlimsi     !: ???
+   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:)  ::   xlimbac    !: ??
+   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:)  ::   xlimbacl   !: ??
+   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:)  ::   concdfe    !: ???
+   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:)  ::   concnfe    !: ???
 
    ! Coefficient for iron limitation
@@ -224,5 +237,5 @@
       !!----------------------------------------------------------------------
 
-      NAMELIST/nampislim/ concnno3, concdno3, concnnh4, concdnh4, concnfer, concdfer, concbfe,   &
+      NAMELIST/namp4zlim/ concnno3, concdno3, concnnh4, concdnh4, concnfer, concdfer, concbfe,   &
          &                concbno3, concbnh4, xsizedia, xsizephy, xsizern, xsizerd,          & 
          &                xksi1, xksi2, xkdoc, qnfelim, qdfelim, caco3r, oxymin
@@ -230,15 +243,15 @@
 
       REWIND( numnatp_ref )              ! Namelist nampislim in reference namelist : Pisces nutrient limitation parameters
-      READ  ( numnatp_ref, nampislim, IOSTAT = ios, ERR = 901)
-901   IF( ios /= 0 ) CALL ctl_nam ( ios , 'nampislim in reference namelist', lwp )
+      READ  ( numnatp_ref, namp4zlim, IOSTAT = ios, ERR = 901)
+901   IF( ios /= 0 ) CALL ctl_nam ( ios , 'namp4zlim in reference namelist', lwp )
 
       REWIND( numnatp_cfg )              ! Namelist nampislim in configuration namelist : Pisces nutrient limitation parameters 
-      READ  ( numnatp_cfg, nampislim, IOSTAT = ios, ERR = 902 )
-902   IF( ios /= 0 ) CALL ctl_nam ( ios , 'nampislim in configuration namelist', lwp )
-      IF(lwm) WRITE ( numonp, nampislim )
+      READ  ( numnatp_cfg, namp4zlim, IOSTAT = ios, ERR = 902 )
+902   IF( ios /= 0 ) CALL ctl_nam ( ios , 'namp4zlim in configuration namelist', lwp )
+      IF(lwm) WRITE ( numonp, namp4zlim )
 
       IF(lwp) THEN                         ! control print
          WRITE(numout,*) ' '
-         WRITE(numout,*) ' Namelist parameters for nutrient limitations, nampislim'
+         WRITE(numout,*) ' Namelist parameters for nutrient limitations, namp4zlim'
          WRITE(numout,*) ' ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~'
          WRITE(numout,*) '    mean rainratio                           caco3r    = ', caco3r
@@ -268,12 +281,24 @@
    END SUBROUTINE p4z_lim_init
 
-#else
-   !!======================================================================
-   !!  Dummy module :                                   No PISCES bio-model
-   !!======================================================================
-CONTAINS
-   SUBROUTINE p4z_lim                   ! Empty routine
-   END SUBROUTINE p4z_lim
-#endif 
+   INTEGER FUNCTION p4z_lim_alloc()
+      !!----------------------------------------------------------------------
+      !!                     ***  ROUTINE p5z_lim_alloc  ***
+      !!----------------------------------------------------------------------
+      USE lib_mpp , ONLY: ctl_warn
+      !!----------------------------------------------------------------------
+
+      !*  Biological arrays for phytoplankton growth
+      ALLOCATE( xnanono3(jpi,jpj,jpk), xdiatno3(jpi,jpj,jpk),       &
+         &      xnanonh4(jpi,jpj,jpk), xdiatnh4(jpi,jpj,jpk),       &
+         &      xnanopo4(jpi,jpj,jpk), xdiatpo4(jpi,jpj,jpk),       &
+         &      xlimphy (jpi,jpj,jpk), xlimdia (jpi,jpj,jpk),       &
+         &      xlimnfe (jpi,jpj,jpk), xlimdfe (jpi,jpj,jpk),       &
+         &      xlimbac (jpi,jpj,jpk), xlimbacl(jpi,jpj,jpk),       &
+         &      concnfe (jpi,jpj,jpk), concdfe (jpi,jpj,jpk),       &
+         &      xlimsi  (jpi,jpj,jpk), STAT=p4z_lim_alloc )
+      !
+      IF( p4z_lim_alloc /= 0 ) CALL ctl_warn('p4z_lim_alloc : failed to allocate arrays.')
+      !
+   END FUNCTION p4z_lim_alloc
 
    !!======================================================================
Index: branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/NEMO/TOP_SRC/PISCES/P4Z/p4zlys.F90
===================================================================
--- branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/NEMO/TOP_SRC/PISCES/P4Z/p4zlys.F90	(revision 7383)
+++ branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/NEMO/TOP_SRC/PISCES/P4Z/p4zlys.F90	(revision 7391)
@@ -11,8 +11,5 @@
    !!                  !  2011-02  (J. Simeon, J. Orr)  Calcon salinity dependence
    !!             3.4  !  2011-06  (O. Aumont, C. Ethe) Improvment of calcite dissolution
-   !!----------------------------------------------------------------------
-#if defined key_pisces
-   !!----------------------------------------------------------------------
-   !!   'key_pisces'                                       PISCES bio-model
+   !!             3.6  !  2015-05  (O. Aumont) PISCES quota
    !!----------------------------------------------------------------------
    !!   p4z_lys        :   Compute the CaCO3 dissolution 
@@ -22,4 +19,5 @@
    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
@@ -61,45 +59,32 @@
       INTEGER, INTENT(in) ::   kt, knt ! ocean time step
       INTEGER  ::   ji, jj, jk, jn
-      REAL(wp) ::   zalk, zdic, zph, zah2
-      REAL(wp) ::   zdispot, zfact, zcalcon, zalka, zaldi
+      REAL(wp) ::   zdispot, zfact, zcalcon
       REAL(wp) ::   zomegaca, zexcess, zexcess0
       CHARACTER (len=25) :: charout
-      REAL(wp), POINTER, DIMENSION(:,:,:) :: zco3, zco3sat, zcaldiss   
+      REAL(wp), POINTER, DIMENSION(:,:,:) :: zco3, zcaldiss, zhinit, zhi, zco3sat
       !!---------------------------------------------------------------------
       !
       IF( nn_timing == 1 )  CALL timing_start('p4z_lys')
       !
-      CALL wrk_alloc( jpi, jpj, jpk, zco3, zco3sat, zcaldiss )
+      CALL wrk_alloc( jpi, jpj, jpk, zco3, zcaldiss, zhinit, zhi, zco3sat )
       !
       zco3    (:,:,:) = 0.
       zcaldiss(:,:,:) = 0.
+      zhinit(:,:,:)   = hi(:,:,:) * 1000. / ( rhop(:,:,:) + rtrn )
       !     -------------------------------------------
       !     COMPUTE [CO3--] and [H+] CONCENTRATIONS
       !     -------------------------------------------
-      
-      DO jn = 1, 5                               !  BEGIN OF ITERATION
-         !
-         DO jk = 1, jpkm1
-            DO jj = 1, jpj
-               DO ji = 1, jpi
-                  zfact = rhop(ji,jj,jk) / 1000. + rtrn
-                  zph  = hi(ji,jj,jk) * tmask(ji,jj,jk) / zfact + ( 1.-tmask(ji,jj,jk) ) * 1.e-9 ! [H+]
-                  zdic  = trb(ji,jj,jk,jpdic) / zfact
-                  zalka = trb(ji,jj,jk,jptal) / zfact
-                  ! CALCULATE [ALK]([CO3--], [HCO3-])
-                  zalk  = zalka - ( akw3(ji,jj,jk) / zph - zph / ( aphscale(ji,jj,jk) + rtrn )  &
-                  &       + borat(ji,jj,jk) / ( 1. + zph / akb3(ji,jj,jk) ) )
-                  ! CALCULATE [H+] and [CO3--]
-                  zaldi = zdic - zalk
-                  zah2  = SQRT( zaldi * zaldi + 4.* ( zalk * ak23(ji,jj,jk) / ak13(ji,jj,jk) ) * ( zdic + zaldi ) )
-                  zah2  = 0.5 * ak13(ji,jj,jk) / zalk * ( zaldi + zah2 )
-                  !
-                  zco3(ji,jj,jk) = zalk / ( 2. + zah2 / ak23(ji,jj,jk) ) * zfact
-                  hi(ji,jj,jk)   = zah2 * zfact
-               END DO
+
+      CALL solve_at_general(zhinit, zhi)
+
+      DO jk = 1, jpkm1
+         DO jj = 1, jpj
+            DO ji = 1, jpi
+               zco3(ji,jj,jk) = trb(ji,jj,jk,jpdic) * ak13(ji,jj,jk) * ak23(ji,jj,jk) / (zhi(ji,jj,jk)**2   &
+               &                + ak13(ji,jj,jk) * zhi(ji,jj,jk) + ak13(ji,jj,jk) * ak23(ji,jj,jk) + rtrn )
+               hi(ji,jj,jk)   = zhi(ji,jj,jk) * rhop(ji,jj,jk) / 1000.
             END DO
          END DO
-         !
-      END DO 
+      END DO
 
       !     ---------------------------------------------------------
@@ -115,5 +100,5 @@
                ! DEVIATION OF [CO3--] FROM SATURATION VALUE
                ! Salinity dependance in zomegaca and divide by rhop/1000 to have good units
-               zcalcon  = calcon * ( tsn(ji,jj,jk,jp_sal) / 35._wp )
+               zcalcon  = calcon * ( salinprac(ji,jj,jk) / 35._wp )
                zfact    = rhop(ji,jj,jk) / 1000._wp
                zomegaca = ( zcalcon * zco3(ji,jj,jk) ) / ( aksp(ji,jj,jk) * zfact + rtrn )
@@ -129,11 +114,7 @@
                !       CACO3 GETS DISSOLVED EVEN IN THE CASE OF OVERSATURATION)
                zdispot = kdca * zexcess * trb(ji,jj,jk,jpcal)
-# if defined key_degrad
-               zdispot = zdispot * facvol(ji,jj,jk)
-# endif
               !  CHANGE OF [CO3--] , [ALK], PARTICULATE [CACO3],
               !       AND [SUM(CO2)] DUE TO CACO3 DISSOLUTION/PRECIPITATION
               zcaldiss(ji,jj,jk)  = zdispot * rfact2 / rmtss ! calcite dissolution
-              zco3(ji,jj,jk)      = zco3(ji,jj,jk) + zcaldiss(ji,jj,jk)
               !
               tra(ji,jj,jk,jptal) = tra(ji,jj,jk,jptal) + 2. * zcaldiss(ji,jj,jk)
@@ -150,10 +131,4 @@
          IF( iom_use( "CO3sat" ) ) CALL iom_put( "CO3sat", zco3sat(:,:,:) * 1.e+3            * tmask(:,:,:) )
          IF( iom_use( "DCAL"   ) ) CALL iom_put( "DCAL"  , zcaldiss(:,:,:) * 1.e+3 * rfact2r * tmask(:,:,:) )
-      ELSE
-         IF( ln_diatrc ) THEN
-            trc3d(:,:,:,jp_pcs0_3d    ) = -1. * LOG10( hi(:,:,:) ) * tmask(:,:,:)
-            trc3d(:,:,:,jp_pcs0_3d + 1) = zco3(:,:,:)              * tmask(:,:,:)
-            trc3d(:,:,:,jp_pcs0_3d + 2) = zco3sat(:,:,:)           * tmask(:,:,:)
-         ENDIF
       ENDIF
       !
@@ -164,5 +139,5 @@
       ENDIF
       !
-      CALL wrk_dealloc( jpi, jpj, jpk, zco3, zco3sat, zcaldiss )
+      CALL wrk_dealloc( jpi, jpj, jpk, zco3, zcaldiss, zhinit, zhi, zco3sat )
       !
       IF( nn_timing == 1 )  CALL timing_stop('p4z_lys')
@@ -183,8 +158,5 @@
       !!
       !!----------------------------------------------------------------------
-      INTEGER  ::  ji, jj, jk
       INTEGER  ::  ios                 ! Local integer output status for namelist read
-      REAL(wp) ::  zcaralk, zbicarb, zco3
-      REAL(wp) ::  ztmas, ztmas1
 
       NAMELIST/nampiscal/ kdca, nca
@@ -212,15 +184,4 @@
       !
    END SUBROUTINE p4z_lys_init
-
-#else
-   !!======================================================================
-   !!  Dummy module :                                   No PISCES bio-model
-   !!======================================================================
-CONTAINS
-   SUBROUTINE p4z_lys( kt )                   ! Empty routine
-      INTEGER, INTENT( in ) ::   kt
-      WRITE(*,*) 'p4z_lys: You should not have seen this print! error?', kt
-   END SUBROUTINE p4z_lys
-#endif 
    !!======================================================================
 END MODULE p4zlys
Index: branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/NEMO/TOP_SRC/PISCES/P4Z/p4zmeso.F90
===================================================================
--- branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/NEMO/TOP_SRC/PISCES/P4Z/p4zmeso.F90	(revision 7383)
+++ branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/NEMO/TOP_SRC/PISCES/P4Z/p4zmeso.F90	(revision 7391)
@@ -8,8 +8,4 @@
    !!             3.4  !  2011-06  (O. Aumont, C. Ethe) Quota model for iron
    !!----------------------------------------------------------------------
-#if defined key_pisces
-   !!----------------------------------------------------------------------
-   !!   'key_pisces'                                       PISCES bio-model
-   !!----------------------------------------------------------------------
    !!   p4z_meso       :   Compute the sources/sinks for mesozooplankton
    !!   p4z_meso_init  :   Initialization of the parameters for mesozooplankton
@@ -18,6 +14,4 @@
    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 p4zint          !  interpolation and computation of various fields
    USE p4zprod         !  production
    USE prtctl_trc      !  print control for debugging
@@ -70,11 +64,8 @@
       REAL(wp) :: zcompadi, zcompaph, zcompapoc, zcompaz, zcompam
       REAL(wp) :: zgraze2 , zdenom, zdenom2
-      REAL(wp) :: zfact   , zstep, zfood, zfoodlim, zproport
-      REAL(wp) :: zmortzgoc, zfrac, zfracfe, zratio, zratio2
+      REAL(wp) :: zfact   , zfood, zfoodlim, zproport
+      REAL(wp) :: zmortzgoc, zfrac, zfracfe, zratio, zratio2, zfracal, zgrazcal
       REAL(wp) :: zepshert, zepsherv, zgrarsig, zgraztot, zgraztotn, zgraztotf
       REAL(wp) :: zgrarem2, zgrafer2, zgrapoc2, zprcaca, zmortz2, zgrasrat, zgrasratn
-#if defined key_kriest
-      REAL znumpoc
-#endif
       REAL(wp) :: zrespz2, ztortz2, zgrazd, zgrazz, zgrazpof
       REAL(wp) :: zgrazn, zgrazpoc, zgraznf, zgrazf
@@ -87,8 +78,6 @@
       IF( nn_timing == 1 )  CALL timing_start('p4z_meso')
       !
-      IF( lk_iomput ) THEN
-         CALL wrk_alloc( jpi, jpj, jpk, zgrazing )
-         zgrazing(:,:,:) = 0._wp
-      ENDIF
+      CALL wrk_alloc( jpi, jpj, jpk, zgrazing )
+      zgrazing(:,:,:) = 0._wp
 
       DO jk = 1, jpkm1
@@ -96,10 +85,5 @@
             DO ji = 1, jpi
                zcompam   = MAX( ( trb(ji,jj,jk,jpmes) - 1.e-9 ), 0.e0 )
-# if defined key_degrad
-               zstep     = xstep * facvol(ji,jj,jk)
-# else
-               zstep     = xstep
-# endif
-               zfact     = zstep * tgfunc2(ji,jj,jk) * zcompam
+               zfact     = xstep * tgfunc2(ji,jj,jk) * zcompam
 
                !  Respiration rates of both zooplankton
@@ -126,5 +110,5 @@
                zdenom    = zfoodlim / ( xkgraz2 + zfoodlim )
                zdenom2   = zdenom / ( zfood + rtrn )
-               zgraze2   = grazrat2 * zstep * tgfunc2(ji,jj,jk) * trb(ji,jj,jk,jpmes) 
+               zgraze2   = grazrat2 * xstep * tgfunc2(ji,jj,jk) * trb(ji,jj,jk,jpmes) 
 
                zgrazd    = zgraze2  * xprefc   * zcompadi  * zdenom2 
@@ -140,14 +124,11 @@
                !  ----------------------------------
                !  ----------------------------------
-# if ! defined key_kriest
-               zgrazffeg = grazflux  * zstep * wsbio4(ji,jj,jk)      &
+               zgrazffeg = grazflux  * xstep * wsbio4(ji,jj,jk)      &
                &           * tgfunc2(ji,jj,jk) * trb(ji,jj,jk,jpgoc) * trb(ji,jj,jk,jpmes)
                zgrazfffg = zgrazffeg * trb(ji,jj,jk,jpbfe) / (trb(ji,jj,jk,jpgoc) + rtrn)
-# endif
-               zgrazffep = grazflux  * zstep *  wsbio3(ji,jj,jk)     &
+               zgrazffep = grazflux  * xstep *  wsbio3(ji,jj,jk)     &
                &           * tgfunc2(ji,jj,jk) * trb(ji,jj,jk,jppoc) * trb(ji,jj,jk,jpmes)
                zgrazfffp = zgrazffep * trb(ji,jj,jk,jpsfe) / (trb(ji,jj,jk,jppoc) + rtrn)
               !
-# if ! defined key_kriest
               zgraztot  = zgrazd + zgrazz + zgrazn + zgrazpoc + zgrazffep + zgrazffeg
               ! Compute the proportion of filter feeders
@@ -158,5 +139,5 @@
               zratio    = trb(ji,jj,jk,jpgsi) / ( trb(ji,jj,jk,jpgoc) + rtrn )
               zratio2   = zratio * zratio
-              zfrac     = zproport * grazflux  * zstep * wsbio4(ji,jj,jk)      &
+              zfrac     = zproport * grazflux  * xstep * wsbio4(ji,jj,jk)      &
                &          * trb(ji,jj,jk,jpgoc) * trb(ji,jj,jk,jpmes)          &
                &          * ( 0.2 + 3.8 * zratio2 / ( 1.**2 + zratio2 ) )
@@ -171,17 +152,7 @@
               &   + zgrazpoc + zgrazffep + zgrazffeg
               zgraztotf = zgrazf + zgraznf + zgrazz * ferat3 + zgrazpof + zgrazfffp + zgrazfffg
-# else
-              zgraztot  = zgrazd + zgrazz + zgrazn + zgrazpoc + zgrazffep
-              ! Compute the proportion of filter feeders
-              zproport  = zgrazffep / ( zgraztot + rtrn )
-              zgrazffep = zproport * zgrazffep
-              zgrazfffp = zproport * zgrazfffp
-              zgraztot  = zgrazd + zgrazz + zgrazn + zgrazpoc + zgrazffep
-              zgraztotn = zgrazd * quotad(ji,jj,jk) + zgrazz + zgrazn * quotan(ji,jj,jk) + zgrazpoc + zgrazffep
-              zgraztotf = zgrazf + zgraznf + zgrazz * ferat3 + zgrazpof + zgrazfffp
-# endif
 
               ! Total grazing ( grazing by microzoo is already computed in p4zmicro )
-              IF( lk_iomput )  zgrazing(ji,jj,jk) = zgraztot
+              zgrazing(ji,jj,jk) = zgraztot
 
               !    Mesozooplankton efficiency
@@ -202,4 +173,7 @@
                tra(ji,jj,jk,jpnh4) = tra(ji,jj,jk,jpnh4) + zgrarsig
                tra(ji,jj,jk,jpdoc) = tra(ji,jj,jk,jpdoc) + zgrarem2 - zgrarsig
+               !
+               IF( ln_ligand ) tra(ji,jj,jk,jplgw) = tra(ji,jj,jk,jplgw) + (zgrarem2 - zgrarsig) * ldocz
+               !
                tra(ji,jj,jk,jpoxy) = tra(ji,jj,jk,jpoxy) - o2ut * zgrarsig
                tra(ji,jj,jk,jpfer) = tra(ji,jj,jk,jpfer) + zgrafer2
@@ -220,26 +194,23 @@
                tra(ji,jj,jk,jpdfe) = tra(ji,jj,jk,jpdfe) - zgrazf
 
-               ! calcite production
-               zprcaca = xfracal(ji,jj,jk) * zgrazn
-               prodcal(ji,jj,jk) = prodcal(ji,jj,jk) + zprcaca  ! prodcal=prodcal(nanophy)+prodcal(microzoo)+prodcal(mesozoo)
-               !
-               zprcaca = part2 * zprcaca
-               tra(ji,jj,jk,jpdic) = tra(ji,jj,jk,jpdic) - zprcaca
-               tra(ji,jj,jk,jptal) = tra(ji,jj,jk,jptal) - 2. * zprcaca
-               tra(ji,jj,jk,jpcal) = tra(ji,jj,jk,jpcal) + zprcaca
-#if defined key_kriest
-              znumpoc = trb(ji,jj,jk,jpnum) / ( trb(ji,jj,jk,jppoc) + rtrn )
-              tra(ji,jj,jk,jppoc) = tra(ji,jj,jk,jppoc) + zmortzgoc - zgrazpoc - zgrazffep + zgrapoc2
-              tra(ji,jj,jk,jpnum) = tra(ji,jj,jk,jpnum) - zgrazpoc * znumpoc + zgrapoc2 * xkr_dmeso      &
-                 &   + zmortzgoc * xkr_dmeso - zgrazffep * znumpoc * wsbio4(ji,jj,jk) / ( wsbio3(ji,jj,jk) + rtrn )
-              tra(ji,jj,jk,jpsfe) = tra(ji,jj,jk,jpsfe) + ferat3 * zmortzgoc - zgrazfffp - zgrazpof    &
-                 &                 + zgraztotf * unass2
-#else
               tra(ji,jj,jk,jppoc) = tra(ji,jj,jk,jppoc) - zgrazpoc - zgrazffep + zfrac
+              prodpoc(ji,jj,jk) = prodpoc(ji,jj,jk) + zfrac
+              conspoc(ji,jj,jk) = conspoc(ji,jj,jk) - zgrazpoc - zgrazffep
               tra(ji,jj,jk,jpgoc) = tra(ji,jj,jk,jpgoc) + zmortzgoc - zgrazffeg + zgrapoc2 - zfrac
+              prodgoc(ji,jj,jk) = prodgoc(ji,jj,jk) + zmortzgoc + zgrapoc2
+              consgoc(ji,jj,jk) = consgoc(ji,jj,jk) - zgrazffeg - zfrac
               tra(ji,jj,jk,jpsfe) = tra(ji,jj,jk,jpsfe) - zgrazpof - zgrazfffp + zfracfe
               tra(ji,jj,jk,jpbfe) = tra(ji,jj,jk,jpbfe) + ferat3 * zmortzgoc - zgrazfffg     &
                  &                + zgraztotf * unass2 - zfracfe
-#endif
+              zfracal = trb(ji,jj,jk,jpcal) / (trb(ji,jj,jk,jppoc) + trb(ji,jj,jk,jpgoc) + rtrn )
+              zgrazcal = (zgrazffeg + zgrazpoc) * (1. - part2) * zfracal
+              ! calcite production
+              zprcaca = xfracal(ji,jj,jk) * zgrazn
+              prodcal(ji,jj,jk) = prodcal(ji,jj,jk) + zprcaca  ! prodcal=prodcal(nanophy)+prodcal(microzoo)+prodcal(mesozoo)
+              !
+              zprcaca = part2 * zprcaca
+              tra(ji,jj,jk,jpdic) = tra(ji,jj,jk,jpdic) + zgrazcal - zprcaca
+              tra(ji,jj,jk,jptal) = tra(ji,jj,jk,jptal) - 2. * ( zgrazcal + zprcaca )
+              tra(ji,jj,jk,jpcal) = tra(ji,jj,jk,jpcal) - zgrazcal + zprcaca
             END DO
          END DO
@@ -265,5 +236,5 @@
       ENDIF
       !
-      IF( lk_iomput )  CALL wrk_dealloc( jpi, jpj, jpk, zgrazing )
+      CALL wrk_dealloc( jpi, jpj, jpk, zgrazing )
       !
       IF( nn_timing == 1 )  CALL timing_stop('p4z_meso')
@@ -285,5 +256,5 @@
       !!----------------------------------------------------------------------
 
-      NAMELIST/nampismes/ part2, grazrat2, resrat2, mzrat2, xprefc, xprefp, xprefz,   &
+      NAMELIST/namp4zmes/ part2, grazrat2, resrat2, mzrat2, xprefc, xprefp, xprefz,   &
          &                xprefpoc, xthresh2dia, xthresh2phy, xthresh2zoo, xthresh2poc, &
          &                xthresh2, xkgraz2, epsher2, sigma2, unass2, grazflux
@@ -291,16 +262,16 @@
 
       REWIND( numnatp_ref )              ! Namelist nampismes in reference namelist : Pisces mesozooplankton
-      READ  ( numnatp_ref, nampismes, IOSTAT = ios, ERR = 901)
-901   IF( ios /= 0 ) CALL ctl_nam ( ios , 'nampismes in reference namelist', lwp )
+      READ  ( numnatp_ref, namp4zmes, IOSTAT = ios, ERR = 901)
+901   IF( ios /= 0 ) CALL ctl_nam ( ios , 'namp4zmes in reference namelist', lwp )
 
       REWIND( numnatp_cfg )              ! Namelist nampismes in configuration namelist : Pisces mesozooplankton
-      READ  ( numnatp_cfg, nampismes, IOSTAT = ios, ERR = 902 )
-902   IF( ios /= 0 ) CALL ctl_nam ( ios , 'nampismes in configuration namelist', lwp )
-      IF(lwm) WRITE ( numonp, nampismes )
+      READ  ( numnatp_cfg, namp4zmes, IOSTAT = ios, ERR = 902 )
+902   IF( ios /= 0 ) CALL ctl_nam ( ios , 'namp4zmes in configuration namelist', lwp )
+      IF(lwm) WRITE ( numonp, namp4zmes )
 
 
       IF(lwp) THEN                         ! control print
          WRITE(numout,*) ' ' 
-         WRITE(numout,*) ' Namelist parameters for mesozooplankton, nampismes'
+         WRITE(numout,*) ' Namelist parameters for mesozooplankton, namp4zmes'
          WRITE(numout,*) ' ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~'
          WRITE(numout,*) '    part of calcite not dissolved in mesozoo guts  part2        =', part2
@@ -327,14 +298,4 @@
    END SUBROUTINE p4z_meso_init
 
-
-#else
-   !!======================================================================
-   !!  Dummy module :                                   No PISCES bio-model
-   !!======================================================================
-CONTAINS
-   SUBROUTINE p4z_meso                    ! Empty routine
-   END SUBROUTINE p4z_meso
-#endif 
-
    !!======================================================================
 END MODULE p4zmeso
Index: branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/NEMO/TOP_SRC/PISCES/P4Z/p4zmicro.F90
===================================================================
--- branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/NEMO/TOP_SRC/PISCES/P4Z/p4zmicro.F90	(revision 7383)
+++ branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/NEMO/TOP_SRC/PISCES/P4Z/p4zmicro.F90	(revision 7391)
@@ -8,8 +8,4 @@
    !!             3.4  !  2011-06  (O. Aumont, C. Ethe) Quota model for iron
    !!----------------------------------------------------------------------
-#if defined key_pisces
-   !!----------------------------------------------------------------------
-   !!   'key_pisces'                                       PISCES bio-model
-   !!----------------------------------------------------------------------
    !!   p4z_micro       :   Compute the sources/sinks for microzooplankton
    !!   p4z_micro_init  :   Initialize and read the appropriate namelist
@@ -19,6 +15,4 @@
    USE sms_pisces      !  PISCES Source Minus Sink variables
    USE p4zlim          !  Co-limitations
-   USE p4zsink         !  vertical flux of particulate matter due to sinking
-   USE p4zint          !  interpolation and computation of various fields
    USE p4zprod         !  production
    USE iom             !  I/O manager
@@ -71,5 +65,5 @@
       REAL(wp) :: zcompadi, zcompaz , zcompaph, zcompapoc
       REAL(wp) :: zgraze  , zdenom, zdenom2
-      REAL(wp) :: zfact   , zstep, zfood, zfoodlim
+      REAL(wp) :: zfact   , zfood, zfoodlim
       REAL(wp) :: zepshert, zepsherv, zgrarsig, zgraztot, zgraztotn, zgraztotf
       REAL(wp) :: zgrarem, zgrafer, zgrapoc, zprcaca, zmortz
@@ -83,5 +77,5 @@
       IF( nn_timing == 1 )  CALL timing_start('p4z_micro')
       !
-      IF( lk_iomput )  CALL wrk_alloc( jpi, jpj, jpk, zgrazing )
+      CALL wrk_alloc( jpi, jpj, jpk, zgrazing )
       !
       DO jk = 1, jpkm1
@@ -89,9 +83,5 @@
             DO ji = 1, jpi
                zcompaz = MAX( ( trb(ji,jj,jk,jpzoo) - 1.e-9 ), 0.e0 )
-               zstep   = xstep
-# if defined key_degrad
-               zstep = zstep * facvol(ji,jj,jk)
-# endif
-               zfact   = zstep * tgfunc2(ji,jj,jk) * zcompaz
+               zfact   = xstep * tgfunc2(ji,jj,jk) * zcompaz
 
                !  Respiration rates of both zooplankton
@@ -115,5 +105,5 @@
                zdenom    = zfoodlim / ( xkgraz + zfoodlim )
                zdenom2   = zdenom / ( zfood + rtrn )
-               zgraze    = grazrat * zstep * tgfunc2(ji,jj,jk) * trb(ji,jj,jk,jpzoo) 
+               zgraze    = grazrat * xstep * tgfunc2(ji,jj,jk) * trb(ji,jj,jk,jpzoo) 
 
                zgrazp    = zgraze  * xpref2p * zcompaph  * zdenom2 
@@ -130,5 +120,5 @@
 
                ! Grazing by microzooplankton
-               IF( ln_diatrc .AND. lk_iomput )  zgrazing(ji,jj,jk) = zgraztot
+               zgrazing(ji,jj,jk) = zgraztot
 
                !    Various remineralization and excretion terms
@@ -148,13 +138,14 @@
                tra(ji,jj,jk,jpnh4) = tra(ji,jj,jk,jpnh4) + zgrarsig
                tra(ji,jj,jk,jpdoc) = tra(ji,jj,jk,jpdoc) + zgrarem - zgrarsig
+               !
+               IF( ln_ligand ) tra(ji,jj,jk,jplgw) = tra(ji,jj,jk,jplgw) + (zgrarem - zgrarsig) * ldocz
+               !
                tra(ji,jj,jk,jpoxy) = tra(ji,jj,jk,jpoxy) - o2ut * zgrarsig
                tra(ji,jj,jk,jpfer) = tra(ji,jj,jk,jpfer) + zgrafer
                tra(ji,jj,jk,jppoc) = tra(ji,jj,jk,jppoc) + zgrapoc
+               prodpoc(ji,jj,jk) = prodpoc(ji,jj,jk) + zgrapoc
                tra(ji,jj,jk,jpsfe) = tra(ji,jj,jk,jpsfe) + zgraztotf * unass
                tra(ji,jj,jk,jpdic) = tra(ji,jj,jk,jpdic) + zgrarsig
                tra(ji,jj,jk,jptal) = tra(ji,jj,jk,jptal) + rno3 * zgrarsig
-#if defined key_kriest
-               tra(ji,jj,jk,jpnum) = tra(ji,jj,jk,jpnum) + zgrapoc * xkr_dmicro
-#endif
                !   Update the arrays TRA which contain the biological sources and sinks
                !   --------------------------------------------------------------------
@@ -170,4 +161,6 @@
                tra(ji,jj,jk,jpdfe) = tra(ji,jj,jk,jpdfe) - zgrazsf
                tra(ji,jj,jk,jppoc) = tra(ji,jj,jk,jppoc) + zmortz - zgrazm
+               prodpoc(ji,jj,jk) = prodpoc(ji,jj,jk) + zmortz
+               conspoc(ji,jj,jk) = conspoc(ji,jj,jk) - zgrazm
                tra(ji,jj,jk,jpsfe) = tra(ji,jj,jk,jpsfe) + ferat3 * zmortz - zgrazmf
                !
@@ -180,19 +173,17 @@
                tra(ji,jj,jk,jptal) = tra(ji,jj,jk,jptal) - 2. * zprcaca
                tra(ji,jj,jk,jpcal) = tra(ji,jj,jk,jpcal) + zprcaca
-#if defined key_kriest
-               tra(ji,jj,jk,jpnum) = tra(ji,jj,jk,jpnum) + zmortz * xkr_dmicro &
-                                                         - zgrazm * trb(ji,jj,jk,jpnum) / ( trb(ji,jj,jk,jppoc) + rtrn )
-#endif
             END DO
          END DO
       END DO
       !
-      IF( lk_iomput .AND. knt == nrdttrc ) THEN
-         CALL wrk_alloc( jpi, jpj, jpk, zw3d )
-         IF( iom_use( "GRAZ1" ) ) THEN
-            zw3d(:,:,:) = zgrazing(:,:,:) * 1.e+3 * rfact2r * tmask(:,:,:)  !  Total grazing of phyto by zooplankton
-            CALL iom_put( "GRAZ1", zw3d )
+      IF( lk_iomput ) THEN
+         IF( knt == nrdttrc ) THEN
+           CALL wrk_alloc( jpi, jpj, jpk, zw3d )
+           IF( iom_use( "GRAZ1" ) ) THEN
+              zw3d(:,:,:) = zgrazing(:,:,:) * 1.e+3 * rfact2r * tmask(:,:,:)  !  Total grazing of phyto by zooplankton
+              CALL iom_put( "GRAZ1", zw3d )
+           ENDIF
+           CALL wrk_dealloc( jpi, jpj, jpk, zw3d )
          ENDIF
-         CALL wrk_dealloc( jpi, jpj, jpk, zw3d )
       ENDIF
       !
@@ -203,5 +194,5 @@
       ENDIF
       !
-      IF( lk_iomput )  CALL wrk_dealloc( jpi, jpj, jpk, zgrazing )
+      CALL wrk_dealloc( jpi, jpj, jpk, zgrazing )
       !
       IF( nn_timing == 1 )  CALL timing_stop('p4z_micro')
@@ -224,5 +215,5 @@
       !!----------------------------------------------------------------------
 
-      NAMELIST/nampiszoo/ part, grazrat, resrat, mzrat, xpref2c, xpref2p, &
+      NAMELIST/namp4zzoo/ part, grazrat, resrat, mzrat, xpref2c, xpref2p, &
          &                xpref2d,  xthreshdia,  xthreshphy,  xthreshpoc, &
          &                xthresh, xkgraz, epsher, sigma1, unass
@@ -230,15 +221,15 @@
 
       REWIND( numnatp_ref )              ! Namelist nampiszoo in reference namelist : Pisces microzooplankton
-      READ  ( numnatp_ref, nampiszoo, IOSTAT = ios, ERR = 901)
-901   IF( ios /= 0 ) CALL ctl_nam ( ios , 'nampiszoo in reference namelist', lwp )
+      READ  ( numnatp_ref, namp4zzoo, IOSTAT = ios, ERR = 901)
+901   IF( ios /= 0 ) CALL ctl_nam ( ios , 'namp4zzoo in reference namelist', lwp )
 
       REWIND( numnatp_cfg )              ! Namelist nampiszoo in configuration namelist : Pisces microzooplankton
-      READ  ( numnatp_cfg, nampiszoo, IOSTAT = ios, ERR = 902 )
-902   IF( ios /= 0 ) CALL ctl_nam ( ios , 'nampiszoo in configuration namelist', lwp )
-      IF(lwm) WRITE ( numonp, nampiszoo )
+      READ  ( numnatp_cfg, namp4zzoo, IOSTAT = ios, ERR = 902 )
+902   IF( ios /= 0 ) CALL ctl_nam ( ios , 'namp4zzoo in configuration namelist', lwp )
+      IF(lwm) WRITE ( numonp, namp4zzoo )
 
       IF(lwp) THEN                         ! control print
          WRITE(numout,*) ' '
-         WRITE(numout,*) ' Namelist parameters for microzooplankton, nampiszoo'
+         WRITE(numout,*) ' Namelist parameters for microzooplankton, namp4zzoo'
          WRITE(numout,*) ' ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~'
          WRITE(numout,*) '    part of calcite not dissolved in microzoo guts  part        =', part
@@ -261,13 +252,4 @@
    END SUBROUTINE p4z_micro_init
 
-#else
-   !!======================================================================
-   !!  Dummy module :                                   No PISCES bio-model
-   !!======================================================================
-CONTAINS
-   SUBROUTINE p4z_micro                    ! Empty routine
-   END SUBROUTINE p4z_micro
-#endif 
-
    !!======================================================================
 END MODULE p4zmicro
Index: branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/NEMO/TOP_SRC/PISCES/P4Z/p4zmort.F90
===================================================================
--- branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/NEMO/TOP_SRC/PISCES/P4Z/p4zmort.F90	(revision 7383)
+++ branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/NEMO/TOP_SRC/PISCES/P4Z/p4zmort.F90	(revision 7391)
@@ -7,8 +7,4 @@
    !!             2.0  !  2007-12  (C. Ethe, G. Madec)  F90
    !!----------------------------------------------------------------------
-#if defined key_pisces
-   !!----------------------------------------------------------------------
-   !!   'key_pisces'                                       PISCES bio-model
-   !!----------------------------------------------------------------------
    !!   p4z_mort       :   Compute the mortality terms for phytoplankton
    !!   p4z_mort_init  :   Initialize the mortality params for phytoplankton
@@ -17,6 +13,6 @@
    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 p4zprod         !  Primary productivity 
+   USE p4zlim          !  Phytoplankton limitation terms
    USE prtctl_trc      !  print control for debugging
 
@@ -34,5 +30,4 @@
    REAL(wp), PUBLIC :: mprat2  !:
 
-
    !!----------------------------------------------------------------------
    !! NEMO/TOP 3.3 , NEMO Consortium (2010)
@@ -73,5 +68,5 @@
       REAL(wp) :: zsizerat, zcompaph
       REAL(wp) :: zfactfe, zfactch, zprcaca, zfracal
-      REAL(wp) :: ztortp , zrespp , zmortp , zstep
+      REAL(wp) :: ztortp , zrespp , zmortp 
       CHARACTER (len=25) :: charout
       !!---------------------------------------------------------------------
@@ -84,8 +79,4 @@
             DO ji = 1, jpi
                zcompaph = MAX( ( trb(ji,jj,jk,jpphy) - 1e-8 ), 0.e0 )
-               zstep    = xstep
-# if defined key_degrad
-               zstep    = zstep * facvol(ji,jj,jk)
-# endif
                !     When highly limited by macronutrients, very small cells 
                !     dominate the community. As a consequence, aggregation
@@ -95,5 +86,5 @@
                !     Squared mortality of Phyto similar to a sedimentation term during
                !     blooms (Doney et al. 1996)
-               zrespp = wchl * 1.e6 * zstep * xdiss(ji,jj,jk) * zcompaph * zsizerat 
+               zrespp = wchl * 1.e6 * xstep * xdiss(ji,jj,jk) * zcompaph * zsizerat 
 
                !     Phytoplankton mortality. This mortality loss is slightly
@@ -119,14 +110,10 @@
                tra(ji,jj,jk,jptal) = tra(ji,jj,jk,jptal) - 2. * zprcaca
                tra(ji,jj,jk,jpcal) = tra(ji,jj,jk,jpcal) + zprcaca
-#if defined key_kriest
-               tra(ji,jj,jk,jppoc) = tra(ji,jj,jk,jppoc) + zmortp
-               tra(ji,jj,jk,jpnum) = tra(ji,jj,jk,jpnum) + ztortp * xkr_dnano + zrespp * xkr_ddiat
-               tra(ji,jj,jk,jpsfe) = tra(ji,jj,jk,jpsfe) + zmortp * zfactfe
-#else
                tra(ji,jj,jk,jpgoc) = tra(ji,jj,jk,jpgoc) + zfracal * zmortp
                tra(ji,jj,jk,jppoc) = tra(ji,jj,jk,jppoc) + ( 1. - zfracal ) * zmortp
+               prodpoc(ji,jj,jk) = prodpoc(ji,jj,jk) + ( 1. - zfracal ) * zmortp
+               prodgoc(ji,jj,jk) = prodgoc(ji,jj,jk) + zfracal * zmortp
                tra(ji,jj,jk,jpsfe) = tra(ji,jj,jk,jpsfe) + ( 1. - zfracal ) * zmortp * zfactfe
                tra(ji,jj,jk,jpbfe) = tra(ji,jj,jk,jpbfe) + zfracal * zmortp * zfactfe
-#endif
             END DO
          END DO
@@ -153,5 +140,5 @@
       INTEGER  ::  ji, jj, jk
       REAL(wp) ::  zfactfe,zfactsi,zfactch, zcompadi
-      REAL(wp) ::  zrespp2, ztortp2, zmortp2, zstep
+      REAL(wp) ::  zrespp2, ztortp2, zmortp2
       REAL(wp) ::  zlim2, zlim1
       CHARACTER (len=25) :: charout
@@ -176,17 +163,13 @@
                !    sticky and coagulate to sink quickly out of the euphotic zone
                !     ------------------------------------------------------------
-               zstep   = xstep
-# if defined key_degrad
-               zstep = zstep * facvol(ji,jj,jk)
-# endif
                !  Phytoplankton respiration 
                !     ------------------------
                zlim2   = xlimdia(ji,jj,jk) * xlimdia(ji,jj,jk)
                zlim1   = 0.25 * ( 1. - zlim2 ) / ( 0.25 + zlim2 ) 
-               zrespp2 = 1.e6 * zstep * (  wchld + wchldm * zlim1 ) * xdiss(ji,jj,jk) * zcompadi * trb(ji,jj,jk,jpdia)
+               zrespp2 = 1.e6 * xstep * (  wchld + wchldm * zlim1 ) * xdiss(ji,jj,jk) * zcompadi * trb(ji,jj,jk,jpdia)
 
                !     Phytoplankton mortality. 
                !     ------------------------
-               ztortp2 = mprat2 * zstep * trb(ji,jj,jk,jpdia)  / ( xkmort + trb(ji,jj,jk,jpdia) ) * zcompadi 
+               ztortp2 = mprat2 * xstep * trb(ji,jj,jk,jpdia)  / ( xkmort + trb(ji,jj,jk,jpdia) ) * zcompadi 
 
                zmortp2 = zrespp2 + ztortp2
@@ -202,14 +185,10 @@
                tra(ji,jj,jk,jpdsi) = tra(ji,jj,jk,jpdsi) - zmortp2 * zfactsi
                tra(ji,jj,jk,jpgsi) = tra(ji,jj,jk,jpgsi) + zmortp2 * zfactsi
-#if defined key_kriest
-               tra(ji,jj,jk,jppoc) = tra(ji,jj,jk,jppoc) + zmortp2  
-               tra(ji,jj,jk,jpnum) = tra(ji,jj,jk,jpnum) + ztortp2 * xkr_ddiat + zrespp2 * xkr_daggr
-               tra(ji,jj,jk,jpsfe) = tra(ji,jj,jk,jpsfe) + zmortp2 * zfactfe
-#else
                tra(ji,jj,jk,jpgoc) = tra(ji,jj,jk,jpgoc) + zrespp2 + 0.5 * ztortp2
                tra(ji,jj,jk,jppoc) = tra(ji,jj,jk,jppoc) + 0.5 * ztortp2
+               prodpoc(ji,jj,jk) = prodpoc(ji,jj,jk) + 0.5 * ztortp2
+               prodgoc(ji,jj,jk) = prodgoc(ji,jj,jk) + zrespp2 + 0.5 * ztortp2
                tra(ji,jj,jk,jpsfe) = tra(ji,jj,jk,jpsfe) + 0.5 * ztortp2 * zfactfe
                tra(ji,jj,jk,jpbfe) = tra(ji,jj,jk,jpbfe) + ( zrespp2 + 0.5 * ztortp2 ) * zfactfe
-#endif
             END DO
          END DO
@@ -240,19 +219,19 @@
       !!----------------------------------------------------------------------
 
-      NAMELIST/nampismort/ wchl, wchld, wchldm, mprat, mprat2
+      NAMELIST/namp4zmort/ wchl, wchld, wchldm, mprat, mprat2
       INTEGER :: ios                 ! Local integer output status for namelist read
 
       REWIND( numnatp_ref )              ! Namelist nampismort in reference namelist : Pisces phytoplankton
-      READ  ( numnatp_ref, nampismort, IOSTAT = ios, ERR = 901)
-901   IF( ios /= 0 ) CALL ctl_nam ( ios , 'nampismort in reference namelist', lwp )
+      READ  ( numnatp_ref, namp4zmort, IOSTAT = ios, ERR = 901)
+901   IF( ios /= 0 ) CALL ctl_nam ( ios , 'namp4zmort in reference namelist', lwp )
 
       REWIND( numnatp_cfg )              ! Namelist nampismort in configuration namelist : Pisces phytoplankton
-      READ  ( numnatp_cfg, nampismort, IOSTAT = ios, ERR = 902 )
-902   IF( ios /= 0 ) CALL ctl_nam ( ios , 'nampismort in configuration namelist', lwp )
-      IF(lwm) WRITE ( numonp, nampismort )
+      READ  ( numnatp_cfg, namp4zmort, IOSTAT = ios, ERR = 902 )
+902   IF( ios /= 0 ) CALL ctl_nam ( ios , 'namp4zmort in configuration namelist', lwp )
+      IF(lwm) WRITE ( numonp, namp4zmort )
 
       IF(lwp) THEN                         ! control print
          WRITE(numout,*) ' '
-         WRITE(numout,*) ' Namelist parameters for phytoplankton mortality, nampismort'
+         WRITE(numout,*) ' Namelist parameters for phytoplankton mortality, namp4zmort'
          WRITE(numout,*) ' ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~'
          WRITE(numout,*) '    quadratic mortality of phytoplankton      wchl      =', wchl
@@ -265,13 +244,4 @@
    END SUBROUTINE p4z_mort_init
 
-#else
-   !!======================================================================
-   !!  Dummy module :                                   No PISCES bio-model
-   !!======================================================================
-CONTAINS
-   SUBROUTINE p4z_mort                    ! Empty routine
-   END SUBROUTINE p4z_mort
-#endif 
-
    !!======================================================================
 END MODULE p4zmort
Index: branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/NEMO/TOP_SRC/PISCES/P4Z/p4zopt.F90
===================================================================
--- branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/NEMO/TOP_SRC/PISCES/P4Z/p4zopt.F90	(revision 7383)
+++ branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/NEMO/TOP_SRC/PISCES/P4Z/p4zopt.F90	(revision 7391)
@@ -9,8 +9,4 @@
    !!             3.4  !  2011-06  (O. Aumont, C. Ethe) Improve light availability of nano & diat
    !!----------------------------------------------------------------------
-#if defined  key_pisces
-   !!----------------------------------------------------------------------
-   !!   'key_pisces'                                       PISCES bio-model
-   !!----------------------------------------------------------------------
    !!   p4z_opt       : light availability in the water column
    !!----------------------------------------------------------------------
@@ -41,13 +37,9 @@
    INTEGER  :: ntimes_par                ! number of time steps in a file
    REAL(wp), ALLOCATABLE, SAVE,   DIMENSION(:,:) :: par_varsw    !: PAR fraction of shortwave
-
-   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) :: enano, ediat   !: PAR for phyto, nano and diat 
-   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) :: etot_ndcy      !: PAR over 24h in case of diurnal cycle
-   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) :: emoy           !: averaged PAR in the mixed layer
-   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) :: ekb, ekg, ekr  !: wavelength (Red-Green-Blue)
+   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:,:) :: ekb, ekg, ekr  !: wavelength (Red-Green-Blue)
 
    INTEGER  ::   nksrp   ! levels below which the light cannot penetrate ( depth larger than 391 m)
 
-   REAL(wp), DIMENSION(3,61), PUBLIC ::   xkrgb   !: tabulated attenuation coefficients for RGB absorption
+   REAL(wp), DIMENSION(3,61) ::   xkrgb   !: tabulated attenuation coefficients for RGB absorption
    
    !!----------------------------------------------------------------------
@@ -75,6 +67,7 @@
       REAL(wp) ::   zc0 , zc1 , zc2, zc3, z1_dep
       REAL(wp), POINTER, DIMENSION(:,:  ) :: zdepmoy, zetmp1, zetmp2, zetmp3, zetmp4
+      REAL(wp), POINTER, DIMENSION(:,:  ) :: zetmp5
       REAL(wp), POINTER, DIMENSION(:,:  ) :: zqsr100, zqsr_corr
-      REAL(wp), POINTER, DIMENSION(:,:,:) :: zpar, ze0, ze1, ze2, ze3
+      REAL(wp), POINTER, DIMENSION(:,:,:) :: zpar, ze0, ze1, ze2, ze3, zchl3d
       !!---------------------------------------------------------------------
       !
@@ -82,7 +75,8 @@
       !
       ! Allocate temporary workspace
-      CALL wrk_alloc( jpi, jpj,      zdepmoy, zetmp1, zetmp2, zetmp3, zetmp4 )
-      CALL wrk_alloc( jpi, jpj,      zqsr100, zqsr_corr )
-      CALL wrk_alloc( jpi, jpj, jpk, zpar   , ze0, ze1, ze2, ze3 )
+                   CALL wrk_alloc( jpi, jpj,      zdepmoy, zetmp1, zetmp2, zetmp3, zetmp4 )
+                   CALL wrk_alloc( jpi, jpj,      zqsr100, zqsr_corr )
+      IF( ln_p5z ) CALL wrk_alloc( jpi, jpj,      zetmp5 )
+                   CALL wrk_alloc( jpi, jpj, jpk, zpar   , ze0, ze1, ze2, ze3, zchl3d )
 
       IF( knt == 1 .AND. ln_varpar ) CALL p4z_opt_sbc( kt )
@@ -93,9 +87,14 @@
       ze2(:,:,:) = 0._wp
       ze3(:,:,:) = 0._wp
+      !
       !                                        !* attenuation coef. function of Chlorophyll and wavelength (Red-Green-Blue)
-      DO jk = 1, jpkm1                         !  --------------------------------------------------------
+                                               !  --------------------------------------------------------
+                    zchl3d(:,:,:) = trb(:,:,:,jpnch) + trb(:,:,:,jpdch)
+      IF( ln_p5z )  zchl3d(:,:,:) = zchl3d(:,:,:) + trb(:,:,:,jppch)
+      !
+      DO jk = 1, jpkm1   
          DO jj = 1, jpj
             DO ji = 1, jpi
-               zchl = ( trb(ji,jj,jk,jpnch) + trb(ji,jj,jk,jpdch) + rtrn ) * 1.e6
+               zchl = ( zchl3d(ji,jj,jk) + rtrn ) * 1.e6
                zchl = MIN(  10. , MAX( 0.05, zchl )  )
                irgb = NINT( 41 + 20.* LOG10( zchl ) + rtrn )
@@ -120,4 +119,9 @@
             ediat    (:,:,jk) =  1.6 * ze1(:,:,jk) + 0.69 * ze2(:,:,jk) + 0.7 * ze3(:,:,jk)
          END DO
+         IF( ln_p5z ) THEN
+            DO jk = 1, nksrp      
+              epico  (:,:,jk) =  2.1 * ze1(:,:,jk) + 0.42 * ze2(:,:,jk) + 0.4 * ze3(:,:,jk)
+            END DO
+         ENDIF
          !
          zqsr_corr(:,:) = qsr(:,:) / ( 1. - fr_i(:,:) + rtrn )
@@ -140,4 +144,9 @@
             ediat(:,:,jk) =  1.6 * ze1(:,:,jk) + 0.69 * ze2(:,:,jk) + 0.7 * ze3(:,:,jk)
          END DO
+         IF( ln_p5z ) THEN
+            DO jk = 1, nksrp      
+              epico(:,:,jk) =  2.1 * ze1(:,:,jk) + 0.42 * ze2(:,:,jk) + 0.4 * ze3(:,:,jk)
+            END DO
+         ENDIF
          etot_ndcy(:,:,:) =  etot(:,:,:) 
       ENDIF
@@ -155,6 +164,7 @@
       ENDIF
       !                                        !* Euphotic depth and level
-      neln(:,:) = 1                            !  ------------------------
-      heup(:,:) = 300.
+      neln   (:,:) = 1                            !  ------------------------
+      heup   (:,:) = gdepw_n(:,:,2)
+      heup_01(:,:) = gdepw_n(:,:,2)
 
       DO jk = 2, nksrp
@@ -166,9 +176,13 @@
                  heup(ji,jj) = gdepw_n(ji,jj,jk+1)     ! Euphotic layer depth
               ENDIF
+              IF( etot_ndcy(ji,jj,jk) * tmask(ji,jj,jk) >= 0.50 )  THEN
+                 heup_01(ji,jj) = gdepw_n(ji,jj,jk+1)  ! Euphotic layer depth (light level definition)
+              ENDIF
            END DO
         END DO
       END DO
       !
-      heup(:,:) = MIN( 300., heup(:,:) )
+      heup   (:,:) = MIN( 300., heup   (:,:) )
+      heup_01(:,:) = MIN( 300., heup_01(:,:) )
       !                                        !* mean light over the mixed layer
       zdepmoy(:,:)   = 0.e0                    !  -------------------------------
@@ -209,4 +223,18 @@
       END DO
       !
+      IF( ln_p5z ) THEN
+         zetmp5 (:,:) = 0.e0
+         DO jk = 1, nksrp
+            DO jj = 1, jpj
+               DO ji = 1, jpi
+                  IF( gdepw_n(ji,jj,jk+1) <= hmld(ji,jj) ) THEN 
+                     z1_dep = 1. / ( zdepmoy(ji,jj) + rtrn )
+                     zetmp5(ji,jj)  = zetmp5 (ji,jj) + epico(ji,jj,jk) * e3t_n(ji,jj,jk) ! production
+                     epico(ji,jj,jk) = zetmp5(ji,jj) * z1_dep
+                  ENDIF
+               END DO
+            END DO
+         END DO
+      ENDIF
       IF( lk_iomput ) THEN
         IF( knt == nrdttrc ) THEN
@@ -215,14 +243,10 @@
            IF( iom_use( "PAR"   ) ) CALL iom_put( "PAR"  , emoy(:,:,:) * tmask(:,:,:) )  ! Photosynthetically Available Radiation
         ENDIF
-      ELSE
-         IF( ln_diatrc ) THEN        ! save output diagnostics
-            trc2d(:,:,  jp_pcs0_2d + 10) = heup(:,:  ) * tmask(:,:,1)
-            trc3d(:,:,:,jp_pcs0_3d + 3)  = etot(:,:,:) * tmask(:,:,:)
-         ENDIF
-      ENDIF
-      !
-      CALL wrk_dealloc( jpi, jpj,      zdepmoy, zetmp1, zetmp2, zetmp3, zetmp4 )
-      CALL wrk_dealloc( jpi, jpj,      zqsr100, zqsr_corr )
-      CALL wrk_dealloc( jpi, jpj, jpk, zpar   ,  ze0, ze1, ze2, ze3 )
+      ENDIF
+      !
+                   CALL wrk_dealloc( jpi, jpj,      zdepmoy, zetmp1, zetmp2, zetmp3, zetmp4 )
+                   CALL wrk_dealloc( jpi, jpj,      zqsr100, zqsr_corr )
+      IF( ln_p5z ) CALL wrk_dealloc( jpi, jpj,      zetmp5 )
+                   CALL wrk_dealloc( jpi, jpj, jpk, zpar   ,  ze0, ze1, ze2, ze3, zchl3d )
       !
       IF( nn_timing == 1 )  CALL timing_stop('p4z_opt')
@@ -407,4 +431,5 @@
                          enano    (:,:,:) = 0._wp
                          ediat    (:,:,:) = 0._wp
+      IF( ln_p5z     )   epico    (:,:,:) = 0._wp
       IF( ln_qsr_bio )   etot3    (:,:,:) = 0._wp
       ! 
@@ -418,20 +443,11 @@
       !!                     ***  ROUTINE p4z_opt_alloc  ***
       !!----------------------------------------------------------------------
-      ALLOCATE( ekb(jpi,jpj,jpk)      , ekr(jpi,jpj,jpk), ekg(jpi,jpj,jpk),   &
-        &       enano(jpi,jpj,jpk)    , ediat(jpi,jpj,jpk), &
-        &       etot_ndcy(jpi,jpj,jpk), emoy (jpi,jpj,jpk), STAT=p4z_opt_alloc ) 
-         !
+      !
+      ALLOCATE( ekb(jpi,jpj,jpk), ekr(jpi,jpj,jpk),  &
+                ekg(jpi,jpj,jpk), STAT= p4z_opt_alloc  ) 
+      !
       IF( p4z_opt_alloc /= 0 ) CALL ctl_warn('p4z_opt_alloc : failed to allocate arrays.')
       !
    END FUNCTION p4z_opt_alloc
-
-#else
-   !!----------------------------------------------------------------------
-   !!  Dummy module :                                   No PISCES bio-model
-   !!----------------------------------------------------------------------
-CONTAINS
-   SUBROUTINE p4z_opt                   ! Empty routine
-   END SUBROUTINE p4z_opt
-#endif 
 
    !!======================================================================
Index: branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/NEMO/TOP_SRC/PISCES/P4Z/p4zpoc.F90
===================================================================
--- branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/NEMO/TOP_SRC/PISCES/P4Z/p4zpoc.F90	(revision 7391)
+++ branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/NEMO/TOP_SRC/PISCES/P4Z/p4zpoc.F90	(revision 7391)
@@ -0,0 +1,948 @@
+MODULE p4zpoc
+   !!======================================================================
+   !!                         ***  MODULE p4zpoc  ***
+   !! TOP :   PISCES Compute remineralization of organic particles
+   !!=========================================================================
+   !! History :   1.0  !  2004     (O. Aumont) Original code
+   !!             2.0  !  2007-12  (C. Ethe, G. Madec)  F90
+   !!             3.4  !  2011-06  (O. Aumont, C. Ethe) Quota model for iron
+   !!             3.6  !  2016-03  (O. Aumont) Quota model and diverse
+   !!----------------------------------------------------------------------
+   !!   p4z_poc       :  Compute remineralization/dissolution of organic compounds
+   !!   p4z_poc_init  :  Initialisation of parameters for remineralisation
+   !!----------------------------------------------------------------------
+   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
+   PRIVATE
+
+   PUBLIC   p4z_poc         ! called in p4zbio.F90
+   PUBLIC   p4z_poc_init    ! called in trcsms_pisces.F90
+   PUBLIC   alngam
+   PUBLIC   gamain
+
+   !! * Shared module variables
+   REAL(wp), PUBLIC ::  xremip     !: remineralisation rate of DOC
+   REAL(wp), PUBLIC ::  xremipc    !: remineralisation rate of DOC
+   REAL(wp), PUBLIC ::  xremipn    !: remineralisation rate of DON
+   REAL(wp), PUBLIC ::  xremipp    !: remineralisation rate of DOP
+   INTEGER , PUBLIC ::  jcpoc      !: number of lability classes
+   REAL(wp), PUBLIC ::  rshape     !: shape factor of the gamma distribution
+
+   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:)     ::   alphan, reminp
+   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:,:) :: alphap
+
+
+   !!----------------------------------------------------------------------
+   !! NEMO/TOP 3.3 , NEMO Consortium (2010)
+   !! $Id: p4zrem.F90 3160 2011-11-20 14:27:18Z cetlod $ 
+   !! Software governed by the CeCILL licence     (NEMOGCM/NEMO_CeCILL.txt)
+   !!----------------------------------------------------------------------
+CONTAINS
+
+   SUBROUTINE p4z_poc( kt, knt )
+      !!---------------------------------------------------------------------
+      !!                     ***  ROUTINE p4z_poc  ***
+      !!
+      !! ** Purpose :   Compute remineralization of organic particles
+      !!
+      !! ** Method  : - ???
+      !!---------------------------------------------------------------------
+      !
+      INTEGER, INTENT(in) ::   kt, knt ! ocean time step
+      !
+      INTEGER  ::   ji, jj, jk, jn
+      REAL(wp) ::   zremip, zremig, zdep, zorem, zorem2, zofer
+      REAL(wp) ::   zopon, zopop, zopoc, zopoc2, zopon2, zopop2
+      REAL(wp) ::   zsizek, zsizek1, alphat, remint, solgoc, zpoc
+      REAL(wp) ::   zofer2, zofer3
+      REAL(wp) ::   zrfact2
+      CHARACTER (len=25) :: charout
+      REAL(wp), POINTER, DIMENSION(:,:  )   :: totprod, totthick, totcons 
+      REAL(wp), POINTER, DIMENSION(:,:,:)   :: zremipoc, zremigoc, zorem3, ztremint
+      REAL(wp), POINTER, DIMENSION(:,:,:,:) :: alphag
+      !!---------------------------------------------------------------------
+      !
+      IF( nn_timing == 1 )  CALL timing_start('p4z_poc')
+      !
+      ! Allocate temporary workspace
+      CALL wrk_alloc( jpi, jpj,      totprod,  totthick, totcons )
+      CALL wrk_alloc( jpi, jpj, jpk, zremipoc, zremigoc, zorem3, ztremint )
+      ALLOCATE( alphag(jpi,jpj,jpk,jcpoc) )
+
+      ! Initialization of local variables
+      ! ---------------------------------
+
+      ! Here we compute the GOC -> POC rate due to the shrinking
+      ! of the fecal pellets/aggregates as a result of bacterial
+      ! solubilization
+      ! This is based on a fractal dimension of 2.56 and a spectral
+      ! slope of -3.6 (identical to what is used in p4zsink to compute
+      ! aggregation
+      solgoc = 0.04/ 2.56 * 1./ ( 1.-50**(-0.04) )
+
+      ! Initialisation of temprary arrys
+      IF( ln_p4z ) THEN
+         zremipoc(:,:,:) = xremip
+         zremigoc(:,:,:) = xremip
+      ELSE    ! ln_p5z
+         zremipoc(:,:,:) = xremipc
+         zremigoc(:,:,:) = xremipc
+      ENDIF
+      zorem3(:,:,:)   = 0.
+      orem  (:,:,:)   = 0.
+      ztremint(:,:,:) = 0.
+
+      DO jn = 1, jcpoc
+        alphag(:,:,:,jn) = alphan(jn)
+        alphap(:,:,:,jn) = alphan(jn)
+      END DO
+
+     ! -----------------------------------------------------------------------
+     ! Lability parameterization. This is the big particles part (GOC)
+     ! This lability parameterization can be activated only with the standard
+     ! particle scheme. Does not work with Kriest parameterization.
+     ! -----------------------------------------------------------------------
+     DO jk = 2, jpkm1
+        DO jj = 1, jpj
+           DO ji = 1, jpi
+              IF (tmask(ji,jj,jk) == 1.) THEN
+                zdep = hmld(ji,jj)
+                !
+                ! In the case of GOC, lability is constant in the mixed layer 
+                ! It is computed only below the mixed layer depth
+                ! ------------------------------------------------------------
+                !
+                IF( gdept_n(ji,jj,jk) > zdep ) THEN
+                  alphat = 0.
+                  remint = 0.
+                  !
+                  zsizek1  = e3t_n(ji,jj,jk-1) / 2. / (wsbio4(ji,jj,jk-1) + rtrn) * tgfunc(ji,jj,jk-1)
+                  zsizek = e3t_n(ji,jj,jk) / 2. / (wsbio4(ji,jj,jk) + rtrn) * tgfunc(ji,jj,jk)
+                  !
+                  IF ( gdept_n(ji,jj,jk-1) <= zdep ) THEN
+                    ! 
+                    ! The first level just below the mixed layer needs a 
+                    ! specific treatment because lability is supposed constant
+                    ! everywhere within the mixed layer. This means that 
+                    ! change in lability in the bottom part of the previous cell
+                    ! should not be computed
+                    ! ----------------------------------------------------------
+                    !
+                    ! POC concentration is computed using the lagrangian 
+                    ! framework. It is only used for the lability param
+                    zpoc = trb(ji,jj,jk-1,jpgoc) + consgoc(ji,jj,jk) * rday / rfact2               &
+                    &   * e3t_n(ji,jj,jk) / 2. / (wsbio4(ji,jj,jk) + rtrn)
+                    zpoc = MAX(0., zpoc)
+                    !
+                    DO jn = 1, jcpoc
+                       !
+                       ! Lagrangian based algorithm. The fraction of each 
+                       ! lability class is computed starting from the previous
+                       ! level
+                       ! -----------------------------------------------------
+                       !
+                       ! the concentration of each lability class is calculated
+                       ! as the sum of the different sources and sinks
+                       ! Please note that production of new GOC experiences
+                       ! degradation 
+                       alphag(ji,jj,jk,jn) = alphag(ji,jj,jk-1,jn) * exp( -reminp(jn) * zsizek ) * zpoc &
+                       &   + prodgoc(ji,jj,jk) * alphan(jn) / tgfunc(ji,jj,jk) / reminp(jn)             &
+                       &   * ( 1. - exp( -reminp(jn) * zsizek ) ) * rday / rfact2 
+                       alphat = alphat + alphag(ji,jj,jk,jn)
+                       remint = remint + alphag(ji,jj,jk,jn) * reminp(jn)
+                    END DO
+                  ELSE
+                    !
+                    ! standard algorithm in the rest of the water column
+                    ! See the comments in the previous block.
+                    ! ---------------------------------------------------
+                    !
+                    zpoc = trb(ji,jj,jk-1,jpgoc) + consgoc(ji,jj,jk-1) * rday / rfact2               &
+                    &   * e3t_n(ji,jj,jk-1) / 2. / (wsbio4(ji,jj,jk-1) + rtrn) + consgoc(ji,jj,jk)   &
+                    &   * rday / rfact2 * e3t_n(ji,jj,jk) / 2. / (wsbio4(ji,jj,jk) + rtrn)
+                    zpoc = max(0., zpoc)
+                    !
+                    DO jn = 1, jcpoc
+                       alphag(ji,jj,jk,jn) = alphag(ji,jj,jk-1,jn) * exp( -reminp(jn) * ( zsizek              &
+                       &   + zsizek1 ) ) * zpoc + ( prodgoc(ji,jj,jk-1) / tgfunc(ji,jj,jk-1) * ( 1.           &
+                       &   - exp( -reminp(jn) * zsizek1 ) ) * exp( -reminp(jn) * zsizek ) + prodgoc(ji,jj,jk) &
+                       &   / tgfunc(ji,jj,jk) * ( 1. - exp( -reminp(jn) * zsizek ) ) ) * rday / rfact2 / reminp(jn) 
+                       alphat = alphat + alphag(ji,jj,jk,jn)
+                       remint = remint + alphag(ji,jj,jk,jn) * reminp(jn)
+                    END DO
+                  ENDIF
+                  !
+                  DO jn = 1, jcpoc
+                     ! The contribution of each lability class at the current
+                     ! level is computed
+                     alphag(ji,jj,jk,jn) = alphag(ji,jj,jk,jn) / ( alphat + rtrn)
+                  END DO
+                  ! Computation of the mean remineralisation rate
+                  ztremint(ji,jj,jk) =  MAX(0., remint / ( alphat + rtrn) )
+                  !
+                ENDIF
+              ENDIF
+            END DO
+         END DO
+      END DO
+
+      IF( ln_p4z ) THEN   ;  zremigoc(:,:,:) = MIN( xremip , ztremint(:,:,:) )
+      ELSE                ;  zremigoc(:,:,:) = MIN( xremipc, ztremint(:,:,:) )
+      ENDIF
+
+      IF( ln_p4z ) THEN
+         DO jk = 1, jpkm1
+            DO jj = 1, jpj
+               DO ji = 1, jpi
+                  ! POC disaggregation by turbulence and bacterial activity. 
+                  ! --------------------------------------------------------
+                  zremig = zremigoc(ji,jj,jk) * xstep * tgfunc(ji,jj,jk)
+                  zorem2  = zremig * trb(ji,jj,jk,jpgoc)
+                  orem(ji,jj,jk)      = zorem2
+                  zorem3(ji,jj,jk) = zremig * solgoc * trb(ji,jj,jk,jpgoc)
+                  zofer2 = zremig * trb(ji,jj,jk,jpbfe)
+                  zofer3 = zremig * solgoc * trb(ji,jj,jk,jpbfe)
+
+                  ! -------------------------------------
+                  tra(ji,jj,jk,jppoc) = tra(ji,jj,jk,jppoc) + zorem3(ji,jj,jk)
+                  tra(ji,jj,jk,jpgoc) = tra(ji,jj,jk,jpgoc) - zorem2 - zorem3(ji,jj,jk)
+                  tra(ji,jj,jk,jpsfe) = tra(ji,jj,jk,jpsfe) + zofer3
+                  tra(ji,jj,jk,jpbfe) = tra(ji,jj,jk,jpbfe) - zofer2 - zofer3
+                  tra(ji,jj,jk,jpdoc) = tra(ji,jj,jk,jpdoc) + zorem2
+                  tra(ji,jj,jk,jpfer) = tra(ji,jj,jk,jpfer) + zofer2
+               END DO
+            END DO
+         END DO
+      ELSE
+         DO jk = 1, jpkm1
+            DO jj = 1, jpj
+               DO ji = 1, jpi
+                   ! POC disaggregation by turbulence and bacterial activity. 
+                  ! --------------------------------------------------------
+                  zremig = zremigoc(ji,jj,jk) * xstep * tgfunc(ji,jj,jk)
+                  zopoc2 = zremig  * trb(ji,jj,jk,jpgoc)
+                  orem(ji,jj,jk) = zopoc2
+                  zorem3(ji,jj,jk) = zremig * solgoc * trb(ji,jj,jk,jpgoc)
+                  zopon2 = xremipn / xremipc * zremig * trb(ji,jj,jk,jpgon)
+                  zopop2 = xremipp / xremipc * zremig * trb(ji,jj,jk,jpgop)
+                  zofer2 = xremipn / xremipc * zremig * trb(ji,jj,jk,jpbfe)
+
+                  ! -------------------------------------
+                  tra(ji,jj,jk,jppoc) = tra(ji,jj,jk,jppoc) + zorem3(ji,jj,jk)
+                  tra(ji,jj,jk,jppon) = tra(ji,jj,jk,jppon) + solgoc * zopon2 
+                  tra(ji,jj,jk,jppop) = tra(ji,jj,jk,jppop) + solgoc * zopop2
+                  tra(ji,jj,jk,jpsfe) = tra(ji,jj,jk,jpsfe) + solgoc * zofer2
+                  tra(ji,jj,jk,jpdoc) = tra(ji,jj,jk,jpdoc) + zopoc2
+                  tra(ji,jj,jk,jpdon) = tra(ji,jj,jk,jpdon) + zopon2
+                  tra(ji,jj,jk,jpdop) = tra(ji,jj,jk,jpdop) + zopop2
+                  tra(ji,jj,jk,jpfer) = tra(ji,jj,jk,jpfer) + zofer2
+                  tra(ji,jj,jk,jpgoc) = tra(ji,jj,jk,jpgoc) - zopoc2 - zorem3(ji,jj,jk)
+                  tra(ji,jj,jk,jpgon) = tra(ji,jj,jk,jpgon) - zopon2 * (1. + solgoc)
+                  tra(ji,jj,jk,jpgop) = tra(ji,jj,jk,jpgop) - zopop2 * (1. + solgoc)
+                  tra(ji,jj,jk,jpbfe) = tra(ji,jj,jk,jpbfe) - zofer2 * (1. + solgoc)
+               END DO
+            END DO
+         END DO
+      ENDIF
+
+     IF(ln_ctl)   THEN  ! print mean trends (used for debugging)
+        WRITE(charout, FMT="('poc1')")
+        CALL prt_ctl_trc_info(charout)
+        CALL prt_ctl_trc(tab4d=tra, mask=tmask, clinfo=ctrcnm)
+     ENDIF
+
+     ! ------------------------------------------------------------------
+     ! Lability parameterization for the small OM particles. This param 
+     ! is based on the same theoretical background as the big particles.
+     ! However, because of its low sinking speed, lability is not supposed
+     ! to be equal to its initial value (the value of the freshly produced
+     ! organic matter). It is however uniform in the mixed layer.
+     ! -------------------------------------------------------------------
+     !
+     totprod(:,:) = 0.
+     totthick(:,:) = 0.
+     totcons(:,:) = 0.
+     ! intregrated production and consumption of POC in the mixed layer
+     ! ----------------------------------------------------------------
+     ! 
+     DO jk = 1, jpkm1
+        DO jj = 1, jpj
+           DO ji = 1, jpi
+              zdep = hmld(ji,jj)
+              IF (tmask(ji,jj,jk) == 1. .AND. gdept_n(ji,jj,jk) <= zdep ) THEN
+                totprod(ji,jj) = totprod(ji,jj) + prodpoc(ji,jj,jk) * e3t_n(ji,jj,jk) * rday/ rfact2
+                ! The temperature effect is included here
+                totthick(ji,jj) = totthick(ji,jj) + e3t_n(ji,jj,jk)* tgfunc(ji,jj,jk)
+                totcons(ji,jj) = totcons(ji,jj) - conspoc(ji,jj,jk) * e3t_n(ji,jj,jk) * rday/ rfact2    &
+                &                / ( trb(ji,jj,jk,jppoc) + rtrn )
+              ENDIF
+           END DO
+        END DO
+     END DO
+
+     ! Computation of the lability spectrum in the mixed layer. In the mixed 
+     ! layer, this spectrum is supposed to be uniform.
+     ! ---------------------------------------------------------------------
+     DO jk = 1, jpkm1
+        DO jj = 1, jpj
+           DO ji = 1, jpi
+              IF (tmask(ji,jj,jk) == 1.) THEN
+                zdep = hmld(ji,jj)
+                alphat = 0.0
+                remint = 0.0
+                IF( gdept_n(ji,jj,jk) <= zdep ) THEN
+                   DO jn = 1, jcpoc
+                      ! For each lability class, the system is supposed to be 
+                      ! at equilibrium: Prod - Sink - w alphap = 0.
+                      alphap(ji,jj,jk,jn) = totprod(ji,jj) * alphan(jn) / ( reminp(jn)    &
+                      &                     * totthick(ji,jj) + totcons(ji,jj) + wsbio + rtrn )
+                      alphat = alphat + alphap(ji,jj,jk,jn)
+                   END DO
+                   DO jn = 1, jcpoc
+                      alphap(ji,jj,jk,jn) = alphap(ji,jj,jk,jn) / ( alphat + rtrn)
+                      remint = remint + alphap(ji,jj,jk,jn) * reminp(jn)
+                   END DO
+                   ! Mean remineralization rate in the mixed layer
+                   ztremint(ji,jj,jk) =  MAX( 0., remint )
+                ENDIF
+              ENDIF
+           END DO
+        END DO
+     END DO
+     !
+     IF( ln_p4z ) THEN   ;  zremipoc(:,:,:) = MIN( xremip , ztremint(:,:,:) )
+     ELSE                ;  zremipoc(:,:,:) = MIN( xremipc, ztremint(:,:,:) )
+     ENDIF
+
+     ! -----------------------------------------------------------------------
+     ! The lability parameterization is used here. The code is here 
+     ! almost identical to what is done for big particles. The only difference
+     ! is that an additional source from GOC to POC is included. This means 
+     ! that since we need the lability spectrum of GOC, GOC spectrum 
+     ! should be determined before.
+     ! -----------------------------------------------------------------------
+     !
+     DO jk = 2, jpkm1
+        DO jj = 1, jpj
+           DO ji = 1, jpi
+              IF (tmask(ji,jj,jk) == 1.) THEN
+                zdep = hmld(ji,jj)
+                IF( gdept_n(ji,jj,jk) > zdep ) THEN
+                  alphat = 0.
+                  remint = 0.
+                  !
+                  ! the scale factors are corrected with temperature
+                  zsizek1  = e3t_n(ji,jj,jk-1) / 2. / (wsbio3(ji,jj,jk-1) + rtrn) * tgfunc(ji,jj,jk-1)
+                  zsizek = e3t_n(ji,jj,jk) / 2. / (wsbio3(ji,jj,jk) + rtrn) * tgfunc(ji,jj,jk)
+                  !
+                  ! Special treatment of the level just below the MXL
+                  ! See the comments in the GOC section
+                  ! ---------------------------------------------------
+                  !
+                  IF ( gdept_n(ji,jj,jk-1) <= zdep ) THEN
+                    !
+                    ! Computation of the POC concentration using the 
+                    ! lagrangian algorithm
+                    zpoc = trb(ji,jj,jk-1,jppoc) + conspoc(ji,jj,jk) * rday / rfact2               &
+                    &   * e3t_n(ji,jj,jk) / 2. / (wsbio3(ji,jj,jk) + rtrn)
+                    zpoc = max(0., zpoc)
+                    ! 
+                    DO jn = 1, jcpoc
+                       ! computation of the lability spectrum applying the 
+                       ! different sources and sinks
+                       alphap(ji,jj,jk,jn) = alphap(ji,jj,jk-1,jn) * exp( -reminp(jn) * zsizek ) * zpoc  &
+                       &   + ( prodpoc(ji,jj,jk) * alphan(jn) + zorem3(ji,jj,jk) * alphag(ji,jj,jk,jn) ) &
+                       &   / tgfunc(ji,jj,jk) / reminp(jn) * rday / rfact2 * ( 1. - exp( -reminp(jn)     &
+                       &   * zsizek ) )
+                       alphap(ji,jj,jk,jn) = MAX( 0., alphap(ji,jj,jk,jn) )
+                       alphat = alphat + alphap(ji,jj,jk,jn)
+                    END DO
+                  ELSE
+                    !
+                    ! Lability parameterization for the interior of the ocean
+                    ! This is very similar to what is done in the previous 
+                    ! block
+                    ! --------------------------------------------------------
+                    !
+                    zpoc = trb(ji,jj,jk-1,jppoc) + conspoc(ji,jj,jk-1) * rday / rfact2               &
+                    &   * e3t_n(ji,jj,jk-1) / 2. / (wsbio3(ji,jj,jk-1) + rtrn) + conspoc(ji,jj,jk)   &
+                    &   * rday / rfact2 * e3t_n(ji,jj,jk) / 2. / (wsbio3(ji,jj,jk) + rtrn)
+                    zpoc = max(0., zpoc)
+                    !
+                    DO jn = 1, jcpoc
+                       alphap(ji,jj,jk,jn) = alphap(ji,jj,jk-1,jn) * exp( -reminp(jn)                       &
+                       &   * ( zsizek + zsizek1 ) ) * zpoc + ( prodpoc(ji,jj,jk-1) * alphan(jn)             & 
+                       &   + zorem3(ji,jj,jk-1) * alphag(ji,jj,jk-1,jn) ) * rday / rfact2 / reminp(jn)      &
+                       &   / tgfunc(ji,jj,jk-1) * ( 1. - exp( -reminp(jn) * zsizek1 ) ) * exp( -reminp(jn)  &
+                       &   * zsizek ) + ( prodpoc(ji,jj,jk) * alphan(jn) + zorem3(ji,jj,jk)                 &
+                       &   * alphag(ji,jj,jk,jn) ) * rday / rfact2 / reminp(jn) / tgfunc(ji,jj,jk) * ( 1.   &
+                       &   - exp( -reminp(jn) * zsizek ) )
+                       alphap(ji,jj,jk,jn) = max(0., alphap(ji,jj,jk,jn) )
+                       alphat = alphat + alphap(ji,jj,jk,jn)
+                    END DO
+                  ENDIF
+                  ! Normalization of the lability spectrum so that the 
+                  ! integral is equal to 1
+                  DO jn = 1, jcpoc
+                     alphap(ji,jj,jk,jn) = alphap(ji,jj,jk,jn) / ( alphat + rtrn)
+                     remint = remint + alphap(ji,jj,jk,jn) * reminp(jn)
+                  END DO
+                  ! Mean remineralization rate in the water column
+                  ztremint(ji,jj,jk) =  MAX( 0., remint )
+                ENDIF
+              ENDIF
+            END DO
+         END DO
+      END DO
+
+     IF( ln_p4z ) THEN   ;  zremipoc(:,:,:) = MIN( xremip , ztremint(:,:,:) )
+     ELSE                ;  zremipoc(:,:,:) = MIN( xremipc, ztremint(:,:,:) )
+     ENDIF
+
+     IF( ln_p4z ) THEN
+         DO jk = 1, jpkm1
+            DO jj = 1, jpj
+               DO ji = 1, jpi
+                  IF (tmask(ji,jj,jk) == 1.) THEN
+                    ! POC disaggregation by turbulence and bacterial activity. 
+                    ! --------------------------------------------------------
+                    zremip          = zremipoc(ji,jj,jk) * xstep * tgfunc(ji,jj,jk)
+                    zorem           = zremip * trb(ji,jj,jk,jppoc)
+                    zofer           = zremip * trb(ji,jj,jk,jpsfe)
+
+                    tra(ji,jj,jk,jpdoc) = tra(ji,jj,jk,jpdoc) + zorem
+                    orem(ji,jj,jk)      = orem(ji,jj,jk) + zorem
+                    tra(ji,jj,jk,jpfer) = tra(ji,jj,jk,jpfer) + zofer
+                    tra(ji,jj,jk,jppoc) = tra(ji,jj,jk,jppoc) - zorem
+                    tra(ji,jj,jk,jpsfe) = tra(ji,jj,jk,jpsfe) - zofer
+                  ENDIF
+               END DO
+            END DO
+         END DO
+     ELSE
+       DO jk = 1, jpkm1
+          DO jj = 1, jpj
+             DO ji = 1, jpi
+                ! POC disaggregation by turbulence and bacterial activity. 
+                ! --------------------------------------------------------
+                zremip = zremipoc(ji,jj,jk) * xstep * tgfunc(ji,jj,jk)
+                zopoc  = zremip * trb(ji,jj,jk,jppoc)
+                orem(ji,jj,jk)  = orem(ji,jj,jk) + zopoc
+                zopon  = xremipn / xremipc * zremip * trb(ji,jj,jk,jppon)
+                zopop  = xremipp / xremipc * zremip * trb(ji,jj,jk,jppop)
+                zofer  = xremipn / xremipc * zremip * trb(ji,jj,jk,jpsfe)
+
+                tra(ji,jj,jk,jppoc) = tra(ji,jj,jk,jppoc) - zopoc
+                tra(ji,jj,jk,jppon) = tra(ji,jj,jk,jppon) - zopon
+                tra(ji,jj,jk,jppop) = tra(ji,jj,jk,jppop) - zopop
+                tra(ji,jj,jk,jpsfe) = tra(ji,jj,jk,jpsfe) - zofer
+                tra(ji,jj,jk,jpdoc) = tra(ji,jj,jk,jpdoc) + zopoc
+                tra(ji,jj,jk,jpdon) = tra(ji,jj,jk,jpdon) + zopon 
+                tra(ji,jj,jk,jpdop) = tra(ji,jj,jk,jpdop) + zopop 
+                tra(ji,jj,jk,jpfer) = tra(ji,jj,jk,jpfer) + zofer 
+             END DO
+           END DO
+        END DO
+     ENDIF
+
+     IF( lk_iomput ) THEN
+        IF( knt == nrdttrc ) THEN
+          zrfact2 = 1.e3 * rfact2r
+          CALL iom_put( "REMINP" , zremipoc(:,:,:) * tmask(:,:,:) )  ! Remineralisation rate
+          CALL iom_put( "REMING" , zremigoc(:,:,:) * tmask(:,:,:) )  ! Remineralisation rate
+        ENDIF
+     ENDIF
+
+      IF(ln_ctl)   THEN  ! print mean trends (used for debugging)
+         WRITE(charout, FMT="('poc2')")
+         CALL prt_ctl_trc_info(charout)
+         CALL prt_ctl_trc(tab4d=tra, mask=tmask, clinfo=ctrcnm)
+      ENDIF
+      !
+      CALL wrk_dealloc( jpi, jpj,      totprod,  totthick, totcons )
+      CALL wrk_dealloc( jpi, jpj, jpk, zremipoc, zremigoc, zorem3, ztremint )
+      DEALLOCATE( alphag )
+      !
+      IF( nn_timing == 1 )  CALL timing_stop('p4z_poc')
+      !
+   END SUBROUTINE p4z_poc
+
+
+   SUBROUTINE p4z_poc_init
+      !!----------------------------------------------------------------------
+      !!                  ***  ROUTINE p4z_poc_init  ***
+      !!
+      !! ** Purpose :   Initialization of remineralization parameters
+      !!
+      !! ** Method  :   Read the nampispoc namelist and check the parameters
+      !!      called at the first timestep
+      !!
+      !! ** input   :   Namelist nampispoc
+      !!
+      !!----------------------------------------------------------------------
+      INTEGER :: jn
+      REAL(wp) :: remindelta, reminup, remindown
+      INTEGER  :: ifault
+
+      NAMELIST/nampispoc/ xremip, jcpoc, rshape,  &
+         &     xremipc, xremipn, xremipp
+
+
+      INTEGER :: ios                 ! Local integer output status for namelist read
+
+      REWIND( numnatp_ref )              ! Namelist nampisrem in reference namelist : Pisces remineralization
+      READ  ( numnatp_ref, nampispoc, IOSTAT = ios, ERR = 901)
+901   IF( ios /= 0 ) CALL ctl_nam ( ios , 'nampispoc in reference namelist', lwp )
+
+      REWIND( numnatp_cfg )              ! Namelist nampisrem in configuration namelist : Pisces remineralization
+      READ  ( numnatp_cfg, nampispoc, IOSTAT = ios, ERR = 902 )
+902   IF( ios /= 0 ) CALL ctl_nam ( ios , 'nampispoc in configuration namelist', lwp )
+      IF(lwm) WRITE ( numonp, nampispoc )
+
+      IF(lwp) THEN                         ! control print
+         WRITE(numout,*) ' '
+         WRITE(numout,*) ' Namelist parameters for remineralization, nampispoc'
+         WRITE(numout,*) ' ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~'
+         IF( ln_p4z ) THEN
+            WRITE(numout,*) '    remineralisation rate of POC              xremip    =', xremip
+         ELSE
+            WRITE(numout,*) '    remineralisation rate of POC              xremipc   =', xremipc
+            WRITE(numout,*) '    remineralisation rate of PON              xremipn   =', xremipn
+            WRITE(numout,*) '    remineralisation rate of POP              xremipp   =', xremipp
+         ENDIF
+         WRITE(numout,*) '    Number of lability classes for POC        jcpoc     =', jcpoc
+         WRITE(numout,*) '    Shape factor of the gamma distribution    rshape    =', rshape
+      ENDIF
+      !
+      ! Discretization along the lability space
+      ! ---------------------------------------
+      !
+      ALLOCATE( alphan(jcpoc), reminp(jcpoc) )
+      ALLOCATE( alphap(jpi,jpj,jpk,jcpoc) )
+      !
+      IF (jcpoc > 1) THEN
+         !
+         remindelta = LOG(4. * 1000. ) / REAL(jcpoc-1, wp)
+         reminup = 1./ 400. * EXP(remindelta)
+         !
+         ! Discretization based on incomplete gamma functions
+         ! As incomplete gamma functions are not available in standard 
+         ! fortran 95, they have been coded as functions in this module (gamain)
+         ! ---------------------------------------------------------------------
+         !
+         alphan(1) = gamain(reminup, rshape, ifault)
+         reminp(1) = gamain(reminup, rshape+1.0, ifault) * xremip / alphan(1)
+         DO jn = 2, jcpoc-1
+            reminup = 1./ 400. * EXP( REAL(jn, wp) * remindelta)
+            remindown = 1. / 400. * EXP( REAL(jn-1, wp) * remindelta)
+            alphan(jn) = gamain(reminup, rshape, ifault) - gamain(remindown, rshape, ifault)
+            reminp(jn) = gamain(reminup, rshape+1.0, ifault) - gamain(remindown, rshape+1.0, ifault)
+            reminp(jn) = reminp(jn) * xremip / alphan(jn)
+         END DO
+         remindown = 1. / 400. * EXP( REAL(jcpoc-1, wp) * remindelta)
+         alphan(jcpoc) = 1.0 - gamain(remindown, rshape, ifault)
+         reminp(jcpoc) = 1.0 - gamain(remindown, rshape+1.0, ifault)
+         reminp(jcpoc) = reminp(jcpoc) * xremip / alphan(jcpoc)
+
+      ELSE
+         alphan(jcpoc) = 1.
+         reminp(jcpoc) = xremip
+      ENDIF
+
+      DO jn = 1, jcpoc
+         alphap(:,:,:,jn) = alphan(jn)
+      END DO
+
+   END SUBROUTINE p4z_poc_init
+
+   REAL FUNCTION alngam( xvalue, ifault )
+
+!*****************************************************************************80
+!
+!! ALNGAM computes the logarithm of the gamma function.
+!
+!  Modified:
+!
+!    13 January 2008
+!
+!  Author:
+!
+!    Allan Macleod
+!    FORTRAN90 version by John Burkardt
+!
+!  Reference:
+!
+!    Allan Macleod,
+!    Algorithm AS 245,
+!    A Robust and Reliable Algorithm for the Logarithm of the Gamma Function,
+!    Applied Statistics,
+!    Volume 38, Number 2, 1989, pages 397-402.
+!
+!  Parameters:
+!
+!    Input, real ( kind = 8 ) XVALUE, the argument of the Gamma function.
+!
+!    Output, integer ( kind = 4 ) IFAULT, error flag.
+!    0, no error occurred.
+!    1, XVALUE is less than or equal to 0.
+!    2, XVALUE is too big.
+!
+!    Output, real ( kind = 8 ) ALNGAM, the logarithm of the gamma function of X.
+!
+  implicit none
+
+  real(wp), parameter :: alr2pi = 0.918938533204673E+00
+  integer:: ifault
+  real(wp), dimension ( 9 ) :: r1 = (/ &
+    -2.66685511495E+00, &
+    -24.4387534237E+00, &
+    -21.9698958928E+00, &
+     11.1667541262E+00, &
+     3.13060547623E+00, &
+     0.607771387771E+00, &
+     11.9400905721E+00, &
+     31.4690115749E+00, &
+     15.2346874070E+00 /)
+  real(wp), dimension ( 9 ) :: r2 = (/ &
+    -78.3359299449E+00, &
+    -142.046296688E+00, &
+     137.519416416E+00, &
+     78.6994924154E+00, &
+     4.16438922228E+00, &
+     47.0668766060E+00, &
+     313.399215894E+00, &
+     263.505074721E+00, &
+     43.3400022514E+00 /)
+  real(wp), dimension ( 9 ) :: r3 = (/ &
+    -2.12159572323E+05, &
+     2.30661510616E+05, &
+     2.74647644705E+04, &
+    -4.02621119975E+04, &
+    -2.29660729780E+03, &
+    -1.16328495004E+05, &
+    -1.46025937511E+05, &
+    -2.42357409629E+04, &
+    -5.70691009324E+02 /)
+  real(wp), dimension ( 5 ) :: r4 = (/ &
+     0.279195317918525E+00, &
+     0.4917317610505968E+00, &
+     0.0692910599291889E+00, &
+     3.350343815022304E+00, &
+     6.012459259764103E+00 /)
+  real (wp) :: x
+  real (wp) :: x1
+  real (wp) :: x2
+  real (wp), parameter :: xlge = 5.10E+05
+  real (wp), parameter :: xlgst = 1.0E+30
+  real (wp) :: xvalue
+  real (wp) :: y
+
+  x = xvalue
+  alngam = 0.0E+00
+!
+!  Check the input.
+!
+  if ( xlgst <= x ) then
+    ifault = 2
+    return
+  end if
+  if ( x <= 0.0E+00 ) then
+    ifault = 1
+    return
+  end if
+
+  ifault = 0
+!
+!  Calculation for 0 < X < 0.5 and 0.5 <= X < 1.5 combined.
+!
+  if ( x < 1.5E+00 ) then
+
+    if ( x < 0.5E+00 ) then
+      alngam = - log ( x )
+      y = x + 1.0E+00
+!
+!  Test whether X < machine epsilon.
+!
+      if ( y == 1.0E+00 ) then
+        return
+      end if
+
+    else
+
+      alngam = 0.0E+00
+      y = x
+      x = ( x - 0.5E+00 ) - 0.5E+00
+
+    end if
+
+    alngam = alngam + x * (((( &
+        r1(5)   * y &
+      + r1(4) ) * y &
+      + r1(3) ) * y &
+      + r1(2) ) * y &
+      + r1(1) ) / (((( &
+                  y &
+      + r1(9) ) * y &
+      + r1(8) ) * y &
+      + r1(7) ) * y &
+      + r1(6) )
+
+    return
+
+  end if
+!
+!  Calculation for 1.5 <= X < 4.0.
+!
+  if ( x < 4.0E+00 ) then
+
+    y = ( x - 1.0E+00 ) - 1.0E+00
+
+    alngam = y * (((( &
+        r2(5)   * x &
+      + r2(4) ) * x &
+      + r2(3) ) * x &
+      + r2(2) ) * x &
+      + r2(1) ) / (((( &
+                  x &
+      + r2(9) ) * x &
+      + r2(8) ) * x &
+      + r2(7) ) * x &
+      + r2(6) )
+!
+!  Calculation for 4.0 <= X < 12.0.
+!
+  else if ( x < 12.0E+00 ) then
+
+    alngam = (((( &
+        r3(5)   * x &
+      + r3(4) ) * x &
+      + r3(3) ) * x &
+      + r3(2) ) * x &
+      + r3(1) ) / (((( &
+                  x &
+      + r3(9) ) * x &
+      + r3(8) ) * x &
+      + r3(7) ) * x &
+      + r3(6) )
+!
+!  Calculation for 12.0 <= X.
+!
+  else
+
+    y = log ( x )
+    alngam = x * ( y - 1.0E+00 ) - 0.5E+00 * y + alr2pi
+
+    if ( x <= xlge ) then
+
+      x1 = 1.0E+00 / x
+      x2 = x1 * x1
+
+      alngam = alngam + x1 * ( ( &
+             r4(3)   * &
+        x2 + r4(2) ) * &
+        x2 + r4(1) ) / ( ( &
+        x2 + r4(5) ) * &
+        x2 + r4(4) )
+
+    end if
+
+   end if
+
+   END FUNCTION alngam
+
+   REAL FUNCTION gamain( x, p, ifault )
+
+!*****************************************************************************80
+!
+!! GAMAIN computes the incomplete gamma ratio.
+!
+!  Discussion:
+!
+!    A series expansion is used if P > X or X <= 1.  Otherwise, a
+!    continued fraction approximation is used.
+!
+!  Modified:
+!
+!    17 January 2008
+!
+!  Author:
+!
+!    G Bhattacharjee
+!    FORTRAN90 version by John Burkardt
+!
+!  Reference:
+!
+!    G Bhattacharjee,
+!    Algorithm AS 32:
+!    The Incomplete Gamma Integral,
+!    Applied Statistics,
+!    Volume 19, Number 3, 1970, pages 285-287.
+!
+!  Parameters:
+!
+!    Input, real ( kind = 8 ) X, P, the parameters of the incomplete 
+!    gamma ratio.  0 <= X, and 0 < P.
+!
+!    Output, integer ( kind = 4 ) IFAULT, error flag.
+!    0, no errors.
+!    1, P <= 0.
+!    2, X < 0.
+!    3, underflow.
+!    4, error return from the Log Gamma routine.
+!
+!    Output, real ( kind = 8 ) GAMAIN, the value of the incomplete
+!    gamma ratio.
+!
+  implicit none
+
+  real (wp) a
+  real (wp), parameter :: acu = 1.0E-08
+  real (wp) an
+  real (wp) arg
+  real (wp) b
+  real (wp) dif
+  real (wp) factor
+  real (wp) g
+  real (wp) gin
+  integer i
+  integer ifault
+  real (wp), parameter :: oflo = 1.0E+37
+  real (wp) p
+  real (wp) pn(6)
+  real (wp) rn
+  real (wp) term
+  real (wp), parameter :: uflo = 1.0E-37
+  real (wp) x
+!
+!  Check the input.
+!
+  if ( p <= 0.0E+00 ) then
+    ifault = 1
+    gamain = 0.0E+00
+    return
+  end if
+
+  if ( x < 0.0E+00 ) then
+    ifault = 2
+    gamain = 0.0E+00
+    return
+  end if
+
+  if ( x == 0.0E+00 ) then
+    ifault = 0
+    gamain = 0.0E+00
+    return
+  end if
+
+  g = alngam ( p, ifault )
+
+  if ( ifault /= 0 ) then
+    ifault = 4
+    gamain = 0.0E+00
+    return
+  end if
+
+  arg = p * log ( x ) - x - g
+
+  if ( arg < log ( uflo ) ) then
+    ifault = 3
+    gamain = 0.0E+00
+    return
+  end if
+
+  ifault = 0
+  factor = exp ( arg )
+!
+!  Calculation by series expansion.
+!
+  if ( x <= 1.0E+00 .or. x < p ) then
+
+    gin = 1.0E+00
+    term = 1.0E+00
+    rn = p
+
+    do
+
+      rn = rn + 1.0E+00
+      term = term * x / rn
+      gin = gin + term
+
+      if ( term <= acu ) then
+        exit
+      end if
+
+    end do
+
+    gamain = gin * factor / p
+    return
+
+  end if
+!
+!  Calculation by continued fraction.
+!
+  a = 1.0E+00 - p
+  b = a + x + 1.0E+00
+  term = 0.0E+00
+
+  pn(1) = 1.0E+00
+  pn(2) = x
+  pn(3) = x + 1.0E+00
+  pn(4) = x * b
+
+  gin = pn(3) / pn(4)
+
+  do
+
+    a = a + 1.0E+00
+    b = b + 2.0E+00
+    term = term + 1.0E+00
+    an = a * term
+    do i = 1, 2
+      pn(i+4) = b * pn(i+2) - an * pn(i)
+    end do
+
+    if ( pn(6) /= 0.0E+00 ) then
+
+      rn = pn(5) / pn(6)
+      dif = abs ( gin - rn )
+!
+!  Absolute error tolerance satisfied?
+!
+      if ( dif <= acu ) then
+!
+!  Relative error tolerance satisfied?
+!
+        if ( dif <= acu * rn ) then
+          gamain = 1.0E+00 - factor * gin
+          exit
+        end if
+
+      end if
+
+      gin = rn
+
+    end if
+
+    do i = 1, 4
+      pn(i) = pn(i+2)
+    end do
+    if ( oflo <= abs ( pn(5) ) ) then
+
+      do i = 1, 4
+        pn(i) = pn(i) / oflo
+      end do
+
+    end if
+
+  end do
+
+  END FUNCTION gamain
+
+   !!======================================================================
+END MODULE p4zpoc
Index: branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/NEMO/TOP_SRC/PISCES/P4Z/p4zprod.F90
===================================================================
--- branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/NEMO/TOP_SRC/PISCES/P4Z/p4zprod.F90	(revision 7383)
+++ branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/NEMO/TOP_SRC/PISCES/P4Z/p4zprod.F90	(revision 7391)
@@ -8,8 +8,4 @@
    !!             3.4  !  2011-05  (O. Aumont, C. Ethe) New parameterization of light limitation
    !!----------------------------------------------------------------------
-#if defined key_pisces
-   !!----------------------------------------------------------------------
-   !!   'key_pisces'                                       PISCES bio-model
-   !!----------------------------------------------------------------------
    !!   p4z_prod       :   Compute the growth Rate of the two phytoplanktons groups
    !!   p4z_prod_init  :   Initialization of the parameters for growth
@@ -19,5 +15,4 @@
    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
@@ -33,9 +28,9 @@
    !! * Shared module variables
    LOGICAL , PUBLIC ::  ln_newprod      !:
-   REAL(wp), PUBLIC ::  pislope         !:
-   REAL(wp), PUBLIC ::  pislope2        !:
+   REAL(wp), PUBLIC ::  pislopen         !:
+   REAL(wp), PUBLIC ::  pisloped        !:
    REAL(wp), PUBLIC ::  xadap           !:
-   REAL(wp), PUBLIC ::  excret          !:
-   REAL(wp), PUBLIC ::  excret2         !:
+   REAL(wp), PUBLIC ::  excretn          !:
+   REAL(wp), PUBLIC ::  excretd         !:
    REAL(wp), PUBLIC ::  bresp           !:
    REAL(wp), PUBLIC ::  chlcnm          !:
@@ -51,6 +46,6 @@
    
    REAL(wp) :: r1_rday                !: 1 / rday
-   REAL(wp) :: texcret                !: 1 - excret 
-   REAL(wp) :: texcret2               !: 1 - excret2        
+   REAL(wp) :: texcretn               !: 1 - excretn 
+   REAL(wp) :: texcretd               !: 1 - excretd        
 
    !!----------------------------------------------------------------------
@@ -75,14 +70,17 @@
       INTEGER  ::   ji, jj, jk
       REAL(wp) ::   zsilfac, znanotot, zdiattot, zconctemp, zconctemp2
-      REAL(wp) ::   zratio, zmax, zsilim, ztn, zadap
-      REAL(wp) ::   zlim, zsilfac2, zsiborn, zprod, zproreg, zproreg2
-      REAL(wp) ::   zmxltst, zmxlday, zmaxday
-      REAL(wp) ::   zpislopen  , zpislope2n
-      REAL(wp) ::   zrum, zcodel, zargu, zval
+      REAL(wp) ::   zratio, zmax, zsilim, ztn, zadap, zlim, zsilfac2, zsiborn
+      REAL(wp) ::   zprod, zproreg, zproreg2, zprochln, zprochld
+      REAL(wp) ::   zmaxday, zdocprod, zpislopen, zpisloped
+      REAL(wp) ::   zmxltst, zmxlday
+      REAL(wp) ::   zrum, zcodel, zargu, zval, zfeup, chlcnm_n, chlcdm_n
       REAL(wp) ::   zfact
       CHARACTER (len=25) :: charout
-      REAL(wp), POINTER, DIMENSION(:,:  ) :: zmixnano, zmixdiat, zstrn, zw2d
-      REAL(wp), POINTER, DIMENSION(:,:,:) :: zpislopead, zpislopead2, zprdia, zprbio, zprdch, zprnch, zysopt, zw3d   
-      REAL(wp), POINTER, DIMENSION(:,:,:) :: zprorca, zprorcad, zprofed, zprofen, zprochln, zprochld, zpronew, zpronewd
+      REAL(wp), POINTER, DIMENSION(:,:  ) :: zstrn, zw2d, zmixnano, zmixdiat
+      REAL(wp), POINTER, DIMENSION(:,:,:) :: zpislopeadn, zpislopeadd, zysopt, zw3d   
+      REAL(wp), POINTER, DIMENSION(:,:,:) :: zprdia, zprbio, zprdch, zprnch   
+      REAL(wp), POINTER, DIMENSION(:,:,:) :: zprorcan, zprorcad, zprofed, zprofen
+      REAL(wp), POINTER, DIMENSION(:,:,:) :: zpronewn, zpronewd
+      REAL(wp), POINTER, DIMENSION(:,:,:) :: zmxl_fac, zmxl_chl
       !!---------------------------------------------------------------------
       !
@@ -90,25 +88,17 @@
       !
       !  Allocate temporary workspace
-      CALL wrk_alloc( jpi, jpj,      zmixnano, zmixdiat, zstrn                                                  )
-      CALL wrk_alloc( jpi, jpj, jpk, zpislopead, zpislopead2, zprdia, zprbio, zprdch, zprnch, zysopt            ) 
-      CALL wrk_alloc( jpi, jpj, jpk, zprorca, zprorcad, zprofed, zprofen, zprochln, zprochld, zpronew, zpronewd )
-      !
-      zprorca (:,:,:) = 0._wp
-      zprorcad(:,:,:) = 0._wp
-      zprofed (:,:,:) = 0._wp
-      zprofen (:,:,:) = 0._wp
-      zprochln(:,:,:) = 0._wp
-      zprochld(:,:,:) = 0._wp
-      zpronew (:,:,:) = 0._wp
-      zpronewd(:,:,:) = 0._wp
-      zprdia  (:,:,:) = 0._wp
-      zprbio  (:,:,:) = 0._wp
-      zprdch  (:,:,:) = 0._wp
-      zprnch  (:,:,:) = 0._wp
-      zysopt  (:,:,:) = 0._wp
+      CALL wrk_alloc( jpi, jpj,      zmixnano, zmixdiat, zstrn )
+      CALL wrk_alloc( jpi, jpj, jpk, zpislopeadn, zpislopeadd, zprdia, zprbio, zprdch, zprnch, zysopt ) 
+      CALL wrk_alloc( jpi, jpj, jpk, zmxl_fac, zmxl_chl )
+      CALL wrk_alloc( jpi, jpj, jpk, zprorcan, zprorcad, zprofed, zprofen, zpronewn, zpronewd )
+      !
+      zprorcan(:,:,:) = 0._wp ; zprorcad(:,:,:) = 0._wp ; zprofed (:,:,:) = 0._wp
+      zprofen (:,:,:) = 0._wp ; zysopt  (:,:,:) = 0._wp
+      zpronewn(:,:,:) = 0._wp ; zpronewd(:,:,:) = 0._wp ; zprdia  (:,:,:) = 0._wp
+      zprbio  (:,:,:) = 0._wp ; zprdch  (:,:,:) = 0._wp ; zprnch  (:,:,:) = 0._wp 
+      zmxl_fac(:,:,:) = 0._wp ; zmxl_chl(:,:,:) = 0._wp 
 
       ! Computation of the optimal production
-      prmax(:,:,:) = 0.6_wp * r1_rday * tgfunc(:,:,:) 
-      IF( lk_degrad )  prmax(:,:,:) = prmax(:,:,:) * facvol(:,:,:) 
+      prmax(:,:,:) = 0.8_wp * r1_rday * tgfunc(:,:,:) 
 
       ! compute the day length depending on latitude and the day
@@ -126,5 +116,5 @@
       END DO
 
-      ! Impact of the day duration on phytoplankton growth
+      ! Impact of the day duration and light intermittency on phytoplankton growth
       DO jk = 1, jpkm1
          DO jj = 1 ,jpj
@@ -132,15 +122,39 @@
                IF( etot_ndcy(ji,jj,jk) > 1.E-3 ) THEN
                   zval = MAX( 1., zstrn(ji,jj) )
-                  zval = 1.5 * zval / ( 12. + zval )
-                  zprbio(ji,jj,jk) = prmax(ji,jj,jk) * zval * ( 1. - fr_i(ji,jj) )
-                  zprdia(ji,jj,jk) = zprbio(ji,jj,jk)
+                  IF( gdept_n(ji,jj,jk) <= hmld(ji,jj) ) THEN
+                     zval = zval * MIN(1., heup_01(ji,jj) / ( hmld(ji,jj) + rtrn ))
+                  ENDIF
+                  zmxl_chl(ji,jj,jk) = zval / 24.
+                  zmxl_fac(ji,jj,jk) = 1.5 * zval / ( 12. + zval )
                ENDIF
             END DO
          END DO
       END DO
+
+      zprbio(:,:,:) = prmax(:,:,:) * zmxl_fac(:,:,:)
+      zprdia(:,:,:) = zprbio(:,:,:)
 
       ! Maximum light intensity
       WHERE( zstrn(:,:) < 1.e0 ) zstrn(:,:) = 24.
-      zstrn(:,:) = 24. / zstrn(:,:)
+
+      ! Computation of the P-I slope for nanos and diatoms
+      DO jk = 1, jpkm1
+         DO jj = 1, jpj
+            DO ji = 1, jpi
+               IF( etot_ndcy(ji,jj,jk) > 1.E-3 ) THEN
+                  ztn         = MAX( 0., tsn(ji,jj,jk,jp_tem) - 15. )
+                  zadap       = xadap * ztn / ( 2.+ ztn )
+                  zconctemp   = MAX( 0.e0 , trb(ji,jj,jk,jpdia) - xsizedia )
+                  zconctemp2  = trb(ji,jj,jk,jpdia) - zconctemp
+                  !
+                  zpislopeadn(ji,jj,jk) = pislopen * ( 1.+ zadap  * EXP( -0.25 * enano(ji,jj,jk) ) )  &
+                  &                   * trb(ji,jj,jk,jpnch) /( trb(ji,jj,jk,jpphy) * 12. + rtrn)
+                  !
+                  zpislopeadd(ji,jj,jk) = (pislopen * zconctemp2 + pisloped * zconctemp) / ( trb(ji,jj,jk,jpdia) + rtrn )   &
+                  &                   * trb(ji,jj,jk,jpdch) /( trb(ji,jj,jk,jpdia) * 12. + rtrn)
+               ENDIF
+            END DO
+         END DO
+      END DO
 
       IF( ln_newprod ) THEN
@@ -148,31 +162,19 @@
             DO jj = 1, jpj
                DO ji = 1, jpi
-                  ! Computation of the P-I slope for nanos and diatoms
                   IF( etot_ndcy(ji,jj,jk) > 1.E-3 ) THEN
-                      ztn         = MAX( 0., tsn(ji,jj,jk,jp_tem) - 15. )
-                      zadap       = xadap * ztn / ( 2.+ ztn )
-                      zconctemp   = MAX( 0.e0 , trb(ji,jj,jk,jpdia) - xsizedia )
-                      zconctemp2  = trb(ji,jj,jk,jpdia) - zconctemp
-                      znanotot    = enano(ji,jj,jk) * zstrn(ji,jj)
-                      zdiattot    = ediat(ji,jj,jk) * zstrn(ji,jj)
-                      !
-                      zpislopead (ji,jj,jk) = pislope * ( 1.+ zadap  * EXP( -znanotot ) )  &
-                         &                   * trb(ji,jj,jk,jpnch) /( trb(ji,jj,jk,jpphy) * 12. + rtrn)
-                      !
-                      zpislopead2(ji,jj,jk) = (pislope * zconctemp2 + pislope2 * zconctemp) / ( trb(ji,jj,jk,jpdia) + rtrn )   &
-                         &                   * trb(ji,jj,jk,jpdch) /( trb(ji,jj,jk,jpdia) * 12. + rtrn)
-
                       ! Computation of production function for Carbon
                       !  ---------------------------------------------
-                      zpislopen  = zpislopead (ji,jj,jk) / ( ( r1_rday + bresp * r1_rday ) * rday + rtrn)
-                      zpislope2n = zpislopead2(ji,jj,jk) / ( ( r1_rday + bresp * r1_rday ) * rday + rtrn)
-                      zprbio(ji,jj,jk) = zprbio(ji,jj,jk) * ( 1.- EXP( -zpislopen  * znanotot )  )
-                      zprdia(ji,jj,jk) = zprdia(ji,jj,jk) * ( 1.- EXP( -zpislope2n * zdiattot )  )
-
+                      zpislopen = zpislopeadn(ji,jj,jk) / ( ( r1_rday + bresp * r1_rday ) &
+                      &            * zmxl_fac(ji,jj,jk) * rday + rtrn)
+                      zpisloped = zpislopeadd(ji,jj,jk) / ( ( r1_rday + bresp * r1_rday ) &
+                      &            * zmxl_fac(ji,jj,jk) * rday + rtrn)
+                      zprbio(ji,jj,jk) = zprbio(ji,jj,jk) * ( 1.- EXP( -zpislopen * enano(ji,jj,jk) )  )
+                      zprdia(ji,jj,jk) = zprdia(ji,jj,jk) * ( 1.- EXP( -zpisloped * ediat(ji,jj,jk) )  )
                       !  Computation of production function for Chlorophyll
                       !--------------------------------------------------
-                      zmaxday  = 1._wp / ( prmax(ji,jj,jk) * rday + rtrn )
-                      zprnch(ji,jj,jk) = prmax(ji,jj,jk) * ( 1.- EXP( -zpislopead (ji,jj,jk) * zmaxday * znanotot ) )
-                      zprdch(ji,jj,jk) = prmax(ji,jj,jk) * ( 1.- EXP( -zpislopead2(ji,jj,jk) * zmaxday * zdiattot ) )
+                      zpislopen = zpislopeadn(ji,jj,jk) / ( prmax(ji,jj,jk) * zmxl_chl(ji,jj,jk) * rday + rtrn )
+                      zpisloped = zpislopeadd(ji,jj,jk) / ( prmax(ji,jj,jk) * zmxl_chl(ji,jj,jk) * rday + rtrn )
+                      zprnch(ji,jj,jk) = prmax(ji,jj,jk) * ( 1.- EXP( -zpislopen * enano(ji,jj,jk) ) )
+                      zprdch(ji,jj,jk) = prmax(ji,jj,jk) * ( 1.- EXP( -zpisloped * ediat(ji,jj,jk) ) )
                   ENDIF
                END DO
@@ -183,34 +185,17 @@
             DO jj = 1, jpj
                DO ji = 1, jpi
-
-                  ! Computation of the P-I slope for nanos and diatoms
                   IF( etot_ndcy(ji,jj,jk) > 1.E-3 ) THEN
-                      ztn         = MAX( 0., tsn(ji,jj,jk,jp_tem) - 15. )
-                      zadap       = ztn / ( 2.+ ztn )
-                      zconctemp   = MAX( 0.e0 , trb(ji,jj,jk,jpdia) - xsizedia )
-                      zconctemp2  = trb(ji,jj,jk,jpdia) - zconctemp
-                      znanotot    = enano(ji,jj,jk) * zstrn(ji,jj)
-                      zdiattot    = ediat(ji,jj,jk) * zstrn(ji,jj)
-                      !
-                      zpislopead (ji,jj,jk) = pislope  * ( 1.+ zadap  * EXP( -znanotot ) )
-                      zpislopead2(ji,jj,jk) = (pislope * zconctemp2 + pislope2 * zconctemp)  / ( trb(ji,jj,jk,jpdia) + rtrn )
-
-                      zpislopen =  zpislopead(ji,jj,jk) * trb(ji,jj,jk,jpnch)                &
-                        &          / ( trb(ji,jj,jk,jpphy) * 12.                  + rtrn )   &
-                        &          / ( prmax(ji,jj,jk) * rday * xlimphy(ji,jj,jk) + rtrn )
-
-                      zpislope2n = zpislopead2(ji,jj,jk) * trb(ji,jj,jk,jpdch)                &
-                        &          / ( trb(ji,jj,jk,jpdia) * 12.                  + rtrn )   &
-                        &          / ( prmax(ji,jj,jk) * rday * xlimdia(ji,jj,jk) + rtrn )
-
                       ! Computation of production function for Carbon
                       !  ---------------------------------------------
-                      zprbio(ji,jj,jk) = zprbio(ji,jj,jk) * ( 1.- EXP( -zpislopen  * znanotot ) )
-                      zprdia(ji,jj,jk) = zprdia(ji,jj,jk) * ( 1.- EXP( -zpislope2n * zdiattot ) )
-
+                      zpislopen = zpislopeadn(ji,jj,jk)  / ( zprbio(ji,jj,jk) * rday * xlimphy(ji,jj,jk) + rtrn )
+                      zpisloped = zpislopeadd(ji,jj,jk) / ( zprdia(ji,jj,jk) * rday * xlimdia(ji,jj,jk) + rtrn )
+                      zprbio(ji,jj,jk) = zprbio(ji,jj,jk) * ( 1.- EXP( -zpislopen * enano(ji,jj,jk) ) )
+                      zprdia(ji,jj,jk) = zprdia(ji,jj,jk) * ( 1.- EXP( -zpisloped * ediat(ji,jj,jk) ) )
                       !  Computation of production function for Chlorophyll
                       !--------------------------------------------------
-                      zprnch(ji,jj,jk) = prmax(ji,jj,jk) * ( 1.- EXP( -zpislopen  * enano(ji,jj,jk) ) )
-                      zprdch(ji,jj,jk) = prmax(ji,jj,jk) * ( 1.- EXP( -zpislope2n * ediat(ji,jj,jk) ) )
+                      zpislopen = zpislopen * zmxl_fac(ji,jj,jk) / ( zmxl_chl(ji,jj,jk) + rtrn )
+                      zpisloped = zpisloped * zmxl_fac(ji,jj,jk) / ( zmxl_chl(ji,jj,jk) + rtrn )
+                      zprnch(ji,jj,jk) = prmax(ji,jj,jk) * ( 1.- EXP( -zpislopen * enano(ji,jj,jk) ) )
+                      zprdch(ji,jj,jk) = prmax(ji,jj,jk) * ( 1.- EXP( -zpisloped * ediat(ji,jj,jk) ) )
                   ENDIF
                END DO
@@ -218,5 +203,4 @@
          END DO
       ENDIF
-
 
       !  Computation of a proxy of the N/C ratio
@@ -261,22 +245,10 @@
       END DO
 
-      !  Computation of the limitation term due to a mixed layer deeper than the euphotic depth
-      DO jj = 1, jpj
-         DO ji = 1, jpi
-            zmxltst = MAX( 0.e0, hmld(ji,jj) - heup(ji,jj) )
-            zmxlday = zmxltst * zmxltst * r1_rday
-            zmixnano(ji,jj) = 1. - zmxlday / ( 2. + zmxlday )
-            zmixdiat(ji,jj) = 1. - zmxlday / ( 4. + zmxlday )
-         END DO
-      END DO
- 
-      !  Mixed-layer effect on production                                                                               
-      DO jk = 1, jpkm1
-         DO jj = 1, jpj
-            DO ji = 1, jpi
-               IF( gdepw_n(ji,jj,jk+1) <= hmld(ji,jj) ) THEN
-                  zprbio(ji,jj,jk) = zprbio(ji,jj,jk) * zmixnano(ji,jj)
-                  zprdia(ji,jj,jk) = zprdia(ji,jj,jk) * zmixdiat(ji,jj)
-               ENDIF
+      !  Mixed-layer effect on production 
+      !  Sea-ice effect on production
+
+      DO jk = 1, jpkm1
+         DO jj = 1, jpj
+            DO ji = 1, jpi
                zprbio(ji,jj,jk) = zprbio(ji,jj,jk) * ( 1. - fr_i(ji,jj) )
                zprdia(ji,jj,jk) = zprdia(ji,jj,jk) * ( 1. - fr_i(ji,jj) )
@@ -290,23 +262,21 @@
             DO ji = 1, jpi
                IF( etot_ndcy(ji,jj,jk) > 1.E-3 ) THEN
-                  !  production terms for nanophyto.
-                  zprorca(ji,jj,jk) = zprbio(ji,jj,jk)  * xlimphy(ji,jj,jk) * trb(ji,jj,jk,jpphy) * rfact2
-                  zpronew(ji,jj,jk) = zprorca(ji,jj,jk) * xnanono3(ji,jj,jk) / ( xnanono3(ji,jj,jk) + xnanonh4(ji,jj,jk) + rtrn )
+                  !  production terms for nanophyto. (C)
+                  zprorcan(ji,jj,jk) = zprbio(ji,jj,jk)  * xlimphy(ji,jj,jk) * trb(ji,jj,jk,jpphy) * rfact2
+                  zpronewn(ji,jj,jk)  = zprorcan(ji,jj,jk)* xnanono3(ji,jj,jk) / ( xnanono3(ji,jj,jk) + xnanonh4(ji,jj,jk) + rtrn )
                   !
-                  zratio = trb(ji,jj,jk,jpnfe) / ( trb(ji,jj,jk,jpphy) + rtrn )
-                  zratio = zratio / fecnm 
+                  zratio = trb(ji,jj,jk,jpnfe) / ( trb(ji,jj,jk,jpphy) * fecnm + rtrn )
                   zmax   = MAX( 0., ( 1. - zratio ) / ABS( 1.05 - zratio ) ) 
-                  zprofen(ji,jj,jk) = fecnm * prmax(ji,jj,jk)  &
+                  zprofen(ji,jj,jk) = fecnm * prmax(ji,jj,jk) * ( 1.0 - fr_i(ji,jj) )  &
                   &             * ( 4. - 4.5 * xlimnfe(ji,jj,jk) / ( xlimnfe(ji,jj,jk) + 0.5 ) )    &
                   &             * biron(ji,jj,jk) / ( biron(ji,jj,jk) + concnfe(ji,jj,jk) )  &
                   &             * zmax * trb(ji,jj,jk,jpphy) * rfact2
-                  !  production terms for diatomees
+                  !  production terms for diatoms (C)
                   zprorcad(ji,jj,jk) = zprdia(ji,jj,jk) * xlimdia(ji,jj,jk) * trb(ji,jj,jk,jpdia) * rfact2
                   zpronewd(ji,jj,jk) = zprorcad(ji,jj,jk) * xdiatno3(ji,jj,jk) / ( xdiatno3(ji,jj,jk) + xdiatnh4(ji,jj,jk) + rtrn )
                   !
-                  zratio = trb(ji,jj,jk,jpdfe) / ( trb(ji,jj,jk,jpdia) + rtrn )
-                  zratio = zratio / fecdm 
+                  zratio = trb(ji,jj,jk,jpdfe) / ( trb(ji,jj,jk,jpdia) * fecdm + rtrn )
                   zmax   = MAX( 0., ( 1. - zratio ) / ABS( 1.05 - zratio ) ) 
-                  zprofed(ji,jj,jk) = fecdm * prmax(ji,jj,jk)  &
+                  zprofed(ji,jj,jk) = fecdm * prmax(ji,jj,jk) * ( 1.0 - fr_i(ji,jj) )  &
                   &             * ( 4. - 4.5 * xlimdfe(ji,jj,jk) / ( xlimdfe(ji,jj,jk) + 0.5 ) )    &
                   &             * biron(ji,jj,jk) / ( biron(ji,jj,jk) + concdfe(ji,jj,jk) )  &
@@ -317,24 +287,26 @@
       END DO
 
-      DO jk = 1, jpkm1
-         DO jj = 1, jpj
-            DO ji = 1, jpi
-               IF( gdepw_n(ji,jj,jk+1) <= hmld(ji,jj) ) THEN
-                  zprnch(ji,jj,jk) = zprnch(ji,jj,jk) * zmixnano(ji,jj)
-                  zprdch(ji,jj,jk) = zprdch(ji,jj,jk) * zmixdiat(ji,jj)
-               ENDIF
+      ! Computation of the chlorophyll production terms
+      DO jk = 1, jpkm1
+         DO jj = 1, jpj
+            DO ji = 1, jpi
                IF( etot_ndcy(ji,jj,jk) > 1.E-3 ) THEN
                   !  production terms for nanophyto. ( chlorophyll )
-                  znanotot = enano(ji,jj,jk) * zstrn(ji,jj)
-                  zprod    = rday * zprorca(ji,jj,jk) * zprnch(ji,jj,jk) * xlimphy(ji,jj,jk)
-                  zprochln(ji,jj,jk) = chlcmin * 12. * zprorca (ji,jj,jk)
-                  zprochln(ji,jj,jk) = zprochln(ji,jj,jk) + (chlcnm-chlcmin) * 12. * zprod / &
-                                     & (  zpislopead(ji,jj,jk) * znanotot +rtrn)
-                  !  production terms for diatomees ( chlorophyll )
-                  zdiattot = ediat(ji,jj,jk) * zstrn(ji,jj)
-                  zprod = rday * zprorcad(ji,jj,jk) * zprdch(ji,jj,jk) * xlimdia(ji,jj,jk)
-                  zprochld(ji,jj,jk) = chlcmin * 12. * zprorcad(ji,jj,jk)
-                  zprochld(ji,jj,jk) = zprochld(ji,jj,jk) + (chlcdm-chlcmin) * 12. * zprod / &
-                                     & ( zpislopead2(ji,jj,jk) * zdiattot +rtrn )
+                  znanotot = enano(ji,jj,jk) / ( zmxl_chl(ji,jj,jk) + rtrn )
+                  zprod    = rday * zprorcan(ji,jj,jk) * zprnch(ji,jj,jk) * xlimphy(ji,jj,jk)
+                  zprochln = chlcmin * 12. * zprorcan (ji,jj,jk)
+                  chlcnm_n   = MIN ( chlcnm, ( chlcnm / (1. - 1.14 / 43.4 *tsn(ji,jj,jk,jp_tem))) * (1. - 1.14 / 43.4 * 20.))
+                  zprochln = zprochln + (chlcnm_n-chlcmin) * 12. * zprod / &
+                                        & (  zpislopeadn(ji,jj,jk) * znanotot +rtrn)
+                  !  production terms for diatoms ( chlorophyll )
+                  zdiattot = ediat(ji,jj,jk) / ( zmxl_chl(ji,jj,jk) + rtrn )
+                  zprod    = rday * zprorcad(ji,jj,jk) * zprdch(ji,jj,jk) * xlimdia(ji,jj,jk)
+                  zprochld = chlcmin * 12. * zprorcad(ji,jj,jk)
+                  chlcdm_n   = MIN ( chlcdm, ( chlcdm / (1. - 1.14 / 43.4 * tsn(ji,jj,jk,jp_tem))) * (1. - 1.14 / 43.4 * 20.))
+                  zprochld = zprochld + (chlcdm_n-chlcmin) * 12. * zprod / &
+                                        & ( zpislopeadd(ji,jj,jk) * zdiattot +rtrn )
+                  !   Update the arrays TRA which contain the Chla sources and sinks
+                  tra(ji,jj,jk,jpnch) = tra(ji,jj,jk,jpnch) + zprochln * texcretn
+                  tra(ji,jj,jk,jpdch) = tra(ji,jj,jk,jpdch) + zprochld * texcretd
                ENDIF
             END DO
@@ -346,32 +318,49 @@
          DO jj = 1, jpj
            DO ji =1 ,jpi
-              zproreg  = zprorca(ji,jj,jk) - zpronew(ji,jj,jk)
-              zproreg2 = zprorcad(ji,jj,jk) - zpronewd(ji,jj,jk)
-              tra(ji,jj,jk,jppo4) = tra(ji,jj,jk,jppo4) - zprorca(ji,jj,jk) - zprorcad(ji,jj,jk)
-              tra(ji,jj,jk,jpno3) = tra(ji,jj,jk,jpno3) - zpronew(ji,jj,jk) - zpronewd(ji,jj,jk)
-              tra(ji,jj,jk,jpnh4) = tra(ji,jj,jk,jpnh4) - zproreg - zproreg2
-              tra(ji,jj,jk,jpphy) = tra(ji,jj,jk,jpphy) + zprorca(ji,jj,jk) * texcret
-              tra(ji,jj,jk,jpnch) = tra(ji,jj,jk,jpnch) + zprochln(ji,jj,jk) * texcret
-              tra(ji,jj,jk,jpnfe) = tra(ji,jj,jk,jpnfe) + zprofen(ji,jj,jk) * texcret
-              tra(ji,jj,jk,jpdia) = tra(ji,jj,jk,jpdia) + zprorcad(ji,jj,jk) * texcret2
-              tra(ji,jj,jk,jpdch) = tra(ji,jj,jk,jpdch) + zprochld(ji,jj,jk) * texcret2
-              tra(ji,jj,jk,jpdfe) = tra(ji,jj,jk,jpdfe) + zprofed(ji,jj,jk) * texcret2
-              tra(ji,jj,jk,jpdsi) = tra(ji,jj,jk,jpdsi) + zprorcad(ji,jj,jk) * zysopt(ji,jj,jk) * texcret2
-              tra(ji,jj,jk,jpdoc) = tra(ji,jj,jk,jpdoc) + excret2 * zprorcad(ji,jj,jk) + excret * zprorca(ji,jj,jk)
-              tra(ji,jj,jk,jpoxy) = tra(ji,jj,jk,jpoxy) + o2ut * ( zproreg + zproreg2) &
-                 &                + ( o2ut + o2nit ) * ( zpronew(ji,jj,jk) + zpronewd(ji,jj,jk) )
-              tra(ji,jj,jk,jpfer) = tra(ji,jj,jk,jpfer) - texcret * zprofen(ji,jj,jk) - texcret2 * zprofed(ji,jj,jk)
-              tra(ji,jj,jk,jpsil) = tra(ji,jj,jk,jpsil) - texcret2 * zprorcad(ji,jj,jk) * zysopt(ji,jj,jk)
-              tra(ji,jj,jk,jpdic) = tra(ji,jj,jk,jpdic) - zprorca(ji,jj,jk) - zprorcad(ji,jj,jk)
-              tra(ji,jj,jk,jptal) = tra(ji,jj,jk,jptal) + rno3 * ( zpronew(ji,jj,jk) + zpronewd(ji,jj,jk) ) &
-                 &                                      - rno3 * ( zproreg + zproreg2 )
-          END DO
+              IF( etot_ndcy(ji,jj,jk) > 1.E-3 ) THEN
+                 zproreg  = zprorcan(ji,jj,jk) - zpronewn(ji,jj,jk)
+                 zproreg2 = zprorcad(ji,jj,jk) - zpronewd(ji,jj,jk)
+                 zdocprod = excretd * zprorcad(ji,jj,jk) + excretn * zprorcan(ji,jj,jk)
+                 tra(ji,jj,jk,jppo4) = tra(ji,jj,jk,jppo4) - zprorcan(ji,jj,jk) - zprorcad(ji,jj,jk)
+                 tra(ji,jj,jk,jpno3) = tra(ji,jj,jk,jpno3) - zpronewn(ji,jj,jk) - zpronewd(ji,jj,jk)
+                 tra(ji,jj,jk,jpnh4) = tra(ji,jj,jk,jpnh4) - zproreg - zproreg2
+                 tra(ji,jj,jk,jpphy) = tra(ji,jj,jk,jpphy) + zprorcan(ji,jj,jk) * texcretn
+                 tra(ji,jj,jk,jpnfe) = tra(ji,jj,jk,jpnfe) + zprofen(ji,jj,jk) * texcretn
+                 tra(ji,jj,jk,jpdia) = tra(ji,jj,jk,jpdia) + zprorcad(ji,jj,jk) * texcretd
+                 tra(ji,jj,jk,jpdfe) = tra(ji,jj,jk,jpdfe) + zprofed(ji,jj,jk) * texcretd
+                 tra(ji,jj,jk,jpdsi) = tra(ji,jj,jk,jpdsi) + zprorcad(ji,jj,jk) * zysopt(ji,jj,jk) * texcretd
+                 tra(ji,jj,jk,jpdoc) = tra(ji,jj,jk,jpdoc) + zdocprod
+                 tra(ji,jj,jk,jpoxy) = tra(ji,jj,jk,jpoxy) + o2ut * ( zproreg + zproreg2) &
+                 &                   + ( o2ut + o2nit ) * ( zpronewn(ji,jj,jk) + zpronewd(ji,jj,jk) )
+                 !
+                 zfeup = texcretn * zprofen(ji,jj,jk) + texcretd * zprofed(ji,jj,jk)
+                 tra(ji,jj,jk,jpfer) = tra(ji,jj,jk,jpfer) - zfeup
+                 tra(ji,jj,jk,jpsil) = tra(ji,jj,jk,jpsil) - texcretd * zprorcad(ji,jj,jk) * zysopt(ji,jj,jk)
+                 tra(ji,jj,jk,jpdic) = tra(ji,jj,jk,jpdic) - zprorcan(ji,jj,jk) - zprorcad(ji,jj,jk)
+                 tra(ji,jj,jk,jptal) = tra(ji,jj,jk,jptal) + rno3 * ( zpronewn(ji,jj,jk) + zpronewd(ji,jj,jk) ) &
+                 &                                         - rno3 * ( zproreg + zproreg2 )
+              ENDIF
+           END DO
         END DO
      END DO
+     !
+     IF( ln_ligand ) THEN
+         DO jk = 1, jpkm1
+            DO jj = 1, jpj
+              DO ji =1 ,jpi
+                 IF( etot_ndcy(ji,jj,jk) > 1.E-3 ) THEN
+                    zdocprod = excretd * zprorcad(ji,jj,jk) + excretn * zprorcan(ji,jj,jk)
+                    zfeup    = texcretn * zprofen(ji,jj,jk) + texcretd * zprofed(ji,jj,jk)
+                    tra(ji,jj,jk,jplgw) = tra(ji,jj,jk,jplgw) + zdocprod * ldocp - zfeup * plig(ji,jj,jk) * lthet
+                 ENDIF
+              END DO
+           END DO
+        END DO
+     ENDIF
 
 
     ! Total primary production per year
     IF( iom_use( "tintpp" ) .OR. ( ln_check_mass .AND. kt == nitend .AND. knt == nrdttrc )  )  &
-         & tpp = glob_sum( ( zprorca(:,:,:) + zprorcad(:,:,:) ) * cvol(:,:,:) )
+         & tpp = glob_sum( ( zprorcan(:,:,:) + zprorcad(:,:,:) ) * cvol(:,:,:) )
 
     IF( lk_iomput ) THEN
@@ -381,13 +370,13 @@
           zfact = 1.e+3 * rfact2r  !  conversion from mol/l/kt to  mol/m3/s
           !
-          IF( iom_use( "PPPHY" ) .OR. iom_use( "PPPHY2" ) )  THEN
-              zw3d(:,:,:) = zprorca (:,:,:) * zfact * tmask(:,:,:)  ! primary production by nanophyto
-              CALL iom_put( "PPPHY"  , zw3d )
+          IF( iom_use( "PPPHYN" ) .OR. iom_use( "PPPHYD" ) )  THEN
+              zw3d(:,:,:) = zprorcan(:,:,:) * zfact * tmask(:,:,:)  ! primary production by nanophyto
+              CALL iom_put( "PPPHYN"  , zw3d )
               !
               zw3d(:,:,:) = zprorcad(:,:,:) * zfact * tmask(:,:,:)  ! primary production by diatomes
-              CALL iom_put( "PPPHY2"  , zw3d )
+              CALL iom_put( "PPPHYD"  , zw3d )
           ENDIF
           IF( iom_use( "PPNEWN" ) .OR. iom_use( "PPNEWD" ) )  THEN
-              zw3d(:,:,:) = zpronew (:,:,:) * zfact * tmask(:,:,:)  ! new primary production by nanophyto
+              zw3d(:,:,:) = zpronewn(:,:,:) * zfact * tmask(:,:,:)  ! new primary production by nanophyto
               CALL iom_put( "PPNEWN"  , zw3d )
               !
@@ -425,9 +414,9 @@
           ENDIF
           IF( iom_use( "TPP" ) )  THEN
-              zw3d(:,:,:) = ( zprorca(:,:,:) + zprorcad(:,:,:) ) * zfact * tmask(:,:,:)  ! total primary production
+              zw3d(:,:,:) = ( zprorcan(:,:,:) + zprorcad(:,:,:) ) * zfact * tmask(:,:,:)  ! total primary production
               CALL iom_put( "TPP"  , zw3d )
           ENDIF
           IF( iom_use( "TPNEW" ) )  THEN
-              zw3d(:,:,:) = ( zpronew(:,:,:) + zpronewd(:,:,:) ) * zfact * tmask(:,:,:)  ! total new production
+              zw3d(:,:,:) = ( zpronewn(:,:,:) + zpronewd(:,:,:) ) * zfact * tmask(:,:,:)  ! total new production
               CALL iom_put( "TPNEW"  , zw3d )
           ENDIF
@@ -436,10 +425,10 @@
               CALL iom_put( "TPBFE"  , zw3d )
           ENDIF
-          IF( iom_use( "INTPPPHY" ) .OR. iom_use( "INTPPPHY2" ) ) THEN  
+          IF( iom_use( "INTPPPHYN" ) .OR. iom_use( "INTPPPHYD" ) ) THEN  
              zw2d(:,:) = 0.
              DO jk = 1, jpkm1
-               zw2d(:,:) = zw2d(:,:) + zprorca (:,:,jk) * e3t_n(:,:,jk) * zfact * tmask(:,:,jk)  ! vert. integrated  primary produc. by nano
+               zw2d(:,:) = zw2d(:,:) + zprorcan(:,:,jk) * e3t_n(:,:,jk) * zfact * tmask(:,:,jk)  ! vert. integrated  primary produc. by nano
              ENDDO
-             CALL iom_put( "INTPPPHY" , zw2d )
+             CALL iom_put( "INTPPPHYN" , zw2d )
              !
              zw2d(:,:) = 0.
@@ -447,10 +436,10 @@
                 zw2d(:,:) = zw2d(:,:) + zprorcad(:,:,jk) * e3t_n(:,:,jk) * zfact * tmask(:,:,jk) ! vert. integrated  primary produc. by diatom
              ENDDO
-             CALL iom_put( "INTPPPHY2" , zw2d )
+             CALL iom_put( "INTPPPHYD" , zw2d )
           ENDIF
           IF( iom_use( "INTPP" ) ) THEN   
              zw2d(:,:) = 0.
              DO jk = 1, jpkm1
-                zw2d(:,:) = zw2d(:,:) + ( zprorca(:,:,jk) + zprorcad(:,:,jk) ) * e3t_n(:,:,jk) * zfact * tmask(:,:,jk) ! vert. integrated pp
+                zw2d(:,:) = zw2d(:,:) + ( zprorcan(:,:,jk) + zprorcad(:,:,jk) ) * e3t_n(:,:,jk) * zfact * tmask(:,:,jk) ! vert. integrated pp
              ENDDO
              CALL iom_put( "INTPP" , zw2d )
@@ -459,5 +448,5 @@
              zw2d(:,:) = 0.
              DO jk = 1, jpkm1
-                zw2d(:,:) = zw2d(:,:) + ( zpronew(:,:,jk) + zpronewd(:,:,jk) ) * e3t_n(:,:,jk) * zfact * tmask(:,:,jk)  ! vert. integrated new prod
+                zw2d(:,:) = zw2d(:,:) + ( zpronewn(:,:,jk) + zpronewd(:,:,jk) ) * e3t_n(:,:,jk) * zfact * tmask(:,:,jk)  ! vert. integrated new prod
              ENDDO
              CALL iom_put( "INTPNEW" , zw2d )
@@ -482,17 +471,4 @@
           CALL wrk_dealloc( jpi, jpj, jpk, zw3d )
        ENDIF
-     ELSE
-        IF( ln_diatrc ) THEN
-           zfact = 1.e+3 * rfact2r
-           trc3d(:,:,:,jp_pcs0_3d + 4)  = zprorca (:,:,:) * zfact * tmask(:,:,:)
-           trc3d(:,:,:,jp_pcs0_3d + 5)  = zprorcad(:,:,:) * zfact * tmask(:,:,:)
-           trc3d(:,:,:,jp_pcs0_3d + 6)  = zpronew (:,:,:) * zfact * tmask(:,:,:)
-           trc3d(:,:,:,jp_pcs0_3d + 7)  = zpronewd(:,:,:) * zfact * tmask(:,:,:)
-           trc3d(:,:,:,jp_pcs0_3d + 8)  = zprorcad(:,:,:) * zfact * tmask(:,:,:) * zysopt(:,:,:)
-           trc3d(:,:,:,jp_pcs0_3d + 9)  = zprofed (:,:,:) * zfact * tmask(:,:,:)
-#  if ! defined key_kriest
-           trc3d(:,:,:,jp_pcs0_3d + 10) = zprofen (:,:,:) * zfact * tmask(:,:,:)
-#  endif
-        ENDIF
      ENDIF
 
@@ -503,7 +479,8 @@
      ENDIF
      !
-     CALL wrk_dealloc( jpi, jpj,      zmixnano, zmixdiat, zstrn                                                  )
-     CALL wrk_dealloc( jpi, jpj, jpk, zpislopead, zpislopead2, zprdia, zprbio, zprdch, zprnch, zysopt            ) 
-     CALL wrk_dealloc( jpi, jpj, jpk, zprorca, zprorcad, zprofed, zprofen, zprochln, zprochld, zpronew, zpronewd )
+     CALL wrk_dealloc( jpi, jpj,  zmixnano, zmixdiat,    zstrn )
+     CALL wrk_dealloc( jpi, jpj, jpk, zpislopeadn, zpislopeadd, zprdia, zprbio, zprdch, zprnch, zysopt ) 
+     CALL wrk_dealloc( jpi, jpj, jpk, zmxl_fac, zmxl_chl )
+     CALL wrk_dealloc( jpi, jpj, jpk, zprorcan, zprorcad, zprofed, zprofen, zpronewn, zpronewd )
      !
      IF( nn_timing == 1 )  CALL timing_stop('p4z_prod')
@@ -524,5 +501,5 @@
       !!----------------------------------------------------------------------
       !
-      NAMELIST/nampisprod/ pislope, pislope2, xadap, ln_newprod, bresp, excret, excret2,  &
+      NAMELIST/namp4zprod/ pislopen, pisloped, xadap, ln_newprod, bresp, excretn, excretd,  &
          &                 chlcnm, chlcdm, chlcmin, fecnm, fecdm, grosip
       INTEGER :: ios                 ! Local integer output status for namelist read
@@ -530,27 +507,27 @@
 
       REWIND( numnatp_ref )              ! Namelist nampisprod in reference namelist : Pisces phytoplankton production
-      READ  ( numnatp_ref, nampisprod, IOSTAT = ios, ERR = 901)
-901   IF( ios /= 0 ) CALL ctl_nam ( ios , 'nampisprod in reference namelist', lwp )
+      READ  ( numnatp_ref, namp4zprod, IOSTAT = ios, ERR = 901)
+901   IF( ios /= 0 ) CALL ctl_nam ( ios , 'namp4zprod in reference namelist', lwp )
 
       REWIND( numnatp_cfg )              ! Namelist nampisprod in configuration namelist : Pisces phytoplankton production
-      READ  ( numnatp_cfg, nampisprod, IOSTAT = ios, ERR = 902 )
-902   IF( ios /= 0 ) CALL ctl_nam ( ios , 'nampisprod in configuration namelist', lwp )
-      IF(lwm) WRITE ( numonp, nampisprod )
+      READ  ( numnatp_cfg, namp4zprod, IOSTAT = ios, ERR = 902 )
+902   IF( ios /= 0 ) CALL ctl_nam ( ios , 'namp4zprod in configuration namelist', lwp )
+      IF(lwm) WRITE ( numonp, namp4zprod )
 
       IF(lwp) THEN                         ! control print
          WRITE(numout,*) ' '
-         WRITE(numout,*) ' Namelist parameters for phytoplankton growth, nampisprod'
+         WRITE(numout,*) ' Namelist parameters for phytoplankton growth, namp4zprod'
          WRITE(numout,*) ' ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~'
-         WRITE(numout,*) '    Enable new parame. of production (T/F)   ln_newprod   =', ln_newprod
+         WRITE(numout,*) '    Enable new parame. of production (T/F)   ln_newprod    =', ln_newprod
          WRITE(numout,*) '    mean Si/C ratio                           grosip       =', grosip
-         WRITE(numout,*) '    P-I slope                                 pislope      =', pislope
-         WRITE(numout,*) '    Acclimation factor to low light           xadap       =', xadap
-         WRITE(numout,*) '    excretion ratio of nanophytoplankton      excret       =', excret
-         WRITE(numout,*) '    excretion ratio of diatoms                excret2      =', excret2
+         WRITE(numout,*) '    P-I slope                                 pislopen     =', pislopen
+         WRITE(numout,*) '    Acclimation factor to low light           xadap        =', xadap
+         WRITE(numout,*) '    excretion ratio of nanophytoplankton      excretn      =', excretn
+         WRITE(numout,*) '    excretion ratio of diatoms                excretd      =', excretd
          IF( ln_newprod )  THEN
             WRITE(numout,*) '    basal respiration in phytoplankton        bresp        =', bresp
             WRITE(numout,*) '    Maximum Chl/C in phytoplankton            chlcmin      =', chlcmin
          ENDIF
-         WRITE(numout,*) '    P-I slope  for diatoms                    pislope2     =', pislope2
+         WRITE(numout,*) '    P-I slope  for diatoms                    pisloped     =', pisloped
          WRITE(numout,*) '    Minimum Chl/C in nanophytoplankton        chlcnm       =', chlcnm
          WRITE(numout,*) '    Minimum Chl/C in diatoms                  chlcdm       =', chlcdm
@@ -560,6 +537,6 @@
       !
       r1_rday   = 1._wp / rday 
-      texcret   = 1._wp - excret
-      texcret2  = 1._wp - excret2
+      texcretn  = 1._wp - excretn
+      texcretd  = 1._wp - excretd
       tpp       = 0._wp
       !
@@ -576,14 +553,4 @@
       !
    END FUNCTION p4z_prod_alloc
-
-#else
-   !!======================================================================
-   !!  Dummy module :                                   No PISCES bio-model
-   !!======================================================================
-CONTAINS
-   SUBROUTINE p4z_prod                    ! Empty routine
-   END SUBROUTINE p4z_prod
-#endif 
-
    !!======================================================================
 END MODULE p4zprod
Index: branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/NEMO/TOP_SRC/PISCES/P4Z/p4zrem.F90
===================================================================
--- branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/NEMO/TOP_SRC/PISCES/P4Z/p4zrem.F90	(revision 7383)
+++ branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/NEMO/TOP_SRC/PISCES/P4Z/p4zrem.F90	(revision 7391)
@@ -8,9 +8,4 @@
    !!             3.4  !  2011-06  (O. Aumont, C. Ethe) Quota model for iron
    !!----------------------------------------------------------------------
-#if defined key_pisces
-   !!----------------------------------------------------------------------
-   !!   'key_top'       and                                      TOP models
-   !!   'key_pisces'                                       PISCES bio-model
-   !!----------------------------------------------------------------------
    !!   p4z_rem       :  Compute remineralization/dissolution of organic compounds
    !!   p4z_rem_init  :  Initialisation of parameters for remineralisation
@@ -20,9 +15,6 @@
    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 p4zint          !  interpolation and computation of various fields
    USE p4zlim
    USE prtctl_trc      !  print control for debugging
@@ -38,14 +30,16 @@
 
    !! * Shared module variables
+   REAL(wp), PUBLIC ::  xremikc    !: remineralisation rate of DOC 
+   REAL(wp), PUBLIC ::  xremikn    !: remineralisation rate of DON 
+   REAL(wp), PUBLIC ::  xremikp    !: remineralisation rate of DOP 
    REAL(wp), PUBLIC ::  xremik     !: remineralisation rate of POC 
-   REAL(wp), PUBLIC ::  xremip     !: remineralisation rate of DOC
    REAL(wp), PUBLIC ::  nitrif     !: NH4 nitrification rate 
    REAL(wp), PUBLIC ::  xsirem     !: remineralisation rate of POC 
    REAL(wp), PUBLIC ::  xsiremlab  !: fast remineralisation rate of POC 
    REAL(wp), PUBLIC ::  xsilab     !: fraction of labile biogenic silica 
-
+   REAL(wp), PUBLIC ::  feratb     !: Fe/C quota in bacteria
+   REAL(wp), PUBLIC ::  xkferb     !: Half-saturation constant for bacteria Fe/C
 
    REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::   denitr     !: denitrification array
-   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::   denitnh4   !: -    -    -    -   -
 
    !!----------------------------------------------------------------------
@@ -68,15 +62,11 @@
       !
       INTEGER  ::   ji, jj, jk
-      REAL(wp) ::   zremip, zremik, zsiremin 
+      REAL(wp) ::   zremik, zremikc, zremikn, zremikp, zsiremin, zfact 
       REAL(wp) ::   zsatur, zsatur2, znusil, znusil2, zdep, zdepmin, zfactdep
-      REAL(wp) ::   zbactfer, zorem, zorem2, zofer, zolimit
-      REAL(wp) ::   zosil, ztem
-#if ! defined key_kriest
-      REAL(wp) ::   zofer2
-#endif
-      REAL(wp) ::   zonitr, zstep, zfact
+      REAL(wp) ::   zbactfer, zolimit, zonitr, zrfact2
+      REAL(wp) ::   zosil, ztem, zdenitnh4, zolimic, zolimin, zolimip, zdenitrn, zdenitrp
       CHARACTER (len=25) :: charout
       REAL(wp), POINTER, DIMENSION(:,:  ) :: ztempbac
-      REAL(wp), POINTER, DIMENSION(:,:,:) :: zdepbac, zolimi, zdepprod, zw3d
+      REAL(wp), POINTER, DIMENSION(:,:,:) :: zdepbac, zolimi, zdepprod, zfacsi, zw3d, zfacsib
       !!---------------------------------------------------------------------
       !
@@ -85,9 +75,11 @@
       ! Allocate temporary workspace
       CALL wrk_alloc( jpi, jpj,      ztempbac                  )
-      CALL wrk_alloc( jpi, jpj, jpk, zdepbac, zdepprod, zolimi )
+      CALL wrk_alloc( jpi, jpj, jpk, zdepbac, zdepprod, zolimi, zfacsi, zfacsib )
 
       ! Initialisation of temprary arrys
       zdepprod(:,:,:) = 1._wp
       ztempbac(:,:)   = 0._wp
+      zfacsib(:,:,:)  = xsilab / ( 1.0 - xsilab )
+      zfacsi(:,:,:)   = xsilab
 
       ! Computation of the mean phytoplankton concentration as
@@ -112,51 +104,96 @@
       END DO
 
+      IF( ln_p4z ) THEN
+         DO jk = 1, jpkm1
+            DO jj = 1, jpj
+               DO ji = 1, jpi
+                  ! DOC ammonification. Depends on depth, phytoplankton biomass
+                  ! and a limitation term which is supposed to be a parameterization of the bacterial activity. 
+                  zremik = xremik * xstep / 1.e-6 * xlimbac(ji,jj,jk) * zdepbac(ji,jj,jk) 
+                  zremik = MAX( zremik, 2.74e-4 * xstep )
+                  ! Ammonification in oxic waters with oxygen consumption
+                  ! -----------------------------------------------------
+                  zolimit = zremik * ( 1.- nitrfac(ji,jj,jk) ) * trb(ji,jj,jk,jpdoc) 
+                  zolimi(ji,jj,jk) = MIN( ( trb(ji,jj,jk,jpoxy) - rtrn ) / o2ut, zolimit ) 
+                  ! Ammonification in suboxic waters with denitrification
+                  ! -------------------------------------------------------
+                  denitr(ji,jj,jk)  = MIN(  ( trb(ji,jj,jk,jpno3) - rtrn ) / rdenit,   &
+                     &                     zremik * nitrfac(ji,jj,jk) * trb(ji,jj,jk,jpdoc)  )
+                  !
+                  zolimi (ji,jj,jk) = MAX( 0.e0, zolimi (ji,jj,jk) )
+                  denitr (ji,jj,jk) = MAX( 0.e0, denitr (ji,jj,jk) )
+                  !
+                  tra(ji,jj,jk,jppo4) = tra(ji,jj,jk,jppo4) + zolimi (ji,jj,jk) + denitr(ji,jj,jk)
+                  tra(ji,jj,jk,jpnh4) = tra(ji,jj,jk,jpnh4) + zolimi (ji,jj,jk) + denitr(ji,jj,jk)
+                  tra(ji,jj,jk,jpno3) = tra(ji,jj,jk,jpno3) - denitr (ji,jj,jk) * rdenit
+                  tra(ji,jj,jk,jpdoc) = tra(ji,jj,jk,jpdoc) - zolimi (ji,jj,jk) - denitr(ji,jj,jk)
+                  tra(ji,jj,jk,jpoxy) = tra(ji,jj,jk,jpoxy) - zolimi (ji,jj,jk) * o2ut
+                  tra(ji,jj,jk,jpdic) = tra(ji,jj,jk,jpdic) + zolimi (ji,jj,jk) + denitr(ji,jj,jk)
+                  tra(ji,jj,jk,jptal) = tra(ji,jj,jk,jptal) + rno3 * ( zolimi(ji,jj,jk)    &
+                  &                     + ( rdenit + 1.) * denitr(ji,jj,jk) )
+               END DO
+            END DO
+         END DO
+      ELSE
+         DO jk = 1, jpkm1
+            DO jj = 1, jpj
+               DO ji = 1, jpi
+                  ! DOC ammonification. Depends on depth, phytoplankton biomass
+                  ! and a limitation term which is supposed to be a parameterization of the bacterial activity. 
+                  ! -----------------------------------------------------------------
+                  zremik = xstep / 1.e-6 * MAX(0.01, xlimbac(ji,jj,jk)) * zdepbac(ji,jj,jk) 
+                  zremik = MAX( zremik, 2.74e-4 * xstep / xremikc )
+
+                  zremikc = xremikc * zremik
+                  zremikn = xremikn / xremikc
+                  zremikp = xremikp / xremikc
+
+                  ! Ammonification in oxic waters with oxygen consumption
+                  ! -----------------------------------------------------
+                  zolimit = zremikc * ( 1.- nitrfac(ji,jj,jk) ) * trb(ji,jj,jk,jpdoc) 
+                  zolimic = MAX( 0.e0, MIN( ( trb(ji,jj,jk,jpoxy) - rtrn ) / o2ut, zolimit ) ) 
+                  zolimi(ji,jj,jk) = zolimic
+                  zolimin = zremikn * zolimic * trb(ji,jj,jk,jpdon) / ( trb(ji,jj,jk,jpdoc) + rtrn )
+                  zolimip = zremikp * zolimic * trb(ji,jj,jk,jpdop) / ( trb(ji,jj,jk,jpdoc) + rtrn ) 
+
+                  ! Ammonification in suboxic waters with denitrification
+                  ! -------------------------------------------------------
+                  zolimit = zremikc * nitrfac(ji,jj,jk) * trb(ji,jj,jk,jpdoc)
+                  denitr(ji,jj,jk)  = MIN(  ( trb(ji,jj,jk,jpno3) - rtrn ) / rdenit, zolimit )
+                  denitr(ji,jj,jk) = MAX( 0.e0, denitr(ji,jj,jk) )
+                  zdenitrn  = zremikn * denitr(ji,jj,jk) * trb(ji,jj,jk,jpdon) / ( trb(ji,jj,jk,jpdoc) + rtrn )
+                  zdenitrp  = zremikp * denitr(ji,jj,jk) * trb(ji,jj,jk,jpdop) / ( trb(ji,jj,jk,jpdoc) + rtrn )
+
+                  tra(ji,jj,jk,jppo4) = tra(ji,jj,jk,jppo4) + zolimip + zdenitrp
+                  tra(ji,jj,jk,jpnh4) = tra(ji,jj,jk,jpnh4) + zolimin + zdenitrn
+                  tra(ji,jj,jk,jpno3) = tra(ji,jj,jk,jpno3) - denitr(ji,jj,jk) * rdenit
+                  tra(ji,jj,jk,jpdoc) = tra(ji,jj,jk,jpdoc) - zolimic - denitr(ji,jj,jk)
+                  tra(ji,jj,jk,jpdon) = tra(ji,jj,jk,jpdon) - zolimin - zdenitrn
+                  tra(ji,jj,jk,jpdop) = tra(ji,jj,jk,jpdop) - zolimip - zdenitrp
+                  tra(ji,jj,jk,jpoxy) = tra(ji,jj,jk,jpoxy) - zolimic * o2ut
+                  tra(ji,jj,jk,jpdic) = tra(ji,jj,jk,jpdic) + zolimic + denitr(ji,jj,jk)
+                  tra(ji,jj,jk,jptal) = tra(ji,jj,jk,jptal) + rno3 * ( zolimin + ( rdenit + 1.) * zdenitrn )
+               END DO
+            END DO
+         END DO
+         !
+      ENDIF
+
+
       DO jk = 1, jpkm1
          DO jj = 1, jpj
             DO ji = 1, jpi
-               zstep   = xstep
-# if defined key_degrad
-               zstep = zstep * facvol(ji,jj,jk)
-# endif
-               ! DOC ammonification. Depends on depth, phytoplankton biomass
-               ! and a limitation term which is supposed to be a parameterization
-               !     of the bacterial activity. 
-               zremik = xremik * zstep / 1.e-6 * xlimbac(ji,jj,jk) * zdepbac(ji,jj,jk) 
-               zremik = MAX( zremik, 2.74e-4 * xstep )
-               ! Ammonification in oxic waters with oxygen consumption
-               ! -----------------------------------------------------
-               zolimit = zremik * ( 1.- nitrfac(ji,jj,jk) ) * trb(ji,jj,jk,jpdoc) 
-               zolimi(ji,jj,jk) = MIN( ( trb(ji,jj,jk,jpoxy) - rtrn ) / o2ut, zolimit ) 
-               ! Ammonification in suboxic waters with denitrification
-               ! -------------------------------------------------------
-               denitr(ji,jj,jk)  = MIN(  ( trb(ji,jj,jk,jpno3) - rtrn ) / rdenit,   &
-                  &                     zremik * nitrfac(ji,jj,jk) * trb(ji,jj,jk,jpdoc)  )
-               !
-               zolimi (ji,jj,jk) = MAX( 0.e0, zolimi (ji,jj,jk) )
-               denitr (ji,jj,jk) = MAX( 0.e0, denitr (ji,jj,jk) )
-               !
-            END DO
-         END DO
-      END DO
-
-
-      DO jk = 1, jpkm1
-         DO jj = 1, jpj
-            DO ji = 1, jpi
-               zstep   = xstep
-# if defined key_degrad
-               zstep = zstep * facvol(ji,jj,jk)
-# endif
                ! NH4 nitrification to NO3. Ceased for oxygen concentrations
                ! below 2 umol/L. Inhibited at strong light 
                ! ----------------------------------------------------------
-               zonitr  =nitrif * zstep * trb(ji,jj,jk,jpnh4) / ( 1.+ emoy(ji,jj,jk) ) * ( 1.- nitrfac(ji,jj,jk) ) 
-               denitnh4(ji,jj,jk) = nitrif * zstep * trb(ji,jj,jk,jpnh4) * nitrfac(ji,jj,jk) 
+               zonitr  = nitrif * xstep * trb(ji,jj,jk,jpnh4) * ( 1.- nitrfac(ji,jj,jk) )  &
+               &         / ( 1.+ emoy(ji,jj,jk) ) * ( 1. + fr_i(ji,jj) * emoy(ji,jj,jk) ) 
+               zdenitnh4 = nitrif * xstep * trb(ji,jj,jk,jpnh4) * nitrfac(ji,jj,jk)
                ! Update of the tracers trends
                ! ----------------------------
-               tra(ji,jj,jk,jpnh4) = tra(ji,jj,jk,jpnh4) - zonitr - denitnh4(ji,jj,jk)
-               tra(ji,jj,jk,jpno3) = tra(ji,jj,jk,jpno3) + zonitr - rdenita * denitnh4(ji,jj,jk)
+               tra(ji,jj,jk,jpnh4) = tra(ji,jj,jk,jpnh4) - zonitr - zdenitnh4
+               tra(ji,jj,jk,jpno3) = tra(ji,jj,jk,jpno3) + zonitr - rdenita * zdenitnh4
                tra(ji,jj,jk,jpoxy) = tra(ji,jj,jk,jpoxy) - o2nit * zonitr
-               tra(ji,jj,jk,jptal) = tra(ji,jj,jk,jptal) - 2 * rno3 * zonitr + rno3 * ( rdenita - 1. ) * denitnh4(ji,jj,jk)
+               tra(ji,jj,jk,jptal) = tra(ji,jj,jk,jptal) - 2 * rno3 * zonitr + rno3 * ( rdenita - 1. ) * zdenitnh4
             END DO
          END DO
@@ -177,15 +214,10 @@
                ! studies (especially at Papa) have shown this uptake to be significant
                ! ----------------------------------------------------------
-               zbactfer = 10.e-6 *  rfact2 * prmax(ji,jj,jk) * xlimbacl(ji,jj,jk)             &
-                  &              * trb(ji,jj,jk,jpfer) / ( 2.5E-10 + trb(ji,jj,jk,jpfer) )    &
+               zbactfer = feratb *  rfact2 * prmax(ji,jj,jk) * xlimbacl(ji,jj,jk)             &
+                  &              * trb(ji,jj,jk,jpfer) / ( xkferb + trb(ji,jj,jk,jpfer) )    &
                   &              * zdepprod(ji,jj,jk) * zdepbac(ji,jj,jk)
-#if defined key_kriest
-               tra(ji,jj,jk,jpfer) = tra(ji,jj,jk,jpfer) - zbactfer*0.05
-               tra(ji,jj,jk,jpsfe) = tra(ji,jj,jk,jpsfe) + zbactfer*0.05
-#else
                tra(ji,jj,jk,jpfer) = tra(ji,jj,jk,jpfer) - zbactfer*0.16
                tra(ji,jj,jk,jpsfe) = tra(ji,jj,jk,jpsfe) + zbactfer*0.12
                tra(ji,jj,jk,jpbfe) = tra(ji,jj,jk,jpbfe) + zbactfer*0.04
-#endif
             END DO
          END DO
@@ -198,79 +230,25 @@
        ENDIF
 
+      ! Initialization of the array which contains the labile fraction
+      ! of bSi. Set to a constant in the upper ocean
+      ! ---------------------------------------------------------------
+
       DO jk = 1, jpkm1
          DO jj = 1, jpj
             DO ji = 1, jpi
-               zstep   = xstep
-# if defined key_degrad
-               zstep = zstep * facvol(ji,jj,jk)
-# endif
-               ! POC disaggregation by turbulence and bacterial activity. 
-               ! --------------------------------------------------------
-               zremip = xremip * zstep * tgfunc(ji,jj,jk) * ( 1.- 0.55 * nitrfac(ji,jj,jk) ) 
-
-               ! POC disaggregation rate is reduced in anoxic zone as shown by
-               ! sediment traps data. In oxic area, the exponent of the martin s
-               ! law is around -0.87. In anoxic zone, it is around -0.35. This
-               ! means a disaggregation constant about 0.5 the value in oxic zones
-               ! -----------------------------------------------------------------
-               zorem  = zremip * trb(ji,jj,jk,jppoc)
-               zofer  = zremip * trb(ji,jj,jk,jpsfe)
-#if ! defined key_kriest
-               zorem2 = zremip * trb(ji,jj,jk,jpgoc)
-               zofer2 = zremip * trb(ji,jj,jk,jpbfe)
-#else
-               zorem2 = zremip * trb(ji,jj,jk,jpnum)
-#endif
-
-               ! Update the appropriate tracers trends
-               ! -------------------------------------
-
-               tra(ji,jj,jk,jpdoc) = tra(ji,jj,jk,jpdoc) + zorem
-               tra(ji,jj,jk,jpfer) = tra(ji,jj,jk,jpfer) + zofer
-#if defined key_kriest
-               tra(ji,jj,jk,jppoc) = tra(ji,jj,jk,jppoc) - zorem
-               tra(ji,jj,jk,jpnum) = tra(ji,jj,jk,jpnum) - zorem2
-               tra(ji,jj,jk,jpsfe) = tra(ji,jj,jk,jpsfe) - zofer
-#else
-               tra(ji,jj,jk,jppoc) = tra(ji,jj,jk,jppoc) + zorem2 - zorem
-               tra(ji,jj,jk,jpgoc) = tra(ji,jj,jk,jpgoc) - zorem2
-               tra(ji,jj,jk,jpsfe) = tra(ji,jj,jk,jpsfe) + zofer2 - zofer
-               tra(ji,jj,jk,jpbfe) = tra(ji,jj,jk,jpbfe) - zofer2
-#endif
-
-            END DO
-         END DO
-      END DO
-
-       IF(ln_ctl)   THEN  ! print mean trends (used for debugging)
-         WRITE(charout, FMT="('rem3')")
-         CALL prt_ctl_trc_info(charout)
-         CALL prt_ctl_trc(tab4d=tra, mask=tmask, clinfo=ctrcnm)
-       ENDIF
-
-      DO jk = 1, jpkm1
-         DO jj = 1, jpj
-            DO ji = 1, jpi
-               zstep   = xstep
-# if defined key_degrad
-               zstep = zstep * facvol(ji,jj,jk)
-# endif
+               zdep     = MAX( hmld(ji,jj), heup_01(ji,jj) )
+               zsatur   = MAX( rtrn, ( sio3eq(ji,jj,jk) - trb(ji,jj,jk,jpsil) ) / ( sio3eq(ji,jj,jk) + rtrn ) )
+               zsatur2  = ( 1. + tsn(ji,jj,jk,jp_tem) / 400.)**37
+               znusil   = 0.225  * ( 1. + tsn(ji,jj,jk,jp_tem) / 15.) * zsatur + 0.775 * zsatur2 * zsatur**9.25
                ! Remineralization rate of BSi depedant on T and saturation
                ! ---------------------------------------------------------
-               zsatur   = ( sio3eq(ji,jj,jk) - trb(ji,jj,jk,jpsil) ) / ( sio3eq(ji,jj,jk) + rtrn )
-               zsatur   = MAX( rtrn, zsatur )
-               zsatur2  = ( 1. + tsn(ji,jj,jk,jp_tem) / 400.)**37
-               znusil   = 0.225  * ( 1. + tsn(ji,jj,jk,jp_tem) / 15.) * zsatur + 0.775 * zsatur2 * zsatur**9.25
-               znusil2  = 0.225  * ( 1. + tsn(ji,jj,1,jp_tem) / 15.) + 0.775 * zsatur2
-
-               ! Two classes of BSi are considered : a labile fraction and 
-               ! a more refractory one. The ratio between both fractions is
-               ! constant and specified in the namelist.
-               ! ----------------------------------------------------------
-               zdep     = MAX( hmld(ji,jj), heup(ji,jj) ) 
-               zdep     = MAX( 0., gdept_n(ji,jj,jk) - zdep )
-               ztem     = MAX( tsn(ji,jj,1,jp_tem), 0. )
-               zfactdep = xsilab * EXP(-( xsiremlab - xsirem ) * znusil2 * zdep / wsbio2 ) * ztem / ( ztem + 10. )
-               zsiremin = ( xsiremlab * zfactdep + xsirem * ( 1. - zfactdep ) ) * zstep * znusil
+               IF ( gdept_n(ji,jj,jk) > zdep ) THEN
+                  zfacsib(ji,jj,jk) = zfacsib(ji,jj,jk-1) * EXP( -0.5 * ( xsiremlab - xsirem )  &
+                  &                   * znusil * e3t_n(ji,jj,jk) / wsbio4(ji,jj,jk) )
+                  zfacsi(ji,jj,jk)  = zfacsib(ji,jj,jk) / ( 1.0 + zfacsib(ji,jj,jk) )
+                  zfacsib(ji,jj,jk) = zfacsib(ji,jj,jk) * EXP( -0.5 * ( xsiremlab - xsirem )    &
+                  &                   * znusil * e3t_n(ji,jj,jk) / wsbio4(ji,jj,jk) )
+               ENDIF
+               zsiremin = ( xsiremlab * zfacsi(ji,jj,jk) + xsirem * ( 1. - zfacsi(ji,jj,jk) ) ) * xstep * znusil
                zosil    = zsiremin * trb(ji,jj,jk,jpgsi)
                !
@@ -283,21 +261,8 @@
 
       IF(ln_ctl)   THEN  ! print mean trends (used for debugging)
-         WRITE(charout, FMT="('rem4')")
+         WRITE(charout, FMT="('rem3')")
          CALL prt_ctl_trc_info(charout)
          CALL prt_ctl_trc(tab4d=tra, mask=tmask, clinfo=ctrcnm)
        ENDIF
-
-      ! Update the arrays TRA which contain the biological sources and sinks
-      ! --------------------------------------------------------------------
-
-      DO jk = 1, jpkm1
-         tra(:,:,jk,jppo4) = tra(:,:,jk,jppo4) + zolimi (:,:,jk) + denitr(:,:,jk)
-         tra(:,:,jk,jpnh4) = tra(:,:,jk,jpnh4) + zolimi (:,:,jk) + denitr(:,:,jk)
-         tra(:,:,jk,jpno3) = tra(:,:,jk,jpno3) - denitr (:,:,jk) * rdenit
-         tra(:,:,jk,jpdoc) = tra(:,:,jk,jpdoc) - zolimi (:,:,jk) - denitr(:,:,jk)
-         tra(:,:,jk,jpoxy) = tra(:,:,jk,jpoxy) - zolimi (:,:,jk) * o2ut
-         tra(:,:,jk,jpdic) = tra(:,:,jk,jpdic) + zolimi (:,:,jk) + denitr(:,:,jk)
-         tra(:,:,jk,jptal) = tra(:,:,jk,jptal) + rno3 * ( zolimi(:,:,jk) + ( rdenit + 1.) * denitr(:,:,jk) )
-      END DO
 
       IF( knt == nrdttrc ) THEN
@@ -316,13 +281,7 @@
           CALL wrk_dealloc( jpi, jpj, jpk, zw3d )
        ENDIF
-
-      IF(ln_ctl)   THEN  ! print mean trends (used for debugging)
-         WRITE(charout, FMT="('rem6')")
-         CALL prt_ctl_trc_info(charout)
-         CALL prt_ctl_trc(tab4d=tra, mask=tmask, clinfo=ctrcnm)
-      ENDIF
       !
       CALL wrk_dealloc( jpi, jpj,      ztempbac                  )
-      CALL wrk_dealloc( jpi, jpj, jpk, zdepbac, zdepprod, zolimi )
+      CALL wrk_dealloc( jpi, jpj, jpk, zdepbac, zdepprod, zolimi, zfacsi, zfacsib )
       !
       IF( nn_timing == 1 )  CALL timing_stop('p4z_rem')
@@ -343,5 +302,6 @@
       !!
       !!----------------------------------------------------------------------
-      NAMELIST/nampisrem/ xremik, xremip, nitrif, xsirem, xsiremlab, xsilab
+      NAMELIST/nampisrem/ xremik, nitrif, xsirem, xsiremlab, xsilab, feratb, xkferb, & 
+         &                xremikc, xremikn, xremikp
       INTEGER :: ios                 ! Local integer output status for namelist read
 
@@ -359,14 +319,20 @@
          WRITE(numout,*) ' Namelist parameters for remineralization, nampisrem'
          WRITE(numout,*) ' ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~'
-         WRITE(numout,*) '    remineralisation rate of POC              xremip    =', xremip
-         WRITE(numout,*) '    remineralization rate of DOC              xremik    =', xremik
+         IF( ln_p4z ) THEN
+            WRITE(numout,*) '    remineralization rate of DOC              xremik    =', xremik
+         ELSE
+            WRITE(numout,*) '    remineralization rate of DOC              xremikc   =', xremikc
+            WRITE(numout,*) '    remineralization rate of DON              xremikn   =', xremikn
+            WRITE(numout,*) '    remineralization rate of DOP              xremikp   =', xremikp
+         ENDIF
          WRITE(numout,*) '    remineralization rate of Si               xsirem    =', xsirem
          WRITE(numout,*) '    fast remineralization rate of Si          xsiremlab =', xsiremlab
          WRITE(numout,*) '    fraction of labile biogenic silica        xsilab    =', xsilab
          WRITE(numout,*) '    NH4 nitrification rate                    nitrif    =', nitrif
+         WRITE(numout,*) '    Bacterial Fe/C ratio                      feratb    =', feratb
+         WRITE(numout,*) '    Half-saturation constant for bact. Fe/C   xkferb    =', xkferb
       ENDIF
       !
       denitr  (:,:,:) = 0._wp
-      denitnh4(:,:,:) = 0._wp
       !
    END SUBROUTINE p4z_rem_init
@@ -377,18 +343,9 @@
       !!                     ***  ROUTINE p4z_rem_alloc  ***
       !!----------------------------------------------------------------------
-      ALLOCATE( denitr(jpi,jpj,jpk), denitnh4(jpi,jpj,jpk), STAT=p4z_rem_alloc )
+      ALLOCATE( denitr(jpi,jpj,jpk), STAT=p4z_rem_alloc )
       !
       IF( p4z_rem_alloc /= 0 )   CALL ctl_warn('p4z_rem_alloc: failed to allocate arrays')
       !
    END FUNCTION p4z_rem_alloc
-
-#else
-   !!======================================================================
-   !!  Dummy module :                                   No PISCES bio-model
-   !!======================================================================
-CONTAINS
-   SUBROUTINE p4z_rem                    ! Empty routine
-   END SUBROUTINE p4z_rem
-#endif 
 
    !!======================================================================
Index: branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/NEMO/TOP_SRC/PISCES/P4Z/p4zsbc.F90
===================================================================
--- branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/NEMO/TOP_SRC/PISCES/P4Z/p4zsbc.F90	(revision 7383)
+++ branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/NEMO/TOP_SRC/PISCES/P4Z/p4zsbc.F90	(revision 7391)
@@ -5,8 +5,4 @@
    !!======================================================================
    !! History :   3.5  !  2012-07 (O. Aumont, C. Ethe) Original code
-   !!----------------------------------------------------------------------
-#if defined key_pisces
-   !!----------------------------------------------------------------------
-   !!   'key_pisces'                                       PISCES bio-model
    !!----------------------------------------------------------------------
    !!   p4z_sbc        :  Read and interpolate time-varying nutrients fluxes
@@ -41,4 +37,8 @@
    REAL(wp), PUBLIC  :: concfediaz  !: Fe half-saturation Cste for diazotrophs 
    REAL(wp)          :: hratio      !: Fe:3He ratio assumed for vent iron supply
+   REAL(wp), PUBLIC  :: fep_rats    !: Fep/Fer ratio from sed  sources
+   REAL(wp), PUBLIC  :: fep_rath    !: Fep/Fer ratio from hydro sources
+   REAL(wp), PUBLIC  :: lgw_rath    !: Weak ligand ratio from hydro sources
+
 
    LOGICAL , PUBLIC  :: ll_sbc
@@ -70,4 +70,6 @@
    REAL(wp), PUBLIC, ALLOCATABLE, SAVE,   DIMENSION(:,:) :: rivdic, rivalk    !: river input fields
    REAL(wp), PUBLIC, ALLOCATABLE, SAVE,   DIMENSION(:,:) :: rivdin, rivdip    !: river input fields
+   REAL(wp), PUBLIC, ALLOCATABLE, SAVE,   DIMENSION(:,:) :: rivdon, rivdop    !: river input fields
+   REAL(wp), PUBLIC, ALLOCATABLE, SAVE,   DIMENSION(:,:) :: rivdoc    !: river input fields
    REAL(wp), PUBLIC, ALLOCATABLE, SAVE,   DIMENSION(:,:) :: rivdsi    !: river input fields
    REAL(wp), PUBLIC, ALLOCATABLE, SAVE,   DIMENSION(:,:) :: nitdep    !: atmospheric N deposition 
@@ -134,19 +136,41 @@
          IF( kt == nit000 .OR. ( kt /= nit000 .AND. ntimes_riv > 1 ) ) THEN
             CALL fld_read( kt, 1, sf_river )
-            DO jj = 1, jpj
-               DO ji = 1, jpi
-                  zcoef = ryyss * e1e2t(ji,jj) * h_rnf(ji,jj) 
-                  rivalk(ji,jj) =   sf_river(jr_dic)%fnow(ji,jj,1)                                    &
-                     &              * 1.E3        / ( 12. * zcoef + rtrn )
-                  rivdic(ji,jj) = ( sf_river(jr_dic)%fnow(ji,jj,1) + sf_river(jr_doc)%fnow(ji,jj,1) ) &
-                     &              * 1.E3         / ( 12. * zcoef + rtrn )
-                  rivdin(ji,jj) = ( sf_river(jr_din)%fnow(ji,jj,1) + sf_river(jr_don)%fnow(ji,jj,1) ) &
-                     &              * 1.E3 / rno3 / ( 14. * zcoef + rtrn )
-                  rivdip(ji,jj) = ( sf_river(jr_dip)%fnow(ji,jj,1) + sf_river(jr_dop)%fnow(ji,jj,1) ) &
-                     &              * 1.E3 / po4r / ( 31. * zcoef + rtrn )
-                  rivdsi(ji,jj) =   sf_river(jr_dsi)%fnow(ji,jj,1)                                    &
-                     &              * 1.E3        / ( 28.1 * zcoef + rtrn )
+            IF( ln_p4z ) THEN
+               DO jj = 1, jpj
+                  DO ji = 1, jpi
+                     zcoef = ryyss * e1e2t(ji,jj) * h_rnf(ji,jj) 
+                     rivalk(ji,jj) =   sf_river(jr_dic)%fnow(ji,jj,1)                                    &
+                        &              * 1.E3        / ( 12. * zcoef + rtrn )
+                     rivdic(ji,jj) = ( sf_river(jr_dic)%fnow(ji,jj,1) + sf_river(jr_doc)%fnow(ji,jj,1) ) &
+                        &              * 1.E3         / ( 12. * zcoef + rtrn )
+                     rivdin(ji,jj) = ( sf_river(jr_din)%fnow(ji,jj,1) + sf_river(jr_don)%fnow(ji,jj,1) ) &
+                        &              * 1.E3 / rno3 / ( 14. * zcoef + rtrn )
+                     rivdip(ji,jj) = ( sf_river(jr_dip)%fnow(ji,jj,1) + sf_river(jr_dop)%fnow(ji,jj,1) ) &
+                        &              * 1.E3 / po4r / ( 31. * zcoef + rtrn )
+                     rivdsi(ji,jj) =   sf_river(jr_dsi)%fnow(ji,jj,1)                                    &
+                        &              * 1.E3        / ( 28.1 * zcoef + rtrn )
+                  END DO
                END DO
-            END DO
+            ELSE    !  ln_p5z
+               DO jj = 1, jpj
+                  DO ji = 1, jpi
+                     zcoef = ryyss * e1e2t(ji,jj) * h_rnf(ji,jj) 
+                     rivalk(ji,jj) =   sf_river(jr_dic)%fnow(ji,jj,1)                                    &
+                        &              * 1.E3        / ( 12. * zcoef + rtrn )
+                     rivdic(ji,jj) = ( sf_river(jr_dic)%fnow(ji,jj,1) ) &
+                        &              * 1.E3 / ( 12. * zcoef + rtrn ) * tmask(ji,jj,1)
+                     rivdin(ji,jj) = ( sf_river(jr_din)%fnow(ji,jj,1) ) &
+                        &              * 1.E3 / rno3 / ( 14. * zcoef + rtrn ) * tmask(ji,jj,1)
+                     rivdip(ji,jj) = ( sf_river(jr_dip)%fnow(ji,jj,1) ) &
+                        &              * 1.E3 / po4r / ( 31. * zcoef + rtrn ) * tmask(ji,jj,1)
+                     rivdoc(ji,jj) = ( sf_river(jr_doc)%fnow(ji,jj,1) ) &
+                        &              * 1.E3 / ( 12. * zcoef + rtrn ) * tmask(ji,jj,1)
+                     rivdon(ji,jj) = ( sf_river(jr_don)%fnow(ji,jj,1) ) &
+                        &              * 1.E3 / rno3 / ( 14. * zcoef + rtrn ) * tmask(ji,jj,1)
+                     rivdop(ji,jj) = ( sf_river(jr_dop)%fnow(ji,jj,1) ) &
+                        &              * 1.E3 / po4r / ( 31. * zcoef + rtrn ) * tmask(ji,jj,1)
+                  END DO
+               END DO
+            ENDIF
          ENDIF
       ENDIF
@@ -205,5 +229,6 @@
         &                sn_riverdip, sn_riverdop, sn_riverdsi, sn_ndepo, sn_ironsed, sn_hydrofe, &
         &                ln_dust, ln_solub, ln_river, ln_ndepo, ln_ironsed, ln_ironice, ln_hydrofe,    &
-        &                sedfeinput, dustsolub, icefeinput, wdust, mfrac, nitrfix, diazolight, concfediaz, hratio
+        &                sedfeinput, dustsolub, icefeinput, wdust, mfrac, nitrfix, diazolight, concfediaz, &
+        &                hratio, fep_rats, fep_rath, lgw_rath
       !!----------------------------------------------------------------------
       !
@@ -249,4 +274,9 @@
          WRITE(numout,*) '    fe half-saturation cste for diazotrophs  concfediaz  = ', concfediaz
          WRITE(numout,*) '    Fe to 3He ratio assumed for vent iron supply hratio  = ', hratio
+         IF( ln_ligand ) THEN
+            WRITE(numout,*) '    Fep/Fer ratio from sed sources            fep_rats   = ', fep_rats
+            WRITE(numout,*) '    Fep/Fer ratio from sed hydro sources      fep_rath   = ', fep_rath
+            WRITE(numout,*) '    Weak ligand ratio from sed hydro sources  lgw_rath   = ', lgw_rath
+         ENDIF
       END IF
 
@@ -291,5 +321,5 @@
             END DO
             CALL iom_close( numdust )
-            ztimes_dust = 1._wp / FLOAT( ntimes_dust ) 
+            ztimes_dust = 1._wp / REAL(ntimes_dust, wp) 
             sumdepsi = 0.e0
             DO jm = 1, ntimes_dust
@@ -334,4 +364,5 @@
          !
          ALLOCATE( rivdic(jpi,jpj), rivalk(jpi,jpj), rivdin(jpi,jpj), rivdip(jpi,jpj), rivdsi(jpi,jpj) ) 
+         IF( ln_p5z )  ALLOCATE( rivdon(jpi,jpj), rivdop(jpi,jpj), rivdoc(jpi,jpj) )
          !
          ALLOCATE( sf_river(jpriv), rivinput(jpriv), STAT=ierr1 )           !* allocate and fill sf_river (forcing structure) with sn_river_
@@ -355,5 +386,5 @@
                END DO
                CALL iom_close( numriv )
-               ztimes_riv = 1._wp / FLOAT(ntimes_riv) 
+               ztimes_riv = 1._wp / REAL(ntimes_riv, wp) 
                DO jm = 1, ntimes_riv
                   rivinput(ifpr) = rivinput(ifpr) + glob_sum( zriver(:,:,jm) * tmask(:,:,1) * ztimes_riv ) 
@@ -402,5 +433,5 @@
             END DO
             CALL iom_close( numdepo )
-            ztimes_ndep = 1._wp / FLOAT( ntimes_ndep ) 
+            ztimes_ndep = 1._wp / REAL(ntimes_ndep, wp) 
             nitdepinput = 0._wp
             DO jm = 1, ntimes_ndep
@@ -508,13 +539,4 @@
    END SUBROUTINE p4z_sbc_init
 
-#else
-   !!======================================================================
-   !!  Dummy module :                                   No PISCES bio-model
-   !!======================================================================
-CONTAINS
-   SUBROUTINE p4z_sbc                         ! Empty routine
-   END SUBROUTINE p4z_sbc
-#endif 
-
    !!======================================================================
 END MODULE p4zsbc
Index: branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/NEMO/TOP_SRC/PISCES/P4Z/p4zsed.F90
===================================================================
--- branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/NEMO/TOP_SRC/PISCES/P4Z/p4zsed.F90	(revision 7383)
+++ branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/NEMO/TOP_SRC/PISCES/P4Z/p4zsed.F90	(revision 7391)
@@ -9,8 +9,4 @@
    !!             3.5  !  2012-07 (O. Aumont) improvment of river input of nutrients 
    !!----------------------------------------------------------------------
-#if defined key_pisces
-   !!----------------------------------------------------------------------
-   !!   'key_pisces'                                       PISCES bio-model
-   !!----------------------------------------------------------------------
    !!   p4z_sed        :  Compute loss of organic matter in the sediments
    !!----------------------------------------------------------------------
@@ -18,6 +14,4 @@
    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 p4zsbc          !  External source of nutrients 
@@ -56,19 +50,23 @@
       INTEGER, INTENT(in) ::   kt, knt ! ocean time step
       INTEGER  ::   ji, jj, jk, ikt
-#if ! defined key_sed
       REAL(wp) ::   zsumsedsi, zsumsedpo4, zsumsedcal
       REAL(wp) ::   zrivalk, zrivsil, zrivno3
-#endif
       REAL(wp) ::  zwflux, zfminus, zfplus
       REAL(wp) ::  zlim, zfact, zfactcal
       REAL(wp) ::  zo2, zno3, zflx, zpdenit, z1pdenit, zdenitt, zolimit
-      REAL(wp) ::  zsiloss, zcaloss, zws3, zws4, zwsc, zdep, zwstpoc
-      REAL(wp) ::  ztrfer, ztrpo4, zwdust, zlight
+      REAL(wp) ::  zsiloss, zcaloss, zws3, zws4, zwsc, zdep
+      REAL(wp) ::  zwstpoc, zwstpon, zwstpop
+      REAL(wp) ::  ztrfer, ztrpo4s, ztrdp, zwdust, zmudia, ztemp
+      REAL(wp) ::  xdiano3, xdianh4
+      REAL(wp) ::  zwssfep
       !
       CHARACTER (len=25) :: charout
-      REAL(wp), POINTER, DIMENSION(:,:  ) :: zpdep, zsidep, zwork1, zwork2, zwork3
+      REAL(wp), POINTER, DIMENSION(:,:  ) :: zsidep, zwork1, zwork2, zwork3
       REAL(wp), POINTER, DIMENSION(:,:  ) :: zdenit2d, zironice, zbureff
       REAL(wp), POINTER, DIMENSION(:,:  ) :: zwsbio3, zwsbio4, zwscal
-      REAL(wp), POINTER, DIMENSION(:,:,:) :: zirondep, zsoufer
+      REAL(wp), POINTER, DIMENSION(:,:  ) :: zsedcal, zsedsi, zsedc
+      REAL(wp), POINTER, DIMENSION(:,:,:) :: ztrpo4, ztrdop, zirondep, zsoufer, zpdep, zlight
+      REAL(wp), POINTER, DIMENSION(:,:  ) :: zwsfep
+
       !!---------------------------------------------------------------------
       !
@@ -78,7 +76,11 @@
       !
       ! Allocate temporary workspace
-      CALL wrk_alloc( jpi, jpj, zdenit2d, zwork1, zwork2, zwork3, zbureff )
-      CALL wrk_alloc( jpi, jpj, zwsbio3, zwsbio4, zwscal )
-      CALL wrk_alloc( jpi, jpj, jpk, zsoufer )
+                      CALL wrk_alloc( jpi, jpj, zdenit2d, zwork1, zwork2, zwork3, zbureff )
+                      CALL wrk_alloc( jpi, jpj, zwsbio3, zwsbio4, zwscal )
+                      CALL wrk_alloc( jpi, jpj, zsedcal,  zsedsi, zsedc )
+                      CALL wrk_alloc( jpi, jpj, jpk, zlight, zsoufer )
+      IF( ln_p5z )    CALL wrk_alloc( jpi, jpj, jpk, ztrpo4, ztrdop )
+      IF( ln_ligand ) CALL wrk_alloc( jpi, jpj, zwsfep )
+
 
       zdenit2d(:,:) = 0.e0
@@ -87,4 +89,8 @@
       zwork2  (:,:) = 0.e0
       zwork3  (:,:) = 0.e0
+      zsedsi  (:,:) = 0.e0
+      zsedcal (:,:) = 0.e0
+      zsedc   (:,:) = 0.e0
+
 
       ! Iron input/uptake due to sea ice : Crude parameterization based on Lancelot et al.
@@ -117,6 +123,6 @@
       IF( ln_dust ) THEN
          !                                              
-         CALL wrk_alloc( jpi, jpj,      zpdep, zsidep )
-         CALL wrk_alloc( jpi, jpj, jpk, zirondep      )
+         CALL wrk_alloc( jpi, jpj,      zsidep )
+         CALL wrk_alloc( jpi, jpj, jpk, zpdep, zirondep      )
          !                                              ! Iron and Si deposition at the surface
          IF( ln_solub ) THEN
@@ -125,6 +131,6 @@
             zirondep(:,:,1) = dustsolub  * dust(:,:) * mfrac * rfact2 / e3t_n(:,:,1) / 55.85 + 3.e-10 * r1_ryyss 
          ENDIF
-         zsidep(:,:) = 8.8 * 0.075 * dust(:,:) * mfrac * rfact2 / e3t_n(:,:,1) / 28.1 
-         zpdep (:,:) = 0.1 * 0.021 * dust(:,:) * mfrac * rfact2 / e3t_n(:,:,1) / 31. / po4r 
+         zsidep(:,:)   = 8.8 * 0.075 * dust(:,:) * mfrac * rfact2 / e3t_n(:,:,1) / 28.1 
+         zpdep (:,:,1) = 0.1 * 0.021 * dust(:,:) * mfrac * rfact2 / e3t_n(:,:,1) / 31. / po4r 
          !                                              ! Iron solubilization of particles in the water column
          !                                              ! dust in kg/m2/s ---> 1/55.85 to put in mol/Fe ;  wdust in m/j
@@ -132,8 +138,9 @@
          DO jk = 2, jpkm1
             zirondep(:,:,jk) = dust(:,:) * mfrac * zwdust * rfact2 * EXP( -gdept_n(:,:,jk) / 540. )
+            zpdep   (:,:,jk) = zirondep(:,:,jk) * 0.023
          END DO
          !                                              ! Iron solubilization of particles in the water column
-         tra(:,:,1,jppo4) = tra(:,:,1,jppo4) + zpdep   (:,:)
          tra(:,:,1,jpsil) = tra(:,:,1,jpsil) + zsidep  (:,:)
+         tra(:,:,:,jppo4) = tra(:,:,:,jppo4) + zpdep   (:,:,:)
          tra(:,:,:,jpfer) = tra(:,:,:,jpfer) + zirondep(:,:,:) 
          ! 
@@ -145,10 +152,7 @@
                 &  CALL iom_put( "pdust"  , dust(:,:) / ( wdust * rday )  * tmask(:,:,1) ) ! dust concentration at surface
             ENDIF
-         ELSE                                    
-            IF( ln_diatrc )  &
-              &  trc2d(:,:,jp_pcs0_2d + 11) = zirondep(:,:,1) * 1.e+3 * rfact2r * e3t_n(:,:,1) * tmask(:,:,1)
          ENDIF
-         CALL wrk_dealloc( jpi, jpj,      zpdep, zsidep )
-         CALL wrk_dealloc( jpi, jpj, jpk, zirondep      )
+         CALL wrk_dealloc( jpi, jpj,      zsidep )
+         CALL wrk_dealloc( jpi, jpj, jpk, zpdep, zirondep      )
          !                                              
       ENDIF
@@ -169,4 +173,15 @@
             ENDDO
          ENDDO
+         IF( ln_p5z ) THEN
+            DO jj = 1, jpj
+               DO ji = 1, jpi
+                  DO jk = 1, nk_rnf(ji,jj)
+                     tra(ji,jj,jk,jpdop) = tra(ji,jj,jk,jpdop) + rivdop(ji,jj) * rfact2
+                     tra(ji,jj,jk,jpdon) = tra(ji,jj,jk,jpdon) + rivdon(ji,jj) * rfact2
+                     tra(ji,jj,jk,jpdoc) = tra(ji,jj,jk,jpdoc) + rivdoc(ji,jj) * rfact2
+                  ENDDO
+               ENDDO
+            ENDDO
+         ENDIF
       ENDIF
       
@@ -181,5 +196,6 @@
       ! ------------------------------------------------------
       IF( ln_ironsed ) THEN
-         tra(:,:,:,jpfer) = tra(:,:,:,jpfer) + ironsed(:,:,:) * rfact2
+                         tra(:,:,:,jpfer) = tra(:,:,:,jpfer) + ironsed(:,:,:) * rfact2
+         IF( ln_ligand ) tra(:,:,:,jpfep) = tra(:,:,:,jpfep) + ( ironsed(:,:,:) * fep_rats ) * rfact2
          !
          IF( lk_iomput .AND. knt == nrdttrc .AND. iom_use( "Ironsed" ) )   &
@@ -190,5 +206,9 @@
       ! ------------------------------------------------------
       IF( ln_hydrofe ) THEN
-         tra(:,:,:,jpfer) = tra(:,:,:,jpfer) + hydrofe(:,:,:) * rfact2
+            tra(:,:,:,jpfer) = tra(:,:,:,jpfer) + hydrofe(:,:,:) * rfact2
+         IF( ln_ligand ) THEN
+            tra(:,:,:,jpfep) = tra(:,:,:,jpfep) + ( hydrofe(:,:,:) * fep_rath ) * rfact2
+            tra(:,:,:,jplgw) = tra(:,:,:,jplgw) + ( hydrofe(:,:,:) * lgw_rath ) * rfact2
+         ENDIF
          !
          IF( lk_iomput .AND. knt == nrdttrc .AND. iom_use( "HYDR" ) )   &
@@ -196,6 +216,5 @@
       ENDIF
 
-      ! OA: Warning, the following part is necessary, especially with Kriest
-      ! to avoid CFL problems above the sediments
+      ! OA: Warning, the following part is necessary to avoid CFL problems above the sediments
       ! --------------------------------------------------------------------
       DO jj = 1, jpj
@@ -208,67 +227,67 @@
          END DO
       END DO
-
-#if ! defined key_sed
-      ! Computation of the sediment denitrification proportion: The metamodel from midlleburg (2006) is being used
-      ! Computation of the fraction of organic matter that is permanently buried from Dunne's model
-      ! -------------------------------------------------------
-      DO jj = 1, jpj
-         DO ji = 1, jpi
-           IF( tmask(ji,jj,1) == 1 ) THEN
-              ikt = mbkt(ji,jj)
-# if defined key_kriest
-              zflx =    trb(ji,jj,ikt,jppoc) * zwsbio3(ji,jj)    * 1E3 * 1E6 / 1E4
-# else
-              zflx = (  trb(ji,jj,ikt,jpgoc) * zwsbio4(ji,jj)   &
-                &     + trb(ji,jj,ikt,jppoc) * zwsbio3(ji,jj) )  * 1E3 * 1E6 / 1E4
-#endif
-              zflx  = LOG10( MAX( 1E-3, zflx ) )
-              zo2   = LOG10( MAX( 10. , trb(ji,jj,ikt,jpoxy) * 1E6 ) )
-              zno3  = LOG10( MAX( 1.  , trb(ji,jj,ikt,jpno3) * 1E6 * rno3 ) )
-              zdep  = LOG10( gdepw_n(ji,jj,ikt+1) )
-              zdenit2d(ji,jj) = -2.2567 - 1.185 * zflx - 0.221 * zflx**2 - 0.3995 * zno3 * zo2 + 1.25 * zno3    &
-              &                + 0.4721 * zo2 - 0.0996 * zdep + 0.4256 * zflx * zo2
-              zdenit2d(ji,jj) = 10.0**( zdenit2d(ji,jj) )
-              !
-              zflx = (  trb(ji,jj,ikt,jpgoc) * zwsbio4(ji,jj)   &
-                &     + trb(ji,jj,ikt,jppoc) * zwsbio3(ji,jj) ) * 1E6
-              zbureff(ji,jj) = 0.013 + 0.53 * zflx**2 / ( 7.0 + zflx )**2
-           ENDIF
-         END DO
-      END DO 
-
-      ! Loss of biogenic silicon, Caco3 organic carbon in the sediments. 
-      ! First, the total loss is computed.
-      ! The factor for calcite comes from the alkalinity effect
-      ! -------------------------------------------------------------
-      DO jj = 1, jpj
-         DO ji = 1, jpi
-            IF( tmask(ji,jj,1) == 1 ) THEN
-               ikt = mbkt(ji,jj) 
-# if defined key_kriest
-               zwork1(ji,jj) = trb(ji,jj,ikt,jpgsi) * zwscal (ji,jj)
-               zwork2(ji,jj) = trb(ji,jj,ikt,jppoc) * zwsbio3(ji,jj)
-# else
-               zwork1(ji,jj) = trb(ji,jj,ikt,jpgsi) * zwsbio4(ji,jj)
-               zwork2(ji,jj) = trb(ji,jj,ikt,jpgoc) * zwsbio4(ji,jj) + trb(ji,jj,ikt,jppoc) * zwsbio3(ji,jj) 
-# endif
-               ! For calcite, burial efficiency is made a function of saturation
-               zfactcal      = MIN( excess(ji,jj,ikt), 0.2 )
-               zfactcal      = MIN( 1., 1.3 * ( 0.2 - zfactcal ) / ( 0.4 - zfactcal ) )
-               zwork3(ji,jj) = trb(ji,jj,ikt,jpcal) * zwscal(ji,jj) * 2.e0 * zfactcal
-            ENDIF
-         END DO
-      END DO
-      zsumsedsi  = glob_sum( zwork1(:,:) * e1e2t(:,:) ) * r1_rday
-      zsumsedpo4 = glob_sum( zwork2(:,:) * e1e2t(:,:) ) * r1_rday
-      zsumsedcal = glob_sum( zwork3(:,:) * e1e2t(:,:) ) * r1_rday
-#endif
+      !
+      IF( ln_ligand ) THEN
+         DO jj = 1, jpj
+            DO ji = 1, jpi
+               ikt  = mbkt(ji,jj)
+               zdep = e3t_n(ji,jj,ikt) / xstep
+               zwsfep(ji,jj)  = MIN( 0.99 * zdep, wsfep(ji,jj,ikt)  )
+            END DO
+         ENDDO
+      ENDIF
+
+      IF( .NOT.lk_sed ) THEN
+         ! Computation of the sediment denitrification proportion: The metamodel from midlleburg (2006) is being used
+         ! Computation of the fraction of organic matter that is permanently buried from Dunne's model
+         ! -------------------------------------------------------
+         DO jj = 1, jpj
+            DO ji = 1, jpi
+              IF( tmask(ji,jj,1) == 1 ) THEN
+                 ikt = mbkt(ji,jj)
+                 zflx = (  trb(ji,jj,ikt,jpgoc) * zwsbio4(ji,jj)   &
+                   &     + trb(ji,jj,ikt,jppoc) * zwsbio3(ji,jj) )  * 1E3 * 1E6 / 1E4
+                 zflx  = LOG10( MAX( 1E-3, zflx ) )
+                 zo2   = LOG10( MAX( 10. , trb(ji,jj,ikt,jpoxy) * 1E6 ) )
+                 zno3  = LOG10( MAX( 1.  , trb(ji,jj,ikt,jpno3) * 1E6 * rno3 ) )
+                 zdep  = LOG10( gdepw_n(ji,jj,ikt+1) )
+                 zdenit2d(ji,jj) = -2.2567 - 1.185 * zflx - 0.221 * zflx**2 - 0.3995 * zno3 * zo2 + 1.25 * zno3    &
+                   &                + 0.4721 * zo2 - 0.0996 * zdep + 0.4256 * zflx * zo2
+                 zdenit2d(ji,jj) = 10.0**( zdenit2d(ji,jj) )
+                   !
+                 zflx = (  trb(ji,jj,ikt,jpgoc) * zwsbio4(ji,jj)   &
+                   &     + trb(ji,jj,ikt,jppoc) * zwsbio3(ji,jj) ) * 1E6
+                 zbureff(ji,jj) = 0.013 + 0.53 * zflx**2 / ( 7.0 + zflx )**2
+                ENDIF
+              END DO
+           END DO 
+
+           ! Loss of biogenic silicon, Caco3 organic carbon in the sediments. 
+           ! First, the total loss is computed.
+           ! The factor for calcite comes from the alkalinity effect
+           ! -------------------------------------------------------------
+           DO jj = 1, jpj
+              DO ji = 1, jpi
+                 IF( tmask(ji,jj,1) == 1 ) THEN
+                    ikt = mbkt(ji,jj) 
+                    zwork1(ji,jj) = trb(ji,jj,ikt,jpgsi) * zwsbio4(ji,jj)
+                    zwork2(ji,jj) = trb(ji,jj,ikt,jpgoc) * zwsbio4(ji,jj) + trb(ji,jj,ikt,jppoc) * zwsbio3(ji,jj) 
+                    ! For calcite, burial efficiency is made a function of saturation
+                    zfactcal      = MIN( excess(ji,jj,ikt), 0.2 )
+                    zfactcal      = MIN( 1., 1.3 * ( 0.2 - zfactcal ) / ( 0.4 - zfactcal ) )
+                    zwork3(ji,jj) = trb(ji,jj,ikt,jpcal) * zwscal(ji,jj) * 2.e0 * zfactcal
+                ENDIF
+            END DO
+         END DO
+         zsumsedsi  = glob_sum( zwork1(:,:) * e1e2t(:,:) ) * r1_rday
+         zsumsedpo4 = glob_sum( zwork2(:,:) * e1e2t(:,:) ) * r1_rday
+         zsumsedcal = glob_sum( zwork3(:,:) * e1e2t(:,:) ) * r1_rday
+         !
+      ENDIF
 
       ! This loss is scaled at each bottom grid cell for equilibrating the total budget of silica in the ocean.
       ! Thus, the amount of silica lost in the sediments equal the supply at the surface (dust+rivers)
       ! ------------------------------------------------------
-#if ! defined key_sed
-      zrivsil =  1._wp - ( sumdepsi + rivdsiinput * r1_ryyss ) / ( zsumsedsi + rtrn )
-#endif
+      IF( .NOT.lk_sed )  zrivsil =  1._wp - ( sumdepsi + rivdsiinput * r1_ryyss ) / ( zsumsedsi + rtrn )
 
       DO jj = 1, jpj
@@ -276,26 +295,34 @@
             ikt  = mbkt(ji,jj)
             zdep = xstep / e3t_n(ji,jj,ikt) 
-            zws4 = zwsbio4(ji,jj) * zdep
             zwsc = zwscal (ji,jj) * zdep
-# if defined key_kriest
-            zsiloss = trb(ji,jj,ikt,jpgsi) * zws4
-# else
             zsiloss = trb(ji,jj,ikt,jpgsi) * zwsc
-# endif
             zcaloss = trb(ji,jj,ikt,jpcal) * zwsc
             !
             tra(ji,jj,ikt,jpgsi) = tra(ji,jj,ikt,jpgsi) - zsiloss
             tra(ji,jj,ikt,jpcal) = tra(ji,jj,ikt,jpcal) - zcaloss
-#if ! defined key_sed
-            tra(ji,jj,ikt,jpsil) = tra(ji,jj,ikt,jpsil) + zsiloss * zrivsil 
-            zfactcal = MIN( excess(ji,jj,ikt), 0.2 )
-            zfactcal = MIN( 1., 1.3 * ( 0.2 - zfactcal ) / ( 0.4 - zfactcal ) )
-            zrivalk  =  1._wp - ( rivalkinput * r1_ryyss ) * zfactcal / ( zsumsedcal + rtrn )
-            tra(ji,jj,ikt,jptal) =  tra(ji,jj,ikt,jptal) + zcaloss * zrivalk * 2.0
-            tra(ji,jj,ikt,jpdic) =  tra(ji,jj,ikt,jpdic) + zcaloss * zrivalk
-#endif
          END DO
       END DO
-
+      !
+      IF( .NOT.lk_sed ) THEN
+         DO jj = 1, jpj
+            DO ji = 1, jpi
+               ikt  = mbkt(ji,jj)
+               zdep = xstep / e3t_n(ji,jj,ikt) 
+               zwsc = zwscal (ji,jj) * zdep
+               zsiloss = trb(ji,jj,ikt,jpgsi) * zwsc
+               zcaloss = trb(ji,jj,ikt,jpcal) * zwsc
+               tra(ji,jj,ikt,jpsil) = tra(ji,jj,ikt,jpsil) + zsiloss * zrivsil 
+               !
+               zfactcal = MIN( excess(ji,jj,ikt), 0.2 )
+               zfactcal = MIN( 1., 1.3 * ( 0.2 - zfactcal ) / ( 0.4 - zfactcal ) )
+               zrivalk  =  1._wp - ( rivalkinput * r1_ryyss ) * zfactcal / ( zsumsedcal + rtrn )
+               tra(ji,jj,ikt,jptal) =  tra(ji,jj,ikt,jptal) + zcaloss * zrivalk * 2.0
+               tra(ji,jj,ikt,jpdic) =  tra(ji,jj,ikt,jpdic) + zcaloss * zrivalk
+               zsedcal(ji,jj) = (1.0 - zrivalk) * zcaloss / zdep
+               zsedsi (ji,jj) = (1.0 - zrivsil) * zsiloss / zdep
+            END DO
+         END DO
+      ENDIF
+      !
       DO jj = 1, jpj
          DO ji = 1, jpi
@@ -304,36 +331,71 @@
             zws4 = zwsbio4(ji,jj) * zdep
             zws3 = zwsbio3(ji,jj) * zdep
-            zrivno3 = 1. - zbureff(ji,jj)
-# if ! defined key_kriest
             tra(ji,jj,ikt,jpgoc) = tra(ji,jj,ikt,jpgoc) - trb(ji,jj,ikt,jpgoc) * zws4 
             tra(ji,jj,ikt,jppoc) = tra(ji,jj,ikt,jppoc) - trb(ji,jj,ikt,jppoc) * zws3
             tra(ji,jj,ikt,jpbfe) = tra(ji,jj,ikt,jpbfe) - trb(ji,jj,ikt,jpbfe) * zws4
             tra(ji,jj,ikt,jpsfe) = tra(ji,jj,ikt,jpsfe) - trb(ji,jj,ikt,jpsfe) * zws3
-            zwstpoc              = trb(ji,jj,ikt,jpgoc) * zws4 + trb(ji,jj,ikt,jppoc) * zws3
-# else
-            tra(ji,jj,ikt,jpnum) = tra(ji,jj,ikt,jpnum) - trb(ji,jj,ikt,jpnum) * zws4 
-            tra(ji,jj,ikt,jppoc) = tra(ji,jj,ikt,jppoc) - trb(ji,jj,ikt,jppoc) * zws3
-            tra(ji,jj,ikt,jpsfe) = tra(ji,jj,ikt,jpsfe) - trb(ji,jj,ikt,jpsfe) * zws3
-            zwstpoc = trb(ji,jj,ikt,jppoc) * zws3 
-# endif
-
-#if ! defined key_sed
-            ! The 0.5 factor in zpdenit and zdenitt is to avoid negative NO3 concentration after both denitrification
-            ! in the sediments and just above the sediments. Not very clever, but simpliest option.
-            zpdenit  = MIN( 0.5 * ( trb(ji,jj,ikt,jpno3) - rtrn ) / rdenit, zdenit2d(ji,jj) * zwstpoc * zrivno3 )
-            z1pdenit = zwstpoc * zrivno3 - zpdenit
-            zolimit = MIN( ( trb(ji,jj,ikt,jpoxy) - rtrn ) / o2ut, z1pdenit * ( 1.- nitrfac(ji,jj,ikt) ) )
-            zdenitt = MIN(  0.5 * ( trb(ji,jj,ikt,jpno3) - rtrn ) / rdenit, z1pdenit * nitrfac(ji,jj,ikt) )
-            tra(ji,jj,ikt,jpdoc) = tra(ji,jj,ikt,jpdoc) + z1pdenit - zolimit - zdenitt
-            tra(ji,jj,ikt,jppo4) = tra(ji,jj,ikt,jppo4) + zpdenit + zolimit + zdenitt
-            tra(ji,jj,ikt,jpnh4) = tra(ji,jj,ikt,jpnh4) + zpdenit + zolimit + zdenitt
-            tra(ji,jj,ikt,jpno3) = tra(ji,jj,ikt,jpno3) - rdenit * (zpdenit + zdenitt)
-            tra(ji,jj,ikt,jpoxy) = tra(ji,jj,ikt,jpoxy) - zolimit * o2ut
-            tra(ji,jj,ikt,jptal) = tra(ji,jj,ikt,jptal) + rno3 * (zolimit + (1.+rdenit) * (zpdenit + zdenitt) )
-            tra(ji,jj,ikt,jpdic) = tra(ji,jj,ikt,jpdic) + zpdenit + zolimit + zdenitt
-            sdenit(ji,jj) = rdenit * zpdenit * e3t_n(ji,jj,ikt)
-#endif
          END DO
       END DO
+      !
+      IF( ln_ligand ) THEN
+         DO jj = 1, jpj
+            DO ji = 1, jpi
+               ikt     = mbkt(ji,jj)
+               zdep    = xstep / e3t_n(ji,jj,ikt) 
+               zwssfep = zwsfep(ji,jj) * zdep
+               tra(ji,jj,ikt,jpfep) = tra(ji,jj,ikt,jpfep) - trb(ji,jj,ikt,jpfep) * zwssfep
+            END DO
+         END DO
+      ENDIF
+      !
+      IF( ln_p5z ) THEN
+         DO jj = 1, jpj
+            DO ji = 1, jpi
+               ikt  = mbkt(ji,jj)
+               zdep = xstep / e3t_n(ji,jj,ikt) 
+               zws4 = zwsbio4(ji,jj) * zdep
+               zws3 = zwsbio3(ji,jj) * zdep
+               tra(ji,jj,ikt,jpgon) = tra(ji,jj,ikt,jpgon) - trb(ji,jj,ikt,jpgon) * zws4
+               tra(ji,jj,ikt,jppon) = tra(ji,jj,ikt,jppon) - trb(ji,jj,ikt,jppon) * zws3
+               tra(ji,jj,ikt,jpgop) = tra(ji,jj,ikt,jpgop) - trb(ji,jj,ikt,jpgop) * zws4
+               tra(ji,jj,ikt,jppop) = tra(ji,jj,ikt,jppop) - trb(ji,jj,ikt,jppop) * zws3
+            END DO
+         END DO
+      ENDIF
+
+      IF( .NOT.lk_sed ) THEN
+         ! The 0.5 factor in zpdenit and zdenitt is to avoid negative NO3 concentration after both denitrification
+         ! in the sediments and just above the sediments. Not very clever, but simpliest option.
+         DO jj = 1, jpj
+            DO ji = 1, jpi
+               ikt  = mbkt(ji,jj)
+               zdep = xstep / e3t_n(ji,jj,ikt) 
+               zws4 = zwsbio4(ji,jj) * zdep
+               zws3 = zwsbio3(ji,jj) * zdep
+               zrivno3 = 1. - zbureff(ji,jj)
+               zwstpoc = trb(ji,jj,ikt,jpgoc) * zws4 + trb(ji,jj,ikt,jppoc) * zws3
+               zpdenit  = MIN( 0.5 * ( trb(ji,jj,ikt,jpno3) - rtrn ) / rdenit, zdenit2d(ji,jj) * zwstpoc * zrivno3 )
+               z1pdenit = zwstpoc * zrivno3 - zpdenit
+               zolimit = MIN( ( trb(ji,jj,ikt,jpoxy) - rtrn ) / o2ut, z1pdenit * ( 1.- nitrfac(ji,jj,ikt) ) )
+               zdenitt = MIN(  0.5 * ( trb(ji,jj,ikt,jpno3) - rtrn ) / rdenit, z1pdenit * nitrfac(ji,jj,ikt) )
+               tra(ji,jj,ikt,jpdoc) = tra(ji,jj,ikt,jpdoc) + z1pdenit - zolimit - zdenitt
+               tra(ji,jj,ikt,jppo4) = tra(ji,jj,ikt,jppo4) + zpdenit + zolimit + zdenitt
+               tra(ji,jj,ikt,jpnh4) = tra(ji,jj,ikt,jpnh4) + zpdenit + zolimit + zdenitt
+               tra(ji,jj,ikt,jpno3) = tra(ji,jj,ikt,jpno3) - rdenit * (zpdenit + zdenitt)
+               tra(ji,jj,ikt,jpoxy) = tra(ji,jj,ikt,jpoxy) - zolimit * o2ut
+               tra(ji,jj,ikt,jptal) = tra(ji,jj,ikt,jptal) + rno3 * (zolimit + (1.+rdenit) * (zpdenit + zdenitt) )
+               tra(ji,jj,ikt,jpdic) = tra(ji,jj,ikt,jpdic) + zpdenit + zolimit + zdenitt
+               sdenit(ji,jj) = rdenit * zpdenit * e3t_n(ji,jj,ikt)
+               zsedc(ji,jj)   = (1. - zrivno3) * zwstpoc / zdep
+               IF( ln_p5z ) THEN
+                  zwstpop              = trb(ji,jj,ikt,jpgop) * zws4 + trb(ji,jj,ikt,jppop) * zws3
+                  zwstpon              = trb(ji,jj,ikt,jpgon) * zws4 + trb(ji,jj,ikt,jppon) * zws3
+                  tra(ji,jj,ikt,jpdon) = tra(ji,jj,ikt,jpdon) + (z1pdenit - zolimit - zdenitt) * zwstpon / (zwstpoc + rtrn)
+                  tra(ji,jj,ikt,jpdop) = tra(ji,jj,ikt,jpdop) + (z1pdenit - zolimit - zdenitt) * zwstpop / (zwstpoc + rtrn)
+               ENDIF
+            END DO
+         END DO
+       ENDIF
+
 
       ! Nitrogen fixation process
@@ -341,39 +403,92 @@
       !-----------------------------------
       DO jk = 1, jpkm1
-         DO jj = 1, jpj
-            DO ji = 1, jpi
-               !                      ! Potential nitrogen fixation dependant on temperature and iron
-               zlim = ( 1.- xnanono3(ji,jj,jk) - xnanonh4(ji,jj,jk) )
-               IF( zlim <= 0.2 )   zlim = 0.01
-#if defined key_degrad
-               zfact = zlim * rfact2 * facvol(ji,jj,jk)
-#else
-               zfact = zlim * rfact2
-#endif
-               ztrfer = biron(ji,jj,jk)       / ( concfediaz + biron(ji,jj,jk)       )
-               ztrpo4 = trb  (ji,jj,jk,jppo4) / ( concnnh4   + trb  (ji,jj,jk,jppo4) ) 
-               zlight =  ( 1.- EXP( -etot_ndcy(ji,jj,jk) / diazolight ) ) 
-               nitrpot(ji,jj,jk) =  MAX( 0.e0, ( 0.6 * tgfunc(ji,jj,jk) - 2.15 ) * r1_rday )   &
-                 &         *  zfact * MIN( ztrfer, ztrpo4 ) * zlight
-               zsoufer(ji,jj,jk) = zlight * 2E-11 / (2E-11 + biron(ji,jj,jk))
-            END DO
-         END DO
-      END DO
+         zlight (:,:,jk) =  ( 1.- EXP( -etot_ndcy(:,:,jk) / diazolight ) ) * ( 1. - fr_i(:,:) ) 
+         zsoufer(:,:,jk) = zlight(:,:,jk) * 2E-11 / ( 2E-11 + biron(:,:,jk) )
+      ENDDO
+      IF( ln_p4z ) THEN
+         DO jk = 1, jpkm1
+            DO jj = 1, jpj
+               DO ji = 1, jpi
+                  !                      ! Potential nitrogen fixation dependant on temperature and iron
+                  zlim = ( 1.- xnanono3(ji,jj,jk) - xnanonh4(ji,jj,jk) )
+                  IF( zlim <= 0.2 )   zlim = 0.01
+                  zfact = zlim * rfact2
+
+                  ztrfer  = biron(ji,jj,jk)       / ( concfediaz + biron(ji,jj,jk)       )
+                  ztrpo4s = trb  (ji,jj,jk,jppo4) / ( concnnh4   + trb  (ji,jj,jk,jppo4) ) 
+                  nitrpot(ji,jj,jk) =  MAX( 0.e0, ( 0.6 * tgfunc(ji,jj,jk) - 2.15 ) * r1_rday ) &
+                    &                *  zfact * MIN( ztrfer, ztrpo4s ) * zlight(ji,jj,jk)
+               END DO
+            END DO
+         END DO
+      ELSE       ! p5z
+         DO jk = 1, jpkm1
+            DO jj = 1, jpj
+               DO ji = 1, jpi
+                  !                      ! Potential nitrogen fixation dependant on temperature and iron
+                  ztemp = tsn(ji,jj,jk,jp_tem)
+                  zmudia = MAX( 0.,-0.001096*ztemp**2 + 0.057*ztemp -0.637 ) * 7.625
+                  !       Potential nitrogen fixation dependant on temperature and iron
+                  xdianh4 = trb(ji,jj,jk,jpnh4) / ( concnnh4 + trb(ji,jj,jk,jpnh4) )
+                  xdiano3 = trb(ji,jj,jk,jpno3) / ( concnno3 + trb(ji,jj,jk,jpno3) ) * (1. - xdianh4)
+                  zlim = ( 1.- xdiano3 - xdianh4 )
+                  IF( zlim <= 0.1 )   zlim = 0.01
+                  zfact = zlim * rfact2
+                  ztrfer = biron(ji,jj,jk) / ( concfediaz + biron(ji,jj,jk) )
+                  ztrpo4(ji,jj,jk) = trb(ji,jj,jk,jppo4) / ( 1E-6 + trb(ji,jj,jk,jppo4) )
+                  ztrdop(ji,jj,jk) = trb(ji,jj,jk,jpdop) / ( 1E-6 + trb(ji,jj,jk,jpdop) ) * (1. - ztrpo4(ji,jj,jk))
+                  ztrdp = ztrpo4(ji,jj,jk) + ztrdop(ji,jj,jk)
+                  nitrpot(ji,jj,jk) =  zmudia * r1_rday * zfact * MIN( ztrfer, ztrdp ) * zlight(ji,jj,jk)
+               END DO
+            END DO
+         END DO
+      ENDIF
 
       ! Nitrogen change due to nitrogen fixation
       ! ----------------------------------------
-      DO jk = 1, jpkm1
-         DO jj = 1, jpj
-            DO ji = 1, jpi
-               zfact = nitrpot(ji,jj,jk) * nitrfix
-               tra(ji,jj,jk,jpnh4) = tra(ji,jj,jk,jpnh4) +             zfact
-               tra(ji,jj,jk,jptal) = tra(ji,jj,jk,jptal) + rno3      * zfact
-               tra(ji,jj,jk,jpoxy) = tra(ji,jj,jk,jpoxy) + o2nit     * zfact 
-               tra(ji,jj,jk,jppo4) = tra(ji,jj,jk,jppo4) + concdnh4 / ( concdnh4 + trb(ji,jj,jk,jppo4) ) &
-               &                     * 0.002 * trb(ji,jj,jk,jpdoc) * xstep
-               tra(ji,jj,jk,jpfer) = tra(ji,jj,jk,jpfer) + 0.002 * 4E-10 * zsoufer(ji,jj,jk) * xstep
-           END DO
-         END DO 
-      END DO
+      IF( ln_p4z ) THEN
+         DO jk = 1, jpkm1
+            DO jj = 1, jpj
+               DO ji = 1, jpi
+                  zfact = nitrpot(ji,jj,jk) * nitrfix
+                  tra(ji,jj,jk,jpnh4) = tra(ji,jj,jk,jpnh4) +             zfact
+                  tra(ji,jj,jk,jptal) = tra(ji,jj,jk,jptal) + rno3      * zfact
+                  tra(ji,jj,jk,jpoxy) = tra(ji,jj,jk,jpoxy) + o2nit     * zfact 
+                  tra(ji,jj,jk,jppo4) = tra(ji,jj,jk,jppo4) + concdnh4 / ( concdnh4 + trb(ji,jj,jk,jppo4) ) &
+                  &                     * 0.002 * trb(ji,jj,jk,jpdoc) * xstep
+                  tra(ji,jj,jk,jpfer) = tra(ji,jj,jk,jpfer) + 0.002 * 4E-10 * zsoufer(ji,jj,jk) * xstep
+              END DO
+            END DO 
+         END DO
+      ELSE    ! p5z
+         DO jk = 1, jpkm1
+            DO jj = 1, jpj
+               DO ji = 1, jpi
+                  zfact = nitrpot(ji,jj,jk) * nitrfix
+                  tra(ji,jj,jk,jpnh4) = tra(ji,jj,jk,jpnh4) + zfact / 3.0
+                  tra(ji,jj,jk,jptal) = tra(ji,jj,jk,jptal) + rno3 * zfact / 3.0
+                  tra(ji,jj,jk,jppo4) = tra(ji,jj,jk,jppo4) - 16.0 / 46.0 * zfact * ( 1.0 - 1.0 / 3.0 ) &
+                  &                     * ztrpo4(ji,jj,jk) / (ztrpo4(ji,jj,jk) + ztrdop(ji,jj,jk) + rtrn)
+                  tra(ji,jj,jk,jpdon) = tra(ji,jj,jk,jpdon) + zfact * 1.0 / 3.0
+                  tra(ji,jj,jk,jpdoc) = tra(ji,jj,jk,jpdoc) + zfact * 1.0 / 3.0
+                  tra(ji,jj,jk,jpdop) = tra(ji,jj,jk,jpdop) + 16.0 / 46.0 * zfact / 3.0  &
+                  &                     - 16.0 / 46.0 * zfact * ztrdop(ji,jj,jk)   &
+                  &                     / (ztrpo4(ji,jj,jk) + ztrdop(ji,jj,jk) + rtrn)
+                  tra(ji,jj,jk,jppoc) = tra(ji,jj,jk,jppoc) + zfact * 1.0 / 3.0 * 2.0 / 3.0
+                  tra(ji,jj,jk,jppon) = tra(ji,jj,jk,jppon) + zfact * 1.0 / 3.0 * 2.0 /3.0
+                  tra(ji,jj,jk,jppop) = tra(ji,jj,jk,jppop) + 16.0 / 46.0 * zfact * 1.0 / 3.0 * 2.0 /3.0
+                  tra(ji,jj,jk,jpgoc) = tra(ji,jj,jk,jpgoc) + zfact * 1.0 / 3.0 * 1.0 / 3.0
+                  tra(ji,jj,jk,jpgon) = tra(ji,jj,jk,jpgon) + zfact * 1.0 / 3.0 * 1.0 /3.0
+                  tra(ji,jj,jk,jpgop) = tra(ji,jj,jk,jpgop) + 16.0 / 46.0 * zfact * 1.0 / 3.0 * 1.0 /3.0
+                  tra(ji,jj,jk,jpoxy) = tra(ji,jj,jk,jpoxy) + ( o2ut + o2nit ) * zfact * 2.0 / 3.0 + o2nit * zfact / 3.0
+                  tra(ji,jj,jk,jpfer) = tra(ji,jj,jk,jpfer) - 30E-6 * zfact * 1.0 / 3.0 
+                  tra(ji,jj,jk,jpsfe) = tra(ji,jj,jk,jpsfe) + 30E-6 * zfact * 1.0 / 3.0 * 2.0 / 3.0
+                  tra(ji,jj,jk,jpbfe) = tra(ji,jj,jk,jpbfe) + 30E-6 * zfact * 1.0 / 3.0 * 1.0 / 3.0
+                  tra(ji,jj,jk,jpfer) = tra(ji,jj,jk,jpfer) + 0.002 * 4E-10 * zsoufer(ji,jj,jk) * rfact2 / rday
+              END DO
+            END DO 
+         END DO
+         !
+      ENDIF
 
       IF( lk_iomput ) THEN
@@ -388,8 +503,9 @@
                CALL iom_put( "INTNFIX" , zwork1 ) 
             ENDIF
+            IF( iom_use("SedCal" ) ) CALL iom_put( "SedCal", zsedcal(:,:) * 1.e+3 )
+            IF( iom_use("SedSi" ) )  CALL iom_put( "SedSi",  zsedsi (:,:) * 1.e+3 )
+            IF( iom_use("SedC" ) )   CALL iom_put( "SedC",   zsedc  (:,:) * 1.e+3 )
+            IF( iom_use("Sdenit" ) ) CALL iom_put( "Sdenit", sdenit (:,:) * 1.e+3 * rno3 )
          ENDIF
-      ELSE
-         IF( ln_diatrc )  &
-            &  trc2d(:,:,jp_pcs0_2d + 12) = nitrpot(:,:,1) * nitrfix * rno3 * 1.e+3 * rfact2r * e3t_n(:,:,1) * tmask(:,:,1)
       ENDIF
       !
@@ -400,11 +516,12 @@
       ENDIF
       !
-      CALL wrk_dealloc( jpi, jpj, zdenit2d, zwork1, zwork2, zwork3, zbureff )
-      CALL wrk_dealloc( jpi, jpj, zwsbio3, zwsbio4, zwscal )
-      CALL wrk_dealloc( jpi, jpj, jpk, zsoufer )
+                      CALL wrk_dealloc( jpi, jpj, zdenit2d, zwork1, zwork2, zwork3, zbureff )
+                      CALL wrk_dealloc( jpi, jpj, zwsbio3, zwsbio4, zwscal )
+                      CALL wrk_dealloc( jpi, jpj, zsedcal,  zsedsi, zsedc )
+                      CALL wrk_dealloc( jpi, jpj, jpk, zlight, zsoufer )
+      IF( ln_p5z )    CALL wrk_dealloc( jpi, jpj, jpk, ztrpo4, ztrdop )
+      IF( ln_ligand ) CALL wrk_dealloc( jpi, jpj, zwsfep )
       !
       IF( nn_timing == 1 )  CALL timing_stop('p4z_sed')
-      !
- 9100  FORMAT(i8,3f10.5)
       !
    END SUBROUTINE p4z_sed
@@ -422,13 +539,4 @@
 
 
-#else
-   !!======================================================================
-   !!  Dummy module :                                   No PISCES bio-model
-   !!======================================================================
-CONTAINS
-   SUBROUTINE p4z_sed                         ! Empty routine
-   END SUBROUTINE p4z_sed
-#endif 
-
    !!======================================================================
 END MODULE p4zsed
Index: branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/NEMO/TOP_SRC/PISCES/P4Z/p4zsink.F90
===================================================================
--- branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/NEMO/TOP_SRC/PISCES/P4Z/p4zsink.F90	(revision 7383)
+++ branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/NEMO/TOP_SRC/PISCES/P4Z/p4zsink.F90	(revision 7391)
@@ -9,6 +9,4 @@
    !!             3.5  !  2012-07  (O. Aumont) Introduce potential time-splitting
    !!----------------------------------------------------------------------
-#if defined key_pisces
-   !!----------------------------------------------------------------------
    !!   p4z_sink       :  Compute vertical flux of particulate matter due to gravitational sinking
    !!   p4z_sink_init  :  Unitialisation of sinking speed parameters
@@ -29,39 +27,14 @@
    PUBLIC   p4z_sink_alloc
 
-   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::   wsbio3   !: POC sinking speed 
-   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::   wsbio4   !: GOC sinking speed
-   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::   wscal    !: Calcite and BSi sinking speeds
-
    REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::   sinking, sinking2  !: POC sinking fluxes 
    !                                                          !  (different meanings depending on the parameterization)
+   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::   sinkingn, sinking2n  !: POC sinking fluxes 
+   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::   sinkingp, sinking2p  !: POC sinking fluxes 
    REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::   sinkcal, sinksil   !: CaCO3 and BSi sinking fluxes
    REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::   sinkfer            !: Small BFe sinking fluxes
-#if ! defined key_kriest
    REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::   sinkfer2           !: Big iron sinking fluxes
-#endif
+   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::   sinkfep      !: Fep sinking fluxes
 
    INTEGER  :: ik100
-
-#if  defined key_kriest
-   REAL(wp) ::  xkr_sfact    !: Sinking factor
-   REAL(wp) ::  xkr_stick    !: Stickiness
-   REAL(wp) ::  xkr_nnano    !: Nbr of cell in nano size class
-   REAL(wp) ::  xkr_ndiat    !: Nbr of cell in diatoms size class
-   REAL(wp) ::  xkr_nmicro   !: Nbr of cell in microzoo size class
-   REAL(wp) ::  xkr_nmeso    !: Nbr of cell in mesozoo  size class
-   REAL(wp) ::  xkr_naggr    !: Nbr of cell in aggregates  size class
-
-   REAL(wp) ::  xkr_frac 
-
-   REAL(wp), PUBLIC ::  xkr_dnano       !: Size of particles in nano pool
-   REAL(wp), PUBLIC ::  xkr_ddiat       !: Size of particles in diatoms pool
-   REAL(wp), PUBLIC ::  xkr_dmicro      !: Size of particles in microzoo pool
-   REAL(wp), PUBLIC ::  xkr_dmeso       !: Size of particles in mesozoo pool
-   REAL(wp), PUBLIC ::  xkr_daggr       !: Size of particles in aggregates pool
-   REAL(wp), PUBLIC ::  xkr_wsbio_min   !: min vertical particle speed
-   REAL(wp), PUBLIC ::  xkr_wsbio_max   !: max vertical particle speed
-
-   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:) ::   xnumm   !:  maximum number of particles in aggregates
-#endif
 
    !!----------------------------------------------------------------------
@@ -72,5 +45,4 @@
 CONTAINS
 
-#if ! defined key_kriest
    !!----------------------------------------------------------------------
    !!   'standard sinking parameterisation'                  ???
@@ -91,5 +63,5 @@
       REAL(wp) ::   zagg1, zagg2, zagg3, zagg4
       REAL(wp) ::   zagg , zaggfe, zaggdoc, zaggdoc2, zaggdoc3
-      REAL(wp) ::   zfact, zwsmax, zmax, zstep
+      REAL(wp) ::   zfact, zwsmax, zmax
       CHARACTER (len=25) :: charout
       REAL(wp), POINTER, DIMENSION(:,:,:) :: zw3d
@@ -98,4 +70,13 @@
       !
       IF( nn_timing == 1 )  CALL timing_start('p4z_sink')
+
+
+      ! Initialization of some global variables
+      ! ---------------------------------------
+      prodpoc(:,:,:) = 0.
+      conspoc(:,:,:) = 0.
+      prodgoc(:,:,:) = 0.
+      consgoc(:,:,:) = 0.
+
       !
       !    Sinking speeds of detritus is increased with depth as shown
@@ -105,7 +86,7 @@
          DO jj = 1, jpj
             DO ji = 1,jpi
-               zmax  = MAX( heup(ji,jj), hmld(ji,jj) )
-               zfact = MAX( 0., gdepw_n(ji,jj,jk+1) - zmax ) / 5000._wp
-               wsbio4(ji,jj,jk) = wsbio2 + ( 200.- wsbio2 ) * zfact
+               zmax  = MAX( heup_01(ji,jj), hmld(ji,jj) )
+               zfact = MAX( 0., gdepw_n(ji,jj,jk+1) - zmax ) / wsbio2scale
+               wsbio4(ji,jj,jk) = wsbio2 + MAX(0., ( wsbio2max - wsbio2 )) * zfact
             END DO
          END DO
@@ -114,5 +95,5 @@
       ! limit the values of the sinking speeds to avoid numerical instabilities  
       wsbio3(:,:,:) = wsbio
-      wscal (:,:,:) = wsbio4(:,:,:)
+
       !
       ! OA This is (I hope) a temporary solution for the problem that may 
@@ -155,10 +136,12 @@
                IF( tmask(ji,jj,jk) == 1 ) THEN
                  zwsmax = 0.5 * e3t_n(ji,jj,jk) / xstep
-                 wsbio3(ji,jj,jk) = MIN( wsbio3(ji,jj,jk), zwsmax * FLOAT( iiter1 ) )
-                 wsbio4(ji,jj,jk) = MIN( wsbio4(ji,jj,jk), zwsmax * FLOAT( iiter2 ) )
+                 wsbio3(ji,jj,jk) = MIN( wsbio3(ji,jj,jk), zwsmax * REAL( iiter1, wp ) )
+                 wsbio4(ji,jj,jk) = MIN( wsbio4(ji,jj,jk), zwsmax * REAL( iiter2, wp ) )
                ENDIF
             END DO
          END DO
       END DO
+
+      wscal (:,:,:) = wsbio4(:,:,:)
 
       !  Initializa to zero all the sinking arrays 
@@ -185,52 +168,41 @@
       END DO
 
-      !  Exchange between organic matter compartments due to coagulation/disaggregation
-      !  ---------------------------------------------------
-      DO jk = 1, jpkm1
-         DO jj = 1, jpj
-            DO ji = 1, jpi
-               !
-               zstep = xstep 
-# if defined key_degrad
-               zstep = zstep * facvol(ji,jj,jk)
-# endif
-               zfact = zstep * xdiss(ji,jj,jk)
-               !  Part I : Coagulation dependent on turbulence
-               zagg1 = 25.9  * zfact * trb(ji,jj,jk,jppoc) * trb(ji,jj,jk,jppoc)
-               zagg2 = 4452. * zfact * trb(ji,jj,jk,jppoc) * trb(ji,jj,jk,jpgoc)
-
-               ! Part II : Differential settling
-
-               !  Aggregation of small into large particles
-               zagg3 =  47.1 * zstep * trb(ji,jj,jk,jppoc) * trb(ji,jj,jk,jpgoc)
-               zagg4 =  3.3  * zstep * trb(ji,jj,jk,jppoc) * trb(ji,jj,jk,jppoc)
-
-               zagg   = zagg1 + zagg2 + zagg3 + zagg4
-               zaggfe = zagg * trb(ji,jj,jk,jpsfe) / ( trb(ji,jj,jk,jppoc) + rtrn )
-
-               ! Aggregation of DOC to POC : 
-               ! 1st term is shear aggregation of DOC-DOC
-               ! 2nd term is shear aggregation of DOC-POC
-               ! 3rd term is differential settling of DOC-POC
-               zaggdoc  = ( ( 0.369 * 0.3 * trb(ji,jj,jk,jpdoc) + 102.4 * trb(ji,jj,jk,jppoc) ) * zfact       &
-               &            + 2.4 * zstep * trb(ji,jj,jk,jppoc) ) * 0.3 * trb(ji,jj,jk,jpdoc)
-               ! transfer of DOC to GOC : 
-               ! 1st term is shear aggregation
-               ! 2nd term is differential settling 
-               zaggdoc2 = ( 3.53E3 * zfact + 0.1 * zstep ) * trb(ji,jj,jk,jpgoc) * 0.3 * trb(ji,jj,jk,jpdoc)
-               ! tranfer of DOC to POC due to brownian motion
-               zaggdoc3 =  ( 5095. * trb(ji,jj,jk,jppoc) + 114. * 0.3 * trb(ji,jj,jk,jpdoc) ) *zstep * 0.3 * trb(ji,jj,jk,jpdoc)
-
-               !  Update the trends
-               tra(ji,jj,jk,jppoc) = tra(ji,jj,jk,jppoc) - zagg + zaggdoc + zaggdoc3
-               tra(ji,jj,jk,jpgoc) = tra(ji,jj,jk,jpgoc) + zagg + zaggdoc2
-               tra(ji,jj,jk,jpsfe) = tra(ji,jj,jk,jpsfe) - zaggfe
-               tra(ji,jj,jk,jpbfe) = tra(ji,jj,jk,jpbfe) + zaggfe
-               tra(ji,jj,jk,jpdoc) = tra(ji,jj,jk,jpdoc) - zaggdoc - zaggdoc2 - zaggdoc3
-               !
-            END DO
-         END DO
-      END DO
-
+      IF( ln_p5z ) THEN
+         sinkingn (:,:,:) = 0.e0
+         sinking2n(:,:,:) = 0.e0
+         sinkingp (:,:,:) = 0.e0
+         sinking2p(:,:,:) = 0.e0
+
+         !   Compute the sedimentation term using p4zsink2 for all the sinking particles
+         !   -----------------------------------------------------
+         DO jit = 1, iiter1
+           CALL p4z_sink2( wsbio3, sinkingn , jppon, iiter1 )
+           CALL p4z_sink2( wsbio3, sinkingp , jppop, iiter1 )
+         END DO
+
+         DO jit = 1, iiter2
+           CALL p4z_sink2( wsbio4, sinking2n, jpgon, iiter2 )
+           CALL p4z_sink2( wsbio4, sinking2p, jpgop, iiter2 )
+         END DO
+      ENDIF
+
+      IF( ln_ligand ) THEN
+         wsfep (:,:,:) = wfep
+         DO jk = 1,jpkm1
+            DO jj = 1, jpj
+               DO ji = 1, jpi
+                  IF( tmask(ji,jj,jk) == 1 ) THEN
+                    zwsmax = 0.5 * e3t_n(ji,jj,jk) / xstep
+                    wsfep(ji,jj,jk) = MIN( wsfep(ji,jj,jk), zwsmax * REAL( iiter1, wp ) )
+                  ENDIF
+               END DO
+            END DO
+         END DO
+         !
+         sinkfep(:,:,:) = 0.e0
+         DO jit = 1, iiter1
+           CALL p4z_sink2( wsfep, sinkfep , jpfep, iiter1 )
+         END DO
+      ENDIF
 
      ! Total carbon export per year
@@ -281,14 +253,4 @@
           CALL wrk_dealloc( jpi, jpj, jpk, zw3d )
         ENDIF
-      ELSE
-         IF( ln_diatrc ) THEN
-            zfact = 1.e3 * rfact2r
-            trc2d(:,:,jp_pcs0_2d + 4) = sinking (:,:,ik100) * zfact * tmask(:,:,1)
-            trc2d(:,:,jp_pcs0_2d + 5) = sinking2(:,:,ik100) * zfact * tmask(:,:,1)
-            trc2d(:,:,jp_pcs0_2d + 6) = sinkfer (:,:,ik100) * zfact * tmask(:,:,1)
-            trc2d(:,:,jp_pcs0_2d + 7) = sinkfer2(:,:,ik100) * zfact * tmask(:,:,1)
-            trc2d(:,:,jp_pcs0_2d + 8) = sinksil (:,:,ik100) * zfact * tmask(:,:,1)
-            trc2d(:,:,jp_pcs0_2d + 9) = sinkcal (:,:,ik100) * zfact * tmask(:,:,1)
-         ENDIF
       ENDIF
       !
@@ -320,450 +282,4 @@
       !
    END SUBROUTINE p4z_sink_init
-
-#else
-   !!----------------------------------------------------------------------
-   !!   'Kriest sinking parameterisation'        key_kriest          ???
-   !!----------------------------------------------------------------------
-
-   SUBROUTINE p4z_sink ( kt, knt )
-      !!---------------------------------------------------------------------
-      !!                ***  ROUTINE p4z_sink  ***
-      !!
-      !! ** Purpose :   Compute vertical flux of particulate matter due to
-      !!              gravitational sinking - Kriest parameterization
-      !!
-      !! ** Method  : - ???
-      !!---------------------------------------------------------------------
-      !
-      INTEGER, INTENT(in) :: kt, knt
-      !
-      INTEGER  :: ji, jj, jk, jit, niter1, niter2
-      REAL(wp) :: zagg1, zagg2, zagg3, zagg4, zagg5, zfract, zaggsi, zaggsh
-      REAL(wp) :: zagg , zaggdoc, zaggdoc1, znumdoc
-      REAL(wp) :: znum , zeps, zfm, zgm, zsm
-      REAL(wp) :: zdiv , zdiv1, zdiv2, zdiv3, zdiv4, zdiv5
-      REAL(wp) :: zval1, zval2, zval3, zval4
-      REAL(wp) :: zfact
-      INTEGER  :: ik1
-      CHARACTER (len=25) :: charout
-      REAL(wp), POINTER, DIMENSION(:,:,:) :: znum3d 
-      REAL(wp), POINTER, DIMENSION(:,:,:) :: zw3d
-      REAL(wp), POINTER, DIMENSION(:,:  ) :: zw2d
-      !!---------------------------------------------------------------------
-      !
-      IF( nn_timing == 1 )  CALL timing_start('p4z_sink')
-      !
-      CALL wrk_alloc( jpi, jpj, jpk, znum3d )
-      !
-      !     Initialisation of variables used to compute Sinking Speed
-      !     ---------------------------------------------------------
-
-      znum3d(:,:,:) = 0.e0
-      zval1 = 1. + xkr_zeta
-      zval2 = 1. + xkr_zeta + xkr_eta
-      zval3 = 1. + xkr_eta
-
-      !     Computation of the vertical sinking speed : Kriest et Evans, 2000
-      !     -----------------------------------------------------------------
-
-      DO jk = 1, jpkm1
-         DO jj = 1, jpj
-            DO ji = 1, jpi
-               IF( tmask(ji,jj,jk) /= 0.e0 ) THEN
-                  znum = trb(ji,jj,jk,jppoc) / ( trb(ji,jj,jk,jpnum) + rtrn ) / xkr_massp
-                  ! -------------- To avoid sinking speed over 50 m/day -------
-                  znum  = MIN( xnumm(jk), znum )
-                  znum  = MAX( 1.1      , znum )
-                  znum3d(ji,jj,jk) = znum
-                  !------------------------------------------------------------
-                  zeps  = ( zval1 * znum - 1. )/ ( znum - 1. )
-                  zfm   = xkr_frac**( 1. - zeps )
-                  zgm   = xkr_frac**( zval1 - zeps )
-                  zdiv  = MAX( 1.e-4, ABS( zeps - zval2 ) ) * SIGN( 1., ( zeps - zval2 ) )
-                  zdiv1 = zeps - zval3
-                  wsbio3(ji,jj,jk) = xkr_wsbio_min * ( zeps - zval1 ) / zdiv    &
-                     &             - xkr_wsbio_max *   zgm * xkr_eta  / zdiv
-                  wsbio4(ji,jj,jk) = xkr_wsbio_min *   ( zeps-1. )    / zdiv1   &
-                     &             - xkr_wsbio_max *   zfm * xkr_eta  / zdiv1
-                  IF( znum == 1.1)   wsbio3(ji,jj,jk) = wsbio4(ji,jj,jk)
-               ENDIF
-            END DO
-         END DO
-      END DO
-
-      wscal(:,:,:) = MAX( wsbio3(:,:,:), 30._wp )
-
-      !   INITIALIZE TO ZERO ALL THE SINKING ARRAYS
-      !   -----------------------------------------
-
-      sinking (:,:,:) = 0.e0
-      sinking2(:,:,:) = 0.e0
-      sinkcal (:,:,:) = 0.e0
-      sinkfer (:,:,:) = 0.e0
-      sinksil (:,:,:) = 0.e0
-
-     !   Compute the sedimentation term using p4zsink2 for all the sinking particles
-     !   -----------------------------------------------------
-
-      niter1 = niter1max
-      niter2 = niter2max
-
-      DO jit = 1, niter1
-        CALL p4z_sink2( wsbio3, sinking , jppoc, niter1 )
-        CALL p4z_sink2( wsbio3, sinkfer , jpsfe, niter1 )
-        CALL p4z_sink2( wscal , sinksil , jpgsi, niter1 )
-        CALL p4z_sink2( wscal , sinkcal , jpcal, niter1 )
-      END DO
-
-      DO jit = 1, niter2
-        CALL p4z_sink2( wsbio4, sinking2, jpnum, niter2 )
-      END DO
-
-     !  Exchange between organic matter compartments due to coagulation/disaggregation
-     !  ---------------------------------------------------
-
-      zval1 = 1. + xkr_zeta
-      zval2 = 1. + xkr_eta
-      zval3 = 3. + xkr_eta
-      zval4 = 4. + xkr_eta
-
-      DO jk = 1,jpkm1
-         DO jj = 1,jpj
-            DO ji = 1,jpi
-               IF( tmask(ji,jj,jk) /= 0.e0 ) THEN
-
-                  znum = trb(ji,jj,jk,jppoc)/(trb(ji,jj,jk,jpnum)+rtrn) / xkr_massp
-                  !-------------- To avoid sinking speed over 50 m/day -------
-                  znum  = min(xnumm(jk),znum)
-                  znum  = MAX( 1.1,znum)
-                  !------------------------------------------------------------
-                  zeps  = ( zval1 * znum - 1.) / ( znum - 1.)
-                  zdiv  = MAX( 1.e-4, ABS( zeps - zval3) ) * SIGN( 1., zeps - zval3 )
-                  zdiv1 = MAX( 1.e-4, ABS( zeps - 4.   ) ) * SIGN( 1., zeps - 4.    )
-                  zdiv2 = zeps - 2.
-                  zdiv3 = zeps - 3.
-                  zdiv4 = zeps - zval2
-                  zdiv5 = 2.* zeps - zval4
-                  zfm   = xkr_frac**( 1.- zeps )
-                  zsm   = xkr_frac**xkr_eta
-
-                  !    Part I : Coagulation dependant on turbulence
-                  !    ----------------------------------------------
-
-                  zagg1 =  0.163 * trb(ji,jj,jk,jpnum)**2               &
-                     &            * 2.*( (zfm-1.)*(zfm*xkr_mass_max**3-xkr_mass_min**3)    &
-                     &            * (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)) 
-                  zagg2 =  2*0.163*trb(ji,jj,jk,jpnum)**2*zfm*                       &
-                     &                   ((xkr_mass_max**3+3.*(xkr_mass_max**2          &
-                     &                    *xkr_mass_min*(zeps-1.)/zdiv2                 &
-                     &                    +xkr_mass_max*xkr_mass_min**2*(zeps-1.)/zdiv3)    &
-                     &                    +xkr_mass_min**3*(zeps-1)/zdiv1)                  &
-                     &                    -zfm*xkr_mass_max**3*(1.+3.*((zeps-1.)/           &
-                     &                    (zeps-2.)+(zeps-1.)/zdiv3)+(zeps-1.)/zdiv1))    
-
-                  zagg3 =  0.163*trb(ji,jj,jk,jpnum)**2*zfm**2*8. * xkr_mass_max**3  
-                  
-                 !    Aggregation of small into large particles
-                 !    Part II : Differential settling
-                 !    ----------------------------------------------
-
-                  zagg4 =  2.*3.141*0.125*trb(ji,jj,jk,jpnum)**2*                       &
-                     &                 xkr_wsbio_min*(zeps-1.)**2                         &
-                     &                 *(xkr_mass_min**2*((1.-zsm*zfm)/(zdiv3*zdiv4)      &
-                     &                 -(1.-zfm)/(zdiv*(zeps-1.)))-                       &
-                     &                 ((zfm*zfm*xkr_mass_max**2*zsm-xkr_mass_min**2)     &
-                     &                 *xkr_eta)/(zdiv*zdiv3*zdiv5) )   
-
-                  zagg5 =   2.*3.141*0.125*trb(ji,jj,jk,jpnum)**2                         &
-                     &                 *(zeps-1.)*zfm*xkr_wsbio_min                        &
-                     &                 *(zsm*(xkr_mass_min**2-zfm*xkr_mass_max**2)         &
-                     &                 /zdiv3-(xkr_mass_min**2-zfm*zsm*xkr_mass_max**2)    &
-                     &                 /zdiv)  
-
-                  !
-                  !     Fractionnation by swimming organisms
-                  !     ------------------------------------
-
-                  zfract = 2.*3.141*0.125*trb(ji,jj,jk,jpmes)*12./0.12/0.06**3*trb(ji,jj,jk,jpnum)  &
-                    &      * (0.01/xkr_mass_min)**(1.-zeps)*0.1**2  &
-                    &      * 10000.*xstep
-
-                  !     Aggregation of DOC to small particles
-                  !     --------------------------------------
-
-                  zaggdoc = 0.83 * trb(ji,jj,jk,jpdoc) * xstep * xdiss(ji,jj,jk) * trb(ji,jj,jk,jpdoc)   &
-                     &        + 0.005 * 231. * trb(ji,jj,jk,jpdoc) * xstep * trb(ji,jj,jk,jpdoc)
-                  zaggdoc1 = 271. * trb(ji,jj,jk,jppoc) * xstep * xdiss(ji,jj,jk) * trb(ji,jj,jk,jpdoc)  &
-                     &  + 0.02 * 16706. * trb(ji,jj,jk,jppoc) * xstep * trb(ji,jj,jk,jpdoc)
-
-# if defined key_degrad
-                   zagg1   = zagg1   * facvol(ji,jj,jk)                 
-                   zagg2   = zagg2   * facvol(ji,jj,jk)                 
-                   zagg3   = zagg3   * facvol(ji,jj,jk)                 
-                   zagg4   = zagg4   * facvol(ji,jj,jk)                 
-                   zagg5   = zagg5   * facvol(ji,jj,jk)                 
-                   zaggdoc = zaggdoc * facvol(ji,jj,jk)                 
-                   zaggdoc1 = zaggdoc1 * facvol(ji,jj,jk)
-# endif
-                  zaggsh = ( zagg1 + zagg2 + zagg3 ) * rfact2 * xdiss(ji,jj,jk) / 1000.
-                  zaggsi = ( zagg4 + zagg5 ) * xstep / 10.
-                  zagg = 0.5 * xkr_stick * ( zaggsh + zaggsi )
-                  !
-                  znumdoc = trb(ji,jj,jk,jpnum) / ( trb(ji,jj,jk,jppoc) + rtrn )
-                  tra(ji,jj,jk,jppoc) = tra(ji,jj,jk,jppoc) + zaggdoc + zaggdoc1
-                  tra(ji,jj,jk,jpnum) = tra(ji,jj,jk,jpnum) + zfract + zaggdoc / xkr_massp - zagg
-                  tra(ji,jj,jk,jpdoc) = tra(ji,jj,jk,jpdoc) - zaggdoc - zaggdoc1
-
-               ENDIF
-            END DO
-         END DO
-      END DO
-
-     ! Total primary production per year
-     t_oce_co2_exp = t_oce_co2_exp + glob_sum( ( sinking(:,:,ik100) * e1e2t(:,:) * tmask(:,:,1) )
-     !
-     IF( lk_iomput ) THEN
-        IF( knt == nrdttrc ) THEN
-          CALL wrk_alloc( jpi, jpj,      zw2d )
-          CALL wrk_alloc( jpi, jpj, jpk, zw3d )
-          zfact = 1.e+3 * rfact2r  !  conversion from mol/l/kt to  mol/m3/s
-          !
-          IF( iom_use( "EPC100" ) )  THEN
-              zw2d(:,:) = sinking(:,:,ik100) * zfact * tmask(:,:,1) ! Export of carbon at 100m
-              CALL iom_put( "EPC100"  , zw2d )
-          ENDIF
-          IF( iom_use( "EPN100" ) )  THEN
-              zw2d(:,:) = sinking2(:,:,ik100) * zfact * tmask(:,:,1) ! Export of number of aggregates ?
-              CALL iom_put( "EPN100"  , zw2d )
-          ENDIF
-          IF( iom_use( "EPCAL100" ) )  THEN
-              zw2d(:,:) = sinkcal(:,:,ik100) * zfact * tmask(:,:,1) ! Export of calcite at 100m
-              CALL iom_put( "EPCAL100"  , zw2d )
-          ENDIF
-          IF( iom_use( "EPSI100" ) )  THEN
-              zw2d(:,:) = sinksil(:,:,ik100) * zfact * tmask(:,:,1) ! Export of bigenic silica at 100m
-              CALL iom_put( "EPSI100"  , zw2d )
-          ENDIF
-          IF( iom_use( "EXPC" ) )  THEN
-              zw3d(:,:,:) = sinking(:,:,:) * zfact * tmask(:,:,:) ! Export of carbon in the water column
-              CALL iom_put( "EXPC"  , zw3d )
-          ENDIF
-          IF( iom_use( "EXPN" ) )  THEN
-              zw3d(:,:,:) = sinking(:,:,:) * zfact * tmask(:,:,:) ! Export of carbon in the water column
-              CALL iom_put( "EXPN"  , zw3d )
-          ENDIF
-          IF( iom_use( "EXPCAL" ) )  THEN
-              zw3d(:,:,:) = sinkcal(:,:,:) * zfact * tmask(:,:,:) ! Export of calcite 
-              CALL iom_put( "EXPCAL"  , zw3d )
-          ENDIF
-          IF( iom_use( "EXPSI" ) )  THEN
-              zw3d(:,:,:) = sinksil(:,:,:) * zfact * tmask(:,:,:) ! Export of bigenic silica
-              CALL iom_put( "EXPSI"  , zw3d )
-          ENDIF
-          IF( iom_use( "XNUM" ) )  THEN
-              zw3d(:,:,:) =  znum3d(:,:,:) * tmask(:,:,:) !  Number of particles on aggregats
-              CALL iom_put( "XNUM"  , zw3d )
-          ENDIF
-          IF( iom_use( "WSC" ) )  THEN
-              zw3d(:,:,:) = wsbio3(:,:,:) * tmask(:,:,:) ! Sinking speed of carbon particles
-              CALL iom_put( "WSC"  , zw3d )
-          ENDIF
-          IF( iom_use( "WSN" ) )  THEN
-              zw3d(:,:,:) = wsbio4(:,:,:) * tmask(:,:,:) ! Sinking speed of particles number
-              CALL iom_put( "WSN"  , zw3d )
-          ENDIF
-          !
-          CALL wrk_dealloc( jpi, jpj,      zw2d )
-          CALL wrk_dealloc( jpi, jpj, jpk, zw3d )
-      ELSE
-         IF( ln_diatrc ) THEN
-            zfact = 1.e3 * rfact2r
-            trc2d(:,:  ,jp_pcs0_2d + 4)  = sinking (:,:,ik100)  * zfact * tmask(:,:,1)
-            trc2d(:,:  ,jp_pcs0_2d + 5)  = sinking2(:,:,ik100)  * zfact * tmask(:,:,1)
-            trc2d(:,:  ,jp_pcs0_2d + 6)  = sinkfer (:,:,ik100)  * zfact * tmask(:,:,1)
-            trc2d(:,:  ,jp_pcs0_2d + 7)  = sinksil (:,:,ik100)  * zfact * tmask(:,:,1)
-            trc2d(:,:  ,jp_pcs0_2d + 8)  = sinkcal (:,:,ik100)  * zfact * tmask(:,:,1)
-            trc3d(:,:,:,jp_pcs0_3d + 11) = sinking (:,:,:)      * zfact * tmask(:,:,:)
-            trc3d(:,:,:,jp_pcs0_3d + 12) = sinking2(:,:,:)      * zfact * tmask(:,:,:)
-            trc3d(:,:,:,jp_pcs0_3d + 13) = sinksil (:,:,:)      * zfact * tmask(:,:,:)
-            trc3d(:,:,:,jp_pcs0_3d + 14) = sinkcal (:,:,:)      * zfact * 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)
-         WRITE(charout, FMT="('sink')")
-         CALL prt_ctl_trc_info(charout)
-         CALL prt_ctl_trc(tab4d=tra, mask=tmask, clinfo=ctrcnm)
-      ENDIF
-      !
-      CALL wrk_dealloc( jpi, jpj, jpk, znum3d )
-      !
-      IF( nn_timing == 1 )  CALL timing_stop('p4z_sink')
-      !
-   END SUBROUTINE p4z_sink
-
-
-   SUBROUTINE p4z_sink_init
-      !!----------------------------------------------------------------------
-      !!                  ***  ROUTINE p4z_sink_init  ***
-      !!
-      !! ** Purpose :   Initialization of sinking parameters
-      !!                Kriest parameterization only
-      !!
-      !! ** Method  :   Read the nampiskrs namelist and check the parameters
-      !!      called at the first timestep 
-      !!
-      !! ** input   :   Namelist nampiskrs
-      !!----------------------------------------------------------------------
-      INTEGER  ::   jk, jn, kiter
-      INTEGER  ::   ios                 ! Local integer output status for namelist read
-      REAL(wp) ::   znum, zdiv
-      REAL(wp) ::   zws, zwr, zwl,wmax, znummax
-      REAL(wp) ::   zmin, zmax, zl, zr, xacc
-      !
-      NAMELIST/nampiskrs/ xkr_sfact, xkr_stick ,  &
-         &                xkr_nnano, xkr_ndiat, xkr_nmicro, xkr_nmeso, xkr_naggr
-      !!----------------------------------------------------------------------
-      !
-      IF( nn_timing == 1 )  CALL timing_start('p4z_sink_init')
-      !
-
-      REWIND( numnatp_ref )              ! Namelist nampiskrs in reference namelist : Pisces sinking Kriest
-      READ  ( numnatp_ref, nampiskrs, IOSTAT = ios, ERR = 901)
-901   IF( ios /= 0 ) CALL ctl_nam ( ios , 'nampiskrs in reference namelist', lwp )
-
-      REWIND( numnatp_cfg )              ! Namelist nampiskrs in configuration namelist : Pisces sinking Kriest
-      READ  ( numnatp_cfg, nampiskrs, IOSTAT = ios, ERR = 902 )
-902   IF( ios /= 0 ) CALL ctl_nam ( ios , 'nampiskrs in configuration namelist', lwp )
-      IF(lwm) WRITE ( numonp, nampiskrs )
-
-      IF(lwp) THEN
-         WRITE(numout,*)
-         WRITE(numout,*) ' Namelist : nampiskrs'
-         WRITE(numout,*) '    Sinking factor                           xkr_sfact    = ', xkr_sfact
-         WRITE(numout,*) '    Stickiness                               xkr_stick    = ', xkr_stick
-         WRITE(numout,*) '    Nbr of cell in nano size class           xkr_nnano    = ', xkr_nnano
-         WRITE(numout,*) '    Nbr of cell in diatoms size class        xkr_ndiat    = ', xkr_ndiat
-         WRITE(numout,*) '    Nbr of cell in microzoo size class       xkr_nmicro   = ', xkr_nmicro
-         WRITE(numout,*) '    Nbr of cell in mesozoo size class        xkr_nmeso    = ', xkr_nmeso
-         WRITE(numout,*) '    Nbr of cell in aggregates size class     xkr_naggr    = ', xkr_naggr
-      ENDIF
-
-
-      ! max and min vertical particle speed
-      xkr_wsbio_min = xkr_sfact * xkr_mass_min**xkr_eta
-      xkr_wsbio_max = xkr_sfact * xkr_mass_max**xkr_eta
-      IF (lwp) WRITE(numout,*) ' max and min vertical particle speed ', xkr_wsbio_min, xkr_wsbio_max
-
-      !
-      !    effect of the sizes of the different living pools on particle numbers
-      !    nano = 2um-20um -> mean size=6.32 um -> ws=2.596 -> xnum=xnnano=2.337
-      !    diat and microzoo = 10um-200um -> 44.7 -> 8.732 -> xnum=xndiat=3.718
-      !    mesozoo = 200um-2mm -> 632.45 -> 45.14 -> xnum=xnmeso=7.147
-      !    aggregates = 200um-10mm -> 1414 -> 74.34 -> xnum=xnaggr=9.877
-      !    doc aggregates = 1um
-      ! ----------------------------------------------------------
-
-      xkr_dnano = 1. / ( xkr_massp * xkr_nnano )
-      xkr_ddiat = 1. / ( xkr_massp * xkr_ndiat )
-      xkr_dmicro = 1. / ( xkr_massp * xkr_nmicro )
-      xkr_dmeso = 1. / ( xkr_massp * xkr_nmeso )
-      xkr_daggr = 1. / ( xkr_massp * xkr_naggr )
-
-      !!---------------------------------------------------------------------
-      !!    'key_kriest'                                                  ???
-      !!---------------------------------------------------------------------
-      !  COMPUTATION OF THE VERTICAL PROFILE OF MAXIMUM SINKING SPEED
-      !  Search of the maximum number of particles in aggregates for each k-level.
-      !  Bissection Method
-      !--------------------------------------------------------------------
-      IF (lwp) THEN
-        WRITE(numout,*)
-        WRITE(numout,*)'    kriest : Compute maximum number of particles in aggregates'
-      ENDIF
-
-      xacc     =  0.001_wp
-      kiter    = 50
-      zmin     =  1.10_wp
-      zmax     = xkr_mass_max / xkr_mass_min
-      xkr_frac = zmax
-
-      DO jk = 1,jpk
-         zl = zmin
-         zr = zmax
-         wmax = 0.5 * e3t_n(1,1,jk) * rday * float(niter1max) / rfact2
-         zdiv = xkr_zeta + xkr_eta - xkr_eta * zl
-         znum = zl - 1.
-         zwl =  xkr_wsbio_min * xkr_zeta / zdiv &
-            & - ( xkr_wsbio_max * xkr_eta * znum * &
-            &     xkr_frac**( -xkr_zeta / znum ) / zdiv ) &
-            & - wmax
-
-         zdiv = xkr_zeta + xkr_eta - xkr_eta * zr
-         znum = zr - 1.
-         zwr =  xkr_wsbio_min * xkr_zeta / zdiv &
-            & - ( xkr_wsbio_max * xkr_eta * znum * &
-            &     xkr_frac**( -xkr_zeta / znum ) / zdiv ) &
-            & - wmax
-iflag:   DO jn = 1, kiter
-            IF    ( zwl == 0._wp ) THEN   ;   znummax = zl
-            ELSEIF( zwr == 0._wp ) THEN   ;   znummax = zr
-            ELSE
-               znummax = ( zr + zl ) / 2.
-               zdiv = xkr_zeta + xkr_eta - xkr_eta * znummax
-               znum = znummax - 1.
-               zws =  xkr_wsbio_min * xkr_zeta / zdiv &
-                  & - ( xkr_wsbio_max * xkr_eta * znum * &
-                  &     xkr_frac**( -xkr_zeta / znum ) / zdiv ) &
-                  & - wmax
-               IF( zws * zwl < 0. ) THEN   ;   zr = znummax
-               ELSE                        ;   zl = znummax
-               ENDIF
-               zdiv = xkr_zeta + xkr_eta - xkr_eta * zl
-               znum = zl - 1.
-               zwl =  xkr_wsbio_min * xkr_zeta / zdiv &
-                  & - ( xkr_wsbio_max * xkr_eta * znum * &
-                  &     xkr_frac**( -xkr_zeta / znum ) / zdiv ) &
-                  & - wmax
-
-               zdiv = xkr_zeta + xkr_eta - xkr_eta * zr
-               znum = zr - 1.
-               zwr =  xkr_wsbio_min * xkr_zeta / zdiv &
-                  & - ( xkr_wsbio_max * xkr_eta * znum * &
-                  &     xkr_frac**( -xkr_zeta / znum ) / zdiv ) &
-                  & - wmax
-               !
-               IF ( ABS ( zws )  <= xacc ) EXIT iflag
-               !
-            ENDIF
-            !
-         END DO iflag
-
-         xnumm(jk) = znummax
-         IF (lwp) WRITE(numout,*) '       jk = ', jk, ' wmax = ', wmax,' xnum max = ', xnumm(jk)
-         !
-      END DO
-      !
-      ik100 = 10        !  last level where depth less than 100 m
-      DO jk = jpkm1, 1, -1
-         IF( gdept_1d(jk) > 100. )  iksed = jk - 1
-      END DO
-      IF (lwp) WRITE(numout,*)
-      IF (lwp) WRITE(numout,*) ' Level corresponding to 100m depth ',  ik100 + 1
-      IF (lwp) WRITE(numout,*)
-      !
-      t_oce_co2_exp = 0._wp
-      !
-      IF( nn_timing == 1 )  CALL timing_stop('p4z_sink_init')
-      !
-  END SUBROUTINE p4z_sink_init
-
-#endif
 
    SUBROUTINE p4z_sink2( pwsink, psinkflx, jp_tra, kiter )
@@ -794,5 +310,5 @@
       CALL wrk_alloc( jpi, jpj, jpk, ztraz, zakz, zwsink2, ztrb )
 
-      zstep = rfact2 / FLOAT( kiter ) / 2.
+      zstep = rfact2 / REAL( kiter, wp ) / 2.
 
       ztraz(:,:,:) = 0.e0
@@ -804,7 +320,4 @@
       END DO
       zwsink2(:,:,1) = 0.e0
-      IF( lk_degrad ) THEN
-         zwsink2(:,:,:) = zwsink2(:,:,:) * facvol(:,:,:)
-      ENDIF
 
 
@@ -887,27 +400,23 @@
       !!                     ***  ROUTINE p4z_sink_alloc  ***
       !!----------------------------------------------------------------------
-      ALLOCATE( wsbio3 (jpi,jpj,jpk) , wsbio4  (jpi,jpj,jpk) , wscal(jpi,jpj,jpk) ,     &
-         &      sinking(jpi,jpj,jpk) , sinking2(jpi,jpj,jpk)                      ,     &                
-         &      sinkcal(jpi,jpj,jpk) , sinksil (jpi,jpj,jpk)                      ,     &                
-#if defined key_kriest
-         &      xnumm(jpk)                                                        ,     &                
-#else
-         &      sinkfer2(jpi,jpj,jpk)                                             ,     &                
-#endif
-         &      sinkfer(jpi,jpj,jpk)                                              , STAT=p4z_sink_alloc )                
+      INTEGER :: ierr(3)
+
+      ierr(:) = 0
+      !
+      ALLOCATE( sinking(jpi,jpj,jpk) , sinking2(jpi,jpj,jpk)                    ,     &                
+         &      sinkcal(jpi,jpj,jpk) , sinksil (jpi,jpj,jpk)                    ,     &                
+         &      sinkfer2(jpi,jpj,jpk)                                           ,     &                
+         &      sinkfer(jpi,jpj,jpk)                                            , STAT=ierr(1) )                
          !
+      IF( ln_ligand ) ALLOCATE( sinkfep(jpi,jpj,jpk)                            , STAT=ierr(2) )  
+         
+      IF( ln_p5z    ) ALLOCATE( sinkingn(jpi,jpj,jpk), sinking2n(jpi,jpj,jpk)   ,     &
+         &                      sinkingp(jpi,jpj,jpk), sinking2p(jpi,jpj,jpk)   , STAT=ierr(3) )
+      !
+      p4z_sink_alloc = MAXVAL( ierr )
       IF( p4z_sink_alloc /= 0 ) CALL ctl_warn('p4z_sink_alloc : failed to allocate arrays.')
       !
    END FUNCTION p4z_sink_alloc
    
-#else
-   !!======================================================================
-   !!  Dummy module :                                   No PISCES bio-model
-   !!======================================================================
-CONTAINS
-   SUBROUTINE p4z_sink                    ! Empty routine
-   END SUBROUTINE p4z_sink
-#endif 
-
    !!======================================================================
 END MODULE p4zsink
Index: branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/NEMO/TOP_SRC/PISCES/P4Z/p4zsms.F90
===================================================================
--- branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/NEMO/TOP_SRC/PISCES/P4Z/p4zsms.F90	(revision 7383)
+++ branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/NEMO/TOP_SRC/PISCES/P4Z/p4zsms.F90	(revision 7391)
@@ -6,8 +6,4 @@
    !! History :   1.0  !  2004-03 (O. Aumont) Original code
    !!             2.0  !  2007-12  (C. Ethe, G. Madec)  F90
-   !!----------------------------------------------------------------------
-#if defined key_pisces
-   !!----------------------------------------------------------------------
-   !!   'key_pisces'                                       PISCES bio-model
    !!----------------------------------------------------------------------
    !!   p4zsms         :  Time loop of passive tracers sms
@@ -69,7 +65,4 @@
       INTEGER ::   ji, jj, jk, jnt, jn, jl
       REAL(wp) ::  ztra
-#if defined key_kriest
-      REAL(wp) ::  zcoef1, zcoef2
-#endif
       CHARACTER (len=25) :: charout
       !!---------------------------------------------------------------------
@@ -83,5 +76,5 @@
         CALL p4z_che                              ! initialize the chemical constants
         !
-        IF( .NOT. ln_rsttr ) THEN  ;   CALL p4z_ph_ini   !  set PH at kt=nit000 
+        IF( .NOT. ln_rsttr ) THEN  ;   CALL ahini_for_at(hi)   !  set PH at kt=nit000 
         ELSE                       ;   CALL p4z_rst( nittrc000, 'READ' )  !* read or initialize all required fields 
         ENDIF
@@ -91,12 +84,9 @@
       IF( ln_pisdmp .AND. MOD( kt - nn_dttrc, nn_pisdmp ) == 0 )   CALL p4z_dmp( kt )      ! Relaxation of some tracers
       !
-      !                                                                    !   set time step size (Euler/Leapfrog)
-      IF( ( neuler == 0 .AND. kt == nittrc000 ) .OR. ln_top_euler ) THEN   ;    rfact = rdttrc     !  at nittrc000
-      ELSEIF( kt <= nittrc000 + nn_dttrc )                          THEN   ;    rfact = 2. * rdttrc   ! at nittrc000 or nittrc000+nn_dttrc (Leapfrog)
-      ENDIF
+      rfact = r2dttrc
       !
       IF( ( ln_top_euler .AND. kt == nittrc000 )  .OR. ( .NOT.ln_top_euler .AND. kt <= nittrc000 + nn_dttrc ) ) THEN
          rfactr  = 1. / rfact
-         rfact2  = rfact / FLOAT( nrdttrc )
+         rfact2  = rfact / REAL( nrdttrc, wp )
          rfact2r = 1. / rfact2
          xstep = rfact2 / rday         ! Time step duration for biology
@@ -165,15 +155,4 @@
       END DO
 
-#if defined key_kriest
-      ! 
-      zcoef1 = 1.e0 / xkr_massp 
-      zcoef2 = 1.e0 / xkr_massp / 1.1
-      DO jk = 1,jpkm1
-         trb(:,:,jk,jpnum) = MAX(  trb(:,:,jk,jpnum), trb(:,:,jk,jppoc) * zcoef1 / xnumm(jk)  )
-         trb(:,:,jk,jpnum) = MIN(  trb(:,:,jk,jpnum), trb(:,:,jk,jppoc) * zcoef2              )
-      END DO
-      !
-#endif
-      !
       !
       IF( l_trdtrc ) THEN
@@ -212,10 +191,9 @@
       !! ** input   :   file 'namelist.trc.s' containing the following
       !!             namelist: natext, natbio, natsms
-      !!                       natkriest ("key_kriest")
-      !!----------------------------------------------------------------------
-      NAMELIST/nampisbio/ nrdttrc, wsbio, xkmort, ferat3, wsbio2, niter1max, niter2max
-#if defined key_kriest
-      NAMELIST/nampiskrp/ xkr_eta, xkr_zeta, xkr_ncontent, xkr_mass_min, xkr_mass_max
-#endif
+      !!----------------------------------------------------------------------
+      NAMELIST/nampisbio/ nrdttrc, wsbio, xkmort, ferat3, wsbio2, wsbio2max, wsbio2scale,    &
+         &                   niter1max, niter2max, wfep, ldocp, ldocz, lthet,  &
+         &                   no3rat3, po4rat3
+
       NAMELIST/nampisdmp/ ln_pisdmp, nn_pisdmp
       NAMELIST/nampismass/ ln_check_mass
@@ -234,42 +212,27 @@
       IF(lwp) THEN                         ! control print
          WRITE(numout,*) ' Namelist : nampisbio'
-         WRITE(numout,*) '    frequence pour la biologie                nrdttrc   =', nrdttrc
-         WRITE(numout,*) '    POC sinking speed                         wsbio     =', wsbio
-         WRITE(numout,*) '    half saturation constant for mortality    xkmort    =', xkmort
-         WRITE(numout,*) '    Fe/C in zooplankton                       ferat3    =', ferat3
-         WRITE(numout,*) '    Big particles sinking speed               wsbio2    =', wsbio2
+         WRITE(numout,*) '    frequence pour la biologie                nrdttrc    =', nrdttrc
+         WRITE(numout,*) '    POC sinking speed                         wsbio      =', wsbio
+         WRITE(numout,*) '    half saturation constant for mortality    xkmort     =', xkmort 
+         IF( ln_p5z ) THEN
+            WRITE(numout,*) '    N/C in zooplankton                        no3rat3    =', no3rat3
+            WRITE(numout,*) '    P/C in zooplankton                        po4rat3    =', po4rat3
+         ENDIF
+         WRITE(numout,*) '    Fe/C in zooplankton                       ferat3     =', ferat3
+         WRITE(numout,*) '    Big particles sinking speed               wsbio2     =', wsbio2
+         WRITE(numout,*) '    Big particles maximum sinking speed       wsbio2max  =', wsbio2max
+         WRITE(numout,*) '    Big particles sinking speed length scale  wsbio2scale =', wsbio2scale
          WRITE(numout,*) '    Maximum number of iterations for POC      niter1max =', niter1max
          WRITE(numout,*) '    Maximum number of iterations for GOC      niter2max =', niter2max
-      ENDIF
-
-#if defined key_kriest
-
-      !                               ! nampiskrp : kriest parameters
-      !                               ! -----------------------------
-      REWIND( numnatp_ref )              ! Namelist nampiskrp in reference namelist : Pisces Kriest
-      READ  ( numnatp_ref, nampiskrp, IOSTAT = ios, ERR = 903)
-903   IF( ios /= 0 ) CALL ctl_nam ( ios , 'nampiskrp in reference namelist', lwp )
-
-      REWIND( numnatp_cfg )              ! Namelist nampiskrp in configuration namelist : Pisces Kriest
-      READ  ( numnatp_cfg, nampiskrp, IOSTAT = ios, ERR = 904 )
-904   IF( ios /= 0 ) CALL ctl_nam ( ios , 'nampiskrp in configuration namelist', lwp )
-      IF(lwm) WRITE ( numonp, nampiskrp )
-
-      IF(lwp) THEN
-         WRITE(numout,*)
-         WRITE(numout,*) ' Namelist : nampiskrp'
-         WRITE(numout,*) '    Sinking  exponent                        xkr_eta      = ', xkr_eta
-         WRITE(numout,*) '    N content exponent                       xkr_zeta     = ', xkr_zeta
-         WRITE(numout,*) '    N content factor                         xkr_ncontent = ', xkr_ncontent
-         WRITE(numout,*) '    Minimum mass for Aggregates              xkr_mass_min = ', xkr_mass_min
-         WRITE(numout,*) '    Maximum mass for Aggregates              xkr_mass_max = ', xkr_mass_max
-         WRITE(numout,*)
-     ENDIF
-
-
-     ! Computation of some variables
-     xkr_massp = xkr_ncontent * 7.625 * xkr_mass_min**xkr_zeta
-
-#endif
+         IF( ln_ligand ) THEN
+            WRITE(numout,*) '    FeP sinking speed                             wfep   =', wfep
+            IF( ln_p4z ) THEN
+              WRITE(numout,*) '    Phyto ligand production per unit doc          ldocp  =', ldocp
+              WRITE(numout,*) '    Zoo ligand production per unit doc            ldocz  =', ldocz
+              WRITE(numout,*) '    Proportional loss of ligands due to Fe uptake lthet  =', lthet
+            ENDIF
+         ENDIF
+      ENDIF
+
 
       REWIND( numnatp_ref )              ! Namelist nampisdmp in reference namelist : Pisces damping
@@ -308,32 +271,4 @@
    END SUBROUTINE p4z_sms_init
 
-   SUBROUTINE p4z_ph_ini
-      !!---------------------------------------------------------------------
-      !!                   ***  ROUTINE p4z_ini_ph  ***
-      !!
-      !!  ** Purpose : Initialization of chemical variables of the carbon cycle
-      !!---------------------------------------------------------------------
-      INTEGER  ::  ji, jj, jk
-      REAL(wp) ::  zcaralk, zbicarb, zco3
-      REAL(wp) ::  ztmas, ztmas1
-      !!---------------------------------------------------------------------
-
-      ! 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 = trb(ji,jj,jk,jptal) - borat(ji,jj,jk) / (  1. + 1.E-8 / ( rtrn + akb3(ji,jj,jk) )  )
-               zco3    = ( zcaralk - trb(ji,jj,jk,jpdic) ) * ztmas + 0.5e-3 * ztmas1
-               zbicarb = ( 2. * trb(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
-     !
-   END SUBROUTINE p4z_ph_ini
-
    SUBROUTINE p4z_rst( kt, cdrw )
       !!---------------------------------------------------------------------
@@ -349,7 +284,4 @@
       CHARACTER(len=*), INTENT(in) ::   cdrw       ! "READ"/"WRITE" flag
       !
-      INTEGER  ::  ji, jj, jk
-      REAL(wp) ::  zcaralk, zbicarb, zco3
-      REAL(wp) ::  ztmas, ztmas1
       !!---------------------------------------------------------------------
 
@@ -363,6 +295,5 @@
             CALL iom_get( numrtr, jpdom_autoglo, 'PH' , hi(:,:,:)  )
          ELSE
-!            hi(:,:,:) = 1.e-9 
-            CALL p4z_ph_ini
+            CALL ahini_for_at(hi)
          ENDIF
          CALL iom_get( numrtr, jpdom_autoglo, 'Silicalim', xksi(:,:) )
@@ -379,4 +310,16 @@
          ENDIF
          !
+         IF( ln_p5z ) THEN
+            IF( iom_varid( numrtr, 'sized', ldstop = .FALSE. ) > 0 ) THEN
+               CALL iom_get( numrtr, jpdom_autoglo, 'sizep' , sized(:,:,:)  )
+               CALL iom_get( numrtr, jpdom_autoglo, 'sizen' , sized(:,:,:)  )
+               CALL iom_get( numrtr, jpdom_autoglo, 'sized' , sized(:,:,:)  )
+            ELSE
+               sizep(:,:,:) = 1.
+               sizen(:,:,:) = 1.
+               sized(:,:,:) = 1.
+            ENDIF
+        ENDIF
+        !
       ELSEIF( TRIM(cdrw) == 'WRITE' ) THEN
          IF( kt == nitrst ) THEN
@@ -389,4 +332,9 @@
          CALL iom_rstput( kt, nitrst, numrtw, 'Silicamax', xksimax(:,:) )
          CALL iom_rstput( kt, nitrst, numrtw, 'tcflxcum', t_oce_co2_flx_cum )
+         IF( ln_p5z ) THEN
+            CALL iom_rstput( kt, nitrst, numrtw, 'sizep', sized(:,:,:) )
+            CALL iom_rstput( kt, nitrst, numrtw, 'sizen', sized(:,:,:) )
+            CALL iom_rstput( kt, nitrst, numrtw, 'sized', sized(:,:,:) )
+         ENDIF
       ENDIF
       !
@@ -475,6 +423,6 @@
       REAL(wp)             ::  zrdenittot, zsdenittot, znitrpottot
       CHARACTER(LEN=100)   ::   cltxt
-      REAL(wp), DIMENSION(jpi,jpj,jpk) :: zvol
       INTEGER :: jk
+      REAL(wp), POINTER, DIMENSION(:,:,:) :: zwork
       !!----------------------------------------------------------------------
 
@@ -496,37 +444,47 @@
       ENDIF
 
+      CALL wrk_alloc( jpi, jpj, jpk, zwork )
       !
       IF( iom_use( "pno3tot" ) .OR. ( ln_check_mass .AND. kt == nitend )  ) THEN
          !   Compute the budget of NO3, ALK, Si, Fer
-         no3budget = glob_sum( (   trn(:,:,:,jpno3) + trn(:,:,:,jpnh4)  &
-            &                    + trn(:,:,:,jpphy) + trn(:,:,:,jpdia)  &
-            &                    + trn(:,:,:,jpzoo) + trn(:,:,:,jpmes)  &
-            &                    + trn(:,:,:,jppoc)                     &
-#if ! defined key_kriest
-            &                    + trn(:,:,:,jpgoc)                     &
-#endif
-            &                    + trn(:,:,:,jpdoc)                     ) * cvol(:,:,:)  )
-         !
-         no3budget = no3budget / areatot
-         CALL iom_put( "pno3tot", no3budget )
+         IF( ln_p4z ) THEN
+            zwork(:,:,:) =    trn(:,:,:,jpno3) + trn(:,:,:,jpnh4)                      &
+               &          +   trn(:,:,:,jpphy) + trn(:,:,:,jpdia)                      &
+               &          +   trn(:,:,:,jppoc) + trn(:,:,:,jpgoc)  + trn(:,:,:,jpdoc)  &        
+               &          +   trn(:,:,:,jpzoo) + trn(:,:,:,jpmes) 
+        ELSE
+            zwork(:,:,:) =    trn(:,:,:,jpno3) + trn(:,:,:,jpnh4) + trn(:,:,:,jpnph)   &
+               &          +   trn(:,:,:,jpndi) + trn(:,:,:,jpnpi)                      & 
+               &          +   trn(:,:,:,jppon) + trn(:,:,:,jpgon) + trn(:,:,:,jpdon)   &
+               &          + ( trn(:,:,:,jpzoo) + trn(:,:,:,jpmes) ) * no3rat3 
+        ENDIF
+        !
+        no3budget = glob_sum( zwork(:,:,:) * cvol(:,:,:)  )  
+        no3budget = no3budget / areatot
+        CALL iom_put( "pno3tot", no3budget )
       ENDIF
       !
       IF( iom_use( "ppo4tot" ) .OR. ( ln_check_mass .AND. kt == nitend )  ) THEN
-         po4budget = glob_sum( (   trn(:,:,:,jppo4)                     &
-            &                    + trn(:,:,:,jpphy) + trn(:,:,:,jpdia)  &
-            &                    + trn(:,:,:,jpzoo) + trn(:,:,:,jpmes)  &
-            &                    + trn(:,:,:,jppoc)                     &
-#if ! defined key_kriest
-            &                    + trn(:,:,:,jpgoc)                     &
-#endif
-            &                    + trn(:,:,:,jpdoc)                     ) * cvol(:,:,:)  )
-         po4budget = po4budget / areatot
-         CALL iom_put( "ppo4tot", po4budget )
+         IF( ln_p4z ) THEN
+            zwork(:,:,:) =    trn(:,:,:,jppo4)                                         &
+               &          +   trn(:,:,:,jpphy) + trn(:,:,:,jpdia)                      &
+               &          +   trn(:,:,:,jppoc) + trn(:,:,:,jpgoc)  + trn(:,:,:,jpdoc)  &        
+               &          +   trn(:,:,:,jpzoo) + trn(:,:,:,jpmes) 
+        ELSE
+            zwork(:,:,:) =    trn(:,:,:,jppo4) + trn(:,:,:,jppph)                      &
+               &          +   trn(:,:,:,jppdi) + trn(:,:,:,jpppi)                      & 
+               &          +   trn(:,:,:,jppop) + trn(:,:,:,jpgop) + trn(:,:,:,jpdop)   &
+               &          + ( trn(:,:,:,jpzoo) + trn(:,:,:,jpmes) ) * po4rat3 
+        ENDIF
+        !
+        po4budget = glob_sum( zwork(:,:,:) * cvol(:,:,:)  )  
+        po4budget = po4budget / areatot
+        CALL iom_put( "ppo4tot", po4budget )
       ENDIF
       !
       IF( iom_use( "psiltot" ) .OR. ( ln_check_mass .AND. kt == nitend )  ) THEN
-         silbudget = glob_sum( (   trn(:,:,:,jpsil) + trn(:,:,:,jpgsi)  &
-            &                    + trn(:,:,:,jpdsi)                     ) * cvol(:,:,:)  )
-         !
+         zwork(:,:,:) =  trn(:,:,:,jpsil) + trn(:,:,:,jpgsi) + trn(:,:,:,jpdsi) 
+         !
+         silbudget = glob_sum( zwork(:,:,:) * cvol(:,:,:)  )  
          silbudget = silbudget / areatot
          CALL iom_put( "psiltot", silbudget )
@@ -534,8 +492,7 @@
       !
       IF( iom_use( "palktot" ) .OR. ( ln_check_mass .AND. kt == nitend )  ) THEN
-         alkbudget = glob_sum( (   trn(:,:,:,jpno3) * rno3              &
-            &                    + trn(:,:,:,jptal)                     &
-            &                    + trn(:,:,:,jpcal) * 2.                ) * cvol(:,:,:)  )
-         !
+         zwork(:,:,:) =  trn(:,:,:,jpno3) * rno3 + trn(:,:,:,jptal) + trn(:,:,:,jpcal) * 2.              
+         !
+         alkbudget = glob_sum( zwork(:,:,:) * cvol(:,:,:)  )         !
          alkbudget = alkbudget / areatot
          CALL iom_put( "palktot", alkbudget )
@@ -543,18 +500,16 @@
       !
       IF( iom_use( "pfertot" ) .OR. ( ln_check_mass .AND. kt == nitend )  ) THEN
-         ferbudget = glob_sum( (   trn(:,:,:,jpfer) + trn(:,:,:,jpnfe)  &
-            &                    + trn(:,:,:,jpdfe)                     &
-#if ! defined key_kriest
-            &                    + trn(:,:,:,jpbfe)                     &
-#endif
-            &                    + trn(:,:,:,jpsfe)                     &
-            &                    + trn(:,:,:,jpzoo) * ferat3            &
-            &                    + trn(:,:,:,jpmes) * ferat3            ) * cvol(:,:,:)  )
-         !
+         zwork(:,:,:) =   trn(:,:,:,jpfer) + trn(:,:,:,jpnfe) + trn(:,:,:,jpdfe)   &
+            &         +   trn(:,:,:,jpbfe) + trn(:,:,:,jpsfe)                      &
+            &         + ( trn(:,:,:,jpzoo) + trn(:,:,:,jpmes) )  * ferat3    
+         IF( ln_ligand)  zwork(:,:,:) = zwork(:,:,:) + trn(:,:,:,jpfep)                
+         !
+         ferbudget = glob_sum( zwork(:,:,:) * cvol(:,:,:)  )  
          ferbudget = ferbudget / areatot
          CALL iom_put( "pfertot", ferbudget )
       ENDIF
       !
-
+      CALL wrk_dealloc( jpi, jpj, jpk, zwork )
+      !
       ! Global budget of N SMS : denitrification in the water column and in the sediment
       !                          nitrogen fixation by the diazotrophs
@@ -600,15 +555,4 @@
    END SUBROUTINE p4z_chk_mass
 
-#else
-   !!======================================================================
-   !!  Dummy module :                                   No PISCES bio-model
-   !!======================================================================
-CONTAINS
-   SUBROUTINE p4z_sms( kt )                   ! Empty routine
-      INTEGER, INTENT( in ) ::   kt
-      WRITE(*,*) 'p4z_sms: You should not have seen this print! error?', kt
-   END SUBROUTINE p4z_sms
-#endif 
-
    !!======================================================================
 END MODULE p4zsms 
Index: branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/NEMO/TOP_SRC/PISCES/P4Z/p5zlim.F90
===================================================================
--- branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/NEMO/TOP_SRC/PISCES/P4Z/p5zlim.F90	(revision 7391)
+++ branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/NEMO/TOP_SRC/PISCES/P4Z/p5zlim.F90	(revision 7391)
@@ -0,0 +1,602 @@
+MODULE p5zlim
+   !!======================================================================
+   !!                         ***  MODULE p5zlim  ***
+   !! TOP :   PISCES with variable stoichiometry 
+   !!======================================================================
+   !! History :   1.0  !  2004     (O. Aumont) Original code
+   !!             2.0  !  2007-12  (C. Ethe, G. Madec)  F90
+   !!             3.4  !  2011-04  (O. Aumont, C. Ethe) Limitation for iron modelled in quota 
+   !!             3.6  !  2015-05  (O. Aumont) PISCES quota
+   !!----------------------------------------------------------------------
+   !!   p5z_lim        :   Compute the nutrients limitation terms 
+   !!   p5z_lim_init   :   Read the namelist 
+   !!----------------------------------------------------------------------
+   USE oce_trc         ! Shared ocean-passive tracers variables
+   USE trc             ! Tracers defined
+   USE sms_pisces      ! PISCES variables
+   USE iom             !  I/O manager
+
+   IMPLICIT NONE
+   PRIVATE
+
+   PUBLIC p5z_lim    
+   PUBLIC p5z_lim_init    
+   PUBLIC p5z_lim_alloc
+
+   !! * Shared module variables
+   REAL(wp), PUBLIC ::  concnno3    !:  NO3, PO4 half saturation   
+   REAL(wp), PUBLIC ::  concpno3    !:  NO3, PO4 half saturation   
+   REAL(wp), PUBLIC ::  concdno3    !:  Phosphate half saturation for diatoms  
+   REAL(wp), PUBLIC ::  concnnh4    !:  NH4 half saturation for phyto  
+   REAL(wp), PUBLIC ::  concpnh4    !:  NH4 half saturation for phyto  
+   REAL(wp), PUBLIC ::  concdnh4    !:  NH4 half saturation for diatoms
+   REAL(wp), PUBLIC ::  concnpo4    !:  NH4 half saturation for diatoms
+   REAL(wp), PUBLIC ::  concppo4    !:  NH4 half saturation for diatoms
+   REAL(wp), PUBLIC ::  concdpo4    !:  NH4 half saturation for diatoms
+   REAL(wp), PUBLIC ::  concnfer    !:  Iron half saturation for nanophyto 
+   REAL(wp), PUBLIC ::  concpfer    !:  Iron half saturation for nanophyto 
+   REAL(wp), PUBLIC ::  concdfer    !:  Iron half saturation for diatoms  
+   REAL(wp), PUBLIC ::  concbno3    !:  NO3 half saturation  for bacteria 
+   REAL(wp), PUBLIC ::  concbnh4    !:  NH4 half saturation for bacteria
+   REAL(wp), PUBLIC ::  concbpo4    !:  PO4 half saturation for bacteria
+   REAL(wp), PUBLIC ::  xsizedia    !:  Minimum size criteria for diatoms
+   REAL(wp), PUBLIC ::  xsizepic    !:  Minimum size criteria for diatoms
+   REAL(wp), PUBLIC ::  xsizephy    !:  Minimum size criteria for nanophyto
+   REAL(wp), PUBLIC ::  xsizern     !:  Size ratio for nanophytoplankton
+   REAL(wp), PUBLIC ::  xsizerp     !:  Size ratio for nanophytoplankton
+   REAL(wp), PUBLIC ::  xsizerd     !:  Size ratio for diatoms
+   REAL(wp), PUBLIC ::  xksi1       !:  half saturation constant for Si uptake 
+   REAL(wp), PUBLIC ::  xksi2       !:  half saturation constant for Si/C 
+   REAL(wp), PUBLIC ::  xkdoc       !:  2nd half-sat. of DOC remineralization  
+   REAL(wp), PUBLIC ::  concbfe     !:  Fe half saturation for bacteria 
+   REAL(wp), PUBLIC ::  oxymin      !:  half saturation constant for anoxia
+   REAL(wp), PUBLIC ::  qfnopt      !:  optimal Fe quota for nanophyto
+   REAL(wp), PUBLIC ::  qfpopt      !:  optimal Fe quota for nanophyto
+   REAL(wp), PUBLIC ::  qfdopt      !:  optimal Fe quota for diatoms
+   REAL(wp), PUBLIC ::  caco3r      !:  mean rainratio 
+   REAL(wp), PUBLIC ::  qnnmin      !:  optimal Fe quota for diatoms
+   REAL(wp), PUBLIC ::  qnnmax      !:  optimal Fe quota for diatoms
+   REAL(wp), PUBLIC ::  qpnmin      !:  optimal Fe quota for diatoms
+   REAL(wp), PUBLIC ::  qpnmax      !:  optimal Fe quota for diatoms
+   REAL(wp), PUBLIC ::  qnpmin      !:  optimal Fe quota for diatoms
+   REAL(wp), PUBLIC ::  qnpmax      !:  optimal Fe quota for diatoms
+   REAL(wp), PUBLIC ::  qppmin      !:  optimal Fe quota for diatoms
+   REAL(wp), PUBLIC ::  qppmax      !:  optimal Fe quota for diatoms
+   REAL(wp), PUBLIC ::  qndmin      !:  optimal Fe quota for diatoms
+   REAL(wp), PUBLIC ::  qndmax      !:  optimal Fe quota for diatoms
+   REAL(wp), PUBLIC ::  qpdmin      !:  optimal Fe quota for diatoms
+   REAL(wp), PUBLIC ::  qpdmax      !:  optimal Fe quota for diatoms
+   REAL(wp), PUBLIC ::  qfnmax      !:  optimal Fe quota for diatoms
+   REAL(wp), PUBLIC ::  qfpmax      !:  optimal Fe quota for diatoms
+   REAL(wp), PUBLIC ::  qfdmax      !:  optimal Fe quota for diatoms
+   REAL(wp), PUBLIC ::  zpsinh4
+   REAL(wp), PUBLIC ::  zpsino3
+   REAL(wp), PUBLIC ::  zpsiuptk
+
+   !!*  Allometric variations of the quotas
+   REAL(wp), PUBLIC, ALLOCATABLE, SAVE,   DIMENSION(:,:,:)  ::   xqnnmin    !: ???
+   REAL(wp), PUBLIC, ALLOCATABLE, SAVE,   DIMENSION(:,:,:)  ::   xqnnmax    !: ???
+   REAL(wp), PUBLIC, ALLOCATABLE, SAVE,   DIMENSION(:,:,:)  ::   xqpnmin    !: ???
+   REAL(wp), PUBLIC, ALLOCATABLE, SAVE,   DIMENSION(:,:,:)  ::   xqpnmax    !: ???
+   REAL(wp), PUBLIC, ALLOCATABLE, SAVE,   DIMENSION(:,:,:)  ::   xqnpmin    !: ???
+   REAL(wp), PUBLIC, ALLOCATABLE, SAVE,   DIMENSION(:,:,:)  ::   xqnpmax    !: ???
+   REAL(wp), PUBLIC, ALLOCATABLE, SAVE,   DIMENSION(:,:,:)  ::   xqppmin    !: ???
+   REAL(wp), PUBLIC, ALLOCATABLE, SAVE,   DIMENSION(:,:,:)  ::   xqppmax    !: ???
+   REAL(wp), PUBLIC, ALLOCATABLE, SAVE,   DIMENSION(:,:,:)  ::   xqndmin    !: ???
+   REAL(wp), PUBLIC, ALLOCATABLE, SAVE,   DIMENSION(:,:,:)  ::   xqndmax    !: ???
+   REAL(wp), PUBLIC, ALLOCATABLE, SAVE,   DIMENSION(:,:,:)  ::   xqpdmin    !: ???
+   REAL(wp), PUBLIC, ALLOCATABLE, SAVE,   DIMENSION(:,:,:)  ::   xqpdmax    !: ???
+
+   !!* Phytoplankton limitation terms
+   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:)  ::   xnanono3   !: ???
+   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:)  ::   xdiatno3   !: ???
+   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:)  ::   xnanonh4   !: ???
+   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:)  ::   xdiatnh4   !: ???
+   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:)  ::   xnanopo4   !: ???
+   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:)  ::   xdiatpo4   !: ???
+   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:)  ::   xlimphy    !: ???
+   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:)  ::   xlimdia    !: ???
+   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:)  ::   xlimnfe    !: ???
+   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:)  ::   xlimdfe    !: ???
+   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:)  ::   xlimsi     !: ???
+   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:)  ::   xlimbac    !: ??
+   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:)  ::   xlimbacl   !: ??
+   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:)  ::   xpicono3   !: ???
+   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:)  ::   xpiconh4   !: ???
+   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:)  ::   xpicopo4   !: ???
+   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:)  ::   xnanodop   !: ???
+   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:)  ::   xpicodop   !: ???
+   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:)  ::   xdiatdop   !: ???
+   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:)  ::   xnanofer   !: ???
+   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:)  ::   xpicofer   !: ???
+   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:)  ::   xdiatfer   !: ???
+   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:)  ::   xlimpic    !: ???
+   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:)  ::   xlimpfe    !: ???
+   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:)  ::   fvnuptk
+   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:)  ::   fvpuptk
+   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:)  ::   fvduptk
+
+   ! Coefficient for iron limitation
+   REAL(wp) ::  xcoef1   = 0.00167  / 55.85
+   REAL(wp) ::  xcoef2   = 1.21E-5 * 14. / 55.85 / 7.625 * 0.5 * 1.5
+   REAL(wp) ::  xcoef3   = 1.15E-4 * 14. / 55.85 / 7.625 * 0.5 
+   !!----------------------------------------------------------------------
+   !! NEMO/TOP 3.3 , NEMO Consortium (2010)
+   !! $Id: p4zlim.F90 3160 2011-11-20 14:27:18Z cetlod $ 
+   !! Software governed by the CeCILL licence (NEMOGCM/NEMO_CeCILL.txt)
+   !!----------------------------------------------------------------------
+
+CONTAINS
+
+   SUBROUTINE p5z_lim( kt, knt )
+      !!---------------------------------------------------------------------
+      !!                     ***  ROUTINE p5z_lim  ***
+      !!
+      !! ** Purpose :   Compute the co-limitations by the various nutrients
+      !!              for the various phytoplankton species
+      !!
+      !! ** Method  : - ???
+      !!---------------------------------------------------------------------
+      !
+      INTEGER, INTENT(in)  :: kt, knt
+      !
+      INTEGER  ::   ji, jj, jk
+      REAL(wp) ::   zlim1, zlim2, zlim3, zlim4, zno3, zferlim
+      REAL(wp) ::   z1_trndia, z1_trnpic, z1_trnphy, ztem1, ztem2, zetot1
+      REAL(wp) ::   zratio, zration, zratiof, znutlim, zfalim
+      REAL(wp) ::   zconc1d, zconc1dnh4, zconc0n, zconc0nnh4, zconc0npo4, zconc0dpo4
+      REAL(wp) ::   zconc0p, zconc0pnh4, zconc0ppo4, zconcpfe, zconcnfe, zconcdfe
+      REAL(wp) ::   fanano, fananop, fananof, fadiat, fadiatp, fadiatf
+      REAL(wp) ::   fapico, fapicop, fapicof
+      REAL(wp) ::   zrpho, zrass, zcoef, zfuptk, zratchl
+      REAL(wp) ::   zfvn, zfvp, zfvf, zsizen, zsizep, zsized, znanochl, zpicochl, zdiatchl
+      REAL(wp) ::   zqfemn, zqfemp, zqfemd, zbactno3, zbactnh4
+      !!---------------------------------------------------------------------
+      !
+      IF( nn_timing == 1 )  CALL timing_start('p5z_lim')
+      !
+      zratchl = 6.0
+      !
+      DO jk = 1, jpkm1
+         DO jj = 1, jpj
+            DO ji = 1, jpi
+               ! 
+               ! Tuning of the iron concentration to a minimum level that is set to the detection limit
+               !-------------------------------------
+               zno3    = trb(ji,jj,jk,jpno3) / 40.e-6
+               zferlim = MAX( 3e-11 * zno3 * zno3, 5e-12 )
+               zferlim = MIN( zferlim, 7e-11 )
+               trb(ji,jj,jk,jpfer) = MAX( trb(ji,jj,jk,jpfer), zferlim )
+
+               ! Computation of the mean relative size of each community
+               ! -------------------------------------------------------
+               z1_trnphy   = 1. / ( trb(ji,jj,jk,jpphy) + rtrn )
+               z1_trnpic   = 1. / ( trb(ji,jj,jk,jppic) + rtrn )
+               z1_trndia   = 1. / ( trb(ji,jj,jk,jpdia) + rtrn )
+               znanochl = trb(ji,jj,jk,jpnch) * z1_trnphy
+               zpicochl = trb(ji,jj,jk,jppch) * z1_trnpic
+               zdiatchl = trb(ji,jj,jk,jpdch) * z1_trndia
+
+               ! Computation of a variable Ks for iron on diatoms taking into account
+               ! that increasing biomass is made of generally bigger cells
+               !------------------------------------------------
+               zsized            = sized(ji,jj,jk)**0.81
+               zconcdfe          = concdfer * zsized
+               zconc1d           = concdno3 * zsized
+               zconc1dnh4        = concdnh4 * zsized
+               zconc0dpo4        = concdpo4 * zsized
+
+               zsizep            = 1.
+               zconcpfe          = concpfer * zsizep
+               zconc0p           = concpno3 * zsizep
+               zconc0pnh4        = concpnh4 * zsizep
+               zconc0ppo4        = concppo4 * zsizep
+
+               zsizen            = 1.
+               zconcnfe          = concnfer * zsizen
+               zconc0n           = concnno3 * zsizen
+               zconc0nnh4        = concnnh4 * zsizen
+               zconc0npo4        = concnpo4 * zsizen
+
+               ! Allometric variations of the minimum and maximum quotas
+               ! From Talmy et al. (2014) and Maranon et al. (2013)
+               ! -------------------------------------------------------
+               xqnnmin(ji,jj,jk) = qnnmin
+               xqnnmax(ji,jj,jk) = qnnmax
+               xqndmin(ji,jj,jk) = qndmin * sized(ji,jj,jk)**(-0.27) 
+               xqndmax(ji,jj,jk) = qndmax
+               xqnpmin(ji,jj,jk) = qnpmin
+               xqnpmax(ji,jj,jk) = qnpmax
+
+               ! Computation of the optimal allocation parameters
+               ! Based on the different papers by Pahlow et al., and Smith et al.
+               ! -----------------------------------------------------------------
+               znutlim = MAX( trb(ji,jj,jk,jpnh4) / zconc0nnh4,    &
+                 &         trb(ji,jj,jk,jpno3) / zconc0n)
+               fanano = MAX(0.01, MIN(0.99, 1. / ( SQRT(znutlim) + 1.) ) )
+               znutlim = trb(ji,jj,jk,jppo4) / zconc0npo4
+               fananop = MAX(0.01, MIN(0.99, 1. / ( SQRT(znutlim) + 1.) ) )
+               znutlim = biron(ji,jj,jk) / zconcnfe
+               fananof = MAX(0.01, MIN(0.99, 1. / ( SQRT(znutlim) + 1.) ) )
+               znutlim = MAX( trb(ji,jj,jk,jpnh4) / zconc0pnh4,    &
+                 &         trb(ji,jj,jk,jpno3) / zconc0p)
+               fapico = MAX(0.01, MIN(0.99, 1. / ( SQRT(znutlim) + 1.) ) )
+               znutlim = trb(ji,jj,jk,jppo4) / zconc0ppo4
+               fapicop = MAX(0.01, MIN(0.99, 1. / ( SQRT(znutlim) + 1.) ) )
+               znutlim = biron(ji,jj,jk) / zconcpfe
+               fapicof = MAX(0.01, MIN(0.99, 1. / ( SQRT(znutlim) + 1.) ) )
+               znutlim = MAX( trb(ji,jj,jk,jpnh4) / zconc1dnh4,    &
+                 &         trb(ji,jj,jk,jpno3) / zconc1d )
+               fadiat = MAX(0.01, MIN(0.99, 1. / ( SQRT(znutlim) + 1.) ) )
+               znutlim = trb(ji,jj,jk,jppo4) / zconc0dpo4
+               fadiatp = MAX(0.01, MIN(0.99, 1. / ( SQRT(znutlim) + 1.) ) )
+               znutlim = biron(ji,jj,jk) / zconcdfe
+               fadiatf = MAX(0.01, MIN(0.99, 1. / ( SQRT(znutlim) + 1.) ) )
+               !
+               ! Michaelis-Menten Limitation term for nutrients Small bacteria
+               ! -------------------------------------------------------------
+               zbactnh4 = trb(ji,jj,jk,jpnh4) / ( concbnh4 + trb(ji,jj,jk,jpnh4) )
+               zbactno3 = trb(ji,jj,jk,jpno3) / ( concbno3 + trb(ji,jj,jk,jpno3) ) * (1. - zbactnh4)
+               !
+               zlim1    = zbactno3 + zbactnh4
+               zlim2    = trb(ji,jj,jk,jppo4) / ( trb(ji,jj,jk,jppo4) + concbpo4)
+               zlim3    = biron(ji,jj,jk) / ( concbfe + biron(ji,jj,jk) )
+               zlim4    = trb(ji,jj,jk,jpdoc) / ( xkdoc   + trb(ji,jj,jk,jpdoc) )
+               xlimbacl(ji,jj,jk) = MIN( zlim1, zlim2, zlim3 )
+               xlimbac (ji,jj,jk) = xlimbacl(ji,jj,jk) * zlim4
+               !
+               ! Michaelis-Menten Limitation term for nutrients Small flagellates
+               ! -----------------------------------------------
+               zfalim = (1.-fanano) / fanano
+               xnanonh4(ji,jj,jk) = (1. - fanano) * trb(ji,jj,jk,jpnh4) / ( zfalim * zconc0nnh4 + trb(ji,jj,jk,jpnh4) )
+               xnanono3(ji,jj,jk) = (1. - fanano) * trb(ji,jj,jk,jpno3) / ( zfalim * zconc0n + trb(ji,jj,jk,jpno3) )  &
+               &                    * (1. - xnanonh4(ji,jj,jk))
+               !
+               zfalim = (1.-fananop) / fananop
+               xnanopo4(ji,jj,jk) = (1. - fananop) * trb(ji,jj,jk,jppo4) / ( trb(ji,jj,jk,jppo4) + zfalim * zconc0npo4 )
+               xnanodop(ji,jj,jk) = trb(ji,jj,jk,jpdop) / ( trb(ji,jj,jk,jpdop) + xkdoc )   &
+               &                    * ( 1.0 - xnanopo4(ji,jj,jk) )
+               xnanodop(ji,jj,jk) = 0.
+               !
+               zfalim = (1.-fananof) / fananof
+               xnanofer(ji,jj,jk) = (1. - fananof) * biron(ji,jj,jk) / ( biron(ji,jj,jk) + zfalim * zconcnfe )
+               !
+               zratiof   = trb(ji,jj,jk,jpnfe) * z1_trnphy
+               zqfemn = xcoef1 * znanochl + xcoef2 + xcoef3 * xnanono3(ji,jj,jk)
+               !
+               zration = trb(ji,jj,jk,jpnph) * z1_trnphy
+               zration = MIN(xqnnmax(ji,jj,jk), MAX( 2. * xqnnmin(ji,jj,jk), zration ))
+               fvnuptk(ji,jj,jk) = 1. / zpsiuptk * rno3 * 2. * xqnnmin(ji,jj,jk) / (zration + rtrn)  &
+               &                   * MAX(0., (1. - zratchl * znanochl / 12. ) )
+               !
+               zlim1    = max(0., (zration - 2. * xqnnmin(ji,jj,jk) )  &
+               &          / (xqnnmax(ji,jj,jk) - 2. * xqnnmin(ji,jj,jk) ) ) * xqnnmax(ji,jj,jk)  &
+               &          / (zration + rtrn)
+               zlim3    = MAX( 0.,( zratiof - zqfemn ) / qfnopt ) 
+               xlimnfe(ji,jj,jk) = MIN( 1., zlim3 )
+               xlimphy(ji,jj,jk) = MIN( 1., zlim1, zlim3 )
+               !
+               ! Michaelis-Menten Limitation term for nutrients picophytoplankton
+               ! ----------------------------------------------------------------
+               zfalim = (1.-fapico) / fapico 
+               xpiconh4(ji,jj,jk) = (1. - fapico) * trb(ji,jj,jk,jpnh4) / ( zfalim * zconc0pnh4 + trb(ji,jj,jk,jpnh4) )
+               xpicono3(ji,jj,jk) = (1. - fapico) * trb(ji,jj,jk,jpno3) / ( zfalim * zconc0p + trb(ji,jj,jk,jpno3) )  &
+               &                    * (1. - xpiconh4(ji,jj,jk))
+               !
+               zfalim = (1.-fapicop) / fapicop 
+               xpicopo4(ji,jj,jk) = (1. - fapicop) * trb(ji,jj,jk,jppo4) / ( trb(ji,jj,jk,jppo4) + zfalim * zconc0ppo4 )
+               xpicodop(ji,jj,jk) = trb(ji,jj,jk,jpdop) / ( trb(ji,jj,jk,jpdop) + xkdoc )   &
+               &                    * ( 1.0 - xpicopo4(ji,jj,jk) )
+               xpicodop(ji,jj,jk) = 0.
+               !
+               zfalim = (1.-fapicof) / fapicof
+               xpicofer(ji,jj,jk) = (1. - fapicof) * biron(ji,jj,jk) / ( biron(ji,jj,jk) + zfalim * zconcpfe )
+               !
+               zratiof   = trb(ji,jj,jk,jppfe) * z1_trnpic
+               zqfemp = xcoef1 * zpicochl + xcoef2 + xcoef3 * xpicono3(ji,jj,jk)
+               !
+               zration   = trb(ji,jj,jk,jpnpi) * z1_trnpic
+               zration = MIN(xqnpmax(ji,jj,jk), MAX( 2. * xqnpmin(ji,jj,jk), zration ))
+               fvpuptk(ji,jj,jk) = 1. / zpsiuptk * rno3 * 2. * xqnpmin(ji,jj,jk) / (zration + rtrn)  &
+               &                   * MAX(0., (1. - zratchl * zpicochl / 12. ) ) 
+               !
+               zlim1    = max(0., (zration - 2. * xqnpmin(ji,jj,jk) )  &
+               &          / (xqnpmax(ji,jj,jk) - 2. * xqnpmin(ji,jj,jk) ) ) * xqnpmax(ji,jj,jk)  &
+               &          / (zration + rtrn)
+               zlim3    = MAX( 0.,( zratiof - zqfemp ) / qfpopt )
+               xlimpfe(ji,jj,jk) = MIN( 1., zlim3 )
+               xlimpic(ji,jj,jk) = MIN( 1., zlim1, zlim3 )
+               !
+               !   Michaelis-Menten Limitation term for nutrients Diatoms
+               !   ------------------------------------------------------
+               zfalim = (1.-fadiat) / fadiat 
+               xdiatnh4(ji,jj,jk) = (1. - fadiat) * trb(ji,jj,jk,jpnh4) / ( zfalim * zconc1dnh4 + trb(ji,jj,jk,jpnh4) )
+               xdiatno3(ji,jj,jk) = (1. - fadiat) * trb(ji,jj,jk,jpno3) / ( zfalim * zconc1d + trb(ji,jj,jk,jpno3) )  &
+               &                    * (1. - xdiatnh4(ji,jj,jk))
+               !
+               zfalim = (1.-fadiatp) / fadiatp
+               xdiatpo4(ji,jj,jk) = (1. - fadiatp) * trb(ji,jj,jk,jppo4) / ( trb(ji,jj,jk,jppo4) + zfalim * zconc0dpo4 )
+               xdiatdop(ji,jj,jk) = trb(ji,jj,jk,jpdop) / ( trb(ji,jj,jk,jpdop) + xkdoc )  &
+               &                    * ( 1.0 - xdiatpo4(ji,jj,jk) )
+               xdiatdop(ji,jj,jk) = 0.
+               !
+               zfalim = (1.-fadiatf) / fadiatf
+               xdiatfer(ji,jj,jk) = (1. - fadiatf) * biron(ji,jj,jk) / ( biron(ji,jj,jk) + zfalim * zconcdfe )
+               !
+               zratiof   = trb(ji,jj,jk,jpdfe) * z1_trndia
+               zqfemd = xcoef1 * zdiatchl + xcoef2 + xcoef3 * xdiatno3(ji,jj,jk)
+               !
+               zration   = trb(ji,jj,jk,jpndi) * z1_trndia
+               zration = MIN(xqndmax(ji,jj,jk), MAX( 2. * xqndmin(ji,jj,jk), zration ))
+               fvduptk(ji,jj,jk) = 1. / zpsiuptk * rno3 * 2. * xqndmin(ji,jj,jk) / (zration + rtrn)   &
+               &                   * MAX(0., (1. - zratchl * zdiatchl / 12. ) ) 
+               !
+               zlim1    = max(0., (zration - 2. * xqndmin(ji,jj,jk) )    &
+               &          / (xqndmax(ji,jj,jk) - 2. * xqndmin(ji,jj,jk) ) )   &
+               &          * xqndmax(ji,jj,jk) / (zration + rtrn)
+               zlim3    = trb(ji,jj,jk,jpsil) / ( trb(ji,jj,jk,jpsil) + xksi(ji,jj) )
+               zlim4    = MAX( 0., ( zratiof - zqfemd ) / qfdopt )
+               xlimdfe(ji,jj,jk) = MIN( 1., zlim4 )
+               xlimdia(ji,jj,jk) = MIN( 1., zlim1, zlim3, zlim4 )
+               xlimsi(ji,jj,jk)  = MIN( zlim1, zlim4 )
+            END DO
+         END DO
+      END DO
+      !
+      ! Compute the phosphorus quota values. It is based on Litchmann et al., 2004 and Daines et al, 2013.
+      ! The relative contribution of three fonctional pools are computed: light harvesting apparatus, 
+      ! nutrient uptake pool and assembly machinery. DNA is assumed to represent 1% of the dry mass of 
+      ! phytoplankton (see Daines et al., 2013). 
+      ! --------------------------------------------------------------------------------------------------
+      DO jk = 1, jpkm1
+         DO jj = 1, jpj
+            DO ji = 1, jpi
+               ! Size estimation of nanophytoplankton
+               ! ------------------------------------
+               zfvn = 2. * fvnuptk(ji,jj,jk)
+               sizen(ji,jj,jk) = MAX(1., MIN(xsizern, 1.0 / ( MAX(rtrn, zfvn) ) ) )
+
+               ! N/P ratio of nanophytoplankton
+               ! ------------------------------
+               zfuptk = 0.23 * zfvn
+               zrpho = 2.24 * trb(ji,jj,jk,jpnch) / ( trb(ji,jj,jk,jpnph) * rno3 * 15. + rtrn )
+               zrass = 1. - 0.2 - zrpho - zfuptk
+               xqpnmax(ji,jj,jk) = ( zfuptk + zrpho ) * 0.0128 * 16. + zrass * 1./ 7.2 * 16.
+               xqpnmax(ji,jj,jk) = xqpnmax(ji,jj,jk) * trb(ji,jj,jk,jpnph) / ( trb(ji,jj,jk,jpphy) + rtrn ) + 0.13
+               xqpnmin(ji,jj,jk) = 0.13 + 0.23 * 0.0128 * 16.
+
+               ! Size estimation of picophytoplankton
+               ! ------------------------------------
+               zfvn = 2. * fvpuptk(ji,jj,jk)
+               sizep(ji,jj,jk) = MAX(1., MIN(xsizerp, 1.0 / ( MAX(rtrn, zfvn) ) ) )
+
+               ! N/P ratio of picophytoplankton
+               ! ------------------------------
+               zfuptk = 0.35 * zfvn
+               zrpho = 2.24 * trb(ji,jj,jk,jppch) / ( trb(ji,jj,jk,jpnpi) * rno3 * 15. + rtrn )
+               zrass = 1. - 0.4 - zrpho - zfuptk
+               xqppmax(ji,jj,jk) =  (zrpho + zfuptk) * 0.0128 * 16. + zrass * 1./ 9. * 16.
+               xqppmax(ji,jj,jk) = xqppmax(ji,jj,jk) * trb(ji,jj,jk,jpnpi) / ( trb(ji,jj,jk,jppic) + rtrn ) + 0.13
+               xqppmin(ji,jj,jk) = 0.13
+
+               ! Size estimation of diatoms
+               ! --------------------------
+               zfvn = 2. * fvduptk(ji,jj,jk)
+               sized(ji,jj,jk) = MAX(1., MIN(xsizerd, 1.0 / ( MAX(rtrn, zfvn) ) ) )
+               zcoef = trb(ji,jj,jk,jpdia) - MIN(xsizedia, trb(ji,jj,jk,jpdia) )
+               sized(ji,jj,jk) = 1. + xsizerd * zcoef *1E6 / ( 1. + zcoef * 1E6 )
+
+               ! N/P ratio of diatoms
+               ! --------------------
+               zfuptk = 0.2 * zfvn
+               zrpho = 2.24 * trb(ji,jj,jk,jpdch) / ( trb(ji,jj,jk,jpndi) * rno3 * 15. + rtrn )
+               zrass = 1. - 0.2 - zrpho - zfuptk
+               xqpdmax(ji,jj,jk) = ( zfuptk + zrpho ) * 0.0128 * 16. + zrass * 1./ 7.2 * 16.
+               xqpdmax(ji,jj,jk) = xqpdmax(ji,jj,jk) * trb(ji,jj,jk,jpndi) / ( trb(ji,jj,jk,jpdia) + rtrn ) + 0.13
+               xqpdmin(ji,jj,jk) = 0.13 + 0.2 * 0.0128 * 16.
+
+            END DO
+         END DO
+      END DO
+
+      ! Compute the fraction of nanophytoplankton that is made of calcifiers
+      ! --------------------------------------------------------------------
+      DO jk = 1, jpkm1
+         DO jj = 1, jpj
+            DO ji = 1, jpi
+               zlim1 =  trb(ji,jj,jk,jpnh4) / ( trb(ji,jj,jk,jpnh4) + concnnh4 ) + trb(ji,jj,jk,jpno3)    &
+               &        / ( trb(ji,jj,jk,jpno3) + concnno3 ) * ( 1.0 - trb(ji,jj,jk,jpnh4)   &
+               &        / ( trb(ji,jj,jk,jpnh4) + concnnh4 ) )
+               zlim2  = trb(ji,jj,jk,jppo4) / ( trb(ji,jj,jk,jppo4) + concnpo4 )
+               zlim3  = trb(ji,jj,jk,jpfer) / ( trb(ji,jj,jk,jpfer) +  5.E-11 ) 
+               ztem1  = MAX( 0., tsn(ji,jj,jk,jp_tem) )
+               ztem2  = tsn(ji,jj,jk,jp_tem) - 10.
+               zetot1 = MAX( 0., etot(ji,jj,jk) - 1.) / ( 4. + etot(ji,jj,jk) ) * 20. / ( 20. + etot(ji,jj,jk) ) 
+
+!               xfracal(ji,jj,jk) = caco3r * MIN( zlim1, zlim2, zlim3 )                  &
+               xfracal(ji,jj,jk) = caco3r                 &
+               &                   * ztem1 / ( 1. + ztem1 ) * MAX( 1., trb(ji,jj,jk,jpphy)*1E6 )   &
+                  &                * ( 1. + EXP(-ztem2 * ztem2 / 25. ) )         &
+                  &                * zetot1 * MIN( 1., 50. / ( hmld(ji,jj) + rtrn ) )
+               xfracal(ji,jj,jk) = MAX( 0.02, MIN( 0.8 , xfracal(ji,jj,jk) ) )
+            END DO
+         END DO
+      END DO
+      !
+      DO jk = 1, jpkm1
+         DO jj = 1, jpj
+            DO ji = 1, jpi
+               ! denitrification factor computed from O2 levels
+               nitrfac(ji,jj,jk) = MAX(  0.e0, 0.4 * ( 6.e-6  - trb(ji,jj,jk,jpoxy) )    &
+                  &                                / ( oxymin + trb(ji,jj,jk,jpoxy) )  )
+               nitrfac(ji,jj,jk) = MIN( 1., nitrfac(ji,jj,jk) )
+            END DO
+         END DO
+      END DO
+      !
+      IF( lk_iomput .AND. knt == nrdttrc ) THEN        ! save output diagnostics
+        IF( iom_use( "xfracal" ) ) CALL iom_put( "xfracal", xfracal(:,:,:) * tmask(:,:,:) )  ! euphotic layer deptht
+        IF( iom_use( "LNnut"   ) ) CALL iom_put( "LNnut"  , xlimphy(:,:,:) * tmask(:,:,:) )  ! Nutrient limitation term
+        IF( iom_use( "LPnut"   ) ) CALL iom_put( "LPnut"  , xlimpic(:,:,:) * tmask(:,:,:) )  ! Nutrient limitation term
+        IF( iom_use( "LDnut"   ) ) CALL iom_put( "LDnut"  , xlimdia(:,:,:) * tmask(:,:,:) )  ! Nutrient limitation term
+        IF( iom_use( "LNFe"    ) ) CALL iom_put( "LNFe"   , xlimnfe(:,:,:) * tmask(:,:,:) )  ! Iron limitation term
+        IF( iom_use( "LPFe"    ) ) CALL iom_put( "LPFe"   , xlimpfe(:,:,:) * tmask(:,:,:) )  ! Iron limitation term
+        IF( iom_use( "LDFe"    ) ) CALL iom_put( "LDFe"   , xlimdfe(:,:,:) * tmask(:,:,:) )  ! Iron limitation term
+        IF( iom_use( "SIZEN"   ) ) CALL iom_put( "SIZEN"  , sizen(:,:,:) * tmask(:,:,:) )  ! Iron limitation term
+        IF( iom_use( "SIZEP"   ) ) CALL iom_put( "SIZEP"  , sizep(:,:,:) * tmask(:,:,:) )  ! Iron limitation term
+        IF( iom_use( "SIZED"   ) ) CALL iom_put( "SIZED"  , sized(:,:,:) * tmask(:,:,:) )  ! Iron limitation term
+      ENDIF
+      !
+      IF( nn_timing == 1 )  CALL timing_stop('p5z_lim')
+      !
+   END SUBROUTINE p5z_lim
+
+   SUBROUTINE p5z_lim_init
+
+      !!----------------------------------------------------------------------
+      !!                  ***  ROUTINE p5z_lim_init  ***
+      !!
+      !! ** Purpose :   Initialization of nutrient limitation parameters
+      !!
+      !! ** Method  :   Read the nampislim and nampisquota namelists and check
+      !!      the parameters called at the first timestep (nittrc000)
+      !!
+      !! ** input   :   Namelist nampislim
+      !!
+      !!----------------------------------------------------------------------
+
+      NAMELIST/namp5zlim/ concnno3, concpno3, concdno3, concnnh4, concpnh4, concdnh4,  &
+         &                concnfer, concpfer, concdfer, concbfe, concnpo4, concppo4,   &
+         &                concdpo4, concbno3, concbnh4, concbpo4, xsizedia, xsizepic,  &
+         &                xsizephy, xsizern, xsizerp, xsizerd, xksi1, xksi2, xkdoc,    &
+         &                caco3r, oxymin
+
+      NAMELIST/namp5zquota/ qnnmin, qnnmax, qpnmin, qpnmax, qnpmin, qnpmax, qppmin,      &
+         &                  qppmax, qndmin, qndmax, qpdmin, qpdmax, qfnmax, qfpmax, qfdmax,  &
+         &                  qfnopt, qfpopt, qfdopt
+ 
+
+      INTEGER :: ios                 ! Local integer output status for namelist read
+
+      REWIND( numnatp_ref )              ! Namelist nampislim in reference namelist : Pisces nutrient limitation parameters
+      READ  ( numnatp_ref, namp5zlim, IOSTAT = ios, ERR = 901)
+901   IF( ios /= 0 ) CALL ctl_nam ( ios , 'nampislim in reference namelist', lwp )
+
+      REWIND( numnatp_cfg )              ! Namelist nampislim in configuration namelist : Pisces nutrient limitation parameters 
+      READ  ( numnatp_cfg, namp5zlim, IOSTAT = ios, ERR = 902 )
+902   IF( ios /= 0 ) CALL ctl_nam ( ios , 'nampislim in configuration namelist', lwp )
+      IF(lwm) WRITE ( numonp, namp5zlim )
+
+      IF(lwp) THEN                         ! control print
+         WRITE(numout,*) ' '
+         WRITE(numout,*) ' Namelist parameters for nutrient limitations, namp5zlim'
+         WRITE(numout,*) ' ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~'
+         WRITE(numout,*) '    mean rainratio                           caco3r    = ', caco3r
+         WRITE(numout,*) '    NO3 half saturation of nanophyto         concnno3  = ', concnno3
+         WRITE(numout,*) '    NO3 half saturation of picophyto         concpno3  = ', concpno3
+         WRITE(numout,*) '    NO3 half saturation of diatoms           concdno3  = ', concdno3
+         WRITE(numout,*) '    NH4 half saturation for phyto            concnnh4  = ', concnnh4
+         WRITE(numout,*) '    NH4 half saturation for pico             concpnh4  = ', concpnh4
+         WRITE(numout,*) '    NH4 half saturation for diatoms          concdnh4  = ', concdnh4
+         WRITE(numout,*) '    PO4 half saturation for phyto            concnpo4  = ', concnpo4
+         WRITE(numout,*) '    PO4 half saturation for pico             concppo4  = ', concppo4
+         WRITE(numout,*) '    PO4 half saturation for diatoms          concdpo4  = ', concdpo4
+         WRITE(numout,*) '    half saturation constant for Si uptake   xksi1     = ', xksi1
+         WRITE(numout,*) '    half saturation constant for Si/C        xksi2     = ', xksi2
+         WRITE(numout,*) '    half-sat. of DOC remineralization        xkdoc     = ', xkdoc
+         WRITE(numout,*) '    Iron half saturation for nanophyto       concnfer  = ', concnfer
+         WRITE(numout,*) '    Iron half saturation for picophyto       concpfer  = ', concpfer
+         WRITE(numout,*) '    Iron half saturation for diatoms         concdfer  = ', concdfer
+         WRITE(numout,*) '    size ratio for nanophytoplankton         xsizern   = ', xsizern
+         WRITE(numout,*) '    size ratio for picophytoplankton         xsizerp   = ', xsizerp
+         WRITE(numout,*) '    size ratio for diatoms                   xsizerd   = ', xsizerd
+         WRITE(numout,*) '    NO3 half saturation of bacteria          concbno3  = ', concbno3
+         WRITE(numout,*) '    NH4 half saturation for bacteria         concbnh4  = ', concbnh4
+         WRITE(numout,*) '    Minimum size criteria for diatoms        xsizedia  = ', xsizedia
+         WRITE(numout,*) '    Minimum size criteria for picophyto      xsizepic  = ', xsizepic
+         WRITE(numout,*) '    Minimum size criteria for nanophyto      xsizephy  = ', xsizephy
+         WRITE(numout,*) '    Fe half saturation for bacteria          concbfe   = ', concbfe
+         WRITE(numout,*) '    halk saturation constant for anoxia       oxymin   =' , oxymin
+      ENDIF
+
+      REWIND( numnatp_ref )              ! Namelist nampislim in reference namelist : Pisces nutrient limitation parameters
+      READ  ( numnatp_ref, namp5zquota, IOSTAT = ios, ERR = 903)
+903   IF( ios /= 0 ) CALL ctl_nam ( ios , 'nampisquota in reference namelist', lwp )
+
+      REWIND( numnatp_cfg )              ! Namelist nampislim in configuration namelist : Pisces nutrient limitation parameters 
+      READ  ( numnatp_cfg, namp5zquota, IOSTAT = ios, ERR = 904 )
+904   IF( ios /= 0 ) CALL ctl_nam ( ios , 'nampisquota in configuration namelist', lwp )
+      IF(lwm) WRITE ( numonp, namp5zquota )
+
+      IF(lwp) THEN                         ! control print
+         WRITE(numout,*) ' '
+         WRITE(numout,*) ' Namelist parameters for nutrient limitations, namp5zquota'
+         WRITE(numout,*) ' ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~'
+         WRITE(numout,*) '    optimal Fe quota for nano.               qfnopt    = ', qfnopt
+         WRITE(numout,*) '    optimal Fe quota for pico.               qfpopt    = ', qfpopt
+         WRITE(numout,*) '    Optimal Fe quota for diatoms             qfdopt    = ', qfdopt
+         WRITE(numout,*) '    Minimal N quota for nano                 qnnmin    = ', qnnmin
+         WRITE(numout,*) '    Maximal N quota for nano                 qnnmax    = ', qnnmax
+         WRITE(numout,*) '    Minimal P quota for nano                 qpnmin    = ', qpnmin
+         WRITE(numout,*) '    Maximal P quota for nano                 qpnmax    = ', qpnmax
+         WRITE(numout,*) '    Minimal N quota for pico                 qnpmin    = ', qnpmin
+         WRITE(numout,*) '    Maximal N quota for pico                 qnpmax    = ', qnpmax
+         WRITE(numout,*) '    Minimal P quota for pico                 qppmin    = ', qppmin
+         WRITE(numout,*) '    Maximal P quota for pico                 qppmax    = ', qppmax
+         WRITE(numout,*) '    Minimal N quota for diatoms              qndmin    = ', qndmin
+         WRITE(numout,*) '    Maximal N quota for diatoms              qndmax    = ', qndmax
+         WRITE(numout,*) '    Minimal P quota for diatoms              qpdmin    = ', qpdmin
+         WRITE(numout,*) '    Maximal P quota for diatoms              qpdmax    = ', qpdmax
+         WRITE(numout,*) '    Maximal Fe quota for nanophyto.          qfnmax    = ', qfnmax
+         WRITE(numout,*) '    Maximal Fe quota for picophyto.          qfpmax    = ', qfpmax
+         WRITE(numout,*) '    Maximal Fe quota for diatoms             qfdmax    = ', qfdmax
+      ENDIF
+
+      zpsino3 = 2.3 * rno3
+      zpsinh4 = 1.8 * rno3
+      zpsiuptk = 2.3 * rno3
+      !
+      nitrfac (:,:,:) = 0._wp
+      !
+   END SUBROUTINE p5z_lim_init
+
+   INTEGER FUNCTION p5z_lim_alloc()
+      !!----------------------------------------------------------------------
+      !!                     ***  ROUTINE p5z_lim_alloc  ***
+      !!----------------------------------------------------------------------
+      USE lib_mpp , ONLY: ctl_warn
+      INTEGER ::   ierr(2)        ! Local variables
+      !!----------------------------------------------------------------------
+      ierr(:) = 0
+
+      !*  Biological arrays for phytoplankton growth
+      ALLOCATE( xpicono3(jpi,jpj,jpk), xpiconh4(jpi,jpj,jpk),       &
+         &      xpicopo4(jpi,jpj,jpk), xpicodop(jpi,jpj,jpk),       &
+         &      xnanodop(jpi,jpj,jpk), xdiatdop(jpi,jpj,jpk),       &
+         &      xnanono3(jpi,jpj,jpk), xdiatno3(jpi,jpj,jpk),       &
+         &      xnanonh4(jpi,jpj,jpk), xdiatnh4(jpi,jpj,jpk),       &
+         &      xnanopo4(jpi,jpj,jpk), xdiatpo4(jpi,jpj,jpk),       &
+         &      xlimphy (jpi,jpj,jpk), xlimdia (jpi,jpj,jpk),       &
+         &      xlimnfe (jpi,jpj,jpk), xlimdfe (jpi,jpj,jpk),       &
+         &      xlimbac (jpi,jpj,jpk), xlimbacl(jpi,jpj,jpk),       &
+         &      xnanofer(jpi,jpj,jpk), xdiatfer(jpi,jpj,jpk),       &
+         &      xpicofer(jpi,jpj,jpk), xlimpfe (jpi,jpj,jpk),       &
+         &      fvnuptk (jpi,jpj,jpk), fvduptk (jpi,jpj,jpk),       &
+         &      fvpuptk (jpi,jpj,jpk), xlimpic (jpi,jpj,jpk),       &
+         &      xlimsi  (jpi,jpj,jpk), STAT=ierr(1) )
+
+      !*  Minimum/maximum quotas of phytoplankton
+      ALLOCATE( xqnnmin (jpi,jpj,jpk), xqnnmax(jpi,jpj,jpk),       &
+         &      xqpnmin (jpi,jpj,jpk), xqpnmax(jpi,jpj,jpk),       &
+         &      xqnpmin (jpi,jpj,jpk), xqnpmax(jpi,jpj,jpk),       &
+         &      xqppmin (jpi,jpj,jpk), xqppmax(jpi,jpj,jpk),       &
+         &      xqndmin (jpi,jpj,jpk), xqndmax(jpi,jpj,jpk),       &
+         &      xqpdmin (jpi,jpj,jpk), xqpdmax(jpi,jpj,jpk),     STAT=ierr(2) )
+      !
+      p5z_lim_alloc = MAXVAL( ierr )
+      !
+      IF( p5z_lim_alloc /= 0 ) CALL ctl_warn('p5z_lim_alloc : failed to allocate arrays.')
+      !
+   END FUNCTION p5z_lim_alloc
+   !!======================================================================
+END MODULE  p5zlim
Index: branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/NEMO/TOP_SRC/PISCES/P4Z/p5zmeso.F90
===================================================================
--- branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/NEMO/TOP_SRC/PISCES/P4Z/p5zmeso.F90	(revision 7391)
+++ branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/NEMO/TOP_SRC/PISCES/P4Z/p5zmeso.F90	(revision 7391)
@@ -0,0 +1,433 @@
+MODULE p5zmeso
+   !!======================================================================
+   !!                         ***  MODULE p5zmeso  ***
+   !! TOP :   PISCES Compute the sources/sinks for mesozooplankton
+   !!======================================================================
+   !! History :   1.0  !  2002     (O. Aumont) Original code
+   !!             2.0  !  2007-12  (C. Ethe, G. Madec)  F90
+   !!             3.4  !  2011-06  (O. Aumont, C. Ethe) Quota model for iron
+   !!             3.6  !  2015-05  (O. Aumont) PISCES quota
+   !!----------------------------------------------------------------------
+   !!   p5z_meso       :   Compute the sources/sinks for mesozooplankton
+   !!   p5z_meso_init  :   Initialization of the parameters for mesozooplankton
+   !!----------------------------------------------------------------------
+   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
+   PRIVATE
+
+   PUBLIC   p5z_meso              ! called in p5zbio.F90
+   PUBLIC   p5z_meso_init         ! called in trcsms_pisces.F90
+
+   !! * Shared module variables
+   REAL(wp), PUBLIC ::  part2        !: part of calcite not dissolved in mesozoo guts
+   REAL(wp), PUBLIC ::  xpref2c      !: mesozoo preference for POC 
+   REAL(wp), PUBLIC ::  xpref2p      !: mesozoo preference for nanophyto
+   REAL(wp), PUBLIC ::  xpref2z      !: mesozoo preference for zooplankton
+   REAL(wp), PUBLIC ::  xpref2d      !: mesozoo preference for Diatoms 
+   REAL(wp), PUBLIC ::  xpref2m      !: mesozoo preference for mesozoo
+   REAL(wp), PUBLIC ::  xthresh2zoo  !: zoo feeding threshold for mesozooplankton 
+   REAL(wp), PUBLIC ::  xthresh2dia  !: diatoms feeding threshold for mesozooplankton 
+   REAL(wp), PUBLIC ::  xthresh2phy  !: nanophyto feeding threshold for mesozooplankton 
+   REAL(wp), PUBLIC ::  xthresh2poc  !: poc feeding threshold for mesozooplankton 
+   REAL(wp), PUBLIC ::  xthresh2mes  !: mesozoo feeding threshold for mesozooplankton 
+   REAL(wp), PUBLIC ::  xthresh2     !: feeding threshold for mesozooplankton 
+   REAL(wp), PUBLIC ::  resrat2      !: exsudation rate of mesozooplankton
+   REAL(wp), PUBLIC ::  mzrat2       !: microzooplankton mortality rate 
+   REAL(wp), PUBLIC ::  grazrat2     !: maximal mesozoo grazing rate
+   REAL(wp), PUBLIC ::  xkgraz2      !: non assimilated fraction of P by mesozoo
+   REAL(wp), PUBLIC ::  unass2c      !: Efficicency of mesozoo growth 
+   REAL(wp), PUBLIC ::  unass2n      !: Efficicency of mesozoo growth 
+   REAL(wp), PUBLIC ::  unass2p      !: Efficicency of mesozoo growth 
+   REAL(wp), PUBLIC ::  epsher2      !: half sturation constant for grazing 2
+   REAL(wp), PUBLIC ::  ssigma2      !: Fraction excreted as semi-labile DOM
+   REAL(wp), PUBLIC ::  srespir2     !: Active respiration
+   REAL(wp), PUBLIC ::  grazflux     !: mesozoo flux feeding rate
+   LOGICAL,  PUBLIC ::  bmetexc2     !: Use of excess carbon for respiration
+
+   !!----------------------------------------------------------------------
+   !! NEMO/TOP 3.3 , NEMO Consortium (2010)
+   !! $Id: p4zmeso.F90 3160 2011-11-20 14:27:18Z cetlod $ 
+   !! Software governed by the CeCILL licence (NEMOGCM/NEMO_CeCILL.txt)
+   !!----------------------------------------------------------------------
+
+CONTAINS
+
+   SUBROUTINE p5z_meso( kt, knt )
+      !!---------------------------------------------------------------------
+      !!                     ***  ROUTINE p5z_meso  ***
+      !!
+      !! ** Purpose :   Compute the sources/sinks for mesozooplankton
+      !!
+      !! ** Method  : - ???
+      !!---------------------------------------------------------------------
+      INTEGER, INTENT(in) ::   kt, knt ! ocean time step
+      INTEGER  :: ji, jj, jk
+      REAL(wp) :: zcompadi, zcompaph, zcompapoc, zcompaz, zcompam, zcompames
+      REAL(wp) :: zgraze2, zdenom, zfact, zfood, zfoodlim, zproport
+      REAL(wp) :: zmortzgoc, zfracc, zfracn, zfracp, zfracfe, zratio, zratio2
+      REAL(wp) :: zepsherf, zepshert, zepsherv, zrespirc, zrespirn, zrespirp, zbasresb, zbasresi
+      REAL(wp) :: zgraztotc, zgraztotn, zgraztotp, zgraztotf, zbasresn, zbasresp, zbasresf
+      REAL(wp) :: zgradoc, zgradon, zgradop, zgratmp, zgradoct, zgradont, zgrareft, zgradopt
+      REAL(wp) :: zgrapoc, zgrapon, zgrapop, zgrapof, zprcaca, zmortz
+      REAL(wp) :: zexcess, zgrarem, zgraren, zgrarep, zgraref
+      REAL(wp) :: zbeta, zrespz, ztortz, zgrasratp, zgrasratn, zgrasratf
+      REAL(wp) :: ztmp1, ztmp2, ztmp3, ztmp4, ztmp5, ztmptot
+      REAL(wp) :: zgrazdc, zgrazz, zgrazm, zgrazpof, zgrazcal, zfracal
+      REAL(wp) :: zgraznc, zgrazpoc, zgrazpon, zgrazpop, zgraznf, zgrazdf
+      REAL(wp) :: zgraznp, zgraznn, zgrazdn, zgrazdp
+      REAL(wp) :: zgrazfffp, zgrazfffg, zgrazffep, zgrazffeg
+      REAL(wp) :: zgrazffnp, zgrazffng, zgrazffpp, zgrazffpg
+      CHARACTER (len=25) :: charout
+      REAL(wp) :: zrfact2, zmetexcess
+      REAL(wp), POINTER, DIMENSION(:,:,:) :: zgrazing, zw3d
+
+      !!---------------------------------------------------------------------
+      !
+      IF( nn_timing == 1 )  CALL timing_start('p5z_meso')
+      !
+      CALL wrk_alloc( jpi, jpj, jpk, zgrazing )
+      zgrazing(:,:,:) = 0._wp
+
+      zmetexcess = 0.0
+      IF ( bmetexc2 ) zmetexcess = 1.0
+
+      DO jk = 1, jpkm1
+         DO jj = 1, jpj
+            DO ji = 1, jpi
+               zcompam   = MAX( ( trb(ji,jj,jk,jpmes) - 1.e-9 ), 0.e0 )
+               zfact     = xstep * tgfunc2(ji,jj,jk) * zcompam
+
+               !   Michaelis-Menten mortality rates of mesozooplankton
+               !   ---------------------------------------------------
+               zrespz   = resrat2 * zfact * ( trb(ji,jj,jk,jpmes) / ( xkmort + trb(ji,jj,jk,jpmes) )  &
+               &          + 3. * nitrfac(ji,jj,jk) )
+
+               !   Zooplankton mortality. A square function has been selected with
+               !   no real reason except that it seems to be more stable and may mimic predation
+               !   ---------------------------------------------------------------
+               ztortz   = mzrat2 * 1.e6 * zfact * trb(ji,jj,jk,jpmes)
+
+               !   Computation of the abundance of the preys
+               !   A threshold can be specified in the namelist
+               !   --------------------------------------------
+               zcompadi  = MAX( ( trb(ji,jj,jk,jpdia) - xthresh2dia ), 0.e0 )
+               zcompaz   = MAX( ( trb(ji,jj,jk,jpzoo) - xthresh2zoo ), 0.e0 )
+               zcompaph  = MAX( ( trb(ji,jj,jk,jpphy) - xthresh2phy ), 0.e0 )
+               zcompapoc = MAX( ( trb(ji,jj,jk,jppoc) - xthresh2poc ), 0.e0 )
+               zcompames = MAX( ( trb(ji,jj,jk,jpmes) - xthresh2mes ), 0.e0 )
+
+               !   Mesozooplankton grazing
+               !   ------------------------
+               zfood     = xpref2d * zcompadi + xpref2z * zcompaz + xpref2p * zcompaph + xpref2c * zcompapoc   &
+               &           + xpref2m * zcompames 
+               zfoodlim  = MAX( 0., zfood - MIN( 0.5 * zfood, xthresh2 ) )
+               zdenom    = zfoodlim / ( xkgraz2 + zfoodlim )
+               zgraze2   = grazrat2 * xstep * tgfunc2(ji,jj,jk) * trb(ji,jj,jk,jpmes) 
+
+               !   An active switching parameterization is used here.
+               !   We don't use the KTW parameterization proposed by 
+               !   Vallina et al. because it tends to produce to steady biomass
+               !   composition and the variance of Chl is too low as it grazes
+               !   too strongly on winning organisms. Thus, instead of a square
+               !   a 1.5 power value is used which decreases the pressure on the
+               !   most abundant species
+               !   ------------------------------------------------------------  
+               ztmp1 = xpref2p * zcompaph**1.5
+               ztmp2 = xpref2m * zcompames**1.5
+               ztmp3 = xpref2c * zcompapoc**1.5
+               ztmp4 = xpref2d * zcompadi**1.5
+               ztmp5 = xpref2z * zcompaz**1.5
+               ztmptot = ztmp1 + ztmp2 + ztmp3 + ztmp4 + ztmp5 + rtrn
+               ztmp1 = ztmp1 / ztmptot
+               ztmp2 = ztmp2 / ztmptot
+               ztmp3 = ztmp3 / ztmptot
+               ztmp4 = ztmp4 / ztmptot
+               ztmp5 = ztmp5 / ztmptot
+
+               !   Mesozooplankton regular grazing on the different preys
+               !   ------------------------------------------------------
+               zgrazdc   = zgraze2 * ztmp4 * zdenom
+               zgrazdn   = zgrazdc * trb(ji,jj,jk,jpndi) / ( trb(ji,jj,jk,jpdia) + rtrn)
+               zgrazdp   = zgrazdc * trb(ji,jj,jk,jppdi) / ( trb(ji,jj,jk,jpdia) + rtrn)
+               zgrazdf   = zgrazdc * trb(ji,jj,jk,jpdfe) / ( trb(ji,jj,jk,jpdia) + rtrn)
+               zgrazz    = zgraze2 * ztmp5 * zdenom
+               zgrazm    = zgraze2 * ztmp2 * zdenom
+               zgraznc   = zgraze2 * ztmp1 * zdenom
+               zgraznn   = zgraznc * trb(ji,jj,jk,jpnph) / ( trb(ji,jj,jk,jpphy) + rtrn)
+               zgraznp   = zgraznc * trb(ji,jj,jk,jppph) / ( trb(ji,jj,jk,jpphy) + rtrn)
+               zgraznf   = zgraznc * trb(ji,jj,jk,jpnfe) / ( trb(ji,jj,jk,jpphy) + rtrn)
+               zgrazpoc  = zgraze2 * ztmp3 * zdenom
+               zgrazpon  = zgrazpoc * trb(ji,jj,jk,jppon) / ( trb(ji,jj,jk,jppoc) + rtrn)
+               zgrazpop  = zgrazpoc * trb(ji,jj,jk,jppop) / ( trb(ji,jj,jk,jppoc) + rtrn)
+               zgrazpof  = zgrazpoc * trb(ji,jj,jk,jpsfe) / ( trb(ji,jj,jk,jppoc) + rtrn)
+
+               !   Mesozooplankton flux feeding on GOC
+               !   ----------------------------------
+               zgrazffeg = grazflux  * xstep * wsbio4(ji,jj,jk)      &
+               &           * tgfunc2(ji,jj,jk) * trb(ji,jj,jk,jpgoc) * trb(ji,jj,jk,jpmes)
+               zgrazfffg = zgrazffeg * trb(ji,jj,jk,jpbfe) / (trb(ji,jj,jk,jpgoc) + rtrn)
+               zgrazffng = zgrazffeg * trb(ji,jj,jk,jpgon) / (trb(ji,jj,jk,jpgoc) + rtrn)
+               zgrazffpg = zgrazffeg * trb(ji,jj,jk,jpgop) / (trb(ji,jj,jk,jpgoc) + rtrn)
+               zgrazffep = grazflux  * xstep *  wsbio3(ji,jj,jk)     &
+               &           * tgfunc2(ji,jj,jk) * trb(ji,jj,jk,jppoc) * trb(ji,jj,jk,jpmes)
+               zgrazfffp = zgrazffep * trb(ji,jj,jk,jpsfe) / (trb(ji,jj,jk,jppoc) + rtrn)
+               zgrazffnp = zgrazffep * trb(ji,jj,jk,jppon) / (trb(ji,jj,jk,jppoc) + rtrn)
+               zgrazffpp = zgrazffep * trb(ji,jj,jk,jppop) / (trb(ji,jj,jk,jppoc) + rtrn)
+               !
+               zgraztotc  = zgrazdc + zgrazz + zgraznc + zgrazm + zgrazpoc + zgrazffep + zgrazffeg
+
+               !   Compute the proportion of filter feeders
+               !   ----------------------------------------  
+               zproport  = (zgrazffep + zgrazffeg)/(rtrn + zgraztotc)
+
+               !   Compute fractionation of aggregates. It is assumed that 
+               !   diatoms based aggregates are more prone to fractionation
+               !   since they are more porous (marine snow instead of fecal pellets)
+               !   ----------------------------------------------------------------
+               zratio    = trb(ji,jj,jk,jpgsi) / ( trb(ji,jj,jk,jpgoc) + rtrn )
+               zratio2   = zratio * zratio
+               zfracc    = zproport * grazflux  * xstep * wsbio4(ji,jj,jk)      &
+               &          * trb(ji,jj,jk,jpgoc) * trb(ji,jj,jk,jpmes)          &
+               &          * ( 0.2 + 3.8 * zratio2 / ( 1.**2 + zratio2 ) )
+               zfracfe   = zfracc * trb(ji,jj,jk,jpbfe) / (trb(ji,jj,jk,jpgoc) + rtrn)
+               zfracn    = zfracc * trb(ji,jj,jk,jpgon) / (trb(ji,jj,jk,jpgoc) + rtrn)
+               zfracp    = zfracc * trb(ji,jj,jk,jpgop) / (trb(ji,jj,jk,jpgoc) + rtrn)
+
+               zgrazffep = zproport * zgrazffep   ;   zgrazffeg = zproport * zgrazffeg
+               zgrazfffp = zproport * zgrazfffp   ;   zgrazfffg = zproport * zgrazfffg
+               zgrazffnp = zproport * zgrazffnp   ;   zgrazffng = zproport * zgrazffng
+               zgrazffpp = zproport * zgrazffpp   ;   zgrazffpg = zproport * zgrazffpg
+
+               zgraztotc  = zgrazdc + zgrazz + zgraznc + zgrazm + zgrazpoc + zgrazffep + zgrazffeg
+               zgraztotf  = zgrazdf + zgraznf + ( zgrazz + zgrazm ) * ferat3 + zgrazpof &
+               &            + zgrazfffp + zgrazfffg
+               zgraztotn  = zgrazdn + (zgrazm + zgrazz) * no3rat3 + zgraznn + zgrazpon  &
+               &            + zgrazffnp + zgrazffng
+               zgraztotp  = zgrazdp + (zgrazz + zgrazm) * po4rat3 + zgraznp + zgrazpop  &
+               &            + zgrazffpp + zgrazffpg
+
+
+               ! Total grazing ( grazing by microzoo is already computed in p5zmicro )
+               zgrazing(ji,jj,jk) = zgraztotc
+
+               !   Stoichiometruc ratios of the food ingested by zooplanton 
+               !   --------------------------------------------------------
+               zgrasratf  =  (zgraztotf + rtrn) / ( zgraztotc + rtrn )
+               zgrasratn  =  (zgraztotn + rtrn) / ( zgraztotc + rtrn )
+               zgrasratp  =  (zgraztotp + rtrn) / ( zgraztotc + rtrn )
+
+               !   Growth efficiency is made a function of the quality 
+               !   and the quantity of the preys
+               !   ---------------------------------------------------
+               zepshert  = MIN( 1., zgrasratn/ no3rat3, zgrasratp/ po4rat3, zgrasratf / ferat3)
+               zbeta = 1./ (epsher2 - 0.2)
+               zepsherf = 0.2 + 1./ (zbeta + 0.04 * 12. * zfood *1E6 )
+               zepsherv  = zepsherf * zepshert
+
+               !   Respiration of mesozooplankton
+               !   Excess carbon in the food is used preferentially
+               !   ----------------  ------------------------------
+               zexcess  = zgraztotc * zepsherf * (1.0 - zepshert) * zmetexcess 
+               zbasresb = MAX(0., zrespz - zexcess)
+               zbasresi = zexcess + MIN(0., zrespz - zexcess)
+               zrespirc = srespir2 * zepsherv * zgraztotc + zbasresb
+
+               !   When excess carbon is used, the other elements in excess
+               !   are also used proportionally to their abundance
+               !   --------------------------------------------------------
+               zexcess  = ( zgrasratn/ no3rat3 - zepshert ) / ( 1.0 - zepshert + rtrn)
+               zbasresn = zbasresi * zexcess * zgrasratn
+               zexcess  = ( zgrasratp/ po4rat3 - zepshert ) / ( 1.0 - zepshert + rtrn)
+               zbasresp = zbasresi * zexcess * zgrasratp
+               zexcess  = ( zgrasratf/ ferat3 - zepshert ) / ( 1.0 - zepshert + rtrn)
+               zbasresf = zbasresi * zexcess * zgrasratf
+
+               !   Voiding of the excessive elements as organic matter
+               !   --------------------------------------------------------
+               zgradoct = (1. - unass2c - zepsherv) * zgraztotc - zbasresi
+               zgradont = (1. - unass2n) * zgraztotn - zepsherv * no3rat3 * zgraztotc - zbasresn
+               zgradopt = (1. - unass2p) * zgraztotp - zepsherv * po4rat3 * zgraztotc - zbasresp
+               zgrareft = (1. - unass2c) * zgraztotf - zepsherv * ferat3 * zgraztotc - zbasresf
+               ztmp1   = ( 1. - epsher2 - unass2c ) /( 1. - 0.8 * epsher2 ) * ztortz
+               zgradoc = (zgradoct + ztmp1) * ssigma2
+               zgradon = (zgradont + no3rat3 * ztmp1) * ssigma2
+               zgradop = (zgradopt + po4rat3 * ztmp1) * ssigma2
+               zgratmp = 0.2 * epsher2 /( 1. - 0.8 * epsher2 ) * ztortz
+
+               !  Since only semilabile DOM is represented in PISCES
+               !  part of DOM is in fact labile and is then released
+               !  as dissolved inorganic compounds (ssigma2)
+               !  --------------------------------------------------
+               zgrarem = zgratmp + ( zgradoct + ztmp1 ) * (1.0 - ssigma2)
+               zgraren = no3rat3 * zgratmp + ( zgradont + no3rat3 * ztmp1 ) * (1.0 - ssigma2)
+               zgrarep = po4rat3 * zgratmp + ( zgradopt + po4rat3 * ztmp1 ) * (1.0 - ssigma2)
+               zgraref = zgrareft + ferat3 * ( ztmp1 + zgratmp )
+
+               !   Defecation as a result of non assimilated products
+               !   --------------------------------------------------
+               zgrapoc  = zgraztotc * unass2c + unass2c / ( 1. - 0.8 * epsher2 ) * ztortz
+               zgrapon  = zgraztotn * unass2n + no3rat3 * unass2n / ( 1. - 0.8 * epsher2 ) * ztortz
+               zgrapop  = zgraztotp * unass2p + po4rat3 * unass2p / ( 1. - 0.8 * epsher2 ) * ztortz
+               zgrapof  = zgraztotf * unass2c + ferat3  * unass2c / ( 1. - 0.8 * epsher2 ) * ztortz
+
+               !  Addition of respiration to the release of inorganic nutrients
+               !  -------------------------------------------------------------
+               zgrarem = zgrarem + zbasresi + zrespirc
+               zgraren = zgraren + zbasresn + zrespirc * no3rat3
+               zgrarep = zgrarep + zbasresp + zrespirc * po4rat3
+               zgraref = zgraref + zbasresf + zrespirc * ferat3
+
+               !   Update the arrays TRA which contain the biological sources and
+               !   sinks
+               !   --------------------------------------------------------------
+               tra(ji,jj,jk,jppo4) = tra(ji,jj,jk,jppo4) + zgrarep 
+               tra(ji,jj,jk,jpnh4) = tra(ji,jj,jk,jpnh4) + zgraren
+               tra(ji,jj,jk,jpdoc) = tra(ji,jj,jk,jpdoc) + zgradoc
+               !
+               IF( ln_ligand ) tra(ji,jj,jk,jplgw) = tra(ji,jj,jk,jplgw) + zgradoc * ldocz
+               !
+               tra(ji,jj,jk,jpdon) = tra(ji,jj,jk,jpdon) + zgradon
+               tra(ji,jj,jk,jpdop) = tra(ji,jj,jk,jpdop) + zgradop
+               tra(ji,jj,jk,jpoxy) = tra(ji,jj,jk,jpoxy) - o2ut * zgrarem
+               tra(ji,jj,jk,jpfer) = tra(ji,jj,jk,jpfer) + zgraref
+               tra(ji,jj,jk,jpdic) = tra(ji,jj,jk,jpdic) + zgrarem
+               tra(ji,jj,jk,jptal) = tra(ji,jj,jk,jptal) + rno3 * zgraren
+               tra(ji,jj,jk,jpmes) = tra(ji,jj,jk,jpmes) + zepsherv * zgraztotc - zrespirc   &
+               &                     - ztortz - zgrazm
+               tra(ji,jj,jk,jpdia) = tra(ji,jj,jk,jpdia) - zgrazdc
+               tra(ji,jj,jk,jpndi) = tra(ji,jj,jk,jpndi) - zgrazdn
+               tra(ji,jj,jk,jppdi) = tra(ji,jj,jk,jppdi) - zgrazdp
+               tra(ji,jj,jk,jpdfe) = tra(ji,jj,jk,jpdfe) - zgrazdf
+               tra(ji,jj,jk,jpzoo) = tra(ji,jj,jk,jpzoo) - zgrazz
+               tra(ji,jj,jk,jpphy) = tra(ji,jj,jk,jpphy) - zgraznc
+               tra(ji,jj,jk,jpnph) = tra(ji,jj,jk,jpnph) - zgraznn
+               tra(ji,jj,jk,jppph) = tra(ji,jj,jk,jppph) - zgraznp
+               tra(ji,jj,jk,jpnfe) = tra(ji,jj,jk,jpnfe) - zgraznf
+               tra(ji,jj,jk,jpnch) = tra(ji,jj,jk,jpnch) - zgraznc * trb(ji,jj,jk,jpnch) / ( trb(ji,jj,jk,jpphy) + rtrn )
+               tra(ji,jj,jk,jpdch) = tra(ji,jj,jk,jpdch) - zgrazdc * trb(ji,jj,jk,jpdch) / ( trb(ji,jj,jk,jpdia) + rtrn )
+               tra(ji,jj,jk,jpdsi) = tra(ji,jj,jk,jpdsi) - zgrazdc * trb(ji,jj,jk,jpdsi) / ( trb(ji,jj,jk,jpdia) + rtrn )
+               tra(ji,jj,jk,jpgsi) = tra(ji,jj,jk,jpgsi) + zgrazdc * trb(ji,jj,jk,jpdsi) / ( trb(ji,jj,jk,jpdia) + rtrn )
+
+               tra(ji,jj,jk,jppoc) = tra(ji,jj,jk,jppoc) - zgrazpoc - zgrazffep + zfracc
+               prodpoc(ji,jj,jk) = prodpoc(ji,jj,jk) + zfracc
+               conspoc(ji,jj,jk) = conspoc(ji,jj,jk) - zgrazpoc - zgrazffep
+               tra(ji,jj,jk,jppon) = tra(ji,jj,jk,jppon) - zgrazpon - zgrazffnp + zfracn
+               tra(ji,jj,jk,jppop) = tra(ji,jj,jk,jppop) - zgrazpop - zgrazffpp + zfracp
+               tra(ji,jj,jk,jpgoc) = tra(ji,jj,jk,jpgoc) - zgrazffeg + zgrapoc - zfracc
+               prodgoc(ji,jj,jk) = prodgoc(ji,jj,jk) + zgrapoc
+               consgoc(ji,jj,jk) = consgoc(ji,jj,jk) - zgrazffeg - zfracc
+               tra(ji,jj,jk,jpgon) = tra(ji,jj,jk,jpgon) - zgrazffng + zgrapon - zfracn
+               tra(ji,jj,jk,jpgop) = tra(ji,jj,jk,jpgop) - zgrazffpg + zgrapop - zfracp
+               tra(ji,jj,jk,jpsfe) = tra(ji,jj,jk,jpsfe) - zgrazpof - zgrazfffp + zfracfe
+               tra(ji,jj,jk,jpbfe) = tra(ji,jj,jk,jpbfe) - zgrazfffg + zgrapof - zfracfe
+               zfracal = trb(ji,jj,jk,jpcal) / ( trb(ji,jj,jk,jpgoc) + rtrn )
+               zgrazcal = zgrazffeg * (1. - part2) * zfracal
+
+               !  calcite production
+               !  ------------------
+               zprcaca = xfracal(ji,jj,jk) * zgraznc
+               prodcal(ji,jj,jk) = prodcal(ji,jj,jk) + zprcaca  ! prodcal=prodcal(nanophy)+prodcal(microzoo)+prodcal(mesozoo)
+               zprcaca = part2 * zprcaca
+               tra(ji,jj,jk,jpdic) = tra(ji,jj,jk,jpdic) + zgrazcal - zprcaca
+               tra(ji,jj,jk,jptal) = tra(ji,jj,jk,jptal) + 2. * ( zgrazcal - zprcaca )
+               tra(ji,jj,jk,jpcal) = tra(ji,jj,jk,jpcal) - zgrazcal + zprcaca
+            END DO
+         END DO
+      END DO
+      !
+      IF( lk_iomput .AND. knt == nrdttrc ) THEN
+         CALL wrk_alloc( jpi, jpj, jpk, zw3d )
+         IF( iom_use( "GRAZ2" ) ) THEN
+            zw3d(:,:,:) = zgrazing(:,:,:) * 1.e+3 * rfact2r * tmask(:,:,:)  !   Total grazing of phyto by zooplankton
+            CALL iom_put( "GRAZ2", zw3d )
+         ENDIF
+         IF( iom_use( "PCAL" ) ) THEN
+            zw3d(:,:,:) = prodcal(:,:,:) * 1.e+3 * rfact2r * tmask(:,:,:)   !  Calcite production
+            CALL iom_put( "PCAL", zw3d )
+         ENDIF
+         CALL wrk_dealloc( jpi, jpj, jpk, zw3d )
+      ENDIF
+      !
+      IF(ln_ctl)   THEN  ! print mean trends (used for debugging)
+        WRITE(charout, FMT="('meso')")
+        CALL prt_ctl_trc_info(charout)
+        CALL prt_ctl_trc(tab4d=tra, mask=tmask, clinfo=ctrcnm)
+      ENDIF
+      !
+      CALL wrk_dealloc( jpi, jpj, jpk, zgrazing )
+      !
+      IF( nn_timing == 1 )  CALL timing_stop('p5z_meso')
+      !
+   END SUBROUTINE p5z_meso
+
+   SUBROUTINE p5z_meso_init
+
+      !!----------------------------------------------------------------------
+      !!                  ***  ROUTINE p5z_meso_init  ***
+      !!
+      !! ** Purpose :   Initialization of mesozooplankton parameters
+      !!
+      !! ** Method  :   Read the nampismes namelist and check the parameters
+      !!      called at the first timestep (nittrc000)
+      !!
+      !! ** input   :   Namelist nampismes
+      !!
+      !!----------------------------------------------------------------------
+
+      NAMELIST/namp5zmes/part2, bmetexc2, grazrat2, resrat2, mzrat2, xpref2c, xpref2p, xpref2z, &
+         &                xpref2m, xpref2d, xthresh2dia, xthresh2phy, xthresh2zoo, xthresh2poc, &
+         &                xthresh2mes, xthresh2, xkgraz2, epsher2, ssigma2, unass2c, &
+      &                   unass2n, unass2p, srespir2, grazflux
+
+      INTEGER :: ios                 ! Local integer output status for namelist read
+
+      REWIND( numnatp_ref )              ! Namelist nampismes in reference namelist : Pisces mesozooplankton
+      READ  ( numnatp_ref, namp5zmes, IOSTAT = ios, ERR = 901)
+901   IF( ios /= 0 ) CALL ctl_nam ( ios , 'nampismes in reference namelist', lwp )
+
+      REWIND( numnatp_cfg )              ! Namelist nampismes in configuration namelist : Pisces mesozooplankton
+      READ  ( numnatp_cfg, namp5zmes, IOSTAT = ios, ERR = 902 )
+902   IF( ios /= 0 ) CALL ctl_nam ( ios , 'nampismes in configuration namelist', lwp )
+      IF(lwm) WRITE ( numonp, namp5zmes )
+
+
+      IF(lwp) THEN                         ! control print
+         WRITE(numout,*) ' ' 
+         WRITE(numout,*) ' Namelist parameters for mesozooplankton, namp5zmes'
+         WRITE(numout,*) ' ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~'
+         WRITE(numout,*) '    part of calcite not dissolved in mesozoo guts  part2       = ', part2
+         WRITE(numout,*) '    mesozoo preference for nano.                   xpref2p     = ', xpref2p
+         WRITE(numout,*) '    mesozoo preference for diatoms                 xpref2d     = ', xpref2d
+         WRITE(numout,*) '    mesozoo preference for zoo                     xpref2z     = ', xpref2z
+         WRITE(numout,*) '    mesozoo preference for mesozoo                 xpref2m     = ', xpref2m
+         WRITE(numout,*) '    mesozoo preference for poc                     xpref2c     = ', xpref2c
+         WRITE(numout,*) '    microzoo feeding threshold  for mesozoo        xthresh2zoo = ', xthresh2zoo
+         WRITE(numout,*) '    diatoms feeding threshold  for mesozoo         xthresh2dia = ', xthresh2dia
+         WRITE(numout,*) '    nanophyto feeding threshold for mesozoo        xthresh2phy = ', xthresh2phy
+         WRITE(numout,*) '    poc feeding threshold for mesozoo              xthresh2poc = ', xthresh2poc
+         WRITE(numout,*) '    mesozoo feeding threshold for mesozoo          xthresh2mes = ', xthresh2mes
+         WRITE(numout,*) '    feeding threshold for mesozooplankton          xthresh2    = ', xthresh2
+         WRITE(numout,*) '    exsudation rate of mesozooplankton             resrat2     = ', resrat2
+         WRITE(numout,*) '    mesozooplankton mortality rate                 mzrat2      = ', mzrat2
+         WRITE(numout,*) '    maximal mesozoo grazing rate                   grazrat2    = ', grazrat2
+         WRITE(numout,*) '    mesozoo flux feeding rate                      grazflux    = ', grazflux
+         WRITE(numout,*) '    C egested fraction of food by mesozoo          unass2c     = ', unass2c
+         WRITE(numout,*) '    C egested fraction of food by mesozoo          unass2n     = ', unass2n
+         WRITE(numout,*) '    C egested fraction of food by mesozoo          unass2p     = ', unass2p
+         WRITE(numout,*) '    Efficicency of Mesozoo growth                  epsher2     = ', epsher2
+         WRITE(numout,*) '    Fraction excreted as semi-labile DOM           ssigma2     = ', ssigma2
+         WRITE(numout,*) '    Active respiration                             srespir2    = ', srespir2
+         WRITE(numout,*) '    half sturation constant for grazing 2          xkgraz2     = ', xkgraz2
+         WRITE(numout,*) '    Use excess carbon for respiration              bmetexc2    = ', bmetexc2
+      ENDIF
+
+
+   END SUBROUTINE p5z_meso_init
+
+   !!======================================================================
+END MODULE  p5zmeso
Index: branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/NEMO/TOP_SRC/PISCES/P4Z/p5zmicro.F90
===================================================================
--- branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/NEMO/TOP_SRC/PISCES/P4Z/p5zmicro.F90	(revision 7391)
+++ branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/NEMO/TOP_SRC/PISCES/P4Z/p5zmicro.F90	(revision 7391)
@@ -0,0 +1,375 @@
+MODULE p5zmicro
+   !!======================================================================
+   !!                         ***  MODULE p5zmicro  ***
+   !! TOP :   PISCES Compute the sources/sinks for microzooplankton
+   !!======================================================================
+   !! History :   1.0  !  2004     (O. Aumont) Original code
+   !!             2.0  !  2007-12  (C. Ethe, G. Madec)  F90
+   !!             3.4  !  2011-06  (O. Aumont, C. Ethe) Quota model for iron
+   !!             3.6  !  2015-05  (O. Aumont) PISCES quota
+   !!----------------------------------------------------------------------
+   !!   p5z_micro       :   Compute the sources/sinks for microzooplankton
+   !!   p5z_micro_init  :   Initialize and read the appropriate namelist
+   !!----------------------------------------------------------------------
+   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 p5zlim          !  Phytoplankton limitation terms
+   USE iom             !  I/O manager
+   USE prtctl_trc      !  print control for debugging
+
+   IMPLICIT NONE
+   PRIVATE
+
+   PUBLIC   p5z_micro         ! called in p5zbio.F90
+   PUBLIC   p5z_micro_init    ! called in trcsms_pisces.F90
+
+   !! * Shared module variables
+   REAL(wp), PUBLIC ::  part        !: part of calcite not dissolved in microzoo guts
+   REAL(wp), PUBLIC ::  xprefc     !: microzoo preference for POC 
+   REAL(wp), PUBLIC ::  xprefn     !: microzoo preference for nanophyto
+   REAL(wp), PUBLIC ::  xprefp     !: microzoo preference for picophyto
+   REAL(wp), PUBLIC ::  xprefd     !: microzoo preference for diatoms
+   REAL(wp), PUBLIC ::  xprefz     !: microzoo preference for microzoo
+   REAL(wp), PUBLIC ::  xthreshdia  !: diatoms feeding threshold for microzooplankton 
+   REAL(wp), PUBLIC ::  xthreshpic  !: picophyto feeding threshold for microzooplankton 
+   REAL(wp), PUBLIC ::  xthreshphy  !: nanophyto threshold for microzooplankton 
+   REAL(wp), PUBLIC ::  xthreshzoo  !: microzoo threshold for microzooplankton 
+   REAL(wp), PUBLIC ::  xthreshpoc  !: poc threshold for microzooplankton 
+   REAL(wp), PUBLIC ::  xthresh     !: feeding threshold for microzooplankton 
+   REAL(wp), PUBLIC ::  resrat      !: exsudation rate of microzooplankton
+   REAL(wp), PUBLIC ::  mzrat       !: microzooplankton mortality rate 
+   REAL(wp), PUBLIC ::  grazrat     !: maximal microzoo grazing rate
+   REAL(wp), PUBLIC ::  xkgraz      !: non assimilated fraction of P by microzoo
+   REAL(wp), PUBLIC ::  unassc      !: Efficicency of microzoo growth 
+   REAL(wp), PUBLIC ::  unassn      !: Efficicency of microzoo growth 
+   REAL(wp), PUBLIC ::  unassp      !: Efficicency of microzoo growth 
+   REAL(wp), PUBLIC ::  epsher      !: half sturation constant for grazing 1 
+   REAL(wp), PUBLIC ::  srespir     !: half sturation constant for grazing 1 
+   REAL(wp), PUBLIC ::  ssigma      !: Fraction excreted as semi-labile DOM
+   LOGICAL,  PUBLIC ::  bmetexc     !: Use of excess carbon for respiration
+
+   !!----------------------------------------------------------------------
+   !! NEMO/TOP 3.3 , NEMO Consortium (2010)
+   !! $Id: p4zmicro.F90 3160 2011-11-20 14:27:18Z cetlod $ 
+   !! Software governed by the CeCILL licence (NEMOGCM/NEMO_CeCILL.txt)
+   !!----------------------------------------------------------------------
+
+CONTAINS
+
+   SUBROUTINE p5z_micro( kt, knt )
+      !!---------------------------------------------------------------------
+      !!                     ***  ROUTINE p5z_micro  ***
+      !!
+      !! ** Purpose :   Compute the sources/sinks for microzooplankton
+      !!
+      !! ** Method  : - ???
+      !!---------------------------------------------------------------------
+      INTEGER, INTENT(in) ::  kt  ! ocean time step
+      INTEGER, INTENT(in) ::  knt 
+      !
+      INTEGER  :: ji, jj, jk
+      REAL(wp) :: zcompadi, zcompaz , zcompaph, zcompapoc, zcompapon, zcompapop
+      REAL(wp) :: zcompapi, zgraze  , zdenom, zfact, zfood, zfoodlim
+      REAL(wp) :: ztmp1, ztmp2, ztmp3, ztmp4, ztmp5, ztmptot
+      REAL(wp) :: zepsherf, zepshert, zepsherv, zrespirc, zrespirn, zrespirp, zbasresb, zbasresi
+      REAL(wp) :: zgraztotc, zgraztotn, zgraztotp, zgraztotf, zbasresn, zbasresp, zbasresf
+      REAL(wp) :: zgradoc, zgradon, zgradop, zgraref, zgradoct, zgradont, zgradopt, zgrareft
+      REAL(wp) :: zexcess, zgraren, zgrarep, zgrarem
+      REAL(wp) :: zgrapoc, zgrapon, zgrapop, zgrapof, zprcaca, zmortz
+      REAL(wp) :: zrespz, ztortz, zgrasratf, zgrasratn, zgrasratp
+      REAL(wp) :: zgraznc, zgraznn, zgraznp, zgrazpoc, zgrazpon, zgrazpop, zgrazpof
+      REAL(wp) :: zgrazdc, zgrazdn, zgrazdp, zgrazdf, zgraznf, zgrazz
+      REAL(wp) :: zgrazpc, zgrazpn, zgrazpp, zgrazpf, zbeta, zrfact2, zmetexcess
+      REAL(wp), POINTER, DIMENSION(:,:,:) :: zgrazing, zw3d
+      CHARACTER (len=25) :: charout
+      !!---------------------------------------------------------------------
+      !
+      IF( nn_timing == 1 )  CALL timing_start('p5z_micro')
+      !
+      CALL wrk_alloc( jpi, jpj, jpk, zgrazing )
+      !
+      zmetexcess = 0.0
+      IF ( bmetexc ) zmetexcess = 1.0
+      !
+      DO jk = 1, jpkm1
+         DO jj = 1, jpj
+            DO ji = 1, jpi
+               zcompaz = MAX( ( trb(ji,jj,jk,jpzoo) - 1.e-9 ), 0.e0 )
+               zfact   = xstep * tgfunc2(ji,jj,jk) * zcompaz
+
+               !   Michaelis-Menten mortality rates of microzooplankton
+               !   -----------------------------------------------------
+               zrespz = resrat * zfact * ( trb(ji,jj,jk,jpzoo) / ( xkmort + trb(ji,jj,jk,jpzoo) )  &
+               &        + 3. * nitrfac(ji,jj,jk) )
+
+               !   Zooplankton mortality. A square function has been selected with
+               !   no real reason except that it seems to be more stable and may mimic predation.
+               !   ------------------------------------------------------------------------------
+               ztortz = mzrat * 1.e6 * zfact * trb(ji,jj,jk,jpzoo)
+
+               !   Computation of the abundance of the preys
+               !   A threshold can be specified in the namelist
+               !   --------------------------------------------
+               zcompadi  = MIN( MAX( ( trb(ji,jj,jk,jpdia) - xthreshdia ), 0.e0 ), xsizedia )
+               zcompaph  = MAX( ( trb(ji,jj,jk,jpphy) - xthreshphy ), 0.e0 )
+               zcompaz   = MAX( ( trb(ji,jj,jk,jpzoo) - xthreshzoo ), 0.e0 )
+               zcompapi  = MAX( ( trb(ji,jj,jk,jppic) - xthreshpic ), 0.e0 )
+               zcompapoc = MAX( ( trb(ji,jj,jk,jppoc) - xthreshpoc ), 0.e0 )
+               
+               !   Microzooplankton grazing
+               !   ------------------------
+               zfood     = xprefn * zcompaph + xprefc * zcompapoc + xprefd * zcompadi   &
+               &           + xprefz * zcompaz + xprefp * zcompapi
+               zfoodlim  = MAX( 0. , zfood - min(xthresh,0.5*zfood) )
+               zdenom    = zfoodlim / ( xkgraz + zfoodlim )
+               zgraze    = grazrat * xstep * tgfunc2(ji,jj,jk) * trb(ji,jj,jk,jpzoo) 
+
+               !   An active switching parameterization is used here.
+               !   We don't use the KTW parameterization proposed by 
+               !   Vallina et al. because it tends to produce to steady biomass
+               !   composition and the variance of Chl is too low as it grazes
+               !   too strongly on winning organisms. Thus, instead of a square
+               !   a 1.5 power value is used which decreases the pressure on the
+               !   most abundant species
+               !   ------------------------------------------------------------  
+               ztmp1 = xprefn * zcompaph**1.5
+               ztmp2 = xprefp * zcompapi**1.5
+               ztmp3 = xprefc * zcompapoc**1.5
+               ztmp4 = xprefd * zcompadi**1.5
+               ztmp5 = xprefz * zcompaz**1.5
+               ztmptot = ztmp1 + ztmp2 + ztmp3 + ztmp4 + ztmp5 + rtrn
+               ztmp1 = ztmp1 / ztmptot
+               ztmp2 = ztmp2 / ztmptot
+               ztmp3 = ztmp3 / ztmptot
+               ztmp4 = ztmp4 / ztmptot
+               ztmp5 = ztmp5 / ztmptot
+
+               !   Microzooplankton regular grazing on the different preys
+               !   -------------------------------------------------------
+               zgraznc   = zgraze  * ztmp1  * zdenom
+               zgraznn   = zgraznc * trb(ji,jj,jk,jpnph) / (trb(ji,jj,jk,jpphy) + rtrn)
+               zgraznp   = zgraznc * trb(ji,jj,jk,jppph) / (trb(ji,jj,jk,jpphy) + rtrn)
+               zgraznf   = zgraznc * trb(ji,jj,jk,jpnfe) / (trb(ji,jj,jk,jpphy) + rtrn)
+               zgrazpc   = zgraze  * ztmp2  * zdenom
+               zgrazpn   = zgrazpc * trb(ji,jj,jk,jpnpi) / (trb(ji,jj,jk,jppic) + rtrn)
+               zgrazpp   = zgrazpc * trb(ji,jj,jk,jpppi) / (trb(ji,jj,jk,jppic) + rtrn)
+               zgrazpf   = zgrazpc * trb(ji,jj,jk,jppfe) / (trb(ji,jj,jk,jppic) + rtrn)
+               zgrazz    = zgraze  * ztmp5   * zdenom
+               zgrazpoc  = zgraze  * ztmp3   * zdenom
+               zgrazpon  = zgrazpoc * trb(ji,jj,jk,jppon) / ( trb(ji,jj,jk,jppoc) + rtrn )
+               zgrazpop  = zgrazpoc * trb(ji,jj,jk,jppop) / ( trb(ji,jj,jk,jppoc) + rtrn )
+               zgrazpof  = zgrazpoc* trb(ji,jj,jk,jpsfe) / (trb(ji,jj,jk,jppoc) + rtrn)
+               zgrazdc   = zgraze  * ztmp4  * zdenom
+               zgrazdn   = zgrazdc * trb(ji,jj,jk,jpndi) / (trb(ji,jj,jk,jpdia) + rtrn)
+               zgrazdp   = zgrazdc * trb(ji,jj,jk,jppdi) / (trb(ji,jj,jk,jpdia) + rtrn)
+               zgrazdf   = zgrazdc * trb(ji,jj,jk,jpdfe) / (trb(ji,jj,jk,jpdia) + rtrn)
+               !
+               zgraztotc = zgraznc + zgrazpoc + zgrazdc + zgrazz + zgrazpc
+               zgraztotn = zgraznn + zgrazpn + zgrazpon + zgrazdn + zgrazz * no3rat3
+               zgraztotp = zgraznp + zgrazpp + zgrazpop + zgrazdp + zgrazz * po4rat3
+               zgraztotf = zgraznf + zgrazpf + zgrazpof + zgrazdf + zgrazz * ferat3
+               !
+               ! Grazing by microzooplankton
+               zgrazing(ji,jj,jk) = zgraztotc
+
+               !   Stoichiometruc ratios of the food ingested by zooplanton 
+               !   --------------------------------------------------------
+               zgrasratf =  (zgraztotf + rtrn) / ( zgraztotc + rtrn )
+               zgrasratn =  (zgraztotn + rtrn) / ( zgraztotc + rtrn )
+               zgrasratp =  (zgraztotp + rtrn) / ( zgraztotc + rtrn )
+
+               !   Growth efficiency is made a function of the quality 
+               !   and the quantity of the preys
+               !   ---------------------------------------------------
+               zepshert  = MIN( 1., zgrasratn/ no3rat3, zgrasratp/ po4rat3, zgrasratf / ferat3)
+               zbeta = 1./ (epsher - 0.2)
+               zepsherf = 0.2 + 1./ (zbeta + 0.04 * 12. * zfood * 1E6 )
+               zepsherv  = zepsherf * zepshert
+
+               !   Respiration of microzooplankton
+               !   Excess carbon in the food is used preferentially
+               !   ------------------------------------------------
+               zexcess  = zgraztotc * zepsherf * (1.0 - zepshert) * zmetexcess
+               zbasresb = MAX(0., zrespz - zexcess)
+               zbasresi = zexcess + MIN(0., zrespz - zexcess)  
+               zrespirc = srespir * zepsherv * zgraztotc + zbasresb
+               
+               !   When excess carbon is used, the other elements in excess
+               !   are also used proportionally to their abundance
+               !   --------------------------------------------------------
+               zexcess  = ( zgrasratn/ no3rat3 - zepshert ) / ( 1.0 - zepshert + rtrn)
+               zbasresn = zbasresi * zexcess * zgrasratn 
+               zexcess  = ( zgrasratp/ po4rat3 - zepshert ) / ( 1.0 - zepshert + rtrn)
+               zbasresp = zbasresi * zexcess * zgrasratp
+               zexcess  = ( zgrasratf/ ferat3 - zepshert ) / ( 1.0 - zepshert + rtrn)
+               zbasresf = zbasresi * zexcess * zgrasratf
+
+               !   Voiding of the excessive elements as DOM
+               !   ----------------------------------------
+               zgradoct   = (1. - unassc - zepsherv) * zgraztotc - zbasresi  
+               zgradont   = (1. - unassn) * zgraztotn - zepsherv * no3rat3 * zgraztotc - zbasresn
+               zgradopt   = (1. - unassp) * zgraztotp - zepsherv * po4rat3 * zgraztotc - zbasresp
+               zgrareft   = (1. - unassc) * zgraztotf - zepsherv * ferat3 * zgraztotc - zbasresf
+
+               !  Since only semilabile DOM is represented in PISCES
+               !  part of DOM is in fact labile and is then released
+               !  as dissolved inorganic compounds (ssigma)
+               !  --------------------------------------------------
+               zgradoc =  zgradoct * ssigma
+               zgradon =  zgradont * ssigma
+               zgradop =  zgradopt * ssigma
+               zgrarem = (1.0 - ssigma) * zgradoct
+               zgraren = (1.0 - ssigma) * zgradont
+               zgrarep = (1.0 - ssigma) * zgradopt
+               zgraref = zgrareft
+
+               !   Defecation as a result of non assimilated products
+               !   --------------------------------------------------
+               zgrapoc   = zgraztotc * unassc
+               zgrapon   = zgraztotn * unassn
+               zgrapop   = zgraztotp * unassp
+               zgrapof   = zgraztotf * unassc
+
+               !  Addition of respiration to the release of inorganic nutrients
+               !  -------------------------------------------------------------
+               zgrarem = zgrarem + zbasresi + zrespirc
+               zgraren = zgraren + zbasresn + zrespirc * no3rat3
+               zgrarep = zgrarep + zbasresp + zrespirc * po4rat3
+               zgraref = zgraref + zbasresf + zrespirc * ferat3
+
+               !   Update of the TRA arrays
+               !   ------------------------
+               tra(ji,jj,jk,jppo4) = tra(ji,jj,jk,jppo4) + zgrarep
+               tra(ji,jj,jk,jpnh4) = tra(ji,jj,jk,jpnh4) + zgraren
+               tra(ji,jj,jk,jpdoc) = tra(ji,jj,jk,jpdoc) + zgradoc
+               !
+               IF( ln_ligand ) tra(ji,jj,jk,jplgw) = tra(ji,jj,jk,jplgw) + zgradoc * ldocz
+               !
+               tra(ji,jj,jk,jpdon) = tra(ji,jj,jk,jpdon) + zgradon
+               tra(ji,jj,jk,jpdop) = tra(ji,jj,jk,jpdop) + zgradop
+               tra(ji,jj,jk,jpoxy) = tra(ji,jj,jk,jpoxy) - o2ut * zgrarem 
+               tra(ji,jj,jk,jpfer) = tra(ji,jj,jk,jpfer) + zgraref
+               tra(ji,jj,jk,jpzoo) = tra(ji,jj,jk,jpzoo) + zepsherv * zgraztotc - zrespirc - ztortz - zgrazz
+               tra(ji,jj,jk,jpphy) = tra(ji,jj,jk,jpphy) - zgraznc
+               tra(ji,jj,jk,jpnph) = tra(ji,jj,jk,jpnph) - zgraznn
+               tra(ji,jj,jk,jppph) = tra(ji,jj,jk,jppph) - zgraznp
+               tra(ji,jj,jk,jppic) = tra(ji,jj,jk,jppic) - zgrazpc
+               tra(ji,jj,jk,jpnpi) = tra(ji,jj,jk,jpnpi) - zgrazpn
+               tra(ji,jj,jk,jpppi) = tra(ji,jj,jk,jpppi) - zgrazpp
+               tra(ji,jj,jk,jpdia) = tra(ji,jj,jk,jpdia) - zgrazdc
+               tra(ji,jj,jk,jpndi) = tra(ji,jj,jk,jpndi) - zgrazdn
+               tra(ji,jj,jk,jppdi) = tra(ji,jj,jk,jppdi) - zgrazdp
+               tra(ji,jj,jk,jpnch) = tra(ji,jj,jk,jpnch) - zgraznc * trb(ji,jj,jk,jpnch)/(trb(ji,jj,jk,jpphy)+rtrn)
+               tra(ji,jj,jk,jppch) = tra(ji,jj,jk,jppch) - zgrazpc * trb(ji,jj,jk,jppch)/(trb(ji,jj,jk,jppic)+rtrn)
+               tra(ji,jj,jk,jpdch) = tra(ji,jj,jk,jpdch) - zgrazdc * trb(ji,jj,jk,jpdch)/(trb(ji,jj,jk,jpdia)+rtrn)
+               tra(ji,jj,jk,jpdsi) = tra(ji,jj,jk,jpdsi) - zgrazdc * trb(ji,jj,jk,jpdsi)/(trb(ji,jj,jk,jpdia)+rtrn)
+               tra(ji,jj,jk,jpgsi) = tra(ji,jj,jk,jpgsi) + zgrazdc * trb(ji,jj,jk,jpdsi)/(trb(ji,jj,jk,jpdia)+rtrn)
+               tra(ji,jj,jk,jpnfe) = tra(ji,jj,jk,jpnfe) - zgraznf
+               tra(ji,jj,jk,jppfe) = tra(ji,jj,jk,jppfe) - zgrazpf
+               tra(ji,jj,jk,jpdfe) = tra(ji,jj,jk,jpdfe) - zgrazdf
+               tra(ji,jj,jk,jppoc) = tra(ji,jj,jk,jppoc) + ztortz + zgrapoc - zgrazpoc 
+               prodpoc(ji,jj,jk) = prodpoc(ji,jj,jk) + ztortz + zgrapoc
+               conspoc(ji,jj,jk) = conspoc(ji,jj,jk) - zgrazpoc
+               tra(ji,jj,jk,jppon) = tra(ji,jj,jk,jppon) + no3rat3 * ztortz + zgrapon - zgrazpon
+               tra(ji,jj,jk,jppop) = tra(ji,jj,jk,jppop) + po4rat3 * ztortz + zgrapop - zgrazpop
+               tra(ji,jj,jk,jpsfe) = tra(ji,jj,jk,jpsfe) + ferat3 * ztortz  + zgrapof - zgrazpof
+               !
+               ! calcite production
+               zprcaca = xfracal(ji,jj,jk) * zgraznc
+               prodcal(ji,jj,jk) = prodcal(ji,jj,jk) + zprcaca  ! prodcal=prodcal(nanophy)+prodcal(microzoo)+prodcal(mesozoo)
+               !
+               zprcaca = part * zprcaca
+               tra(ji,jj,jk,jpdic) = tra(ji,jj,jk,jpdic) + zgrarem - zprcaca
+               tra(ji,jj,jk,jptal) = tra(ji,jj,jk,jptal) - 2. * zprcaca     &
+               &                     + rno3 * zgraren
+               tra(ji,jj,jk,jpcal) = tra(ji,jj,jk,jpcal) + zprcaca
+            END DO
+         END DO
+      END DO
+      !
+      IF( lk_iomput .AND. knt == nrdttrc ) THEN
+         CALL wrk_alloc( jpi, jpj, jpk, zw3d )
+         IF( iom_use( "GRAZ1" ) ) THEN
+            zw3d(:,:,:) = zgrazing(:,:,:) * 1.e+3 * rfact2r * tmask(:,:,:)  !  Total grazing of phyto by zooplankton
+            CALL iom_put( "GRAZ1", zw3d )
+         ENDIF
+         CALL wrk_dealloc( jpi, jpj, jpk, zw3d )
+      ENDIF
+      !
+      IF(ln_ctl)   THEN  ! print mean trends (used for debugging)
+         WRITE(charout, FMT="('micro')")
+         CALL prt_ctl_trc_info(charout)
+         CALL prt_ctl_trc(tab4d=tra, mask=tmask, clinfo=ctrcnm)
+      ENDIF
+      !
+      CALL wrk_dealloc( jpi, jpj, jpk, zgrazing )
+      !
+      IF( nn_timing == 1 )  CALL timing_stop('p5z_micro')
+      !
+   END SUBROUTINE p5z_micro
+
+
+   SUBROUTINE p5z_micro_init
+
+      !!----------------------------------------------------------------------
+      !!                  ***  ROUTINE p5z_micro_init  ***
+      !!
+      !! ** Purpose :   Initialization of microzooplankton parameters
+      !!
+      !! ** Method  :   Read the nampiszoo namelist and check the parameters
+      !!                called at the first timestep (nittrc000)
+      !!
+      !! ** input   :   Namelist nampiszoo
+      !!
+      !!----------------------------------------------------------------------
+
+      NAMELIST/namp5zzoo/ part, grazrat, bmetexc, resrat, mzrat, xprefc, xprefn, &
+         &                xprefp, xprefd, xprefz, xthreshdia, xthreshphy, &
+         &                xthreshpic, xthreshpoc, xthreshzoo, xthresh, xkgraz, &
+         &                epsher, ssigma, srespir, unassc, unassn, unassp
+
+      INTEGER :: ios                 ! Local integer output status for namelist read
+
+      REWIND( numnatp_ref )              ! Namelist nampiszoo in reference namelist : Pisces microzooplankton
+      READ  ( numnatp_ref, namp5zzoo, IOSTAT = ios, ERR = 901)
+901   IF( ios /= 0 ) CALL ctl_nam ( ios , 'namp5zzoo in reference namelist', lwp )
+
+      REWIND( numnatp_cfg )              ! Namelist nampiszoo in configuration namelist : Pisces microzooplankton
+      READ  ( numnatp_cfg, namp5zzoo, IOSTAT = ios, ERR = 902 )
+902   IF( ios /= 0 ) CALL ctl_nam ( ios , 'namp5zzoo in configuration namelist', lwp )
+      IF(lwm) WRITE ( numonp, namp5zzoo )
+
+      IF(lwp) THEN                         ! control print
+         WRITE(numout,*) ' '
+         WRITE(numout,*) ' Namelist parameters for microzooplankton, nampiszooq'
+         WRITE(numout,*) ' ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~'
+         WRITE(numout,*) '    part of calcite not dissolved in microzoo guts  part        =', part
+         WRITE(numout,*) '    microzoo preference for POC                     xprefc     =', xprefc
+         WRITE(numout,*) '    microzoo preference for nano                    xprefn     =', xprefn
+         WRITE(numout,*) '    microzoo preference for pico                    xprefp     =', xprefp
+         WRITE(numout,*) '    microzoo preference for diatoms                 xprefd     =', xprefd
+         WRITE(numout,*) '    microzoo preference for microzoo                xprefz     =', xprefz
+         WRITE(numout,*) '    diatoms feeding threshold  for microzoo         xthreshdia  =', xthreshdia
+         WRITE(numout,*) '    nanophyto feeding threshold for microzoo        xthreshphy  =', xthreshphy
+         WRITE(numout,*) '    picophyto feeding threshold for microzoo        xthreshpic  =', xthreshpic
+         WRITE(numout,*) '    poc feeding threshold for microzoo              xthreshpoc  =', xthreshpoc
+         WRITE(numout,*) '    microzoo feeding threshold for microzoo         xthreshzoo  =', xthreshzoo
+         WRITE(numout,*) '    feeding threshold for microzooplankton          xthresh     =', xthresh
+         WRITE(numout,*) '    exsudation rate of microzooplankton             resrat      =', resrat
+         WRITE(numout,*) '    microzooplankton mortality rate                 mzrat       =', mzrat
+         WRITE(numout,*) '    maximal microzoo grazing rate                   grazrat     =', grazrat
+         WRITE(numout,*) '    C egested fraction of fodd by microzoo          unassc      =', unassc
+         WRITE(numout,*) '    N egested fraction of fodd by microzoo          unassn      =', unassn
+         WRITE(numout,*) '    P egested fraction of fodd by microzoo          unassp      =', unassp
+         WRITE(numout,*) '    Efficicency of microzoo growth                  epsher      =', epsher
+         WRITE(numout,*) '    Fraction excreted as semi-labile DOM            ssigma      =', ssigma
+         WRITE(numout,*) '    Active respiration                              srespir     =', srespir
+         WRITE(numout,*) '    half sturation constant for grazing 1           xkgraz      =', xkgraz
+         WRITE(numout,*) '    Use of excess carbon for respiration            bmetexc     =', bmetexc
+      ENDIF
+
+   END SUBROUTINE p5z_micro_init
+
+   !!======================================================================
+END MODULE  p5zmicro
Index: branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/NEMO/TOP_SRC/PISCES/P4Z/p5zmort.F90
===================================================================
--- branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/NEMO/TOP_SRC/PISCES/P4Z/p5zmort.F90	(revision 7391)
+++ branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/NEMO/TOP_SRC/PISCES/P4Z/p5zmort.F90	(revision 7391)
@@ -0,0 +1,310 @@
+MODULE p5zmort
+   !!======================================================================
+   !!                         ***  MODULE p5zmort  ***
+   !! TOP :   PISCES Compute the mortality terms for phytoplankton
+   !!======================================================================
+   !! History :   1.0  !  2002     (O. Aumont)  Original code
+   !!             2.0  !  2007-12  (C. Ethe, G. Madec)  F90
+   !!             3.6  !  2015-05  (O. Aumont) PISCES quota
+   !!----------------------------------------------------------------------
+   !!   p5z_mort       :   Compute the mortality terms for phytoplankton
+   !!   p5z_mort_init  :   Initialize the mortality params for phytoplankton
+   !!----------------------------------------------------------------------
+   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 p5zlim          !  Phytoplankton limitation terms
+   USE prtctl_trc      !  print control for debugging
+
+   IMPLICIT NONE
+   PRIVATE
+
+   PUBLIC   p5z_mort    
+   PUBLIC   p5z_mort_init    
+
+   !! * Shared module variables
+   REAL(wp), PUBLIC :: wchln    !:
+   REAL(wp), PUBLIC :: wchlp   !:
+   REAL(wp), PUBLIC :: wchld   !:
+   REAL(wp), PUBLIC :: wchldm  !:
+   REAL(wp), PUBLIC :: mpratn   !:
+   REAL(wp), PUBLIC :: mpratp  !:
+   REAL(wp), PUBLIC :: mpratd  !:
+
+   !!----------------------------------------------------------------------
+   !! NEMO/TOP 3.3 , NEMO Consortium (2010)
+   !! $Id: p4zmort.F90 3160 2011-11-20 14:27:18Z cetlod $ 
+   !! Software governed by the CeCILL licence (NEMOGCM/NEMO_CeCILL.txt)
+   !!----------------------------------------------------------------------
+
+CONTAINS
+
+   SUBROUTINE p5z_mort( kt )
+      !!---------------------------------------------------------------------
+      !!                     ***  ROUTINE p5z_mort  ***
+      !!
+      !! ** Purpose :   Calls the different subroutine to initialize and compute
+      !!                the different phytoplankton mortality terms
+      !!
+      !! ** Method  : - ???
+      !!---------------------------------------------------------------------
+      INTEGER, INTENT(in) ::   kt ! ocean time step
+      !!---------------------------------------------------------------------
+
+      CALL p5z_nano            ! nanophytoplankton
+      CALL p5z_pico            ! picophytoplankton
+      CALL p5z_diat            ! diatoms
+
+   END SUBROUTINE p5z_mort
+
+
+   SUBROUTINE p5z_nano
+      !!---------------------------------------------------------------------
+      !!                     ***  ROUTINE p5z_nano  ***
+      !!
+      !! ** Purpose :   Compute the mortality terms for nanophytoplankton
+      !!
+      !! ** Method  : - ???
+      !!---------------------------------------------------------------------
+      INTEGER  :: ji, jj, jk
+      REAL(wp) :: zcompaph
+      REAL(wp) :: zfactfe, zfactch, zfactn, zfactp, zprcaca
+      REAL(wp) :: ztortp , zrespp , zmortp
+      CHARACTER (len=25) :: charout
+      !!---------------------------------------------------------------------
+      !
+      IF( nn_timing == 1 )  CALL timing_start('p5z_nano')
+      !
+      prodcal(:,:,:) = 0.  !: calcite production variable set to zero
+      DO jk = 1, jpkm1
+         DO jj = 1, jpj
+            DO ji = 1, jpi
+               zcompaph = MAX( ( trb(ji,jj,jk,jpphy) - 1e-9 ), 0.e0 )
+               !   Squared mortality of Phyto similar to a sedimentation term during
+               !   blooms (Doney et al. 1996)
+               !   -----------------------------------------------------------------
+               zrespp = wchln * 1.e6 * xstep * xdiss(ji,jj,jk) * zcompaph * trb(ji,jj,jk,jpphy)
+
+               !   Phytoplankton linear mortality
+               !   ------------------------------
+               ztortp = mpratn * xstep  * zcompaph
+               zmortp = zrespp + ztortp
+
+               !   Update the arrays TRA which contains the biological sources and sinks
+
+               zfactn  = trb(ji,jj,jk,jpnph)/(trb(ji,jj,jk,jpphy)+rtrn)
+               zfactp  = trb(ji,jj,jk,jppph)/(trb(ji,jj,jk,jpphy)+rtrn)
+               zfactfe = trb(ji,jj,jk,jpnfe)/(trb(ji,jj,jk,jpphy)+rtrn)
+               zfactch = trb(ji,jj,jk,jpnch)/(trb(ji,jj,jk,jpphy)+rtrn)
+               tra(ji,jj,jk,jpphy) = tra(ji,jj,jk,jpphy) - zmortp
+               tra(ji,jj,jk,jpnph) = tra(ji,jj,jk,jpnph) - zmortp * zfactn
+               tra(ji,jj,jk,jppph) = tra(ji,jj,jk,jppph) - zmortp * zfactp
+               tra(ji,jj,jk,jpnch) = tra(ji,jj,jk,jpnch) - zmortp * zfactch
+               tra(ji,jj,jk,jpnfe) = tra(ji,jj,jk,jpnfe) - zmortp * zfactfe
+               zprcaca = xfracal(ji,jj,jk) * zmortp
+               !
+               prodcal(ji,jj,jk) = prodcal(ji,jj,jk) + zprcaca  ! prodcal=prodcal(nanophy)+prodcal(microzoo)+prodcal(mesozoo)
+               !
+               tra(ji,jj,jk,jpdic) = tra(ji,jj,jk,jpdic) - zprcaca
+               tra(ji,jj,jk,jptal) = tra(ji,jj,jk,jptal) - 2. * zprcaca
+               tra(ji,jj,jk,jpcal) = tra(ji,jj,jk,jpcal) + zprcaca
+               tra(ji,jj,jk,jppoc) = tra(ji,jj,jk,jppoc) + zmortp
+               tra(ji,jj,jk,jppon) = tra(ji,jj,jk,jppon) + zmortp * zfactn
+               tra(ji,jj,jk,jppop) = tra(ji,jj,jk,jppop) + zmortp * zfactp
+               prodpoc(ji,jj,jk) = prodpoc(ji,jj,jk) + zmortp
+               tra(ji,jj,jk,jpsfe) = tra(ji,jj,jk,jpsfe) + zmortp * zfactfe
+            END DO
+         END DO
+      END DO
+      !
+       IF(ln_ctl)   THEN  ! print mean trends (used for debugging)
+         WRITE(charout, FMT="('nano')")
+         CALL prt_ctl_trc_info(charout)
+         CALL prt_ctl_trc(tab4d=tra, mask=tmask, clinfo=ctrcnm)
+       ENDIF
+      !
+      IF( nn_timing == 1 )  CALL timing_stop('p5z_nano')
+      !
+   END SUBROUTINE p5z_nano
+
+   SUBROUTINE p5z_pico
+      !!---------------------------------------------------------------------
+      !!                     ***  ROUTINE p5z_pico  ***
+      !!
+      !! ** Purpose :   Compute the mortality terms for picophytoplankton
+      !!
+      !! ** Method  : - ???
+      !!---------------------------------------------------------------------
+      INTEGER  :: ji, jj, jk
+      REAL(wp) :: zcompaph
+      REAL(wp) :: zfactfe, zfactch, zfactn, zfactp
+      REAL(wp) :: ztortp , zrespp , zmortp 
+      CHARACTER (len=25) :: charout
+      !!---------------------------------------------------------------------
+      !
+      IF( nn_timing == 1 )  CALL timing_start('p5z_pico')
+      !
+      DO jk = 1, jpkm1
+         DO jj = 1, jpj
+            DO ji = 1, jpi
+               zcompaph = MAX( ( trb(ji,jj,jk,jppic) - 1e-9 ), 0.e0 )
+               !  Squared mortality of Phyto similar to a sedimentation term during
+               !  blooms (Doney et al. 1996)
+               !  -----------------------------------------------------------------
+               zrespp = wchlp * 1.e6 * xstep * xdiss(ji,jj,jk) * zcompaph * trb(ji,jj,jk,jppic)
+
+               !     Phytoplankton mortality 
+               ztortp = mpratp * xstep  * zcompaph
+               zmortp = zrespp + ztortp
+
+               !   Update the arrays TRA which contains the biological sources and sinks
+
+               zfactn = trb(ji,jj,jk,jpnpi)/(trb(ji,jj,jk,jppic)+rtrn)
+               zfactp = trb(ji,jj,jk,jpppi)/(trb(ji,jj,jk,jppic)+rtrn)
+               zfactfe = trb(ji,jj,jk,jppfe)/(trb(ji,jj,jk,jppic)+rtrn)
+               zfactch = trb(ji,jj,jk,jppch)/(trb(ji,jj,jk,jppic)+rtrn)
+               tra(ji,jj,jk,jppic) = tra(ji,jj,jk,jppic) - zmortp
+               tra(ji,jj,jk,jpnpi) = tra(ji,jj,jk,jpnpi) - zmortp * zfactn
+               tra(ji,jj,jk,jpppi) = tra(ji,jj,jk,jpppi) - zmortp * zfactp
+               tra(ji,jj,jk,jppch) = tra(ji,jj,jk,jppch) - zmortp * zfactch
+               tra(ji,jj,jk,jppfe) = tra(ji,jj,jk,jppfe) - zmortp * zfactfe
+               tra(ji,jj,jk,jppoc) = tra(ji,jj,jk,jppoc) + zmortp
+               tra(ji,jj,jk,jppon) = tra(ji,jj,jk,jppon) + zmortp * zfactn
+               tra(ji,jj,jk,jppop) = tra(ji,jj,jk,jppop) + zmortp * zfactp
+               tra(ji,jj,jk,jpsfe) = tra(ji,jj,jk,jpsfe) + zmortp * zfactfe
+               prodpoc(ji,jj,jk) = prodpoc(ji,jj,jk) + zmortp
+            END DO
+         END DO
+      END DO
+      !
+       IF(ln_ctl)   THEN  ! print mean trends (used for debugging)
+         WRITE(charout, FMT="('pico')")
+         CALL prt_ctl_trc_info(charout)
+         CALL prt_ctl_trc(tab4d=tra, mask=tmask, clinfo=ctrcnm)
+       ENDIF
+      !
+      IF( nn_timing == 1 )  CALL timing_stop('p5z_pico')
+      !
+   END SUBROUTINE p5z_pico
+
+
+   SUBROUTINE p5z_diat
+      !!---------------------------------------------------------------------
+      !!                     ***  ROUTINE p5z_diat  ***
+      !!
+      !! ** Purpose :   Compute the mortality terms for diatoms
+      !!
+      !! ** Method  : - ???
+      !!---------------------------------------------------------------------
+      INTEGER  ::  ji, jj, jk
+      REAL(wp) ::  zfactfe,zfactsi,zfactch, zfactn, zfactp, zcompadi
+      REAL(wp) ::  zrespp2, ztortp2, zmortp2
+      REAL(wp) ::  zlim2, zlim1
+      CHARACTER (len=25) :: charout
+      !!---------------------------------------------------------------------
+      !
+      IF( nn_timing == 1 )  CALL timing_start('p5z_diat')
+      !
+
+      DO jk = 1, jpkm1
+         DO jj = 1, jpj
+            DO ji = 1, jpi
+
+               zcompadi = MAX( ( trb(ji,jj,jk,jpdia) - 1E-9), 0. )
+
+               !   Aggregation term for diatoms is increased in case of nutrient
+               !   stress as observed in reality. The stressed cells become more
+               !   sticky and coagulate to sink quickly out of the euphotic zone
+               !   -------------------------------------------------------------
+               !  Phytoplankton squared mortality
+               !  -------------------------------
+               zlim2   = xlimdia(ji,jj,jk) * xlimdia(ji,jj,jk)
+               zlim1   = 0.25 * ( 1. - zlim2 ) / ( 0.25 + zlim2 ) 
+               zrespp2 = 1.e6 * xstep * (  wchld + wchldm * zlim1 ) * xdiss(ji,jj,jk) * zcompadi * trb(ji,jj,jk,jpdia)
+
+               !  Phytoplankton linear mortality 
+               !  ------------------------------
+               ztortp2 = mpratd * xstep  * zcompadi
+               zmortp2 = zrespp2 + ztortp2
+
+               !   Update the arrays tra which contains the biological sources and sinks
+               !   ---------------------------------------------------------------------
+               zfactn  = trb(ji,jj,jk,jpndi) / ( trb(ji,jj,jk,jpdia) + rtrn )
+               zfactp  = trb(ji,jj,jk,jppdi) / ( trb(ji,jj,jk,jpdia) + rtrn )
+               zfactch = trb(ji,jj,jk,jpdch) / ( trb(ji,jj,jk,jpdia) + rtrn )
+               zfactfe = trb(ji,jj,jk,jpdfe) / ( trb(ji,jj,jk,jpdia) + rtrn )
+               zfactsi = trb(ji,jj,jk,jpdsi) / ( trb(ji,jj,jk,jpdia) + rtrn )
+               tra(ji,jj,jk,jpdia) = tra(ji,jj,jk,jpdia) - zmortp2 
+               tra(ji,jj,jk,jpndi) = tra(ji,jj,jk,jpndi) - zmortp2 * zfactn
+               tra(ji,jj,jk,jppdi) = tra(ji,jj,jk,jppdi) - zmortp2 * zfactp
+               tra(ji,jj,jk,jpdch) = tra(ji,jj,jk,jpdch) - zmortp2 * zfactch
+               tra(ji,jj,jk,jpdfe) = tra(ji,jj,jk,jpdfe) - zmortp2 * zfactfe
+               tra(ji,jj,jk,jpdsi) = tra(ji,jj,jk,jpdsi) - zmortp2 * zfactsi
+               tra(ji,jj,jk,jpgsi) = tra(ji,jj,jk,jpgsi) + zmortp2 * zfactsi
+               tra(ji,jj,jk,jpgoc) = tra(ji,jj,jk,jpgoc) + zrespp2 
+               tra(ji,jj,jk,jpgon) = tra(ji,jj,jk,jpgon) + zrespp2 * zfactn
+               tra(ji,jj,jk,jpgop) = tra(ji,jj,jk,jpgop) + zrespp2 * zfactp
+               tra(ji,jj,jk,jpbfe) = tra(ji,jj,jk,jpbfe) + zrespp2 * zfactfe
+               tra(ji,jj,jk,jppoc) = tra(ji,jj,jk,jppoc) + ztortp2
+               tra(ji,jj,jk,jppon) = tra(ji,jj,jk,jppon) + ztortp2 * zfactn
+               tra(ji,jj,jk,jppop) = tra(ji,jj,jk,jppop) + ztortp2 * zfactp
+               tra(ji,jj,jk,jpsfe) = tra(ji,jj,jk,jpsfe) + ztortp2 * zfactfe
+               prodpoc(ji,jj,jk)   = prodpoc(ji,jj,jk) + ztortp2
+               prodgoc(ji,jj,jk)   = prodgoc(ji,jj,jk) + zrespp2
+            END DO
+         END DO
+      END DO
+      !
+      IF(ln_ctl)   THEN  ! print mean trends (used for debugging)
+         WRITE(charout, FMT="('diat')")
+         CALL prt_ctl_trc_info(charout)
+         CALL prt_ctl_trc(tab4d=tra, mask=tmask, clinfo=ctrcnm)
+      ENDIF
+      !
+      IF( nn_timing == 1 )  CALL timing_stop('p5z_diat')
+      !
+   END SUBROUTINE p5z_diat
+
+   SUBROUTINE p5z_mort_init
+
+      !!----------------------------------------------------------------------
+      !!                  ***  ROUTINE p5z_mort_init  ***
+      !!
+      !! ** Purpose :   Initialization of phytoplankton parameters
+      !!
+      !! ** Method  :   Read the nampismort namelist and check the parameters
+      !!      called at the first timestep
+      !!
+      !! ** input   :   Namelist nampismort
+      !!
+      !!----------------------------------------------------------------------
+
+      NAMELIST/namp5zmort/ wchln, wchlp, wchld, wchldm, mpratn, mpratp, mpratd
+      INTEGER :: ios                 ! Local integer output status for namelist read
+
+      REWIND( numnatp_ref )              ! Namelist nampismort in reference namelist : Pisces phytoplankton
+      READ  ( numnatp_ref, namp5zmort, IOSTAT = ios, ERR = 901)
+901   IF( ios /= 0 ) CALL ctl_nam ( ios , 'namp5zmort in reference namelist', lwp )
+
+      REWIND( numnatp_cfg )              ! Namelist nampismort in configuration namelist : Pisces phytoplankton
+      READ  ( numnatp_cfg, namp5zmort, IOSTAT = ios, ERR = 902 )
+902   IF( ios /= 0 ) CALL ctl_nam ( ios , 'namp5zmort in configuration namelist', lwp )
+      IF(lwm) WRITE ( numonp, namp5zmort )
+
+      IF(lwp) THEN                         ! control print
+         WRITE(numout,*) ' '
+         WRITE(numout,*) ' Namelist parameters for phytoplankton mortality, namp5zmort'
+         WRITE(numout,*) ' ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~'
+         WRITE(numout,*) '    quadratic mortality of phytoplankton      wchln     =', wchln
+         WRITE(numout,*) '    quadratic mortality of picophyto.         wchlp     =', wchlp
+         WRITE(numout,*) '    quadratic mortality of diatoms            wchld     =', wchld
+         WRITE(numout,*) '    Additional quadratic mortality of diatoms wchldm    =', wchldm
+         WRITE(numout,*) '    nanophyto. mortality rate                 mpratn    =', mpratn
+         WRITE(numout,*) '    picophyto. mortality rate                 mpratp    =', mpratp
+         WRITE(numout,*) '    Diatoms mortality rate                    mpratd    =', mpratd
+      ENDIF
+
+   END SUBROUTINE p5z_mort_init
+
+   !!======================================================================
+END MODULE  p5zmort
Index: branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/NEMO/TOP_SRC/PISCES/P4Z/p5zprod.F90
===================================================================
--- branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/NEMO/TOP_SRC/PISCES/P4Z/p5zprod.F90	(revision 7391)
+++ branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/NEMO/TOP_SRC/PISCES/P4Z/p5zprod.F90	(revision 7391)
@@ -0,0 +1,644 @@
+MODULE p5zprod
+   !!======================================================================
+   !!                         ***  MODULE p5zprod  ***
+   !! TOP :  Growth Rate of the two phytoplanktons groups 
+   !!======================================================================
+   !! History :   1.0  !  2004     (O. Aumont) Original code
+   !!             2.0  !  2007-12  (C. Ethe, G. Madec)  F90
+   !!             3.4  !  2011-05  (O. Aumont, C. Ethe) New parameterization of light limitation
+   !!             3.6  !  2015-05  (O. Aumont) PISCES quota
+   !!----------------------------------------------------------------------
+   !!   p5z_prod       :   Compute the growth Rate of the two phytoplanktons groups
+   !!   p5z_prod_init  :   Initialization of the parameters for growth
+   !!   p5z_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 p5zlim          !  Co-limitations of differents nutrients
+   USE prtctl_trc      !  print control for debugging
+   USE iom             !  I/O manager
+
+   IMPLICIT NONE
+   PRIVATE
+
+   PUBLIC   p5z_prod         ! called in p5zbio.F90
+   PUBLIC   p5z_prod_init    ! called in trcsms_pisces.F90
+   PUBLIC   p5z_prod_alloc
+
+   !! * Shared module variables
+   REAL(wp), PUBLIC ::  pislopen        !:
+   REAL(wp), PUBLIC ::  pislopep        !:
+   REAL(wp), PUBLIC ::  pisloped        !:
+   REAL(wp), PUBLIC ::  xadap           !:
+   REAL(wp), PUBLIC ::  excretn         !:
+   REAL(wp), PUBLIC ::  excretp         !:
+   REAL(wp), PUBLIC ::  excretd         !:
+   REAL(wp), PUBLIC ::  bresp           !:
+   REAL(wp), PUBLIC ::  thetanpm        !:
+   REAL(wp), PUBLIC ::  thetannm        !:
+   REAL(wp), PUBLIC ::  thetandm        !:
+   REAL(wp), PUBLIC ::  chlcmin         !:
+   REAL(wp), PUBLIC ::  grosip          !:
+
+   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::   prmaxn   !: optimal production = f(temperature)
+   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::   prmaxp   !: optimal production = f(temperature)
+   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::   prmaxd   !: optimal production = f(temperature)
+   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:)   ::   zdaylen
+   
+   REAL(wp) :: r1_rday                !: 1 / rday
+   REAL(wp) :: texcretn               !: 1 - excret 
+   REAL(wp) :: texcretp               !: 1 - excretp 
+   REAL(wp) :: texcretd               !: 1 - excret2        
+
+   !!----------------------------------------------------------------------
+   !! NEMO/TOP 3.3 , NEMO Consortium (2010)
+   !! $Id: p4zprod.F90 3160 2011-11-20 14:27:18Z cetlod $ 
+   !! Software governed by the CeCILL licence     (NEMOGCM/NEMO_CeCILL.txt)
+   !!----------------------------------------------------------------------
+CONTAINS
+
+   SUBROUTINE p5z_prod( kt , knt )
+      !!---------------------------------------------------------------------
+      !!                     ***  ROUTINE p5z_prod  ***
+      !!
+      !! ** Purpose :   Compute the phytoplankton production depending on
+      !!              light, temperature and nutrient availability
+      !!
+      !! ** Method  : - ???
+      !!---------------------------------------------------------------------
+      !
+      INTEGER, INTENT(in) :: kt, knt
+      !
+      INTEGER  ::   ji, jj, jk
+      REAL(wp) ::   zsilfac, znanotot, zpicotot, zdiattot, zconctemp, zconctemp2
+      REAL(wp) ::   zration, zratiop, zratiof, zmax, zmax2, zsilim, ztn, zadap
+      REAL(wp) ::   zpronmax, zpropmax, zprofmax, zrat
+      REAL(wp) ::   zlim, zsilfac2, zsiborn, zprod, zprontot, zproptot, zprodtot
+      REAL(wp) ::   zprnutmax, zdocprod, zprochln, zprochld, zprochlp
+      REAL(wp) ::   zpislopen, zpislopep, zpisloped, thetannm_n, thetandm_n, thetanpm_n
+      REAL(wp) ::   zrum, zcodel, zargu, zval, zfeup
+      REAL(wp) ::   zfact, zrfact2
+      CHARACTER (len=25) :: charout
+      REAL(wp), POINTER, DIMENSION(:,:  ) :: zmixnano, zmixpico, zmixdiat, zstrn
+      REAL(wp), POINTER, DIMENSION(:,:,:) :: zpislopeadn, zpislopeadp, zpislopeadd
+      REAL(wp), POINTER, DIMENSION(:,:,:) :: zprbio, zprpic, zprdia, zysopt
+      REAL(wp), POINTER, DIMENSION(:,:,:) :: zprchln, zprchlp, zprchld
+      REAL(wp), POINTER, DIMENSION(:,:,:) :: zprorcan, zprorcap, zprorcad 
+      REAL(wp), POINTER, DIMENSION(:,:,:) :: zprofed, zprofep, zprofen
+      REAL(wp), POINTER, DIMENSION(:,:,:) :: zpronewn, zpronewp, zpronewd
+      REAL(wp), POINTER, DIMENSION(:,:,:) :: zproregn, zproregp, zproregd
+      REAL(wp), POINTER, DIMENSION(:,:,:) :: zpropo4n, zpropo4p, zpropo4d
+      REAL(wp), POINTER, DIMENSION(:,:,:) :: zprodopn, zprodopp, zprodopd
+      REAL(wp), POINTER, DIMENSION(:,:,:) :: zrespn, zrespp, zrespd, zprnut
+      REAL(wp), POINTER, DIMENSION(:,:,:) :: zcroissn, zcroissp, zcroissd
+      REAL(wp), POINTER, DIMENSION(:,:,:) :: zmxl_fac, zmxl_chl
+      REAL(wp), POINTER, DIMENSION(:,:,:) :: zw3d
+      REAL(wp), POINTER, DIMENSION(:,:  ) :: zw2d
+      !!---------------------------------------------------------------------
+      !
+      IF( nn_timing == 1 )  CALL timing_start('p5z_prod')
+      !
+      !  Allocate temporary workspace
+      CALL wrk_alloc( jpi, jpj,      zmixnano, zmixpico, zmixdiat, zstrn )
+      CALL wrk_alloc( jpi, jpj, jpk, zmxl_fac, zmxl_chl )
+      CALL wrk_alloc( jpi, jpj, jpk, zpislopeadn, zpislopeadp, zpislopeadd, zysopt ) 
+      CALL wrk_alloc( jpi, jpj, jpk, zprdia, zprpic, zprbio, zprorcan, zprorcap, zprorcad )
+      CALL wrk_alloc( jpi, jpj, jpk, zprofed, zprofep, zprofen )
+      CALL wrk_alloc( jpi, jpj, jpk, zpronewn, zpronewp, zpronewd, zproregn, zproregp, zproregd )
+      CALL wrk_alloc( jpi, jpj, jpk, zpropo4n, zpropo4p, zpropo4d, zrespn, zrespp, zrespd, zprnut )
+      CALL wrk_alloc( jpi, jpj, jpk, zprchln, zprchlp, zprchld, zprodopn, zprodopp, zprodopd )
+      CALL wrk_alloc( jpi, jpj, jpk, zcroissp, zcroissn, zcroissd )
+      !
+      zprorcan(:,:,:) = 0._wp ; zprorcap(:,:,:) = 0._wp ; zprorcad(:,:,:) = 0._wp
+      zprofed (:,:,:) = 0._wp ; zprofep (:,:,:) = 0._wp ; zprofen (:,:,:) = 0._wp
+      zpronewn(:,:,:) = 0._wp ; zpronewp(:,:,:) = 0._wp ; zpronewd(:,:,:) = 0._wp
+      zproregn(:,:,:) = 0._wp ; zproregp(:,:,:) = 0._wp ; zproregd(:,:,:) = 0._wp 
+      zpropo4n(:,:,:) = 0._wp ; zpropo4p(:,:,:) = 0._wp ; zpropo4d(:,:,:) = 0._wp
+      zprdia  (:,:,:) = 0._wp ; zprpic  (:,:,:) = 0._wp ; zprbio  (:,:,:) = 0._wp
+      zysopt  (:,:,:) = 0._wp
+      zrespn  (:,:,:) = 0._wp ; zrespp  (:,:,:) = 0._wp ; zrespd  (:,:,:) = 0._wp 
+
+      ! Computation of the optimal production
+      prmaxn(:,:,:) = ( 0.65_wp * (1. + zpsino3 * qnpmax ) ) * r1_rday * tgfunc(:,:,:)
+      prmaxp(:,:,:) = 0.5 / 0.65 * prmaxn(:,:,:) 
+      prmaxd(:,:,:) = prmaxn(:,:,:) 
+      zprnut(:,:,:) = 0.65_wp * r1_rday * tgfunc(:,:,:)
+
+      ! compute the day length depending on latitude and the day
+      zrum = REAL( nday_year - 80, wp ) / REAL( nyear_len(1), wp )
+      zcodel = ASIN(  SIN( zrum * rpi * 2._wp ) * SIN( rad * 23.5_wp )  )
+
+      ! day length in hours
+      zstrn(:,:) = 0.
+      DO jj = 1, jpj
+         DO ji = 1, jpi
+            zargu = TAN( zcodel ) * TAN( gphit(ji,jj) * rad )
+            zargu = MAX( -1., MIN(  1., zargu ) )
+            zstrn(ji,jj) = MAX( 0.0, 24. - 2. * ACOS( zargu ) / rad / 15. )
+         END DO
+      END DO
+
+         ! Impact of the day duration on phytoplankton growth
+      DO jk = 1, jpkm1
+         DO jj = 1 ,jpj
+            DO ji = 1, jpi
+               IF( etot_ndcy(ji,jj,jk) > 1.E-3 ) THEN
+                  zval = MAX( 1., zstrn(ji,jj) )
+                  IF( gdepw_n(ji,jj,jk+1) <= hmld(ji,jj) ) THEN
+                     zval = zval * MIN(1., heup_01(ji,jj) / ( hmld(ji,jj) + rtrn ))
+                  ENDIF
+                  zmxl_chl(ji,jj,jk) = zval / 24.
+                  zmxl_fac(ji,jj,jk) = 1.5 * zval / ( 12. + zval )
+               ENDIF
+            END DO
+         END DO
+      END DO
+
+      zprbio(:,:,:) = prmaxn(:,:,:) * zmxl_fac(:,:,:)
+      zprdia(:,:,:) = prmaxd(:,:,:) * zmxl_fac(:,:,:)
+      zprpic(:,:,:) = prmaxp(:,:,:) * zmxl_fac(:,:,:)
+
+
+      ! Maximum light intensity
+      zdaylen(:,:) = MAX(1., zstrn(:,:)) / 24.
+      WHERE( zstrn(:,:) < 1.e0 ) zstrn(:,:) = 24.
+
+      DO jk = 1, jpkm1
+         DO jj = 1, jpj
+            DO ji = 1, jpi
+               IF( etot_ndcy(ji,jj,jk) > 1.E-3 ) THEN
+                  ! Computation of the P-I slope for nanos and diatoms
+                  ztn         = MAX( 0., tsn(ji,jj,jk,jp_tem) - 15. )
+                  zadap       = xadap * ztn / ( 2.+ ztn )
+                  !
+                  zpislopeadn(ji,jj,jk) = pislopen * trb(ji,jj,jk,jpnch)    &
+                  &                       /( trb(ji,jj,jk,jpphy) * 12. + rtrn)
+                  zpislopeadp(ji,jj,jk) = pislopep * ( 1. + zadap * EXP( -0.25 * epico(ji,jj,jk) ) )   &
+                  &                       * trb(ji,jj,jk,jppch) /( trb(ji,jj,jk,jppic) * 12. + rtrn)
+                  zpislopeadd(ji,jj,jk) = pisloped * trb(ji,jj,jk,jpdch)    &
+                     &                    /( trb(ji,jj,jk,jpdia) * 12. + rtrn)
+                  !
+                  zpislopen = zpislopeadn(ji,jj,jk) / ( zprbio(ji,jj,jk) * rday * xlimphy(ji,jj,jk) + rtrn )
+                  zpislopep = zpislopeadp(ji,jj,jk) / ( zprpic(ji,jj,jk) * rday * xlimpic(ji,jj,jk) + rtrn )
+                  zpisloped = zpislopeadd(ji,jj,jk) / ( zprdia(ji,jj,jk) * rday * xlimdia(ji,jj,jk) + rtrn )
+
+                  ! Computation of production function for Carbon
+                  !  ---------------------------------------------
+                  zprbio(ji,jj,jk) = zprbio(ji,jj,jk) * ( 1.- EXP( -zpislopen * enano(ji,jj,jk) )  )
+                  zprpic(ji,jj,jk) = zprpic(ji,jj,jk) * ( 1.- EXP( -zpislopep * epico(ji,jj,jk) )  )
+                  zprdia(ji,jj,jk) = zprdia(ji,jj,jk) * ( 1.- EXP( -zpisloped * ediat(ji,jj,jk) )  )
+
+                  ! Computation of production function for Chlorophyll
+                  !  -------------------------------------------------
+                  zpislopen = zpislopen * zmxl_fac(ji,jj,jk) / ( zmxl_chl(ji,jj,jk) + rtrn )
+                  zpisloped = zpisloped * zmxl_fac(ji,jj,jk) / ( zmxl_chl(ji,jj,jk) + rtrn )
+                  zpislopep = zpislopep * zmxl_fac(ji,jj,jk) / ( zmxl_chl(ji,jj,jk) + rtrn )
+                  zprchln(ji,jj,jk) = prmaxn(ji,jj,jk) * ( 1.- EXP( -zpislopen * enano(ji,jj,jk) )  )
+                  zprchlp(ji,jj,jk) = prmaxp(ji,jj,jk) * ( 1.- EXP( -zpislopep * epico(ji,jj,jk) )  )
+                  zprchld(ji,jj,jk) = prmaxd(ji,jj,jk) * ( 1.- EXP( -zpisloped * ediat(ji,jj,jk) )  )
+               ENDIF
+            END DO
+         END DO
+      END DO
+
+      DO jk = 1, jpkm1
+         DO jj = 1, jpj
+            DO ji = 1, jpi
+
+                IF( etot_ndcy(ji,jj,jk) > 1.E-3 ) THEN
+                  !    Si/C of diatoms
+                  !    ------------------------
+                  !    Si/C increases with iron stress and silicate availability
+                  !    Si/C is arbitrariliy increased for very high Si concentrations
+                  !    to mimic the very high ratios observed in the Southern Ocean (silpot2)
+                  zlim  = trb(ji,jj,jk,jpsil) / ( trb(ji,jj,jk,jpsil) + xksi1 )
+                  zsilim = MIN( zprdia(ji,jj,jk) / ( prmaxd(ji,jj,jk) + rtrn ), xlimsi(ji,jj,jk) )
+                  zsilfac = 3.4 * EXP( -4.23 * zsilim ) * MAX( 0.e0, MIN( 1., 2.2 * ( zlim - 0.5 ) )  ) + 1.e0
+                  zsiborn = trb(ji,jj,jk,jpsil) * trb(ji,jj,jk,jpsil) * trb(ji,jj,jk,jpsil)
+                  IF (gphit(ji,jj) < -30 ) THEN
+                    zsilfac2 = 1. + 2. * zsiborn / ( zsiborn + xksi2**3 )
+                  ELSE
+                    zsilfac2 = 1. +      zsiborn / ( zsiborn + xksi2**3 )
+                  ENDIF
+                  zysopt(ji,jj,jk) = grosip * zlim * zsilfac * zsilfac2
+              ENDIF
+            END DO
+         END DO
+      END DO
+
+      !  Sea-ice effect on production                                                                               
+      DO jk = 1, jpkm1
+         DO jj = 1, jpj
+            DO ji = 1, jpi
+               zprbio(ji,jj,jk)  = zprbio(ji,jj,jk) * ( 1. - fr_i(ji,jj) )
+               zprpic(ji,jj,jk)  = zprpic(ji,jj,jk) * ( 1. - fr_i(ji,jj) ) 
+               zprdia(ji,jj,jk)  = zprdia(ji,jj,jk) * ( 1. - fr_i(ji,jj) ) 
+               zprnut(ji,jj,jk)  = zprnut(ji,jj,jk) * ( 1. - fr_i(ji,jj) )
+            END DO
+         END DO
+      END DO
+
+      ! Computation of the various production terms of nanophytoplankton 
+      DO jk = 1, jpkm1
+         DO jj = 1, jpj
+            DO ji = 1, jpi
+               IF( etot_ndcy(ji,jj,jk) > 1.E-3 ) THEN
+                  !  production terms for nanophyto.
+                  zprorcan(ji,jj,jk) = zprbio(ji,jj,jk)  * xlimphy(ji,jj,jk) * trb(ji,jj,jk,jpphy) * rfact2
+                  !
+                  zration = trb(ji,jj,jk,jpnph) / ( trb(ji,jj,jk,jpphy) + rtrn )
+                  zratiop = trb(ji,jj,jk,jppph) / ( trb(ji,jj,jk,jpphy) + rtrn )
+                  zratiof = trb(ji,jj,jk,jpnfe) / ( trb(ji,jj,jk,jpphy) + rtrn )
+                  zprnutmax = zprnut(ji,jj,jk) * fvnuptk(ji,jj,jk) / rno3 * trb(ji,jj,jk,jpphy) * rfact2
+                  ! Uptake of nitrogen
+                  zrat = MIN( 1., zration / (xqnnmax(ji,jj,jk) + rtrn) ) 
+                  zmax = MAX(0., MIN(1., (1. - zrat)/ (1.05 - zrat) * 1.05))
+                  zpronmax = zprnutmax * zmax * MAX(0., MIN(1., ( zratiop - xqpnmin(ji,jj,jk) )   &
+                  &          / ( xqpnmax(ji,jj,jk) - xqpnmin(ji,jj,jk) + rtrn ), xlimnfe(ji,jj,jk) ) )
+                  zpronewn(ji,jj,jk) = zpronmax * zdaylen(ji,jj) * xnanono3(ji,jj,jk)
+                  zproregn(ji,jj,jk) = zpronmax * xnanonh4(ji,jj,jk)
+                  ! Uptake of phosphorus
+                  zrat = MIN( 1., zratiop / (xqpnmax(ji,jj,jk) + rtrn) )
+                  zmax = MAX(0., MIN(1., (1. - zrat)/ (1.05 - zrat) * 1.05))
+                  zpropmax = zprnutmax * zmax * xlimnfe(ji,jj,jk)
+                  zpropo4n(ji,jj,jk) = zpropmax * xnanopo4(ji,jj,jk)
+                  zprodopn(ji,jj,jk) = zpropmax * xnanodop(ji,jj,jk)
+                  ! Uptake of iron
+                  zrat = MIN( 1., zratiof / qfnmax )
+                  zmax = MAX(0., MIN(1., (1. - zrat)/ (1.05 - zrat) * 1.05))
+                  zprofmax = zprnutmax * qfnmax * zmax
+                  zprofen(ji,jj,jk) = zprofmax * xnanofer(ji,jj,jk) * ( 3. - 2.4 * xlimnfe(ji,jj,jk)    &
+                  &          / ( xlimnfe(ji,jj,jk) + 0.2 ) ) * (1. + 0.8 * xnanono3(ji,jj,jk) / ( rtrn  &
+                  &          + xnanono3(ji,jj,jk) + xnanonh4(ji,jj,jk) ) * (1. - xnanofer(ji,jj,jk) ) )
+               ENDIF
+            END DO
+         END DO
+      END DO
+
+      ! Computation of the various production terms of picophytoplankton 
+      DO jk = 1, jpkm1
+         DO jj = 1, jpj
+            DO ji = 1, jpi
+               IF( etot_ndcy(ji,jj,jk) > 1.E-3 ) THEN
+                  !  production terms for picophyto.
+                  zprorcap(ji,jj,jk) = zprpic(ji,jj,jk)  * xlimpic(ji,jj,jk) * trb(ji,jj,jk,jppic) * rfact2
+                  !
+                  zration = trb(ji,jj,jk,jpnpi) / ( trb(ji,jj,jk,jppic) + rtrn )
+                  zratiop = trb(ji,jj,jk,jpppi) / ( trb(ji,jj,jk,jppic) + rtrn )
+                  zratiof = trb(ji,jj,jk,jppfe) / ( trb(ji,jj,jk,jppic) + rtrn )
+                  zprnutmax = zprnut(ji,jj,jk) * fvpuptk(ji,jj,jk) / rno3 * trb(ji,jj,jk,jppic) * rfact2
+                  ! Uptake of nitrogen
+                  zrat = MIN( 1., zration / (xqnpmax(ji,jj,jk) + rtrn) )
+                  zmax = MAX(0., MIN(1., (1. - zrat)/ (1.05 - zrat) * 1.05))
+                  zpronmax = zprnutmax * zmax * MAX(0., MIN(1., ( zratiop - xqppmin(ji,jj,jk) )   &
+                  &          / ( xqppmax(ji,jj,jk) - xqppmin(ji,jj,jk) + rtrn ), xlimpfe(ji,jj,jk) ) )
+                  zpronewp(ji,jj,jk) = zpronmax * zdaylen(ji,jj) * xpicono3(ji,jj,jk) 
+                  zproregp(ji,jj,jk) = zpronmax * xpiconh4(ji,jj,jk)
+                  ! Uptake of phosphorus
+                  zrat = MIN( 1., zratiop / (xqppmax(ji,jj,jk) + rtrn) )
+                  zmax = MAX(0., MIN(1., (1. - zrat)/ (1.05 - zrat) * 1.05))
+                  zpropmax = zprnutmax * zmax * xlimpfe(ji,jj,jk)
+                  zpropo4p(ji,jj,jk) = zpropmax * xpicopo4(ji,jj,jk)
+                  zprodopp(ji,jj,jk) = zpropmax * xpicodop(ji,jj,jk)
+                  ! Uptake of iron
+                  zrat = MIN( 1., zratiof / qfpmax )
+                  zmax = MAX(0., MIN(1., (1. - zrat)/ (1.05 - zrat) * 1.05))
+                  zprofmax = zprnutmax * qfpmax * zmax
+                  zprofep(ji,jj,jk) = zprofmax * xpicofer(ji,jj,jk) * ( 3. - 2.4 * xlimpfe(ji,jj,jk)   &
+                  &          / ( xlimpfe(ji,jj,jk) + 0.2 ) ) * (1. + 0.8 * xpicono3(ji,jj,jk) / ( rtrn   &
+                  &          + xpicono3(ji,jj,jk) + xpiconh4(ji,jj,jk) ) * (1. - xpicofer(ji,jj,jk) ) )
+               ENDIF
+            END DO
+         END DO
+      END DO
+
+      ! Computation of the various production terms of diatoms
+      DO jk = 1, jpkm1
+         DO jj = 1, jpj
+            DO ji = 1, jpi
+               IF( etot_ndcy(ji,jj,jk) > 1.E-3 ) THEN
+                  !  production terms for diatomees
+                  zprorcad(ji,jj,jk) = zprdia(ji,jj,jk) * xlimdia(ji,jj,jk) * trb(ji,jj,jk,jpdia) * rfact2
+                  ! Computation of the respiration term according to pahlow 
+                  ! & oschlies (2013)
+                  !
+                  zration = trb(ji,jj,jk,jpndi) / ( trb(ji,jj,jk,jpdia) + rtrn )
+                  zratiop = trb(ji,jj,jk,jppdi) / ( trb(ji,jj,jk,jpdia) + rtrn )
+                  zratiof = trb(ji,jj,jk,jpdfe) / ( trb(ji,jj,jk,jpdia) + rtrn )
+                  zprnutmax = zprnut(ji,jj,jk) * fvduptk(ji,jj,jk) / rno3 * trb(ji,jj,jk,jpdia) * rfact2
+                  ! Uptake of nitrogen
+                  zrat = MIN( 1., zration / (xqndmax(ji,jj,jk) + rtrn) )
+                  zmax = MAX(0., MIN(1., (1. - zrat)/ (1.05 - zrat) * 1.05)) 
+                  zpronmax = zprnutmax * zmax * MAX(0., MIN(1., ( zratiop - xqpdmin(ji,jj,jk) )   &
+                  &          / ( xqpdmax(ji,jj,jk) - xqpdmin(ji,jj,jk) + rtrn ), xlimdfe(ji,jj,jk) ) )
+                  zpronewd(ji,jj,jk) = zpronmax * zdaylen(ji,jj) * xdiatno3(ji,jj,jk)
+                  zproregd(ji,jj,jk) = zpronmax * xdiatnh4(ji,jj,jk)
+                  ! Uptake of phosphorus
+                  zrat = MIN( 1., zratiop / (xqpdmax(ji,jj,jk) + rtrn) )
+                  zmax = MAX(0., MIN(1., (1. - zrat)/ (1.05 - zrat) * 1.05)) 
+                  zpropmax = zprnutmax * zmax * xlimdfe(ji,jj,jk)
+                  zpropo4d(ji,jj,jk) = zpropmax * xdiatpo4(ji,jj,jk)
+                  zprodopd(ji,jj,jk) = zpropmax * xdiatdop(ji,jj,jk)
+                  ! Uptake of iron
+                  zrat = MIN( 1., zratiof / qfdmax )
+                  zmax = MAX(0., MIN(1., (1. - zrat)/ (1.05 - zrat) * 1.05))
+                  zprofmax = zprnutmax * qfdmax * zmax
+                  zprofed(ji,jj,jk) = zprofmax * xdiatfer(ji,jj,jk) * ( 3. - 2.4 * xlimdfe(ji,jj,jk)     &
+                  &          / ( xlimdfe(ji,jj,jk) + 0.2 ) ) * (1. + 0.8 * xdiatno3(ji,jj,jk) / ( rtrn   &
+                  &          + xdiatno3(ji,jj,jk) + xdiatnh4(ji,jj,jk) ) * (1. - xdiatfer(ji,jj,jk) ) )
+               ENDIF
+            END DO
+         END DO
+      END DO
+
+      DO jk = 1, jpkm1
+         DO jj = 1, jpj
+            DO ji = 1, jpi
+               IF( etot_ndcy(ji,jj,jk) > 1.E-3 ) THEN
+                     !  production terms for nanophyto. ( chlorophyll )
+                  znanotot = enano(ji,jj,jk) / ( zmxl_chl(ji,jj,jk) + rtrn )
+                  zprod = rday * (zpronewn(ji,jj,jk) + zproregn(ji,jj,jk)) * zprchln(ji,jj,jk) * xlimphy(ji,jj,jk)
+                  thetannm_n   = MIN ( thetannm, ( thetannm / (1. - 1.14 / 43.4 *tsn(ji,jj,jk,jp_tem)))   &
+                  &               * (1. - 1.14 / 43.4 * 20.))
+                  zprochln = thetannm_n * zprod / ( zpislopeadn(ji,jj,jk) * znanotot + rtrn )
+                  zprochln = MAX(zprochln, chlcmin * 12. * zprorcan (ji,jj,jk) )
+                     !  production terms for picophyto. ( chlorophyll )
+                  zpicotot = epico(ji,jj,jk) / ( zmxl_chl(ji,jj,jk) + rtrn )
+                  zprod = rday * (zpronewp(ji,jj,jk) + zproregp(ji,jj,jk)) * zprchlp(ji,jj,jk) * xlimpic(ji,jj,jk)
+                  thetanpm_n   = MIN ( thetanpm, ( thetanpm / (1. - 1.14 / 43.4 *tsn(ji,jj,jk,jp_tem)))   &
+                  &               * (1. - 1.14 / 43.4 * 20.))
+                  zprochlp = thetanpm_n * zprod / ( zpislopeadp(ji,jj,jk) * zpicotot + rtrn )
+                  zprochlp = MAX(zprochlp, chlcmin * 12. * zprorcap(ji,jj,jk) )
+                  !  production terms for diatomees ( chlorophyll )
+                  zdiattot = ediat(ji,jj,jk) / ( zmxl_chl(ji,jj,jk) + rtrn )
+                  zprod = rday * (zpronewd(ji,jj,jk) + zproregd(ji,jj,jk)) * zprchld(ji,jj,jk) * xlimdia(ji,jj,jk)
+                  thetandm_n   = MIN ( thetandm, ( thetandm / (1. - 1.14 / 43.4 *tsn(ji,jj,jk,jp_tem)))   &
+                  &               * (1. - 1.14 / 43.4 * 20.))
+                  zprochld = thetandm_n * zprod / ( zpislopeadd(ji,jj,jk) * zdiattot + rtrn )
+                  zprochld = MAX(zprochld, chlcmin * 12. * zprorcad(ji,jj,jk) )
+                  !   Update the arrays TRA which contain the Chla sources and sinks
+                  tra(ji,jj,jk,jpnch) = tra(ji,jj,jk,jpnch) + zprochln * texcretn
+                  tra(ji,jj,jk,jpdch) = tra(ji,jj,jk,jpdch) + zprochld * texcretd
+                  tra(ji,jj,jk,jppch) = tra(ji,jj,jk,jppch) + zprochlp * texcretp
+               ENDIF
+            END DO
+         END DO
+      END DO
+
+      !   Update the arrays TRA which contain the biological sources and sinks
+      DO jk = 1, jpkm1
+         DO jj = 1, jpj
+           DO ji =1 ,jpi
+              zprontot = zpronewn(ji,jj,jk) + zproregn(ji,jj,jk)
+              zproptot = zpronewp(ji,jj,jk) + zproregp(ji,jj,jk)
+              zprodtot = zpronewd(ji,jj,jk) + zproregd(ji,jj,jk)
+              zdocprod = excretd * zprorcad(ji,jj,jk) + excretn * zprorcan(ji,jj,jk)  &
+              &          + excretp * zprorcap(ji,jj,jk)
+              tra(ji,jj,jk,jppo4) = tra(ji,jj,jk,jppo4) - zpropo4n(ji,jj,jk) - zpropo4d(ji,jj,jk)  &
+              &                     - zpropo4p(ji,jj,jk)
+              tra(ji,jj,jk,jpno3) = tra(ji,jj,jk,jpno3) - zpronewn(ji,jj,jk) - zpronewd(ji,jj,jk)  &
+              &                     - zpronewp(ji,jj,jk)
+              tra(ji,jj,jk,jpnh4) = tra(ji,jj,jk,jpnh4) - zproregn(ji,jj,jk) - zproregd(ji,jj,jk)  &
+              &                     - zproregp(ji,jj,jk)
+              tra(ji,jj,jk,jpphy) = tra(ji,jj,jk,jpphy) + zprorcan(ji,jj,jk) * texcretn    &
+                 &                  - zpsino3 * zpronewn(ji,jj,jk) - zpsinh4 * zproregn(ji,jj,jk)   &
+                 &                  - zrespn(ji,jj,jk) 
+              zcroissn(ji,jj,jk) = tra(ji,jj,jk,jpphy) / rfact2/ (trb(ji,jj,jk,jpphy) + rtrn)
+              tra(ji,jj,jk,jpnph) = tra(ji,jj,jk,jpnph) + zprontot * texcretn
+              tra(ji,jj,jk,jppph) = tra(ji,jj,jk,jppph) + zpropo4n(ji,jj,jk) * texcretn   &
+              &                     + zprodopn(ji,jj,jk) * texcretn
+              tra(ji,jj,jk,jpnfe) = tra(ji,jj,jk,jpnfe) + zprofen(ji,jj,jk) * texcretn
+              tra(ji,jj,jk,jppic) = tra(ji,jj,jk,jppic) + zprorcap(ji,jj,jk) * texcretp     &
+                 &                  - zpsino3 * zpronewp(ji,jj,jk) - zpsinh4 * zproregp(ji,jj,jk)   &
+                 &                  - zrespp(ji,jj,jk) 
+              zcroissp(ji,jj,jk) = tra(ji,jj,jk,jppic) / rfact2/ (trb(ji,jj,jk,jppic) + rtrn)
+              tra(ji,jj,jk,jpnpi) = tra(ji,jj,jk,jpnpi) + zproptot * texcretp
+              tra(ji,jj,jk,jpppi) = tra(ji,jj,jk,jpppi) + zpropo4p(ji,jj,jk) * texcretp   &
+              &                     + zprodopp(ji,jj,jk) * texcretp
+              tra(ji,jj,jk,jppfe) = tra(ji,jj,jk,jppfe) + zprofep(ji,jj,jk) * texcretp
+              tra(ji,jj,jk,jpdia) = tra(ji,jj,jk,jpdia) + zprorcad(ji,jj,jk) * texcretd   &
+                 &                  - zpsino3 * zpronewd(ji,jj,jk) - zpsinh4 * zproregd(ji,jj,jk)   &
+                 &                  - zrespd(ji,jj,jk) 
+              zcroissd(ji,jj,jk) = tra(ji,jj,jk,jpdia) / rfact2 / (trb(ji,jj,jk,jpdia) + rtrn)
+              tra(ji,jj,jk,jpndi) = tra(ji,jj,jk,jpndi) + zprodtot * texcretd
+              tra(ji,jj,jk,jppdi) = tra(ji,jj,jk,jppdi) + zpropo4d(ji,jj,jk) * texcretd   &
+              &                     + zprodopd(ji,jj,jk) * texcretd
+              tra(ji,jj,jk,jpdfe) = tra(ji,jj,jk,jpdfe) + zprofed(ji,jj,jk) * texcretd
+              tra(ji,jj,jk,jpdsi) = tra(ji,jj,jk,jpdsi) + zprorcad(ji,jj,jk) * zysopt(ji,jj,jk) * texcretd
+              tra(ji,jj,jk,jpdoc) = tra(ji,jj,jk,jpdoc) + excretd * zprorcad(ji,jj,jk) + excretn * zprorcan(ji,jj,jk)  &
+              &                     + excretp * zprorcap(ji,jj,jk)
+              tra(ji,jj,jk,jpdon) = tra(ji,jj,jk,jpdon) + excretd * zprodtot + excretn * zprontot   &
+              &                     + excretp * zproptot
+              tra(ji,jj,jk,jpdop) = tra(ji,jj,jk,jpdop) + excretd * zpropo4d(ji,jj,jk) + excretn * zpropo4n(ji,jj,jk)   &
+              &    - texcretn * zprodopn(ji,jj,jk) - texcretd * zprodopd(ji,jj,jk) + excretp * zpropo4p(ji,jj,jk)     &
+              &    - texcretp * zprodopp(ji,jj,jk)
+              tra(ji,jj,jk,jpoxy) = tra(ji,jj,jk,jpoxy) + o2ut * ( zproregn(ji,jj,jk) + zproregd(ji,jj,jk)   &
+                 &                + zproregp(ji,jj,jk) ) + ( o2ut + o2nit ) * ( zpronewn(ji,jj,jk)           &
+                 &                + zpronewd(ji,jj,jk) + zpronewp(ji,jj,jk) )   &
+                 &                - o2ut * ( zrespn(ji,jj,jk) + zrespp(ji,jj,jk) + zrespd(ji,jj,jk) )
+              zfeup = texcretn * zprofen(ji,jj,jk) + texcretd * zprofed(ji,jj,jk) + texcretp * zprofep(ji,jj,jk)
+              tra(ji,jj,jk,jpfer) = tra(ji,jj,jk,jpfer) - zfeup
+              tra(ji,jj,jk,jpsil) = tra(ji,jj,jk,jpsil) - texcretd * zprorcad(ji,jj,jk) * zysopt(ji,jj,jk)
+              tra(ji,jj,jk,jpdic) = tra(ji,jj,jk,jpdic) - zprorcan(ji,jj,jk) - zprorcad(ji,jj,jk) - zprorcap(ji,jj,jk)  &
+              &                     + zpsino3 * zpronewn(ji,jj,jk) + zpsinh4 * zproregn(ji,jj,jk)   &
+              &                     + zpsino3 * zpronewp(ji,jj,jk) + zpsinh4 * zproregp(ji,jj,jk)   &
+              &                     + zpsino3 * zpronewd(ji,jj,jk) + zpsinh4 * zproregd(ji,jj,jk)  &
+              &                     + zrespn(ji,jj,jk) + zrespd(ji,jj,jk) + zrespp(ji,jj,jk) 
+              tra(ji,jj,jk,jptal) = tra(ji,jj,jk,jptal) + rno3 * ( zpronewn(ji,jj,jk) + zpronewd(ji,jj,jk)  &
+              &                     + zpronewp(ji,jj,jk) ) - rno3 * ( zproregn(ji,jj,jk) + zproregd(ji,jj,jk)     &
+              &                     + zproregp(ji,jj,jk) ) 
+          END DO
+        END DO
+     END DO
+     !
+     IF( ln_ligand ) THEN
+         DO jk = 1, jpkm1
+            DO jj = 1, jpj
+              DO ji =1 ,jpi
+                 zdocprod = excretd * zprorcad(ji,jj,jk) + excretn * zprorcan(ji,jj,jk) + excretp * zprorcap(ji,jj,jk)
+                 zfeup    = texcretn * zprofen(ji,jj,jk) + texcretd * zprofed(ji,jj,jk) + texcretp * zprofep(ji,jj,jk)
+                 tra(ji,jj,jk,jplgw) = tra(ji,jj,jk,jplgw) + zdocprod * ldocp - zfeup * plig(ji,jj,jk) * lthet
+              END DO
+           END DO
+        END DO
+     ENDIF
+
+
+     ! Total primary production per year
+
+    ! Total primary production per year
+    IF( iom_use( "tintpp" ) .OR. ( ln_check_mass .AND. kt == nitend .AND. knt == nrdttrc )  )  &
+      & tpp = glob_sum( ( zprorcan(:,:,:) + zprorcad(:,:,:) + zprorcap(:,:,:) ) * cvol(:,:,:) )
+
+    IF( lk_iomput ) THEN
+       IF( knt == nrdttrc ) THEN
+          CALL wrk_alloc( jpi, jpj,      zw2d )
+          CALL wrk_alloc( jpi, jpj, jpk, zw3d )
+          zfact = 1.e+3 * rfact2r  !  conversion from mol/l/kt to  mol/m3/s
+          !
+          IF( iom_use( "PPPHYN" ) .OR. iom_use( "PPPHYD" ) .OR. iom_use( "PPPHYP" ) )  THEN
+              zw3d(:,:,:) = zprorcan(:,:,:) * zfact * tmask(:,:,:)  ! primary production by nanophyto
+              CALL iom_put( "PPPHYN"  , zw3d )
+              !
+              zw3d(:,:,:) = zprorcap(:,:,:) * zfact * tmask(:,:,:)  ! primary production by picophyto
+              CALL iom_put( "PPPHYP"  , zw3d )
+              !
+              zw3d(:,:,:) = zprorcad(:,:,:) * zfact * tmask(:,:,:)  ! primary production by diatomes
+              CALL iom_put( "PPPHYD"  , zw3d )
+          ENDIF
+          IF( iom_use( "PPNEWN" ) .OR. iom_use( "PPNEWD" ) .OR. iom_use( "PPNEWP" ) )  THEN
+              zw3d(:,:,:) = zpronewn(:,:,:) * zfact * tmask(:,:,:)  ! new primary production by nanophyto
+              CALL iom_put( "PPNEWN"  , zw3d )
+              !
+              zw3d(:,:,:) = zpronewp(:,:,:) * zfact * tmask(:,:,:)  ! new primary production by picophyto
+              CALL iom_put( "PPNEWP"  , zw3d )
+              !
+              zw3d(:,:,:) = zpronewd(:,:,:) * zfact * tmask(:,:,:)  ! new primary production by diatomes
+              CALL iom_put( "PPNEWD"  , zw3d )
+          ENDIF
+          IF( iom_use( "PBSi" ) )  THEN
+              zw3d(:,:,:) = zprorcad(:,:,:) * zfact * tmask(:,:,:) * zysopt(:,:,:) ! biogenic silica production
+              CALL iom_put( "PBSi"  , zw3d )
+          ENDIF
+          IF( iom_use( "PFeN" ) .OR. iom_use( "PFeD" ) .OR. iom_use( "PFeP" ) )  THEN
+              zw3d(:,:,:) = zprofen(:,:,:) * zfact * tmask(:,:,:)  ! biogenic iron production by nanophyto
+              CALL iom_put( "PFeN"  , zw3d )
+              !
+              zw3d(:,:,:) = zprofep(:,:,:) * zfact * tmask(:,:,:)  ! biogenic iron production by picophyto
+              CALL iom_put( "PFeP"  , zw3d )
+              !
+              zw3d(:,:,:) = zprofed(:,:,:) * zfact * tmask(:,:,:)  ! biogenic iron production by  diatomes
+              CALL iom_put( "PFeD"  , zw3d )
+          ENDIF
+          IF( iom_use( "Mumax" ) )  THEN
+              zw3d(:,:,:) = prmaxn(:,:,:) * tmask(:,:,:)   ! Maximum growth rate
+              CALL iom_put( "Mumax"  , zw3d )
+          ENDIF
+          IF( iom_use( "MuN" ) .OR. iom_use( "MuD" ) .OR. iom_use( "MuP" ) )  THEN
+              zw3d(:,:,:) = zprbio(:,:,:) * xlimphy(:,:,:) * tmask(:,:,:)  ! Realized growth rate for nanophyto
+              CALL iom_put( "MuN"  , zw3d )
+              !
+              zw3d(:,:,:) = zprpic(:,:,:) * xlimpic(:,:,:) * tmask(:,:,:)  ! Realized growth rate for picophyto
+              CALL iom_put( "MuP"  , zw3d )
+              !
+              zw3d(:,:,:) =  zprdia(:,:,:) * xlimdia(:,:,:) * tmask(:,:,:)  ! Realized growth rate for diatoms
+              CALL iom_put( "MuD"  , zw3d )
+          ENDIF
+          IF( iom_use( "LNlight" ) .OR. iom_use( "LDlight" ) .OR. iom_use( "LPlight" ) )  THEN
+              zw3d(:,:,:) = zprbio (:,:,:) / (prmaxn(:,:,:) + rtrn) * tmask(:,:,:) ! light limitation term
+              CALL iom_put( "LNlight"  , zw3d )
+              !
+              zw3d(:,:,:) = zprpic (:,:,:) / (prmaxp(:,:,:) + rtrn) * tmask(:,:,:) ! light limitation term
+              CALL iom_put( "LPlight"  , zw3d )
+              !
+              zw3d(:,:,:) =  zprdia (:,:,:) / (prmaxd(:,:,:) + rtrn) * tmask(:,:,:)  ! light limitation term
+              CALL iom_put( "LDlight"  , zw3d )
+          ENDIF
+          IF( iom_use( "MunetN" ) .OR. iom_use( "MunetD" ) .OR. iom_use( "MunetP" ) )  THEN
+              zw3d(:,:,:) = zcroissn(:,:,:) * tmask(:,:,:) ! ! Realized growth rate for nanophyto
+              CALL iom_put( "MunetN"  , zw3d )
+              !
+              zw3d(:,:,:) = zcroissp(:,:,:) * tmask(:,:,:) ! ! Realized growth rate for picophyto
+              CALL iom_put( "MunetP"  , zw3d )
+              !
+              zw3d(:,:,:) = zcroissd(:,:,:) * tmask(:,:,:) ! ! Realized growth rate for diatomes
+              CALL iom_put( "MunetD"  , zw3d )
+              !
+          ENDIF
+
+          IF( iom_use( "tintpp" ) )  CALL iom_put( "tintpp" , tpp * zfact )  !  global total integrated primary production molC/s
+          !
+          CALL wrk_dealloc( jpi, jpj,      zw2d )
+          CALL wrk_dealloc( jpi, jpj, jpk, zw3d )
+       ENDIF
+     ENDIF
+
+      IF(ln_ctl)   THEN  ! print mean trends (used for debugging)
+         WRITE(charout, FMT="('prod')")
+         CALL prt_ctl_trc_info(charout)
+         CALL prt_ctl_trc(tab4d=tra, mask=tmask, clinfo=ctrcnm)
+      ENDIF
+      !
+      CALL wrk_dealloc( jpi, jpj,      zmixnano, zmixpico, zmixdiat, zstrn )
+      CALL wrk_dealloc( jpi, jpj, jpk, zmxl_fac, zmxl_chl )
+      CALL wrk_dealloc( jpi, jpj, jpk, zpislopeadn, zpislopeadp, zpislopeadd, zysopt )                           
+      CALL wrk_dealloc( jpi, jpj, jpk, zprdia, zprpic, zprbio, zprorcan, zprorcap, zprorcad )
+      CALL wrk_dealloc( jpi, jpj, jpk, zprofed, zprofep, zprofen ) 
+      CALL wrk_dealloc( jpi, jpj, jpk, zpronewn, zpronewp, zpronewd, zproregn, zproregp, zproregd )
+      CALL wrk_dealloc( jpi, jpj, jpk, zpropo4n, zpropo4p, zpropo4d, zrespn, zrespp, zrespd, zprnut )
+      CALL wrk_dealloc( jpi, jpj, jpk, zprchln, zprchlp, zprchld, zprodopn, zprodopp, zprodopd )
+      CALL wrk_dealloc( jpi, jpj, jpk, zcroissp, zcroissn, zcroissd )
+      !
+      IF( nn_timing == 1 )  CALL timing_stop('p5z_prod')
+      !
+   END SUBROUTINE p5z_prod
+
+
+   SUBROUTINE p5z_prod_init
+      !!----------------------------------------------------------------------
+      !!                  ***  ROUTINE p5z_prod_init  ***
+      !!
+      !! ** Purpose :   Initialization of phytoplankton production parameters
+      !!
+      !! ** Method  :   Read the nampisprod namelist and check the parameters
+      !!      called at the first timestep (nittrc000)
+      !!
+      !! ** input   :   Namelist nampisprod
+      !!----------------------------------------------------------------------
+      !
+      NAMELIST/namp5zprod/ pislopen, pislopep, pisloped, excretn, excretp, excretd,     &
+         &                 thetannm, thetanpm, thetandm, chlcmin, grosip, bresp, xadap
+
+      INTEGER :: ios                 ! Local integer output status for namelist read
+      !!----------------------------------------------------------------------
+
+      REWIND( numnatp_ref )              ! Namelist nampisprod in reference namelist : Pisces phytoplankton production
+      READ  ( numnatp_ref, namp5zprod, IOSTAT = ios, ERR = 901)
+901   IF( ios /= 0 ) CALL ctl_nam ( ios , 'namp5zprod in reference namelist', lwp )
+
+      REWIND( numnatp_cfg )              ! Namelist nampisprod in configuration namelist : Pisces phytoplankton production
+      READ  ( numnatp_cfg, namp5zprod, IOSTAT = ios, ERR = 902 )
+902   IF( ios /= 0 ) CALL ctl_nam ( ios , 'namp5zprod in configuration namelist', lwp )
+      IF(lwm) WRITE ( numonp, namp5zprod )
+
+      IF(lwp) THEN                         ! control print
+         WRITE(numout,*) ' '
+         WRITE(numout,*) ' Namelist parameters for phytoplankton growth, namp5zprod'
+         WRITE(numout,*) ' ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~'
+         WRITE(numout,*) '    mean Si/C ratio                           grosip       =', grosip
+         WRITE(numout,*) '    P-I slope                                 pislopen     =', pislopen
+         WRITE(numout,*) '    P-I slope  for diatoms                    pisloped     =', pisloped
+         WRITE(numout,*) '    P-I slope  for picophytoplankton          pislopep     =', pislopep
+         WRITE(numout,*) '    Acclimation factor to low light           xadap        =', xadap
+         WRITE(numout,*) '    excretion ratio of nanophytoplankton      excretn      =', excretn
+         WRITE(numout,*) '    excretion ratio of picophytoplankton      excretp      =', excretp
+         WRITE(numout,*) '    excretion ratio of diatoms                excretd      =', excretd
+         WRITE(numout,*) '    basal respiration in phytoplankton        bresp        =', bresp
+         WRITE(numout,*) '    Maximum Chl/C in phytoplankton            chlcmin      =', chlcmin
+         WRITE(numout,*) '    Minimum Chl/N in nanophytoplankton        thetannm     =', thetannm
+         WRITE(numout,*) '    Minimum Chl/N in picophytoplankton        thetanpm     =', thetanpm
+         WRITE(numout,*) '    Minimum Chl/N in diatoms                  thetandm     =', thetandm
+      ENDIF
+      !
+      r1_rday   = 1._wp / rday 
+      texcretn  = 1._wp - excretn
+      texcretp  = 1._wp - excretp
+      texcretd  = 1._wp - excretd
+      tpp       = 0._wp
+      !
+   END SUBROUTINE p5z_prod_init
+
+
+   INTEGER FUNCTION p5z_prod_alloc()
+      !!----------------------------------------------------------------------
+      !!                     ***  ROUTINE p5z_prod_alloc  ***
+      !!----------------------------------------------------------------------
+      ALLOCATE( prmaxn(jpi,jpj,jpk), prmaxp(jpi,jpj,jpk), prmaxd(jpi,jpj,jpk),  &
+      &          zdaylen(jpi,jpj), STAT = p5z_prod_alloc )
+      !
+      IF( p5z_prod_alloc /= 0 ) CALL ctl_warn('p5z_prod_alloc : failed to allocate arrays.')
+      !
+   END FUNCTION p5z_prod_alloc
+   !!======================================================================
+END MODULE  p5zprod
Index: branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/NEMO/TOP_SRC/PISCES/SED/par_sed.F90
===================================================================
--- branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/NEMO/TOP_SRC/PISCES/SED/par_sed.F90	(revision 7383)
+++ branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/NEMO/TOP_SRC/PISCES/SED/par_sed.F90	(revision 7391)
@@ -24,9 +24,5 @@
 #endif
 
-#if defined key_kriest
-   INTEGER, PARAMETER :: jpdta = 11
-#else
    INTEGER, PARAMETER :: jpdta = 12
-#endif
 
 
Index: branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/NEMO/TOP_SRC/PISCES/SED/sed.F90
===================================================================
--- branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/NEMO/TOP_SRC/PISCES/SED/sed.F90	(revision 7383)
+++ branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/NEMO/TOP_SRC/PISCES/SED/sed.F90	(revision 7391)
@@ -40,7 +40,5 @@
 
    USE p4zsink , ONLY :  sinking    =>   sinking         !: sinking flux for POC
-#if ! defined key_kriest
    USE p4zsink , ONLY :  sinking2   =>   sinking2        !: sinking flux for GOC
-#endif
    USE p4zsink , ONLY :  sinkcal    =>   sinkcal         !: sinking flux for calcite
    USE p4zsink , ONLY :  sinksil    =>   sinksil         !: sinking flux for opal ( dsi )
Index: branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/NEMO/TOP_SRC/PISCES/SED/seddta.F90
===================================================================
--- branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/NEMO/TOP_SRC/PISCES/SED/seddta.F90	(revision 7383)
+++ branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/NEMO/TOP_SRC/PISCES/SED/seddta.F90	(revision 7391)
@@ -55,7 +55,5 @@
 
       REAL(wp), DIMENSION(:,:), ALLOCATABLE :: zdta
-#if ! defined key_kriest
       REAL(wp), DIMENSION(:)  , ALLOCATABLE :: zdtap, zdtag
-#endif 
 
 
@@ -97,11 +95,7 @@
       ENDIF
 
-
-#if ! defined key_kriest   
       ! Initialization of temporaries arrays  
       ALLOCATE( zdtap(jpoce) )    ;   zdtap(:)    = 0. 
       ALLOCATE( zdtag(jpoce) )    ;   zdtag(:)    = 0.  
-#endif
-
 
       IF( MOD( kt - 1, nfreq ) == 0 ) THEN
@@ -122,5 +116,4 @@
                   trc_data(ji,jj,5)  = trn  (ji,jj,ikt,jpoxy)
                   trc_data(ji,jj,6)  = trn  (ji,jj,ikt,jpsil)
-#   if ! defined key_kriest
                   trc_data(ji,jj,7 ) = sinksil (ji,jj,ikt)
                   trc_data(ji,jj,8 ) = sinking (ji,jj,ikt)
@@ -129,11 +122,4 @@
                   trc_data(ji,jj,11) = tsn     (ji,jj,ikt,jp_tem)
                   trc_data(ji,jj,12) = tsn     (ji,jj,ikt,jp_sal)
-#   else
-                  trc_data(ji,jj,7 ) = sinksil (ji,jj,ikt)
-                  trc_data(ji,jj,8 ) = sinking (ji,jj,ikt)
-                  trc_data(ji,jj,9 ) = sinkcal (ji,jj,ikt)
-                  trc_data(ji,jj,10) = tsn     (ji,jj,ikt,jp_tem)
-                  trc_data(ji,jj,11) = tsn     (ji,jj,ikt,jp_sal)       
-#   endif
                ENDIF
             ENDDO
@@ -147,5 +133,4 @@
          CALL iom_get( numbio, jpdom_data, 'O2BOT'      , trc_data(:,:,5 ) )
          CALL iom_get( numbio, jpdom_data, 'SIBOT'      , trc_data(:,:,6 ) )
-#   if ! defined key_kriest
          CALL iom_get( numbio, jpdom_data, 'OPALFLXBOT' , trc_data(:,:,7 ) ) 
          CALL iom_get( numbio, jpdom_data, 'POCFLXBOT'  , trc_data(:,:,8 ) ) 
@@ -154,11 +139,4 @@
          CALL iom_get( numoce, jpdom_data, 'TBOT'       , trc_data(:,:,11) ) 
          CALL iom_get( numoce, jpdom_data, 'SBOT'       , trc_data(:,:,12) ) 
-#   else
-         CALL iom_get( numbio, jpdom_data, 'OPALFLXBOT' , trc_data(:,:,7 ) ) 
-         CALL iom_get( numbio, jpdom_data, 'POCFLXBOT'  , trc_data(:,:,8 ) ) 
-         CALL iom_get( numbio, jpdom_data, 'CACO3FLXBOT', trc_data(:,:,9 ) ) 
-         CALL iom_get( numoce, jpdom_data, 'TBOT'       , trc_data(:,:,10) ) 
-         CALL iom_get( numoce, jpdom_data, 'SBOT'       , trc_data(:,:,11) ) 
-#   endif
 #endif
 
@@ -186,5 +164,4 @@
          !  Solid components : 
          !-----------------------
-#if ! defined key_kriest
          !  Sinking fluxes for OPAL in mol.m-2.s-1 ; conversion in mol.cm-2.s-1
          CALL pack_arr ( jpoce, rainrm_dta(1:jpoce,jsopal), trc_data(1:jpi,1:jpj,7), iarroce(1:jpoce) ) 
@@ -200,19 +177,4 @@
          CALL pack_arr ( jpoce,  temp(1:jpoce), trc_data(1:jpi,1:jpj,11), iarroce(1:jpoce) )
          CALL pack_arr ( jpoce,  salt(1:jpoce), trc_data(1:jpi,1:jpj,12), iarroce(1:jpoce) )
-#else
-         !  Sinking fluxes for OPAL in mol.m-2.s-1 ; conversion in mol.cm-2.s-1
-         CALL pack_arr ( jpoce, rainrm_dta(1:jpoce,jsopal), trc_data(1:jpi,1:jpj,7), iarroce(1:jpoce) ) 
-         rainrm_dta(1:jpoce,jsopal) = rainrm_dta(1:jpoce,jsopal) * 1e-4
-         !  Sinking fluxes for POC in mol.m-2.s-1 ; conversion in mol.cm-2.s-1
-         CALL pack_arr ( jpoce, rainrm_dta(1:jpoce,jspoc), trc_data(1:jpi,1:jpj,8) , iarroce(1:jpoce) )      
-         rainrm_dta(1:jpoce,jspoc) = rainrm_dta(1:jpoce,jspoc) * 1e-4
-         !  Sinking fluxes for Calcite in mol.m-2.s-1 ; conversion in mol.cm-2.s-1
-         CALL pack_arr ( jpoce,  rainrm_dta(1:jpoce,jscal), trc_data(1:jpi,1:jpj,9), iarroce(1:jpoce) )
-         rainrm_dta(1:jpoce,jscal) = rainrm_dta(1:jpoce,jscal) * 1e-4
-         ! vector temperature [°C] and salinity 
-         CALL pack_arr ( jpoce,  temp(1:jpoce), trc_data(1:jpi,1:jpj,10), iarroce(1:jpoce) )
-         CALL pack_arr ( jpoce,  salt(1:jpoce), trc_data(1:jpi,1:jpj,11), iarroce(1:jpoce) )
-
-#endif
         
          ! Clay rain rate in [mol/(cm**2.s)] 
@@ -252,7 +214,5 @@
 
       DEALLOCATE( zdta ) 
-#if ! defined key_kriest
       DEALLOCATE( zdtap    ) ;  DEALLOCATE( zdtag    ) 
-#endif      
 
       IF( kt == nitsedend )   THEN
Index: branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/NEMO/TOP_SRC/PISCES/SED/sedmodel.F90
===================================================================
--- branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/NEMO/TOP_SRC/PISCES/SED/sedmodel.F90	(revision 7383)
+++ branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/NEMO/TOP_SRC/PISCES/SED/sedmodel.F90	(revision 7391)
@@ -15,7 +15,4 @@
    PUBLIC sed_model  ! called by step.F90
 
-   LOGICAL, PUBLIC, PARAMETER ::   lk_sed = .TRUE.     !: sediment flag
-
-   !! $Id$
 CONTAINS
 
@@ -47,6 +44,4 @@
    !! MODULE sedmodel  :   Dummy module 
    !!======================================================================
-   LOGICAL, PUBLIC, PARAMETER ::   lk_sed = .FALSE.     !: sediment flag
-   !! $Id$
 CONTAINS
    SUBROUTINE sed_model( kt )         ! Empty routine
Index: branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/NEMO/TOP_SRC/PISCES/par_pisces.F90
===================================================================
--- branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/NEMO/TOP_SRC/PISCES/par_pisces.F90	(revision 7383)
+++ branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/NEMO/TOP_SRC/PISCES/par_pisces.F90	(revision 7391)
@@ -13,128 +13,58 @@
    IMPLICIT NONE
 
-#if defined key_pisces_reduced
-   !!---------------------------------------------------------------------
-   !!   'key_pisces_reduced'   :                                LOBSTER bio-model
-   !!---------------------------------------------------------------------
-   LOGICAL, PUBLIC, PARAMETER ::   lk_pisces     = .TRUE.  !: PISCES flag 
-   LOGICAL, PUBLIC, PARAMETER ::   lk_p4z        = .FALSE. !: p4z flag 
-   INTEGER, PUBLIC, PARAMETER ::   jp_pisces     =  6      !: number of passive tracers
-   INTEGER, PUBLIC, PARAMETER ::   jp_pisces_2d  =  19     !: additional 2d output 
-   INTEGER, PUBLIC, PARAMETER ::   jp_pisces_3d  =   3     !: additional 3d output 
-   INTEGER, PUBLIC, PARAMETER ::   jp_pisces_trd =   17    !: number of sms trends for PISCES
+   ! productive layer depth
+   INTEGER, PUBLIC ::   jpkb       !: first vertical layers where biology is active
+   INTEGER, PUBLIC ::   jpkbm1     !: first vertical layers where biology is active
 
    ! assign an index in trc arrays for each LOBSTER prognostic variables
-   INTEGER, PUBLIC, PARAMETER ::   jpdet     =  1        !: detritus                    [mmoleN/m3]
-   INTEGER, PUBLIC, PARAMETER ::   jpzoo     =  2        !: zooplancton concentration   [mmoleN/m3]
-   INTEGER, PUBLIC, PARAMETER ::   jpphy     =  3        !: phytoplancton concentration [mmoleN/m3]
-   INTEGER, PUBLIC, PARAMETER ::   jpno3     =  4        !: nitrate concentration       [mmoleN/m3]
-   INTEGER, PUBLIC, PARAMETER ::   jpnh4     =  5        !: ammonium concentration      [mmoleN/m3]
-   INTEGER, PUBLIC, PARAMETER ::   jpdom     =  6        !: dissolved organic matter    [mmoleN/m3]
+   INTEGER, PUBLIC ::   jpdet     !: detritus                   
+   INTEGER, PUBLIC ::   jpdom     !: dissolved organic matter 
+   INTEGER, PUBLIC ::   jpdic     !: dissolved inoganic carbon concentration 
+   INTEGER, PUBLIC ::   jptal     !: total alkalinity 
+   INTEGER, PUBLIC ::   jpoxy     !: oxygen carbon concentration 
+   INTEGER, PUBLIC ::   jpcal     !: calcite  concentration 
+   INTEGER, PUBLIC ::   jppo4     !: phosphate concentration 
+   INTEGER, PUBLIC ::   jppoc     !: small particulate organic phosphate concentration
+   INTEGER, PUBLIC ::   jpsil     !: silicate concentration
+   INTEGER, PUBLIC ::   jpphy     !: phytoplancton concentration 
+   INTEGER, PUBLIC ::   jpzoo     !: zooplancton concentration
+   INTEGER, PUBLIC ::   jpdoc     !: dissolved organic carbon concentration 
+   INTEGER, PUBLIC ::   jpdia     !: Diatoms Concentration
+   INTEGER, PUBLIC ::   jpmes     !: Mesozooplankton Concentration
+   INTEGER, PUBLIC ::   jpdsi     !: Diatoms Silicate Concentration
+   INTEGER, PUBLIC ::   jpfer     !: Iron Concentration
+   INTEGER, PUBLIC ::   jpbfe     !: Big iron particles Concentration
+   INTEGER, PUBLIC ::   jpgoc     !: big particulate organic phosphate concentration
+   INTEGER, PUBLIC ::   jpsfe     !: Small iron particles Concentration
+   INTEGER, PUBLIC ::   jpdfe     !: Diatoms iron Concentration
+   INTEGER, PUBLIC ::   jpgsi     !: (big) Silicate Concentration
+   INTEGER, PUBLIC ::   jpnfe     !: Nano iron Concentration
+   INTEGER, PUBLIC ::   jpnch     !: Nano Chlorophyll Concentration
+   INTEGER, PUBLIC ::   jpdch     !: Diatoms Chlorophyll Concentration
+   INTEGER, PUBLIC ::   jpno3     !: Nitrates Concentration
+   INTEGER, PUBLIC ::   jpnh4     !: Ammonium Concentration
+   INTEGER, PUBLIC ::   jpdon     !: dissolved organic nitrogen concentration
+   INTEGER, PUBLIC ::   jpdop     !: dissolved organic phosphorus concentration
+   INTEGER, PUBLIC ::   jppon     !: small particulate organic nitrogen concentration
+   INTEGER, PUBLIC ::   jppop     !: small particulate organic phosphorus concentration
+   INTEGER, PUBLIC ::   jpnph     !: small particulate organic phosphorus concentration
+   INTEGER, PUBLIC ::   jppph     !: small particulate organic phosphorus concentration
+   INTEGER, PUBLIC ::   jpndi     !: small particulate organic phosphorus concentration
+   INTEGER, PUBLIC ::   jppdi     !: small particulate organic phosphorus concentration
+   INTEGER, PUBLIC ::   jppic     !: small particulate organic phosphorus concentration
+   INTEGER, PUBLIC ::   jpnpi     !: small particulate organic phosphorus concentration
+   INTEGER, PUBLIC ::   jpppi     !: small particulate organic phosphorus concentration
+   INTEGER, PUBLIC ::   jppfe     !: small particulate organic phosphorus concentration
+   INTEGER, PUBLIC ::   jppch     !: small particulate organic phosphorus concentration
+   INTEGER, PUBLIC ::   jpgon     !: Big nitrogen particles Concentration
+   INTEGER, PUBLIC ::   jpgop     !: Big phosphorus particles Concentration
+   INTEGER, PUBLIC ::   jplgw     !: Weak Ligands
+   INTEGER, PUBLIC ::   jpfep     !: Fe nanoparticle
 
-   ! productive layer depth
-   INTEGER, PUBLIC, PARAMETER ::   jpkb      = 12        !: first vertical layers where biology is active
-   INTEGER, PUBLIC, PARAMETER ::   jpkbm1    = jpkb - 1  !: first vertical layers where biology is active
-
-#elif defined key_pisces  &&  defined key_kriest
-   !!---------------------------------------------------------------------
-   !!   'key_pisces' & 'key_kriest'                 PISCES bio-model + ???
-   !!---------------------------------------------------------------------
-   LOGICAL, PUBLIC, PARAMETER ::   lk_pisces     = .TRUE.  !: PISCES flag 
-   LOGICAL, PUBLIC, PARAMETER ::   lk_p4z        = .TRUE. !: p4z flag 
-   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 
-   INTEGER, PUBLIC, PARAMETER ::   jp_pisces_3d  =  18     !: additional 3d output 
-   INTEGER, PUBLIC, PARAMETER ::   jp_pisces_trd =   1     !: number of sms trends for PISCES
-
-   ! assign an index in trc arrays for each LOBSTER prognostic variables
-   !    WARNING: be carefull about the order when reading the restart
-        !   !!gm  this warning should be obsolet with IOM
-   INTEGER, PUBLIC, PARAMETER ::   jpdic =  1    !: dissolved inoganic carbon concentration 
-   INTEGER, PUBLIC, PARAMETER ::   jptal =  2    !: total alkalinity 
-   INTEGER, PUBLIC, PARAMETER ::   jpoxy =  3    !: oxygen carbon concentration 
-   INTEGER, PUBLIC, PARAMETER ::   jpcal =  4    !: calcite  concentration 
-   INTEGER, PUBLIC, PARAMETER ::   jppo4 =  5    !: phosphate concentration 
-   INTEGER, PUBLIC, PARAMETER ::   jppoc =  6    !: small particulate organic phosphate concentration
-   INTEGER, PUBLIC, PARAMETER ::   jpsil =  7    !: silicate concentration
-   INTEGER, PUBLIC, PARAMETER ::   jpphy =  8    !: phytoplancton concentration 
-   INTEGER, PUBLIC, PARAMETER ::   jpzoo =  9    !: zooplancton concentration
-   INTEGER, PUBLIC, PARAMETER ::   jpdoc = 10    !: dissolved organic carbon concentration 
-   INTEGER, PUBLIC, PARAMETER ::   jpdia = 11    !: Diatoms Concentration
-   INTEGER, PUBLIC, PARAMETER ::   jpmes = 12    !: Mesozooplankton Concentration
-   INTEGER, PUBLIC, PARAMETER ::   jpdsi = 13    !: Diatoms Silicate Concentration
-   INTEGER, PUBLIC, PARAMETER ::   jpfer = 14    !: Iron Concentration
-   INTEGER, PUBLIC, PARAMETER ::   jpnum = 15    !: Big iron particles Concentration
-   INTEGER, PUBLIC, PARAMETER ::   jpsfe = 16    !: number of particulate organic phosphate concentration
-   INTEGER, PUBLIC, PARAMETER ::   jpdfe = 17    !: Diatoms iron Concentration
-   INTEGER, PUBLIC, PARAMETER ::   jpgsi = 18    !: (big) Silicate Concentration
-   INTEGER, PUBLIC, PARAMETER ::   jpnfe = 19    !: Nano iron Concentration
-   INTEGER, PUBLIC, PARAMETER ::   jpnch = 20    !: Nano Chlorophyll Concentration
-   INTEGER, PUBLIC, PARAMETER ::   jpdch = 21    !: Diatoms Chlorophyll Concentration
-   INTEGER, PUBLIC, PARAMETER ::   jpno3 = 22    !: Nitrates Concentration
-   INTEGER, PUBLIC, PARAMETER ::   jpnh4 = 23    !: Ammonium Concentration
-
-#elif defined key_pisces
-   !!---------------------------------------------------------------------
-   !!   'key_pisces'   :                         standard PISCES bio-model
-   !!---------------------------------------------------------------------
-   LOGICAL, PUBLIC, PARAMETER ::   lk_pisces     = .TRUE.  !: PISCES flag 
-   LOGICAL, PUBLIC, PARAMETER ::   lk_p4z        = .TRUE.  !: p4z flag 
-   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 
-   INTEGER, PUBLIC, PARAMETER ::   jp_pisces_3d  = 11      !: additional 3d output 
-   INTEGER, PUBLIC, PARAMETER ::   jp_pisces_trd =  1      !: number of sms trends for PISCES
-
-   ! assign an index in trc arrays for each LOBSTER prognostic variables
-   !    WARNING: be carefull about the order when reading the restart
-        !   !!gm  this warning should be obsolet with IOM
-   INTEGER, PUBLIC, PARAMETER ::   jpdic =  1    !: dissolved inoganic carbon concentration 
-   INTEGER, PUBLIC, PARAMETER ::   jptal =  2    !: total alkalinity 
-   INTEGER, PUBLIC, PARAMETER ::   jpoxy =  3    !: oxygen carbon concentration 
-   INTEGER, PUBLIC, PARAMETER ::   jpcal =  4    !: calcite  concentration 
-   INTEGER, PUBLIC, PARAMETER ::   jppo4 =  5    !: phosphate concentration 
-   INTEGER, PUBLIC, PARAMETER ::   jppoc =  6    !: small particulate organic phosphate concentration
-   INTEGER, PUBLIC, PARAMETER ::   jpsil =  7    !: silicate concentration
-   INTEGER, PUBLIC, PARAMETER ::   jpphy =  8    !: phytoplancton concentration 
-   INTEGER, PUBLIC, PARAMETER ::   jpzoo =  9    !: zooplancton concentration
-   INTEGER, PUBLIC, PARAMETER ::   jpdoc = 10    !: dissolved organic carbon concentration 
-   INTEGER, PUBLIC, PARAMETER ::   jpdia = 11    !: Diatoms Concentration
-   INTEGER, PUBLIC, PARAMETER ::   jpmes = 12    !: Mesozooplankton Concentration
-   INTEGER, PUBLIC, PARAMETER ::   jpdsi = 13    !: Diatoms Silicate Concentration
-   INTEGER, PUBLIC, PARAMETER ::   jpfer = 14    !: Iron Concentration
-   INTEGER, PUBLIC, PARAMETER ::   jpbfe = 15    !: Big iron particles Concentration
-   INTEGER, PUBLIC, PARAMETER ::   jpgoc = 16    !: big particulate organic phosphate concentration
-   INTEGER, PUBLIC, PARAMETER ::   jpsfe = 17    !: Small iron particles Concentration
-   INTEGER, PUBLIC, PARAMETER ::   jpdfe = 18    !: Diatoms iron Concentration
-   INTEGER, PUBLIC, PARAMETER ::   jpgsi = 19    !: (big) Silicate Concentration
-   INTEGER, PUBLIC, PARAMETER ::   jpnfe = 20    !: Nano iron Concentration
-   INTEGER, PUBLIC, PARAMETER ::   jpnch = 21    !: Nano Chlorophyll Concentration
-   INTEGER, PUBLIC, PARAMETER ::   jpdch = 22    !: Diatoms Chlorophyll Concentration
-   INTEGER, PUBLIC, PARAMETER ::   jpno3 = 23    !: Nitrates Concentration
-   INTEGER, PUBLIC, PARAMETER ::   jpnh4 = 24    !: Ammonium Concentration
-
-#else
    !!---------------------------------------------------------------------
    !!   Default                                   No CFC geochemical model
-   !!---------------------------------------------------------------------
-   LOGICAL, PUBLIC, PARAMETER ::   lk_pisces     = .FALSE.  !: PISCES flag 
-   LOGICAL, PUBLIC, PARAMETER ::   lk_p4z        = .FALSE.  !: p4z flag 
-   INTEGER, PUBLIC, PARAMETER ::   jp_pisces     =  0       !: No CFC tracers
-   INTEGER, PUBLIC, PARAMETER ::   jp_pisces_2d  =  0       !: No CFC additional 2d output arrays 
-   INTEGER, PUBLIC, PARAMETER ::   jp_pisces_3d  =  0       !: No CFC additional 3d output arrays 
-   INTEGER, PUBLIC, PARAMETER ::   jp_pisces_trd =  0       !: number of sms trends for PISCES
-#endif
-
    ! Starting/ending PISCES do-loop indices (N.B. no PISCES : jpl_pcs < jpf_pcs the do-loop are never done)
-   INTEGER, PUBLIC, PARAMETER ::   jp_pcs0     = 1                  !: First index of PISCES tracers
-   INTEGER, PUBLIC, PARAMETER ::   jp_pcs1     = jp_pisces          !: Last  index of PISCES tracers
-   INTEGER, PUBLIC, PARAMETER ::   jp_pcs0_2d  = 1               !: First index of 2D diag
-   INTEGER, PUBLIC, PARAMETER ::   jp_pcs1_2d  = jp_pisces_2d    !: Last  index of 2D diag
-   INTEGER, PUBLIC, PARAMETER ::   jp_pcs0_3d  = 1               !: First index of 3D diag
-   INTEGER, PUBLIC, PARAMETER ::   jp_pcs1_3d  = jp_pisces_3d    !: Last  index of 3d diag
-   INTEGER, PUBLIC, PARAMETER ::   jp_pcs0_trd = 1              !: First index of bio diag
-   INTEGER, PUBLIC, PARAMETER ::   jp_pcs1_trd = jp_pisces_trd  !: Last  index of bio diag
-
+   INTEGER, PUBLIC  ::   jp_pcs0  !: First index of PISCES tracers
+   INTEGER, PUBLIC  ::   jp_pcs1  !: Last  index of PISCES tracers
 
    !!======================================================================
Index: branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/NEMO/TOP_SRC/PISCES/sms_pisces.F90
===================================================================
--- branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/NEMO/TOP_SRC/PISCES/sms_pisces.F90	(revision 7383)
+++ branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/NEMO/TOP_SRC/PISCES/sms_pisces.F90	(revision 7391)
@@ -6,8 +6,4 @@
    !! History :   1.0  !  2000-02 (O. Aumont) original code
    !!             3.2  !  2009-04 (C. Ethe & NEMO team) style
-   !!----------------------------------------------------------------------
-#if defined key_pisces || defined key_pisces_reduced 
-   !!----------------------------------------------------------------------
-   !!   'key_pisces'                                         PISCES model
    !!----------------------------------------------------------------------
    USE par_oce
@@ -21,13 +17,12 @@
    INTEGER ::   numonp      = -1           !! Logical unit for namelist pisces output
 
-   !!*  Biological fluxes for light : variables shared by pisces & lobster
-   INTEGER , ALLOCATABLE, SAVE, DIMENSION(:,:)   ::  neln  !: number of T-levels + 1 in the euphotic layer
-   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:)   ::  heup  !: euphotic layer depth
-   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::  etot  !: par (photosynthetic available radiation)
-   !
-   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:)   ::  xksi  !:  LOBSTER : zooplakton closure
    !                                                       !:  PISCES  : silicon dependant half saturation
 
-#if defined key_pisces 
+   !!* Model used
+   LOGICAL  ::  ln_p2z            !: Flag to use LOBSTER model
+   LOGICAL  ::  ln_p4z            !: Flag to use PISCES  model
+   LOGICAL  ::  ln_p5z            !: Flag to use PISCES  quota model
+   LOGICAL  ::  ln_ligand         !: Flag to enable organic ligands
+
    !!*  Time variables
    INTEGER  ::   nrdttrc           !: ???
@@ -49,6 +44,15 @@
    REAL(wp) ::   o2nit             !: ???
    REAL(wp) ::   wsbio, wsbio2     !: ???
+   REAL(wp) ::   wsbio2max         !: ???
+   REAL(wp) ::   wsbio2scale       !: ???
    REAL(wp) ::   xkmort            !: ???
    REAL(wp) ::   ferat3            !: ???
+   REAL(wp) ::   wfep              !: ???
+   REAL(wp) ::   ldocp             !: ???
+   REAL(wp) ::   ldocz             !: ???
+   REAL(wp) ::   lthet             !: ???
+   REAL(wp) ::   no3rat3           !: ???
+   REAL(wp) ::   po4rat3           !: ???
+
 
    !!*  diagnostic parameters 
@@ -66,20 +70,26 @@
    LOGICAL  ::  ln_check_mass      !: Flag to check mass conservation
 
+   !!*  Biological fluxes for light : variables shared by pisces & lobster
+   INTEGER , ALLOCATABLE, SAVE, DIMENSION(:,:)   ::  neln  !: number of T-levels + 1 in the euphotic layer
+   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:)   ::  heup  !: euphotic layer depth
+   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::  etot  !: par (photosynthetic available radiation)
+   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::  etot_ndcy      !: PAR over 24h in case of diurnal cycle
+   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::  enano, ediat   !: PAR for phyto, nano and diat 
+   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::  epico          !: PAR for pico
+   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::  emoy           !: averaged PAR in the mixed layer
+   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:)   ::  heup_01 !: Absolute euphotic layer depth
+   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:)   ::  xksi  !:  LOBSTER : zooplakton closure
+
    !!*  Biological fluxes for primary production
-   REAL(wp), ALLOCATABLE, SAVE,   DIMENSION(:,:)  ::   xksimax    !: ???
-   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:,:)  ::   xnanono3   !: ???
-   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:,:)  ::   xdiatno3   !: ???
-   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:,:)  ::   xnanonh4   !: ???
-   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:,:)  ::   xdiatnh4   !: ???
-   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:,:)  ::   xnanopo4   !: ???
-   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:,:)  ::   xdiatpo4   !: ???
-   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:,:)  ::   xlimphy    !: ???
-   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:,:)  ::   xlimdia    !: ???
-   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:,:)  ::   concdfe    !: ???
-   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:,:)  ::   concnfe    !: ???
-   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:,:)  ::   xlimnfe    !: ???
-   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:,:)  ::   xlimdfe    !: ???
-   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:,:)  ::   xlimsi     !: ???
+   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:)    ::   xksimax    !: ???
    REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:,:)  ::   biron      !: bioavailable fraction of iron
+   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:,:)  ::   plig       !: proportion of iron organically complexed
+
+   !!*  Sinking speed
+   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::   wsbio3   !: POC sinking speed 
+   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::   wsbio4   !: GOC sinking speed
+   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::   wscal    !: Calcite and BSi sinking speeds
+   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::   wsfep
+
 
 
@@ -87,16 +97,21 @@
    REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::   xfracal    !: ??
    REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::   nitrfac    !: ??
-   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::   xlimbac    !: ??
-   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::   xlimbacl   !: ??
+   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::   orem       !: ??
    REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::   xdiss      !: ??
    REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::   prodcal    !: Calcite production
+   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::   prodpoc    !: Calcite production
+   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::   conspoc    !: Calcite production
+   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::   prodgoc    !: Calcite production
+   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::   consgoc    !: Calcite production
+
+   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::   sizen      !: size of diatoms 
+   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::   sizep      !: size of diatoms 
+   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::   sized      !: size of diatoms 
+
 
    !!* Variable for chemistry of the CO2 cycle
-   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::   akb3       !: ???
    REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::   ak13       !: ???
    REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::   ak23       !: ???
    REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::   aksp       !: ???
-   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::   akw3       !: ???
-   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::   borat      !: ???
    REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::   hi         !: ???
    REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::   excess     !: ???
@@ -108,14 +123,10 @@
    REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::   tgfunc2   !: Temp. dependancy of mesozooplankton rates
 
-#if defined key_kriest
-   !!*  Kriest parameter for aggregation
-   REAL(wp) ::   xkr_eta                            !: Sinking  exponent 
-   REAL(wp) ::   xkr_zeta                           !:  N content exponent 
-   REAL(wp) ::   xkr_ncontent                       !:  N content factor   
-   REAL(wp) ::   xkr_massp                          !: 
-   REAL(wp) ::   xkr_mass_min, xkr_mass_max         !:  Minimum, Maximum mass for Aggregates 
+#if defined key_sed
+   LOGICAL, PUBLIC, PARAMETER ::   lk_sed = .TRUE.     !: sediment flag
+#else
+   LOGICAL, PUBLIC, PARAMETER ::   lk_sed = .FALSE.     !: sediment flag
 #endif
 
-#endif
    !!----------------------------------------------------------------------
    !! NEMO/TOP 3.3 , NEMO Consortium (2010)
@@ -124,4 +135,5 @@
    !!----------------------------------------------------------------------
 CONTAINS
+
 
    INTEGER FUNCTION sms_pisces_alloc()
@@ -130,37 +142,54 @@
       !!----------------------------------------------------------------------
       USE lib_mpp , ONLY: ctl_warn
-      INTEGER ::   ierr(5)        ! Local variables
+      INTEGER ::   ierr(10)        ! Local variables
       !!----------------------------------------------------------------------
       ierr(:) = 0
       !*  Biological fluxes for light : shared variables for pisces & lobster
-      ALLOCATE( etot(jpi,jpj,jpk), neln(jpi,jpj), heup(jpi,jpj), xksi(jpi,jpj), STAT=ierr(1) )
-      !
-#if defined key_pisces
-      !*  Biological fluxes for primary production
-      ALLOCATE( xksimax(jpi,jpj)     , biron   (jpi,jpj,jpk),       &
-         &      xnanono3(jpi,jpj,jpk), xdiatno3(jpi,jpj,jpk),       &
-         &      xnanonh4(jpi,jpj,jpk), xdiatnh4(jpi,jpj,jpk),       &
-         &      xnanopo4(jpi,jpj,jpk), xdiatpo4(jpi,jpj,jpk),       &
-         &      xlimphy (jpi,jpj,jpk), xlimdia (jpi,jpj,jpk),       &
-         &      xlimnfe (jpi,jpj,jpk), xlimdfe (jpi,jpj,jpk),       &
-         &      xlimsi  (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),       &
-         &      xlimbac (jpi,jpj,jpk), xdiss  (jpi,jpj,jpk),       & 
-         &      xlimbacl(jpi,jpj,jpk), prodcal(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)    , excess(jpi,jpj,jpk) ,       &
-         &      aphscale(jpi,jpj,jpk),                           STAT=ierr(4) )
-         !
-      !* Temperature dependancy of SMS terms
-      ALLOCATE( tgfunc(jpi,jpj,jpk)  , tgfunc2(jpi,jpj,jpk) ,    STAT=ierr(5) )
-         !
-#endif
+      ALLOCATE( etot(jpi,jpj,jpk), neln(jpi,jpj), heup(jpi,jpj),    &
+        &       heup_01(jpi,jpj) , xksi(jpi,jpj)               ,  STAT=ierr(1) )
+      !
+  
+      IF( ln_p4z .OR. ln_p5z ) THEN
+         !*  Biological fluxes for light 
+         ALLOCATE(  enano(jpi,jpj,jpk)    , ediat(jpi,jpj,jpk) ,   &
+           &        etot_ndcy(jpi,jpj,jpk), emoy(jpi,jpj,jpk)  ,  STAT=ierr(2) ) 
+
+         !*  Biological fluxes for primary production
+         ALLOCATE( xksimax(jpi,jpj)  , biron(jpi,jpj,jpk)      ,  STAT=ierr(3) )
+         !
+         !*  SMS for the organic matter
+         ALLOCATE( xfracal (jpi,jpj,jpk), nitrfac(jpi,jpj,jpk) ,    &
+            &      orem    (jpi,jpj,jpk),                           &
+            &      prodcal(jpi,jpj,jpk),  xdiss   (jpi,jpj,jpk),    &
+            &      prodpoc(jpi,jpj,jpk) , conspoc(jpi,jpj,jpk) ,    &
+            &      prodgoc(jpi,jpj,jpk) , consgoc(jpi,jpj,jpk) ,  STAT=ierr(4) )
+
+         !* Variable for chemistry of the CO2 cycle
+         ALLOCATE( ak13  (jpi,jpj,jpk) ,                            &
+            &      ak23(jpi,jpj,jpk)    , aksp  (jpi,jpj,jpk) ,     &
+            &      hi  (jpi,jpj,jpk)    , excess(jpi,jpj,jpk) ,     &
+            &      aphscale(jpi,jpj,jpk),                         STAT=ierr(5) )
+         !
+         !* Temperature dependancy of SMS terms
+         ALLOCATE( tgfunc(jpi,jpj,jpk)  , tgfunc2(jpi,jpj,jpk),   STAT=ierr(6) )
+         !
+         !* Sinkong speed
+         ALLOCATE( wsbio3 (jpi,jpj,jpk) , wsbio4 (jpi,jpj,jpk),     &
+            &      wscal(jpi,jpj,jpk)                         ,   STAT=ierr(7) )   
+         ! 
+         IF( ln_ligand ) THEN
+           ALLOCATE( plig(jpi,jpj,jpk)  , wsfep(jpi,jpj,jpk)  ,   STAT=ierr(8) )
+         ENDIF
+         !
+      ENDIF
+      !
+      IF( ln_p5z ) THEN
+         !       
+         ALLOCATE( epico(jpi,jpj,jpk)                         ,   STAT=ierr(9) ) 
+
+         !*  Size of phytoplankton cells
+         ALLOCATE( sizen(jpi,jpj,jpk), sizep(jpi,jpj,jpk),         &
+           &       sized(jpi,jpj,jpk),                            STAT=ierr(10) )
+      ENDIF
       !
       sms_pisces_alloc = MAXVAL( ierr )
@@ -170,10 +199,4 @@
    END FUNCTION sms_pisces_alloc
 
-#else
-   !!----------------------------------------------------------------------   
-   !!  Empty module :                                     NO PISCES model
-   !!----------------------------------------------------------------------
-#endif
-   
    !!======================================================================   
 END MODULE sms_pisces    
Index: branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/NEMO/TOP_SRC/PISCES/trcice_pisces.F90
===================================================================
--- branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/NEMO/TOP_SRC/PISCES/trcice_pisces.F90	(revision 7383)
+++ branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/NEMO/TOP_SRC/PISCES/trcice_pisces.F90	(revision 7391)
@@ -5,10 +5,4 @@
    !!======================================================================
    !! History :  3.5  ! 2013    (M. Vancoppenolle, O. Aumont, G. Madec), original code
-   !! Comment ! probably not properly done when the second particle export
-   !! scheme (kriest) is used
-   !!----------------------------------------------------------------------
-#if defined key_pisces || defined key_pisces_reduced
-   !!----------------------------------------------------------------------
-   !!   'key_pisces'                                       PISCES bio-model
    !!----------------------------------------------------------------------
    !! trc_ice_pisces   : PISCES fake sea ice model setting
@@ -18,5 +12,4 @@
    USE oce_trc         ! Shared variables between ocean and passive tracers
    USE trc             ! Passive tracers common variables 
-   USE phycst          ! Ocean physics parameters
    USE sms_pisces      ! PISCES Source Minus Sink variables
    USE in_out_manager
@@ -37,6 +30,6 @@
       !!----------------------------------------------------------------------
 
-      IF( lk_p4z ) THEN  ;   CALL p4z_ice_ini   !  PISCES
-      ELSE               ;   CALL p2z_ice_ini   !  LOBSTER
+      IF( ln_p4z .OR. ln_p5z ) THEN  ;   CALL p4z_ice_ini   !  PISCES
+      ELSE                           ;   CALL p2z_ice_ini   !  LOBSTER
       ENDIF
 
@@ -45,6 +38,4 @@
 
    SUBROUTINE p4z_ice_ini
-
-#if defined key_pisces 
       !!----------------------------------------------------------------------
       !!                   ***  ROUTINE p4z_ice_ini ***
@@ -75,6 +66,6 @@
 
                                         !--- Dummy variables
-      REAL(wp), DIMENSION(jp_pisces,2)  :: zratio  ! effective ice-ocean tracer cc ratio
-      REAL(wp), DIMENSION(jp_pisces,4)  :: zpisc   ! prescribes concentration 
+      REAL(wp), DIMENSION(jpmaxtrc,2) :: zratio  ! effective ice-ocean tracer cc ratio
+      REAL(wp), DIMENSION(jpmaxtrc,4) :: zpisc   ! prescribes concentration 
       !                                            !  1:global, 2:Arctic, 3:Antarctic, 4:Baltic
 
@@ -107,10 +98,6 @@
       zpisc(jppo4,1) =  5.77e-7_wp / po4r 
       zpisc(jppoc,1) =  1.27e-6_wp  
-#  if ! defined key_kriest
       zpisc(jpgoc,1) =  5.23e-8_wp  
       zpisc(jpbfe,1) =  9.84e-13_wp 
-#  else
-      zpisc(jpnum,1) = 0. ! could not get this value since did not use it
-#  endif
       zpisc(jpsil,1) =  7.36e-6_wp  
       zpisc(jpdsi,1) =  1.07e-7_wp 
@@ -129,4 +116,21 @@
       zpisc(jpnh4,1) =  3.22e-7_wp / rno3
 
+      ! ln_p5z
+      zpisc(jppic,1) =  9.57e-8_wp
+      zpisc(jpnpi,1) =  9.57e-8_wp
+      zpisc(jpppi,1) =  9.57e-8_wp
+      zpisc(jppfe,1) =  1.76e-11_wp
+      zpisc(jppch,1) =  1.67e-7_wp
+      zpisc(jpnph,1) =  9.57e-8_wp
+      zpisc(jppph,1) =  9.57e-8_wp
+      zpisc(jpndi,1) =  4.24e-7_wp
+      zpisc(jppdi,1) =  4.24e-7_wp
+      zpisc(jppon,1) =  9.57e-8_wp
+      zpisc(jppop,1) =  9.57e-8_wp
+      zpisc(jpdon,1) =  2.04e-5_wp
+      zpisc(jpdop,1) =  2.04e-5_wp
+      zpisc(jpgon,1) =  5.23e-8_wp
+      zpisc(jpgop,1) =  5.23e-8_wp
+
       !--- Arctic specificities (dissolved inorganic & DOM)
       zpisc(jpdic,2) =  1.98e-3_wp 
@@ -137,10 +141,6 @@
       zpisc(jppo4,2) =  4.09e-7_wp / po4r 
       zpisc(jppoc,2) =  4.05e-7_wp  
-#  if ! defined key_kriest
       zpisc(jpgoc,2) =  2.84e-8_wp  
       zpisc(jpbfe,2) =  7.03e-13_wp 
-#  else
-      zpisc(jpnum,2) =  0.00e-00_wp 
-#  endif
       zpisc(jpsil,2) =  6.87e-6_wp  
       zpisc(jpdsi,2) =  1.73e-7_wp 
@@ -159,4 +159,21 @@
       zpisc(jpnh4,2) =  6.15e-08_wp / rno3 
 
+      ! ln_p5z
+      zpisc(jppic,2) =  5.25e-7_wp
+      zpisc(jpnpi,2) =  5.25e-7_wp
+      zpisc(jpppi,2) =  5.25e-7_wp
+      zpisc(jppfe,2) =  1.75e-11_wp
+      zpisc(jppch,2) =  1.46e-07_wp
+      zpisc(jpnph,2) =  5.25e-7_wp
+      zpisc(jppph,2) =  5.25e-7_wp
+      zpisc(jpndi,2) =  7.75e-7_wp
+      zpisc(jppdi,2) =  7.75e-7_wp
+      zpisc(jppon,2) =  4.05e-7_wp
+      zpisc(jppop,2) =  4.05e-7_wp
+      zpisc(jpdon,2) =  6.00e-6_wp
+      zpisc(jpdop,2) =  6.00e-6_wp
+      zpisc(jpgon,2) =  2.84e-8_wp
+      zpisc(jpgop,2) =  2.84e-8_wp
+
       !--- Antarctic specificities (dissolved inorganic & DOM)
       zpisc(jpdic,3) =  2.20e-3_wp  
@@ -167,10 +184,6 @@
       zpisc(jppo4,3) =  1.88e-6_wp / po4r  
       zpisc(jppoc,3) =  1.13e-6_wp  
-#  if ! defined key_kriest
       zpisc(jpgoc,3) =  2.89e-8_wp  
       zpisc(jpbfe,3) =  5.63e-13_wp 
-#  else
-      zpisc(jpnum,3) =  0.00e-00_wp 
-#  endif
       zpisc(jpsil,3) =  4.96e-5_wp  
       zpisc(jpdsi,3) =  5.63e-7_wp 
@@ -189,4 +202,22 @@
       zpisc(jpnh4,3) =  3.39e-7_wp / rno3  
 
+      ! ln_p5z
+      zpisc(jppic,3) =  8.10e-7_wp
+      zpisc(jpnpi,3) =  8.10e-7_wp
+      zpisc(jpppi,3) =  8.10e-7_wp 
+      zpisc(jppfe,3) =  1.48e-11_wp
+      zpisc(jppch,3) =  2.02e-7_wp
+      zpisc(jpnph,3) =  9.57e-8_wp
+      zpisc(jppph,3) =  9.57e-8_wp
+      zpisc(jpndi,3) =  5.77e-7_wp
+      zpisc(jppdi,3) =  5.77e-7_wp
+      zpisc(jppon,3) =  1.13e-6_wp
+      zpisc(jppop,3) =  1.13e-6_wp
+      zpisc(jpdon,3) =  7.02e-6_wp
+      zpisc(jpdop,3) =  7.02e-6_wp
+      zpisc(jpgon,3) =  2.89e-8_wp
+      zpisc(jpgop,3) =  2.89e-8_wp
+
+
       !--- Baltic Sea particular case for ORCA configurations
       zpisc(jpdic,4) = 1.14e-3_wp
@@ -197,10 +228,6 @@
       zpisc(jppo4,4) = 2.85e-9_wp / po4r
       zpisc(jppoc,4) = 4.84e-7_wp
-#  if ! defined key_kriest
       zpisc(jpgoc,4) = 1.05e-8_wp
       zpisc(jpbfe,4) = 4.97e-13_wp
-#  else
-      zpisc(jpnum,4) = 0. ! could not get this value
-#  endif
       zpisc(jpsil,4) = 4.91e-5_wp
       zpisc(jpdsi,4) = 3.25e-7_wp
@@ -218,4 +245,21 @@
       zpisc(jpno3,4) = 5.36e-5_wp / rno3
       zpisc(jpnh4,4) = 7.18e-7_wp / rno3
+
+      ! ln_p5z
+      zpisc(jppic,4) =  6.64e-7_wp
+      zpisc(jpnpi,4) =  6.64e-7_wp
+      zpisc(jpppi,4) =  6.64e-7_wp
+      zpisc(jppfe,4) =  3.89e-11_wp
+      zpisc(jppch,4) =  1.17e-7_wp
+      zpisc(jpnph,4) =  6.64e-7_wp
+      zpisc(jppph,4) =  6.64e-7_wp
+      zpisc(jpndi,4) =  3.41e-7_wp
+      zpisc(jppdi,4) =  3.41e-7_wp
+      zpisc(jppon,4) =  4.84e-7_wp
+      zpisc(jppop,4) =  4.84e-7_wp
+      zpisc(jpdon,4) =  1.06e-5_wp
+      zpisc(jpdop,4) =  1.06e-5_wp
+      zpisc(jpgon,4) =  1.05e-8_wp
+      zpisc(jpgop,4) =  1.05e-8_wp
  
       DO jn = jp_pcs0, jp_pcs1
@@ -279,10 +323,8 @@
       !
       END DO ! jn
-#endif
-
+      !
    END SUBROUTINE p4z_ice_ini
 
    SUBROUTINE p2z_ice_ini
-#if defined key_pisces_reduced 
       !!----------------------------------------------------------------------
       !!                   ***  ROUTINE p2z_ice_ini ***
@@ -290,16 +332,6 @@
       !! ** Purpose :   Initialisation of the LOBSTER biochemical model
       !!----------------------------------------------------------------------
-#endif
    END SUBROUTINE p2z_ice_ini
 
-
-#else
-   !!----------------------------------------------------------------------
-   !!   Dummy module                            No PISCES biochemical model
-   !!----------------------------------------------------------------------
-CONTAINS
-   SUBROUTINE trc_ice_ini_pisces         ! Empty routine
-   END SUBROUTINE trc_ice_ini_pisces
-#endif
 
    !!======================================================================
Index: branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/NEMO/TOP_SRC/PISCES/trcini_pisces.F90
===================================================================
--- branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/NEMO/TOP_SRC/PISCES/trcini_pisces.F90	(revision 7383)
+++ branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/NEMO/TOP_SRC/PISCES/trcini_pisces.F90	(revision 7391)
@@ -11,13 +11,10 @@
    !!             3.5  !  2012-05  (C. Ethe) Merge PISCES-LOBSTER
    !!----------------------------------------------------------------------
-#if defined key_pisces || defined key_pisces_reduced
-   !!----------------------------------------------------------------------
-   !!   'key_pisces'                                       PISCES bio-model
-   !!----------------------------------------------------------------------
    !! trc_ini_pisces   : PISCES biochemical model initialisation
    !!----------------------------------------------------------------------
-   USE par_trc         ! TOP parameters
+   USE par_trc         !  TOP parameters
    USE oce_trc         !  shared variables between ocean and passive tracers
    USE trc             !  passive tracers common variables 
+   USE trcnam_pisces   !  PISCES namelist
    USE sms_pisces      !  PISCES Source Minus Sink variables
 
@@ -41,6 +38,9 @@
       !!----------------------------------------------------------------------
 
-      IF( lk_p4z ) THEN  ;   CALL p4z_ini   !  PISCES
-      ELSE               ;   CALL p2z_ini   !  LOBSTER
+      !
+      CALL trc_nam_pisces
+      !
+      IF( ln_p4z .OR. ln_p5z ) THEN  ;   CALL p4z_ini   !  PISCES
+      ELSE                           ;   CALL p2z_ini   !  LOBSTER
       ENDIF
 
@@ -53,5 +53,4 @@
       !! ** Purpose :   Initialisation of the PISCES biochemical model
       !!----------------------------------------------------------------------
-#if defined key_pisces 
       !
       USE p4zsms          ! Main P4Z routine
@@ -70,4 +69,12 @@
       USE p4zlys          !  Calcite saturation
       USE p4zsed          !  Sedimentation & burial
+      USE p4zpoc          !  Remineralization of organic particles
+      USE p4zligand       !  Remineralization of organic ligands
+      USE p5zlim          !  Co-limitations of differents nutrients
+      USE p5zprod         !  Growth rate of the 2 phyto groups
+      USE p5zmicro        !  Sources and sinks of microzooplankton
+      USE p5zmeso         !  Sources and sinks of mesozooplankton
+      USE p5zmort         !  Mortality terms for phytoplankton
+
       !
       REAL(wp), SAVE :: sco2   =  2.312e-3_wp
@@ -79,22 +86,37 @@
       REAL(wp), SAVE :: no3    =  30.9e-6_wp * 7.625_wp
       !
-      INTEGER  ::  ji, jj, jk, ierr
+      INTEGER  ::  ji, jj, jk, jn, ierr
       REAL(wp) ::  zcaralk, zbicarb, zco3
       REAL(wp) ::  ztmas, ztmas1
-      !!----------------------------------------------------------------------
-
-      IF(lwp) WRITE(numout,*)
-      IF(lwp) WRITE(numout,*) ' p4z_ini :   PISCES biochemical model initialisation'
-      IF(lwp) WRITE(numout,*) ' ~~~~~~~~~~~~~~'
-
-                                                 ! Allocate PISCES arrays
+      CHARACTER(len = 20)  ::  cltra
+
+      !!----------------------------------------------------------------------
+
+      IF(lwp) THEN
+         WRITE(numout,*)
+         IF( ln_p4z ) THEN 
+            WRITE(numout,*) ' p4z_ini :   PISCES biochemical model initialisation'
+         ELSE
+            WRITE(numout,*) ' p5z_ini :   PISCES biochemical model initialisation'
+            WRITE(numout,*) '             With variable stoichiometry'
+         ENDIF
+         WRITE(numout,*) ' ~~~~~~~~~~~~~~'
+      ENDIF
+      !
+      ! Allocate PISCES arrays
       ierr =         sms_pisces_alloc()          
       ierr = ierr +  p4z_che_alloc()
       ierr = ierr +  p4z_sink_alloc()
       ierr = ierr +  p4z_opt_alloc()
-      ierr = ierr +  p4z_prod_alloc()
-      ierr = ierr +  p4z_rem_alloc()
       ierr = ierr +  p4z_flx_alloc()
       ierr = ierr +  p4z_sed_alloc()
+      ierr = ierr +  p4z_rem_alloc()
+      IF( ln_p4z ) THEN
+         ierr = ierr +  p4z_lim_alloc()
+         ierr = ierr +  p4z_prod_alloc()
+      ELSE
+         ierr = ierr +  p5z_lim_alloc()
+         ierr = ierr +  p5z_prod_alloc()
+      ENDIF
       !
       IF( lk_mpp    )   CALL mpp_sum( ierr )
@@ -104,4 +126,49 @@
       r1_ryyss = 1. / ryyss
       !
+
+      ! assign an index in trc arrays for each prognostic variables
+      DO jn = 1, jptra
+        cltra = ctrcnm(jn) 
+        IF( cltra == 'DIC'      )   jpdic = jn      !: dissolved inoganic carbon concentration 
+        IF( cltra == 'Alkalini' )   jptal = jn      !: total alkalinity 
+        IF( cltra == 'O2'       )   jpoxy = jn      !: oxygen carbon concentration 
+        IF( cltra == 'CaCO3'    )   jpcal = jn      !: calcite  concentration 
+        IF( cltra == 'PO4'      )   jppo4 = jn      !: phosphate concentration 
+        IF( cltra == 'POC'      )   jppoc = jn      !: small particulate organic phosphate concentration
+        IF( cltra == 'Si'       )   jpsil = jn      !: silicate concentration
+        IF( cltra == 'PHY'      )   jpphy = jn      !: phytoplancton concentration 
+        IF( cltra == 'ZOO'      )   jpzoo = jn      !: zooplancton concentration
+        IF( cltra == 'DOC'      )   jpdoc = jn      !: dissolved organic carbon concentration 
+        IF( cltra == 'PHY2'     )   jpdia = jn      !: Diatoms Concentration
+        IF( cltra == 'ZOO2'     )   jpmes = jn      !: Mesozooplankton Concentration
+        IF( cltra == 'DSi'      )   jpdsi = jn      !: Diatoms Silicate Concentration
+        IF( cltra == 'Fer'      )   jpfer = jn      !: Iron Concentration
+        IF( cltra == 'BFe'      )   jpbfe = jn      !: Big iron particles Concentration
+        IF( cltra == 'GOC'      )   jpgoc = jn      !: Big particulate organic phosphate concentration
+        IF( cltra == 'SFe'      )   jpsfe = jn      !: Small iron particles Concentration
+        IF( cltra == 'DFe'      )   jpdfe = jn      !: Diatoms iron Concentration
+        IF( cltra == 'GSi'      )   jpgsi = jn      !: (big) Silicate Concentration
+        IF( cltra == 'NFe'      )   jpnfe = jn      !: Nano iron Concentration
+        IF( cltra == 'NCHL'     )   jpnch = jn      !: Nano Chlorophyll Concentration
+        IF( cltra == 'DCHL'     )   jpdch = jn      !: Diatoms Chlorophyll Concentration
+        IF( cltra == 'NO3'      )   jpno3 = jn      !: Nitrates Concentration
+        IF( cltra == 'NH4'      )   jpnh4 = jn      !: Ammonium Concentration
+        IF( cltra == 'DON'      )   jpdon = jn      !: Dissolved organic N Concentration
+        IF( cltra == 'DOP'      )   jpdop = jn      !: Dissolved organic P Concentration
+        IF( cltra == 'PON'      )   jppon = jn      !: Small Nitrogen particle Concentration
+        IF( cltra == 'POP'      )   jppop = jn      !: Small Phosphorus particle Concentration
+        IF( cltra == 'GON'      )   jpgon = jn      !: Big Nitrogen particles Concentration
+        IF( cltra == 'GOP'      )   jpgop = jn      !: Big Phosphorus Concentration
+        IF( cltra == 'PHYN'     )   jpnph = jn      !: Nanophytoplankton N biomass
+        IF( cltra == 'PHYP'     )   jppph = jn      !: Nanophytoplankton P biomass
+        IF( cltra == 'DIAN'     )   jpndi = jn      !: Diatoms N biomass
+        IF( cltra == 'DIAP'     )   jppdi = jn      !: Diatoms P biomass
+        IF( cltra == 'PIC'      )   jppic = jn      !: Picophytoplankton C biomass
+        IF( cltra == 'PICN'     )   jpnpi = jn      !: Picophytoplankton N biomass
+        IF( cltra == 'PICP'     )   jpppi = jn      !: Picophytoplankton P biomass
+        IF( cltra == 'PFe'      )   jppfe = jn      !: Picophytoplankton Fe biomass
+        IF( cltra == 'LGW'      )   jplgw = jn      !: Weak ligands
+        IF( cltra == 'LFe'      )   jpfep = jn      !: Fe nanoparticle
+      ENDDO
 
       CALL p4z_sms_init       !  Maint routine
@@ -116,10 +183,12 @@
       rdenit  =  ( ( o2ut + o2nit ) * 0.80 - rno3 - rno3 * 0.60 ) / rno3
       rdenita =   3._wp /  5._wp
-
+      IF( ln_p5z ) THEN
+         no3rat3 = no3rat3 / rno3
+         po4rat3 = po4rat3 / po4r
+      ENDIF
 
       ! Initialization of tracer concentration in case of  no restart 
       !--------------------------------------------------------------
-      IF( .NOT. ln_rsttr ) THEN  
-         
+      IF( .NOT.ln_rsttr ) THEN  
          trn(:,:,:,jpdic) = sco2
          trn(:,:,:,jpdoc) = bioma0
@@ -129,10 +198,6 @@
          trn(:,:,:,jppo4) = po4 / po4r
          trn(:,:,:,jppoc) = bioma0
-#  if ! defined key_kriest
          trn(:,:,:,jpgoc) = bioma0
          trn(:,:,:,jpbfe) = bioma0 * 5.e-6
-#  else
-         trn(:,:,:,jpnum) = bioma0 / ( 6. * xkr_massp )
-#  endif
          trn(:,:,:,jpsil) = silic1
          trn(:,:,:,jpdsi) = bioma0 * 0.15
@@ -150,5 +215,25 @@
          trn(:,:,:,jpno3) = no3
          trn(:,:,:,jpnh4) = bioma0
-
+         IF( ln_ligand) THEN
+            trn(:,:,:,jplgw) = 0.6E-9
+            trn(:,:,:,jpfep) = 0. * 5.e-6
+         ENDIF
+         IF( ln_p5z ) THEN
+            trn(:,:,:,jpdon) = bioma0
+            trn(:,:,:,jpdop) = bioma0
+            trn(:,:,:,jppon) = bioma0
+            trn(:,:,:,jppop) = bioma0
+            trn(:,:,:,jpgon) = bioma0
+            trn(:,:,:,jpgop) = bioma0
+            trn(:,:,:,jpnph) = bioma0
+            trn(:,:,:,jppph) = bioma0
+            trn(:,:,:,jppic) = bioma0
+            trn(:,:,:,jpnpi) = bioma0
+            trn(:,:,:,jpppi) = bioma0
+            trn(:,:,:,jpndi) = bioma0
+            trn(:,:,:,jppdi) = bioma0
+            trn(:,:,:,jppfe) = bioma0 * 5.e-6
+            trn(:,:,:,jppch) = bioma0 * 12. / 55.
+         ENDIF
          ! initialize the half saturation constant for silicate
          ! ----------------------------------------------------
@@ -158,16 +243,32 @@
 
 
-      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_sbc_init       !  boundary conditions
-      CALL p4z_fechem_init    !  Iron chemistry
-      CALL p4z_rem_init       !  remineralisation
-      CALL p4z_mort_init      !  phytoplankton mortality 
-      CALL p4z_micro_init     !  microzooplankton
-      CALL p4z_meso_init      !  mesozooplankton
-      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
+      IF( ln_p4z ) THEN
+         CALL p4z_lim_init       !  co-limitations by the various nutrients
+         CALL p4z_prod_init      !  phytoplankton growth rate over the global ocean.
+      ELSE
+         CALL p5z_lim_init       !  co-limitations by the various nutrients
+         CALL p5z_prod_init      !  phytoplankton growth rate over the global ocean.
+      ENDIF
+      CALL p4z_sbc_init          !  boundary conditions
+      CALL p4z_fechem_init       !  Iron chemistry
+      CALL p4z_rem_init          !  remineralisation
+      CALL p4z_poc_init          !  remineralisation of organic particles
+      IF( ln_ligand ) &
+         & CALL p4z_ligand_init  !  remineralisation of organic ligands
+
+      IF( ln_p4z ) THEN
+         CALL p4z_mort_init      !  phytoplankton mortality 
+         CALL p4z_micro_init     !  microzooplankton
+         CALL p4z_meso_init      !  mesozooplankton
+      ELSE
+         CALL p5z_mort_init      !  phytoplankton mortality 
+         CALL p5z_micro_init     !  microzooplankton
+         CALL p5z_meso_init      !  mesozooplankton
+      ENDIF
+      CALL p4z_lys_init          !  calcite saturation
+      IF( .NOT.l_co2cpl ) &
+        & CALL p4z_flx_init      !  gas exchange 
 
       ndayflxtr = 0
@@ -176,5 +277,4 @@
       IF(lwp) WRITE(numout,*) 'Initialization of PISCES tracers done'
       IF(lwp) WRITE(numout,*) 
-#endif
       !
    END SUBROUTINE p4z_ini
@@ -186,5 +286,4 @@
       !! ** Purpose :   Initialisation of the LOBSTER biochemical model
       !!----------------------------------------------------------------------
-#if defined key_pisces_reduced 
       !
       USE p2zopt
@@ -193,5 +292,6 @@
       USE p2zsed
       !
-      INTEGER  ::  ji, jj, jk, ierr
+      INTEGER  ::  ji, jj, jk, jn, ierr
+      CHARACTER(len = 10)  ::  cltra
       !!----------------------------------------------------------------------
 
@@ -205,4 +305,25 @@
       IF( lk_mpp    )   CALL mpp_sum( ierr )
       IF( ierr /= 0 )   CALL ctl_stop( 'STOP', 'p2z_ini: unable to allocate LOBSTER arrays' )
+
+      DO jn = 1, jptra
+        cltra = ctrcnm(jn) 
+        IF( cltra == 'DET' )   jpdet = jn       !: detritus                    [mmoleN/m3]
+        IF( cltra == 'ZOO' )   jpzoo = jn       !: zooplancton concentration   [mmoleN/m3]
+        IF( cltra == 'PHY' )   jpphy = jn       !: phytoplancton concentration [mmoleN/m3]
+        IF( cltra == 'NO3' )   jpno3 = jn       !: nitrate concentration       [mmoleN/m3]
+        IF( cltra == 'NH4' )   jpnh4 = jn       !: ammonium concentration      [mmoleN/m3]
+        IF( cltra == 'DOM' )   jpdom = jn       !: dissolved organic matter    [mmoleN/m3]
+      ENDDO
+
+      jpkb = 10        !  last level where depth less than 200 m
+      DO jk = jpkm1, 1, -1
+         IF( gdept_1d(jk) > 200. ) jpkb = jk 
+      END DO
+      IF (lwp) WRITE(numout,*)
+      IF (lwp) WRITE(numout,*) ' first vertical layers where biology is active (200m depth ) ', jpkb
+      IF (lwp) WRITE(numout,*)
+      jpkbm1 = jpkb - 1
+      !
+
 
       ! LOBSTER initialisation for GYRE : init NO3=f(density) by asklod AS Kremeur 2005-07
@@ -214,5 +335,5 @@
          trn(:,:,:,jpphy) = 0.1 * tmask(:,:,:)
          trn(:,:,:,jpdom) = 1.0 * tmask(:,:,:)
-         WHERE( rhd(:,:,:) <= 24.5e-3 )  ;  trn(:,:,:,jpno3 ) = 2._wp * tmask(:,:,:)
+         WHERE( rhd(:,:,:) <= 24.5e-3 )  ;  trn(:,:,:,jpno3) = 2._wp * tmask(:,:,:)
          ELSE WHERE                      ;  trn(:,:,:,jpno3) = ( 15.55 * ( rhd(:,:,:) * 1000. ) - 380.11 ) * tmask(:,:,:)
          END WHERE                       
@@ -227,15 +348,6 @@
       IF(lwp) WRITE(numout,*) 'Initialization of LOBSTER tracers done'
       IF(lwp) WRITE(numout,*) 
-#endif
       !
    END SUBROUTINE p2z_ini
-#else
-   !!----------------------------------------------------------------------
-   !!   Dummy module                            No PISCES biochemical model
-   !!----------------------------------------------------------------------
-CONTAINS
-   SUBROUTINE trc_ini_pisces             ! Empty routine
-   END SUBROUTINE trc_ini_pisces
-#endif
 
    !!======================================================================
Index: branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/NEMO/TOP_SRC/PISCES/trcnam_pisces.F90
===================================================================
--- branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/NEMO/TOP_SRC/PISCES/trcnam_pisces.F90	(revision 7383)
+++ branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/NEMO/TOP_SRC/PISCES/trcnam_pisces.F90	(revision 7391)
@@ -8,8 +8,4 @@
    !!             1.0  !  2003-08 (C. Ethe)  module F90
    !!             2.0  !  2007-12  (C. Ethe, G. Madec) from trcnam.pisces.h90
-   !!----------------------------------------------------------------------
-#if defined key_pisces || defined key_pisces_reduced
-   !!----------------------------------------------------------------------
-   !!   'key_pisces'   :                                   PISCES bio-model
    !!----------------------------------------------------------------------
    !! trc_nam_pisces       : PISCES model namelist read
@@ -45,28 +41,17 @@
       !! ** input   :   file 'namelist.trc.sms' containing the following
       !!             namelist: natext, natbio, natsms
-      !!                       natkriest ("key_kriest")
       !!----------------------------------------------------------------------
       !!
       INTEGER :: jl, jn
-      INTEGER :: ios                 ! Local integer output status for namelist read
-      TYPE(DIAG), DIMENSION(jp_pisces_2d)  :: pisdia2d
-      TYPE(DIAG), DIMENSION(jp_pisces_3d)  :: pisdia3d
-      TYPE(DIAG), DIMENSION(jp_pisces_trd) :: pisdiabio
+      INTEGER :: ios, ioptio                 ! Local integer output status for namelist read
       CHARACTER(LEN=20)   ::   clname
       !!
-      NAMELIST/nampisdia/ pisdia3d, pisdia2d     ! additional diagnostics
-#if defined key_pisces_reduced
-      NAMELIST/nampisdbi/ pisdiabio
-#endif
-
+      NAMELIST/nampismod/ln_p2z, ln_p4z, ln_p5z, ln_ligand
       !!----------------------------------------------------------------------
 
       IF(lwp) WRITE(numout,*)
       clname = 'namelist_pisces'
-#if defined key_pisces
+
       IF(lwp) WRITE(numout,*) ' trc_nam_pisces : read PISCES namelist'
-#else
-      IF(lwp) WRITE(numout,*) ' trc_nam_pisces : read LOBSTER namelist'
-#endif
       IF(lwp) WRITE(numout,*) ' ~~~~~~~~~~~~~~'
       CALL ctl_opn( numnatp_ref, TRIM( clname )//'_ref', 'OLD'    , 'FORMATTED', 'SEQUENTIAL', -1, numout, .FALSE. )
@@ -74,98 +59,40 @@
       IF(lwm) CALL ctl_opn( numonp     , 'output.namelist.pis' , 'UNKNOWN', 'FORMATTED', 'SEQUENTIAL', -1, numout, .FALSE. )
       !
-      IF( .NOT.lk_iomput .AND. ln_diatrc ) THEN
-         !
-         ! Namelist nampisdia
-         ! -------------------
-         REWIND( numnatp_ref )              ! Namelist nampisdia in reference namelist : Pisces diagnostics
-         READ  ( numnatp_ref, nampisdia, IOSTAT = ios, ERR = 901)
-901      IF( ios /= 0 ) CALL ctl_nam ( ios , 'nampisdia in reference namelist', lwp )
 
-         REWIND( numnatp_cfg )              ! Namelist nampisdia in configuration namelist : Pisces diagnostics
-         READ  ( numnatp_cfg, nampisdia, IOSTAT = ios, ERR = 902 )
-902      IF( ios /= 0 ) CALL ctl_nam ( ios , 'nampisdia in configuration namelist', lwp )
-         IF(lwm) WRITE ( numonp, nampisdia )
+      REWIND( numnatp_ref )              ! Namelist nampisbio in reference namelist : Pisces variables
+      READ  ( numnatp_ref, nampismod, IOSTAT = ios, ERR = 901)
+901   IF( ios /= 0 ) CALL ctl_nam ( ios , 'nampismod in reference namelist', lwp )
 
-         DO jl = 1, jp_pisces_2d
-            jn = jp_pcs0_2d + jl - 1
-            ctrc2d(jn) = pisdia2d(jl)%sname
-            ctrc2l(jn) = pisdia2d(jl)%lname
-            ctrc2u(jn) = pisdia2d(jl)%units
-         END DO
+      REWIND( numnatp_cfg )              ! Namelist nampisbio in configuration namelist : Pisces variables
+      READ  ( numnatp_cfg, nampismod, IOSTAT = ios, ERR = 902 )
+902   IF( ios /= 0 ) CALL ctl_nam ( ios , 'nampismod in configuration namelist', lwp )
+      IF(lwm) WRITE ( numonp, nampismod )
 
-         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,*) ' '
-
-            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
-         !
+     IF(lwp) THEN                  ! control print
+         WRITE(numout,*) ' '
+         WRITE(numout,*) ' Flag to use LOBSTER model            ln_p2z    = ', ln_p2z
+         WRITE(numout,*) ' Flag to use PISCES standard  model   ln_p4z    = ', ln_p4z
+         WRITE(numout,*) ' Flag to use PISCES quota     model   ln_p5z    = ', ln_p5z
+         WRITE(numout,*) ' Flag to ligand                       ln_ligand = ', ln_ligand
+         WRITE(numout,*) ' '
       ENDIF
 
-#if defined key_pisces_reduced
-
-      IF( ( .NOT.lk_iomput .AND. ln_diabio ) .OR. lk_trdmxl_trc ) THEN
-         !
-         ! Namelist nampisdbi
-         ! -------------------
-         REWIND( numnatp_ref )              ! Namelist nampisdbi in reference namelist : Pisces add. diagnostics
-         READ  ( numnatp_ref, nampisdbi, IOSTAT = ios, ERR = 903)
-903      IF( ios /= 0 ) CALL ctl_nam ( ios , 'nampisdbi in reference namelist', lwp )
-
-         REWIND( numnatp_cfg )              ! Namelist nampisdbi in configuration namelist : Pisces add. diagnostics
-         READ  ( numnatp_cfg, nampisdbi, IOSTAT = ios, ERR = 904 )
-904      IF( ios /= 0 ) CALL ctl_nam ( ios , 'nampisdbi in configuration namelist', lwp )
-         IF(lwm) WRITE ( numonp, nampisdbi )
-
-         DO jl = 1, jp_pisces_trd
-            jn = jp_pcs0_trd + jl - 1
-            ctrbio(jl) = pisdiabio(jl)%sname
-            ctrbil(jl) = pisdiabio(jl)%lname
-            ctrbiu(jl) = pisdiabio(jl)%units
-         END DO
-
-         IF(lwp) THEN                   ! control print
-            WRITE(numout,*)
-            WRITE(numout,*) ' Namelist : nampisdbi'
-            DO jl = 1, jp_pisces_trd
-               jn = jp_pcs0_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 IF
-         !
-      END IF
-
-#endif
-
+      IF(lwp) THEN                         ! control print
+         WRITE(numout,*) ' '
+         IF( ln_p5z    )  WRITE(numout,*) '  PISCES QUOTA model is used'
+         IF( ln_p4z    )  WRITE(numout,*) '  PISCES STANDARD model is used'
+         IF( ln_p2z    )  WRITE(numout,*) '  LOBSTER model is used'
+         IF( ln_ligand )  WRITE(numout,*) '  Compute remineralization/dissolution of organic ligands'
+         WRITE(numout,*) ' '
+      ENDIF
+    
+      ioptio = 0
+      IF( ln_p2z )    ioptio = ioptio + 1
+      IF( ln_p4z )    ioptio = ioptio + 1
+      IF( ln_p5z )    ioptio = ioptio + 1
+      !
+      IF( ioptio /= 1 )   CALL ctl_stop( 'Choose ONE PISCES model namelist nampismod' )
+       !
    END SUBROUTINE trc_nam_pisces
-
-#else
-   !!----------------------------------------------------------------------
-   !!  Dummy module :                                   No PISCES bio-model
-   !!----------------------------------------------------------------------
-CONTAINS
-   SUBROUTINE trc_nam_pisces                      ! Empty routine
-   END  SUBROUTINE  trc_nam_pisces
-#endif  
 
    !!======================================================================
Index: branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/NEMO/TOP_SRC/PISCES/trcsms_pisces.F90
===================================================================
--- branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/NEMO/TOP_SRC/PISCES/trcsms_pisces.F90	(revision 7383)
+++ branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/NEMO/TOP_SRC/PISCES/trcsms_pisces.F90	(revision 7391)
@@ -7,11 +7,8 @@
    !!             2.0  !  2007-12  (C. Ethe, G. Madec)  F90
    !!----------------------------------------------------------------------
-#if defined key_pisces || defined key_pisces_reduced
-   !!----------------------------------------------------------------------
-   !!   'key_pisces'                                       PISCES bio-model
-   !!----------------------------------------------------------------------
    !!   trcsms_pisces        :  Time loop of passive tracers sms
    !!----------------------------------------------------------------------
    USE par_pisces
+   USE sms_pisces
    USE p4zsms
    USE p2zsms
@@ -48,6 +45,6 @@
       !!---------------------------------------------------------------------
       !
-      IF( lk_p4z ) THEN  ;   CALL p4z_sms( kt )   !  PISCES
-      ELSE               ;   CALL p2z_sms( kt )   !  LOBSTER
+      IF( ln_p4z .OR. ln_p5z ) THEN  ;   CALL p4z_sms( kt )   !  PISCES
+      ELSE                           ;   CALL p2z_sms( kt )   !  LOBSTER
       ENDIF
 
@@ -55,15 +52,4 @@
    END SUBROUTINE trc_sms_pisces
 
-#else
-   !!======================================================================
-   !!  Dummy module :                                   No PISCES bio-model
-   !!======================================================================
-CONTAINS
-   SUBROUTINE trc_sms_pisces( kt )                   ! Empty routine
-      INTEGER, INTENT( in ) ::   kt
-      WRITE(*,*) 'trc_sms_pisces: You should not have seen this print! error?', kt
-   END SUBROUTINE trc_sms_pisces
-#endif 
-
    !!======================================================================
 END MODULE trcsms_pisces 
Index: branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/NEMO/TOP_SRC/PISCES/trcwri_pisces.F90
===================================================================
--- branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/NEMO/TOP_SRC/PISCES/trcwri_pisces.F90	(revision 7383)
+++ branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/NEMO/TOP_SRC/PISCES/trcwri_pisces.F90	(revision 7391)
@@ -6,7 +6,5 @@
    !! History :   1.0  !  2009-05 (C. Ethe)  Original code
    !!----------------------------------------------------------------------
-#if defined key_top && defined key_iomput && ( defined key_pisces || defined key_pisces_reduced )
-   !!----------------------------------------------------------------------
-   !!   'key_pisces or key_pisces_reduced'                     PISCES model
+#if defined key_top && defined key_iomput 
    !!----------------------------------------------------------------------
    !! trc_wri_pisces   :  outputs of concentration fields
@@ -42,47 +40,47 @@
       ! write the tracer concentrations in the file
       ! ---------------------------------------
-#if defined key_pisces_reduced
-      DO jn = jp_pcs0, jp_pcs1
-         cltra = TRIM( ctrcnm(jn) )                  ! short title for tracer
-         CALL iom_put( cltra, trn(:,:,:,jn) )
-      END DO
-#else
-      DO jn = jp_pcs0, jp_pcs1
-         zfact = 1.0e+6 
-         IF( jn == jpno3 .OR. jn == jpnh4 ) zfact = rno3 * 1.0e+6 
-         IF( jn == jppo4  )                 zfact = po4r * 1.0e+6
-         cltra = TRIM( ctrcnm(jn) )                  ! short title for tracer
-         IF( iom_use( cltra ) )  CALL iom_put( cltra, trn(:,:,:,jn) * zfact )
-      END DO
+      IF( ln_p2z ) THEN
+         DO jn = jp_pcs0, jp_pcs1
+            cltra = TRIM( ctrcnm(jn) )                  ! short title for tracer
+            CALL iom_put( cltra, trn(:,:,:,jn) )
+         END DO
+      ELSE
+         DO jn = jp_pcs0, jp_pcs1
+            zfact = 1.0e+6 
+            IF( jn == jpno3 .OR. jn == jpnh4 ) zfact = rno3 * 1.0e+6 
+            IF( jn == jppo4  )                 zfact = po4r * 1.0e+6
+            cltra = TRIM( ctrcnm(jn) )                  ! short title for tracer
+            IF( iom_use( cltra ) )  CALL iom_put( cltra, trn(:,:,:,jn) * zfact )
+         END DO
 
-      IF( iom_use( "INTDIC" ) ) THEN                     !   DIC content in kg/m2
-         zdic(:,:) = 0.
-         DO jk = 1, jpkm1
-            zdic(:,:) = zdic(:,:) + trn(:,:,jk,jpdic) * e3t_n(:,:,jk) * tmask(:,:,jk) * 12.
-         ENDDO
-         CALL iom_put( 'INTDIC', zdic )     
-      ENDIF
-      !
-      IF( iom_use( "O2MIN" ) .OR. iom_use ( "ZO2MIN" ) ) THEN  ! Oxygen minimum concentration and depth 
-         zo2min   (:,:) = trn(:,:,1,jpoxy) * tmask(:,:,1)
-         zdepo2min(:,:) = gdepw_n(:,:,1)   * tmask(:,:,1)
-         DO jk = 2, jpkm1
-            DO jj = 1, jpj
-               DO ji = 1, jpi
-                  IF( tmask(ji,jj,jk) == 1 ) then
-                     IF( trn(ji,jj,jk,jpoxy) < zo2min(ji,jj) ) then
-                        zo2min   (ji,jj) = trn(ji,jj,jk,jpoxy)
-                        zdepo2min(ji,jj) = gdepw_n(ji,jj,jk)
+         IF( iom_use( "INTDIC" ) ) THEN                     !   DIC content in kg/m2
+            zdic(:,:) = 0.
+            DO jk = 1, jpkm1
+               zdic(:,:) = zdic(:,:) + trn(:,:,jk,jpdic) * e3t_n(:,:,jk) * tmask(:,:,jk) * 12.
+            ENDDO
+            CALL iom_put( 'INTDIC', zdic )     
+         ENDIF
+         !
+         IF( iom_use( "O2MIN" ) .OR. iom_use ( "ZO2MIN" ) ) THEN  ! Oxygen minimum concentration and depth 
+            zo2min   (:,:) = trn(:,:,1,jpoxy) * tmask(:,:,1)
+            zdepo2min(:,:) = gdepw_n(:,:,1)   * tmask(:,:,1)
+            DO jk = 2, jpkm1
+               DO jj = 1, jpj
+                  DO ji = 1, jpi
+                     IF( tmask(ji,jj,jk) == 1 ) then
+                        IF( trn(ji,jj,jk,jpoxy) < zo2min(ji,jj) ) then
+                           zo2min   (ji,jj) = trn(ji,jj,jk,jpoxy)
+                           zdepo2min(ji,jj) = gdepw_n(ji,jj,jk)
+                        ENDIF
                      ENDIF
-                  ENDIF
+                  END DO
                END DO
             END DO
-         END DO
-         !
-         CALL iom_put('O2MIN' , zo2min     )                              ! oxygen minimum concentration
-         CALL iom_put('ZO2MIN', zdepo2min  )                              ! depth of oxygen minimum concentration
-          !
-      ENDIF
-#endif
+            !
+            CALL iom_put('O2MIN' , zo2min     )                              ! oxygen minimum concentration
+            CALL iom_put('ZO2MIN', zdepo2min  )                              ! depth of oxygen minimum concentration
+             !
+         ENDIF
+     ENDIF
       !
    END SUBROUTINE trc_wri_pisces
Index: branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/NEMO/TOP_SRC/TRP/trcadv.F90
===================================================================
--- branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/NEMO/TOP_SRC/TRP/trcadv.F90	(revision 7383)
+++ branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/NEMO/TOP_SRC/TRP/trcadv.F90	(revision 7391)
@@ -57,7 +57,4 @@
    INTEGER ::              nadv             ! chosen advection scheme
    !
-   REAL(wp) ::   r2dttrc  ! vertical profile time-step, = 2 rdt
-   !                                                    ! except at nitrrc000 (=rdt) if neuler=0
-
    !! * Substitutions
 #  include "vectopt_loop_substitute.h90"
@@ -87,10 +84,4 @@
       !
       CALL wrk_alloc( jpi,jpj,jpk,   zun, zvn, zwn )
-      !
-      IF( ( neuler == 0 .AND. kt == nittrc000 ) .OR. ln_top_euler ) THEN     ! at nittrc000
-         r2dttrc =  rdttrc           ! = rdttrc (use or restarting with Euler time stepping)
-      ELSEIF( kt <= nittrc000 + nn_dttrc ) THEN          ! at nittrc000 or nittrc000+1
-         r2dttrc = 2. * rdttrc       ! = 2 rdttrc (leapfrog)
-      ENDIF
       !                                               !==  effective transport  ==!
       DO jk = 1, jpkm1
Index: branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/NEMO/TOP_SRC/TRP/trcnxt.F90
===================================================================
--- branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/NEMO/TOP_SRC/TRP/trcnxt.F90	(revision 7383)
+++ branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/NEMO/TOP_SRC/TRP/trcnxt.F90	(revision 7391)
@@ -43,6 +43,4 @@
 
    PUBLIC   trc_nxt          ! routine called by step.F90
-
-   REAL(wp) ::   r2dttrc
 
    !!----------------------------------------------------------------------
@@ -100,9 +98,4 @@
 
       IF( lk_bdy )  CALL trc_bdy( kt )
-
-      !                                ! set time step size (Euler/Leapfrog)
-      IF( neuler == 0 .AND. kt ==  nittrc000 ) THEN  ;  r2dttrc =     rdttrc   ! at nittrc000             (Euler)
-      ELSEIF( kt <= nittrc000 + nn_dttrc )     THEN  ;  r2dttrc = 2.* rdttrc   ! at nit000 or nit000+1 (Leapfrog)
-      ENDIF
 
       IF( l_trdtrc )  THEN             ! trends: store now fields before the Asselin filter application
Index: branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/NEMO/TOP_SRC/TRP/trcrad.F90
===================================================================
--- branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/NEMO/TOP_SRC/TRP/trcrad.F90	(revision 7383)
+++ branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/NEMO/TOP_SRC/TRP/trcrad.F90	(revision 7391)
@@ -62,8 +62,9 @@
       ENDIF
 
-      IF( lk_cfc     )   CALL trc_rad_sms( kt, trb, trn, jp_cfc0 , jp_cfc1               )  ! CFC model
-      IF( lk_c14b    )   CALL trc_rad_sms( kt, trb, trn, jp_c14b0, jp_c14b1              )  ! bomb C14
-      IF( lk_pisces  )   CALL trc_rad_sms( kt, trb, trn, jp_pcs0 , jp_pcs1, cpreserv='Y' )  ! PISCES model
-      IF( lk_my_trc  )   CALL trc_rad_sms( kt, trb, trn, jp_myt0 , jp_myt1               )  ! MY_TRC model
+      IF( ln_age     )   CALL trc_rad_sms( kt, trb, trn, jp_age , jp_age               )  !  AGE
+      IF( ll_cfc     )   CALL trc_rad_sms( kt, trb, trn, jp_cfc0, jp_cfc1               )  !  CFC model
+      IF( ln_c14     )   CALL trc_rad_sms( kt, trb, trn, jp_c14 , jp_c14               )  !  C14
+      IF( ln_pisces  )   CALL trc_rad_sms( kt, trb, trn, jp_pcs0, jp_pcs1, cpreserv='Y' )  !  PISCES model
+      IF( ln_my_trc  )   CALL trc_rad_sms( kt, trb, trn, jp_myt0, jp_myt1               )  !  MY_TRC model
 
       !
@@ -213,5 +214,5 @@
             IF( l_trdtrc ) THEN
                !
-               zs2rdt = 1. / ( 2. * rdt * FLOAT( nn_dttrc ) )
+               zs2rdt = 1. / ( 2. * rdt * REAL( nn_dttrc, wp ) )
                ztrtrdb(:,:,:) = ( ptrb(:,:,:,jn) - ztrtrdb(:,:,:) ) * zs2rdt
                ztrtrdn(:,:,:) = ( ptrn(:,:,:,jn) - ztrtrdn(:,:,:) ) * zs2rdt 
Index: branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/NEMO/TOP_SRC/TRP/trcsbc.F90
===================================================================
--- branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/NEMO/TOP_SRC/TRP/trcsbc.F90	(revision 7383)
+++ branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/NEMO/TOP_SRC/TRP/trcsbc.F90	(revision 7391)
@@ -84,15 +84,4 @@
       END SELECT
 
-      IF( ln_top_euler) THEN
-         r2dt =  rdttrc              ! = rdttrc (use Euler time stepping)
-      ELSE
-         IF( neuler == 0 .AND. kt == nittrc000 ) THEN     ! at nittrc000
-            r2dt = rdttrc            ! = rdttrc (restarting with Euler time stepping)
-         ELSEIF( kt <= nittrc000 + nn_dttrc ) THEN          ! at nittrc000 or nittrc000+1
-            r2dt = 2. * rdttrc       ! = 2 rdttrc (leapfrog)
-         ENDIF
-      ENDIF
-
-
       IF( kt == nittrc000 ) THEN
          IF(lwp) WRITE(numout,*)
@@ -160,5 +149,5 @@
                   zdtra = r1_rau0 * ( ztfx + zsfx(ji,jj) * trn(ji,jj,1,jn) ) 
                   IF ( zdtra < 0. ) THEN
-                     zratio = -zdtra * zse3t * r2dt / ( trn(ji,jj,1,jn) + zrtrn )
+                     zratio = -zdtra * zse3t * r2dttrc / ( trn(ji,jj,1,jn) + zrtrn )
                      zdtra = MIN(1.0, zratio) * zdtra ! avoid negative concentrations to arise
                   ENDIF
Index: branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/NEMO/TOP_SRC/TRP/trczdf.F90
===================================================================
--- branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/NEMO/TOP_SRC/TRP/trczdf.F90	(revision 7383)
+++ branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/NEMO/TOP_SRC/TRP/trczdf.F90	(revision 7391)
@@ -35,7 +35,4 @@
    INTEGER ::   nzdf = 0               ! type vertical diffusion algorithm used
       !                                ! defined from ln_zdf...  namlist logicals)
-   REAL(wp) ::  r2dttrc   ! vertical profile time-step, = 2 rdt
-      !                   ! except at nittrc000 (=rdt) if neuler=0
-
    !! * Substitutions
 #  include "zdfddm_substitute.h90"
@@ -63,10 +60,4 @@
       IF( nn_timing == 1 )  CALL timing_start('trc_zdf')
       !
-      IF( ( neuler == 0 .AND. kt == nittrc000 ) .OR. ln_top_euler ) THEN     ! at nittrc000
-         r2dttrc =  rdttrc           ! = rdttrc (use or restarting with Euler time stepping)
-      ELSEIF( kt <= nittrc000 + nn_dttrc ) THEN          ! at nittrc000 or nittrc000+1
-         r2dttrc = 2. * rdttrc       ! = 2 rdttrc (leapfrog)
-      ENDIF
-
       IF( l_trdtrc )  THEN
          CALL wrk_alloc( jpi, jpj, jpk, jptra, ztrtrd )
Index: branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/NEMO/TOP_SRC/TRP/trdmxl_trc.F90
===================================================================
--- branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/NEMO/TOP_SRC/TRP/trdmxl_trc.F90	(revision 7383)
+++ branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/NEMO/TOP_SRC/TRP/trdmxl_trc.F90	(revision 7391)
@@ -41,27 +41,16 @@
    PUBLIC trd_mxl_trc
    PUBLIC trd_mxl_trc_alloc
-   PUBLIC trd_mxl_bio
    PUBLIC trd_mxl_trc_init
    PUBLIC trd_mxl_trc_zint
-   PUBLIC trd_mxl_bio_zint
 
    CHARACTER (LEN=40) ::  clhstnam                                ! name of the trends NetCDF file
    INTEGER ::   nmoymltrd
-   INTEGER, ALLOCATABLE, SAVE, DIMENSION(:) ::   ndextrd1
-   INTEGER, DIMENSION(jptra) ::   nidtrd, nh_t
+   INTEGER, ALLOCATABLE, SAVE, DIMENSION(:) ::   ndextrd1, nidtrd, nh_t
    INTEGER ::   ndimtrd1                        
    INTEGER, SAVE ::  ionce, icount
-#if defined key_pisces_reduced
-   INTEGER ::   nidtrdbio, nh_tb
-   INTEGER, SAVE ::  ioncebio, icountbio
-   INTEGER, SAVE ::   nmoymltrdbio
-#endif
    LOGICAL :: llwarn  = .TRUE.                                    ! this should always be .TRUE.
    LOGICAL :: lldebug = .TRUE.
 
    REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:,:,:) ::  ztmltrd2   !
-#if defined key_pisces_reduced
-   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::  ztmltrdbio2  ! only needed for mean diagnostics in trd_mxl_bio()
-#endif
 
    !! * Substitutions
@@ -79,8 +68,5 @@
       !!----------------------------------------------------------------------
       ALLOCATE( ztmltrd2(jpi,jpj,jpltrd_trc,jptra) ,      &
-#if defined key_pisces_reduced
-         &      ztmltrdbio2(jpi,jpj,jpdiabio)      ,      &
-#endif
-         &      ndextrd1(jpi*jpj)                  ,  STAT=trd_mxl_trc_alloc)
+         &      ndextrd1(jpi*jpj), nidtrd(jptra), nh_t(jptra),  STAT=trd_mxl_trc_alloc)
          !
       IF( lk_mpp                )   CALL mpp_sum ( trd_mxl_trc_alloc )
@@ -131,7 +117,5 @@
          SELECT CASE ( nn_ctls_trc )                                ! choice of the control surface
             CASE ( -2  )   ;   STOP 'trdmxl_trc : not ready '     !     -> isopycnal surface (see ???)
-#if defined key_pisces || defined key_pisces_reduced
             CASE ( -1  )   ;   nmld_trc(:,:) = neln(:,:)          !     -> euphotic layer with light criterion
-#endif
             CASE (  0  )   ;   nmld_trc(:,:) = nmln(:,:)          !     -> ML with density criterion (see zdfmxl)
             CASE (  1  )   ;   nmld_trc(:,:) = nbol_trc(:,:)          !     -> read index from file
@@ -207,119 +191,4 @@
       !
    END SUBROUTINE trd_mxl_trc_zint
-
-
-   SUBROUTINE trd_mxl_bio_zint( ptrc_trdmxl, ktrd )
-      !!----------------------------------------------------------------------
-      !!                  ***  ROUTINE trd_mxl_bio_zint  ***
-      !!
-      !! ** Purpose :   Compute the vertical average of the 3D fields given as arguments
-      !!                to the subroutine. This vertical average is performed from ocean
-      !!                surface down to a chosen control surface.
-      !!
-      !! ** Method/usage :
-      !!      The control surface can be either a mixed layer depth (time varying)
-      !!      or a fixed surface (jk level or bowl).
-      !!      Choose control surface with nctls in namelist NAMTRD :
-      !!        nctls_trc = 0  : use mixed layer with density criterion
-      !!        nctls_trc = 1  : read index from file 'ctlsurf_idx'
-      !!        nctls_trc > 1  : use fixed level surface jk = nctls_trc
-      !!      Note: in the remainder of the routine, the volume between the
-      !!            surface and the control surface is called "mixed-layer"
-      !!----------------------------------------------------------------------
-      !!
-      INTEGER                         , INTENT(in) ::   ktrd          ! bio trend index
-      REAL(wp), DIMENSION(jpi,jpj,jpk), INTENT(in) ::   ptrc_trdmxl   ! passive trc trend
-#if defined key_pisces_reduced
-      !
-      INTEGER ::   ji, jj, jk, isum
-      REAL(wp), POINTER, DIMENSION(:,:) :: zvlmsk
-      !!----------------------------------------------------------------------
-
-      CALL wrk_alloc( jpi, jpj, zvlmsk )
-
-      ! I. Definition of control surface and integration weights
-      ! --------------------------------------------------------
-      !            ==> only once per time step <==
-
-      IF( icountbio == 1 ) THEN
-         !
-         tmltrd_bio(:,:,:) = 0.e0    ! <<< reset trend arrays to zero
-         ! ... Set nmld(ji,jj) = index of first T point below control surf. or outside mixed-layer
-         SELECT CASE ( nn_ctls_trc )                                    ! choice of the control surface
-            CASE ( -2  )   ;   STOP 'trdmxl_trc : not ready '     !     -> isopycnal surface (see ???)
-            CASE ( -1  )   ;   nmld_trc(:,:) = neln(:,:)          !     -> euphotic layer with light criterion
-            CASE (  0  )   ;   nmld_trc(:,:) = nmln(:,:)          !     -> ML with density criterion (see zdfmxl)
-            CASE (  1  )   ;   nmld_trc(:,:) = nbol_trc(:,:)          !     -> read index from file
-            CASE (  2: )   ;   nn_ctls_trc = MIN( nn_ctls_trc, jpktrd_trc - 1 )
-                               nmld_trc(:,:) = nn_ctls_trc + 1          !     -> model level
-         END SELECT
-
-         ! ... Compute ndextrd1 and ndimtrd1 only once
-         IF( ioncebio == 1 ) THEN
-            !
-            ! Check of validity : nmld_trc(ji,jj) <= jpktrd_trc
-            isum        = 0
-            zvlmsk(:,:) = 0.e0
-
-            IF( jpktrd_trc < jpk ) THEN
-               DO jj = 1, jpj
-                  DO ji = 1, jpi
-                     IF( nmld_trc(ji,jj) <= jpktrd_trc ) THEN
-                        zvlmsk(ji,jj) = tmask(ji,jj,1)
-                     ELSE
-                        isum = isum + 1
-                        zvlmsk(ji,jj) = 0.
-                     END IF
-                  END DO
-               END DO
-            END IF
-
-            ! Index of ocean points (2D only)
-            IF( isum > 0 ) THEN
-               WRITE(numout,*)' tmltrd_trc : Number of invalid points nmld_trc > jpktrd', isum
-               CALL wheneq( jpi*jpj, zvlmsk(:,:) , 1, 1., ndextrd1, ndimtrd1 )
-            ELSE
-               CALL wheneq( jpi*jpj, tmask(:,:,1), 1, 1., ndextrd1, ndimtrd1 )
-            END IF
-
-            ioncebio = 0                  ! no more pass here
-            !
-         END IF !  ( ioncebio == 1 )
-
-         ! ... Weights for vertical averaging
-         wkx_trc(:,:,:) = 0.e0
-         DO jk = 1, jpktrd_trc         ! initialize wkx_trc with vertical scale factor in mixed-layer
-            DO jj = 1,jpj
-              DO ji = 1,jpi
-                  IF( jk - nmld_trc(ji,jj) < 0. )   wkx_trc(ji,jj,jk) = e3t_n(ji,jj,jk) * tmask(ji,jj,jk)
-               END DO
-            END DO
-         END DO
-
-         rmld_trc(:,:) = 0.
-         DO jk = 1, jpktrd_trc         ! compute mixed-layer depth : rmld_trc
-            rmld_trc(:,:) = rmld_trc(:,:) + wkx_trc(:,:,jk)
-         END DO
-
-         DO jk = 1, jpktrd_trc         ! compute integration weights
-            wkx_trc(:,:,jk) = wkx_trc(:,:,jk) / MAX( 1., rmld_trc(:,:) )
-         END DO
-
-         icountbio = 0                    ! <<< flag = off : control surface & integr. weights
-         !                             !     computed only once per time step
-      END IF ! ( icountbio == 1 )
-
-      ! II. Vertical integration of trends in the mixed-layer
-      ! -----------------------------------------------------
-
-
-      DO jk = 1, jpktrd_trc
-         tmltrd_bio(:,:,ktrd) = tmltrd_bio(:,:,ktrd) + ptrc_trdmxl(:,:,jk) * wkx_trc(:,:,jk)
-      END DO
-
-      CALL wrk_dealloc( jpi, jpj, zvlmsk )
-#endif
-      !
-   END SUBROUTINE trd_mxl_bio_zint
 
 
@@ -877,229 +746,4 @@
 
 
-   SUBROUTINE trd_mxl_bio( kt )
-      !!----------------------------------------------------------------------
-      !!                  ***  ROUTINE trd_mld  ***
-      !!
-      !! ** Purpose :  Compute and cumulate the mixed layer biological trends over an analysis
-      !!               period, and write NetCDF outputs.
-      !!
-      !! ** Method/usage :
-      !!          The stored trends can be chosen twofold (according to the ln_trdmxl_trc_instant
-      !!          logical namelist variable) :
-      !!          1) to explain the difference between initial and final
-      !!             mixed-layer T & S (where initial and final relate to the
-      !!             current analysis window, defined by ntrd in the namelist)
-      !!          2) to explain the difference between the current and previous
-      !!             TIME-AVERAGED mixed-layer T & S (where time-averaging is
-      !!             performed over each analysis window).
-      !!
-      !! ** Consistency check :
-      !!        If the control surface is fixed ( nctls > 1 ), the residual term (dh/dt
-      !!        entrainment) should be zero, at machine accuracy. Note that in the case
-      !!        of time-averaged mixed-layer fields, this residual WILL NOT BE ZERO
-      !!        over the first two analysis windows (except if restart).
-      !!        N.B. For ORCA2_LIM, use e.g. ntrd=5, ucf=1., nctls=8
-      !!             for checking residuals.
-      !!             On a NEC-SX5 computer, this typically leads to:
-      !!                   O(1.e-20) temp. residuals (tml_res) when ln_trdmxl_trc_instant=.false.
-      !!                   O(1.e-21) temp. residuals (tml_res) when ln_trdmxl_trc_instant=.true.
-      !!
-      !! ** Action :
-      !!       At each time step, mixed-layer averaged trends are stored in the
-      !!       tmltrd(:,:,jpmxl_xxx) array (see trdmxl_oce.F90 for definitions of jpmxl_xxx).
-      !!       This array is known when trd_mld is called, at the end of the stp subroutine,
-      !!       except for the purely vertical K_z diffusion term, which is embedded in the
-      !!       lateral diffusion trend.
-      !!
-      !!       In I), this K_z term is diagnosed and stored, thus its contribution is removed
-      !!       from the lateral diffusion trend.
-      !!       In II), the instantaneous mixed-layer T & S are computed, and misc. cumulative
-      !!       arrays are updated.
-      !!       In III), called only once per analysis window, we compute the total trends,
-      !!       along with the residuals and the Asselin correction terms.
-      !!       In IV), the appropriate trends are written in the trends NetCDF file.
-      !!
-      !! References :
-      !!       - Vialard & al.
-      !!       - See NEMO documentation (in preparation)
-      !!----------------------------------------------------------------------
-      INTEGER, INTENT( in ) ::   kt                       ! ocean time-step index
-#if defined key_pisces_reduced
-      INTEGER  ::  jl, it, itmod
-      LOGICAL  :: llwarn  = .TRUE., lldebug = .TRUE.
-      REAL(wp) :: zfn, zfn2
-      !!----------------------------------------------------------------------
-      ! ... Warnings
-      IF( nn_dttrc  /= 1  ) CALL ctl_stop( " Be careful, trends diags never validated " )
-
-      ! ======================================================================
-      ! II. Cumulate the trends over the analysis window
-      ! ======================================================================
-
-      ztmltrdbio2(:,:,:) = 0.e0  ! <<< reset arrays to zero
-
-      ! II.3 Initialize mixed-layer "before" arrays for the 1rst analysis window
-      ! ------------------------------------------------------------------------
-      IF( kt == nittrc000 + nn_dttrc ) THEN  !  i.e. ( .NOT. ln_rstart ).AND.( kt == nit000 + 1)
-         !
-         tmltrd_csum_ub_bio (:,:,:) = 0.e0
-         !
-      END IF
-
-      ! II.4 Cumulated trends over the analysis period
-      ! ----------------------------------------------
-      !
-      !         [  1rst analysis window ] [     2nd analysis window     ]
-      !
-      !
-      !     o---[--o-----o-----o-----o--]-[--o-----o-----o-----o-----o--]---o-----o--> time steps
-      !                            ntrd                             2*ntrd       etc.
-      !     1      2     3     4    =5 e.g.                          =10
-      !
-      IF( ( kt >= 2 ).OR.( ln_rsttr ) ) THEN
-         !
-         nmoymltrdbio = nmoymltrdbio + 1
-
-         ! ... Trends associated with the time mean of the ML passive tracers
-         tmltrd_sum_bio    (:,:,:) = tmltrd_sum_bio    (:,:,:) + tmltrd_bio    (:,:,:)
-         tmltrd_csum_ln_bio(:,:,:) = tmltrd_csum_ln_bio(:,:,:) + tmltrd_sum_bio(:,:,:)
-         !
-      END IF
-
-      ! ======================================================================
-      ! III. Prepare fields for output (get here ONCE PER ANALYSIS PERIOD)
-      ! ======================================================================
-
-      ! Convert to appropriate physical units
-      tmltrd_bio(:,:,:) = tmltrd_bio(:,:,:) * rn_ucf_trc
-
-      MODULO_NTRD : IF( MOD( kt, nn_trd_trc ) == 0 ) THEN      ! nitend MUST be multiple of ntrd
-         !
-         zfn  = float(nmoymltrdbio)    ;    zfn2 = zfn * zfn
-
-         ! III.1 Prepare fields for output ("instantaneous" diagnostics)
-         ! -------------------------------------------------------------
-
-#if defined key_diainstant
-         STOP 'tmltrd_bio : key_diainstant was never checked within trdmxl. Comment this to proceed.'
-#endif
-         ! III.2 Prepare fields for output ("mean" diagnostics)
-         ! ----------------------------------------------------
-
-         ztmltrdbio2(:,:,:) = tmltrd_csum_ub_bio(:,:,:) + tmltrd_csum_ln_bio(:,:,:)
-
-         !-- Lateral boundary conditions
-         IF ( cp_cfg .NE. 'gyre' ) THEN            ! other than GYRE configuration 
-            ! ES_B27_CD_WARN : lbc inutile GYRE, cf. + haut
-            DO jn = 1, jpdiabio
-              CALL lbc_lnk( ztmltrdbio2(:,:,jn), 'T', 1. )
-            ENDDO
-         ENDIF
-
-         IF( lldebug ) THEN
-            !
-            WRITE(numout,*) 'trd_mxl_bio : write trends in the Mixed Layer for debugging process:'
-            WRITE(numout,*) '~~~~~~~~~~~  '
-            WRITE(numout,*) 'TRC kt = ', kt, 'nmoymltrdbio = ', nmoymltrdbio
-            WRITE(numout,*)
-
-            DO jl = 1, jpdiabio
-              IF( ln_trdmxl_trc_instant ) THEN
-                  WRITE(numout,97) 'TRC jl =', jl, ' bio TREND INDEX  = ', jl, &
-                     & ' SUM tmltrd_bio : ', SUM2D(tmltrd_bio(:,:,jl))
-              ELSE
-                  WRITE(numout,97) 'TRC jl =', jl, ' bio TREND INDEX  = ', jl, &
-                     & ' SUM ztmltrdbio2 : ', SUM2D(ztmltrdbio2(:,:,jl))
-              endif
-            END DO
-
-97          FORMAT(a10, i3, 2x, a30, i3, a20, 2x, g20.10)
-98          FORMAT(a10, i3, 2x, a30, 2x, g20.10)
-99          FORMAT('TRC jj =', i3,' : ', 10(g10.3,2x))
-            WRITE(numout,*)
-            !
-         ENDIF
-
-         ! III.3 Time evolution array swap
-         ! -------------------------------
-
-         ! For passive tracer mean diagnostics
-         tmltrd_csum_ub_bio (:,:,:) = zfn * tmltrd_sum_bio(:,:,:) - tmltrd_csum_ln_bio(:,:,:)
-
-         ! III.4 Convert to appropriate physical units
-         ! -------------------------------------------
-         ztmltrdbio2    (:,:,:) = ztmltrdbio2    (:,:,:) * rn_ucf_trc/zfn2
-
-      END IF MODULO_NTRD
-
-      ! ======================================================================
-      ! IV. Write trends in the NetCDF file
-      ! ======================================================================
-
-      ! IV.1 Code for IOIPSL/NetCDF output
-      ! ----------------------------------
-
-      ! define time axis
-      itmod = kt - nittrc000 + 1
-      it    = kt
-
-      IF( lwp .AND. MOD( itmod , nn_trd_trc ) == 0 ) THEN
-         WRITE(numout,*) ' '
-         WRITE(numout,*) 'trd_mxl_bio : write ML bio trends in the NetCDF file :'
-         WRITE(numout,*) '~~~~~~~~~~~ '
-         WRITE(numout,*) '          ', TRIM(clhstnam), ' at kt = ', kt
-         WRITE(numout,*) '          N.B. nmoymltrdbio = ', nmoymltrdbio
-         WRITE(numout,*) ' '
-      END IF
-
-
-      ! 2. Start writing data
-      ! ---------------------
-
-      NETCDF_OUTPUT : IF( ln_trdmxl_trc_instant ) THEN    ! <<< write the trends for passive tracer instant. diags
-         !
-            DO jl = 1, jpdiabio
-               CALL histwrite( nidtrdbio,TRIM("ML_"//ctrd_bio(jl,2)) ,            &
-                    &          it, tmltrd_bio(:,:,jl), ndimtrd1, ndextrd1 )
-            END DO
-
-
-         IF( kt == nitend )   CALL histclo( nidtrdbio )
-
-      ELSE    ! <<< write the trends for passive tracer mean diagnostics
-
-            DO jl = 1, jpdiabio
-               CALL histwrite( nidtrdbio, TRIM("ML_"//ctrd_bio(jl,2)) ,            &
-                    &          it, ztmltrdbio2(:,:,jl), ndimtrd1, ndextrd1 )
-            END DO
-
-            IF( kt == nitend )   CALL histclo( nidtrdbio )
-            !
-      END IF NETCDF_OUTPUT
-
-      ! Compute the control surface (for next time step) : flag = on
-      icountbio = 1
-
-
-
-      IF( MOD( itmod, nn_trd_trc ) == 0 ) THEN
-         !
-         ! III.5 Reset cumulative arrays to zero
-         ! -------------------------------------
-         nmoymltrdbio = 0
-         tmltrd_csum_ln_bio (:,:,:) = 0.e0
-         tmltrd_sum_bio     (:,:,:) = 0.e0
-      END IF
-
-      ! ======================================================================
-      ! Write restart file
-      ! ======================================================================
-
-! restart write is done in trd_mxl_trc_write which is called by trd_mxl_bio (Marina)
-!
-#endif
-   END SUBROUTINE trd_mxl_bio
-
-
    REAL FUNCTION sum2d( ztab )
       !!----------------------------------------------------------------------
@@ -1191,13 +835,4 @@
       tmltrd_csum_ln_trc (:,:,:,:) = 0.e0   ;   rmld_sum_trc       (:,:)     = 0.e0
 
-#if defined key_pisces_reduced
-      nmoymltrdbio   = 0
-      tmltrd_sum_bio     (:,:,:) = 0.e0     ;   tmltrd_csum_ln_bio (:,:,:) = 0.e0
-      DO jl = 1, jp_pisces_trd
-          ctrd_bio(jl,1) = ctrbil(jl)   ! long name
-          ctrd_bio(jl,2) = ctrbio(jl)   ! short name
-       ENDDO
-#endif
-
       IF( ln_rsttr .AND. ln_trdmxl_trc_restart ) THEN
          CALL trd_mxl_trc_rst_read
@@ -1208,7 +843,4 @@
          tml_sumb_trc       (:,:,:)   = 0.e0   ;   tmltrd_csum_ub_trc (:,:,:,:) = 0.e0     ! mean
          tmltrd_atf_sumb_trc(:,:,:)   = 0.e0   ;   tmltrd_rad_sumb_trc(:,:,:)   = 0.e0 
-#if defined key_pisces_reduced
-         tmltrd_csum_ub_bio (:,:,:) = 0.e0
-#endif
 
        ENDIF
@@ -1216,7 +848,4 @@
       icount = 1   ;   ionce  = 1  ! open specifier   
 
-#if defined key_pisces_reduced
-      icountbio = 1   ;   ioncebio  = 1  ! open specifier
-#endif
 
       ! I.3 Read control surface from file ctlsurf_idx
@@ -1308,11 +937,4 @@
       END DO
 
-#if defined key_pisces_reduced
-          !-- Create a NetCDF file and enter the define mode
-          CALL dia_nam( clhstnam, nn_trd_trc, 'trdbio' )
-          CALL histbeg( clhstnam, jpi, glamt, jpj, gphit,                                            &
-             &             1, jpi, 1, jpj, iiter, zjulian, rdt, nh_tb, nidtrdbio, domain_id=nidom, snc4chunks=snc4set )
-#endif
-
       !-- Define physical units
       IF( rn_ucf_trc == 1. ) THEN
@@ -1354,11 +976,4 @@
       END DO
 
-#if defined key_pisces_reduced
-      DO jl = 1, jp_pisces_trd
-         CALL histdef(nidtrdbio, TRIM("ML_"//ctrd_bio(jl,2)), TRIM(clmxl//" ML_"//ctrd_bio(jl,1))   ,            &
-             &    cltrcu, jpi, jpj, nh_tb, 1  , 1, 1  , -99 , 32, clop, zsto, zout ) ! IOIPSL: time mean
-      END DO                                                                         ! if zsto=rdt above
-#endif
-
       !-- Leave IOIPSL/NetCDF define mode
       DO jn = 1, jptra
@@ -1366,11 +981,5 @@
       END DO
 
-#if defined key_pisces_reduced
-      !-- Leave IOIPSL/NetCDF define mode
-      CALL histend( nidtrdbio, snc4set )
-
       IF(lwp) WRITE(numout,*)
-       IF(lwp) WRITE(numout,*) 'End of NetCDF Initialization for ML bio trends'
-#endif
 
    END SUBROUTINE trd_mxl_trc_init
@@ -1385,8 +994,4 @@
       WRITE(*,*) 'trd_mxl_trc: You should not have seen this print! error?', kt
    END SUBROUTINE trd_mxl_trc
-   SUBROUTINE trd_mxl_bio( kt )
-      INTEGER, INTENT( in) ::   kt
-      WRITE(*,*) 'trd_mxl_bio: You should not have seen this print! error?', kt
-   END SUBROUTINE trd_mxl_bio
    SUBROUTINE trd_mxl_trc_zint( ptrc_trdmxl, ktrd, ctype, kjn )
       INTEGER               , INTENT( in ) ::  ktrd, kjn              ! ocean trend index and passive tracer rank
Index: branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/NEMO/TOP_SRC/TRP/trdmxl_trc_rst.F90
===================================================================
--- branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/NEMO/TOP_SRC/TRP/trdmxl_trc_rst.F90	(revision 7383)
+++ branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/NEMO/TOP_SRC/TRP/trdmxl_trc_rst.F90	(revision 7391)
@@ -107,10 +107,4 @@
             END DO                                                     ! tracer loop
             !                                                          ! ===========
-#if defined key_pisces_reduced
-            DO jl = 1, jp_pisces_trd
-               CALL iom_rstput( kt, nitrst, nummldw_trc, 'tmltrd_csum_ub_bio'//ctrd_bio(jl,2), tmltrd_csum_ub_bio(:,:,jl) )
-            ENDDO
-#endif
-
          ENDIF
          
@@ -188,10 +182,4 @@
          !                                                          ! ===========
 
-#if defined key_pisces_reduced
-         DO jl = 1, jp_pisces_trd
-            CALL iom_get( inum, jpdom_autoglo, 'tmltrd_csum_ub_bio'//ctrd_bio(jl,2), tmltrd_csum_ub_bio(:,:,jl) )
-         ENDDO
-#endif
-         
          CALL iom_close( inum )
       ENDIF
Index: branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/NEMO/TOP_SRC/TRP/trdtrc_oce.F90
===================================================================
--- branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/NEMO/TOP_SRC/TRP/trdtrc_oce.F90	(revision 7383)
+++ branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/NEMO/TOP_SRC/TRP/trdtrc_oce.F90	(revision 7391)
@@ -22,5 +22,5 @@
    CHARACTER(len=50) ::  cn_trdrst_trc_in     !: suffix of pass. tracer restart name (input)
    CHARACTER(len=50) ::  cn_trdrst_trc_out    !: suffix of pass. tracer restart name (output)
-   LOGICAL, DIMENSION(jptra) ::   ln_trdtrc   !: large trends diagnostic to write or not (namelist)
+   LOGICAL, DIMENSION(:), ALLOCATABLE ::   ln_trdtrc   !: large trends diagnostic to write or not (namelist)
 
 # if defined key_trdtrc && defined key_iomput
@@ -106,14 +106,4 @@
 # endif
 
-# if defined key_pisces_reduced
-   CHARACTER(LEN=80) :: clname_bio, ctrd_bio(jpdiabio,2)
-   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::  &
-      tmltrd_bio,                         &      !: \ biological contributions to the total trend ,
-                                                 !: / cumulated over the current analysis window
-      tmltrd_sum_bio,                     &      !: sum of these trends over the analysis period
-      tmltrd_csum_ln_bio,                 &      !: now cumulated sum of trends over the "lower triangle"
-      tmltrd_csum_ub_bio                         !: before (prev. analysis period) cumulated sum over the
-                                                 !: upper triangle
-#endif
    !!----------------------------------------------------------------------
    !! NEMO/TOP 3.3 , NEMO Consortium (2010)
@@ -154,11 +144,4 @@
 #endif
       !
-# if defined key_pisces_reduced
-      ALLOCATE( tmltrd_bio        (jpi,jpj,jpdiabio) ,     &
-         &      tmltrd_sum_bio    (jpi,jpj,jpdiabio) ,     &
-         &      tmltrd_csum_ln_bio(jpi,jpj,jpdiabio) ,     &
-         &      tmltrd_csum_ub_bio(jpi,jpj,jpdiabio) , STAT=ierr(2) )
-# endif
-      !
       trd_trc_oce_alloc = MAXVAL(ierr)
       !
Index: branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/NEMO/TOP_SRC/oce_trc.F90
===================================================================
--- branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/NEMO/TOP_SRC/oce_trc.F90	(revision 7383)
+++ branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/NEMO/TOP_SRC/oce_trc.F90	(revision 7391)
@@ -31,4 +31,5 @@
    USE phycst                                   !* physical constants *
    USE c1d                                      !* 1D configuration
+
    USE dom_oce                                  !* model domain *
 
@@ -63,9 +64,12 @@
    USE sbc_oce , ONLY :   fmmflx     =>    fmmflx     !: freshwater budget: volume flux               [Kg/m2/s]
    USE sbc_oce , ONLY :   rnf        =>    rnf        !: river runoff   [Kg/m2/s]
+   USE sbc_oce , ONLY :   rnf_b      =>    rnf_b      !: river runoff at previus step   [Kg/m2/s]
    USE sbc_oce , ONLY :   ln_dm2dc   =>    ln_dm2dc   !: Diurnal Cycle 
+   USE sbc_oce , ONLY :   ln_cpl     =>    ln_cpl     !: ocean-atmosphere coupled formulation
    USE sbc_oce , ONLY :   ncpl_qsr_freq   =>   ncpl_qsr_freq   !: qsr coupling frequency per days from atmospher
    USE sbc_oce , ONLY :   ln_rnf     =>    ln_rnf     !: runoffs / runoff mouths
    USE sbc_oce , ONLY :   fr_i       =>    fr_i       !: ice fraction (between 0 to 1)
    USE sbc_oce , ONLY :   nn_ice_embd => nn_ice_embd  !: flag for  levitating/embedding sea-ice in the ocean
+   USE sbc_oce , ONLY :   atm_co2    =>    atm_co2    !  atmospheric pCO2
    USE traqsr  , ONLY :   rn_abs     =>    rn_abs     !: fraction absorbed in the very near surface
    USE traqsr  , ONLY :   rn_si0     =>    rn_si0     !: very near surface depth of extinction
@@ -75,4 +79,5 @@
    USE sbcrnf  , ONLY :   h_rnf      =>    h_rnf      !: river runoff   [Kg/m2/s]
    USE sbcrnf  , ONLY :   nk_rnf     =>    nk_rnf     !: depth of runoff in model level
+   USE sbcrnf  , ONLY :   rn_rfact   =>    rn_rfact   !: multiplicative factor for runoff
 
    USE trc_oce
Index: branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/NEMO/TOP_SRC/par_trc.F90
===================================================================
--- branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/NEMO/TOP_SRC/par_trc.F90	(revision 7383)
+++ branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/NEMO/TOP_SRC/par_trc.F90	(revision 7391)
@@ -10,38 +10,34 @@
    !!----------------------------------------------------------------------
    USE par_kind          ! kind parameters
+   USE par_pisces        ! PISCES model  parameters
+   USE par_cfc           ! CFCs  tracers parameters
+   USE par_c14           ! C14 tracer    parameters
+   USE par_age           ! AGE tracer    parameters
+   USE par_my_trc        ! MY_TRC model  parameters
    !
-   USE par_pisces    ! PISCES  model
-   USE par_c14b      ! C14 bomb tracer
-   USE par_cfc       ! CFC 11 and 12 tracers
-   USE par_my_trc    ! user defined passive tracers
 
    IMPLICIT NONE
 
-   ! Passive tracers : Maximum number of tracers. Needed to define data structures
-   ! --------------- 
-   INTEGER, PUBLIC,  PARAMETER ::   jpmaxtrc = 100
+   INTEGER, PUBLIC,  PARAMETER :: jpmaxtrc = 100  ! Maximum number of tracers
 
-   ! Passive tracers : Total size
-   ! ---------------               ! total number of passive tracers, of 2d and 3d output and trend arrays
-   INTEGER, PUBLIC,  PARAMETER ::   jptra    =  jp_pisces     + jp_cfc     + jp_c14b    + jp_my_trc
-   INTEGER, PUBLIC,  PARAMETER ::   jpdia2d  =  jp_pisces_2d  + jp_cfc_2d  + jp_c14b_2d + jp_my_trc_2d
-   INTEGER, PUBLIC,  PARAMETER ::   jpdia3d  =  jp_pisces_3d  + jp_cfc_3d  + jp_c14b_3d + jp_my_trc_3d
-   !                     ! total number of sms diagnostic arrays
-   INTEGER, PUBLIC,  PARAMETER ::   jpdiabio =  jp_pisces_trd + jp_cfc_trd + jp_c14b_trd + jp_my_trc_trd
-   
-   !  1D configuration ("key_c1d")
-   ! -----------------
-# if defined key_c1d
-   LOGICAL, PUBLIC, PARAMETER ::   lk_trc_c1d   = .TRUE.   !: 1D pass. tracer configuration flag
-# else   
-   LOGICAL, PUBLIC, PARAMETER ::   lk_trc_c1d   = .FALSE.  !: 1D pass. tracer configuration flag
-# endif
+   INTEGER, PUBLIC             :: jptra           !: Total number of passive tracers
+   INTEGER, PUBLIC             :: jp_pisces       !: number of passive tracers in PISCES model
+   INTEGER, PUBLIC             :: jp_cfc          !: number of CFC passive tracers 
+   INTEGER, PUBLIC             :: jp_my_trc       !: number of passive tracers in MY_TRC model
+   INTEGER, PUBLIC             :: jp_bgc          !: number of passive tracers for the BGC model
 
-   REAL(wp), PUBLIC  :: rtrn  = 0.5 * EPSILON( 1.e0 )    !: truncation value
+   INTEGER, PUBLIC             :: jp_dia3d        !: number of 3D diagnostic variables
+   INTEGER, PUBLIC             :: jp_dia2d        !: number of 2D diagnostic variables
 
-   !!----------------------------------------------------------------------
-   !! NEMO/TOP 3.3 , NEMO Consortium (2010)
-   !! $Id$ 
-   !! Software governed by the CeCILL licence (NEMOGCM/NEMO_CeCILL.txt)
-   !!======================================================================
+   LOGICAL, PUBLIC             :: ln_pisces       !: PISCES flag 
+   LOGICAL, PUBLIC             :: ln_age          !: AGE flag 
+   LOGICAL, PUBLIC             :: ln_cfc11        !: CFC11 flag 
+   LOGICAL, PUBLIC             :: ln_cfc12        !: CFC12 flag 
+   LOGICAL, PUBLIC             :: ln_sf6          !: SF6 flag 
+   LOGICAL, PUBLIC             :: ll_cfc          !: CFC flag 
+   LOGICAL, PUBLIC             :: ln_c14          !: C14 flag 
+   LOGICAL, PUBLIC             :: ln_my_trc       !: MY_TRC flag 
+
+   REAL(wp), PUBLIC            :: rtrn  = 0.5 * EPSILON( 1.e0 )    !: truncation value
+
 END MODULE par_trc
Index: branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/NEMO/TOP_SRC/prtctl_trc.F90
===================================================================
--- branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/NEMO/TOP_SRC/prtctl_trc.F90	(revision 7383)
+++ branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/NEMO/TOP_SRC/prtctl_trc.F90	(revision 7391)
@@ -70,5 +70,5 @@
       INTEGER  ::   overlap, jn, js, sind, eind, kdir, j_id
       REAL(wp) ::   zsum, zvctl
-      CHARACTER (len=20), DIMENSION(jptra) ::   cl
+      CHARACTER (len=20), ALLOCATABLE, DIMENSION(:) ::   cl
       CHARACTER (len=10) ::   cl2
       REAL(wp), POINTER, DIMENSION(:,:,:)  :: zmask, ztab3d 
@@ -76,4 +76,5 @@
 
       CALL wrk_alloc( jpi, jpj, jpk, zmask, ztab3d )
+      ALLOCATE( cl(jptra) )
       !                                      ! Arrays, scalars initialization 
       overlap       = 0
@@ -152,4 +153,5 @@
       !
       CALL wrk_dealloc( jpi, jpj, jpk, zmask, ztab3d )
+      DEALLOCATE( cl )
       !
    END SUBROUTINE prt_ctl_trc
Index: branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/NEMO/TOP_SRC/trc.F90
===================================================================
--- branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/NEMO/TOP_SRC/trc.F90	(revision 7383)
+++ branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/NEMO/TOP_SRC/trc.F90	(revision 7391)
@@ -28,4 +28,7 @@
    INTEGER, PUBLIC                                                 ::   numnat_cfg = -1   !: logical unit for the reference passive tracer namelist_top_cfg
    INTEGER, PUBLIC                                                 ::   numont     = -1   !: logical unit for the reference passive tracer namelist output output.namelist.top
+   INTEGER, PUBLIC                                                 ::   numtrc_ref = -1   !: logical unit for the reference passive tracer namelist_top_ref
+   INTEGER, PUBLIC                                                 ::   numtrc_cfg = -1   !: logical unit for the reference passive tracer namelist_top_cfg
+   INTEGER, PUBLIC                                                 ::   numonr     = -1   !: logical unit for the reference passive tracer namelist output output.namelist.top
    INTEGER, PUBLIC                                                 ::   numstr        !: logical unit for tracer statistics
    INTEGER, PUBLIC                                                 ::   numrtr        !: logical unit for trc restart (read )
@@ -68,9 +71,10 @@
    CHARACTER(len = 256), PUBLIC                                    ::  cn_trcrst_outdir  !: restart output directory
    REAL(wp)            , PUBLIC                                    ::  rdttrc         !: passive tracer time step
-   LOGICAL             , PUBLIC                                    ::  ln_top_euler  !: boolean term for euler integration 
+   REAL(wp)            , PUBLIC                                    ::  r2dttrc        !: = 2*rdttrc except at nit000 (=rdttrc) if neuler=0
+   LOGICAL             , PUBLIC                                    ::  ln_top_euler   !: boolean term for euler integration 
    LOGICAL             , PUBLIC                                    ::  ln_trcdta      !: Read inputs data from files
    LOGICAL             , PUBLIC                                    ::  ln_trcdmp      !: internal damping flag
    LOGICAL             , PUBLIC                                    ::  ln_trcdmp_clo  !: internal damping flag on closed seas
-   INTEGER             , PUBLIC                                    ::  nittrc000       !: first time step of passive tracers model
+   INTEGER             , PUBLIC                                    ::  nittrc000      !: first time step of passive tracers model
    LOGICAL             , PUBLIC                                    ::  l_trcdm2dc     !: Diurnal cycle for TOP
 
@@ -83,7 +87,8 @@
    END TYPE
 
-   REAL(wp), DIMENSION(jptra), PUBLIC         :: trc_ice_ratio, & ! ice-ocean tracer ratio
-                                                 trc_ice_prescr   ! prescribed ice trc cc
-   CHARACTER(len=2), DIMENSION(jptra), PUBLIC :: cn_trc_o ! choice of ocean tracer cc
+   REAL(wp)        , PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:)  :: trc_ice_ratio      ! ice-ocean tracer ratio
+   REAL(wp)        , PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:)  :: trc_ice_prescr     ! prescribed ice trc cc
+   CHARACTER(len=2), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:)  :: cn_trc_o ! choice of ocean tracer cc
+
 
    !! information for outputs
@@ -94,15 +99,12 @@
        CHARACTER(len = 20)  :: clunit   !: unit
        LOGICAL              :: llinit   !: read in a file or not
-#if defined  key_my_trc
        LOGICAL              :: llsbc   !: read in a file or not
        LOGICAL              :: llcbc   !: read in a file or not
        LOGICAL              :: llobc   !: read in a file or not
-#endif
-       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_wri     !: save the tracer or not
 
    TYPE, PUBLIC :: DIAG                                                               !: passive trcacer ddditional diagnostic type
@@ -112,32 +114,16 @@
    END TYPE DIAG
 
+   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:,:)         ::  trc3d          !: 3D diagnostics for tracers
+   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:,:)         ::  trc2d          !: 2D diagnostics for tracers
+
    !! information for inputs
    !! --------------------------------------------------
-   LOGICAL            , PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:)    ::  ln_trc_ini     !: Initialisation from data input file
-   LOGICAL            , PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:)    ::  ln_trc_obc     !: Use open boundary condition data
-   LOGICAL            , PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:)    ::  ln_trc_sbc     !: Use surface boundary condition data
-   LOGICAL            , PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:)    ::  ln_trc_cbc     !: Use coastal boundary condition data
-
-   !! additional 2D/3D outputs namelist
-   !! --------------------------------------------------
-   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
-
-   !! Biological trends
-   !! -----------------
-   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
+   LOGICAL , PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:)    ::  ln_trc_ini     !: Initialisation from data input file
+   LOGICAL , PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:)    ::  ln_trc_obc     !: Use open boundary condition data
+   LOGICAL , PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:)    ::  ln_trc_sbc     !: Use surface boundary condition data
+   LOGICAL , PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:)    ::  ln_trc_cbc     !: Use coastal boundary condition data
+   LOGICAL , PUBLIC                                     ::  ln_rnf_ctl     !: remove runoff dilution on tracers
+   REAL(wp), PUBLIC                                     ::  rn_bc_time     !: Time scaling factor for SBC and CBC data (seconds in a day)
+
 
    !! variables to average over physics over passive tracer sub-steps.
@@ -211,4 +197,7 @@
       USE lib_mpp, ONLY: ctl_warn
       !!-------------------------------------------------------------------
+      INTEGER :: ierr(3)
+      !!-------------------------------------------------------------------
+      ierr(:) = 0
       !
       ALLOCATE( trn(jpi,jpj,jpk,jptra), trb(jpi,jpj,jpk,jptra), tra(jpi,jpj,jpk,jptra),       &  
@@ -216,17 +205,21 @@
          &      gtru (jpi,jpj,jptra)  , gtrv (jpi,jpj,jptra)                          ,       &
          &      gtrui(jpi,jpj,jptra)  , gtrvi(jpi,jpj,jptra)                          ,       &
+         &      trc_ice_ratio(jptra)  , trc_ice_prescr(jptra) , cn_trc_o(jptra)       ,       &
          &      sbc_trc_b(jpi,jpj,jptra), sbc_trc(jpi,jpj,jptra)                      ,       &  
-         &      cvol(jpi,jpj,jpk)     , trai(jptra)                                   ,       &
-         &      ctrcnm(jptra)         , ctrcln(jptra)         , ctrcun(jptra)         ,       & 
-         &      ln_trc_ini(jptra)     , ln_trc_wri(jptra)     , qsr_mean(jpi,jpj)     ,       &
-#if defined key_my_trc
+         &      cvol(jpi,jpj,jpk)     , trai(jptra)           , qsr_mean(jpi,jpj)     ,       &
+         &      ctrcnm(jptra)         , ctrcln(jptra)         , ctrcun(jptra)         ,       &
+         &      ln_trc_ini(jptra)     ,                                                       &
          &      ln_trc_sbc(jptra)     , ln_trc_cbc(jptra)     , ln_trc_obc(jptra)     ,       &
-#endif
 #if defined key_bdy
          &      cn_trc_dflt(nb_bdy)   , cn_trc(nb_bdy)        , nn_trcdmp_bdy(nb_bdy) ,       &
          &      trcdta_bdy(jptra,nb_bdy)                                              ,       &
 #endif
-         &      STAT = trc_alloc  )
-
+         &      STAT = ierr(1)  )
+      !
+      IF (jp_dia3d > 0 ) ALLOCATE( trc3d(jpi,jpj,jpk,jp_dia3d), STAT = ierr(2) )
+      !
+      IF (jp_dia2d > 0 ) ALLOCATE( trc2d(jpi,jpj,jpk,jp_dia2d), STAT = ierr(3) )
+      ! 
+      trc_alloc = MAXVAL( ierr )
       IF( trc_alloc /= 0 )   CALL ctl_warn('trc_alloc: failed to allocate arrays')
       !
Index: branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/NEMO/TOP_SRC/trcbc.F90
===================================================================
--- branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/NEMO/TOP_SRC/trcbc.F90	(revision 7383)
+++ branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/NEMO/TOP_SRC/trcbc.F90	(revision 7391)
@@ -4,6 +4,7 @@
    !! TOP :  module for passive tracer boundary conditions
    !!=====================================================================
-   !! History :  3.5 !  2014-04  (M. Vichi, T. Lovato)  Original
-   !!            3.6 !  2015-03  (T . Lovato) Revision and BDY support
+   !! History :  3.5 !  2014 (M. Vichi, T. Lovato)  Original
+   !!            3.6 !  2015 (T . Lovato) Revision and BDY support
+   !!            4.0 !  2016 (T . Lovato) Include application of sbc and cbc
    !!----------------------------------------------------------------------
 #if defined key_top
@@ -11,5 +12,5 @@
    !!   'key_top'                                                TOP model 
    !!----------------------------------------------------------------------
-   !!   trc_bc       : read and time interpolated tracer Boundary Conditions
+   !!   trc_bc       :  Apply tracer Boundary Conditions
    !!----------------------------------------------------------------------
    USE par_trc       !  passive tracers parameters
@@ -26,6 +27,6 @@
    PRIVATE
 
-   PUBLIC   trc_bc_init    ! called in trcini.F90 
-   PUBLIC   trc_bc_read    ! called in trcstp.F90 or within
+   PUBLIC   trc_bc         ! called in trcstp.F90 or within TOP modules
+   PUBLIC   trc_bc_ini     ! called in trcini.F90 
 
    INTEGER  , SAVE, PUBLIC                             :: nb_trcobc    ! number of tracers with open BC
@@ -43,6 +44,8 @@
    TYPE(MAP_POINTER), ALLOCATABLE, DIMENSION(:) :: nbmap_ptr   ! array of pointers to nbmap
 
-   !!----------------------------------------------------------------------
-   !! NEMO/OPA 3.6 , NEMO Consortium (2015)
+   !! * Substitutions
+#  include "vectopt_loop_substitute.h90"
+   !!----------------------------------------------------------------------
+   !! NEMO/TOP 4.0 , NEMO Consortium (2016)
    !! $Id$
    !! Software governed by the CeCILL licence     (NEMOGCM/NEMO_CeCILL.txt)
@@ -50,7 +53,7 @@
 CONTAINS
 
-   SUBROUTINE trc_bc_init( ntrc )
+   SUBROUTINE trc_bc_ini( ntrc )
       !!----------------------------------------------------------------------
-      !!                   ***  ROUTINE trc_bc_init  ***
+      !!                   ***  ROUTINE trc_bc_ini  ***
       !!                    
       !! ** Purpose :   initialisation of passive tracer BC data 
@@ -77,14 +80,15 @@
       REAL(wp)   , DIMENSION(jpmaxtrc) :: rn_trcfac    ! multiplicative factor for tracer values
       !!
-      NAMELIST/namtrc_bc/ cn_dir_sbc, cn_dir_cbc, cn_dir_obc, sn_trcobc, rn_trofac, sn_trcsbc, rn_trsfac, sn_trccbc, rn_trcfac
+      NAMELIST/namtrc_bc/ cn_dir_obc, sn_trcobc, rn_trofac, cn_dir_sbc, sn_trcsbc, rn_trsfac, & 
+                        & cn_dir_cbc, sn_trccbc, rn_trcfac, ln_rnf_ctl, rn_bc_time
 #if defined key_bdy
       NAMELIST/namtrc_bdy/ cn_trc_dflt, cn_trc, nn_trcdmp_bdy
 #endif
       !!----------------------------------------------------------------------
-      IF( nn_timing == 1 )  CALL timing_start('trc_bc_init')
+      IF( nn_timing == 1 )  CALL timing_start('trc_bc_ini')
       !
       IF( lwp ) THEN
          WRITE(numout,*) ' '
-         WRITE(numout,*) 'trc_bc_init : Tracers Boundary Conditions (BC)'
+         WRITE(numout,*) 'trc_bc_ini : Tracers Boundary Conditions (BC)'
          WRITE(numout,*) '~~~~~~~~~~~ '
       ENDIF
@@ -93,5 +97,5 @@
       ALLOCATE( slf_i(ntrc), STAT=ierr0 )
       IF( ierr0 > 0 ) THEN
-         CALL ctl_stop( 'trc_bc_init: unable to allocate local slf_i' )   ;   RETURN
+         CALL ctl_stop( 'trc_bc_ini: unable to allocate local slf_i' )   ;   RETURN
       ENDIF
 
@@ -99,5 +103,5 @@
       ALLOCATE( n_trc_indobc(ntrc), STAT=ierr0 )
       IF( ierr0 > 0 ) THEN
-         CALL ctl_stop( 'trc_bc_init: unable to allocate n_trc_indobc' )   ;   RETURN
+         CALL ctl_stop( 'trc_bc_ini: unable to allocate n_trc_indobc' )   ;   RETURN
       ENDIF
       nb_trcobc      = 0
@@ -106,5 +110,5 @@
       ALLOCATE( n_trc_indsbc(ntrc), STAT=ierr0 )
       IF( ierr0 > 0 ) THEN
-         CALL ctl_stop( 'trc_bc_init: unable to allocate n_trc_indsbc' )   ;   RETURN
+         CALL ctl_stop( 'trc_bc_ini: unable to allocate n_trc_indsbc' )   ;   RETURN
       ENDIF
       nb_trcsbc      = 0
@@ -113,5 +117,5 @@
       ALLOCATE( n_trc_indcbc(ntrc), STAT=ierr0 )
       IF( ierr0 > 0 ) THEN
-         CALL ctl_stop( 'trc_bc_init: unable to allocate n_trc_indcbc' )   ;   RETURN
+         CALL ctl_stop( 'trc_bc_ini: unable to allocate n_trc_indcbc' )   ;   RETURN
       ENDIF
       nb_trccbc      = 0
@@ -140,5 +144,5 @@
       DO jn = 1, ntrc
          DO ib = 1, nb_bdy
-            ! Set type of obc in BDY data structure (around here we may plug user override of obc type from nml)
+            ! Set type of obc in BDY data structure (TL: around here we may plug user override of obc type from nml)
             IF ( ln_trc_obc(jn) ) THEN
                trcdta_bdy(jn,ib)%cn_obc = TRIM( cn_trc(ib) )
@@ -195,5 +199,6 @@
          ENDIF
          WRITE(numout,'(2a)') '   COASTAL BC data repository : ', TRIM(cn_dir_cbc)
-
+         IF ( .NOT. ln_rnf ) ln_rnf_ctl = .FALSE.
+         IF ( ln_rnf_ctl )  WRITE(numout,'(a)') ' -> Remove runoff dilution effect on tracers with absent river load (ln_rnf_ctl = .TRUE.)' 
          WRITE(numout,*) ' '
          WRITE(numout,'(a,i3)') '   Total tracers to be initialized with OPEN BCs data:', nb_trcobc
@@ -230,5 +235,5 @@
          ALLOCATE ( sf_trcobc(nb_trcobc), rf_trofac(nb_trcobc), nbmap_ptr(nb_trcobc), STAT=ierr1 )
          IF( ierr1 > 0 ) THEN
-            CALL ctl_stop( 'trc_bc_init: unable to allocate sf_trcobc structure' )   ;   RETURN
+            CALL ctl_stop( 'trc_bc_ini: unable to allocate sf_trcobc structure' )   ;   RETURN
          ENDIF
 
@@ -248,5 +253,5 @@
                   IF( sn_trcobc(jn)%ln_tint )  ALLOCATE( sf_trcobc(jl)%fdta(nblen,1,jpk,2) , STAT=ierr3 )
                   IF( ierr2 + ierr3 > 0 ) THEN
-                    CALL ctl_stop( 'trc_bc_init : unable to allocate passive tracer OBC data arrays' )   ;   RETURN
+                    CALL ctl_stop( 'trc_bc_ini : unable to allocate passive tracer OBC data arrays' )   ;   RETURN
                   ENDIF
                   trcdta_bdy(jn,ib)%trc => sf_trcobc(jl)%fnow(:,1,:)
@@ -270,5 +275,5 @@
          ENDDO
 
-         CALL fld_fill( sf_trcobc, slf_i, cn_dir_obc, 'trc_bc_init', 'Passive tracer OBC data', 'namtrc_bc' )
+         CALL fld_fill( sf_trcobc, slf_i, cn_dir_obc, 'trc_bc_ini', 'Passive tracer OBC data', 'namtrc_bc' )
       ENDIF
 #endif
@@ -277,5 +282,5 @@
          ALLOCATE( sf_trcsbc(nb_trcsbc), rf_trsfac(nb_trcsbc), STAT=ierr1 )
          IF( ierr1 > 0 ) THEN
-            CALL ctl_stop( 'trc_bc_init: unable to allocate  sf_trcsbc structure' )   ;   RETURN
+            CALL ctl_stop( 'trc_bc_ini: unable to allocate  sf_trcsbc structure' )   ;   RETURN
          ENDIF
          !
@@ -288,5 +293,5 @@
                IF( sn_trcsbc(jn)%ln_tint )  ALLOCATE( sf_trcsbc(jl)%fdta(jpi,jpj,1,2) , STAT=ierr3 )
                IF( ierr2 + ierr3 > 0 ) THEN
-                 CALL ctl_stop( 'trc_bc_init : unable to allocate passive tracer SBC data arrays' )   ;   RETURN
+                 CALL ctl_stop( 'trc_bc_ini : unable to allocate passive tracer SBC data arrays' )   ;   RETURN
                ENDIF
             ENDIF
@@ -294,5 +299,5 @@
          ENDDO
          !                         ! fill sf_trcsbc with slf_i and control print
-         CALL fld_fill( sf_trcsbc, slf_i, cn_dir_sbc, 'trc_bc_init', 'Passive tracer SBC data', 'namtrc_bc' )
+         CALL fld_fill( sf_trcsbc, slf_i, cn_dir_sbc, 'trc_bc_ini', 'Passive tracer SBC data', 'namtrc_bc' )
          !
       ENDIF
@@ -319,21 +324,22 @@
          ENDDO
          !                         ! fill sf_trccbc with slf_i and control print
-         CALL fld_fill( sf_trccbc, slf_i, cn_dir_cbc, 'trc_bc_init', 'Passive tracer CBC data', 'namtrc_bc' )
+         CALL fld_fill( sf_trccbc, slf_i, cn_dir_cbc, 'trc_bc_ini', 'Passive tracer CBC data', 'namtrc_bc' )
          !
       ENDIF
       !
       DEALLOCATE( slf_i )          ! deallocate local field structure
-      IF( nn_timing == 1 )  CALL timing_stop('trc_bc_init')
-      !
-   END SUBROUTINE trc_bc_init
-
-
-   SUBROUTINE trc_bc_read(kt, jit)
+      IF( nn_timing == 1 )  CALL timing_stop('trc_bc_ini')
+      !
+   END SUBROUTINE trc_bc_ini
+
+
+   SUBROUTINE trc_bc(kt, jit)
       !!----------------------------------------------------------------------
-      !!                   ***  ROUTINE trc_bc_init  ***
+      !!                   ***  ROUTINE trc_bc  ***
       !!
-      !! ** Purpose :  Read passive tracer Boundary Conditions data
+      !! ** Purpose :  Apply Boundary Conditions data to tracers
       !!
-      !! ** Method  :  Read BC inputs and update data structures using fldread
+      !! ** Method  :  1) Read BC inputs and update data structures using fldread
+      !!               2) Apply Boundary Conditions to tracers
       !!              
       !!----------------------------------------------------------------------
@@ -341,16 +347,20 @@
       
       !! * Arguments
-      INTEGER, INTENT( in ) ::   kt      ! ocean time-step index
+      INTEGER, INTENT( in ) ::   kt              ! ocean time-step index
       INTEGER, INTENT( in ), OPTIONAL ::   jit   ! subcycle time-step index (for timesplitting option)
+      !!
+      INTEGER  :: ji, jj, jk, jn, jl             ! Loop index
+      REAL(wp) :: zfact, zrnf
       !!---------------------------------------------------------------------
       !
-      IF( nn_timing == 1 )  CALL timing_start('trc_bc_read')
+      IF( nn_timing == 1 )  CALL timing_start('trc_bc')
 
       IF( kt == nit000 .AND. lwp) THEN
          WRITE(numout,*)
-         WRITE(numout,*) 'trc_bc_read : Surface boundary conditions for passive tracers.'
+         WRITE(numout,*) 'trc_bc : Surface boundary conditions for passive tracers.'
          WRITE(numout,*) '~~~~~~~~~~~ '
       ENDIF
 
+      ! 1. Update Boundary conditions data
       IF ( PRESENT(jit) ) THEN 
 
@@ -395,8 +405,52 @@
       ENDIF
 
-      !
-      IF( nn_timing == 1 )  CALL timing_stop('trc_bc_read')
-      !
-   END SUBROUTINE trc_bc_read
+      ! 2. Apply Boundary conditions data
+      ! 
+      DO jn = 1 , jptra
+         !
+         ! Remove river dilution for tracers with absent river load
+         IF ( ln_rnf_ctl .AND. .NOT. ln_trc_cbc(jn) ) THEN
+            DO jj = 2, jpj
+               DO ji = fs_2, fs_jpim1
+                  DO jk = 1, nk_rnf(ji,jj)
+                     zrnf = (rnf(ji,jj) + rnf_b(ji,jj)) * 0.5_wp * r1_rau0 / h_rnf(ji,jj)
+                     tra(ji,jj,jk,jn) = tra(ji,jj,jk,jn)  + (trn(ji,jj,jk,jn) * zrnf)
+                  ENDDO
+               ENDDO
+            ENDDO
+         ENDIF
+          
+         ! OPEN boundary conditions: trcbdy is called in trcnxt !
+
+         ! SURFACE boundary conditions
+         IF (ln_trc_sbc(jn)) THEN
+            jl = n_trc_indsbc(jn)
+            DO jj = 2, jpj
+               DO ji = fs_2, fs_jpim1   ! vector opt.
+                  zfact = 1. / ( e3t_n(ji,jj,1) * rn_bc_time )
+                  tra(ji,jj,1,jn) = tra(ji,jj,1,jn) + rf_trsfac(jl) * sf_trcsbc(jl)%fnow(ji,jj,1) * zfact
+               END DO
+            END DO
+         END IF
+
+         ! COASTAL boundary conditions
+         IF ( ln_rnf .AND. ln_trc_cbc(jn)) THEN
+            jl = n_trc_indcbc(jn)
+            DO jj = 2, jpj
+               DO ji = fs_2, fs_jpim1   ! vector opt.
+                  DO jk = 1, nk_rnf(ji,jj)
+                     zfact = rn_rfact / ( e1e2t(ji,jj) * h_rnf(ji,jj) * rn_bc_time ) 
+                     tra(ji,jj,jk,jn) = tra(ji,jj,jk,jn) + rf_trcfac(jl) * sf_trccbc(jl)%fnow(ji,jj,1) * zfact
+                  ENDDO
+               END DO
+            END DO
+         END IF
+         !                                                       ! ===========
+      END DO                                                     ! tracer loop
+      !                                                          ! ===========
+      !
+      IF( nn_timing == 1 )  CALL timing_stop('trc_bc')
+      !
+   END SUBROUTINE trc_bc
 
 #else
@@ -406,12 +460,12 @@
 CONTAINS
 
-   SUBROUTINE trc_bc_init( ntrc )        ! Empty routine
+   SUBROUTINE trc_bc_ini( ntrc )        ! Empty routine
       INTEGER,INTENT(IN) :: ntrc                           ! number of tracers
-      WRITE(*,*) 'trc_bc_init: You should not have seen this print! error?', kt
-   END SUBROUTINE trc_bc_init
-
-   SUBROUTINE trc_bc_read( kt )        ! Empty routine
-      WRITE(*,*) 'trc_bc_read: You should not have seen this print! error?', kt
-   END SUBROUTINE trc_bc_read
+      WRITE(*,*) 'trc_bc_ini: You should not have seen this print! error?', kt
+   END SUBROUTINE trc_bc_ini
+
+   SUBROUTINE trc_bc( kt )        ! Empty routine
+      WRITE(*,*) 'trc_bc: You should not have seen this print! error?', kt
+   END SUBROUTINE trc_bc
 #endif
 
Index: branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/NEMO/TOP_SRC/trcdia.F90
===================================================================
--- branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/NEMO/TOP_SRC/trcdia.F90	(revision 7383)
+++ 	(revision )
@@ -1,488 +1,0 @@
-MODULE trcdia
-   !!======================================================================
-   !!                       *** MODULE trcdia ***
-   !! TOP :   Output of passive tracers
-   !!======================================================================
-   !! History :   OPA  !  1995-01 (M. Levy)  Original code
-   !!              -   !  1998-01 (C. Levy) NETCDF format using ioipsl interface
-   !!              -   !  1999-01 (M.A. Foujols) adapted for passive tracer
-   !!              -   !  1999-09 (M.A. Foujols) split into three parts
-   !!   NEMO      1.0  !  2005-03 (O. Aumont, A. El Moussaoui) F90
-   !!                  !  2008-05 (C. Ethe re-organization)
-   !!----------------------------------------------------------------------
-#if defined key_top 
-   !!----------------------------------------------------------------------
-   !!   'key_top'                                                TOP models
-   !!----------------------------------------------------------------------
-   !! trc_dia     : main routine of output passive tracer
-   !! trcdit_wr   : outputs of concentration fields
-   !! trcdii_wr   : outputs of additional 2D/3D diagnostics
-   !! trcdib_wr   : outputs of biological fields
-   !!----------------------------------------------------------------------
-   USE dom_oce         ! ocean space and time domain variables 
-   USE oce_trc
-   USE trc
-   USE par_trc
-   USE dianam    ! build name of file (routine)
-   USE ioipsl    ! I/O manager
-   USE iom       ! I/O manager
-   USE lib_mpp   ! MPP library
-
-   IMPLICIT NONE
-   PRIVATE
-
-   PUBLIC   trc_dia        ! called by XXX module 
-
-   INTEGER  ::   nit5      !: id for tracer output file
-   INTEGER  ::   ndepit5   !: id for depth mesh
-   INTEGER  ::   nhorit5   !: id for horizontal mesh
-   INTEGER  ::   ndimt50   !: number of ocean points in index array
-   INTEGER  ::   ndimt51   !: number of ocean points in index array
-   REAL(wp) ::   zjulian   !: ????   not DOCTOR !
-   INTEGER , ALLOCATABLE, SAVE, DIMENSION (:) ::   ndext50   !: integer arrays for ocean 3D index
-   INTEGER , ALLOCATABLE, SAVE, DIMENSION (:) ::   ndext51   !: integer arrays for ocean surface index
-
-   INTEGER  ::   nitd      !: id for additional array output file
-   INTEGER  ::   ndepitd   !: id for depth mesh
-   INTEGER  ::   nhoritd   !: id for horizontal mesh
-
-   INTEGER  ::   nitb        !:         id.         for additional array output file
-   INTEGER  ::   ndepitb   !:  id for depth mesh
-   INTEGER  ::   nhoritb   !:  id for horizontal mesh
-
-   !!----------------------------------------------------------------------
-   !! NEMO/TOP 3.3 , NEMO Consortium (2010)
-   !! $Id$ 
-   !! Software governed by the CeCILL licence     (NEMOGCM/NEMO_CeCILL.txt)
-   !!----------------------------------------------------------------------
-CONTAINS
-
-   SUBROUTINE trc_dia( kt )  
-      !!---------------------------------------------------------------------
-      !!                     ***  ROUTINE trc_dia  ***
-      !!
-      !! ** Purpose :   output passive tracers fields 
-      !!---------------------------------------------------------------------
-      INTEGER, INTENT(in) ::   kt    ! ocean time-step
-      !
-      INTEGER             ::  ierr   ! local integer
-      !!---------------------------------------------------------------------
-      !
-      IF( kt == nittrc000 )  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 )      ! outputs for tracer concentration
-         IF( ln_diatrc )  CALL trcdii_wr( kt )      ! outputs for additional arrays
-         IF( ln_diabio )  CALL trcdib_wr( kt )      ! outputs for biological trends
-      ENDIF
-      !
-   END SUBROUTINE trc_dia
-
-
-   SUBROUTINE trcdit_wr( kt )
-      !!----------------------------------------------------------------------
-      !!                     ***  ROUTINE trcdit_wr  ***
-      !!
-      !! ** Purpose :   Standard output of passive tracer : concentration fields
-      !!
-      !! ** Method  :   At the beginning of the first time step (nittrc000), define all
-      !!             the NETCDF files and fields for concentration of passive tracer
-      !!
-      !!        At each time step call histdef to compute the mean if necessary
-      !!        Each nwritetrc time step, output the instantaneous or mean fields
-      !!
-      !!----------------------------------------------------------------------
-      INTEGER, INTENT(in) ::   kt       ! ocean time-step
-      !
-      INTEGER ::   jn
-      LOGICAL ::   ll_print = .FALSE.
-      CHARACTER (len=40) :: clhstnam, clop
-      INTEGER ::   inum = 11             ! temporary logical unit
-      CHARACTER (len=20) :: cltra, cltrau
-      CHARACTER (len=80) :: cltral
-      REAL(wp) :: zsto, zout
-      INTEGER  :: iimi, iima, ijmi, ijma, ipk, it, itmod, iiter
-      !!----------------------------------------------------------------------
-
-      ! Initialisation
-      ! --------------
-
-      ! local variable for debugging
-      ll_print = .FALSE.                  ! change it to true for more control print
-      ll_print = ll_print .AND. lwp
-
-      ! Define frequency of output and means
-      IF( ln_mskland )   THEN   ;   clop = "only(x)"   ! put 1.e+20 on land (very expensive!!)
-      ELSE                      ;   clop = "x"         ! no use of the mask value (require less cpu time)
-      ENDIF
-# if defined key_diainstant
-      zsto = nn_writetrc * rdt
-      clop = "inst("//TRIM(clop)//")"
-# else
-      zsto = rdt
-      clop = "ave("//TRIM(clop)//")"
-# endif
-      zout = nn_writetrc * rdt
-
-      ! Define indices of the horizontal output zoom and vertical limit storage
-      iimi = 1      ;      iima = jpi
-      ijmi = 1      ;      ijma = jpj
-      ipk = jpk
-
-      ! define time axis
-      itmod = kt - nittrc000 + 1
-      it    = kt
-      iiter = ( nittrc000 - 1 ) / nn_dttrc
-
-      ! Define NETCDF files and fields at beginning of first time step
-      ! --------------------------------------------------------------
-
-      IF(ll_print)WRITE(numout,*)'trcdit_wr kt=',kt
-      
-      IF( kt == nittrc000 ) 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
-         CALL ymds2ju( nyear, nmonth, nday, rdt, zjulian )
-         zjulian = zjulian - adatrj   !   set calendar origin to the beginning of the experiment
-         IF(lwp)WRITE(numout,*)' '  
-         IF(lwp)WRITE(numout,*)' Date 0 used :', nittrc000                         &
-            &                 ,' YEAR ', nyear, ' MONTH ', nmonth, ' DAY ', nday   &
-            &                 ,'Julian day : ', zjulian  
-  
-         IF(lwp) WRITE(numout,*) ' indexes of zoom = ', iimi, iima, ijmi, ijma,  &
-            &                    ' limit storage in depth = ', ipk
-
-         IF( lk_offline .AND. lwp ) THEN
-            CALL dia_nam( clhstnam, nn_writetrc,' ' )
-            CALL ctl_opn( inum, 'date.file', 'REPLACE', 'FORMATTED', 'SEQUENTIAL', 1, numout, lwp, narea )
-            WRITE(inum,*) clhstnam
-            CLOSE(inum)
-         ENDIF
-
-         ! Define the NETCDF files for passive tracer concentration
-         CALL dia_nam( clhstnam, nn_writetrc, 'ptrc_T' )
-         IF(lwp)WRITE(numout,*)" Name of NETCDF file ", clhstnam
-
-         ! Horizontal grid : glamt and gphit
-         CALL histbeg( clhstnam, jpi, glamt, jpj, gphit,     &
-            &          iimi, iima-iimi+1, ijmi, ijma-ijmi+1,         & 
-            &          iiter, zjulian, rdt, nhorit5, nit5 , domain_id=nidom, snc4chunks=snc4set)
-
-         ! Vertical grid for tracer : gdept
-         CALL histvert( nit5, 'deptht', 'Vertical T levels', 'm', ipk, gdept_1d, ndepit5)
-
-         ! Index of ocean points in 3D and 2D (surface)
-         CALL wheneq( jpi*jpj*ipk, tmask, 1, 1., ndext50, ndimt50 )
-         CALL wheneq( jpi*jpj    , tmask, 1, 1., ndext51, ndimt51 )
-
-         ! Declare all the output fields as NETCDF variables
-         DO jn = 1, jptra
-            IF( ln_trc_wri(jn) ) THEN
-               cltra  = TRIM( ctrcnm(jn) )   ! short 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,  &
-                  &          ipk, 1, ipk,  ndepit5, 32, clop, zsto, zout ) 
-            ENDIF
-         END DO
-
-         ! end netcdf files header
-         CALL histend( nit5, snc4set )
-         IF(lwp) WRITE(numout,*)
-         IF(lwp) WRITE(numout,*) 'End of NetCDF Initialization in trcdit_wr'
-         IF( ll_print )   CALL FLUSH(numout )
-
-      ENDIF
-
-      ! Start writing the tracer concentrations
-      ! ---------------------------------------
-
-      IF( lwp .AND. MOD( itmod, nn_writetrc ) == 0 ) THEN
-         WRITE(numout,*) 'trcdit_wr : write NetCDF passive tracer concentrations at ', kt, 'time-step'
-         WRITE(numout,*) '~~~~~~~~~ '
-      ENDIF
-
-      DO jn = 1, jptra
-         cltra  = TRIM( ctrcnm(jn) )   ! short title for tracer
-         IF( ln_trc_wri(jn) ) CALL histwrite( nit5, cltra, it, trn(:,:,:,jn), ndimt50, ndext50 )
-      END DO
-
-      ! close the file 
-      ! --------------
-      IF( kt == nitend )   CALL histclo( nit5 )
-      !
-   END SUBROUTINE trcdit_wr
-
-   SUBROUTINE trcdii_wr( kt )
-      !!----------------------------------------------------------------------
-      !!                     ***  ROUTINE trcdii_wr  ***
-      !!
-      !! ** Purpose :   output of passive tracer : additional 2D and 3D arrays
-      !!
-      !! ** Method  :   At the beginning of the first time step (nittrc000), define all
-      !!             the NETCDF files and fields for concentration of passive tracer
-      !!
-      !!        At each time step call histdef to compute the mean if necessary
-      !!        Each nn_writedia time step, output the instantaneous or mean fields
-      !!
-      !!----------------------------------------------------------------------
-      INTEGER, INTENT(in) ::   kt       ! ocean time-step
-      !!
-      LOGICAL ::   ll_print = .FALSE.
-      CHARACTER (len=40) ::   clhstnam, clop
-      CHARACTER (len=20) ::   cltra, cltrau
-      CHARACTER (len=80) ::   cltral
-      INTEGER  ::   jl
-      INTEGER  ::   iimi, iima, ijmi, ijma, ipk, it, itmod, iiter
-      REAL(wp) ::   zsto, zout
-      !!----------------------------------------------------------------------
-
-      ! Initialisation
-      ! --------------
-      
-      ! local variable for debugging
-      ll_print = .FALSE.
-      ll_print = ll_print .AND. lwp
-      !
-      ! Define frequency of output and means
-      IF( ln_mskland )   THEN   ;   clop = "only(x)"   ! put 1.e+20 on land (very expensive!!)
-      ELSE                      ;   clop = "x"         ! no use of the mask value (require less cpu time)
-      ENDIF
-#  if defined key_diainstant
-      zsto = nn_writedia * rdt
-      clop = "inst("//TRIM(clop)//")"
-#  else
-      zsto = rdt
-      clop = "ave("//TRIM(clop)//")"
-#  endif
-      zout = nn_writedia * rdt
-
-      ! Define indices of the horizontal output zoom and vertical limit storage
-      iimi = 1      ;      iima = jpi
-      ijmi = 1      ;      ijma = jpj
-      ipk = jpk
-
-      ! define time axis
-      itmod = kt - nittrc000 + 1
-      it    = kt
-      iiter = ( nittrc000 - 1 ) / nn_dttrc
-
-      ! 1. Define NETCDF files and fields at beginning of first time step
-      ! -----------------------------------------------------------------
-
-      IF( ll_print ) WRITE(numout,*) 'trcdii_wr kt=', kt
-
-      IF( kt == nittrc000 ) THEN
-
-         ! Define the NETCDF files for additional arrays : 2D or 3D
-
-         ! Define the T grid file for tracer auxiliary files
-
-         CALL dia_nam( clhstnam, nn_writedia, 'diad_T' )
-         IF(lwp) WRITE(numout,*) " Name of NETCDF file ", clhstnam
-
-         ! Define a netcdf FILE for 2d and 3d arrays
-
-         CALL histbeg( clhstnam, jpi, glamt, jpj, gphit,             &
-            &          iimi, iima-iimi+1, ijmi, ijma-ijmi+1,         &
-            &          iiter, zjulian, rdt, nhoritd, nitd , domain_id=nidom, snc4chunks=snc4set )
-
-         ! Vertical grid for 2d and 3d arrays
-
-         CALL histvert( nitd, 'deptht', 'Vertical T levels','m', ipk, gdept_1d, ndepitd)
-
-         ! Declare all the output fields as NETCDF variables
-
-         ! more 3D horizontal arrays
-         DO jl = 1, jpdia3d
-            cltra  = TRIM( ctrc3d(jl) )   ! short title for 3D diagnostic
-            cltral = TRIM( ctrc3l(jl) )  ! long title for 3D diagnostic
-            cltrau = TRIM( ctrc3u(jl) )  ! UNIT for 3D diagnostic
-            CALL histdef( nitd, cltra, cltral, cltrau, jpi, jpj, nhoritd,   &
-               &          ipk, 1, ipk,  ndepitd, 32, clop, zsto, zout )
-         END DO
-
-         ! more 2D horizontal arrays
-         DO jl = 1, jpdia2d
-            cltra  = TRIM( ctrc2d(jl) )   ! short title for 2D diagnostic
-            cltral = TRIM( ctrc2l(jl) )  ! long title for 2D diagnostic
-            cltrau = TRIM( ctrc2u(jl) )  ! UNIT for 2D diagnostic
-            CALL histdef( nitd, cltra, cltral, cltrau, jpi, jpj, nhoritd,  &
-               &          1, 1, 1,  -99, 32, clop, zsto, zout )
-         END DO
-
-         ! TODO: more 2D vertical sections arrays : I or J indice fixed
-
-         ! CLOSE netcdf Files
-         CALL histend( nitd, snc4set )
-
-         IF(lwp) WRITE(numout,*)
-         IF(lwp) WRITE(numout,*) 'End of NetCDF Initialization in trcdii_wr'
-         IF( ll_print )   CALL FLUSH(numout )
-         !
-      ENDIF
-
-      ! 2. Start writing data
-      ! ---------------------
-
-      IF( lwp .AND. MOD( itmod, nn_writedia ) == 0 ) THEN
-         WRITE(numout,*) 'trcdii_wr : write NetCDF additional arrays at ', kt, 'time-step'
-         WRITE(numout,*) '~~~~~~ '
-      ENDIF
-
-      ! more 3D horizontal arrays
-      DO jl = 1, jpdia3d
-         cltra  = TRIM( ctrc3d(jl) )   ! short title for 3D diagnostic
-         CALL histwrite( nitd, cltra, it, trc3d(:,:,:,jl), ndimt50 ,ndext50)
-      END DO
-
-      ! more 2D horizontal arrays
-      DO jl = 1, jpdia2d
-         cltra  = TRIM( ctrc2d(jl) )   ! short title for 2D diagnostic
-         CALL histwrite(nitd, cltra, it, trc2d(:,:,jl), ndimt51  ,ndext51)
-      END DO
-
-      ! Closing all files
-      ! -----------------
-      IF( kt == nitend )   CALL histclo(nitd)
-      !
-
-   END SUBROUTINE trcdii_wr
-
-   SUBROUTINE trcdib_wr( kt )
-      !!----------------------------------------------------------------------
-      !!                     ***  ROUTINE trcdib_wr  ***
-      !!
-      !! ** Purpose :   output of passive tracer : biological fields
-      !!
-      !! ** Method  :   At the beginning of the first time step (nittrc000), define all
-      !!             the NETCDF files and fields for concentration of passive tracer
-      !!
-      !!        At each time step call histdef to compute the mean if necessary
-      !!        Each nn_writebio time step, output the instantaneous or mean fields
-      !!
-      !!----------------------------------------------------------------------
-      INTEGER, INTENT( in ) ::   kt          ! ocean time-step
-      !!
-      LOGICAL ::   ll_print = .FALSE.
-      CHARACTER (len=40) ::   clhstnam, clop
-      CHARACTER (len=20) ::   cltra, cltrau
-      CHARACTER (len=80) ::   cltral
-      INTEGER  ::   ji, jj, jk, jl
-      INTEGER  ::   iimi, iima, ijmi, ijma, ipk, it, itmod, iiter
-      REAL(wp) ::   zsto, zout
-      !!----------------------------------------------------------------------
-
-      ! Initialisation
-      ! --------------
-      
-      ! local variable for debugging
-      ll_print = .FALSE.
-      ll_print = ll_print .AND. lwp
-
-      ! Define frequency of output and means
-      IF( ln_mskland )   THEN   ;   clop = "only(x)"   ! put 1.e+20 on land (very expensive!!)
-      ELSE                      ;   clop = "x"         ! no use of the mask value (require less cpu time)
-      ENDIF
-#        if defined key_diainstant
-      zsto = nn_writebio * rdt
-      clop = "inst("//TRIM(clop)//")"
-#        else
-      zsto = rdt
-      clop = "ave("//TRIM(clop)//")"
-#        endif
-      zout = nn_writebio * rdt
-
-      ! Define indices of the horizontal output zoom and vertical limit storage
-      iimi = 1      ;      iima = jpi
-      ijmi = 1      ;      ijma = jpj
-      ipk = jpk
-
-      ! define time axis
-      itmod = kt - nittrc000 + 1
-      it    = kt
-      iiter = ( nittrc000 - 1 ) / nn_dttrc
-
-      ! Define NETCDF files and fields at beginning of first time step
-      ! --------------------------------------------------------------
-
-      IF(ll_print) WRITE(numout,*)'trcdib_wr kt=',kt
-
-      IF( kt == nittrc000 ) THEN
-
-         ! Define the NETCDF files for biological trends
-
-         CALL dia_nam(clhstnam,nn_writebio,'biolog')
-         IF(lwp)WRITE(numout,*) " Name of NETCDF file for biological trends ", clhstnam
-         ! Horizontal grid : glamt and gphit
-         CALL histbeg( clhstnam, jpi, glamt, jpj, gphit,      &
-            &    iimi, iima-iimi+1, ijmi, ijma-ijmi+1,          &
-            &    iiter, zjulian, rdt, nhoritb, nitb , domain_id=nidom, snc4chunks=snc4set )
-         ! Vertical grid for biological trends
-         CALL histvert(nitb, 'deptht', 'Vertical T levels', 'm', ipk, gdept_1d, ndepitb)
-
-         ! Declare all the output fields as NETCDF variables
-         ! biological trends
-         DO jl = 1, jpdiabio
-            cltra  = TRIM( ctrbio(jl) )   ! short title for biological diagnostic
-            cltral = TRIM( ctrbil(jl) )  ! long title for biological diagnostic
-            cltrau = TRIM( ctrbiu(jl) )  ! UNIT for biological diagnostic
-            CALL histdef( nitb, cltra, cltral, cltrau, jpi, jpj, nhoritb,  &
-               &         ipk, 1, ipk,  ndepitb, 32, clop, zsto, zout)
-         END DO
-
-         ! CLOSE netcdf Files
-          CALL histend( nitb, snc4set )
-
-         IF(lwp) WRITE(numout,*)
-         IF(lwp) WRITE(numout,*) 'End of NetCDF Initialization in trcdib_wr'
-         IF(ll_print) CALL FLUSH(numout )
-         !
-      ENDIF
-
-      ! Start writing data
-      ! ------------------
-
-      ! biological trends
-      IF( lwp .AND. MOD( itmod, nn_writebio ) == 0 ) THEN
-         WRITE(numout,*) 'trcdit_wr : write NetCDF biological trends at ', kt, 'time-step'
-         WRITE(numout,*) '~~~~~~ '
-      ENDIF
-
-      DO jl = 1, jpdiabio
-         cltra  = TRIM( ctrbio(jl) )   ! short title for biological diagnostic
-         CALL histwrite(nitb, cltra, it, trbio(:,:,:,jl), ndimt50,ndext50)
-      END DO
-
-      ! Closing all files
-      ! -----------------
-      IF( kt == nitend )   CALL histclo( nitb )
-      !
-   END SUBROUTINE trcdib_wr
-
-#else
-   !!----------------------------------------------------------------------
-   !!  Dummy module :                                     No passive tracer
-   !!----------------------------------------------------------------------
-CONTAINS
-   SUBROUTINE trc_dia( kt )                      ! Empty routine   
-      INTEGER, INTENT(in) :: kt
-   END SUBROUTINE trc_dia   
-#endif
-
-   !!======================================================================
-END MODULE trcdia
Index: branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/NEMO/TOP_SRC/trcdta.F90
===================================================================
--- branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/NEMO/TOP_SRC/trcdta.F90	(revision 7383)
+++ branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/NEMO/TOP_SRC/trcdta.F90	(revision 7391)
@@ -9,5 +9,5 @@
    !!            3.4   !  2010-11  (C. Ethe, G. Madec)  use of fldread + dynamical allocation 
    !!            3.5   !  2013-08  (M. Vichi)  generalization for other BGC models
-   !!            3.6   !  2015-03  (T. Lovato) revision of code log info
+   !!            3.6   !  2015-03  (T. Lovato) revisit code I/O
    !!----------------------------------------------------------------------
 #if defined key_top 
@@ -28,5 +28,5 @@
 
    PUBLIC   trc_dta         ! called in trcini.F90 and trcdmp.F90
-   PUBLIC   trc_dta_init    ! called in trcini.F90 
+   PUBLIC   trc_dta_ini     ! called in trcini.F90 
 
    INTEGER  , SAVE, PUBLIC                             :: nb_trcdta   ! number of tracers to be initialised with data
@@ -45,7 +45,7 @@
 CONTAINS
 
-   SUBROUTINE trc_dta_init(ntrc)
-      !!----------------------------------------------------------------------
-      !!                   ***  ROUTINE trc_dta_init  ***
+   SUBROUTINE trc_dta_ini(ntrc)
+      !!----------------------------------------------------------------------
+      !!                   ***  ROUTINE trc_dta_ini  ***
       !!                    
       !! ** Purpose :   initialisation of passive tracer input data 
@@ -70,9 +70,9 @@
       !!----------------------------------------------------------------------
       !
-      IF( nn_timing == 1 )  CALL timing_start('trc_dta_init')
+      IF( nn_timing == 1 )  CALL timing_start('trc_dta_ini')
       !
       IF( lwp ) THEN
          WRITE(numout,*) ' '
-         WRITE(numout,*) '  trc_dta_init : Tracers Initial Conditions (IC)'
+         WRITE(numout,*) '  trc_dta_ini : Tracers Initial Conditions (IC)'
          WRITE(numout,*) '  ~~~~~~~~~~~ '
       ENDIF
@@ -83,5 +83,5 @@
       ALLOCATE( n_trc_index(ntrc), slf_i(ntrc), STAT=ierr0 )
       IF( ierr0 > 0 ) THEN
-         CALL ctl_stop( 'trc_dta_init: unable to allocate n_trc_index' )   ;   RETURN
+         CALL ctl_stop( 'trc_dta_ini: unable to allocate n_trc_index' )   ;   RETURN
       ENDIF
       nb_trcdta      = 0
@@ -103,9 +103,9 @@
       REWIND( numnat_ref )              ! Namelist namtrc_dta in reference namelist : Passive tracer input data
       READ  ( numnat_ref, namtrc_dta, IOSTAT = ios, ERR = 901)
-901   IF( ios /= 0 ) CALL ctl_nam ( ios , 'namtrc_dta_init in reference namelist', lwp )
+901   IF( ios /= 0 ) CALL ctl_nam ( ios , 'namtrc_dta_ini in reference namelist', lwp )
 
       REWIND( numnat_cfg )              ! Namelist namtrc_dta in configuration namelist : Passive tracer input data
       READ  ( numnat_cfg, namtrc_dta, IOSTAT = ios, ERR = 902 )
-902   IF( ios /= 0 ) CALL ctl_nam ( ios , 'namtrc_dta_init in configuration namelist', lwp )
+902   IF( ios /= 0 ) CALL ctl_nam ( ios , 'namtrc_dta_ini in configuration namelist', lwp )
       IF(lwm) WRITE ( numont, namtrc_dta )
 
@@ -118,5 +118,5 @@
                zfact  = rn_trfac(jn)
                IF( clndta /=  clntrc ) THEN 
-                  CALL ctl_warn( 'trc_dta_init: passive tracer data initialisation    ',   &
+                  CALL ctl_warn( 'trc_dta_ini: passive tracer data initialisation    ',   &
                   &              'Input name of data file : '//TRIM(clndta)//   &
                   &              ' differs from that of tracer : '//TRIM(clntrc)//' ')
@@ -132,5 +132,5 @@
          ALLOCATE( sf_trcdta(nb_trcdta), rf_trfac(nb_trcdta), STAT=ierr1 )
          IF( ierr1 > 0 ) THEN
-            CALL ctl_stop( 'trc_dta_init: unable to allocate  sf_trcdta structure' )   ;   RETURN
+            CALL ctl_stop( 'trc_dta_ini: unable to allocate  sf_trcdta structure' )   ;   RETURN
          ENDIF
          !
@@ -143,5 +143,5 @@
                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_init : unable to allocate passive tracer data arrays' )   ;   RETURN
+                 CALL ctl_stop( 'trc_dta_ini : unable to allocate passive tracer data arrays' )   ;   RETURN
                ENDIF
             ENDIF
@@ -149,15 +149,15 @@
          ENDDO
          !                         ! fill sf_trcdta with slf_i and control print
-         CALL fld_fill( sf_trcdta, slf_i, cn_dir, 'trc_dta_init', 'Passive tracer data', 'namtrc' )
+         CALL fld_fill( sf_trcdta, slf_i, cn_dir, 'trc_dta_ini', 'Passive tracer data', 'namtrc' )
          !
       ENDIF
       !
       DEALLOCATE( slf_i )          ! deallocate local field structure
-      IF( nn_timing == 1 )  CALL timing_stop('trc_dta_init')
-      !
-   END SUBROUTINE trc_dta_init
-
-
-   SUBROUTINE trc_dta( kt, sf_trcdta, ptrfac, ptrc)
+      IF( nn_timing == 1 )  CALL timing_stop('trc_dta_ini')
+      !
+   END SUBROUTINE trc_dta_ini
+
+
+   SUBROUTINE trc_dta( kt, sf_trcdta, ztrcfac, ztrcdta)
       !!----------------------------------------------------------------------
       !!                   ***  ROUTINE trc_dta  ***
@@ -169,15 +169,14 @@
       !!              - ln_trcdmp=F: deallocates the data structure as they are not used
       !!
-      !! ** Action  :   sf_trcdta   passive tracer data on medl mesh and interpolated at time-step kt
-      !!----------------------------------------------------------------------
-      INTEGER                     , INTENT(in   ) ::   kt     ! ocean time-step
-      TYPE(FLD), DIMENSION(1)     , INTENT(inout) ::   sf_trcdta     ! array of information on the field to read
-      REAL(wp)                    , INTENT(in   ) ::   ptrfac  ! multiplication factor
-      REAL(wp), DIMENSION(jpi,jpj,jpk), OPTIONAL  , INTENT(out  ) ::   ptrc
+      !! ** Action  :   sf_trcdta   passive tracer data on meld mesh and interpolated at time-step kt
+      !!----------------------------------------------------------------------
+      INTEGER                          , INTENT(in   )   ::   kt         ! ocean time-step
+      TYPE(FLD), DIMENSION(1)          , INTENT(inout)   ::   sf_trcdta  ! array of information on the field to read
+      REAL(wp)                         , INTENT(in   )   ::   ztrcfac    ! multiplication factor
+      REAL(wp),  DIMENSION(jpi,jpj,jpk), INTENT(inout  ) ::   ztrcdta    ! 3D data array
       !
       INTEGER ::   ji, jj, jk, jl, jkk, ik    ! dummy loop indices
       REAL(wp)::   zl, zi
       REAL(wp), DIMENSION(jpk) ::  ztp                ! 1D workspace
-      REAL(wp), POINTER, DIMENSION(:,:,:) ::  ztrcdta   ! 3D  workspace
       CHARACTER(len=100) :: clndta
       !!----------------------------------------------------------------------
@@ -187,10 +186,9 @@
       IF( nb_trcdta > 0 ) THEN
          !
-         CALL wrk_alloc( jpi, jpj, jpk, ztrcdta )    ! Memory allocation
-         !
-         CALL fld_read( kt, 1, sf_trcdta )      !==   read data at kt time step   ==!
-         ztrcdta(:,:,:) = sf_trcdta(1)%fnow(:,:,:) * tmask(:,:,:)    ! Mask
-         !
-         IF( ln_sco ) THEN                   !==   s- or mixed s-zps-coordinate   ==!
+         ! read data at kt time step
+         CALL fld_read( kt, 1, sf_trcdta )
+         ztrcdta(:,:,:) = sf_trcdta(1)%fnow(:,:,:) * tmask(:,:,:)
+         ! 
+         IF( ln_sco ) THEN                !== s- or mixed s-zps-coordinate  ==!
             !
             IF( kt == nit000 .AND. lwp )THEN
@@ -205,11 +203,10 @@
                         ztp(jk) = ztrcdta(ji,jj,1)
                      ELSEIF( zl > gdept_1d(jpk) ) THEN         ! below the last level of data
-                        ztp(jk) =  ztrcdta(ji,jj,jpkm1)
+                        ztp(jk) = ztrcdta(ji,jj,jpkm1)
                      ELSE                                      ! inbetween : vertical interpolation between jkk & jkk+1
                         DO jkk = 1, jpkm1                                  ! when  gdept(jkk) < zl < gdept(jkk+1)
                            IF( (zl-gdept_1d(jkk)) * (zl-gdept_1d(jkk+1)) <= 0._wp ) THEN
                               zi = ( zl - gdept_1d(jkk) ) / (gdept_1d(jkk+1)-gdept_1d(jkk))
-                              ztp(jk) = ztrcdta(ji,jj,jkk) + ( ztrcdta(ji,jj,jkk+1) - &
-                                        ztrcdta(ji,jj,jkk) ) * zi 
+                              ztp(jk) = ztrcdta(ji,jj,jkk) + ( ztrcdta(ji,jj,jkk+1) - ztrcdta(ji,jj,jkk) ) * zi
                            ENDIF
                         END DO
@@ -217,5 +214,5 @@
                   END DO
                   DO jk = 1, jpkm1
-                    ztrcdta(ji,jj,jk) = ztp(jk) * tmask(ji,jj,jk)     ! mask required for mixed zps-s-coord
+                     ztrcdta(ji,jj,jk) = ztp(jk) * tmask(ji,jj,jk)     ! mask required for mixed zps-s-coord
                   END DO
                   ztrcdta(ji,jj,jpk) = 0._wp
@@ -224,6 +221,6 @@
             ! 
          ELSE                                !==   z- or zps- coordinate   ==!
-            !
-            IF( ln_zps ) THEN                      ! zps-coordinate (partial steps) interpolation at the last ocean level
+            ! zps-coordinate (partial steps) interpolation at the last ocean level
+            IF( ln_zps ) THEN
                DO jj = 1, jpj
                   DO ji = 1, jpi
@@ -244,14 +241,6 @@
          ENDIF
          !
-         ! Add multiplicative factor
-         ztrcdta(:,:,:) = ztrcdta(:,:,:) * ptrfac
-         !
-         ! Data structure for trc_ini (and BFMv5.1 coupling)
-         IF( .NOT. PRESENT(ptrc) ) sf_trcdta(1)%fnow(:,:,:) = ztrcdta(:,:,:)
-         !
-         ! Data structure for trc_dmp
-         IF( PRESENT(ptrc) )  ptrc(:,:,:) = ztrcdta(:,:,:)
-         !
-         CALL wrk_dealloc( jpi, jpj, jpk, ztrcdta )
+         ! Scale by multiplicative factor
+         ztrcdta(:,:,:) = ztrcdta(:,:,:) * ztrcfac
          !
       ENDIF
@@ -266,5 +255,5 @@
    !!----------------------------------------------------------------------
 CONTAINS
-   SUBROUTINE trc_dta( kt, sf_trcdta, ptrfac, ptrc)        ! Empty routine
+   SUBROUTINE trc_dta( kt, sf_trcdta, ztrcfac, ztrcdta)        ! Empty routine
       WRITE(*,*) 'trc_dta: You should not have seen this print! error?', kt
    END SUBROUTINE trc_dta
Index: branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/NEMO/TOP_SRC/trcice.F90
===================================================================
--- branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/NEMO/TOP_SRC/trcice.F90	(revision 7383)
+++ branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/NEMO/TOP_SRC/trcice.F90	(revision 7391)
@@ -17,5 +17,6 @@
    USE trcice_cfc      ! CFC      initialisation
    USE trcice_pisces   ! PISCES   initialisation
-   USE trcice_c14b     ! C14 bomb initialisation
+   USE trcice_c14      ! C14 bomb initialisation
+   USE trcice_age      ! aGE initialisation
    USE trcice_my_trc   ! MY_TRC   initialisation
    
@@ -45,5 +46,6 @@
 
       IF( nn_timing == 1 )  CALL timing_start('trc_ice_ini')
-
+      !
+      CALL trc_nam_ice
       !
       trc_i(:,:,:) = 0.0d0 ! by default
@@ -51,8 +53,9 @@
 
       IF ( nn_ice_tr == 1 ) THEN
-         IF( lk_pisces  )    CALL trc_ice_ini_pisces       ! PISCES  bio-model
-         IF( lk_cfc     )    CALL trc_ice_ini_cfc          ! CFC     tracers
-         IF( lk_c14b    )    CALL trc_ice_ini_c14b         ! C14 bomb  tracer
-         IF( lk_my_trc  )    CALL trc_ice_ini_my_trc       ! MY_TRC  tracers
+         IF( ln_pisces  )    CALL trc_ice_ini_pisces       ! PISCES  bio-model
+         IF( ll_cfc     )    CALL trc_ice_ini_cfc          ! CFC     tracers
+         IF( ln_c14     )    CALL trc_ice_ini_c14          ! C14     tracer
+         IF( ln_age     )    CALL trc_ice_ini_age          ! AGE     tracer
+         IF( ln_my_trc  )    CALL trc_ice_ini_my_trc       ! MY_TRC  tracers
       ENDIF
 
@@ -60,4 +63,55 @@
       !
    END SUBROUTINE trc_ice_ini
+
+   SUBROUTINE trc_nam_ice
+      !!---------------------------------------------------------------------
+      !!                     ***  ROUTINE trc_nam_ice ***
+      !!
+      !! ** Purpose :   Read the namelist for the ice effect on tracers
+      !!
+      !! ** Method  : -
+      !!
+      !!---------------------------------------------------------------------
+      INTEGER :: jn      ! dummy loop indices
+      INTEGER :: ios, ierr     ! Local integer output status for namelist read
+      !
+      TYPE(TRC_I_NML), DIMENSION(jpmaxtrc) :: sn_tri_tracer
+      !!
+      NAMELIST/namtrc_ice/ nn_ice_tr, sn_tri_tracer
+      !!---------------------------------------------------------------------
+      !
+      IF(lwp) THEN
+         WRITE(numout,*)
+         WRITE(numout,*) 'trc_nam_ice : Read the namelist for trc_ice'
+         WRITE(numout,*) '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~'
+      ENDIF
+
+      IF( nn_timing == 1 )  CALL timing_start('trc_nam_ice')
+
+      !
+      REWIND( numnat_ref )              ! Namelist namtrc_ice in reference namelist : Passive tracer input data
+      READ  ( numnat_ref, namtrc_ice, IOSTAT = ios, ERR = 901)
+ 901  IF( ios /= 0 ) CALL ctl_nam ( ios , ' namtrc_ice in reference namelist ', lwp )
+
+      REWIND( numnat_cfg )              ! Namelist namtrc_ice in configuration namelist : Pisces external sources of nutrients
+      READ  ( numnat_cfg, namtrc_ice, IOSTAT = ios, ERR = 902 )
+ 902  IF( ios /= 0 ) CALL ctl_nam ( ios , 'namtrc_ice in configuration namelist', lwp )
+
+      IF( lwp ) THEN
+         WRITE(numout,*) ' '
+         WRITE(numout,*) ' Sea ice tracers option (nn_ice_tr) : ', nn_ice_tr
+         WRITE(numout,*) ' '
+      ENDIF
+      !
+      ! Assign namelist stuff
+      DO jn = 1, jptra
+         trc_ice_ratio (jn) = sn_tri_tracer(jn)%trc_ratio
+         trc_ice_prescr(jn) = sn_tri_tracer(jn)%trc_prescr
+         cn_trc_o      (jn) = sn_tri_tracer(jn)%ctrc_o
+      END DO
+
+      IF( nn_timing == 1 )   CALL timing_stop('trc_nam_ice')
+      !
+   END SUBROUTINE trc_nam_ice
 
 #else
@@ -68,4 +122,8 @@
    SUBROUTINE trc_ice_ini                   ! Dummy routine   
    END SUBROUTINE trc_ice_ini
+
+   SUBROUTINE trc_nam_ice
+   END SUBROUTINE trc_nam_ice
+
 #endif
 
Index: branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/NEMO/TOP_SRC/trcini.F90
===================================================================
--- branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/NEMO/TOP_SRC/trcini.F90	(revision 7383)
+++ branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/NEMO/TOP_SRC/trcini.F90	(revision 7391)
@@ -24,7 +24,6 @@
    USE trcrst
    USE lib_mpp         ! distribued memory computing library
-   USE sbc_oce
    USE trcice          ! tracers in sea ice
-   USE trcbc,   only : trc_bc_init ! generalized Boundary Conditions
+   USE trcbc,   only : trc_bc_ini ! generalized Boundary Conditions
  
    IMPLICIT NONE
@@ -58,32 +57,25 @@
       IF(lwp) WRITE(numout,*) 'trc_init : initial set up of the passive tracers'
       IF(lwp) WRITE(numout,*) '~~~~~~~'
-
-      !
+      !
+      CALL trc_ini_ctl   ! control 
+      CALL trc_nam       ! read passive tracers namelists
       CALL top_alloc()   ! allocate TOP arrays
       !
-      CALL trc_ini_ctl   ! control 
-      !
-      CALL trc_nam       ! read passive tracers namelists
+      IF(.NOT.ln_trcdta )   ln_trc_ini(:) = .FALSE.
       !
       IF(lwp) WRITE(numout,*)
-      !
       IF( ln_rsttr .AND. .NOT. lk_offline ) CALL trc_rst_cal( nit000, 'READ' )   ! calendar
-      !
       IF(lwp) WRITE(numout,*)
       !
       CALL trc_ini_sms   ! SMS
-      !
+      CALL trc_ini_inv   ! Inventories
       CALL trc_ini_trp   ! passive tracers transport
-      !
       CALL trc_ice_ini   ! Tracers in sea ice
       !
-      IF( lwp )  &
-         &  CALL ctl_opn( numstr, 'tracer.stat', 'REPLACE', 'FORMATTED', 'SEQUENTIAL', -1, numout, lwp , narea )
+      IF(lwp) CALL ctl_opn( numstr, 'tracer.stat', 'REPLACE', 'FORMATTED', 'SEQUENTIAL', -1, numout, lwp , narea )
       !
       CALL trc_ini_state  !  passive tracers initialisation : from a restart or from clim
-      !
-      IF( nn_dttrc /= 1 )        CALL trc_sub_ini      ! Initialize variables for substepping passive tracers
-      !
-      CALL trc_ini_inv   ! Inventories
+      IF( nn_dttrc /= 1 ) &
+      CALL trc_sub_ini    ! Initialize variables for substepping passive tracers
       !
       IF( nn_timing == 1 )   CALL timing_stop('trc_init')
@@ -120,5 +112,4 @@
          cvol(:,:,jk) = e1e2t(:,:) * e3t_n(:,:,jk) * tmask(:,:,jk)
       END DO
-      IF( lk_degrad )   cvol(:,:,:) = cvol(:,:,:) * facvol(:,:,:)    ! degrad option: reduction by facvol
       !                                                              ! total volume of the ocean 
       areatot = glob_sum( cvol(:,:,:) )
@@ -131,8 +122,7 @@
       IF(lwp) THEN               ! control print
          WRITE(numout,*)
-         WRITE(numout,*)
-         WRITE(numout,*) '          *** Total number of passive tracer jptra = ', jptra
-         WRITE(numout,*) '          *** Total volume of ocean                = ', areatot
-         WRITE(numout,*) '          *** Total inital content of all tracers '
+         WRITE(numout,*) '  *** Total number of passive tracer jptra = ', jptra
+         WRITE(numout,*) '  *** Total volume of ocean                = ', areatot
+         WRITE(numout,*) '  *** Total inital content of all tracers '
          WRITE(numout,*)
          DO jn = 1, jptra
@@ -148,5 +138,5 @@
          CALL prt_ctl_trc( tab4d=trn, mask=tmask, clinfo=ctrcnm )
       ENDIF
-9000  FORMAT(' tracer nb : ',i2,'      name :',a10,'      initial content :',e18.10)
+9000  FORMAT('  tracer nb : ',i2,'      name :',a10,'      initial content :',e18.10)
       !
    END SUBROUTINE trc_ini_inv
@@ -158,13 +148,40 @@
       !! ** Purpose :   SMS initialisation
       !!----------------------------------------------------------------------
-      USE trcini_cfc      ! CFC      initialisation
-      USE trcini_pisces   ! PISCES   initialisation
-      USE trcini_c14b     ! C14 bomb initialisation
-      USE trcini_my_trc   ! MY_TRC   initialisation
-      !!----------------------------------------------------------------------
-      IF( lk_pisces  )       CALL trc_ini_pisces       ! PISCES  bio-model
-      IF( lk_cfc     )       CALL trc_ini_cfc          ! CFC     tracers
-      IF( lk_c14b    )       CALL trc_ini_c14b         ! C14 bomb  tracer
-      IF( lk_my_trc  )       CALL trc_ini_my_trc       ! MY_TRC  tracers
+      USE trcini_pisces  ! PISCES   initialisation
+      USE trcini_cfc     ! CFC      initialisation
+      USE trcini_c14     ! C14  initialisation
+      USE trcini_age     ! age initialisation
+      USE trcini_my_trc  ! MY_TRC   initialisation
+      !
+      INTEGER :: jn
+      !!----------------------------------------------------------------------
+      !
+      ! Pass sn_tracer fields to specialized arrays 
+      DO jn = 1, jp_bgc
+         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_sbc(jn) =       sn_tracer(jn)%llsbc
+         ln_trc_cbc(jn) =       sn_tracer(jn)%llcbc
+         ln_trc_obc(jn) =       sn_tracer(jn)%llobc
+      END DO
+      !    
+      IF( ln_pisces  )   CALL trc_ini_pisces     !  PISCES model
+      IF( ln_my_trc  )   CALL trc_ini_my_trc     !  MY_TRC model
+      IF( ll_cfc     )   CALL trc_ini_cfc        !  CFC's
+      IF( ln_c14     )   CALL trc_ini_c14        !  C14 model
+      IF( ln_age     )   CALL trc_ini_age        !  AGE
+      !
+      IF(lwp) THEN                   ! control print
+         WRITE(numout,*)
+         WRITE(numout,*) ' trc_init: Summary for selected passive tracers'
+         WRITE(numout,*) ' ~~~~~~~~~~~~~~'
+         WRITE(numout,*) ' ID     NAME     INI  SBC  CBC  OBC'
+         DO jn = 1, jptra
+            WRITE(numout,9001) jn, TRIM(ctrcnm(jn)), ln_trc_ini(jn), ln_trc_sbc(jn),ln_trc_cbc(jn),ln_trc_obc(jn)
+         END DO
+      ENDIF
+9001  FORMAT(1x,i3,1x,a10,3x,l2,3x,l2,3x,l2,3x,l2)
       !
    END SUBROUTINE trc_ini_sms
@@ -207,8 +224,8 @@
       !
       ! Initialisation of tracers Initial Conditions
-      IF( ln_trcdta )      CALL trc_dta_init(jptra)
+      IF( ln_trcdta )      CALL trc_dta_ini(jptra)
 
       ! Initialisation of tracers Boundary Conditions
-      IF( lk_my_trc )     CALL trc_bc_init(jptra)
+      IF( ln_my_trc )     CALL trc_bc_ini(jptra)
 
       IF( ln_rsttr ) THEN
@@ -217,17 +234,16 @@
         !
       ELSE
-        !
-        IF( ln_trcdta .AND. nb_trcdta > 0 ) THEN  ! Initialisation of tracer from a file that may also be used for damping
-            !
+        ! Initialisation of tracer from a file that may also be used for damping
+        IF( ln_trcdta .AND. nb_trcdta > 0 ) THEN
+            ! update passive tracers arrays with input data read from file
             DO jn = 1, jptra
-               IF( ln_trc_ini(jn) ) THEN      ! update passive tracers arrays with input data read from file
+               IF( ln_trc_ini(jn) ) THEN
                   jl = n_trc_index(jn) 
-                  CALL trc_dta( nit000, sf_trcdta(jl), rf_trfac(jl) )   ! read tracer data at nit000
-                  trn(:,:,:,jn) = sf_trcdta(jl)%fnow(:,:,:) 
+                  CALL trc_dta( nit000, sf_trcdta(jl), rf_trfac(jl), trn(:,:,:,jn) )
                   !
-                  IF( .NOT.ln_trcdmp .AND. .NOT.ln_trcdmp_clo ) THEN      !== deallocate data structure   ==!
-                     !                                                    (data used only for initialisation)
+                  ! deallocate data structure if data are not used for damping
+                  IF( .NOT.ln_trcdmp .AND. .NOT.ln_trcdmp_clo ) THEN
                      IF(lwp) WRITE(numout,*) 'trc_dta: deallocate data arrays as they are only used to initialize the run'
-                                                  DEALLOCATE( sf_trcdta(jl)%fnow )     !  arrays in the structure
+                                                  DEALLOCATE( sf_trcdta(jl)%fnow )
                      IF( sf_trcdta(jl)%ln_tint )  DEALLOCATE( sf_trcdta(jl)%fdta )
                      !
Index: branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/NEMO/TOP_SRC/trcnam.F90
===================================================================
--- branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/NEMO/TOP_SRC/trcnam.F90	(revision 7383)
+++ branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/NEMO/TOP_SRC/trcnam.F90	(revision 7391)
@@ -20,8 +20,4 @@
    USE oce_trc           ! shared variables between ocean and passive tracers
    USE trc               ! passive tracers common variables
-   USE trcnam_pisces     ! PISCES namelist
-   USE trcnam_cfc        ! CFC SMS namelist
-   USE trcnam_c14b       ! C14 SMS namelist
-   USE trcnam_my_trc     ! MY_TRC SMS namelist
    USE trd_oce       
    USE trdtrc_oce
@@ -34,4 +30,6 @@
    PUBLIC trc_nam      ! called in trcini
 
+   TYPE(PTRACER), DIMENSION(jpmaxtrc), PUBLIC  :: sn_tracer  ! type of tracer for saving if not key_iomput
+
    !!----------------------------------------------------------------------
    !! NEMO/TOP 3.3 , NEMO Consortium (2010)
@@ -52,30 +50,13 @@
       !!---------------------------------------------------------------------
       INTEGER  ::   jn                  ! dummy loop indice
-      !                                  
-      IF( .NOT.lk_offline )   CALL trc_nam_run     ! Parameters of the run 
+      !
+      IF( .NOT.lk_offline )   CALL trc_nam_run     ! Parameters of the run                                  
       !               
-                              CALL trc_nam_trc     ! passive tracer informations
+      CALL trc_nam_trc     ! passive tracer informations
       !                                        
-                              CALL trc_nam_dia     ! Parameters of additional diagnostics
-      !                                      
-      !
       IF( ln_rsttr                     )   ln_trcdta     = .FALSE.   ! restart : no need of clim data
       !
       IF( ln_trcdmp .OR. ln_trcdmp_clo )   ln_trcdta     = .TRUE.   ! damping : need to have clim data
       !
-      IF( .NOT.ln_trcdta               )   ln_trc_ini(:) = .FALSE.
-
-      IF(lwp) THEN                   ! control print
-         WRITE(numout,*)
-         WRITE(numout,*) ' Namelist : namtrc'
-         WRITE(numout,*) '   Read inputs data from file (y/n)             ln_trcdta     = ', ln_trcdta
-         WRITE(numout,*) '   Damping of passive tracer (y/n)              ln_trcdmp     = ', ln_trcdmp
-         WRITE(numout,*) '   Restoring of tracer on closed seas           ln_trcdmp_clo = ', ln_trcdmp_clo
-         WRITE(numout,*) ' '
-         DO jn = 1, jptra
-            WRITE(numout,*) '  tracer nb : ', jn, '    short name : ', ctrcnm(jn)
-         END DO
-         WRITE(numout,*) ' '
-      ENDIF
 
       IF(lwp) THEN                   ! control print
@@ -96,64 +77,14 @@
          ENDIF
       ENDIF
-
-      
-      rdttrc = rdt * FLOAT( nn_dttrc )   ! passive tracer time-step
-  
-      IF(lwp) THEN                   ! control print
+      !
+      rdttrc = rdt * FLOAT( nn_dttrc )          ! passive tracer time-step
+      ! 
+      IF(lwp) THEN                              ! control print
         WRITE(numout,*) 
         WRITE(numout,*) '    Passive Tracer  time step    rdttrc  = ', rdttrc
         WRITE(numout,*) 
       ENDIF
-
-
-#if defined key_trdmxl_trc || defined key_trdtrc
-
-         REWIND( numnat_ref )              ! Namelist namtrc_trd in reference namelist : Passive tracer trends
-         READ  ( numnat_ref, namtrc_trd, IOSTAT = ios, ERR = 905)
-905      IF( ios /= 0 ) CALL ctl_nam ( ios , 'namtrc_trd in reference namelist', lwp )
-
-         REWIND( numnat_cfg )              ! Namelist namtrc_trd in configuration namelist : Passive tracer trends
-         READ  ( numnat_cfg, namtrc_trd, IOSTAT = ios, ERR = 906 )
-906      IF( ios /= 0 ) CALL ctl_nam ( ios , 'namtrc_trd in configuration namelist', lwp )
-         IF(lwm) WRITE ( numont, namtrc_trd )
-
-         IF(lwp) THEN
-            WRITE(numout,*)
-            WRITE(numout,*) ' trd_mxl_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_trdmxl_trc_restart  = ', ln_trdmxl_trc_restart
-            WRITE(numout,*) '   * flag to diagnose trends of                                 '
-            WRITE(numout,*) '     instantantaneous or mean ML T/S   ln_trdmxl_trc_instant  = ', ln_trdmxl_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
-
-
-      ! Call the ice module for tracers
-      ! -------------------------------
-                                  CALL trc_nam_ice
-
-      ! namelist of SMS
-      ! ---------------      
-      IF( lk_pisces  ) THEN   ;   CALL trc_nam_pisces      ! PISCES  bio-model
-      ELSE                    ;   IF(lwp) WRITE(numout,*) '          PISCES not used'
-      ENDIF
-
-      IF( lk_cfc     ) THEN   ;   CALL trc_nam_cfc         ! CFC     tracers
-      ELSE                    ;   IF(lwp) WRITE(numout,*) '          CFC not used'
-      ENDIF
-
-      IF( lk_c14b     ) THEN   ;   CALL trc_nam_c14b         ! C14 bomb     tracers
-      ELSE                    ;   IF(lwp) WRITE(numout,*) '          C14 not used'
-      ENDIF
-
-      IF( lk_my_trc  ) THEN   ;   CALL trc_nam_my_trc      ! MY_TRC  tracers
-      ELSE                    ;   IF(lwp) WRITE(numout,*) '          MY_TRC not used'
-      ENDIF
+      !
+      IF( l_trdtrc )        CALL trc_nam_trd    ! Passive tracer trends
       !
    END SUBROUTINE trc_nam
@@ -167,5 +98,5 @@
       !!
       !!---------------------------------------------------------------------
-      NAMELIST/namtrc_run/ nn_dttrc, nn_writetrc, ln_rsttr, nn_rsttr, ln_top_euler, &
+      NAMELIST/namtrc_run/ nn_dttrc, ln_rsttr, nn_rsttr, ln_top_euler, &
         &                  cn_trcrst_indir, cn_trcrst_outdir, cn_trcrst_in, cn_trcrst_out
       !
@@ -199,5 +130,4 @@
          WRITE(numout,*) '   control of time step for passive tracer      nn_rsttr      = ', nn_rsttr
          WRITE(numout,*) '   first time step for pass. trac.              nittrc000     = ', nittrc000
-         WRITE(numout,*) '   frequency of outputs for passive tracers     nn_writetrc   = ', nn_writetrc 
          WRITE(numout,*) '   Use euler integration for TRC (y/n)          ln_top_euler  = ', ln_top_euler
          WRITE(numout,*) ' '
@@ -206,57 +136,4 @@
     END SUBROUTINE trc_nam_run
 
-
-   SUBROUTINE trc_nam_ice
-      !!---------------------------------------------------------------------
-      !!                     ***  ROUTINE trc_nam_ice ***
-      !!
-      !! ** Purpose :   Read the namelist for the ice effect on tracers
-      !!
-      !! ** Method  : -
-      !!
-      !!---------------------------------------------------------------------
-      INTEGER :: jn      ! dummy loop indices
-      INTEGER :: ios     ! Local integer output status for namelist read
-      !
-      TYPE(TRC_I_NML), DIMENSION(jptra) :: sn_tri_tracer
-      !!
-      NAMELIST/namtrc_ice/ nn_ice_tr, sn_tri_tracer
-      !!---------------------------------------------------------------------
-      !
-      IF(lwp) THEN
-         WRITE(numout,*)
-         WRITE(numout,*) 'trc_nam_ice : Read the namelist for trc_ice'
-         WRITE(numout,*) '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~'
-      ENDIF
-
-      IF( nn_timing == 1 )  CALL timing_start('trc_nam_ice')
-
-      !
-      REWIND( numnat_ref )              ! Namelist namtrc_ice in reference namelist : Passive tracer input data
-      READ  ( numnat_ref, namtrc_ice, IOSTAT = ios, ERR = 901)
- 901  IF( ios /= 0 ) CALL ctl_nam ( ios , ' namtrc_ice in reference namelist ', lwp )
-
-      REWIND( numnat_cfg )              ! Namelist namtrc_ice in configuration namelist : Pisces external sources of nutrients
-      READ  ( numnat_cfg, namtrc_ice, IOSTAT = ios, ERR = 902 )
- 902  IF( ios /= 0 ) CALL ctl_nam ( ios , 'namtrc_ice in configuration namelist', lwp )
-
-      IF( lwp ) THEN
-         WRITE(numout,*) ' '
-         WRITE(numout,*) ' Sea ice tracers option (nn_ice_tr) : ', nn_ice_tr
-         WRITE(numout,*) ' '
-      ENDIF
-
-      ! Assign namelist stuff
-      DO jn = 1, jptra
-         trc_ice_ratio(jn)  = sn_tri_tracer(jn)%trc_ratio
-         trc_ice_prescr(jn) = sn_tri_tracer(jn)%trc_prescr
-         cn_trc_o      (jn) = sn_tri_tracer(jn)%ctrc_o
-      END DO
-
-      IF( nn_timing == 1 )   CALL timing_stop('trc_nam_ice')
-      !
-   END SUBROUTINE trc_nam_ice
-
-
    SUBROUTINE trc_nam_trc
       !!---------------------------------------------------------------------
@@ -266,11 +143,13 @@
       !!
       !!---------------------------------------------------------------------
-      INTEGER  ::   ios                 ! Local integer output status for namelist read
-      INTEGER  ::   jn                  ! dummy loop indice
-      !
-      TYPE(PTRACER), DIMENSION(jptra) :: sn_tracer  ! type of tracer for saving if not key_iomput
-      !!
-      NAMELIST/namtrc/ sn_tracer, ln_trcdta, ln_trcdmp, ln_trcdmp_clo
-      !!---------------------------------------------------------------------
+      INTEGER  ::   ios, ierr, icfc       ! Local integer output status for namelist read
+      !!
+      NAMELIST/namtrc/jp_bgc, ln_pisces, ln_my_trc, ln_age, ln_cfc11, ln_cfc12, ln_sf6, ln_c14, &
+         &            sn_tracer, ln_trcdta, ln_trcdmp, ln_trcdmp_clo, jp_dia3d, jp_dia2d
+      !!---------------------------------------------------------------------
+      ! Dummy settings to fill tracers data structure
+      !                  !   name   !   title   !   unit   !   init  !   sbc   !   cbc   !   obc  !
+      sn_tracer = PTRACER( 'NONAME' , 'NOTITLE' , 'NOUNIT' , .false. , .false. , .false. , .false.)
+      !
       IF(lwp) WRITE(numout,*)
       IF(lwp) WRITE(numout,*) 'trc_nam_trc : read the passive tracer namelists'
@@ -286,21 +165,78 @@
       IF(lwm) WRITE ( numont, namtrc )
 
-      DO jn = 1, jptra
-         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
-#if defined key_my_trc
-         ln_trc_sbc(jn) =       sn_tracer(jn)%llsbc
-         ln_trc_cbc(jn) =       sn_tracer(jn)%llcbc
-         ln_trc_obc(jn) =       sn_tracer(jn)%llobc
-#endif
-         ln_trc_wri(jn) =       sn_tracer(jn)%llsave
-      END DO
-      !
+      ! Control settings
+      IF( ln_pisces .AND. ln_my_trc )   CALL ctl_stop( 'Choose only ONE BGC model - PISCES or MY_TRC' )
+      IF( .NOT. ln_pisces .AND. .NOT. ln_my_trc )   jp_bgc = 0
+      ll_cfc = ln_cfc11 .OR. ln_cfc12 .OR. ln_sf6
+      !
+      jptra       =  0
+      jp_pisces   =  0    ;   jp_pcs0  =  0    ;   jp_pcs1  = 0
+      jp_my_trc   =  0    ;   jp_myt0  =  0    ;   jp_myt1  = 0
+      jp_cfc      =  0    ;   jp_cfc0  =  0    ;   jp_cfc1  = 0
+      jp_age      =  0    ;   jp_c14   =  0
+      !
+      IF( ln_pisces )  THEN
+         jp_pisces = jp_bgc
+         jp_pcs0   = 1
+         jp_pcs1   = jp_pisces
+      ENDIF
+      IF( ln_my_trc )  THEN
+          jp_my_trc = jp_bgc
+          jp_myt0   = 1
+          jp_myt1   = jp_my_trc
+      ENDIF
+      !
+      jptra  = jp_bgc
+      !
+      IF( ln_age )    THEN
+         jptra     = jptra + 1
+         jp_age    = jptra
+      ENDIF
+      IF( ln_cfc11 )  jp_cfc = jp_cfc + 1
+      IF( ln_cfc12 )  jp_cfc = jp_cfc + 1
+      IF( ln_sf6   )  jp_cfc = jp_cfc + 1
+      IF( ll_cfc )    THEN
+          jptra     = jptra + jp_cfc
+          jp_cfc0   = jptra - jp_cfc + 1
+          jp_cfc1   = jptra
+      ENDIF
+      IF( ln_c14 )    THEN
+           jptra     = jptra + 1
+           jp_c14    = jptra
+      ENDIF
+      !
+      IF( jptra == 0 )   CALL ctl_stop( 'All TOP tracers disabled: change namtrc setting or check if key_top is active' )
+      !
+      IF(lwp) THEN                   ! control print
+         WRITE(numout,*)
+         WRITE(numout,*) ' Namelist : namtrc'
+         WRITE(numout,*) '   Total number of passive tracers              jptra         = ', jptra
+         WRITE(numout,*) '   Total number of BGC tracers                  jp_bgc        = ', jp_bgc
+         WRITE(numout,*) '   Simulating PISCES model                      ln_pisces     = ', ln_pisces
+         WRITE(numout,*) '   Simulating MY_TRC  model                     ln_my_trc     = ', ln_my_trc
+         WRITE(numout,*) '   Simulating water mass age                    ln_age        = ', ln_age
+         WRITE(numout,*) '   Simulating CFC11 passive tracer              ln_cfc11      = ', ln_cfc11
+         WRITE(numout,*) '   Simulating CFC12 passive tracer              ln_cfc12      = ', ln_cfc12
+         WRITE(numout,*) '   Simulating SF6 passive tracer                ln_sf6        = ', ln_sf6
+         WRITE(numout,*) '   Total number of CFCs tracers                 jp_cfc        = ', jp_cfc
+         WRITE(numout,*) '   Simulating C14   passive tracer              ln_c14        = ', ln_c14
+         WRITE(numout,*) '   Read inputs data from file (y/n)             ln_trcdta     = ', ln_trcdta
+         WRITE(numout,*) '   Damping of passive tracer (y/n)              ln_trcdmp     = ', ln_trcdmp
+         WRITE(numout,*) '   Restoring of tracer on closed seas           ln_trcdmp_clo = ', ln_trcdmp_clo
+         WRITE(numout,*) ' '
+         WRITE(numout,*) ' '
+      ENDIF
+      !
+      IF( ll_cfc .OR. ln_c14 ) THEN
+        !                             ! Open namelist files
+        CALL ctl_opn( numtrc_ref, 'namelist_trc_ref'   ,     'OLD', 'FORMATTED', 'SEQUENTIAL', -1, numout, .FALSE. )
+        CALL ctl_opn( numtrc_cfg, 'namelist_trc_cfg'   ,     'OLD', 'FORMATTED', 'SEQUENTIAL', -1, numout, .FALSE. )
+        IF(lwm) CALL ctl_opn( numonr, 'output.namelist.trc', 'UNKNOWN', 'FORMATTED', 'SEQUENTIAL', -1, numout, .FALSE. )
+        !
+      ENDIF
+
    END SUBROUTINE trc_nam_trc
 
-
-   SUBROUTINE trc_nam_dia
+   SUBROUTINE trc_nam_trd
       !!---------------------------------------------------------------------
       !!                     ***  ROUTINE trc_nam_dia  ***
@@ -312,60 +248,47 @@
       !!                ( (PISCES, CFC, MY_TRC )
       !!---------------------------------------------------------------------
+
+#if defined key_trdmxl_trc  || defined key_trdtrc
       INTEGER  ::   ios                 ! Local integer output status for namelist read
       INTEGER ::  ierr
       !!
-#if defined key_trdmxl_trc  || defined key_trdtrc
       NAMELIST/namtrc_trd/ nn_trd_trc, nn_ctls_trc, rn_ucf_trc, &
          &                ln_trdmxl_trc_restart, ln_trdmxl_trc_instant, &
          &                cn_trdrst_trc_in, cn_trdrst_trc_out, ln_trdtrc
-#endif
-      NAMELIST/namtrc_dia/ ln_diatrc, ln_diabio, nn_writedia, nn_writebio
       !!---------------------------------------------------------------------
 
       IF(lwp) WRITE(numout,*)
-      IF(lwp) WRITE(numout,*) 'trc_nam_dia : read the passive tracer diagnostics options'
+      IF(lwp) WRITE(numout,*) 'trc_nam_trd : read the passive tracer diagnostics options'
       IF(lwp) WRITE(numout,*) '~~~~~~~'
 
-      REWIND( numnat_ref )              ! Namelist namtrc_dia in reference namelist : Passive tracer diagnostics
-      READ  ( numnat_ref, namtrc_dia, IOSTAT = ios, ERR = 903)
-903   IF( ios /= 0 ) CALL ctl_nam ( ios , 'namtrc_dia in reference namelist', lwp )
-
-      REWIND( numnat_cfg )              ! Namelist namtrc_dia in configuration namelist : Passive tracer diagnostics
-      READ  ( numnat_cfg, namtrc_dia, IOSTAT = ios, ERR = 904 )
-904   IF( ios /= 0 ) CALL ctl_nam ( ios , 'namtrc_dia in configuration namelist', lwp )
-      IF(lwm) WRITE ( numont, namtrc_dia )
+      !
+      ALLOCATE( ln_trdtrc(jptra) ) 
+      !
+      REWIND( numnat_ref )              ! Namelist namtrc_trd in reference namelist : Passive tracer trends
+      READ  ( numnat_ref, namtrc_trd, IOSTAT = ios, ERR = 905)
+905   IF( ios /= 0 ) CALL ctl_nam ( ios , 'namtrc_trd in reference namelist', lwp )
+
+      REWIND( numnat_cfg )              ! Namelist namtrc_trd in configuration namelist : Passive tracer trends
+      READ  ( numnat_cfg, namtrc_trd, IOSTAT = ios, ERR = 906 )
+906   IF( ios /= 0 ) CALL ctl_nam ( ios , 'namtrc_trd in configuration namelist', lwp )
+      IF(lwm) WRITE ( numont, namtrc_trd )
 
       IF(lwp) THEN
          WRITE(numout,*)
-         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' )
-         !
-         trc2d(:,:,:  ) = 0._wp  ;   ctrc2d(:) = ' '   ;   ctrc2l(:) = ' '    ;    ctrc2u(:) = ' ' 
-         trc3d(:,:,:,:) = 0._wp  ;   ctrc3d(:) = ' '   ;   ctrc3l(:) = ' '    ;    ctrc3u(:) = ' ' 
-         !
-      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' )
-         !
-         trbio(:,:,:,:) = 0._wp  ;   ctrbio(:) = ' '   ;   ctrbil(:) = ' '    ;    ctrbiu(:) = ' ' 
-         !
-      ENDIF
-      !
-   END SUBROUTINE trc_nam_dia
+         WRITE(numout,*) ' trd_mxl_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_trdmxl_trc_restart  = ', ln_trdmxl_trc_restart
+         WRITE(numout,*) '   * flag to diagnose trends of                                 '
+         WRITE(numout,*) '     instantantaneous or mean ML T/S   ln_trdmxl_trc_instant  = ', ln_trdmxl_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
+      !
+   END SUBROUTINE trc_nam_trd
 
 #else
Index: branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/NEMO/TOP_SRC/trcsms.F90
===================================================================
--- branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/NEMO/TOP_SRC/trcsms.F90	(revision 7383)
+++ branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/NEMO/TOP_SRC/trcsms.F90	(revision 7391)
@@ -16,6 +16,7 @@
    USE trc                !
    USE trcsms_pisces      ! PISCES biogeo-model
-   USE trcsms_cfc         ! CFC 11 & 12
-   USE trcsms_c14b        ! C14b tracer 
+   USE trcsms_cfc         ! CFC 11 &/or 12
+   USE trcsms_c14         ! C14 
+   USE trcsms_age         ! AGE
    USE trcsms_my_trc      ! MY_TRC  tracers
    USE prtctl_trc         ! Print control for debbuging
@@ -48,8 +49,9 @@
       IF( nn_timing == 1 )   CALL timing_start('trc_sms')
       !
-      IF( lk_pisces  )   CALL trc_sms_pisces ( kt )    ! main program of PISCES 
-      IF( lk_cfc     )   CALL trc_sms_cfc    ( kt )    ! surface fluxes of CFC
-      IF( lk_c14b    )   CALL trc_sms_c14b   ( kt )    ! surface fluxes of C14
-      IF( lk_my_trc  )   CALL trc_sms_my_trc ( kt )    ! MY_TRC  tracers
+      IF( ln_pisces  )   CALL trc_sms_pisces ( kt )    ! main program of PISCES 
+      IF( ll_cfc     )   CALL trc_sms_cfc    ( kt )    ! surface fluxes of CFC
+      IF( ln_c14     )   CALL trc_sms_c14    ( kt )    ! surface fluxes of C14
+      IF( ln_age     )   CALL trc_sms_age    ( kt )    ! Age tracer
+      IF( ln_my_trc  )   CALL trc_sms_my_trc ( kt )    ! MY_TRC  tracers
 
       IF(ln_ctl) THEN      ! print mean trends (used for debugging)
Index: branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/NEMO/TOP_SRC/trcstp.F90
===================================================================
--- branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/NEMO/TOP_SRC/trcstp.F90	(revision 7383)
+++ branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/NEMO/TOP_SRC/trcstp.F90	(revision 7391)
@@ -15,10 +15,9 @@
    USE trctrp           ! passive tracers transport
    USE trcsms           ! passive tracers sources and sinks
-   USE prtctl_trc       ! Print control for debbuging
-   USE trcdia
    USE trcwri
    USE trcrst
    USE trdtrc_oce
    USE trdmxl_trc
+   USE prtctl_trc       ! Print control for debbuging
    USE iom
    USE in_out_manager
@@ -62,4 +61,10 @@
       IF( nn_timing == 1 )   CALL timing_start('trc_stp')
       !
+      IF( ( neuler == 0 .AND. kt == nittrc000 ) .OR. ln_top_euler ) THEN     ! at nittrc000
+         r2dttrc =  rdttrc           ! = rdttrc (use or restarting with Euler time stepping)
+      ELSEIF( kt <= nittrc000 + nn_dttrc ) THEN          ! at nittrc000 or nittrc000+1
+         r2dttrc = 2. * rdttrc       ! = 2 rdttrc (leapfrog)
+      ENDIF
+      !
       IF( kt == nittrc000 .AND. lk_trdmxl_trc )  CALL trd_mxl_trc_init    ! trends: Mixed-layer
       !
@@ -68,5 +73,4 @@
             cvol(:,:,jk) = e1e2t(:,:) * e3t_n(:,:,jk) * tmask(:,:,jk)
          END DO
-         IF( lk_degrad )  cvol(:,:,:) = cvol(:,:,:) * facvol(:,:,:)       ! degrad option: reduction by facvol
          areatot         = glob_sum( cvol(:,:,:) )
       ENDIF
@@ -87,7 +91,5 @@
                                    CALL trc_rst_opn  ( kt )       ! Open tracer restart file 
          IF( lrst_trc )            CALL trc_rst_cal  ( kt, 'WRITE' )   ! calendar
-         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_wri      ( kt )       ! output of passive tracers with iom I/O manager
                                    CALL trc_sms      ( kt )       ! tracers: sinks and sources
                                    CALL trc_trp      ( kt )       ! transport of passive tracers
Index: branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/NEMO/TOP_SRC/trcwri.F90
===================================================================
--- branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/NEMO/TOP_SRC/trcwri.F90	(revision 7383)
+++ branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/NEMO/TOP_SRC/trcwri.F90	(revision 7391)
@@ -19,5 +19,6 @@
    USE trcwri_pisces
    USE trcwri_cfc
-   USE trcwri_c14b
+   USE trcwri_c14
+   USE trcwri_age
    USE trcwri_my_trc
 
@@ -53,8 +54,9 @@
       ! write the tracer concentrations in the file
       ! ---------------------------------------
-      IF( lk_pisces  )   CALL trc_wri_pisces     ! PISCES 
-      IF( lk_cfc     )   CALL trc_wri_cfc        ! surface fluxes of CFC
-      IF( lk_c14b    )   CALL trc_wri_c14b       ! surface fluxes of C14
-      IF( lk_my_trc  )   CALL trc_wri_my_trc     ! MY_TRC  tracers
+      IF( ln_pisces  )   CALL trc_wri_pisces     ! PISCES 
+      IF( ll_cfc     )   CALL trc_wri_cfc        ! surface fluxes of CFC
+      IF( ln_c14     )   CALL trc_wri_c14        ! surface fluxes of C14
+      IF( ln_age     )   CALL trc_wri_age        ! AGE tracer
+      IF( ln_my_trc  )   CALL trc_wri_my_trc     ! MY_TRC  tracers
       !
       IF( nn_timing == 1 )  CALL timing_stop('trc_wri')
Index: branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/SETTE/sette.sh
===================================================================
--- branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/SETTE/sette.sh	(revision 7383)
+++ branches/2016/dev_INGV_METO_merge_2016/NEMOGCM/SETTE/sette.sh	(revision 7391)
@@ -306,5 +306,4 @@
 #   set_namelist namelist_cfg nn_solv 2
     set_namelist namelist_top_cfg ln_trcdta .false.
-    set_namelist namelist_top_cfg ln_diatrc .false.
     # put ln_ironsed, ln_river, ln_ndepo, ln_dust to false
     # if not you need input files, and for tests is not necessary
@@ -316,4 +315,5 @@
     set_namelist namelist_pisces_cfg ln_ndepo .false.
     set_namelist namelist_pisces_cfg ln_ironsed .false.
+    set_namelist namelist_pisces_cfg ln_ironice .false.
     set_namelist namelist_pisces_cfg ln_hydrofe .false.
     if [ ${USING_MPMD} == "yes" ] ; then
@@ -341,5 +341,4 @@
     set_namelist namelist_cfg jpnij 8
 #   set_namelist namelist_cfg nn_solv 2
-    set_namelist namelist_top_cfg ln_diatrc .false.
     set_namelist namelist_top_cfg ln_rsttr .true.
     set_namelist namelist_top_cfg nn_rsttr 2
@@ -356,4 +355,5 @@
     set_namelist namelist_pisces_cfg ln_ndepo .false.
     set_namelist namelist_pisces_cfg ln_ironsed .false.
+    set_namelist namelist_pisces_cfg ln_ironice .false.
     set_namelist namelist_pisces_cfg ln_hydrofe .false.
     # put ln_pisdmp to false : no restoring to global mean value
@@ -400,5 +400,4 @@
 #   set_namelist namelist_cfg nn_solv 2
     set_namelist namelist_top_cfg ln_trcdta .false.
-    set_namelist namelist_top_cfg ln_diatrc .false.
     # put ln_ironsed, ln_river, ln_ndepo, ln_dust to false
     # if not you need input files, and for tests is not necessary
@@ -410,4 +409,5 @@
     set_namelist namelist_pisces_cfg ln_ndepo .false.
     set_namelist namelist_pisces_cfg ln_ironsed .false.
+    set_namelist namelist_pisces_cfg ln_ironice .false.
     set_namelist namelist_pisces_cfg ln_hydrofe .false.
     # put ln_pisdmp to false : no restoring to global mean value
@@ -439,5 +439,4 @@
 #   set_namelist namelist_cfg nn_solv 2
     set_namelist namelist_top_cfg ln_trcdta .false.
-    set_namelist namelist_top_cfg ln_diatrc .false.
     # put ln_ironsed, ln_river, ln_ndepo, ln_dust to false
     # if not you need input files, and for tests is not necessary
@@ -449,4 +448,5 @@
     set_namelist namelist_pisces_cfg ln_ndepo .false.
     set_namelist namelist_pisces_cfg ln_ironsed .false.
+    set_namelist namelist_pisces_cfg ln_ironice .false.
     set_namelist namelist_pisces_cfg ln_hydrofe .false.
     # put ln_pisdmp to false : no restoring to global mean value
@@ -486,5 +486,4 @@
     set_namelist namelist_cfg jpnij 8
     set_namelist namelist_top_cfg ln_trcdta .false.
-    set_namelist namelist_top_cfg ln_diatrc .false.
     # put ln_ironsed, ln_river, ln_ndepo, ln_dust to false
     # if not you need input files, and for tests is not necessary
@@ -496,4 +495,5 @@
     set_namelist namelist_pisces_cfg ln_ndepo .false.
     set_namelist namelist_pisces_cfg ln_ironsed .false.
+    set_namelist namelist_pisces_cfg ln_ironice .false.
     set_namelist namelist_pisces_cfg ln_hydrofe .false.
     # put ln_pisdmp to false : no restoring to global mean value
@@ -519,5 +519,4 @@
     set_namelist namelist_cfg jpnj 4
     set_namelist namelist_cfg jpnij 8
-    set_namelist namelist_top_cfg ln_diatrc .false.
     set_namelist namelist_top_cfg ln_rsttr .true.
     set_namelist namelist_top_cfg nn_rsttr 2
@@ -537,4 +536,5 @@
     set_namelist namelist_pisces_cfg ln_ndepo .false.
     set_namelist namelist_pisces_cfg ln_ironsed .false.
+    set_namelist namelist_pisces_cfg ln_ironice .false.
     set_namelist namelist_pisces_cfg ln_hydrofe .false.
     # put ln_pisdmp to false : no restoring to global mean value
@@ -572,5 +572,4 @@
     set_namelist namelist_cfg jpnij 16
     set_namelist namelist_top_cfg ln_trcdta .false.
-    set_namelist namelist_top_cfg ln_diatrc .false.
     # put ln_ironsed, ln_river, ln_ndepo, ln_dust to false
     # if not you need input files, and for tests is not necessary
@@ -582,4 +581,5 @@
     set_namelist namelist_pisces_cfg ln_ndepo .false.
     set_namelist namelist_pisces_cfg ln_ironsed .false.
+    set_namelist namelist_pisces_cfg ln_ironice .false.
     set_namelist namelist_pisces_cfg ln_hydrofe .false.
     # put ln_pisdmp to false : no restoring to global mean value
@@ -610,5 +610,4 @@
     set_namelist namelist_cfg jpnij 16
     set_namelist namelist_top_cfg ln_trcdta .false.
-    set_namelist namelist_top_cfg ln_diatrc .false.
     # put ln_ironsed, ln_river, ln_ndepo, ln_dust to false
     # if not you need input files, and for tests is not necessary
@@ -620,4 +619,5 @@
     set_namelist namelist_pisces_cfg ln_ndepo .false.
     set_namelist namelist_pisces_cfg ln_ironsed .false.
+    set_namelist namelist_pisces_cfg ln_ironice .false.
     set_namelist namelist_pisces_cfg ln_hydrofe .false.
     # put ln_pisdmp to false : no restoring to global mean value
