Index: trunk/LMDZ.MARS/README
===================================================================
--- trunk/LMDZ.MARS/README	(revision 2933)
+++ trunk/LMDZ.MARS/README	(revision 2934)
@@ -3993,2 +3993,6 @@
 ==03/04/2023 == RV
 Small correction in write_output_mod following r2932
+
+== 10/04/2023 == EM
+A first step in cleaning up outputs and adding field definitions for XIOS.
+ 
Index: trunk/LMDZ.MARS/deftank/context_lmdz_physics.xml
===================================================================
--- trunk/LMDZ.MARS/deftank/context_lmdz_physics.xml	(revision 2933)
+++ trunk/LMDZ.MARS/deftank/context_lmdz_physics.xml	(revision 2934)
@@ -91,4 +91,5 @@
               name="Xhistins"
               output_freq="12ts" 
+              time_units="days"
               type="one_file"
               enabled=".true.">
@@ -97,5 +98,5 @@
             <field_group operation="instant"
                          freq_op="1ts">
-                <field field_ref="ls" />
+                <field field_ref="Ls" />
             </field_group>
 
@@ -107,6 +108,6 @@
                 <field field_ref="tsurf" />
                 <field field_ref="co2ice" />
-                <field field_ref="ISR" />
-                <field field_ref="OLR" />
+                <field field_ref="fluxsurf_dn_sw" name="ISR" />
+                <field field_ref="fluxtop_lw" name="OLR" />
             </field_group>
 
@@ -114,5 +115,5 @@
             <field_group operation="instant"
                          freq_op="1ts">
-                <field field_ref="temperature" />
+                <field field_ref="temp" />
                 <field field_ref="u" />
                 <field field_ref="v" />
@@ -122,5 +123,5 @@
             <field_group operation="instant"
                          freq_op="1ts">
-                <field field_ref="tsoil" />
+                <field field_ref="soiltemp" name="tsoil" />
                 <field field_ref="inertiedat" />
             </field_group>
@@ -131,4 +132,5 @@
               name="Xdiurnalave"
               output_freq="1d" 
+              time_units="days"
               type="one_file"
               enabled=".false.">
@@ -137,5 +139,5 @@
             <field_group operation="average"
                          freq_op="1ts">
-                <field field_ref="ls" />
+                <field field_ref="Ls" />
             </field_group>
 
@@ -150,5 +152,5 @@
             <field_group operation="average"
                          freq_op="1ts">
-                <field field_ref="temperature" />
+                <field field_ref="temp" />
                 <field field_ref="u" />
                 <field field_ref="v" />
Index: trunk/LMDZ.MARS/deftank/field_def_physics_mars.xml
===================================================================
--- trunk/LMDZ.MARS/deftank/field_def_physics_mars.xml	(revision 2933)
+++ trunk/LMDZ.MARS/deftank/field_def_physics_mars.xml	(revision 2934)
@@ -10,7 +10,26 @@
         <!-- 0D variables -->
         <field_group id="fields_0D" grid_ref="scalarpoint">
-            <field id="ls"
+            <field id="Ls"
                    long_name="Solar longitude"
                    unit="degrees" />
+            <field id="Sols"
+                   long_name="Time"
+                   unit="sols" />
+
+            <!-- planetary escape fluxes -->
+            <field id="PhiH"
+                   long_name="H escape flux"
+                   unit="s-1" />
+            <field id="PhiH2"
+                   long_name="H2 escape flux"
+                   unit="s-1" />
+            <field id="PhiD"
+                   long_name="D escape flux"
+                   unit="s-1" />
+
+            <field id="co2conservation"
+                   long_name="Total CO2 mass conservation in physic"
+                   unit="kg" />
+
         </field_group>    
 
@@ -37,25 +56,188 @@
         <!-- 2D variables -->
         <field_group id="fields_2D" domain_ref="dom_glo">
+            <field id="area"
+                   long_name="Mesh area"
+                   unit="m2" />
+            <field id="phisfi"
+                   long_name="Surface geopotential"  
+                   unit="m2.s-2" />
+            <field id="emis"
+                   long_name="Surface emissivity"  
+                   unit="" />
+            <field id="emis_slope01"
+                   long_name="Surface emissivity of slope 01"  
+                   unit="" />
+            <field id="albedo"
+                   long_name="Albedo of the surface"  
+                   unit="" />
+            <field id="albedo_slope01"
+                   long_name="Albedo of the surface for slope 01"  
+                   unit="" />
+
+            <field id="local_time"
+                   long_name="Local time" 
+                   unit="sol" />
+
             <field id="ps"
                    long_name="Surface Pressure" 
                    unit="Pa" />
-            <field id="area"
-                   long_name="Mesh area"
-                   unit="m2" />
             <field id="tsurf"
                    long_name="Surface Temperature"
                    unit="K" />
+            <field id="tsurf_slope01"
+                   long_name="Surface Temperature of slope 01"
+                   unit="K" />
+            <field id="temp_layer1"
+                   long_name="Temperature in layer 1"
+                   unit="K" />
+            <field id="temp7"
+                   long_name="Temperature in layer 7"
+                   unit="K" />
+
+            <!-- Radiation -->
+            <field id="fluxsurf_lw"
+                   long_name="Longwave radiation at the surface" 
+                   unit="W.m-2" />
+            <field id="fluxsurf_lw_slope01"
+                   long_name="Longwave radiation at the surface on slope 01" 
+                   unit="W.m-2" />
+            <field id="fluxtop_lw"
+                   long_name="Longwave radiation at the top of the atmosphere" 
+                   unit="W.m-2" />
+
+            <field id="fluxsurf_dn_sw"
+                   long_name="Incoming shortwave radiation at the surface"  
+                   unit="W.m-2" />
+            <field id="fluxsurf_dn_sw_slope01"
+                   long_name="Incoming shortwave radiation at the surface on slope 01"  
+                   unit="W.m-2" />
+            <field id="fluxtop_up_sw"
+                   long_name="Upward shortwave radiation at the top of the atmosphere" 
+                   unit="W.m-2" />
+            
+            <!-- dust cycle -->
+            <field id="tau_pref_scenario"
+                   long_name="Prescribed visible dust optical depth at 610Pa"
+                   unit="" />
+            <field id="tau_pref_gcm"
+                   long_name="Visible dust optical depth at 610Pa in the GCM"
+                   unit="" />
+            <field id="IRtoVIScoef"
+                   long_name="Conversion coeff for dust tau from abs9.3um to ext0.67um"
+                   unit="" />
+            <field id="IRtoVIScoef"
+                   long_name="Conversion coeff for dust tau from abs9.3um to ext0.67um"
+                   unit="" />
+            <field id="dust_rad_adjust"
+                   long_name="radiative adjustment coefficient for dust"
+                   unit="" />
+
+            <field id="dqsdust"
+                   long_name="deposited surface dust mass"
+                   unit="kg.m-2.s-1" />
+            <field id="dqndust"
+                   long_name="deposited surface dust number"
+                   unit="number.m-2.s-1" />
+            <field id="dqsdifdustq"
+                   long_name="tendency due to vertical diffusion of background dust on surface"
+                   unit="kg.m-2.s-1" />
+            <field id="dqsdifdustq_slope01"
+                   long_name="tendency due to vertical diffusion of background dust on surface"
+                   unit="kg.m-2.s-1" />
+            <field id="dqsdifrdsq"
+                   long_name="tendency due to vertical diffusion of stormdust on surface"
+                   unit="kg.m-2.s-1" />
+            <field id="dqsdifrdsq_slope01"
+                   long_name="tendency due to vertical diffusion of stormdust on surface"
+                   unit="kg.m-2.s-1" />
+
+
+            <field id="tau_pref_target"
+                   long_name="target visible dust opacity column at 610Pa"
+                   unit="" />
+            <field id="dtau"
+                   long_name="opacity difference wrt scenario"
+                   unit="" />
+            <field id="dustliftday"
+                   long_name="dust injection rate"
+                   unit="s-1" />
+            
+            <field id="stormfract"
+                   long_name="fraction of the mesh with stormdust"
+                   unit="none" />
+            <field id="mstormdtot"
+                   long_name="total mass of stormdust in the column"
+                   unit="kg.m-2" />
+            <field id="mdusttot"
+                   long_name="total mass of background dust in the column"
+                   unit="kg.m-2" />
+            <field id="rdsdqsdust"
+                   long_name="deposited surface stormdust mass rate"
+                   unit="kg.m-2.s-1" />
+            <field id="zdqssed_dust_mass"
+                   long_name="sedimentation tendency of background dust on surface"
+                   unit="kg.m-2.s-1" />
+
+            <!-- water cycle -->
+            <field id="watercap"
+                   long_name="Perennial water ice thickness"
+                   unit="kg.m-2" />            
+            <field id="watercap_slope01"
+                   long_name="Perennial water ice thickness of slope 01"
+                   unit="kg.m-2" />            
+            <field id="surf_h2o_lh"
+                   long_name="Ground ice latent heat flux"
+                   unit="W.m-2" />
+            <field id="tauTES"
+                   long_name="Water ice cloud opacity at TES abs 825 cm-1"
+                   unit="" />
+            <field id="mtot"
+                   long_name="Total mass of water vapor in the column"
+                   unit="kg.m-2" />
+            <field id="icetot"
+                   long_name="Total mass of water ice in the atmospheric column"
+                   unit="kg.m-2" />
+            <field id="reffice"
+                   long_name="Mean effective radius of water ice in the atmospheric column"
+                   unit="m" />
+            <field id="Nccntot"
+                   long_name="Number of water condensation nuclei in the atmospheric column"
+                   unit="nbr.m-2" />
+            <field id="Mccntot"
+                   long_name="Mass of water condensation nuclei in the atmospheric column"
+                   unit="kg.m-2" />
+            <field id="h2o_ice_s"
+                   long_name="Mass of water ice on the surface"
+                   unit="kg.m-2" />
+            <field id="h2o_ice_s_slope01"
+                   long_name="Mass of water ice on the surface of slope 01"
+                   unit="kg.m-2" />
+            
+            <!-- CO2 cycle -->
             <field id="co2ice"
                    long_name="CO2 ice thickness"
-                   unit="kg/m2" />
-            <field id="OLR"
-                   long_name="outgoing longwave radiation" 
-                   unit="W/m2" />
-            <field id="ISR"
-                   long_name="incoming solar radiation"  
-                   unit="W/m2" />
-            <field id="phisinit"
-                   long_name="Geopotential at the surface"  
-                   unit="" />
+                   unit="kg.m-2" />
+            <field id="co2ice_slope01"
+                   long_name="CO2 ice thickness on slope 01"
+                   unit="kg.m-2" />
+            
+            <field id="co2condens_zfallice"
+                   long_name="CO2 ice tendency on the surface"
+                   unit="kg.m-2.s-1" />
+
+            <!-- Thermals parametrization -->
+            <field id="lmax_th"
+                   long_name="index of vertical extension of thermals"
+                   unit="grid level" />
+            <field id="zmax_th"
+                   long_name="vertical extension of thermals"
+                   unit="m" />
+            <field id="hfmax_th"
+                   long_name="maximum heat flux in thermals"
+                   unit="K.m/s" />
+            <field id="wstar"
+                   long_name="maximum vertical velocity in thermals"
+                   unit="m/s" />
+
         </field_group>
 
@@ -63,22 +245,221 @@
         <field_group id="fields_3D" domain_ref="dom_glo" axis_ref="altitude">
         <!--<field_group id="fields_3D" grid_ref="grid_3d">-->
-            <field id="temperature"
+
+            <field id="zzlay"
+                   long_name="Midlayer altitude"
+                   unit="m" />
+            <field id="zzlev"
+                   long_name="Interlayer altitude"
+                   unit="m" />
+            <field id="pphi"
+                   long_name="Geopotential"
+                   unit="m2.s-2" />
+
+            <!-- main meteorological fields -->
+            <field id="temp"
                    long_name="Atmospheric temperature"
                    unit="K" />
             <field id="u"
                    long_name="Eastward Zonal Wind"
-                   unit="m/s" />
+                   unit="m.s-1" />
             <field id="v" 
                    long_name="Northward Meridional Wind" 
-                   unit="m/s" />
+                   unit="m.s-1" />
+            <field id="w" 
+                   long_name="Vertical Wind (positive when downward)" 
+                   unit="m.s-1" />
+            <field id="rho" 
+                   long_name="Atmospheric density" 
+                   unit="kg.m-3" />
+            <field id="pressure" 
+                   long_name="Atmospheric pressure" 
+                   unit="Pa" />
+            <field id="zplev" 
+                   long_name="Interlayer pressure" 
+                   unit="Pa" />
+
+            <!-- heating rates -->
+            <field id="dtrad" 
+                   long_name="total radiative heating rate" 
+                   unit="K.s-1" />
+            <field id="sw_htrt" 
+                   long_name="Shortwave heating rate" 
+                   unit="K.s-1" />
+            <field id="lw_htrt" 
+                   long_name="Longwave heating rate" 
+                   unit="K.s-1" />
+            <field id="q15um" 
+                   long_name="15 um cooling" 
+                   unit="K.s-1" />
+            <field id="qnir" 
+                   long_name="NIR heating rate" 
+                   unit="K.s-1" />
+            <field id="quv" 
+                   long_name="EUV heating rate" 
+                   unit="K.s-1" />
+            <field id="cond" 
+                   long_name="Thermal conduction heating rate" 
+                   unit="K.s-1" />
+
+            <!-- tracers -->
             <field id="co2" 
                    long_name="co2 mass mixing ratio" 
                    unit="kg/kg" />
+            <field id="h2o_ice" 
+                   long_name="water ice mass mixing ratio" 
+                   unit="kg/kg" />
+            <field id="vmr_h2oice" 
+                   long_name="water ice volume mixing ratio" 
+                   unit="mol/mol" />
+            <field id="h2o_vap" 
+                   long_name="water vapor mass mixing ratio" 
+                   unit="kg/kg" />
+            <field id="vmr_h2ovap" 
+                   long_name="water vapor volume mixing ratio" 
+                   unit="mol/mol" />
+        
+            <!-- Dust cycle parametrization -->
+            <field id="reffdust" 
+                   long_name="Dust effective radius" 
+                   unit="m" />
+            <field id="rdust" 
+                   long_name="Dust radius" 
+                   unit="m" />
+            <field id="dustq" 
+                   long_name="Dust mass mixing ratio" 
+                   unit="kg/kg" />
+            <field id="dustN" 
+                   long_name="Dust number mixing ratio" 
+                   unit="part/kg" />
+            <field id="dsodust_TES" 
+                   long_name="Density scaled extinction opacity of std dust at 9.3um(TES)" 
+                   unit="m2.kg-1" />
+            <field id="dso_TES" 
+                   long_name="Density scaled extinction opacity of all dust at 9.3um(TES)" 
+                   unit="m2.kg-1" />
+            <field id="dsodust" 
+                   long_name="Density scaled extinction opacity of std dust at 21.6um(MCS)" 
+                   unit="m2.kg-1" />
+            <field id="dso" 
+                   long_name="Density scaled extinction opacity of all dust at 21.6um(MCS)" 
+                   unit="m2.kg-1" />
+            <field id="aerosol_dust" 
+                   long_name="Opacity of background dust" 
+                   unit="" />
+
+            <field id="reffstormdust" 
+                   long_name="Stormdust dust effective radius" 
+                   unit="m" />
+            <field id="rstormdust" 
+                   long_name="Stormdust dust radius" 
+                   unit="m" />
+            <field id="dsords_TES" 
+                   long_name="Density scaled extinction opacity of stormdust at 9.3um(TES)" 
+                   unit="m2.kg-1" />
+            <field id="dsords" 
+                   long_name="Density scaled extinction opacity of stormdust at 21.6um(MCS)" 
+                   unit="m2.kg-1" />
+            <field id="rdsdustq" 
+                   long_name="Stormdust dust mass mixing ratio" 
+                   unit="kg/kg" />
+            <field id="rdsdustqmodel" 
+                   long_name="Stormdust dust mass mixing ratio" 
+                   unit="kg/kg" />
+            <field id="rdsdustN" 
+                   long_name="Stormdust dust number mixing ratio" 
+                   unit="part/kg" />
+            <field id="rdsdustN" 
+                   long_name="Stormdust dust number mixing ratio" 
+                   unit="part/kg" />
+            <field id="wspeed_stormdust" 
+                   long_name="vertical velocity of stormdust" 
+                   unit="m/s" />
+            <field id="zdqsed_dust_mass" 
+                   long_name="sedimentation tendency of background dust mmr" 
+                   unit="kg/kg.s-1" />
+            <field id="zdqsed_dust_number" 
+                   long_name="sedimentation tendency of background dust number" 
+                   unit="nbr/kg.s-1" />
+            <field id="zdqsed_stormdust_mass" 
+                   long_name="sedimentation tendency of stormdust dust mmr" 
+                   unit="kg/kg.s-1" />
+            <field id="aerosol_stormdust" 
+                   long_name="Opacity of stormdust dust" 
+                   unit="" />
+            <field id="rds_lapserate" 
+                   long_name="lapse rate in the rocket dust storm" 
+                   unit="K/m" />
+            <field id="rds_deltahr" 
+                   long_name="extra heating rate in the rocket dust storm" 
+                   unit="K/s" />
+
+            <field id="topdustq" 
+                   long_name="Topdust dust mass mixing ratio" 
+                   unit="kg/kg" />
+            <field id="topdustN" 
+                   long_name="Topdust dust number mixing ratio" 
+                   unit="part/kg" />
+            <field id="refftopdust" 
+                   long_name="Topdust dust effective radius" 
+                   unit="m" />
+            <field id="dsotop_TES" 
+                   long_name="Density scaled extinction opacity of topdust at 9.3um(TES)" 
+                   unit="m2.kg-1" />
+            <field id="dsotop" 
+                   long_name="Density scaled extinction opacity of topdust at 21.6um(MCS)" 
+                   unit="m2.kg-1" />
+
+
+            <!-- Water cycle parametrization -->
+            <field id="rice" 
+                   long_name="Water ice particle size" 
+                   unit="m" />
+            <field id="h2o_saturation" 
+                   long_name="h2o vapor saturation ratio" 
+                   unit="" />
+            <field id="watercloud_pdqh2oice" 
+                   long_name="pdqcloud_h2o_ice after microphysics" 
+                   unit="kg/kg.s-1" />
+            <field id="watercloud_pdqh2ovap" 
+                   long_name="pdqcloud_h2o_vap after microphysics" 
+                   unit="kg/kg.s-1" />
+            <field id="watercloud_pdqhdoice" 
+                   long_name="pdqcloud_hdo_ice after microphysics" 
+                   unit="kg/kg.s-1" />
+            <field id="watercloud_pdqhdovap" 
+                   long_name="pdqcloud_hdo_vap after microphysics" 
+                   unit="kg/kg.s-1" />
+            
+            <!-- CO2 condensation parametrization -->
+            <field id="co2condens_pdtc" 
+                   long_name="Temperature tendency due to CO2 condensation" 
+                   unit="K.s-1" />
+            
+            <!-- Non-orographic GW parametrization -->
+            <field id="nonoro_bv" 
+                   long_name="Brunt Vaisala frequency in nonoro" 
+                   unit="Hz" />
+            <field id="nonoro_u_epflux_tot" 
+                   long_name="Total EP Flux along U in nonoro" 
+                   unit="" />
+            <field id="nonoro_v_epflux_tot" 
+                   long_name="Total EP Flux along V in nonoro" 
+                   unit="" />
+            <field id="du_nonoro_gwd" 
+                   long_name="Tendency on U due to nonoro GW" 
+                   unit="m.s-2" />
+            <field id="dv_nonoro_gwd" 
+                   long_name="Tendency on V due to nonoro GW" 
+                   unit="m.s-2" />        
+        
         </field_group>
 
         <!-- soil variables -->
         <field_group id="fields_soil" domain_ref="dom_glo" axis_ref="soil_layers">
-            <field id="tsoil"
+            <field id="soiltemp"
                    long_name="Soil temperature"
+                   unit="K" />
+            <field id="soiltemp_slope01"
+                   long_name="Soil temperature for slope 01"
                    unit="K" />
             <field id="inertiedat"
@@ -86,3 +467,4 @@
                    unit="J/kg/K" />
         </field_group>
+
     </field_definition>
Index: trunk/LMDZ.MARS/libf/phymars/co2condens_mod.F
===================================================================
--- trunk/LMDZ.MARS/libf/phymars/co2condens_mod.F	(revision 2933)
+++ trunk/LMDZ.MARS/libf/phymars/co2condens_mod.F	(revision 2934)
@@ -332,7 +332,7 @@
      &                       rdust,zcondicea,zfallice,zdq_scav,pdqsc)
       endif
-             call write_output("zfallice",
-     &         "",
-     &         " ",zfallice(:,1))
+             call write_output("co2condens_zfallice",
+     &         "CO2 ice tendency on the surface",
+     &         "kg.m-2.s-1",zfallice(:,1))
       ELSE ! if co2 clouds
         condens_layer(:,:) = 0.
@@ -349,16 +349,16 @@
           piceco2(ig) = piceco2(ig) + zdqssed_co2(ig)*ptimestep
         ENDDO
-       call write_output("zfallice",
-     &         "",
-     &         " ",zdqssed_co2(:)) ! otherwise we have not 1 day(1proc) = 1 day (24procs) test
+       call write_output("co2condens_zfallice",
+     &         "CO2 ice tendency on the surface",
+     &         "kg.m-2.s-1",zdqssed_co2(:)) ! otherwise we have not 1 day(1proc) = 1 day (24procs) test
       ENDIF ! end of if co2clouds
 
-      call write_output("pdtc_atm",
-     &         "temperature tendency due to CO2 condensation",
-     &         " ",pdtc(:,:)) 
+      call write_output("co2condens_pdtc",
+     &         "Temperature tendency due to CO2 condensation",
+     &         "K.s-1",pdtc(:,:)) 
      
-       call write_output("condens_layer",
-     &         "",
-     &         " ",condens_layer(:,:))
+!       call write_output("condens_layer",
+!     &         "",
+!     &         " ",condens_layer(:,:))
 
 c     *************************
Index: trunk/LMDZ.MARS/libf/phymars/nonoro_gwd_ran_mod.F90
===================================================================
--- trunk/LMDZ.MARS/libf/phymars/nonoro_gwd_ran_mod.F90	(revision 2933)
+++ trunk/LMDZ.MARS/libf/phymars/nonoro_gwd_ran_mod.F90	(revision 2934)
@@ -223,6 +223,6 @@
     PH(:, 1) = 2. * PP(:, 1) - PH(:, 2)
 
-    call write_output('nonoro_pp','nonoro_pp', 'm',PP(:,:))
-    call write_output('nonoro_ph','nonoro_ph', 'm',PH(:,:))
+!    call write_output('nonoro_pp','nonoro_pp', 'm',PP(:,:))
+!    call write_output('nonoro_ph','nonoro_ph', 'm',PH(:,:))
 
     ! Launching level for reproductible case
@@ -251,5 +251,5 @@
 	ZH(:, 1) = H0 * LOG(PR / (PH(:, 1) + PSEC))
 
-    call write_output('nonoro_zh','nonoro_zh', 'm',ZH(:,2:nlayer+1))
+!    call write_output('nonoro_zh','nonoro_zh', 'm',ZH(:,2:nlayer+1))
 
     ! Winds and Brunt Vaisala frequency
@@ -276,5 +276,5 @@
        MAX_K(II)=MAX(kmin,kstar)
     ENDDO
-    call write_output('nonoro_bv','nonoro_bv', 'm',BV(:,2:nlayer+1))
+    call write_output('nonoro_bv','Brunt Vaisala frequency in nonoro', 'Hz',BV(:,2:nlayer+1))
 
 !-----------------------------------------------------------------------------------------------------------------------
@@ -445,6 +445,6 @@
     ! (upward) that should be compensated by circulation 
     ! and induce additional friction at the surface 
-    call write_output('nonoro_u_epflux_tot','nonoro_u_epflux_tot', '',u_epflux_tot(:,2:nlayer+1))
-    call write_output('nonoro_v_epflux_tot','nonoro_v_epflux_tot', '',v_epflux_tot(:,2:nlayer+1))
+    call write_output('nonoro_u_epflux_tot','Total EP Flux along U in nonoro', '',u_epflux_tot(:,2:nlayer+1))
+    call write_output('nonoro_v_epflux_tot','Total EP Flux along V in nonoro', '',v_epflux_tot(:,2:nlayer+1))
 
     ! 5.2 AR-1 RECURSIVE FORMULA (13) IN VERSION 4
@@ -458,6 +458,6 @@
     ENDDO
     d_t(:,:) = 0.
-    call write_output('nonoro_d_u','nonoro_d_u', '',d_u(:,:))
-    call write_output('nonoro_d_v','nonoro_d_v', '',d_v(:,:))
+!    call write_output('nonoro_d_u','nonoro_d_u', '',d_u(:,:))
+!    call write_output('nonoro_d_v','nonoro_d_v', '',d_v(:,:))
 
     ! 5.3 Update tendency of wind with the previous (and saved) values
@@ -470,6 +470,6 @@
     dv_nonoro_gwd(:,:) = d_v(:,:)
 
-    call write_output('du_nonoro_gwd','du_nonoro_gwd', '',du_nonoro_gwd(:,:))
-    call write_output('dv_nonoro_gwd','dv_nonoro_gwd', '',dv_nonoro_gwd(:,:))
+    call write_output('du_nonoro_gwd','Tendency on U due to nonoro GW', 'm.s-2',du_nonoro_gwd(:,:))
+    call write_output('dv_nonoro_gwd','Tendency on V due to nonoro GW', 'm.s-2',dv_nonoro_gwd(:,:))
     
     ! Cosmetic: evaluation of the cumulated stress
@@ -481,11 +481,4 @@
     ENDDO
 
-!#ifdef CPP_XIOS
-!     call send_xios_field("du_nonoro", d_u)
-!     call send_xios_field("dv_nonoro", d_v)
-!     call send_xios_field("east_gwstress", east_gwstress)
-!     call send_xios_field("west_gwstress", west_gwstress)
-!#endif
-
   END SUBROUTINE NONORO_GWD_RAN
 
Index: trunk/LMDZ.MARS/libf/phymars/physiq_mod.F
===================================================================
--- trunk/LMDZ.MARS/libf/phymars/physiq_mod.F	(revision 2933)
+++ trunk/LMDZ.MARS/libf/phymars/physiq_mod.F	(revision 2934)
@@ -1294,17 +1294,17 @@
                                              ! temperature tendency
             ! for diagnostics
-            qdustrds0(ig,l)=pq(ig,l,igcm_dust_mass)+
-     &           pdq(ig,l,igcm_dust_mass)*ptimestep
-            qstormrds0(ig,l)=pq(ig,l,igcm_stormdust_mass)+
-     &           pdq(ig,l,igcm_stormdust_mass)*ptimestep
-            qdusttotal0(ig)=qdusttotal0(ig)+(qdustrds0(ig,l)+
-     &          qstormrds0(ig,l))*(zplev(ig,l)-
-     &           zplev(ig,l+1))/g
+!            qdustrds0(ig,l)=pq(ig,l,igcm_dust_mass)+
+!     &           pdq(ig,l,igcm_dust_mass)*ptimestep
+!            qstormrds0(ig,l)=pq(ig,l,igcm_stormdust_mass)+
+!     &           pdq(ig,l,igcm_stormdust_mass)*ptimestep
+!            qdusttotal0(ig)=qdusttotal0(ig)+(qdustrds0(ig,l)+
+!     &          qstormrds0(ig,l))*(zplev(ig,l)-
+!     &           zplev(ig,l+1))/g
            enddo
          enddo
-         call write_output('qdustrds0','qdust before rds',
-     &           'kg/kg ',qdustrds0(:,:))
-         call write_output('qstormrds0','qstorm before rds',
-     &           'kg/kg ',qstormrds0(:,:))
+!         call write_output('qdustrds0','qdust before rds',
+!     &           'kg/kg ',qdustrds0(:,:))
+!         call write_output('qstormrds0','qstorm before rds',
+!     &           'kg/kg ',qstormrds0(:,:))
 
          CALL rocketduststorm(ngrid,nlayer,nq,ptime,ptimestep,
@@ -1355,13 +1355,13 @@
 
 c        for diagnostics
-         call write_output('qdustrds1','qdust after rds',
-     &           'kg/kg ',qdustrds1(:,:))
-         call write_output('qstormrds1','qstorm after rds',
-     &           'kg/kg ',qstormrds1(:,:))
-         
-         call write_output('qdusttotal0','q sum before rds',
-     &           'kg/m2 ',qdusttotal0(:))
-         call write_output('qdusttotal1','q sum after rds',
-     &           'kg/m2 ',qdusttotal1(:))
+!         call write_output('qdustrds1','qdust after rds',
+!     &           'kg/kg ',qdustrds1(:,:))
+!         call write_output('qstormrds1','qstorm after rds',
+!     &           'kg/kg ',qstormrds1(:,:))
+!         
+!         call write_output('qdusttotal0','q sum before rds',
+!     &           'kg/m2 ',qdusttotal0(:))
+!         call write_output('qdusttotal1','q sum after rds',
+!     &           'kg/m2 ',qdusttotal1(:))
 
       ENDIF ! end of if(rdstorm)
@@ -3133,11 +3133,13 @@
 c        WRITEDIAGFI can ALSO be called from any other subroutines
 c        for any variables !!
-         call write_output("emis","Surface emissivity","w.m-1",
+         call write_output("emis","Surface emissivity","",
      &                  emis(:,iflat))
          do islope=1,nslope
            write(str2(1:2),'(i2.2)') islope
            call write_output("emis_slope"//str2,
-     &    "Surface emissivity","w.m-1",emis(:,islope))
+     &    "Surface emissivity","",emis(:,islope))
          ENDDO
+         call write_output("zzlay","Midlayer altitude",
+     &                    "m",zzlay(:,:))
          call write_output("zzlev","Interlayer altitude",
      &                    "m",zzlev(:,1:nlayer))
@@ -3162,10 +3164,10 @@
      &              ,"kg.m-2",qsurf(:,igcm_co2,islope))
          ENDDO
-         call write_output("watercap","Water ice thickness"
+         call write_output("watercap","Perennial water ice thickness"
      &         ,"kg.m-2",watercap(:,iflat))
          do islope=1,nslope
           write(str2(1:2),'(i2.2)') islope
          call write_output("watercap_slope"//str2,
-     &         "Water ice thickness"
+     &         "Perennial water ice thickness"
      &         ,"kg.m-2",watercap(:,islope))
          ENDDO
@@ -3203,5 +3205,6 @@
          call write_output("rho","density","kg.m-3",rho(:,:))
          call write_output("pressure","Pressure","Pa",zplay(:,:))
-         call write_output("pplev","Pressure","Pa",zplev(:,:))
+         call write_output("zplev","Interlayer pressure","Pa",
+     &                     zplev(:,1:nlayer))
         call write_output('sw_htrt','sw heat. rate',
      &                   'K/s',zdtsw(:,:))
@@ -3229,5 +3232,5 @@
       call write_output("u","Zonal wind","m.s-1",zu(:,:))
       call write_output("v","Meridional wind","m.s-1",zv(:,:))
-      call write_output("emis","Surface emissivity","w.m-1",
+      call write_output("emis","Surface emissivity","",
      &                 emis(:,iflat))
       call write_output("tsoil","Soil temperature",
@@ -3395,9 +3398,9 @@
 
 !A. Pottier
-             CALL write_output('rmoym',
-     &                      'alternative reffice',
-     &                      'm',rave2(:))
-            call write_output('saturation',
-     &           'h2o vap saturation ratio','dimless',satu(:,:))
+!             CALL write_output('rmoym',
+!     &                      'alternative reffice',
+!     &                      'm',rave2(:))
+            call write_output('h2o_saturation',
+     &           'h2o vap saturation ratio','',satu(:,:))
             if (scavenging) then
               CALL write_output("Nccntot",
@@ -3408,5 +3411,5 @@
      &                    Mccntot(:))
             endif
-            call write_output('rice','Ice particle size',
+            call write_output('rice','Water ice particle size',
      &                       'm',rice(:,:))
             call write_output('h2o_ice_s',
@@ -3489,11 +3492,9 @@
       if (reff_driven_IRtoVIS_scenario) then
              call write_output('IRtoVIScoef',
-     &  'conversion coeff for dust tau from abs9.3um to ext0.67um',
+     &  'Conversion coeff for dust tau from abs9.3um to ext0.67um',
      &                        '/',IRtoVIScoef(:))
       endif
 
       if (dustbin.ne.0) then
-
-        call write_output('tau','taudust','SI',tau(:,1))
 
 #ifndef MESOINI
@@ -3514,8 +3515,8 @@
 	     select case (trim(dustiropacity))
               case ("tes")
-               call write_output('dsodust',
+               call write_output('dsodust_TES',
      &  'density scaled extinction opacity of std dust at 9.3um(TES)',
      &         'm2.kg-1',dsodust(:,:))
-               call write_output('dso',
+               call write_output('dso_TES',
      &  'density scaled extinction opacity of all dust at 9.3um(TES)',
      &         'm2.kg-1',dsodust(:,:)+dsords(:,:)+dsotop(:,:))
@@ -3564,35 +3565,40 @@
      &                "fraction of the mesh, with stormdust","none",
      &                                         totstormfract(:))
-             call write_output('qsurf',
-     &                 'stormdust injection',
-     &                 'kg.m-2',qsurf(:,igcm_stormdust_mass,iflat))
-         do islope=1,nslope
-          write(str2(1:2),'(i2.2)') islope
-             call write_output('qsurf_slope'//str2,
-     &                 'stormdust injection',
-     &          'kg.m-2',qsurf(:,igcm_stormdust_mass,islope))
-         ENDDO
-             call write_output('pdqsurf',
-     &                  'tendancy stormdust mass at surface',
-     &          'kg.m-2',dqsurf(:,igcm_stormdust_mass,iflat))
-         do islope=1,nslope
-          write(str2(1:2),'(i2.2)') islope
-             call write_output('pdqsurf_slope'//str2,
-     &                  'tendancy stormdust mass at surface',
-     &            'kg.m-2',dqsurf(:,igcm_stormdust_mass,islope))
-         ENDDO
-             call write_output('wspeed','vertical speed stormdust',
-     &                        'm/s',wspeed(:,:))
-             call write_output('zdqsed_dustq'
-     &          ,'sedimentation q','kg.m-2.s-1',
+!             call write_output('qsurf',
+!     &                 'stormdust injection',
+!     &                 'kg.m-2',qsurf(:,igcm_stormdust_mass,iflat))
+!         do islope=1,nslope
+!          write(str2(1:2),'(i2.2)') islope
+!             call write_output('qsurf_slope'//str2,
+!     &                 'stormdust injection',
+!     &          'kg.m-2',qsurf(:,igcm_stormdust_mass,islope))
+!         ENDDO
+!             call write_output('pdqsurf',
+!     &                  'tendancy stormdust mass at surface',
+!     &          'kg.m-2',dqsurf(:,igcm_stormdust_mass,iflat))
+!         do islope=1,nslope
+!          write(str2(1:2),'(i2.2)') islope
+!             call write_output('pdqsurf_slope'//str2,
+!     &                  'tendancy stormdust mass at surface',
+!     &            'kg.m-2',dqsurf(:,igcm_stormdust_mass,islope))
+!         ENDDO
+             call write_output('wspeed_stormdust',
+     &                         'vertical velocity of stormdust',
+     &                         'm/s',wspeed(:,:))
+             call write_output('zdqsed_dust_mass'
+     &          ,'sedimentation tendency of background dust mmr'
+     &          ,'kg/kg.s-1',
      &          zdqsed(:,:,igcm_dust_mass))
-             call write_output('zdqssed_dustq'
-     &          ,'sedimentation q','kg.m-2.s-1',
+             call write_output('zdqssed_dust_mass'
+     &          ,'sedimentation tendency of background dust on surface'
+     &          ,'kg.m-2.s-1',
      &          zdqssed(:,igcm_dust_mass))
-             call write_output('zdqsed_rdsq'
-     &          ,'sedimentation q','kg.m-2.s-1',
+             call write_output('zdqsed_stormdust_mass'
+     &          ,'sedimentation tendency of stormdust dust mmr'
+     &          ,'kg/kg.s-1',
      &          zdqsed(:,:,igcm_stormdust_mass))
-             call write_output('zdqsed_dustN'
-     &          ,'sedimentation N','Nbr.m-2.s-1',
+             call write_output('zdqsed_dust_number'
+     &          ,'sedimentation tendency of background dust number'
+     &          ,'nbr/kg.s-1',
      &          zdqsed(:,:,igcm_dust_number))
              call write_output('rdust','rdust',
@@ -3600,10 +3606,8 @@
              call write_output('rstormdust','rstormdust',
      &                        'm',rstormdust(:,:))
-             call write_output('totaldustq','total dust mass',
-     &                        'kg/kg',qdusttotal(:,:))
 
 	     select case (trim(dustiropacity))
               case ("tes")
-               call write_output('dsords',
+               call write_output('dsords_TES',
      &  'density scaled extinction opacity of stormdust at 9.3um(TES)',
      &         'm2.kg-1',dsords(:,:))
@@ -3616,6 +3620,7 @@
 
            if (topflows) then
-             call write_output('refftopdust','refftopdust',
-     &                        'm',rtopdust(:,:)*ref_r0)
+             call write_output('refftopdust',
+     &                         'Topdust dust effective radius',
+     &                         'm',rtopdust(:,:)*ref_r0)
              call write_output('topdustq','top Dust mass mr',
      &                        'kg/kg',pq(:,:,igcm_topdust_mass))
@@ -3624,5 +3629,5 @@
 	     select case (trim(dustiropacity))
               case ("tes")
-               call write_output('dsotop',
+               call write_output('dsotop_TES',
      &  'density scaled extinction opacity of topdust at 9.3um(TES)',
      &         'm2.kg-1',dsotop(:,:))
@@ -3640,26 +3645,26 @@
            endif
 
-           if (scavenging) then
-             call write_output('ccnq','CCN mass mr',
-     &                        'kg/kg',qccn(:,:))
-             call write_output('ccnN','CCN number',
-     &                        'part/kg',nccn(:,:))
-             call write_output('surfccnq','Surf nuclei mass mr',
-     &                        'kg.m-2',qsurf(:,igcm_ccn_mass,iflat))
-         do islope=1,nslope
-          write(str2(1:2),'(i2.2)') islope
-             call write_output('surfccnq_slope'//str2,
-     &               'Surf nuclei mass mr',
-     &               'kg.m-2',qsurf(:,igcm_ccn_mass,islope))
-         ENDDO
-             call write_output('surfccnN','Surf nuclei number',
-     &                        'kg.m-2',qsurf(:,igcm_ccn_number,iflat))
-         do islope=1,nslope
-          write(str2(1:2),'(i2.2)') islope
-             call write_output('surfccnN_slope'//str2,
-     &                 'Surf nuclei number',
-     &                 'kg.m-2',qsurf(:,igcm_ccn_number,islope))
-         ENDDO
-           endif ! (scavenging)
+!           if (scavenging) then ! these outputs should be in the scavenging routine
+!             call write_output('ccnq','CCN mass mr',
+!     &                        'kg/kg',qccn(:,:))
+!             call write_output('ccnN','CCN number',
+!     &                        'part/kg',nccn(:,:))
+!             call write_output('surfccnq','Surf nuclei mass mr',
+!     &                        'kg.m-2',qsurf(:,igcm_ccn_mass,iflat))
+!         do islope=1,nslope
+!          write(str2(1:2),'(i2.2)') islope
+!             call write_output('surfccnq_slope'//str2,
+!     &               'Surf nuclei mass mr',
+!     &               'kg.m-2',qsurf(:,igcm_ccn_mass,islope))
+!         ENDDO
+!             call write_output('surfccnN','Surf nuclei number',
+!     &                        'kg.m-2',qsurf(:,igcm_ccn_number,iflat))
+!         do islope=1,nslope
+!          write(str2(1:2),'(i2.2)') islope
+!             call write_output('surfccnN_slope'//str2,
+!     &                 'Surf nuclei number',
+!     &                 'kg.m-2',qsurf(:,igcm_ccn_number,islope))
+!         ENDDO
+!           endif ! (scavenging)
 
 #else
@@ -3698,15 +3703,4 @@
 
 c        ----------------------------------------------------------
-c        GW non-oro outputs
-c        ----------------------------------------------------------
-
-         if(calllott_nonoro) then 
-           call write_output("dugwno","GW non-oro dU","m/s2",
-     $           d_u_hin(:,:)/ptimestep)
-           call write_output("dvgwno","GW non-oro dV","m/s2",
-     $           d_v_hin(:,:)/ptimestep)
-         endif                  !(calllott_nonoro)
-
-c        ----------------------------------------------------------
 c        Thermospheric outputs
 c        ----------------------------------------------------------
@@ -3714,12 +3708,8 @@
          if(callthermos) then
 
-            call write_output("q15um","15 um cooling","K/s",
-     $           zdtnlte(:,:))
             call write_output("quv","UV heating","K/s",
      $           zdteuv(:,:))
             call write_output("cond","Thermal conduction","K/s",
      $           zdtconduc(:,:))
-            call write_output("qnir","NIR heating","K/s",
-     $           zdtnirco2(:,:))
 
             !H, H2 and D escape fluxes
@@ -3750,14 +3740,14 @@
       if (calltherm) then
         call write_output('lmax_th',
-     &              'hauteur du thermique','point',
-     &                         lmax_th_out(:))
+     &              'index of vertical extension of thermals',
+     &                   'grid level',lmax_th_out(:))
         call write_output('zmax_th',
-     &                   'hauteur du thermique','m',
+     &                   'vertical extension of thermals','m',
      &                    zmax_th(:))
         call write_output('hfmax_th',
-     &                   'maximum TH heat flux','K.m/s',
+     &                   'maximum heat flux in thermals','K.m/s',
      &                   hfmax_th(:))
         call write_output('wstar',
-     &                   'maximum TH vertical velocity','m/s',
+     &                   'maximum thermals vertical velocity','m/s',
      &                   wstar(:))
       end if
@@ -3795,18 +3785,20 @@
      &                         'opacity of storm dust',''
      &                        ,aerosol(:,:,iaer_stormdust_doubleq))
-             call write_output('dqsdifdustq','diffusion',
-     &          'kg.m-2.s-1',zdqsdif(:,igcm_dust_mass,iflat))
+             call write_output('dqsdifdustq',
+     &'tendency due to vertical diffusion of background dust on surface'
+     &          ,'kg.m-2.s-1',zdqsdif(:,igcm_dust_mass,iflat))
          do islope=1,nslope
           write(str2(1:2),'(i2.2)') islope
              call write_output('dqsdifdustq_slope'//str2,
-     &             'diffusion',
-     &          'kg.m-2.s-1',zdqsdif(:,igcm_dust_mass,islope))
+     &'tendency due to vertical diffusion of background dust on surface'
+     &          ,'kg.m-2.s-1',zdqsdif(:,igcm_dust_mass,islope))
          ENDDO
-             call write_output('dqsdifrdsq','diffusion',
+             call write_output('dqsdifrdsq',
+     & 'tendency due to vertical diffusion of stormdust on surface',
      &          'kg.m-2.s-1',zdqsdif(:,igcm_stormdust_mass,iflat))
          do islope=1,nslope
           write(str2(1:2),'(i2.2)') islope
              call write_output('dqsdifrdsq_slope'//str2,
-     &           'diffusion',
+     & 'tendency due to vertical diffusion of stormdust on surface',
      &          'kg.m-2.s-1',zdqsdif(:,igcm_stormdust_mass,islope))
          ENDDO
@@ -3873,10 +3865,9 @@
         call write_output( 'co2conservation',
      &                     'Total CO2 mass conservation in physic',
-     &                     ' ', co2conservation)
+     &                     'kg', co2conservation)
 ! XIOS outputs
 #ifdef CPP_XIOS      
       ! Send fields to XIOS: (NB these fields must also be defined as
       ! <field id="..." /> in context_lmdz_physics.xml to be correctly used)
-      CALL send_xios_field("ls",zls*180./pi)
 
       CALL send_xios_field("controle",tab_cntrl_mod,1)
@@ -3886,52 +3877,4 @@
       CALL send_xios_field("aps",aps,1)
       CALL send_xios_field("bps",bps,1)
-
-      CALL send_xios_field("phisinit",phisfi)
-      
-      CALL send_xios_field("ps",ps)
-      CALL send_xios_field("area",cell_area)
-
-!      CALL send_xios_field("ISR",fluxtop_dn_sw_tot)
-      CALL send_xios_field("OLR",fluxtop_lw)
-
-      CALL send_xios_field("tsurf",tsurf(:,iflat))
-!      CALL send_xios_field("inertiedat",inertiedat)
-      CALL send_xios_field("tsoil",tsoil(:,:,iflat))
-      CALL send_xios_field("co2ice",qsurf(:,igcm_co2,iflat))
-      
-!      CALL send_xios_field("temp",zt)
-      CALL send_xios_field("u",zu)
-      CALL send_xios_field("v",zv)
-
-!      CALL send_xios_field("rho",rho)
-      ! Orographic Gravity waves tendencies
-!      if (calllott) then
-!      CALL send_xios_field("dugw",zdugw/ptimestep)
-!      CALL send_xios_field("dvgw",zdvgw/ptimestep)
-!      CALL send_xios_field("dtgw",zdtgw/ptimestep)
-!      endif
-      !CREATE IF CO2CYCLE
-!      if (igcm_co2.ne.0) then
-!         CALL send_xios_field("co2",zq(:,:,igcm_co2))
-!      endif
-      ! Water cycle
-!      if (water) then
-!         CALL send_xios_field("watercap",watercap)
-         !CALL send_xios_field("watercaptag",watercaptag)
-!         CALL send_xios_field("mtot",mtot)
-!         CALL send_xios_field("icetot",icetot)
-!         if (igcm_h2o_vap.ne.0 .and. igcm_h2o_ice.ne.0) then
-!            CALL send_xios_field("h2o_vap",zq(:,:,igcm_h2o_vap))
-!            CALL send_xios_field("h2o_ice",zq(:,:,igcm_h2o_ice))
-!         endif
-!      endif
-!            if (.not.activice) then
-!      CALL send_xios_field("tauTESap",tauTES)
-!             else
-!      CALL send_xios_field("tauTES",taucloudtes)
-!             endif
-
-!      CALL send_xios_field("h2o_ice_s",qsurf(:,igcm_h2o_ice))
-
 
       if (lastcall.and.is_omp_master) then
Index: trunk/LMDZ.MARS/libf/phymars/rocketduststorm_mod.F90
===================================================================
--- trunk/LMDZ.MARS/libf/phymars/rocketduststorm_mod.F90	(revision 2933)
+++ trunk/LMDZ.MARS/libf/phymars/rocketduststorm_mod.F90	(revision 2934)
@@ -526,10 +526,12 @@
 ! WRITEDIAGFI
 
-        call write_output('lapserate','lapse rate in the storm', &
-           &                        'k/m',lapserate(:,:))
-        call write_output('deltahr','extra heating rates', &
-           &                        'K/s',deltahr(:,:))
-        call write_output('scheme','which scheme',&
-                                                   ' ',real(scheme(:)))
+        call write_output('rds_lapserate', &
+                          'lapse rate in the rocket dust storm', &
+                                    'K/m',lapserate(:,:))
+        call write_output('rds_deltahr', &
+                          'extra heating rate in the rocket dust storm', &
+                                    'K/s',deltahr(:,:))
+!        call write_output('scheme','which scheme',&
+!                                                   ' ',real(scheme(:)))
 
         END SUBROUTINE rocketduststorm
Index: trunk/LMDZ.MARS/libf/phymars/topmons_mod.F90
===================================================================
--- trunk/LMDZ.MARS/libf/phymars/topmons_mod.F90	(revision 2933)
+++ trunk/LMDZ.MARS/libf/phymars/topmons_mod.F90	(revision 2934)
@@ -643,53 +643,53 @@
 ! WRITEDIAGFI
 ! **********************************************************************
-               CALL write_output('wup_top', &
-                'wup_top','',wup(:,:))
-               CALL write_output('wlwmax_top', &
-                'wlwmax_top','',wup(:,lwmax(1)))
-               CALL write_output('w0_top', &
-                'w0_top','',wup(:,lsummit(1)+1))
-               CALL write_output('wup2_top', &
-                'wup2_top','',wup2(:,:))
-               CALL write_output('wrad_top', &
-                'wrad_top','',wrad(:,:))
-               CALL write_output('wfin_top', &
-                'wfin_top','',wfin(:,:))
-               CALL write_output('hmons', &
-                'hmons','',hmons(:))
-               CALL write_output('hsummit', &
-                'hsummit','',hsummit(:))
-               CALL write_output('alpha_hmons', &
-                'alpha_hmons','',alpha_hmons(:))
-               CALL write_output('zt_top', &
-                'zt_top','',t_top(:,:))
-               CALL write_output('dt_top', &
-                'dt_top','',dt_top(:))
-               CALL write_output('ztemp', &
-                'envtemp','',zt(:,:))
-               CALL write_output('zt_env', &
-                't_env','',t_env(:,:))
-               CALL write_output('zdtvert_top', &
-                'zdtvert_top','',zdtvert(:,:))
-               CALL write_output('newzt_top', &
-                'newzt_top','',newzt(:,:))
-               CALL write_output('deltahr_top', &
-                'deltahr_top','',deltahr(:,:))
-               CALL write_output('rhobarz', &
-                'rhobarz','',rhobarz(:,:))
-               CALL write_output('zlwmax', &
-                'zlwmax','',zlaywmax(:))
-               CALL write_output('coefdetrain', &
-                'coefdetrain','',coefdetrain(:,:))
-               CALL write_output('detrain_rate', &
-                              'detrain_rate', &
-                              '',detrain_rate(:,:))
-               CALL write_output('rholev', &
-                'rholev','',rho(:,:))
-               CALL write_output('zlsummit', &
-                'zlsummit','',pzlay(:,lsummit(1)))
-               CALL write_output('pzlev_top', &
-                'pzlev_top','',pzlev(:,:))
-               CALL write_output('entr', &
-                'entr','',entr(:))
+!               CALL write_output('wup_top', &
+!                'wup_top','',wup(:,:))
+!               CALL write_output('wlwmax_top', &
+!                'wlwmax_top','',wup(:,lwmax(1)))
+!               CALL write_output('w0_top', &
+!                'w0_top','',wup(:,lsummit(1)+1))
+!               CALL write_output('wup2_top', &
+!                'wup2_top','',wup2(:,:))
+!               CALL write_output('wrad_top', &
+!                'wrad_top','',wrad(:,:))
+!               CALL write_output('wfin_top', &
+!                'wfin_top','',wfin(:,:))
+!               CALL write_output('hmons', &
+!                'hmons','',hmons(:))
+!               CALL write_output('hsummit', &
+!                'hsummit','',hsummit(:))
+!               CALL write_output('alpha_hmons', &
+!                'alpha_hmons','',alpha_hmons(:))
+!               CALL write_output('zt_top', &
+!                'zt_top','',t_top(:,:))
+!               CALL write_output('dt_top', &
+!                'dt_top','',dt_top(:))
+!               CALL write_output('ztemp', &
+!                'envtemp','',zt(:,:))
+!               CALL write_output('zt_env', &
+!                't_env','',t_env(:,:))
+!               CALL write_output('zdtvert_top', &
+!                'zdtvert_top','',zdtvert(:,:))
+!               CALL write_output('newzt_top', &
+!                'newzt_top','',newzt(:,:))
+!               CALL write_output('deltahr_top', &
+!                'deltahr_top','',deltahr(:,:))
+!               CALL write_output('rhobarz', &
+!                'rhobarz','',rhobarz(:,:))
+!               CALL write_output('zlwmax', &
+!                'zlwmax','',zlaywmax(:))
+!               CALL write_output('coefdetrain', &
+!                'coefdetrain','',coefdetrain(:,:))
+!               CALL write_output('detrain_rate', &
+!                              'detrain_rate', &
+!                              '',detrain_rate(:,:))
+!               CALL write_output('rholev', &
+!                'rholev','',rho(:,:))
+!               CALL write_output('zlsummit', &
+!                'zlsummit','',pzlay(:,lsummit(1)))
+!               CALL write_output('pzlev_top', &
+!                'pzlev_top','',pzlev(:,:))
+!               CALL write_output('entr', &
+!                'entr','',entr(:))
         
         END SUBROUTINE topmons
Index: trunk/LMDZ.MARS/libf/phymars/vdifc_mod.F
===================================================================
--- trunk/LMDZ.MARS/libf/phymars/vdifc_mod.F	(revision 2933)
+++ trunk/LMDZ.MARS/libf/phymars/vdifc_mod.F	(revision 2934)
@@ -155,5 +155,5 @@
 
       REAL hdoflux(ngrid)       ! value of vapour flux of HDO
-      REAL h2oflux(ngrid)       ! value of vapour flux of H2O
+!      REAL h2oflux(ngrid)       ! value of vapour flux of H2O
       REAL old_h2o_vap(ngrid)   ! traceur d'eau avant traitement
 
@@ -1063,12 +1063,12 @@
 
 C       Diagnostic output for HDO
-        if (hdo) then
-            CALL write_output('hdoflux',
-     &                       'hdoflux',
-     &                       ' ',hdoflux(:))  
-            CALL write_output('h2oflux',
-     &                       'h2oflux',
-     &                       ' ',h2oflux(:))
-        endif
+!        if (hdo) then
+!            CALL write_output('hdoflux',
+!     &                       'hdoflux',
+!     &                       ' ',hdoflux(:))  
+!            CALL write_output('h2oflux',
+!     &                       'h2oflux',
+!     &                       ' ',h2oflux(:))
+!        endif
 
 c-----------------------------------------------------------------------
Index: trunk/LMDZ.MARS/libf/phymars/watercloud_mod.F
===================================================================
--- trunk/LMDZ.MARS/libf/phymars/watercloud_mod.F	(revision 2933)
+++ trunk/LMDZ.MARS/libf/phymars/watercloud_mod.F	(revision 2934)
@@ -269,12 +269,12 @@
      &                           cloudfrac(:,:)
       !! CLFvarying outputs
-      CALL write_output('pqeffice','pqeffice',
-     &             'kg/kg',pqeff(:,:,igcm_h2o_ice))
-      CALL write_output('pteff','pteff',
-     &             'K',pteff(:,:))
-      CALL write_output('tcond','tcond',
-     &             'K',tcond(:,:))
-      CALL write_output('cloudfrac','cloudfrac',
-     &             'K',cloudfrac(:,:))
+!      CALL write_output('pqeffice','pqeffice',
+!     &             'kg/kg',pqeff(:,:,igcm_h2o_ice))
+!      CALL write_output('pteff','pteff',
+!     &             'K',pteff(:,:))
+!      CALL write_output('tcond','tcond',
+!     &             'K',tcond(:,:))
+!      CALL write_output('cloudfrac','cloudfrac',
+!     &             'K',cloudfrac(:,:))
       END IF ! end if (CLFvarying)
 c------------------------------------------------------------------
@@ -714,28 +714,26 @@
 #ifndef MESOSCALE
 c=======================================================================
-      call write_output("pdqice2","pdqcloudice apres microphysique"
-     &      ,"kg/kg.s-1",pdqcloud(:,:,igcm_h2o_ice))
-      call write_output("pdqvap2","pdqcloudvap apres microphysique"
-     &      ,"kg/kg.s-1",pdqcloud(:,:,
-     &      igcm_h2o_vap))
+      call write_output("watercloud_pdqh2oice","pdqcloud_h2o_ice "//
+     &   "after microphysics","kg/kg.s-1",pdqcloud(:,:,igcm_h2o_ice))
+      call write_output("watercloud_pdqh2ovap","pdqcloud_h2o_vap "//
+     &   "after microphysics","kg/kg.s-1",pdqcloud(:,:,igcm_h2o_vap))
       if (hdo) then
-      call write_output("pdqiceD","pdqiceD apres microphysique"
-     &      ,"kg/kg.s-1",pdqcloud(:,:,igcm_hdo_ice))
-      call write_output("pdqvapD","pdqvapD apres microphysique"
-     &      ,"kg/kg.s-1",pdqcloud(:,:,
-     &      igcm_hdo_vap))
+        call write_output("watercloud_pdqhdoice","pdqcloud_hdo_ice "//
+     &     "after microphysics","kg/kg.s-1",pdqcloud(:,:,igcm_hdo_ice))
+        call write_output("watercloud_pdqhdovap","pdqcloud_hdo_vap "//
+     &     "after microphysics","kg/kg.s-1",pdqcloud(:,:,igcm_hdo_vap))
       endif
-      call write_output("pdqccn2","pdqcloudccn apres microphysique"
-     &      ,"kg/kg.s-1",pdqcloud(:,:,
-     &      igcm_ccn_mass)) 
-      call write_output("pdqccnN2","pdqcloudccnN apres "//
-     &      "microphysique","nb/kg.s-1",pdqcloud(:,:,
-     &      igcm_ccn_number))
-      call write_output("pdqdust2", "pdqclouddust apres "//
-     &      "microphysique","kg/kg.s-1",pdqcloud(:,:,
-     &      igcm_dust_mass))
-      call write_output("pdqdustN2", "pdqclouddustN apres "//
-     &      "microphysique","nb/kg.s-1",pdqcloud(:,:,
-     &      igcm_dust_number)) 
+!      call write_output("pdqccn2","pdqcloudccn apres microphysique"
+!     &      ,"kg/kg.s-1",pdqcloud(:,:,
+!     &      igcm_ccn_mass)) 
+!      call write_output("pdqccnN2","pdqcloudccnN apres "//
+!     &      "microphysique","nb/kg.s-1",pdqcloud(:,:,
+!     &      igcm_ccn_number))
+!      call write_output("pdqdust2", "pdqclouddust apres "//
+!     &      "microphysique","kg/kg.s-1",pdqcloud(:,:,
+!     &      igcm_dust_mass))
+!      call write_output("pdqdustN2", "pdqclouddustN apres "//
+!     &      "microphysique","nb/kg.s-1",pdqcloud(:,:,
+!     &      igcm_dust_number)) 
 c=======================================================================
 #endif
Index: trunk/LMDZ.MARS/libf/phymars/write_output_mod.F90
===================================================================
--- trunk/LMDZ.MARS/libf/phymars/write_output_mod.F90	(revision 2933)
+++ trunk/LMDZ.MARS/libf/phymars/write_output_mod.F90	(revision 2934)
@@ -4,5 +4,5 @@
     
     INTERFACE write_output
-      MODULE PROCEDURE write_output_d0,write_output_d1,write_output_d2,write_output_d3
+      MODULE PROCEDURE write_output_d0,write_output_d1,write_output_d2
     END INTERFACE write_output
 
@@ -13,4 +13,7 @@
   SUBROUTINE write_output_d0(field_name,title,units,field)
   ! For a surface field
+#ifdef CPP_XIOS
+  use xios_output_mod, only: send_xios_field
+#endif
   IMPLICIT NONE
   include "dimensions.h"
@@ -31,4 +34,7 @@
   SUBROUTINE write_output_d1(field_name,title,units,field)
   ! For a surface field
+#ifdef CPP_XIOS
+  use xios_output_mod, only: send_xios_field
+#endif
   use comsoil_h, only: nsoilmx
   use writediagsoil_mod, only: writediagsoil
@@ -51,4 +57,7 @@
   SUBROUTINE write_output_d2(field_name,title,units,field)
   ! For a "3D" horizontal-vertical field
+#ifdef CPP_XIOS
+  use xios_output_mod, only: send_xios_field
+#endif
   use comsoil_h, only: nsoilmx
   use writediagsoil_mod, only: writediagsoil
@@ -73,27 +82,3 @@
   END SUBROUTINE write_output_d2
 
-  SUBROUTINE write_output_d3(field_name,title,units,field)
-  ! For a "4D" field surf/alt/??
-  use comsoil_h, only: nsoilmx
-  use writediagsoil_mod, only: writediagsoil
-  IMPLICIT NONE
-  include "dimensions.h"
-  INTEGER ngrid
-  PARAMETER( ngrid = 2+(jjm-1)*iim - 1/jjm   )
-  CHARACTER(LEN=*),INTENT(IN)    :: field_name
-  CHARACTER(LEN=*),INTENT(IN)    :: title
-  CHARACTER(LEN=*),INTENT(IN)    :: units
-  REAL,INTENT(IN)                :: field(:,:,:)
-
-  if(size(field(:,:,:),3).eq.nsoilmx) then
-    call writediagsoil(ngrid,field_name,title,units,4,field)
-  else 
-    call writediagfi(ngrid,field_name,title,units,4,field)
-  endif
-#ifdef CPP_XIOS 
-  call send_xios_field(field_name,field)
-#endif
-  
-  END SUBROUTINE write_output_d3
-
 END MODULE write_output_mod
