Index: /trunk/LMDZ.COMMON/libf/evolution/constants_marspem_mod.F90
===================================================================
--- /trunk/LMDZ.COMMON/libf/evolution/constants_marspem_mod.F90	(revision 2964)
+++ /trunk/LMDZ.COMMON/libf/evolution/constants_marspem_mod.F90	(revision 2965)
@@ -16,7 +16,7 @@
       REAL,PARAMETER :: beta_clap_co2 = 3182.48   !Kelvin, James et al. 1992
 
-!     Coefficient for Clapeyron law for psat(psat = exp(beta/Th2o+alpha)),following Murphie and Kood 2005
-      REAL,PARAMETER :: alpha_clap_h2o = 28.9074  ! Uniteless, Murphie and Kood 2005
-      REAL,PARAMETER :: beta_clap_h2o = -6143.7   ! Kelvin, Murphie and Kood 2005
+!     Coefficient for Clapeyron law for psat (psat = exp(beta/Th2o+alpha)),following Murphy and Koop 2005
+      REAL,PARAMETER :: alpha_clap_h2o = 28.9074  ! Uniteless, Murphy and Koop 2005
+      REAL,PARAMETER :: beta_clap_h2o = -6143.7   ! Kelvin, Murphy and Koop 2005
 
 !     Density of the regolith (Zent et al., 1995, Buhler and Piqueux 2021)     
Index: /trunk/LMDZ.MARS/changelog.txt
===================================================================
--- /trunk/LMDZ.MARS/changelog.txt	(revision 2964)
+++ /trunk/LMDZ.MARS/changelog.txt	(revision 2965)
@@ -4035,4 +4035,10 @@
 This is the place to define the output (file name, variable, frequency, operation...) of the physic when using XIOS.
 
-
-
+== 17/05/2023 == AB
+Fixed r2963 which was preventing to compile the model without XIOS
++ changed the computation of variables rhowater_* so that they are real densities (factor 1/rvap missing ; this doesn't affect the previous PEM results as these densities were only compared between each other)
++ added comments and units for ice table variables in physiq_mod.F
++ made Clapeyron coefficient names in physiq_mod.F coherent with how they are defined in the PEM
++ fixed a reference in constants_marspem_mod.F90
++ fixed unit attribute of surface/soil water densities in field_def_physics_mars.xml
+
Index: /trunk/LMDZ.MARS/deftank/field_def_physics_mars.xml
===================================================================
--- /trunk/LMDZ.MARS/deftank/field_def_physics_mars.xml	(revision 2964)
+++ /trunk/LMDZ.MARS/deftank/field_def_physics_mars.xml	(revision 2965)
@@ -377,23 +377,23 @@
             <field id="Waterdensity_surface01"
                    long_name="Waterdensity_surface of slope 01"
-                   unit="XX" />
+                   unit="kg.m-3" />
             <field id="Waterdensity_surface02"
                    long_name="Waterdensity_surface of slope 02"
-                   unit="XX" />
+                   unit="kg.m-3" />
             <field id="Waterdensity_surface03"
                    long_name="Waterdensity_surface of slope 03"
-                   unit="XX" />
+                   unit="kg.m-3" />
             <field id="Waterdensity_surface04"
                    long_name="Waterdensity_surface of slope 04"
-                   unit="XX" />
+                   unit="kg.m-3" />
             <field id="Waterdensity_surface05"
                    long_name="Waterdensity_surface of slope 05"
-                   unit="XX" />
+                   unit="kg.m-3" />
             <field id="Waterdensity_surface06"
                    long_name="Waterdensity_surface of slope 06"
-                   unit="XX" />
+                   unit="kg.m-3" />
             <field id="Waterdensity_surface07"
                    long_name="Waterdensity_surface of slope 07"
-                   unit="XX" />
+                   unit="kg.m-3" />
             <field id="h2o_layer1"
                    long_name="h2o in the first layer"  
@@ -716,24 +716,24 @@
                    unit="J/kg/K" />
             <field id="Waterdensity_soil_slope01"
-                   long_name="rhowater_soil"
-                   unit="J/kg/K" />
+                   long_name="Waterdensity_soil of slope 01"
+                   unit="kg.m-3" />
             <field id="Waterdensity_soil_slope02"
-                   long_name="rhowater_soil"
-                   unit="J/kg/K" />
+                   long_name="Waterdensity_soil of slope 02"
+                   unit="kg.m-3" />
             <field id="Waterdensity_soil_slope03"
-                   long_name="rhowater_soil"
-                   unit="J/kg/K" />
+                   long_name="Waterdensity_soil of slope 03"
+                   unit="kg.m-3" />
             <field id="Waterdensity_soil_slope04"
-                   long_name="rhowater_soil"
-                   unit="J/kg/K" />
+                   long_name="Waterdensity_soil of slope 04"
+                   unit="kg.m-3" />
             <field id="Waterdensity_soil_slope05"
-                   long_name="rhowater_soil"
-                   unit="J/kg/K" />
+                   long_name="Waterdensity_soil of slope 05"
+                   unit="kg.m-3" />
             <field id="Waterdensity_soil_slope06"
-                   long_name="rhowater_soil"
-                   unit="J/kg/K" />
+                   long_name="Waterdensity_soil of slope 06"
+                   unit="kg.m-3" />
             <field id="Waterdensity_soil_slope07"
-                   long_name="rhowater_soil"
-                   unit="J/kg/K" />
+                   long_name="Waterdensity_soil of slope 07"
+                   unit="kg.m-3" />
 
         </field_group>
Index: /trunk/LMDZ.MARS/libf/phymars/physiq_mod.F
===================================================================
--- /trunk/LMDZ.MARS/libf/phymars/physiq_mod.F	(revision 2964)
+++ /trunk/LMDZ.MARS/libf/phymars/physiq_mod.F	(revision 2965)
@@ -546,13 +546,13 @@
 
 ! Variable for ice table
-      REAL :: rhowater_surf(ngrid,nslope)
-      REAL :: rhowater_surf_sat(ngrid,nslope)
-      REAL :: rhowater_soil(ngrid,nsoilmx,nslope)
-      REAL,PARAMETER  :: alph_clap = -6143.7
-      REAL,PARAMETER :: beta_clap = 28.9074
-      REAL :: pvap_surf(ngrid)
-      REAL,PARAMETER :: m_co2 = 44.01E-3  ! CO2 molecular mass (kg/mol)   
-      REAL,PARAMETER :: m_noco2 = 33.37E-3  ! Non condensible mol mass (kg/mol)   
-      REAL :: ztmp1,ztmp2
+      REAL :: rhowater_surf(ngrid,nslope)         ! Water density at the surface [kg/m^3]
+      REAL :: rhowater_surf_sat(ngrid,nslope)     ! Water density at the surface at saturation [kg/m^3]
+      REAL :: rhowater_soil(ngrid,nsoilmx,nslope) ! Water density in soil layers [kg/m^3]
+      REAL,PARAMETER :: alpha_clap_h2o = 28.9074  ! Coeff for Clapeyron law [/]
+      REAL,PARAMETER :: beta_clap_h2o = -6143.7   ! Coeff for Clapeyron law [K]
+      REAL :: pvap_surf(ngrid)                    ! Water vapor partial pressure in first layer [Pa]
+      REAL,PARAMETER :: m_co2 = 44.01E-3          ! CO2 molecular mass [kg/mol]
+      REAL,PARAMETER :: m_noco2 = 33.37E-3        ! Non condensible mol mass [kg/mol]
+      REAL :: ztmp1,ztmp2                         ! intermediate variables to compute the mean molar mass of the layer
 
 c=======================================================================
@@ -3847,20 +3847,24 @@
 
             DO islope = 1,nslope
+	    ! Clapeyron law for psat (psat = exp(beta/Th2o+alpha)),following Murphy and Koop 2005
              rhowater_surf_sat(ig,islope)  =
-     &         exp(alph_clap/tsurf(ig,islope)+beta_clap)
+     &         exp(beta_clap_h2o/tsurf(ig,islope)+alpha_clap_h2o)
      &         / tsurf(ig,islope)
+     &         * mmol(igcm_h2o_vap)/(mugaz*r)
  
              if(qsurf(ig,igcm_h2o_ice,islope).gt.(1.e-4)) then
-               rhowater_surf(ig,islope) =
-     &         exp(alph_clap/tsurf(ig,islope)+beta_clap)
-     &         / tsurf(ig,islope)
+	       ! we consider to be at saturation above 1.e-4 kg.m-2
+               rhowater_surf(ig,islope) = rhowater_surf_sat(ig,islope)
              else
+	      ! otherwise, use vapor partial pressure
               rhowater_surf(ig,islope) = pvap_surf(ig)
      &         / tsurf(ig,islope)
+     &         * mmol(igcm_h2o_vap)/(mugaz*r)
              endif
              DO isoil = 1,nsoilmx
              rhowater_soil(ig,isoil,islope) =
-     &         exp(alph_clap/tsoil(ig,isoil,islope)+beta_clap)
+     &         exp(beta_clap_h2o/tsoil(ig,isoil,islope)+alpha_clap_h2o)
      &         / tsoil(ig,isoil,islope)
+     &         * mmol(igcm_h2o_vap)/(mugaz*r)
              ENDDO
           ENDDO
@@ -3869,12 +3873,16 @@
       DO islope = 1,nslope
         write(str2(1:2),'(i2.2)') islope
-        CALL send_xios_field("Waterdensity_soil_slope"//str2,
+        CALL write_output("Waterdensity_soil_slope"//str2,
+     &     "rhowater_soil_slope"//str2,'kg.m-3',
      &     rhowater_soil(:,:,islope))
-        CALL send_xios_field("Waterdensity_surface"//str2,
+        CALL write_output("Waterdensity_surface"//str2,
+     &     "rhowater_surface"//str2,'kg.m-3',
      &     rhowater_surf(:,islope))
       ENDDO
 
-      CALL send_xios_field("h2o_layer1",zq(:,1,igcm_h2o_vap))
-      CALL send_xios_field("co2_layer1",zq(:,1,igcm_co2))
+      CALL write_output("h2o_layer1","h2o mass mr in the first layer",
+     &     'kg/kg',zq(:,1,igcm_h2o_vap))
+      CALL write_output("co2_layer1","co2 mass mr in the first layer",
+     &     'kg/kg',zq(:,1,igcm_co2))
 
 !PREVIOUSLY IN 1D ONLY
