Index: /branches/2017/nemo_v3_6_STABLE_trdtrc/NEMOGCM/CONFIG/SHARED/field_def.xml
===================================================================
--- /branches/2017/nemo_v3_6_STABLE_trdtrc/NEMOGCM/CONFIG/SHARED/field_def.xml	(revision 8470)
+++ /branches/2017/nemo_v3_6_STABLE_trdtrc/NEMOGCM/CONFIG/SHARED/field_def.xml	(revision 8471)
@@ -1,3 +1,6 @@
 <!--
+< GO6.0 version of the XIOS namelist >
+< XIOS2 version namelist >
+
 <?xml version="1.0"?>
        -->
@@ -1001,6 +1004,8 @@
        <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 >
+       <!-- CFC12 : variables available with key_cfc -->
        <field id="CFC12"       long_name="CFC-12 Concentration"                     unit="umol/m3" />
        <field id="CFC12_E3T"   long_name="CFC12 * E3T"                              unit="umol/m2"  > CFC12 * e3t </field >
+       <!-- SF6 : variables available with key_cfc -->
        <field id="SF6"         long_name="SF6 Concentration"                        unit="umol/m3" />
        <field id="SF6_E3T"     long_name="SF6 * E3T"                                unit="umol/m2"  > SF6 * e3t </field >
@@ -1140,4 +1145,109 @@
        <field id="qint_C14b"   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"  />
+
+     </field_group>
+
+
+     <field_group id="ptrd_T" grid_ref="grid_T_3D">  <!-- key_trdtrc || key_trdmlx_trc -->
+       <!-- CFC11 : variables available with key_cfc -->
+       <field id="XAD_CFC11"       long_name="CFC-11 Concentration"                     unit="umol/m3/s" />
+       <field id="YAD_CFC11"       long_name="CFC-11 Concentration"                     unit="umol/m3/s" />
+       <field id="ZAD_CFC11"       long_name="CFC-11 Concentration"                     unit="umol/m3/s" />
+       <field id="TAD_CFC11"       long_name="CFC-11 Concentration"                     unit="umol/m3/s" />
+       <field id="TAD_CFC11_E3T"   long_name="TAD_CFC11 * E3T"                          unit="umol/m2/s" > TAD_CFC11 * e3t </field>
+       <field id="LDF_CFC11"       long_name="CFC-11 Concentration"                     unit="umol/m3/s" />
+       <field id="BBL_CFC11"       long_name="CFC-11 Concentration"                     unit="umol/m3/s" />
+       <field id="FOR_CFC11"       long_name="CFC-11 Concentration"                     unit="umol/m3/s" />
+       <field id="ZDF_CFC11"       long_name="CFC-11 Concentration"                     unit="umol/m3/s" />
+       <field id="ZDP_CFC11"       long_name="CFC-11 Concentration"                     unit="umol/m3/s" />
+       <field id="DMP_CFC11"       long_name="CFC-11 Concentration"                     unit="umol/m3/s" />
+       <field id="SMS_CFC11"       long_name="CFC-11 Concentration"                     unit="umol/m3/s" />
+       <field id="SMS_CFC11_E3T"   long_name="SMS_CFC11 * E3T"                          unit="umol/m2/s" > SMS_CFC11 * e3t </field>
+       <field id="ATF_CFC11"       long_name="CFC-11 Concentration"                     unit="umol/m3/s" />
+       <field id="RDB_CFC11"       long_name="CFC-11 Concentration"                     unit="umol/m3/s" />
+       <field id="RDN_CFC11"       long_name="CFC-11 Concentration"                     unit="umol/m3/s" />
+       <field id="TOT_CFC11"       long_name="CFC-11 Concentration"                     unit="umol/m3/s" />
+       <field id="TOT_CFC11_E3T"   long_name="TOT_CFC11 * E3T"                          unit="umol/m2/s" > TOT_CFC11 * e3t </field>
+       <field id="ISO_CFC11"       long_name="CFC-11 Concentration"                     unit="umol/m3/s" > LDF_CFC11 + ZDF_CFC11 - ZDP_CFC11 </field>  
+       <!-- CFC12 : variables available with key_cfc -->
+       <field id="XAD_CFC12"       long_name="CFC-12 Concentration"                     unit="umol/m3/s" />
+       <field id="YAD_CFC12"       long_name="CFC-12 Concentration"                     unit="umol/m3/s" />
+       <field id="ZAD_CFC12"       long_name="CFC-12 Concentration"                     unit="umol/m3/s" />
+       <field id="TAD_CFC12"       long_name="CFC-12 Concentration"                     unit="umol/m3/s" />
+       <field id="TAD_CFC12_E3T"   long_name="TAD_CFC12 * E3T"                          unit="umol/m2/s" > TAD_CFC12 * e3t </field>
+       <field id="LDF_CFC12"       long_name="CFC-12 Concentration"                     unit="umol/m3/s" />
+       <field id="BBL_CFC12"       long_name="CFC-12 Concentration"                     unit="umol/m3/s" />
+       <field id="FOR_CFC12"       long_name="CFC-12 Concentration"                     unit="umol/m3/s" />
+       <field id="ZDF_CFC12"       long_name="CFC-12 Concentration"                     unit="umol/m3/s" />
+       <field id="ZDP_CFC12"       long_name="CFC-12 Concentration"                     unit="umol/m3/s" />
+       <field id="DMP_CFC12"       long_name="CFC-12 Concentration"                     unit="umol/m3/s" />
+       <field id="SMS_CFC12"       long_name="CFC-12 Concentration"                     unit="umol/m3/s" />
+       <field id="SMS_CFC12_E3T"   long_name="SMS_CFC12 * E3T"                          unit="umol/m2/s" > SMS_CFC12 * e3t </field>
+       <field id="ATF_CFC12"       long_name="CFC-12 Concentration"                     unit="umol/m3/s" />
+       <field id="RDB_CFC12"       long_name="CFC-12 Concentration"                     unit="umol/m3/s" />
+       <field id="RDN_CFC12"       long_name="CFC-12 Concentration"                     unit="umol/m3/s" />
+       <field id="TOT_CFC12"       long_name="CFC-12 Concentration"                     unit="umol/m3/s" /> 
+       <field id="TOT_CFC12_E3T"   long_name="TOT_CFC12 * E3T"                          unit="umol/m2/s" > TOT_CFC12 * e3t </field>
+       <field id="ISO_CFC12"       long_name="CFC-12 Concentration"                     unit="umol/m3/s" > LDF_CFC12 + ZDF_CFC12 - ZDP_CFC12 </field>
+       <!-- SF6 : variables available with key_cfc -->
+       <field id="XAD_SF6"         long_name="SF6 Concentration"                        unit="umol/m3/s" />
+       <field id="YAD_SF6"         long_name="SF6 Concentration"                        unit="umol/m3/s" />
+       <field id="ZAD_SF6"         long_name="SF6 Concentration"                        unit="umol/m3/s" />
+       <field id="TAD_SF6"         long_name="SF6 Concentration"                        unit="umol/m3/s" />
+       <field id="TAD_SF6_E3T"     long_name="TAD_SF6 * E3T"                            unit="umol/m2/s" > TAD_SF6 * e3t </field>
+       <field id="LDF_SF6"         long_name="SF6 Concentration"                        unit="umol/m3/s" />
+       <field id="BBL_SF6"         long_name="SF6 Concentration"                        unit="umol/m3/s" />
+       <field id="FOR_SF6"         long_name="SF6 Concentration"                        unit="umol/m3/s" />
+       <field id="ZDF_SF6"         long_name="SF6 Concentration"                        unit="umol/m3/s" />
+       <field id="ZDP_SF6"         long_name="SF6 Concentration"                        unit="umol/m3/s" />
+       <field id="DMP_SF6"         long_name="SF6 Concentration"                        unit="umol/m3/s" />
+       <field id="SMS_SF6"         long_name="SF6 Concentration"                        unit="umol/m3/s" />
+       <field id="SMS_SF6_E3T"     long_name="SMS_SF6 * E3T"                            unit="umol/m2/s" > SMS_SF6 * e3t </field>
+       <field id="ATF_SF6"         long_name="SF6 Concentration"                        unit="umol/m3/s" />
+       <field id="RDB_SF6"         long_name="SF6 Concentration"                        unit="umol/m3/s" />
+       <field id="RDN_SF6"         long_name="SF6 Concentration"                        unit="umol/m3/s" />
+       <field id="TOT_SF6"         long_name="SF6 Concentration"                        unit="umol/m3/s" />
+       <field id="TOT_SF6_E3T"     long_name="TOT_SF6 * E3T"                            unit="umol/m2/s" > TOT_SF6 * e3t </field>
+       <field id="ISO_SF6"         long_name="SF6 Concentration"                        unit="umol/m3/s" > LDF_SF6 + ZDF_SF6 - ZDP_SF6 </field>
+       <!-- Bomb C14 : variables available with key_c14b -->
+       <field id="XAD_C14B"        long_name="Bomb C14 Concentration"                   unit="1/s"         />
+       <field id="YAD_C14B"        long_name="Bomb C14 Concentration"                   unit="1/s"         />
+       <field id="ZAD_C14B"        long_name="Bomb C14 Concentration"                   unit="1/s"         />
+       <field id="TAD_C14B"        long_name="Bomb C14 Concentration"                   unit="1/s"         />
+       <field id="TAD_C14B_E3T"    long_name="TAD_C14B * E3T"                           unit="1/s" > TAD_C14B * e3t </field>
+       <field id="LDF_C14B"        long_name="Bomb C14 Concentration"                   unit="1/s"         />
+       <field id="BBL_C14B"        long_name="Bomb C14 Concentration"                   unit="1/s"         />
+       <field id="FOR_C14B"        long_name="Bomb C14 Concentration"                   unit="1/s"         />
+       <field id="ZDF_C14B"        long_name="Bomb C14 Concentration"                   unit="1/s"         />
+       <field id="ZDP_C14B"        long_name="Bomb C14 Concentration"                   unit="1/s"         />
+       <field id="DMP_C14B"        long_name="Bomb C14 Concentration"                   unit="1/s"         />
+       <field id="SMS_C14B"        long_name="Bomb C14 Concentration"                   unit="1/s"         />
+       <field id="SMS_C14B_E3T"    long_name="SMS_C14B * E3T"                           unit="1/s" > SMS_C14B * e3t </field>
+       <field id="ATF_C14B"        long_name="Bomb C14 Concentration"                   unit="1/s"         />
+       <field id="RDB_C14B"        long_name="Bomb C14 Concentration"                   unit="1/s"         />
+       <field id="RDN_C14B"        long_name="Bomb C14 Concentration"                   unit="1/s"         />
+       <field id="TOT_C14B"        long_name="Bomb C14 Concentration"                   unit="1/s"         />
+       <field id="TOT_C14B_E3T"    long_name="TOT_C14B * E3T"                           unit="1/s" > TOT_C14B * e3t </field>
+       <field id="ISO_C14B"        long_name="Bomb C14 Concentration"                   unit="1/s"        > LDF_C14B + ZDF_C14B - ZDP_C14B </field>
+       <!-- AGE : variables available with key_age -->
+       <field id="XAD_Age"        long_name="Sea Water Age Since Surface contact" standard_name="sea_water_age_since_surface_contact"  unit="yr/s"         />
+       <field id="YAD_Age"        long_name="Sea Water Age Since Surface contact" standard_name="sea_water_age_since_surface_contact"  unit="yr/s"         />
+       <field id="ZAD_Age"        long_name="Sea Water Age Since Surface contact" standard_name="sea_water_age_since_surface_contact"  unit="yr/s"         />
+       <field id="TAD_Age"        long_name="Sea Water Age Since Surface contact" standard_name="sea_water_age_since_surface_contact"  unit="yr/s"         />
+       <field id="TAD_Age_E3T"    long_name="TAD_Age * E3T"                                     unit="yr/s" > TAD_Age * e3t </field>
+       <field id="LDF_Age"        long_name="Sea Water Age Since Surface contact" standard_name="sea_water_age_since_surface_contact"  unit="yr/s"         />
+       <field id="BBL_Age"        long_name="Sea Water Age Since Surface contact" standard_name="sea_water_age_since_surface_contact"  unit="yr/s"         />
+       <field id="FOR_Age"        long_name="Sea Water Age Since Surface contact" standard_name="sea_water_age_since_surface_contact"  unit="yr/s"         />
+       <field id="ZDF_Age"        long_name="Sea Water Age Since Surface contact" standard_name="sea_water_age_since_surface_contact"  unit="yr/s"         />
+       <field id="ZDP_Age"        long_name="Sea Water Age Since Surface contact" standard_name="sea_water_age_since_surface_contact"  unit="yr/s"         />
+       <field id="DMP_Age"        long_name="Sea Water Age Since Surface contact" standard_name="sea_water_age_since_surface_contact"  unit="yr/s"         />
+       <field id="SMS_Age"        long_name="Sea Water Age Since Surface contact" standard_name="sea_water_age_since_surface_contact"  unit="yr/s"         />
+       <field id="SMS_Age_E3T"    long_name="SMS_Age * E3T"                                     unit="yr/s" > SMS_Age * e3t </field>
+       <field id="ATF_Age"        long_name="Sea Water Age Since Surface contact" standard_name="sea_water_age_since_surface_contact"  unit="yr/s"         />
+       <field id="RDB_Age"        long_name="Sea Water Age Since Surface contact" standard_name="sea_water_age_since_surface_contact"  unit="yr/s"         />
+       <field id="RDN_Age"        long_name="Sea Water Age Since Surface contact" standard_name="sea_water_age_since_surface_contact"  unit="yr/s"         />
+       <field id="TOT_Age"        long_name="Sea Water Age Since Surface contact" standard_name="sea_water_age_since_surface_contact"  unit="yr/s"         />
+       <field id="TOT_Age_E3T"    long_name="TOT_Age * E3T"                                     unit="yr/s" > TOT_Age * e3t </field>
+       <field id="ISO_Age"        long_name="Sea Water Age Since Surface contact" standard_name="sea_water_age_since_surface_contact"  unit="yr/s"  > LDF_Age + ZDF_Age - ZDP_Age  </field>
      </field_group>
 
@@ -1162,17 +1272,182 @@
     -->
 
-     <field_group id="TRD" >
-          <field field_ref="ttrd_totad_li"   name="opottempadvect"  />
-          <field field_ref="ttrd_iso_li"     name="opottemppmdiff"  />
-          <field field_ref="ttrd_zdfp_li"    name="opottempdiff"  />
-          <field field_ref="ttrd_evd_li"     name="opottempevd" />
-          <field field_ref="strd_evd_li"     name="osaltevd" />
-          <field field_ref="ttrd_qns_li"     name="opottempqns"  />
-          <field field_ref="ttrd_qsr_li"     name="rsdoabsorb" operation="accumulate" />
-          <field field_ref="strd_totad_li"   name="osaltadvect" />
-          <field field_ref="strd_iso_li"     name="osaltpmdiff"  />
-          <field field_ref="strd_zdfp_li"    name="osaltdiff" />
+    <field_group id="groupCFC" >
+      <field field_ref="CFC11"     name="CFC11"     />
+      <field field_ref="CFC11_E3T" name="CFC11_E3T" />
+      <field field_ref="CFC12"     name="CFC12"     />
+      <field field_ref="CFC12_E3T" name="CFC12_E3T" />
+      <field field_ref="SF6"       name="SF6"       />
+      <field field_ref="SF6_E3T"   name="SF6_E3T"   />
     </field_group>
-    
+
+    <field_group id="groupCFC_dia" >
+      <field field_ref="qtrCFC11"    name="qtrCFC11"   />
+      <field field_ref="qintCFC11"   name="qintCFC11"  />
+      <field field_ref="qtrCFC12"    name="qtrCFC12"   />
+      <field field_ref="qintCFC12"   name="qintCFC12"  />
+      <field field_ref="qtrSF6"      name="qtrSF6"     />
+      <field field_ref="qintSF6"     name="qintSF6"    />
+    </field_group>
+
+    <field_group id="groupAGE" >
+      <field field_ref="Age" name="Age" />
+    </field_group>
+
+    <field_group id="trendCFC11" >
+          <!-- cfc11 -->
+          <field field_ref="TOT_CFC11"     name="TOT_CFC11"     standard_name="CFC-11_Concentration"                  />
+          <field field_ref="TOT_CFC11_E3T" name="TOT_CFC11_E3T" standard_name="CFC-11_Concentration"                  />
+          <field field_ref="XAD_CFC11"     name="XAD_CFC11"     standard_name="CFC-11_Concentration"                  />
+          <field field_ref="YAD_CFC11"     name="YAD_CFC11"     standard_name="CFC-11_Concentration"                  />
+          <field field_ref="ZAD_CFC11"     name="ZAD_CFC11"     standard_name="CFC-11_Concentration"                  />
+          <field field_ref="TAD_CFC11"     name="TAD_CFC11"     standard_name="CFC-11_Concentration"                  />
+          <field field_ref="TAD_CFC11_E3T" name="TAD_CFC11_E3T" standard_name="CFC-11_Concentration"                  />
+          <field field_ref="LDF_CFC11"     name="LDF_CFC11"     standard_name="CFC-11_Concentration"                  />
+          <field field_ref="BBL_CFC11"     name="BBL_CFC11"     standard_name="CFC-11_Concentration"                  />
+          <field field_ref="FOR_CFC11"     name="FOR_CFC11"     standard_name="CFC-11_Concentration"                  />
+          <field field_ref="ZDF_CFC11"     name="ZDF_CFC11"     standard_name="CFC-11_Concentration"                  />
+          <field field_ref="ZDP_CFC11"     name="ZDP_CFC11"     standard_name="CFC-11_Concentration"                  />
+          <field field_ref="DMP_CFC11"     name="DMP_CFC11"     standard_name="CFC-11_Concentration"                  />
+          <field field_ref="SMS_CFC11"     name="SMS_CFC11"     standard_name="CFC-11_Concentration"                  />
+          <field field_ref="SMS_CFC11_E3T" name="SMS_CFC11_E3T" standard_name="CFC-11_Concentration"                  />
+          <field field_ref="ATF_CFC11"     name="ATF_CFC11"     standard_name="CFC-11_Concentration"                  />
+          <field field_ref="ISO_CFC11"     name="ISO_CFC11"     standard_name="CFC-11_Concentration"                  />
+   </field_group>
+
+    <field_group id="trendCFC12" >
+          <!-- cfc12 -->
+          <field field_ref="TOT_CFC12"     name="TOT_CFC12"     standard_name="CFC-12_Concentration"                  />
+          <field field_ref="TOT_CFC12_E3T" name="TOT_CFC12_E3T" standard_name="CFC-12_Concentration"                  />
+          <field field_ref="XAD_CFC12"     name="XAD_CFC12"     standard_name="CFC-12_Concentration"                  />
+          <field field_ref="YAD_CFC12"     name="YAD_CFC12"     standard_name="CFC-12_Concentration"                  />
+          <field field_ref="ZAD_CFC12"     name="ZAD_CFC12"     standard_name="CFC-12_Concentration"                  />
+          <field field_ref="TAD_CFC12"     name="TAD_CFC12"     standard_name="CFC-12_Concentration"                  />
+          <field field_ref="TAD_CFC12_E3T" name="TAD_CFC12_E3T" standard_name="CFC-12_Concentration"                  />
+          <field field_ref="LDF_CFC12"     name="LDF_CFC12"     standard_name="CFC-12_Concentration"                  />
+          <field field_ref="BBL_CFC12"     name="BBL_CFC12"     standard_name="CFC-12_Concentration"                  />
+          <field field_ref="FOR_CFC12"     name="FOR_CFC12"     standard_name="CFC-12_Concentration"                  />
+          <field field_ref="ZDF_CFC12"     name="ZDF_CFC12"     standard_name="CFC-12_Concentration"                  />
+          <field field_ref="ZDP_CFC12"     name="ZDP_CFC12"     standard_name="CFC-12_Concentration"                  />
+          <field field_ref="DMP_CFC12"     name="DMP_CFC12"     standard_name="CFC-12_Concentration"                  />
+          <field field_ref="SMS_CFC12"     name="SMS_CFC12"     standard_name="CFC-12_Concentration"                  />
+          <field field_ref="SMS_CFC12_E3T" name="SMS_CFC12_E3T" standard_name="CFC-12_Concentration"                  />
+          <field field_ref="ATF_CFC12"     name="ATF_CFC12"     standard_name="CFC-12_Concentration"                  />
+          <field field_ref="ISO_CFC12"     name="ISO_CFC12"     standard_name="CFC-12_Concentration"                  />
+   </field_group>
+
+    <field_group id="trendSF6" >
+          <!-- sf6 -->
+          <field field_ref="TOT_SF6"      name="TOT_SF6"      standard_name="SF6_Concentration"                     />
+          <field field_ref="TOT_SF6_E3T"  name="TOT_SF6_E3T"  standard_name="SF6_Concentration"                     />
+          <field field_ref="XAD_SF6"      name="XAD_SF6"      standard_name="SF6_Concentration"                     />
+          <field field_ref="YAD_SF6"      name="YAD_SF6"      standard_name="SF6_Concentration"                     />
+          <field field_ref="ZAD_SF6"      name="ZAD_SF6"      standard_name="SF6_Concentration"                     />
+          <field field_ref="TAD_SF6"      name="TAD_SF6"      standard_name="SF6_Concentration"                     />
+          <field field_ref="TAD_SF6_E3T"  name="TAD_SF6_E3T"  standard_name="SF6_Concentration"                     />
+          <field field_ref="LDF_SF6"      name="LDF_SF6"      standard_name="SF6_Concentration"                     />
+          <field field_ref="BBL_SF6"      name="BBL_SF6"      standard_name="SF6_Concentration"                     />
+          <field field_ref="FOR_SF6"      name="FOR_SF6"      standard_name="SF6_Concentration"                     />
+          <field field_ref="ZDF_SF6"      name="ZDF_SF6"      standard_name="SF6_Concentration"                     />
+          <field field_ref="ZDP_SF6"      name="ZDP_SF6"      standard_name="SF6_Concentration"                     />
+          <field field_ref="DMP_SF6"      name="DMP_SF6"      standard_name="SF6_Concentration"                     />
+          <field field_ref="SMS_SF6"      name="SMS_SF6"      standard_name="SF6_Concentration"                     />
+          <field field_ref="SMS_SF6_E3T"  name="SMS_SF6_E3T"  standard_name="SF6_Concentration"                     />
+          <field field_ref="ATF_SF6"      name="ATF_SF6"      standard_name="SF6_Concentration"                     />
+          <field field_ref="ISO_SF6"      name="ISO_SF6"      standard_name="SF6_Concentration"                     />
+   </field_group>
+
+    <field_group id="trendAGE" >
+          <!-- age -->
+          <field field_ref="TOT_Age"      name="TOT_Age"      standard_name="sea_water_age_since_surface_contact"   />
+          <field field_ref="TOT_Age_E3T"  name="TOT_Age_E3T"  standard_name="sea_water_age_since_surface_contact"   />
+          <field field_ref="XAD_Age"      name="XAD_Age"      standard_name="sea_water_age_since_surface_contact"   />
+          <field field_ref="YAD_Age"      name="YAD_Age"      standard_name="sea_water_age_since_surface_contact"   />
+          <field field_ref="ZAD_Age"      name="ZAD_Age"      standard_name="sea_water_age_since_surface_contact"   />
+          <field field_ref="TAD_Age"      name="TAD_Age"      standard_name="sea_water_age_since_surface_contact"   />
+          <field field_ref="TAD_Age_E3T"  name="TAD_Age_E3T"  standard_name="sea_water_age_since_surface_contact"   />
+          <field field_ref="LDF_Age"      name="LDF_Age"      standard_name="sea_water_age_since_surface_contact"   />
+          <field field_ref="BBL_Age"      name="BBL_Age"      standard_name="sea_water_age_since_surface_contact"   />
+          <field field_ref="FOR_Age"      name="FOR_Age"      standard_name="sea_water_age_since_surface_contact"   />
+          <field field_ref="ZDF_Age"      name="ZDF_Age"      standard_name="sea_water_age_since_surface_contact"   />
+          <field field_ref="ZDP_Age"      name="ZDP_Age"      standard_name="sea_water_age_since_surface_contact"   />
+          <field field_ref="DMP_Age"      name="DMP_Age"      standard_name="sea_water_age_since_surface_contact"   />
+          <field field_ref="SMS_Age"      name="SMS_Age"      standard_name="sea_water_age_since_surface_contact"   />
+          <field field_ref="SMS_Age_E3T"  name="SMS_Age_E3T"  standard_name="sea_water_age_since_surface_contact"   />
+          <field field_ref="ATF_Age"      name="ATF_Age"      standard_name="sea_water_age_since_surface_contact"   />
+          <field field_ref="ISO_Age"      name="ISO_Age"      standard_name="sea_water_age_since_surface_contact"   />
+   </field_group>
+
+    <field_group id="trendC14B" >
+          <!-- c14 bomb -->
+          <field field_ref="TOT_C14B"      name="TOT_C14B"      standard_name="C14b_Concentration"               />
+          <field field_ref="TOT_C14B_E3T"  name="TOT_C14B_E3T"  standard_name="C14b_Concentration"               />
+          <field field_ref="XAD_C14B"      name="XAD_C14B"      standard_name="C14b_Concentration"               />
+          <field field_ref="YAD_C14B"      name="YAD_C14B"      standard_name="C14b_Concentration"               />
+          <field field_ref="ZAD_C14B"      name="ZAD_C14B"      standard_name="C14b_Concentration"               />
+          <field field_ref="TAD_C14B"      name="TAD_C14B"      standard_name="C14b_Concentration"               />
+          <field field_ref="TAD_C14B_E3T"  name="TAD_C14B_E3T"  standard_name="C14b_Concentration"               />
+          <field field_ref="LDF_C14B"      name="LDF_C14B"      standard_name="C14b_Concentration"               />
+          <field field_ref="BBL_C14B"      name="BBL_C14B"      standard_name="C14b_Concentration"               />
+          <field field_ref="FOR_C14B"      name="FOR_C14B"      standard_name="C14b_Concentration"               />
+          <field field_ref="ZDF_C14B"      name="ZDF_C14B"      standard_name="C14b_Concentration"               />
+          <field field_ref="ZDP_C14B"      name="ZDP_C14B"      standard_name="C14b_Concentration"               />
+          <field field_ref="DMP_C14B"      name="DMP_C14B"      standard_name="C14b_Concentration"               />
+          <field field_ref="SMS_C14B"      name="SMS_C14B"      standard_name="C14b_Concentration"               />
+          <field field_ref="SMS_C14B_E3T"  name="SMS_C14B_E3T"  standard_name="C14b_Concentration"               />
+          <field field_ref="ATF_C14B"      name="ATF_C14B"      standard_name="C14b_Concentration"               />
+          <field field_ref="ISO_C14B"      name="ISO_C14B"      standard_name="C14b_Concentration"               />
+   </field_group>
+
+    <field_group id="trendCFC11_short" >
+          <!-- cfc11 -->
+          <field field_ref="TOT_CFC11"     name="TOT_CFC11"     standard_name="CFC-11_Concentration"                  />
+          <field field_ref="TOT_CFC11_E3T" name="TOT_CFC11_E3T" standard_name="CFC-11_Concentration"                  />
+          <field field_ref="TAD_CFC11"     name="TAD_CFC11"     standard_name="CFC-11_Concentration"                  />
+          <field field_ref="TAD_CFC11_E3T" name="TAD_CFC11_E3T" standard_name="CFC-11_Concentration"                  />
+          <field field_ref="SMS_CFC11"     name="SMS_CFC11"     standard_name="CFC-11_Concentration"                  />
+          <field field_ref="SMS_CFC11_E3T" name="SMS_CFC11_E3T" standard_name="CFC-11_Concentration"                  />
+   </field_group>
+
+    <field_group id="trendCFC12_short" >
+          <!-- cfc12 -->
+          <field field_ref="TOT_CFC12"     name="TOT_CFC12"     standard_name="CFC-12_Concentration"                  />
+          <field field_ref="TOT_CFC12_E3T" name="TOT_CFC12_E3T" standard_name="CFC-12_Concentration"                  />
+          <field field_ref="TAD_CFC12"     name="TAD_CFC12"     standard_name="CFC-12_Concentration"                  />
+          <field field_ref="TAD_CFC12_E3T" name="TAD_CFC12_E3T" standard_name="CFC-12_Concentration"                  />
+          <field field_ref="SMS_CFC12"     name="SMS_CFC12"     standard_name="CFC-12_Concentration"                  />
+          <field field_ref="SMS_CFC12_E3T" name="SMS_CFC12_E3T" standard_name="CFC-12_Concentration"                  />
+   </field_group>
+
+    <field_group id="trendSF6_short" >
+          <!-- sf6 -->
+          <field field_ref="TOT_SF6"      name="TOT_SF6"      standard_name="SF6_Concentration"                     />
+          <field field_ref="TOT_SF6_E3T"  name="TOT_SF6_E3T"  standard_name="SF6_Concentration"                     />
+          <field field_ref="TAD_SF6"      name="TAD_SF6"      standard_name="SF6_Concentration"                     />
+          <field field_ref="TAD_SF6_E3T"  name="TAD_SF6_E3T"  standard_name="SF6_Concentration"                     />
+          <field field_ref="SMS_SF6"      name="SMS_SF6"      standard_name="SF6_Concentration"                     />
+          <field field_ref="SMS_SF6_E3T"  name="SMS_SF6_E3T"  standard_name="SF6_Concentration"                     />
+   </field_group>
+
+    <field_group id="trendAGE_short" >
+          <!-- age -->
+          <field field_ref="TOT_Age"      name="TOT_Age"      standard_name="sea_water_age_since_surface_contact"   />
+          <field field_ref="TOT_Age_E3T"  name="TOT_Age_E3T"  standard_name="sea_water_age_since_surface_contact"   />
+          <field field_ref="TAD_Age"      name="TAD_Age"      standard_name="sea_water_age_since_surface_contact"   />
+          <field field_ref="TAD_Age_E3T"  name="TAD_Age_E3T"  standard_name="sea_water_age_since_surface_contact"   />
+          <field field_ref="SMS_Age"      name="SMS_Age"      standard_name="sea_water_age_since_surface_contact"   />
+          <field field_ref="SMS_Age_E3T"  name="SMS_Age_E3T"  standard_name="sea_water_age_since_surface_contact"   />
+   </field_group>
+
+    <field_group id="trendC14B_short" >
+          <!-- c14 bomb -->
+          <field field_ref="TOT_C14B"      name="TOT_C14B"      standard_name="C14b_Concentration"               />
+          <field field_ref="TOT_C14B_E3T"  name="TOT_C14B_E3T"  standard_name="C14b_Concentration"               />
+          <field field_ref="TAD_C14B"      name="TAD_C14B"      standard_name="C14b_Concentration"               />
+          <field field_ref="TAD_C14B_E3T"  name="TAD_C14B_E3T"  standard_name="C14b_Concentration"               />
+          <field field_ref="SMS_C14B"      name="SMS_C14B"      standard_name="C14b_Concentration"               />
+          <field field_ref="SMS_C14B_E3T"  name="SMS_C14B_E3T"  standard_name="C14b_Concentration"               />
+   </field_group>
+
+
     <field_group id="mooring" >
       <field field_ref="toce"         name="thetao"   long_name="sea_water_potential_temperature"      />
Index: /branches/2017/nemo_v3_6_STABLE_trdtrc/NEMOGCM/CONFIG/SHARED/namelist_top_ref
===================================================================
--- /branches/2017/nemo_v3_6_STABLE_trdtrc/NEMOGCM/CONFIG/SHARED/namelist_top_ref	(revision 8470)
+++ /branches/2017/nemo_v3_6_STABLE_trdtrc/NEMOGCM/CONFIG/SHARED/namelist_top_ref	(revision 8471)
@@ -98,6 +98,6 @@
    nn_ctls_trc =   0        !  control surface type in mixed-layer trends (0,1 or n<jpk)
    rn_ucf_trc  =   1        !  unit conversion factor (=1 -> /seconds ; =86400. -> /day)
-   ln_trdmld_trc_restart = .false.  !  restart for ML diagnostics
-   ln_trdmld_trc_instant = .true.  !  flag to diagnose trends of instantantaneous or mean ML T/S
+   ln_trdmxl_trc_restart = .false.  !  restart for ML diagnostics
+   ln_trdmxl_trc_instant = .true.  !  flag to diagnose trends of instantantaneous or mean ML T/S
    ln_trdtrc(1)  =   .true.
    ln_trdtrc(2)  =   .true.
Index: /branches/2017/nemo_v3_6_STABLE_trdtrc/NEMOGCM/NEMO/OPA_SRC/TRD/trdtra.F90
===================================================================
--- /branches/2017/nemo_v3_6_STABLE_trdtrc/NEMOGCM/NEMO/OPA_SRC/TRD/trdtra.F90	(revision 8470)
+++ /branches/2017/nemo_v3_6_STABLE_trdtrc/NEMOGCM/NEMO/OPA_SRC/TRD/trdtra.F90	(revision 8471)
@@ -20,4 +20,5 @@
    USE trd_oce        ! trends: ocean variables
    USE trdtrc         ! ocean passive mixed layer tracers trends 
+   USE trc,           ONLY: tra    ! tracer definitions (trn, trb, tra, etc.) 
    USE trdglo         ! trends: global domain averaged
    USE trdpen         ! trends: Potential ENergy
@@ -170,4 +171,21 @@
          CASE( jptra_yad )   ;   CALL trd_tra_adv( ptrd , pun , ptra, 'Y', ztrds ) 
          CASE( jptra_zad )   ;   CALL trd_tra_adv( ptrd , pun , ptra, 'Z', ztrds ) 
+         CASE( jptra_zdfp )           ! diagnose the "PURE" Kz trend (here: just before the swap)
+            !                         ! iso-neutral diffusion case otherwise
+            !                         jptra_zdf is "PURE"
+            CALL wrk_alloc( jpi, jpj, jpk, zws )
+            !
+            zws(:,:, 1 ) = 0._wp                        ! vertical diffusive fluxes
+            zws(:,:,jpk) = 0._wp  
+            DO jk = 2, jpk
+               zws(:,:,jk) = avt(:,:,jk) * (tra(:,:,jk-1,ktra) - tra(:,:,jk,ktra) ) / fse3w(:,:,jk) * tmask(:,:,jk)
+            END DO
+            !
+            ztrds(:,:,jpk) = 0._wp   
+            DO jk = 1, jpkm1
+               ztrds(:,:,jk) = ( zws(:,:,jk) - zws(:,:,jk+1) ) / fse3t(:,:,jk)
+            END DO
+            CALL wrk_dealloc( jpi, jpj, jpk, zws )
+            !
          CASE DEFAULT                 ! other trends: just masked 
                                  ztrds(:,:,:) = ptrd(:,:,:) * tmask(:,:,:)
Index: /branches/2017/nemo_v3_6_STABLE_trdtrc/NEMOGCM/NEMO/TOP_SRC/TRP/trcnxt.F90
===================================================================
--- /branches/2017/nemo_v3_6_STABLE_trdtrc/NEMOGCM/NEMO/TOP_SRC/TRP/trcnxt.F90	(revision 8470)
+++ /branches/2017/nemo_v3_6_STABLE_trdtrc/NEMOGCM/NEMO/TOP_SRC/TRP/trcnxt.F90	(revision 8471)
@@ -27,7 +27,9 @@
    !!----------------------------------------------------------------------
    USE oce_trc         ! ocean dynamics and tracers variables
+   USE domvvl          ! variable volume  
    USE trc             ! ocean passive tracers variables
    USE lbclnk          ! ocean lateral boundary conditions (or mpp link)
    USE prtctl_trc      ! Print control for debbuging
+   USE trcnam_trp      ! passive tracers transport namelist variables
    USE trd_oce
    USE trdtra
@@ -129,5 +131,37 @@
       IF( l_trdtrc )  THEN
          CALL wrk_alloc( jpi, jpj, jpk, jptra, ztrdt )  !* store now fields before applying the Asselin filter
-         ztrdt(:,:,:,:)  = trn(:,:,:,:)
+         ztrdt(:,:,jpk,:) = 0._wp
+         IF( ln_trcldf_iso ) THEN                       ! diagnose the "pure" Kz diffusive trend 
+            DO jn = 1, jptra
+               CALL trd_tra( kt, 'TRC', jn, jptra_zdfp, ztrdt(:,:,:,jn) )
+            ENDDO
+         ENDIF
+         ! total trend for the non-time-filtered variables.
+         ! G Nurser 23 Mar 2017. Recalculate trend as Delta(e3t*T)/e3tn; e3tn
+         ! cancel from tsn terms
+         IF( lk_vvl ) THEN
+            DO jn = 1, jptra
+               DO jk = 1, jpkm1
+                  zfact = 1.0 / rdttrc(jk)
+                  ztrdt(:,:,jk,jn) = ( tra(:,:,jk,jn)*fse3t_a(:,:,jk) / fse3t_n(:,:,jk) - &
+                                       trn(:,:,jk,jn) ) * zfact
+               END DO
+            END DO
+         ELSE
+            DO jn = 1, jptra
+               DO jk = 1, jpkm1
+                  zfact = 1.0 / rdttrc(jk)
+                  ztrdt(:,:,jk,jn) = ( tra(:,:,jk,jn) - trn(:,:,jk,jn) ) * zfact
+               END DO
+            END DO
+         END IF
+         DO jn = 1, jptra
+            CALL trd_tra( kt, 'TRC', jn, jptra_tot, ztrdt(:,:,:,jn) )
+         ENDDO
+         IF( .NOT.lk_vvl )  THEN
+            ! Store now fields before applying the Asselin filter 
+            ! in order to calculate Asselin filter trend later.
+            ztrdt(:,:,:,:)  = trn(:,:,:,:)
+         ENDIF
       ENDIF
       ! Leap-Frog + Asselin filter time stepping
@@ -137,7 +171,17 @@
             DO jk = 1, jpkm1
                trn(:,:,jk,jn) = tra(:,:,jk,jn)
-               trb(:,:,jk,jn) = trn(:,:,jk,jn)  
             END DO
          END DO
+         IF (l_trdtrc.AND.lk_vvl) THEN      ! Zero Asselin filter contribution
+                                            ! must be explicitly written out since for vvl
+                                            ! Asselin filter is output by
+                                            ! tra_nxt_vvl that is not called on
+                                            ! this time step
+            ztrdt(:,:,:,:) = 0._wp
+            DO jn = 1, jptra
+               CALL trd_tra( kt, 'TRC', jn, jptra_atf, ztrdt(:,:,:,jn) )
+            ENDDO
+         END IF
+
          !                                              
       ELSE
@@ -153,14 +197,15 @@
 
       ! trends computation
-      IF( l_trdtrc ) THEN                                      ! trends
+      IF( l_trdtrc.AND..NOT.lk_vvl) THEN                                      ! trends
          DO jn = 1, jptra
             DO jk = 1, jpkm1
                zfact = 1.e0 / r2dt(jk)  
                ztrdt(:,:,jk,jn) = ( trb(:,:,jk,jn) - ztrdt(:,:,jk,jn) ) * zfact 
-               CALL trd_tra( kt, 'TRC', jn, jptra_atf, ztrdt )
-            END DO
+            END DO
+            CALL trd_tra( kt, 'TRC', jn, jptra_atf, ztrdt(:,:,:,jn) )
          END DO
-         CALL wrk_dealloc( jpi, jpj, jpk, jptra, ztrdt ) 
       END IF
+      !
+      IF( l_trdtrc)  CALL wrk_dealloc( jpi, jpj, jpk, jptra, ztrdt ) 
       !
       IF(ln_ctl)   THEN  ! print mean trends (used for debugging)
Index: /branches/2017/nemo_v3_6_STABLE_trdtrc/NEMOGCM/NEMO/TOP_SRC/TRP/trczdf.F90
===================================================================
--- /branches/2017/nemo_v3_6_STABLE_trdtrc/NEMOGCM/NEMO/TOP_SRC/TRP/trczdf.F90	(revision 8470)
+++ /branches/2017/nemo_v3_6_STABLE_trdtrc/NEMOGCM/NEMO/TOP_SRC/TRP/trczdf.F90	(revision 8471)
@@ -15,4 +15,5 @@
    !!----------------------------------------------------------------------
    USE oce_trc         ! ocean dynamics and active tracers
+   USE domvvl          ! variable volume       
    USE trc             ! ocean passive tracers variables
    USE trcnam_trp      ! passive tracers transport namelist variables
@@ -98,8 +99,21 @@
 
       IF( l_trdtrc )   THEN                      ! save the vertical diffusive trends for further diagnostics
+         !! JPALM -- 18-08-2017 -- vvl case, do as done by G Nurser in trazdf 
+         IF( lk_vvl ) THEN
+            DO jn = 1, jptra
+               DO jk = 1, jpkm1
+                  ztrtrd(:,:,jk,jn) = ( ( tra(:,:,jk,jn)*fse3t_a(:,:,jk) - &
+                                          trn(:,:,jk,jn)*fse3t_b(:,:,jk) ) &
+                                       / (fse3t_n(:,:,jk)*r2dtra(jk)) ) - ztrtrd(:,:,jk,jn)
+               END DO
+            END DO
+         ELSE
+            DO jn = 1, jptra
+               DO jk = 1, jpkm1
+                  ztrtrd(:,:,jk,jn) = ( ( tra(:,:,jk,jn) - trb(:,:,jk,jn) ) / r2dt(jk) ) - ztrtrd(:,:,jk,jn)
+               END DO
+            END DO
+         ENDIF 
          DO jn = 1, jptra
-            DO jk = 1, jpkm1
-               ztrtrd(:,:,jk,jn) = ( ( tra(:,:,jk,jn) - trb(:,:,jk,jn) ) / r2dt(jk) ) - ztrtrd(:,:,jk,jn)
-            END DO
             CALL trd_tra( kt, 'TRC', jn, jptra_zdf, ztrtrd(:,:,:,jn) )
          END DO
Index: /branches/2017/nemo_v3_6_STABLE_trdtrc/NEMOGCM/NEMO/TOP_SRC/TRP/trdtrc.F90
===================================================================
--- /branches/2017/nemo_v3_6_STABLE_trdtrc/NEMOGCM/NEMO/TOP_SRC/TRP/trdtrc.F90	(revision 8470)
+++ /branches/2017/nemo_v3_6_STABLE_trdtrc/NEMOGCM/NEMO/TOP_SRC/TRP/trdtrc.F90	(revision 8471)
@@ -19,4 +19,7 @@
    USE trdmxl_trc        ! Mixed layer trends diag.
    USE iom               ! I/O library
+# if defined key_debug_medusa
+   USE trcstat,          ONLY: trc_rst_dia_stat     
+# endif
 
    IMPLICIT NONE
@@ -86,21 +89,70 @@
 
       IF( lk_trdtrc .AND. ln_trdtrc( kjn ) ) THEN
-         !
+      !! JPALM -- 17-08-2017 -- modif following trd_tra_iom as suggested by Georges
+      !!                     -- add jptra_tot; jptra_totad; jptra_zdfp
+      !!                     -- shange to output trends every 2 time-step, except tot.
+      !!                     -- move cltra and iomput inside the select case
+      !!                     So if an non-wanted case arrives here it will not go
+      !!                     through cltra (without value) and break iomput.
+      !!                     -- Add iom_use in prevision of not using All trends
+      !!                     for All passive tracers (will create a HUGE 3D file otherwise --
+      !!                     might be interested in very few of them : SMS and TOT probably)
+         !
+         SELECT CASE( ktrd )
+         !! tot - output every time-step:
+         CASE( jptra_tot  )       ;    WRITE (cltra,'("TOT_",4a)')
+                           cltra = TRIM(cltra)//TRIM(ctrcnm(kjn))
+                           CALL trd_trc_iomput( cltra, ptrtrd, kjn, kt )
+         END SELECT
+         !
+       IF( MOD( kt, 2 ) == 0 ) THEN
          SELECT CASE( ktrd )
          CASE( jptra_xad  )       ;    WRITE (cltra,'("XAD_",4a)')
+                           cltra = TRIM(cltra)//TRIM(ctrcnm(kjn))
+                           CALL trd_trc_iomput( cltra, ptrtrd, kjn, kt )
          CASE( jptra_yad  )       ;    WRITE (cltra,'("YAD_",4a)')
-         CASE( jptra_zad  )       ;    WRITE (cltra,'("ZAD_",4a)')
+                           cltra = TRIM(cltra)//TRIM(ctrcnm(kjn))
+                           CALL trd_trc_iomput( cltra, ptrtrd, kjn, kt )
+         CASE( jptra_zad  )       ;    WRITE (cltra,'("ZAD_",4a)')      !! care vvl case
+                           cltra = TRIM(cltra)//TRIM(ctrcnm(kjn))
+                           CALL trd_trc_iomput( cltra, ptrtrd, kjn, kt )
+         CASE( jptra_totad  )     ;    WRITE (cltra,'("TAD_",4a)')      !! total adv
+                           cltra = TRIM(cltra)//TRIM(ctrcnm(kjn))
+                           CALL trd_trc_iomput( cltra, ptrtrd, kjn, kt )
          CASE( jptra_ldf  )       ;    WRITE (cltra,'("LDF_",4a)')
+                           cltra = TRIM(cltra)//TRIM(ctrcnm(kjn))
+                           CALL trd_trc_iomput( cltra, ptrtrd, kjn, kt )
          CASE( jptra_bbl  )       ;    WRITE (cltra,'("BBL_",4a)')
+                           cltra = TRIM(cltra)//TRIM(ctrcnm(kjn))
+                           CALL trd_trc_iomput( cltra, ptrtrd, kjn, kt )
          CASE( jptra_nsr  )       ;    WRITE (cltra,'("FOR_",4a)')
+                           cltra = TRIM(cltra)//TRIM(ctrcnm(kjn))
+                           CALL trd_trc_iomput( cltra, ptrtrd, kjn, kt )
          CASE( jptra_zdf  )       ;    WRITE (cltra,'("ZDF_",4a)')
+                           cltra = TRIM(cltra)//TRIM(ctrcnm(kjn))
+                           CALL trd_trc_iomput( cltra, ptrtrd, kjn, kt )
+         CASE( jptra_zdfp )       ;    WRITE (cltra,'("ZDP_",4a)')
+                           cltra = TRIM(cltra)//TRIM(ctrcnm(kjn))
+                           CALL trd_trc_iomput( cltra, ptrtrd, kjn, kt )
          CASE( jptra_dmp  )       ;    WRITE (cltra,'("DMP_",4a)')
+                           cltra = TRIM(cltra)//TRIM(ctrcnm(kjn))
+                           CALL trd_trc_iomput( cltra, ptrtrd, kjn, kt )
          CASE( jptra_sms  )       ;    WRITE (cltra,'("SMS_",4a)')
+                           cltra = TRIM(cltra)//TRIM(ctrcnm(kjn))
+                           CALL trd_trc_iomput( cltra, ptrtrd, kjn, kt )
+         CASE( jptra_radb )       ;    WRITE (cltra,'("RDB_",4a)')
+                           cltra = TRIM(cltra)//TRIM(ctrcnm(kjn))
+                           CALL trd_trc_iomput( cltra, ptrtrd, kjn, kt )
+         CASE( jptra_radn )       ;    WRITE (cltra,'("RDN_",4a)')
+                           cltra = TRIM(cltra)//TRIM(ctrcnm(kjn))
+                           CALL trd_trc_iomput( cltra, ptrtrd, kjn, kt )
+         END SELECT
+       ELSE IF( MOD( kt, 2 ) == 1 ) THEN
+         SELECT CASE( ktrd )
          CASE( jptra_atf  )       ;    WRITE (cltra,'("ATF_",4a)')
-         CASE( jptra_radb )       ;    WRITE (cltra,'("RDB_",4a)')
-         CASE( jptra_radn )       ;    WRITE (cltra,'("RDN_",4a)')
-         END SELECT
-                                          cltra = TRIM(cltra)//TRIM(ctrcnm(kjn))
-                                          CALL iom_put( cltra,  ptrtrd(:,:,:) )
+                           cltra = TRIM(cltra)//TRIM(ctrcnm(kjn))
+                           CALL trd_trc_iomput( cltra, ptrtrd, kjn, kt )
+         END SELECT
+       END IF
          !
       END IF
@@ -123,4 +175,33 @@
 
    END SUBROUTINE trd_trc_bio
+
+   SUBROUTINE trd_trc_iomput( cltra, ptrtrd, kjn, kt )
+      !!----------------------------------------------------------------------
+      !!                  ***  ROUTINE trd_trc_iomput  ***
+      !!----------------------------------------------------------------------
+      INTEGER, INTENT( in )  ::   kt                                  ! timestep
+      INTEGER, INTENT( in )  ::   kjn                                 ! biotrend index
+      REAL(wp), DIMENSION(jpi,jpj,jpk), INTENT( inout )  ::   ptrtrd  ! var trend
+      CHARACTER (len=*),INTENT( in ) :: cltra                         ! trend name
+      !!----------------------------------------------------------------------
+
+
+      IF  (iom_use(cltra)) THEN
+# if defined key_debug_medusa
+         IF(lwp) WRITE(numout,*) ' TREND stats (min, max,sum) kt = ',kt ,' jn = ',kjn
+         CALL trc_rst_dia_stat( ptrtrd(:,:,1), cltra)
+# endif
+         CALL iom_put( cltra,  ptrtrd(:,:,:) )
+# if defined key_debug_medusa
+      ELSE
+         IF(lwp) WRITE(numout,*) &
+                      ' TREND -- No output asked for ',cltra,' kt = ',kt,' jn = ',kjn
+         CALL trc_rst_dia_stat( ptrtrd(:,:,1), cltra)
+# endif
+      ENDIF
+
+   END SUBROUTINE trd_trc_iomput
+
+
 #else
    !!----------------------------------------------------------------------
Index: /branches/2017/nemo_v3_6_STABLE_trdtrc/NEMOGCM/NEMO/TOP_SRC/trcnam.F90
===================================================================
--- /branches/2017/nemo_v3_6_STABLE_trdtrc/NEMOGCM/NEMO/TOP_SRC/trcnam.F90	(revision 8470)
+++ /branches/2017/nemo_v3_6_STABLE_trdtrc/NEMOGCM/NEMO/TOP_SRC/trcnam.F90	(revision 8471)
@@ -55,7 +55,18 @@
       !! ** Method  : - read passive tracer namelist 
       !!              - read namelist of each defined SMS model
-      !!                ( (PISCES, CFC, MY_TRC )
-      !!---------------------------------------------------------------------
-      INTEGER  ::   jn                  ! dummy loop indice
+      !!                ( (PISCES, CFC, MY_TRC, MEDUSA, IDTRA, Age )
+      !!---------------------------------------------------------------------
+      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
+
+      INTEGER  ::   jn, jk              ! dummy loop indice
+      INTEGER  ::   ios                 ! Local integer output status for namelist read
+      !!---------------------------------------------------------------------
+
+
       !                                        !   Parameters of the run 
       IF( .NOT. lk_offline ) CALL trc_nam_run
@@ -145,215 +156,4 @@
       ENDIF
 
-      !
-   END SUBROUTINE trc_nam
-
-   SUBROUTINE trc_nam_run
-      !!---------------------------------------------------------------------
-      !!                     ***  ROUTINE trc_nam  ***
-      !!
-      !! ** Purpose :   read options for the passive tracer run (namelist) 
-      !!
-      !!---------------------------------------------------------------------
-      NAMELIST/namtrc_run/ nn_dttrc, nn_writetrc, ln_rsttr, nn_rsttr, ln_top_euler, &
-        &                  cn_trcrst_indir, cn_trcrst_outdir, cn_trcrst_in, cn_trcrst_out
-
-
-      INTEGER  ::   ios                 ! Local integer output status for namelist read
-
-      !!---------------------------------------------------------------------
-
-
-      IF(lwp) WRITE(numout,*) 'trc_nam : read the passive tracer namelists'
-      IF(lwp) WRITE(numout,*) '~~~~~~~'
-
-      CALL ctl_opn( numnat_ref, 'namelist_top_ref'   , 'OLD'    , 'FORMATTED', 'SEQUENTIAL', -1, numout, .FALSE. )
-      CALL ctl_opn( numnat_cfg, 'namelist_top_cfg'   , 'OLD'    , 'FORMATTED', 'SEQUENTIAL', -1, numout, .FALSE. )
-      IF(lwm) CALL ctl_opn( numont, 'output.namelist.top', 'UNKNOWN', 'FORMATTED', 'SEQUENTIAL', -1, numout, .FALSE., 1 )
-
-      REWIND( numnat_ref )              ! Namelist namtrc in reference namelist : Passive tracer variables
-      READ  ( numnat_ref, namtrc_run, IOSTAT = ios, ERR = 901)
-901   IF( ios /= 0 ) CALL ctl_nam ( ios , 'namtrc in reference namelist', lwp )
-
-      REWIND( numnat_cfg )              ! Namelist namtrc in configuration namelist : Passive tracer variables
-      READ  ( numnat_cfg, namtrc_run, IOSTAT = ios, ERR = 902 )
-902   IF( ios /= 0 ) CALL ctl_nam ( ios , 'namtrc in configuration namelist', lwp )
-      IF(lwm) WRITE ( numont, namtrc_run )
-
-      !  computes the first time step of tracer model
-      nittrc000 = nit000 + nn_dttrc - 1
-
-      IF(lwp) THEN                   ! control print
-         WRITE(numout,*)
-         WRITE(numout,*) ' Namelist : namtrc_run'
-         WRITE(numout,*) '   time step freq. for passive tracer           nn_dttrc      = ', nn_dttrc
-         WRITE(numout,*) '   restart  for passive tracer                  ln_rsttr      = ', ln_rsttr
-         WRITE(numout,*) '   control of time step for passive tracer      nn_rsttr      = ', nn_rsttr
-         WRITE(numout,*) '   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,*) ' '
-      ENDIF
-      !
-    END SUBROUTINE trc_nam_run
-
-   SUBROUTINE trc_nam_ice
-      !!---------------------------------------------------------------------
-      !!                     ***  ROUTINE trc_nam_ice ***
-      !!
-      !! ** Purpose :   Read the namelist for the ice effect on tracers
-      !!
-      !! ** Method  : -
-      !!
-      !!---------------------------------------------------------------------
-      ! --- Variable declarations --- !
-      INTEGER :: jn      ! dummy loop indices
-      INTEGER :: ios     ! Local integer output status for namelist read
-
-      ! --- Namelist declarations --- !
-      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
-      !!---------------------------------------------------------------------
-      !!                     ***  ROUTINE trc_nam  ***
-      !!
-      !! ** Purpose :   read options for the passive tracer run (namelist) 
-      !!
-      !!---------------------------------------------------------------------
-      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                 ! Local integer output status for namelist read
-      INTEGER  ::   jn                  ! dummy loop indice
-      !!---------------------------------------------------------------------
-      IF(lwp) WRITE(numout,*)
-      IF(lwp) WRITE(numout,*) 'trc_nam : read the passive tracer namelists'
-      IF(lwp) WRITE(numout,*) '~~~~~~~'
-
-
-      REWIND( numnat_ref )              ! Namelist namtrc in reference namelist : Passive tracer variables
-      READ  ( numnat_ref, namtrc, IOSTAT = ios, ERR = 901)
-901   IF( ios /= 0 ) CALL ctl_nam ( ios , 'namtrc in reference namelist', lwp )
-
-      REWIND( numnat_cfg )              ! Namelist namtrc in configuration namelist : Passive tracer variables
-      READ  ( numnat_cfg, namtrc, IOSTAT = ios, ERR = 902 )
-902   IF( ios /= 0 ) CALL ctl_nam ( ios , 'namtrc in configuration namelist', lwp )
-      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
-         ln_trc_wri(jn) =       sn_tracer(jn)%llsave
-      END DO
-      
-    END SUBROUTINE trc_nam_trc
-
-
-   SUBROUTINE trc_nam_dia
-      !!---------------------------------------------------------------------
-      !!                     ***  ROUTINE trc_nam_dia  ***
-      !!
-      !! ** Purpose :   read options for the passive tracer diagnostics
-      !!
-      !! ** Method  : - read passive tracer namelist 
-      !!              - read namelist of each defined SMS model
-      !!                ( (PISCES, CFC, MY_TRC )
-      !!---------------------------------------------------------------------
-      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
-
-      INTEGER  ::   jn        
-      INTEGER  ::   ios                 ! Local integer output status for namelist read
-      !!---------------------------------------------------------------------
-
-      IF(lwp) WRITE(numout,*) 
-      IF(lwp) WRITE(numout,*) 'trc_nam_dia : read the passive tracer diagnostics options'
-      IF(lwp) WRITE(numout,*) '~~~~~~~'
-
-      IF(lwp) WRITE(numout,*)
-      IF(lwp) WRITE(numout,*) 'trc_nam_dia : 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 )
-
-      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 ) 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 .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
 
 #if defined key_trdmxl_trc || defined key_trdtrc
@@ -384,4 +184,214 @@
 #endif
       !
+   END SUBROUTINE trc_nam
+
+   SUBROUTINE trc_nam_run
+      !!---------------------------------------------------------------------
+      !!                     ***  ROUTINE trc_nam  ***
+      !!
+      !! ** Purpose :   read options for the passive tracer run (namelist) 
+      !!
+      !!---------------------------------------------------------------------
+      NAMELIST/namtrc_run/ nn_dttrc, nn_writetrc, ln_rsttr, nn_rsttr, ln_top_euler, &
+        &                  cn_trcrst_indir, cn_trcrst_outdir, cn_trcrst_in, cn_trcrst_out
+
+
+      INTEGER  ::   ios                 ! Local integer output status for namelist read
+
+      !!---------------------------------------------------------------------
+
+
+      IF(lwp) WRITE(numout,*) 'trc_nam : read the passive tracer namelists'
+      IF(lwp) WRITE(numout,*) '~~~~~~~'
+
+      CALL ctl_opn( numnat_ref, 'namelist_top_ref'   , 'OLD'    , 'FORMATTED', 'SEQUENTIAL', -1, numout, .FALSE. )
+      CALL ctl_opn( numnat_cfg, 'namelist_top_cfg'   , 'OLD'    , 'FORMATTED', 'SEQUENTIAL', -1, numout, .FALSE. )
+      IF(lwm) CALL ctl_opn( numont, 'output.namelist.top', 'UNKNOWN', 'FORMATTED', 'SEQUENTIAL', -1, numout, .FALSE., 1 )
+
+      REWIND( numnat_ref )              ! Namelist namtrc in reference namelist : Passive tracer variables
+      READ  ( numnat_ref, namtrc_run, IOSTAT = ios, ERR = 901)
+901   IF( ios /= 0 ) CALL ctl_nam ( ios , 'namtrc in reference namelist', lwp )
+
+      REWIND( numnat_cfg )              ! Namelist namtrc in configuration namelist : Passive tracer variables
+      READ  ( numnat_cfg, namtrc_run, IOSTAT = ios, ERR = 902 )
+902   IF( ios /= 0 ) CALL ctl_nam ( ios , 'namtrc in configuration namelist', lwp )
+      IF(lwm) WRITE ( numont, namtrc_run )
+
+      !  computes the first time step of tracer model
+      nittrc000 = nit000 + nn_dttrc - 1
+
+      IF(lwp) THEN                   ! control print
+         WRITE(numout,*)
+         WRITE(numout,*) ' Namelist : namtrc_run'
+         WRITE(numout,*) '   time step freq. for passive tracer           nn_dttrc      = ', nn_dttrc
+         WRITE(numout,*) '   restart  for passive tracer                  ln_rsttr      = ', ln_rsttr
+         WRITE(numout,*) '   control of time step for passive tracer      nn_rsttr      = ', nn_rsttr
+         WRITE(numout,*) '   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,*) ' '
+      ENDIF
+      !
+    END SUBROUTINE trc_nam_run
+
+   SUBROUTINE trc_nam_ice
+      !!---------------------------------------------------------------------
+      !!                     ***  ROUTINE trc_nam_ice ***
+      !!
+      !! ** Purpose :   Read the namelist for the ice effect on tracers
+      !!
+      !! ** Method  : -
+      !!
+      !!---------------------------------------------------------------------
+      ! --- Variable declarations --- !
+      INTEGER :: jn      ! dummy loop indices
+      INTEGER :: ios     ! Local integer output status for namelist read
+
+      ! --- Namelist declarations --- !
+      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
+      !!---------------------------------------------------------------------
+      !!                     ***  ROUTINE trc_nam  ***
+      !!
+      !! ** Purpose :   read options for the passive tracer run (namelist) 
+      !!
+      !!---------------------------------------------------------------------
+      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                 ! Local integer output status for namelist read
+      INTEGER  ::   jn                  ! dummy loop indice
+      !!---------------------------------------------------------------------
+      IF(lwp) WRITE(numout,*)
+      IF(lwp) WRITE(numout,*) 'trc_nam : read the passive tracer namelists'
+      IF(lwp) WRITE(numout,*) '~~~~~~~'
+
+
+      REWIND( numnat_ref )              ! Namelist namtrc in reference namelist : Passive tracer variables
+      READ  ( numnat_ref, namtrc, IOSTAT = ios, ERR = 901)
+901   IF( ios /= 0 ) CALL ctl_nam ( ios , 'namtrc in reference namelist', lwp )
+
+      REWIND( numnat_cfg )              ! Namelist namtrc in configuration namelist : Passive tracer variables
+      READ  ( numnat_cfg, namtrc, IOSTAT = ios, ERR = 902 )
+902   IF( ios /= 0 ) CALL ctl_nam ( ios , 'namtrc in configuration namelist', lwp )
+      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
+         ln_trc_wri(jn) =       sn_tracer(jn)%llsave
+      END DO
+      
+    END SUBROUTINE trc_nam_trc
+
+
+   SUBROUTINE trc_nam_dia
+      !!---------------------------------------------------------------------
+      !!                     ***  ROUTINE trc_nam_dia  ***
+      !!
+      !! ** Purpose :   read options for the passive tracer diagnostics
+      !!
+      !! ** Method  : - read passive tracer namelist 
+      !!              - read namelist of each defined SMS model
+      !!                ( (PISCES, CFC, MY_TRC )
+      !!---------------------------------------------------------------------
+      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
+
+      INTEGER  ::   ios                 ! Local integer output status for namelist read
+      !!---------------------------------------------------------------------
+
+      IF(lwp) WRITE(numout,*) 
+      IF(lwp) WRITE(numout,*) 'trc_nam_dia : read the passive tracer diagnostics options'
+      IF(lwp) WRITE(numout,*) '~~~~~~~'
+
+      IF(lwp) WRITE(numout,*)
+      IF(lwp) WRITE(numout,*) 'trc_nam_dia : 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 )
+
+      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 ) 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 .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
 
Index: /branches/2017/nemo_v3_6_STABLE_trdtrc/NEMOGCM/NEMO/TOP_SRC/trcstat.F90
===================================================================
--- /branches/2017/nemo_v3_6_STABLE_trdtrc/NEMOGCM/NEMO/TOP_SRC/trcstat.F90	(revision 8471)
+++ /branches/2017/nemo_v3_6_STABLE_trdtrc/NEMOGCM/NEMO/TOP_SRC/trcstat.F90	(revision 8471)
@@ -0,0 +1,154 @@
+MODULE trcstat
+   !!======================================================================
+   !!                         ***  MODULE trcrst  ***
+   !! TOP :   Manage the passive tracer restart
+   !!======================================================================
+   !! History :    -   !  1991-03  ()  original code
+   !!             1.0  !  2005-03 (O. Aumont, A. El Moussaoui) F90
+   !!              -   !  2005-10 (C. Ethe) print control
+   !!             2.0  !  2005-10 (C. Ethe, G. Madec) revised architecture
+   !!----------------------------------------------------------------------
+#if defined key_top
+   !!----------------------------------------------------------------------
+   !!   'key_top'                                                TOP models
+   !!----------------------------------------------------------------------
+   !!----------------------------------------------------------------------
+   !!   trc_rst :   Restart for passive tracer
+   !!----------------------------------------------------------------------
+   !!----------------------------------------------------------------------
+   !!   'key_top'                                                TOP models
+   !!----------------------------------------------------------------------
+   !!   trc_rst_opn    : open  restart file
+   !!   trc_rst_read   : read  restart file
+   !!   trc_rst_wri    : write restart file
+   !!----------------------------------------------------------------------
+   USE trc,               ONLY: tra, ctrcnm
+   USE par_kind,          ONLY: wp
+   USE in_out_manager,    ONLY: lwp, numout
+   USE par_oce,           ONLY: jpi, jpj
+   USE par_trc,           ONLY: jptra
+   USE dom_oce,           ONLY: e3t_0, e3t_a, e3t_n, gdepw_0, gdepw_n,     &
+                          tmask, e1e2t
+   !* MPP library                         
+   USE lib_mpp
+   !* Fortran utilities                         
+   USE lib_fortran
+
+   IMPLICIT NONE
+   PRIVATE
+
+   PUBLIC   trc_rst_dia_stat
+   PUBLIC   trc_rst_tra_stat
+
+   !! * Substitutions
+#  include "top_substitute.h90"
+   
+CONTAINS
+   
+   SUBROUTINE trc_rst_tra_stat
+      !!----------------------------------------------------------------------
+      !!                    ***  trc_rst_tra_stat  ***
+      !!
+      !! ** purpose  :   Compute tracers statistics - check where crazy values appears
+      !!----------------------------------------------------------------------
+      INTEGER  :: jk, jn
+      REAL(wp) :: ztraf, zmin, zmax, zmean, zdrift, areasf
+      REAL(wp), DIMENSION(jpi,jpj) :: zvol
+      !!----------------------------------------------------------------------
+
+      IF( lwp ) THEN
+         WRITE(numout,*)
+         WRITE(numout,*) '           ----SURFACE TRA STAT----             '
+         WRITE(numout,*)
+      ENDIF
+      !
+      zvol(:,:) = e1e2t(:,:) * fse3t_a(:,:,1) * tmask(:,:,1)
+      areasf = glob_sum(zvol(:,:))
+      DO jn = 1, jptra
+         ztraf = glob_sum( tra(:,:,1,jn) * zvol(:,:) )
+         zmin  = MINVAL( tra(:,:,1,jn), mask= ((tmask(:,:,1).NE.0.)) )
+         zmax  = MAXVAL( tra(:,:,1,jn), mask= ((tmask(:,:,1).NE.0.)) )
+         IF( lk_mpp ) THEN
+            CALL mpp_min( zmin )      ! min over the global domain
+            CALL mpp_max( zmax )      ! max over the global domain
+         END IF
+         zmean  = ztraf / areasf
+         IF(lwp) WRITE(numout,9001) jn, TRIM( ctrcnm(jn) ), zmean, zmin, zmax
+      END DO
+      IF(lwp) WRITE(numout,*)
+9001  FORMAT(' tracer nb :',i2,'    name :',a10,'    mean :',e18.10,'    min :',e18.10, &
+      &      '    max :',e18.10)
+      !
+   END SUBROUTINE trc_rst_tra_stat
+
+
+
+   SUBROUTINE trc_rst_dia_stat( dgtr, names)
+      !!----------------------------------------------------------------------
+      !!                    ***  trc_rst_dia_stat  ***
+      !!
+      !! ** purpose  :   Compute tracers statistics
+      !!----------------------------------------------------------------------
+      REAL(wp), DIMENSION(jpi,jpj) , INTENT(in) ::   dgtr      ! 2D diag var
+      CHARACTER(len=*)             , INTENT(in) ::   names     ! 2D diag name
+      !!---------------------------------------------------------------------
+      INTEGER  :: jk, jn
+      CHARACTER (LEN=18) :: text_zmean
+      REAL(wp) :: ztraf, zmin, zmax, zmean, areasf
+      REAL(wp), DIMENSION(jpi,jpj) :: zvol
+      !!----------------------------------------------------------------------
+
+      IF( lwp )  WRITE(numout,*) 'STAT- ', names
+      
+      ! fse3t_a will be undefined at the start of a run, but this routine
+      ! may be called at any stage! Hence we MUST make sure it is 
+      ! initialised to zero when allocated to enable us to test for 
+      ! zero content here and avoid potentially dangerous and non-portable 
+      ! operations (e.g. divide by zero, global sums of junk values etc.)   
+      zvol(:,:) = e1e2t(:,:) * fse3t_a(:,:,1) * tmask(:,:,1)
+      ztraf = glob_sum( dgtr(:,:) * zvol(:,:) )
+      !! areasf = glob_sum(e1e2t(:,:) * tmask(:,:,1) )
+      areasf = glob_sum(zvol(:,:))
+      zmin  = MINVAL( dgtr(:,:), mask= ((tmask(:,:,1).NE.0.)) )
+      zmax  = MAXVAL( dgtr(:,:), mask= ((tmask(:,:,1).NE.0.)) )
+      IF( lk_mpp ) THEN
+         CALL mpp_min( zmin )      ! min over the global domain
+         CALL mpp_max( zmax )      ! max over the global domain
+      END IF
+
+      text_zmean = "N/A"
+      ! Avoid divide by zero. areasf must be positive.
+      IF  (areasf > 0.0) THEN 
+         zmean = ztraf / areasf
+         WRITE(text_zmean,'(e18.10)') zmean
+      ENDIF
+
+      IF(lwp) WRITE(numout,9002) TRIM( names ), text_zmean, zmin, zmax
+
+  9002  FORMAT(' tracer name :',A,'    mean :',A,'    min :',e18.10, &
+      &      '    max :',e18.10 )
+      !
+   END SUBROUTINE trc_rst_dia_stat
+
+
+#else
+   !!----------------------------------------------------------------------
+   !!  Dummy module :                                     No passive tracer
+   !!----------------------------------------------------------------------
+CONTAINS
+   SUBROUTINE trc_rst_dia_stat                      ! Empty routines
+      WRITE(*,*) 'trc_rst_wri: You should not have seen this print! error?'
+   END SUBROUTINE trc_rst_dia_stat
+   SUBROUTINE trc_rst_dia_stat( dgtr, names)
+      REAL(wp), DIMENSION(jpi,jpj) , INTENT(in) ::   dgtr      ! 2D diag var
+      CHARACTER(len=*)             , INTENT(in) ::   names     ! 2D diag name
+      WRITE(*,*) 'trc_rst_wri: You should not have seen this print! error?'
+   END SUBROUTINE trc_rst_dia_stat  
+#endif
+
+   !!----------------------------------------------------------------------
+   !! NEMO/TOP 3.3 , NEMO Consortium (2010)
+   !! $Id$
+   !! Software governed by the CeCILL licence (NEMOGCM/NEMO_CeCILL.txt)
+   !!======================================================================
+END MODULE trcstat
