Index: branches/ORCHIDEE_2_2/ORCHIDEE/src_xml/context_input_orchidee.xml
===================================================================
--- branches/ORCHIDEE_2_2/ORCHIDEE/src_xml/context_input_orchidee.xml	(revision 8463)
+++ branches/ORCHIDEE_2_2/ORCHIDEE/src_xml/context_input_orchidee.xml	(revision 8468)
@@ -30,4 +30,13 @@
       <field id="soilcolor" name="soilcolor" domain_ref="dom_file_soil" operation="instant" freq_offset="1ts" enabled="false"/>
       <field id="soiltext" name="soiltext" domain_ref="dom_file_soil" operation="instant" freq_offset="1ts"/>
+    </file>
+
+    <!-- Default file name: soil_bulk_and_ph.nc for both soilbulk and soilph. The variables can be read from different files, specified in run.def
+                  This file is read in the initialization phase only if there is no restart file.
+         For soilbulk and soilph, set values lower than min_sechiba as masked values because missing values are zero in the file.
+        Renormalization will be done later using the interpolated mask.  -->
+    <file id="soilbulk_file" mode="read" output_freq="1y" enabled="true">
+      <field id="soilbulk_mask_read" name="soilbulk" domain_ref="dom_file_soilbulk" operation="instant" freq_offset="1ts" > this &gt; $min_sechiba ? 1 : 0 </field>
+      <field id="soilbulk_read" name="soilbulk" domain_ref="dom_file_soilbulk" operation="instant" freq_offset="1ts" > this &gt; $min_sechiba ? this : 0 </field>
     </file>
 
@@ -134,4 +143,11 @@
         <field id="soiltext13" > soiltext == 13 </field>
       </field_group>
+
+      <!-- If soilbulk_mask .gt. min_sechiba, then renormalize by dividing with soilbulk_mask else set bulk_default.
+      soilbulk_mask interpolated to the model grid corresponds to the fraction of the grid cell covered by non-masked
+      values in the input file. Where soilbulk_mask=0, no data where found on the source grid. -->
+      <field id="soilbulk_tmp"  field_ref="soilbulk_read" domain_ref="dom_from_soilbulk" />
+      <field id="soilbulk_mask" field_ref="soilbulk_mask_read" domain_ref="dom_from_soilbulk" read_access="true" enabled="true" />
+      <field id="soilbulk"      field_ref="soilbulk_tmp"  domain_ref="dom_from_soilbulk" read_access="true" enabled="true"  > soilbulk_mask &gt; $min_sechiba ? soilbulk_tmp/(soilbulk_mask+1e-100) : $bulk_default </field>
       
       <field id="frac_veget"      field_ref="maxvegetfrac_read" domain_ref="dom_from_pft" read_access="true" enabled="true" />
@@ -220,4 +236,8 @@
     </domain>
 
+    <domain id="dom_from_soilbulk" domain_ref="domain_landpoints">
+    <interpolate_domain order="1" renormalize="false" />
+    </domain>
+
     <domain id="dom_from_pft" domain_ref="domain_landpoints">
       <interpolate_domain order="1" renormalize="false" />
@@ -258,4 +278,8 @@
       <!-- generate_rectilinear_domain bounds_lon_start="-180" bounds_lon_end="180" bounds_lat_start="-90" bounds_lat_end="90"/-->
       <generate_rectilinear_domain bounds_lon_start="-180" bounds_lon_end="180" bounds_lat_start="90" bounds_lat_end="-90"/>
+    </domain>
+
+    <domain id="dom_file_soilbulk" type="rectilinear">
+    <generate_rectilinear_domain bounds_lon_start="-180" bounds_lon_end="180" bounds_lat_start="90" bounds_lat_end="-90"/>/>
     </domain>
     
@@ -346,4 +370,5 @@
     <variable id="albbg_vis_default" type="double">xxx</variable>
     <variable id="albbg_nir_default" type="double">xxx</variable>
+    <variable id="bulk_default" type="double">xxx</variable>
     
   </variable_definition>
Index: branches/ORCHIDEE_2_2/ORCHIDEE/src_xml/field_def_orchidee.xml
===================================================================
--- branches/ORCHIDEE_2_2/ORCHIDEE/src_xml/field_def_orchidee.xml	(revision 8463)
+++ branches/ORCHIDEE_2_2/ORCHIDEE/src_xml/field_def_orchidee.xml	(revision 8468)
@@ -358,5 +358,4 @@
     <field id="gpplut" name="gppLut" long_name="Gross primary productivity on Landuse tiles" unit="kgC m-2 s-1" grid_ref="grid_nlut" />
 
-
     <!-- Varaibles interp_diag_xxx and interp_avail_xxx are written just after reading and interpolating from file and are used for validation -->
     <field id="interp_avail_aveget" name="interp_avail_aveget" long_name="Availability of data for the vegetation fraction interpolation (negative values if no data found)" unit="1" operation="once" freq_offset="0ts"/>
@@ -366,4 +365,5 @@
     <field id="interp_diag_soilclass" name="interp_diag_soilclass"     grid_ref="grid_nscm" long_name="soilclass read from soils_param file" operation="once" freq_offset="0ts"/>
     <field id="interp_diag_njsc" name="interp_diag_njsc" long_name="njsc after reading of soilclass from soils_param file" operation="once" freq_offset="0ts"/>
+    <field id="interp_diag_bulk" name="interp_diag_bulk" long_name="Soil bulk density read from file" unit="kg/m**3" operation="once" freq_offset="0ts"/>
     <field id="interp_diag_clayfraction" name="interp_diag_clayfraction" long_name="clayfraction read from soils_param file" operation="once" freq_offset="0ts" />
     <field id="interp_diag_sandfraction" name="interp_diag_sandfraction" long_name="sandfraction read from soils_param file" operation="once" freq_offset="0ts" />
@@ -636,4 +636,10 @@
   <field id="vegetmax_soil" name="vegetsoil" long_name="PFT fraction for soil tiles" unit="1" grid_ref="grid_nvm_nstm"/>
 
+  <!-- Output variables for Moyano et al. 2012 control humidity function -->
+  <field id="ControlMoistLitter" name="ControlMoistLitter" long_name="Controle moist value for iabove" unit="1" grid_ref="grid_landpoints" />
+  <field id="ControlMoistSoil" name="ControlMoistSoil" long_name="Controle moist value for ibelow" unit="1" grid_ref="grid_landpoints"/>
+  <field id="litterhumSAT" name="litterhumSAT" long_name="litter moisture for the controle moisture fonction" unit="1" grid_ref="grid_landpoints"/>
+  <field id="soilhumSAT" name="soilhumSAT" long_name="soil moisture for the control moisture fonction" unit="1" grid_ref="grid_landpoints"/>
+
 </field_definition>
 
Index: branches/ORCHIDEE_2_2/ORCHIDEE/src_xml/file_def_orchidee.xml
===================================================================
--- branches/ORCHIDEE_2_2/ORCHIDEE/src_xml/file_def_orchidee.xml	(revision 8463)
+++ branches/ORCHIDEE_2_2/ORCHIDEE/src_xml/file_def_orchidee.xml	(revision 8468)
@@ -991,4 +991,11 @@
     <field field_ref="nppOther" level="1"/>
     <field field_ref="nep" level="0"/>
+
+    <!-- variables for Moyano control moisture -->
+    <field field_ref="ControlMoistLitter" level="1"/>
+    <field field_ref="ControlMoistSoil" level="1"/>
+    <field field_ref="litterhumSAT" level="1"/>
+    <field field_ref="soilhumSAT" level="1"/>
+
    </field_group>
     
