Index: /branches/2013/dev_r4028_CNRS_LIM3/NEMOGCM/CONFIG/ORCA2_LIM3/EXP00/domain_def.xml
===================================================================
--- /branches/2013/dev_r4028_CNRS_LIM3/NEMOGCM/CONFIG/ORCA2_LIM3/EXP00/domain_def.xml	(revision 4344)
+++ /branches/2013/dev_r4028_CNRS_LIM3/NEMOGCM/CONFIG/ORCA2_LIM3/EXP00/domain_def.xml	(revision 4345)
@@ -5,5 +5,6 @@
 	 <!--   My zoom: example of hand defined zoom   -->
          <domain id="myzoom" zoom_ibegin="10" zoom_jbegin="10" zoom_ni="5" zoom_nj="5" />
-	 <!--   Eq section   -->
+         <domain id="1point" zoom_ibegin="10" zoom_jbegin="10" zoom_ni="1" zoom_nj="1" />
+         <!--   Eq section   -->
          <domain id="EqT" zoom_ibegin="1" zoom_jbegin="0000" zoom_ni="0000" zoom_nj="1" />
          <!--   TAO   -->
@@ -170,5 +171,7 @@
       <domain_group id="scalarpoint">
          <domain id="scalarpoint" long_name="scalar"/>
+         <!--
          <domain id="1point" zoom_ibegin="1" zoom_jbegin="1" zoom_ni="1" zoom_nj="1" />
+         -->
       </domain_group>
 
Index: /branches/2013/dev_r4028_CNRS_LIM3/NEMOGCM/CONFIG/ORCA2_LIM3/EXP00/field_def.xml
===================================================================
--- /branches/2013/dev_r4028_CNRS_LIM3/NEMOGCM/CONFIG/ORCA2_LIM3/EXP00/field_def.xml	(revision 4344)
+++ /branches/2013/dev_r4028_CNRS_LIM3/NEMOGCM/CONFIG/ORCA2_LIM3/EXP00/field_def.xml	(revision 4345)
@@ -214,6 +214,6 @@
          
          <field id="iceconc"      long_name="ice concentration"                                            unit="%"        />
-         <field id="icebopr"      long_name="daily bottom thermo ice prod."                                unit="km3/day"   />
-         <field id="icedypr"      long_name="daily  dynamic ice prod."                                     unit="km3/day"   />
+         <field id="icebopr"      long_name="daily bottom thermo ice prod."                                unit="m/day"   />
+         <field id="icedypr"      long_name="daily  dynamic ice prod."                                     unit="m/day"   />
 	 <field id="ioceflxb"     long_name="Oceanic flux at the ice base"                                 unit="W/m2"     />
          <field id="uice_ipa"     long_name="Ice velocity along i-axis at I-point (ice presence average)"  unit="m/s"      />
@@ -231,6 +231,6 @@
          <field id="micesalt"     long_name="Mean ice salinity"                                            unit="psu"      />
          <field id="miceage"      long_name="Mean ice age"                                                 unit="years"    />
-         <field id="icelapr"      long_name="daily lateral thermo ice prod."                               unit="km3/day"   />
-         <field id="icesipr"      long_name="daily snowice ice prod."                                      unit="km3/day"   />
+         <field id="icelapr"      long_name="daily lateral thermo ice prod."                               unit="m/day"   />
+         <field id="icesipr"      long_name="daily snowice ice prod."                                      unit="m/day"   />
          <field id="micet"        long_name="Mean ice temperature"                                         unit="degC"     />
          <field id="icehc"        long_name="ice total heat content"                                       unit="10^9 J"   /> 
@@ -243,14 +243,14 @@
          <field id="icestr"       long_name="ice strength"                                                 unit="N/m"      />
          <field id="icevel"       long_name="ice velocity"                                                 unit="m/s"      />
-         <field id="isume"        long_name="surface melt"                                                 unit="km3/day"   />
-         <field id="ibome"        long_name="bottom melt"                                                  unit="km3/day"   />
+         <field id="isume"        long_name="surface melt"                                                 unit="m/day"   />
+         <field id="ibome"        long_name="bottom melt"                                                  unit="m/day"   />
          <field id="idive"        long_name="divergence"                                                   unit="10-8s-1"  />
          <field id="ishear"       long_name="shear"                                                        unit="10-8s-1"  />
-         <field id="icerepr"      long_name="daily resultant ice prod./melting from limupdate"             unit="km3/day"   />
-         <field id="icevolu"      long_name="ice volume"                                                   unit="km3"      />
-         <field id="snowvol"      long_name="snow volume"                                                  unit="km3"      />
+         <field id="icerepr"      long_name="daily resultant ice prod./melting from limupdate"             unit="m/day"   />
+         <field id="icevolu"      long_name="ice volume"                                                   unit="m"      />
+         <field id="snowvol"      long_name="snow volume"                                                  unit="m"      />
          <field id="sfxmec"       long_name="salt flux from ridging rafting"                               unit="psu*kg/m2/day" />
          <field id="sfxres"       long_name="salt flux from lipupdate (resultant)"                         unit="psu*kg/m2/day" />
-         <field id="icetrp"       long_name="ice volume transport"                                         unit="km3/day"   />
+         <field id="icetrp"       long_name="ice volume transport"                                         unit="m/day"   />
 
 
@@ -333,18 +333,19 @@
          <field id="fram_trans" long_name="Sea Ice Mass Transport Through Fram Strait" unit="kg/s" />
    	 <!-- available with ln_diahsb -->
-	 <field id="bgtemper"     long_name="global mean temperature"                  unit="degC"   />
-	 <field id="bgsaline"     long_name="global mean salinity"                     unit="psu"    />
-	 <field id="bgheatco"     long_name="global mean heat content"                 unit="10^9J"  />
-	 <field id="bgsaltco"     long_name="global mean salt content"                 unit="psu*m3" />
-	 <field id="bgvolssh"     long_name="global mean ssh volume"                   unit="km3"     />
-	 <field id="bgvoltot"     long_name="global mean volume"                       unit="km3"     />
-	 <field id="bgsshtot"     long_name="global mean ssh"                          unit="m"      />
-	 <field id="bgfrcvol"     long_name="global mean volume from forcing"          unit="km3"     />
-	 <field id="bgfrctem"     long_name="global mean heat content from forcing"    unit="10^9J"  />
-	 <field id="bgfrcsal"     long_name="global mean salt content from forcing"    unit="psu*km3" />
+	 <field id="bgtemper" long_name="global mean temperature variation"            unit="degC"/>
+	 <field id="bgsaline" long_name="global mean salinity variation"               unit="psu"/>
+	 <field id="bgheatco" long_name="global mean heat content variation"           unit="10^20J"/>
+	 <field id="bgsaltco" long_name="global mean salt content variation"           unit="psu*km3" />
+	 <field id="bgvolssh" long_name="global mean volume variation (ssh)"           unit="km3"/>
+	 <field id="bgvole3t" long_name="global mean volume variation (e3t)"           unit="km3"/>
+	 <field id="bgfrcvol" long_name="global mean volume variation from forcing"    unit="km3"/>
+	 <field id="bgfrctem" long_name="global mean forcing from heat content variation"   unit="degC"/>
+	 <field id="bgfrcsal" long_name="global mean forcing salt content variation"        unit="psu"/>
+	 <field id="bgmistem" long_name="global mean temperature error due to free surface" unit="degC"/>
+	 <field id="bgmissal" long_name="global mean salinity error due to free surface"    unit="psu"/>
       </field_group>
 
       <field_group id="SBC_scalar"  domain_ref="1point" >
-         <!-- available with ln_limdiahsb -->
+         <!-- available with ln_limdiaout -->
 	 <field id="ibgvoltot"    long_name="global mean ice volume"                   unit="km3"   />
 	 <field id="sbgvoltot"    long_name="global mean snow volume"                  unit="km3"   />
@@ -352,16 +353,26 @@
 	 <field id="ibgsaline"    long_name="global mean ice salinity"                 unit="psu"   />
 	 <field id="ibgtemper"    long_name="global mean ice temperature"              unit="degC"   />
-	 <field id="ibgheatco"    long_name="global mean ice heat content"             unit="10^9J"   />
+	 <field id="ibgheatco"    long_name="global mean ice heat content"             unit="10^20J"   />
+	 <field id="sbgheatco"    long_name="global mean snow heat content"            unit="10^20J"   />
 	 <field id="ibgsaltco"    long_name="global mean ice salt content"             unit="psu*km3"   />
-	 <field id="sbgheatco"    long_name="global mean snow heat content"            unit="10^9J"   />
-	 <field id="ibgfrcsfx"    long_name="global mean salt content from sfx"        unit="psu*km3"   />
-	 <field id="ibgfrcemp"    long_name="global mean volume from emp"              unit="km3"      />
-	 <field id="ibgsfx"       long_name="global mean emps"                         unit="psu*kg/m2/day"   />
-	 <field id="ibgemp"       long_name="global mean emp"                          unit="kg/m2/day"   />
-	 <field id="ibgsfxbri"    long_name="global mean ice sfx_bri"                  unit="psu*kg/m2/day"   />
-	 <field id="ibgsfxthd"    long_name="global mean ice sfx_thd"                  unit="psu*kg/m2/day"   />
-	 <field id="ibgsfxres"    long_name="global mean ice sfx_res"                  unit="psu*kg/m2/day"   />
-	 <field id="ibgsfxmec"    long_name="global mean ice fsalt_rpo"                unit="psu*kg/m2/day"   />
-	 <field id="ibggrpme"     long_name="global mean ice growth+melt volume"       unit="km3"      />
+
+	 <field id="ibgemp"       long_name="global mean volume flux (emp)"               unit="m/day"   />
+	 <field id="ibgempbog"    long_name="global mean volume flux (bottom growth)"     unit="m/day"   />
+	 <field id="ibgemplag"    long_name="global mean volume flux (open water growth)" unit="m/day"   />
+	 <field id="ibgempsig"    long_name="global mean volume flux (snow-ice growth)"   unit="m/day"   />
+	 <field id="ibgempdyg"    long_name="global mean volume flux (dynamic growth)"    unit="m/day"   />
+	 <field id="ibgempbom"    long_name="global mean volume flux (bottom melt)"       unit="m/day"   />
+	 <field id="ibgempsum"    long_name="global mean volume flux (surface melt)"      unit="m/day"   />
+	 <field id="ibgempres"    long_name="global mean volume flux (resultant)"         unit="m/day"   />
+
+	 <field id="ibgsfx"       long_name="global mean salt flux (total)"            unit="psu*m/day"   />
+	 <field id="ibgsfxbri"    long_name="global mean salt flux (brines)"           unit="psu*m/day"   />
+	 <field id="ibgsfxthd"    long_name="global mean salt flux (thermo)"           unit="psu*m/day"   />
+	 <field id="ibgsfxmec"    long_name="global mean salt flux (dynamic)"          unit="psu*m/day"   />
+	 <field id="ibgsfxres"    long_name="global mean salt flux (resultant)"        unit="psu*m/day"   />
+
+	 <field id="ibgfrcvol"    long_name="global mean forcing volume (emp)"         unit="km3"      />
+	 <field id="ibgfrcsfx"    long_name="global mean forcing salt   (sfx)"         unit="psu*km3"   />
+	 <field id="ibggrme"      long_name="global mean ice growth+melt volume"       unit="km3"      />
       </field_group>
   
Index: /branches/2013/dev_r4028_CNRS_LIM3/NEMOGCM/CONFIG/ORCA2_LIM3/EXP00/iodef.xml
===================================================================
--- /branches/2013/dev_r4028_CNRS_LIM3/NEMOGCM/CONFIG/ORCA2_LIM3/EXP00/iodef.xml	(revision 4344)
+++ /branches/2013/dev_r4028_CNRS_LIM3/NEMOGCM/CONFIG/ORCA2_LIM3/EXP00/iodef.xml	(revision 4345)
@@ -128,6 +128,5 @@
 	</file>
 
-
-	<file id="file7" name_suffix="_scalar" description="scalar variables" >
+        <file id="file7" name_suffix="_scalar" description="scalar variables" >
           <field field_ref="voltot"       name="scvoltot"  />
           <field field_ref="sshtot"       name="scsshtot"  />
@@ -137,47 +136,47 @@
           <field field_ref="temptot"      name="sctemtot"  />
           <field field_ref="saltot"       name="scsaltot"  />
-	
-          <!-- available with ln_diahsb -->
-	  <field field_ref="bgtemper"     name="bgtemper"    />
-	  <field field_ref="bgsaline"     name="bgsaline"    />
-	  <field field_ref="bgheatco"     name="bgheatco"    />
-	  <field field_ref="bgsaltco"     name="bgsaltco"    />
-	  <field field_ref="bgvolssh"     name="bgvolssh"    />
-	  <field field_ref="bgvoltot"     name="bgvoltot"    />
-	  <field field_ref="bgsshtot"     name="bgsshtot"    />
-	  <field field_ref="bgfrcvol"     name="bgfrcvol"    />
-	  <field field_ref="bgfrctem"     name="bgfrctem"    />
-	  <field field_ref="bgfrcsal"     name="bgfrcsal"    />
-	  <!-- available with ln_limdiahsb -->
-	  <field field_ref="ibgvoltot"    name="ibgvoltot"   />
-	  <field field_ref="sbgvoltot"    name="sbgvoltot"   />
-	  <field field_ref="ibgarea"      name="ibgarea"     />
-	  <field field_ref="ibgsaline"    name="ibgsaline"   />
-	  <field field_ref="ibgtemper"    name="ibgtemper"   />
-	  <field field_ref="ibgheatco"    name="ibgheatco"   />
-	  <field field_ref="ibgsaltco"    name="ibgsaltco"   />
-	  <field field_ref="sbgheatco"    name="sbgheatco"   />
-	  <field field_ref="ibgfrcsfx"    name="ibgfrcsfx"  />
-	  <field field_ref="ibgfrcemp"    name="ibgfrcemp"   />
-	  <field field_ref="ibgsfx"       name="ibgsfx"     />
-	  <field field_ref="ibgemp"       name="ibgemp"      />
-	  <field field_ref="ibgsfxbri"    name="ibgsfxbri"    />
-	  <field field_ref="ibgsfxthd"    name="ibgsfxthd"    />
-	  <field field_ref="ibgsfxres"    name="ibgsfxres" />
-	  <field field_ref="ibgsfxmec"    name="ibgsfxmec" />
-	  <field field_ref="ibggrpme"     name="ibggrpme"    />
-
-	</file>
-
-	<!--
-	<file id="file8" name_suffix="_Tides" description="tidal harmonics" >
-	  <field field_ref="M2x"          name="M2x"      long_name="M2 Elevation harmonic real part"                       />
-	  <field field_ref="M2y"          name="M2y"      long_name="M2 Elevation harmonic imaginary part"                  />
-	  <field field_ref="M2x_u"        name="M2x_u"    long_name="M2 current barotrope along i-axis harmonic real part "       />
-	  <field field_ref="M2y_u"        name="M2y_u"    long_name="M2 current barotrope along i-axis harmonic imaginary part "  />
-	  <field field_ref="M2x_v"        name="M2x_v"    long_name="M2 current barotrope along j-axis harmonic real part "       />
-	  <field field_ref="M2y_v"        name="M2y_v"    long_name="M2 current barotrope along j-axis harmonic imaginary part "  />
-	</file>
-	-->
+
+          <field field_ref="bgtemper"     name="bgtemper"    />
+          <field field_ref="bgsaline"     name="bgsaline"    />
+          <field field_ref="bgheatco"     name="bgheatco"    />
+          <field field_ref="bgsaltco"     name="bgsaltco"    />
+          <field field_ref="bgvolssh"     name="bgvolssh"    /> 
+          <field field_ref="bgvole3t"     name="bgvole3t"    />
+          <field field_ref="bgfrcvol"     name="bgfrcvol"    />
+          <field field_ref="bgfrctem"     name="bgfrctem"    />
+          <field field_ref="bgfrcsal"     name="bgfrcsal"    />
+          <field field_ref="bgmistem"     name="bgmistem"    />
+          <field field_ref="bgmissal"     name="bgmissal"    />
+        </file>
+
+        <file id="file8" name_suffix="_SBC_scalar" description="scalar variables" >
+          <field field_ref="ibgvoltot"    name="ibgvoltot"   />
+          <field field_ref="sbgvoltot"    name="sbgvoltot"   />
+          <field field_ref="ibgarea"      name="ibgarea"     />
+          <field field_ref="ibgsaline"    name="ibgsaline"   />
+          <field field_ref="ibgtemper"    name="ibgtemper"   />
+          <field field_ref="ibgheatco"    name="ibgheatco"   />
+          <field field_ref="sbgheatco"    name="sbgheatco"   />
+          <field field_ref="ibgsaltco"    name="ibgsaltco"   />
+
+          <field field_ref="ibgemp"       name="ibgemp"      />
+          <field field_ref="ibgempbog"    name="ibgempbog"      />
+          <field field_ref="ibgemplag"    name="ibgemplag"      />
+          <field field_ref="ibgempsig"    name="ibgempsig"      />
+          <field field_ref="ibgempdyg"    name="ibgempdyg"      />
+          <field field_ref="ibgempbom"    name="ibgempbom"      />
+          <field field_ref="ibgempsum"    name="ibgempsum"      />
+          <field field_ref="ibgempres"    name="ibgempres"      />
+
+          <field field_ref="ibgsfx"       name="ibgsfx"     />
+          <field field_ref="ibgsfxbri"    name="ibgsfxbri"    />
+          <field field_ref="ibgsfxthd"    name="ibgsfxthd"    />
+          <field field_ref="ibgsfxmec"    name="ibgsfxmec" />
+          <field field_ref="ibgsfxres"    name="ibgsfxres" />
+
+          <field field_ref="ibgfrcvol"    name="ibgfrcvol"   />
+          <field field_ref="ibgfrcsfx"    name="ibgfrcsfx"  />
+          <field field_ref="ibggrme"      name="ibggrme"    />
+        </file>
 
       </file_group>
Index: /branches/2013/dev_r4028_CNRS_LIM3/NEMOGCM/CONFIG/ORCA2_LIM3/EXP00/iodef_default.xml
===================================================================
--- /branches/2013/dev_r4028_CNRS_LIM3/NEMOGCM/CONFIG/ORCA2_LIM3/EXP00/iodef_default.xml	(revision 4344)
+++ /branches/2013/dev_r4028_CNRS_LIM3/NEMOGCM/CONFIG/ORCA2_LIM3/EXP00/iodef_default.xml	(revision 4345)
@@ -128,6 +128,5 @@
 	</file>
 
-
-	<file id="file7" name_suffix="_scalar" description="scalar variables" >
+        <file id="file7" name_suffix="_scalar" description="scalar variables" enabled=".true." >
           <field field_ref="voltot"       name="scvoltot"  />
           <field field_ref="sshtot"       name="scsshtot"  />
@@ -137,47 +136,47 @@
           <field field_ref="temptot"      name="sctemtot"  />
           <field field_ref="saltot"       name="scsaltot"  />
-	
-          <!-- available with ln_diahsb -->
-	  <field field_ref="bgtemper"     name="bgtemper"    />
-	  <field field_ref="bgsaline"     name="bgsaline"    />
-	  <field field_ref="bgheatco"     name="bgheatco"    />
-	  <field field_ref="bgsaltco"     name="bgsaltco"    />
-	  <field field_ref="bgvolssh"     name="bgvolssh"    />
-	  <field field_ref="bgvoltot"     name="bgvoltot"    />
-	  <field field_ref="bgsshtot"     name="bgsshtot"    />
-	  <field field_ref="bgfrcvol"     name="bgfrcvol"    />
-	  <field field_ref="bgfrctem"     name="bgfrctem"    />
-	  <field field_ref="bgfrcsal"     name="bgfrcsal"    />
-	  <!-- available with ln_limdiahsb -->
-	  <field field_ref="ibgvoltot"    name="ibgvoltot"   />
-	  <field field_ref="sbgvoltot"    name="sbgvoltot"   />
-	  <field field_ref="ibgarea"      name="ibgarea"     />
-	  <field field_ref="ibgsaline"    name="ibgsaline"   />
-	  <field field_ref="ibgtemper"    name="ibgtemper"   />
-	  <field field_ref="ibgheatco"    name="ibgheatco"   />
-	  <field field_ref="ibgsaltco"    name="ibgsaltco"   />
-	  <field field_ref="sbgheatco"    name="sbgheatco"   />
-	  <field field_ref="ibgfrcsfx"    name="ibgfrcsfx"  />
-	  <field field_ref="ibgfrcemp"    name="ibgfrcemp"   />
-	  <field field_ref="ibgsfx"       name="ibgsfx"     />
-	  <field field_ref="ibgemp"       name="ibgemp"      />
-	  <field field_ref="ibgsfxbri"    name="ibgsfxbri"    />
-	  <field field_ref="ibgsfxthd"    name="ibgsfxthd"    />
-	  <field field_ref="ibgsfxres"    name="ibgsfxres" />
-	  <field field_ref="ibgsfxmec"    name="ibgsfxmec" />
-	  <field field_ref="ibggrpme"     name="ibggrpme"    />
-
-	</file>
-
-	<!--
-	<file id="file8" name_suffix="_Tides" description="tidal harmonics" >
-	  <field field_ref="M2x"          name="M2x"      long_name="M2 Elevation harmonic real part"                       />
-	  <field field_ref="M2y"          name="M2y"      long_name="M2 Elevation harmonic imaginary part"                  />
-	  <field field_ref="M2x_u"        name="M2x_u"    long_name="M2 current barotrope along i-axis harmonic real part "       />
-	  <field field_ref="M2y_u"        name="M2y_u"    long_name="M2 current barotrope along i-axis harmonic imaginary part "  />
-	  <field field_ref="M2x_v"        name="M2x_v"    long_name="M2 current barotrope along j-axis harmonic real part "       />
-	  <field field_ref="M2y_v"        name="M2y_v"    long_name="M2 current barotrope along j-axis harmonic imaginary part "  />
-	</file>
-	-->
+
+          <field field_ref="bgtemper"     name="bgtemper"    />
+          <field field_ref="bgsaline"     name="bgsaline"    />
+          <field field_ref="bgheatco"     name="bgheatco"    />
+          <field field_ref="bgsaltco"     name="bgsaltco"    />
+          <field field_ref="bgvolssh"     name="bgvolssh"    /> 
+          <field field_ref="bgvole3t"     name="bgvole3t"    />
+          <field field_ref="bgfrcvol"     name="bgfrcvol"    />
+          <field field_ref="bgfrctem"     name="bgfrctem"    />
+          <field field_ref="bgfrcsal"     name="bgfrcsal"    />
+          <field field_ref="bgmistem"     name="bgmistem"    />
+          <field field_ref="bgmissal"     name="bgmissal"    />
+        </file>
+
+        <file id="file8" name_suffix="_SBC_scalar" description="scalar variables" enabled=".true." >
+          <field field_ref="ibgvoltot"    name="ibgvoltot"   />
+          <field field_ref="sbgvoltot"    name="sbgvoltot"   />
+          <field field_ref="ibgarea"      name="ibgarea"     />
+          <field field_ref="ibgsaline"    name="ibgsaline"   />
+          <field field_ref="ibgtemper"    name="ibgtemper"   />
+          <field field_ref="ibgheatco"    name="ibgheatco"   />
+          <field field_ref="sbgheatco"    name="sbgheatco"   />
+          <field field_ref="ibgsaltco"    name="ibgsaltco"   />
+
+          <field field_ref="ibgemp"       name="ibgemp"      />
+          <field field_ref="ibgempbog"    name="ibgempbog"      />
+          <field field_ref="ibgemplag"    name="ibgemplag"      />
+          <field field_ref="ibgempsig"    name="ibgempsig"      />
+          <field field_ref="ibgempdyg"    name="ibgempdyg"      />
+          <field field_ref="ibgempbom"    name="ibgempbom"      />
+          <field field_ref="ibgempsum"    name="ibgempsum"      />
+          <field field_ref="ibgempres"    name="ibgempres"      />
+
+          <field field_ref="ibgsfx"       name="ibgsfx"     />
+          <field field_ref="ibgsfxbri"    name="ibgsfxbri"    />
+          <field field_ref="ibgsfxthd"    name="ibgsfxthd"    />
+          <field field_ref="ibgsfxmec"    name="ibgsfxmec" />
+          <field field_ref="ibgsfxres"    name="ibgsfxres" />
+
+          <field field_ref="ibgfrcvol"    name="ibgfrcvol"   />
+          <field field_ref="ibgfrcsfx"    name="ibgfrcsfx"  />
+          <field field_ref="ibggrme"      name="ibggrme"    />
+        </file>
 
       </file_group>
Index: /branches/2013/dev_r4028_CNRS_LIM3/NEMOGCM/CONFIG/ORCA2_LIM3/EXP00/namelist
===================================================================
--- /branches/2013/dev_r4028_CNRS_LIM3/NEMOGCM/CONFIG/ORCA2_LIM3/EXP00/namelist	(revision 4344)
+++ /branches/2013/dev_r4028_CNRS_LIM3/NEMOGCM/CONFIG/ORCA2_LIM3/EXP00/namelist	(revision 4345)
@@ -900,5 +900,5 @@
 &namhsb       !  Heat and salt budgets
 !-----------------------------------------------------------------------
-   ln_diahsb  = .false.    !  check the heat and salt budgets (T) or not (F)
+   ln_diahsb  = .true.    !  check the heat and salt budgets (T) or not (F)
 /
 !-----------------------------------------------------------------------
Index: /branches/2013/dev_r4028_CNRS_LIM3/NEMOGCM/CONFIG/ORCA2_LIM3/EXP00/namelist_ice
===================================================================
--- /branches/2013/dev_r4028_CNRS_LIM3/NEMOGCM/CONFIG/ORCA2_LIM3/EXP00/namelist_ice	(revision 4344)
+++ /branches/2013/dev_r4028_CNRS_LIM3/NEMOGCM/CONFIG/ORCA2_LIM3/EXP00/namelist_ice	(revision 4345)
@@ -22,5 +22,5 @@
    ln_nicep    = .false.   !  Ice points output for debug (yes or no)
    ln_limdiahsb  = .false.    !  check the heat and salt budgets (T) or not (F)
-   ln_limdiaout  = .false.    !  output the heat and salt budgets (T) or not (F)
+   ln_limdiaout  = .true.    !  output the heat and salt budgets (T) or not (F)
 /
 !-----------------------------------------------------------------------
@@ -49,5 +49,5 @@
    cw          =   5.0e-03 !  drag coefficient for oceanic stress
    angvg       =   0.0     !  turning angle for oceanic stress
-   pstar       =   4.0e+04 !  1st bulk-rheology parameter
+   pstar       =   2.0e+04 !  1st bulk-rheology parameter
    c_rhg       =  20.0     !  2nd bulk-rhelogy parameter
    etamn       =   0.0e+07 !  minimun value for viscosity
@@ -58,5 +58,5 @@
    telast      =9600.0     !  timescale for elastic waves, SB, 720.0
    alphaevp    =   1.0     !  coefficient for the solution of internal ice stresses
-   hminrhg     =   0.05     !  ice thickness (m) below which ice velocity equal ocean velocity
+   hminrhg     =   0.001   !  ice thickness (m) below which ice velocity equal ocean velocity
 /
 !-----------------------------------------------------------------------
Index: /branches/2013/dev_r4028_CNRS_LIM3/NEMOGCM/CONFIG/ORCA2_LIM3/EXP00/namelist_ice_lim3
===================================================================
--- /branches/2013/dev_r4028_CNRS_LIM3/NEMOGCM/CONFIG/ORCA2_LIM3/EXP00/namelist_ice_lim3	(revision 4344)
+++ /branches/2013/dev_r4028_CNRS_LIM3/NEMOGCM/CONFIG/ORCA2_LIM3/EXP00/namelist_ice_lim3	(revision 4345)
@@ -22,5 +22,5 @@
    ln_nicep    = .false.   !  Ice points output for debug (yes or no)
    ln_limdiahsb  = .false.    !  check the heat and salt budgets (T) or not (F)
-   ln_limdiaout  = .false.    !  output the heat and salt budgets (T) or not (F)
+   ln_limdiaout  = .true.    !  output the heat and salt budgets (T) or not (F)
 /
 !-----------------------------------------------------------------------
Index: /branches/2013/dev_r4028_CNRS_LIM3/NEMOGCM/NEMO/LIM_SRC_3/limcat_1D.F90
===================================================================
--- /branches/2013/dev_r4028_CNRS_LIM3/NEMOGCM/NEMO/LIM_SRC_3/limcat_1D.F90	(revision 4344)
+++ /branches/2013/dev_r4028_CNRS_LIM3/NEMOGCM/NEMO/LIM_SRC_3/limcat_1D.F90	(revision 4345)
@@ -44,6 +44,6 @@
       REAL(wp), DIMENSION(:),   INTENT(in)    ::   zhti, zhts, zai    ! input ice/snow variables
       REAL(wp), DIMENSION(:,:), INTENT(inout) ::   zht_i, zht_s, za_i ! output ice/snow variables
-      REAL(wp)                     ::   epsi06 = 1.0e-6
-      REAL(wp)                     ::   zc1, zc2, zc3, zx1, zdh   ! local scalars
+      REAL(wp) :: epsi06 = 1.0e-6
+      REAL(wp) :: zc1, zc2, zc3, zx1, zdh   ! local scalars
       REAL(wp), DIMENSION(0:jpl)   ::   zhi_max         !:Boundary of ice thickness categories in thickness space
  
Index: /branches/2013/dev_r4028_CNRS_LIM3/NEMOGCM/NEMO/LIM_SRC_3/limdiahsb.F90
===================================================================
--- /branches/2013/dev_r4028_CNRS_LIM3/NEMOGCM/NEMO/LIM_SRC_3/limdiahsb.F90	(revision 4344)
+++ /branches/2013/dev_r4028_CNRS_LIM3/NEMOGCM/NEMO/LIM_SRC_3/limdiahsb.F90	(revision 4345)
@@ -34,6 +34,6 @@
    !!PUBLIC   lim_diahsb_rst   ! routine called by ice_init.F90
 
-   REAL(wp), SAVE   ::   frc_sal, frc_vol   ! global forcing trends
-   REAL(wp), SAVE   ::   bg_grpme           ! global ice growth+melt trends
+   REAL(dp) ::   frc_sal, frc_vol   ! global forcing trends
+   REAL(dp) ::   bg_grme            ! global ice growth+melt trends
    REAL(wp) ::   epsi06 = 1.e-6_wp  ! small number
    REAL(wp) ::   epsi03 = 1.e-3_wp  ! small number
@@ -57,14 +57,12 @@
       !! ** Purpose: Compute the ice global heat content, salt content and volume conservation
       !!	
-      !! ** Method : - Compute the deviation of heat content, salt content and volume
-      !!	            at the current time step from their values at nit000
-      !!	            - Compute the contribution of forcing and remove it from these deviations
+      !!---------------------------------------------------------------------------
       !!
-      !!---------------------------------------------------------------------------
-      !!
-      REAL(wp)   ::   zbg_ivo, zbg_svo, zbg_are, zbg_sal ,zbg_tem ,zbg_ihc ,zbg_shc
-      REAL(wp)   ::   zbg_sfx, zbg_emp, zbg_sfx_bri, zbg_sfx_thd, zbg_sfx_res, zbg_sfx_mec 
-      REAL(wp)   ::   z_frc_vol, z_frc_sal, z_bg_grpme 
-      REAL(wp)   ::   zdeltat, z1_area                     !    -     -
+      REAL(dp)   ::   zbg_ivo, zbg_svo, zbg_are, zbg_sal ,zbg_tem ,zbg_ihc ,zbg_shc
+      REAL(dp)   ::   zbg_sfx, zbg_sfx_bri, zbg_sfx_thd, zbg_sfx_res, zbg_sfx_mec 
+      REAL(dp)   ::   zbg_emp, zbg_emp_bog, zbg_emp_lag, zbg_emp_sig, zbg_emp_dyg, zbg_emp_bom, zbg_emp_sum, zbg_emp_res 
+      REAL(dp)   ::   z_frc_vol, z_frc_sal, z_bg_grme 
+      REAL(dp)   ::   z1_area                     !    -     -
+      REAL(dp)   ::   zinda, zindb
       !!---------------------------------------------------------------------------
       IF( nn_timing == 1 )   CALL timing_start('lim_diahsb')
@@ -73,5 +71,7 @@
 
       ! 1/area
-      z1_area = 1.0 / MAX( glob_sum( area(:,:) * tms(:,:) ),epsi06 )
+      z1_area = 1.d0 / MAX( glob_sum( area(:,:) * tms(:,:) ), epsi06 )
+
+      zinda = MAX( 0.d0 , SIGN( 1.d0 , glob_sum( area(:,:) * tms(:,:) ) - epsi06 ) )
       ! ----------------------- !
       ! 1 -  Content variations !
@@ -80,31 +80,39 @@
       zbg_svo = glob_sum( vt_s(:,:) * area(:,:) * tms(:,:) ) ! volume snow
       zbg_are = glob_sum( at_i(:,:) * area(:,:) * tms(:,:) ) ! area
-      zbg_sal = glob_sum( SUM(smv_i(:,:,:),dim=3) * area(:,:) * tms(:,:) ) ! mean salt content
-      zbg_tem = glob_sum( (tm_i(:,:)-rtt) * vt_i(:,:) * area(:,:) * tms(:,:) )  ! mean temp content
+      zbg_sal = glob_sum( SUM( smv_i(:,:,:), dim=3 ) * area(:,:) * tms(:,:) )       ! mean salt content
+      zbg_tem = glob_sum( ( tm_i(:,:) - rtt ) * vt_i(:,:) * area(:,:) * tms(:,:) )  ! mean temp content
 
       !zbg_ihc = glob_sum( et_i(:,:) * area(:,:) * tms(:,:) ) / MAX( zbg_ivo,epsi06 ) ! ice heat content
       !zbg_shc = glob_sum( et_s(:,:) * area(:,:) * tms(:,:) ) / MAX( zbg_svo,epsi06 ) ! snow heat content
 
-      zbg_ihc = glob_sum( et_i(:,:) ) ! ice heat content  [10^9 J]
-      zbg_shc = glob_sum( et_s(:,:) ) ! snow heat content [10^9 J]
-
-      zbg_sfx      = glob_sum(      sfx(:,:) * area(:,:) * tms(:,:) ) * z1_area
-      zbg_emp       = glob_sum(       emp(:,:) * area(:,:) * tms(:,:) ) * z1_area
-      zbg_sfx_bri     = glob_sum(     sfx_bri(:,:) * area(:,:) * tms(:,:) ) * z1_area
-      zbg_sfx_thd     = glob_sum(     sfx_thd(:,:) * area(:,:) * tms(:,:) ) * z1_area
-      zbg_sfx_res = glob_sum( sfx_res(:,:) * area(:,:) * tms(:,:) ) * z1_area
-      zbg_sfx_mec = glob_sum( sfx_mec(:,:) * area(:,:) * tms(:,:) ) * z1_area
+      zbg_ihc = glob_sum( et_i(:,:) * 1.e-11 ) ! ice heat content  [10^9*1.e-11 J]
+      zbg_shc = glob_sum( et_s(:,:) * 1.e-11 ) ! snow heat content [10^9*1.e-11 J]
+
+      zbg_emp     = zinda * glob_sum(         emp(:,:) * area(:,:) * tms(:,:) ) * z1_area         * r1_rau0 * rday
+      zbg_emp_bog = zinda * glob_sum( diag_bot_gr(:,:) * area(:,:) * tms(:,:) ) * z1_area * rhoic * r1_rau0 * rday
+      zbg_emp_lag = zinda * glob_sum( diag_lat_gr(:,:) * area(:,:) * tms(:,:) ) * z1_area * rhoic * r1_rau0 * rday
+      zbg_emp_sig = zinda * glob_sum( diag_sni_gr(:,:) * area(:,:) * tms(:,:) ) * z1_area * rhoic * r1_rau0 * rday
+      zbg_emp_dyg = zinda * glob_sum( diag_dyn_gr(:,:) * area(:,:) * tms(:,:) ) * z1_area * rhoic * r1_rau0 * rday
+      zbg_emp_bom = zinda * glob_sum( diag_bot_me(:,:) * area(:,:) * tms(:,:) ) * z1_area * rhoic * r1_rau0 * rday
+      zbg_emp_sum = zinda * glob_sum( diag_sur_me(:,:) * area(:,:) * tms(:,:) ) * z1_area * rhoic * r1_rau0 * rday
+      zbg_emp_res = zinda * glob_sum( diag_res_pr(:,:) * area(:,:) * tms(:,:) ) * z1_area * rhoic * r1_rau0 * rday
+
+      zbg_sfx     = zinda * glob_sum(     sfx(:,:) * area(:,:) * tms(:,:) ) * z1_area * r1_rau0 * rday
+      zbg_sfx_bri = zinda * glob_sum( sfx_bri(:,:) * area(:,:) * tms(:,:) ) * z1_area * r1_rau0 * rday
+      zbg_sfx_thd = zinda * glob_sum( sfx_thd(:,:) * area(:,:) * tms(:,:) ) * z1_area * r1_rau0 * rday
+      zbg_sfx_res = zinda * glob_sum( sfx_res(:,:) * area(:,:) * tms(:,:) ) * z1_area * r1_rau0 * rday
+      zbg_sfx_mec = zinda * glob_sum( sfx_mec(:,:) * area(:,:) * tms(:,:) ) * z1_area * r1_rau0 * rday
       
       ! --------------------------------------------- !
       ! 2 - Trends due to forcing and ice growth/melt !
       ! --------------------------------------------- !
-      z_frc_vol = ( 1.e0 / rau0 ) * glob_sum( - emp(:,:) * area(:,:) * tms(:,:) ) ! volume fluxes
-      z_frc_sal = ( 1.e0 / rau0 ) * glob_sum(  sfx(:,:) * area(:,:) * tms(:,:) ) ! salt fluxes
-      z_bg_grpme = glob_sum( ( diag_bot_gr(:,:) + diag_lat_gr(:,:) + diag_sni_gr(:,:) + diag_dyn_gr(:,:) + &
+      z_frc_vol = r1_rau0 * glob_sum( - emp(:,:) * area(:,:) * tms(:,:) ) ! volume fluxes
+      z_frc_sal = r1_rau0 * glob_sum(   sfx(:,:) * area(:,:) * tms(:,:) ) ! salt fluxes
+      z_bg_grme = glob_sum( ( diag_bot_gr(:,:) + diag_lat_gr(:,:) + diag_sni_gr(:,:) + diag_dyn_gr(:,:) + &
                           &    diag_bot_me(:,:) + diag_sur_me(:,:) + diag_res_pr(:,:) ) * area(:,:) * tms(:,:) ) ! volume fluxes
       !
       frc_vol  = frc_vol  + z_frc_vol  * rdt_ice
       frc_sal  = frc_sal  + z_frc_sal  * rdt_ice
-      bg_grpme = bg_grpme + z_bg_grpme * rdt_ice
+      bg_grme  = bg_grme  + z_bg_grme  * rdt_ice
       
       ! difference
@@ -115,23 +123,33 @@
       ! 3 - Diagnostics writing !
       ! ----------------------- !
-      !zdeltat  = 1.e0 / ( ( kt - nit000 + 1 ) * rdt_ice )
-      !
-      CALL iom_put( 'ibgvoltot',zbg_ivo * rhoic / rau0 * 1.e-9 ) ! m3 (equivalent liquid)         
-      CALL iom_put( 'sbgvoltot',zbg_svo * rhosn / rau0 * 1.e-9 )  ! m3 (equivalent liquid)       
-      CALL iom_put( 'ibgarea',zbg_are * 1.e-6 )         
-      CALL iom_put( 'ibgsaline',zbg_sal / MAX( zbg_ivo,epsi03 ) )         
-      CALL iom_put( 'ibgtemper',zbg_tem / MAX( zbg_ivo,epsi03 ) )         
-      CALL iom_put( 'ibgheatco',zbg_ihc )           ! 10^9 J        
-      CALL iom_put( 'ibgsaltco',zbg_sal * rhoic / rau0 * 1.e-9 ) ! psu*km3        
-      CALL iom_put( 'sbgheatco',zbg_shc )           ! 10^9 J
-      CALL iom_put( 'ibgfrcemp',frc_vol * 1.e-9 )           !vol - forcing : km3 (equivalent liquid)         
-      CALL iom_put( 'ibgfrcsfx',frc_sal * 1.e-9 )          !sal - forcing : psu*km3   
-      CALL iom_put( 'ibgsfx',zbg_sfx *rday)            
-      CALL iom_put( 'ibgemp',zbg_emp *rday)              
-      CALL iom_put( 'ibgsfxbri',zbg_sfx_bri *rday)         
-      CALL iom_put( 'ibgsfxthd',zbg_sfx_thd *rday)         
-      CALL iom_put( 'ibgsfxres',zbg_sfx_res *rday)         
-      CALL iom_put( 'ibgsfxmec',zbg_sfx_mec *rday)         
-      CALL iom_put( 'ibggrpme',bg_grpme * rhoic / rau0 * 1.e-9 ) ! km3 (equivalent liquid)         
+      zindb = MAX( 0.d0 , SIGN( 1.d0 , zbg_ivo - epsi06 ) )
+      !
+      CALL iom_put( 'ibgvoltot' , zbg_ivo * rhoic * r1_rau0 * 1.e-9        )   ! ice volume (km3 equivalent liquid)         
+      CALL iom_put( 'sbgvoltot' , zbg_svo * rhosn * r1_rau0 * 1.e-9        )   ! snw volume (km3 equivalent liquid)       
+      CALL iom_put( 'ibgarea'   , zbg_are * 1.e-6                          )   ! ice area   (km2)
+      CALL iom_put( 'ibgsaline' , zindb * zbg_sal / MAX( zbg_ivo, epsi06 ) )   ! ice saline (psu)
+      CALL iom_put( 'ibgtemper' , zindb * zbg_tem / MAX( zbg_ivo, epsi06 ) )   ! ice temper (C)
+      CALL iom_put( 'ibgheatco' , zbg_ihc                                  )   ! ice heat content (1.e20 J)        
+      CALL iom_put( 'sbgheatco' , zbg_shc                                  )   ! snw heat content (1.e20 J)
+      CALL iom_put( 'ibgsaltco' , zbg_sal * rhoic * r1_rau0 * 1.e-9        )   ! ice salt content (psu*km3 equivalent liquid)        
+
+      CALL iom_put( 'ibgemp'    , zbg_emp                                  )   ! volume flux emp (m/day liquid)
+      CALL iom_put( 'ibgempbog' , zbg_emp_bog                              )   ! volume flux bottom growth     -(m/day equivalent liquid)
+      CALL iom_put( 'ibgemplag' , zbg_emp_lag                              )   ! volume flux open water growth -
+      CALL iom_put( 'ibgempsig' , zbg_emp_sig                              )   ! volume flux snow ice growth   -
+      CALL iom_put( 'ibgempdyg' , zbg_emp_dyg                              )   ! volume flux dynamic growth    -
+      CALL iom_put( 'ibgempbom' , zbg_emp_bom                              )   ! volume flux bottom melt       -
+      CALL iom_put( 'ibgempsum' , zbg_emp_sum                              )   ! volume flux surface melt      -
+      CALL iom_put( 'ibgempres' , zbg_emp_res                              )   ! volume flux resultant         -
+          
+      CALL iom_put( 'ibgsfx'    , zbg_sfx                                  )   ! salt flux         -(psu*m/day equivalent liquid)       
+      CALL iom_put( 'ibgsfxbri' , zbg_sfx_bri                              )   ! salt flux brines  -      
+      CALL iom_put( 'ibgsfxthd' , zbg_sfx_thd                              )   ! salt flux thermo  -    
+      CALL iom_put( 'ibgsfxmec' , zbg_sfx_mec                              )   ! salt flux dynamic -    
+      CALL iom_put( 'ibgsfxres' , zbg_sfx_res                              )   ! salt flux result  -    
+
+      CALL iom_put( 'ibgfrcvol' , frc_vol * 1.e-9                          )   ! vol - forcing     (km3 equivalent liquid) 
+      CALL iom_put( 'ibgfrcsfx' , frc_sal * 1.e-9                          )   ! sal - forcing     (psu*km3 equivalent liquid)   
+      CALL iom_put( 'ibggrme'   , bg_grme * rhoic * r1_rau0 * 1.e-9        )   ! vol growth + melt (km3 equivalent liquid)         
       !
       IF( lrst_ice )   CALL lim_diahsb_rst( numit, 'WRITE' )
@@ -172,7 +190,7 @@
       ! 2 - initial conservation variables !
       ! ---------------------------------- !
-      !frc_vol = 0._wp                                           ! volume       trend due to forcing
-      !frc_sal = 0._wp                                           ! salt content   -    -   -    -         
-      !bg_grpme = 0._wp                                          ! ice growth + melt volume trend
+      !frc_vol = 0.d0                                           ! volume       trend due to forcing
+      !frc_sal = 0.d0                                           ! salt content   -    -   -    -         
+      !bg_grme = 0.d0                                           ! ice growth + melt volume trend
       !
       CALL lim_diahsb_rst( nstart, 'READ' )  !* read or initialize all required files
@@ -196,21 +214,29 @@
      IF( TRIM(cdrw) == 'READ' ) THEN        ! Read/initialise 
         IF( ln_rstart ) THEN                   !* Read the restart file
-           id1 = iom_varid( numrir, 'frc_vol'  , ldstop = .TRUE. )
+           !id1 = iom_varid( numrir, 'frc_vol'  , ldstop = .TRUE. )
            !
+           IF(lwp) WRITE(numout,*) '~~~~~~~'
+           IF(lwp) WRITE(numout,*) ' lim_diahsb_rst at it= ', kt,' date= ', ndastp
+           IF(lwp) WRITE(numout,*) '~~~~~~~'
            CALL iom_get( numrir, 'frc_vol', frc_vol )
            CALL iom_get( numrir, 'frc_sal', frc_sal )
-           CALL iom_get( numrir, 'bg_grpme', bg_grpme )
-       ELSE
-       	   frc_vol = 0._wp                                           
-       	   frc_sal = 0._wp                                                  
-      	   bg_grpme = 0._wp                                        
+           CALL iom_get( numrir, 'bg_grme', bg_grme )
+        ELSE
+           IF(lwp) WRITE(numout,*) '~~~~~~~'
+           IF(lwp) WRITE(numout,*) ' lim_diahsb at initial state '
+           IF(lwp) WRITE(numout,*) '~~~~~~~'
+           frc_vol  = 0.d0                                           
+           frc_sal  = 0.d0                                                  
+           bg_grme  = 0.d0                                        
        ENDIF	
 
      ELSEIF( TRIM(cdrw) == 'WRITE' ) THEN   ! Create restart file
         !                                   ! -------------------
-        IF(lwp) WRITE(numout,*) '---- limdia-rst ----'
+        IF(lwp) WRITE(numout,*) '~~~~~~~'
+        IF(lwp) WRITE(numout,*) ' lim_diahsb_rst at it= ', kt,' date= ', ndastp
+        IF(lwp) WRITE(numout,*) '~~~~~~~'
         CALL iom_rstput( kt, nitrst, numriw, 'frc_vol'   , frc_vol     )
         CALL iom_rstput( kt, nitrst, numriw, 'frc_sal'   , frc_sal     )
-        CALL iom_rstput( kt, nitrst, numriw, 'bg_grpme'  , bg_grpme     )
+        CALL iom_rstput( kt, nitrst, numriw, 'bg_grme'   , bg_grme     )
         !
      ENDIF
Index: /branches/2013/dev_r4028_CNRS_LIM3/NEMOGCM/NEMO/LIM_SRC_3/limitd_me.F90
===================================================================
--- /branches/2013/dev_r4028_CNRS_LIM3/NEMOGCM/NEMO/LIM_SRC_3/limitd_me.F90	(revision 4344)
+++ /branches/2013/dev_r4028_CNRS_LIM3/NEMOGCM/NEMO/LIM_SRC_3/limitd_me.F90	(revision 4345)
@@ -1477,5 +1477,5 @@
             END DO
          END DO
-         zmask_glo = glob_sum(zmask)
+         !zmask_glo = glob_sum(zmask)
          !IF( ln_nicep .AND. lwp ) WRITE(numout,*) zmask_glo, ' cells of ice zapped in the ocean '
 
Index: /branches/2013/dev_r4028_CNRS_LIM3/NEMOGCM/NEMO/LIM_SRC_3/limrhg.F90
===================================================================
--- /branches/2013/dev_r4028_CNRS_LIM3/NEMOGCM/NEMO/LIM_SRC_3/limrhg.F90	(revision 4344)
+++ /branches/2013/dev_r4028_CNRS_LIM3/NEMOGCM/NEMO/LIM_SRC_3/limrhg.F90	(revision 4345)
@@ -427,17 +427,17 @@
                !-Calculate stress tensor components zs1 and zs2 
                !-at centre of grid cells (see section 3.5 of CICE user's guide).
-               zs1(ji,jj) = ( zs1(ji,jj) - dtotel*( ( 1._wp - alphaevp) * zs1(ji,jj) +   &
-                  &          ( delta / deltat(ji,jj) - zdd(ji,jj) / deltat(ji,jj) ) * zpresh(ji,jj) ) )  &       
-                  &          / ( 1._wp + alphaevp * dtotel )
-
-               zs2(ji,jj) = ( zs2(ji,jj) - dtotel * ( ( 1._wp - alphaevp ) * ecc2 * zs2(ji,jj) -   &
-                             zdt(ji,jj) / deltat(ji,jj) * zpresh(ji,jj) ) )   &
-                  &          / ( 1._wp + alphaevp * ecc2 * dtotel )
+               !zs1(ji,jj) = ( zs1(ji,jj) - dtotel*( ( 1._wp - alphaevp) * zs1(ji,jj) +   &
+               !   &          ( delta / deltat(ji,jj) - zdd(ji,jj) / deltat(ji,jj) ) * zpresh(ji,jj) ) )  &       
+               !   &          / ( 1._wp + alphaevp * dtotel )
+
+               !zs2(ji,jj) = ( zs2(ji,jj) - dtotel * ( ( 1._wp - alphaevp ) * ecc2 * zs2(ji,jj) -   &
+               !              zdt(ji,jj) / deltat(ji,jj) * zpresh(ji,jj) ) )   &
+               !   &          / ( 1._wp + alphaevp * ecc2 * dtotel )
 
                ! new formulation from S. Bouillon to help stabilizing the code (no need of alphaevp)
-               !zs1(ji,jj) = ( zs1(ji,jj) + dtotel * ( ( zdd(ji,jj) / deltat(ji,jj) - delta / deltat(ji,jj) )  &
-               !   &         * zpresh(ji,jj) ) ) / ( 1._wp + dtotel )
-               !zs2(ji,jj) = ( zs2(ji,jj) + dtotel * ( ecci * zdt(ji,jj) / deltat(ji,jj) * zpresh(ji,jj) ) )  &
-               !   &         / ( 1._wp + dtotel )
+               zs1(ji,jj) = ( zs1(ji,jj) + dtotel * ( ( zdd(ji,jj) / deltat(ji,jj) - delta / deltat(ji,jj) )  &
+                  &         * zpresh(ji,jj) ) ) / ( 1._wp + dtotel )
+               zs2(ji,jj) = ( zs2(ji,jj) + dtotel * ( ecci * zdt(ji,jj) / deltat(ji,jj) * zpresh(ji,jj) ) )  &
+                  &         / ( 1._wp + dtotel )
 
             END DO
@@ -473,12 +473,12 @@
 
                !-Calculate stress tensor component zs12 at corners (see section 3.5 of CICE user's guide).
-               zs12(ji,jj) = ( zs12(ji,jj) - dtotel * ( (1.0-alphaevp) * ecc2 * zs12(ji,jj) - zds(ji,jj) /  &
-                  &          ( 2._wp * deltac(ji,jj) ) * zpreshc(ji,jj) ) )  &
-                  &          / ( 1._wp + alphaevp * ecc2 * dtotel ) 
+               !zs12(ji,jj) = ( zs12(ji,jj) - dtotel * ( (1.0-alphaevp) * ecc2 * zs12(ji,jj) - zds(ji,jj) /  &
+               !   &          ( 2._wp * deltac(ji,jj) ) * zpreshc(ji,jj) ) )  &
+               !   &          / ( 1._wp + alphaevp * ecc2 * dtotel ) 
 
                ! new formulation from S. Bouillon to help stabilizing the code (no need of alphaevp)
-               !zs12(ji,jj) = ( zs12(ji,jj) + dtotel *  &
-               !   &          ( ecci * zds(ji,jj) / ( 2._wp * deltac(ji,jj) ) * zpreshc(ji,jj) ) )  &
-               !   &          / ( 1.0 + dtotel ) 
+               zs12(ji,jj) = ( zs12(ji,jj) + dtotel *  &
+                  &          ( ecci * zds(ji,jj) / ( 2._wp * deltac(ji,jj) ) * zpreshc(ji,jj) ) )  &
+                  &          / ( 1.0 + dtotel ) 
 
             END DO ! ji
Index: /branches/2013/dev_r4028_CNRS_LIM3/NEMOGCM/NEMO/LIM_SRC_3/limsbc.F90
===================================================================
--- /branches/2013/dev_r4028_CNRS_LIM3/NEMOGCM/NEMO/LIM_SRC_3/limsbc.F90	(revision 4344)
+++ /branches/2013/dev_r4028_CNRS_LIM3/NEMOGCM/NEMO/LIM_SRC_3/limsbc.F90	(revision 4345)
@@ -24,21 +24,22 @@
    !!----------------------------------------------------------------------
    USE par_oce          ! ocean parameters
+   USE phycst           ! physical constants
    USE par_ice          ! ice parameters
    USE dom_oce          ! ocean domain
+   USE dom_ice,    ONLY : tms
+   USE ice              ! LIM sea-ice variables
    USE sbc_ice          ! Surface boundary condition: sea-ice fields
    USE sbc_oce          ! Surface boundary condition: ocean fields
-   USE phycst           ! physical constants
+   USE sbccpl
+   USE cpl_oasis3, ONLY : lk_cpl
+   USE oce       , ONLY : iatte, oatte, sshn, sshb, snwice_mass, snwice_mass_b, snwice_fmass, sshu_b, sshv_b, sshu_n, sshv_n, sshf_n
    USE albedo           ! albedo parameters
-   USE ice              ! LIM sea-ice variables
-   USE lbclnk           ! ocean lateral boundary condition
-   USE in_out_manager   ! I/O manager
+   USE lbclnk           ! ocean lateral boundary condition - MPP exchanges
    USE lib_mpp          ! MPP library
    USE wrk_nemo         ! work arrays
+   USE in_out_manager   ! I/O manager
    USE prtctl           ! Print control
-   USE cpl_oasis3, ONLY : lk_cpl
+   USE lib_fortran      ! Fortran utilities (allows no signed zero when 'key_nosignedzero' defined)  
    USE traqsr           ! clem: add penetration of solar flux into the calculation of heat budget
-   USE oce,        ONLY : iatte, oatte, sshn, sshb, snwice_mass, snwice_mass_b, snwice_fmass, sshu_b, sshv_b, sshu_n, sshv_n, sshf_n
-   USE dom_ice,    ONLY : tms
-   USE lib_fortran      ! Fortran utilities (allows no signed zero when 'key_nosignedzero' defined)  
 
    IMPLICIT NONE
@@ -438,12 +439,4 @@
       ENDIF ! .NOT. ln_rstart
       !
-!!?      IF( .NOT. ln_rstart ) THEN           ! delete the initial ssh below sea-ice area
-!!?         !
-!!?         zarea     = glob_sum( e1e2t(:,:) )           ! interior global domain surface
-!!?         zsum      = glob_sum( e1e2t(:,:) * ( snwice_mass(:,:) ) ) / zarea * r1_rau0
-!!?         sshn(:,:) = sshn(:,:) - zsum 
-!!?         sshb(:,:) = sshb(:,:) - zsum
-!!?      ENDIF
-      !
 
    END SUBROUTINE lim_sbc_init
Index: /branches/2013/dev_r4028_CNRS_LIM3/NEMOGCM/NEMO/OPA_SRC/DIA/diahsb.F90
===================================================================
--- /branches/2013/dev_r4028_CNRS_LIM3/NEMOGCM/NEMO/OPA_SRC/DIA/diahsb.F90	(revision 4344)
+++ /branches/2013/dev_r4028_CNRS_LIM3/NEMOGCM/NEMO/OPA_SRC/DIA/diahsb.F90	(revision 4345)
@@ -37,8 +37,10 @@
    LOGICAL, PUBLIC ::   ln_diahsb  = .FALSE.   !: check the heat and salt budgets
 
-   REAL(wp), SAVE                                ::   frc_t      , frc_s     , frc_v   ! global forcing trends
-   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:)   ::   ssh_ini              !
-   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::   hc_loc_ini, sc_loc_ini, e3t_ini  !
-   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:)   ::   hcssh_loc_ini, scssh_loc_ini     !
+   REAL(dp)                                ::   surf_tot                !
+   REAL(dp)                                ::   frc_t      , frc_s     , frc_v   ! global forcing trends
+   REAL(dp)                                ::   frc_wn_t      , frc_wn_s ! global forcing trends
+   REAL(dp), DIMENSION(:,:)  , ALLOCATABLE ::   surf      , ssh_ini              !
+   REAL(dp), DIMENSION(:,:,:), ALLOCATABLE ::   hc_loc_ini, sc_loc_ini, e3t_ini  !
+   REAL(dp), DIMENSION(:,:)  , ALLOCATABLE ::   ssh_hc_loc_ini, ssh_sc_loc_ini
 
    !! * Substitutions
@@ -68,92 +70,83 @@
       !!
       INTEGER    ::   jk                          ! dummy loop indice
-      REAL(wp)   ::   zdiff_hc    , zdiff_sc      ! heat and salt content variations
-      REAL(wp)   ::   zdiff_v1    , zdiff_v2      ! volume variation
-      REAL(wp)   ::   z_hc        , z_sc          ! heat and salt content
-      REAL(wp)   ::   z_v1        , z_v2          ! volume
-      REAL(wp)   ::   zdeltat                     !    -     -
-      REAL(wp)   ::   z_frc_trd_t , z_frc_trd_s   !    -     -
-      REAL(wp)   ::   z_frc_trd_v                 !    -     -
-      REAL(wp), POINTER, DIMENSION(:,:)   ::   zsurf              !
+      REAL(dp)   ::   zdiff_hc    , zdiff_sc      ! heat and salt content variations
+      REAL(dp)   ::   zdiff_hc1   , zdiff_sc1     ! -   -   -   -   -   -   -   - 
+      REAL(dp)   ::   zdiff_v1    , zdiff_v2      ! volume variation
+      REAL(dp)   ::   zerr_hc1    , zerr_sc1       ! heat and salt content misfit
+      REAL(dp)   ::   zvol_tot                    ! volume
+      REAL(dp)   ::   z_frc_trd_t , z_frc_trd_s   !    -     -
+      REAL(dp)   ::   z_frc_trd_v                 !    -     -
+      REAL(dp)   ::   z_wn_trd_t , z_wn_trd_s   !    -     -
+      REAL(dp)   ::   z_ssh_hc , z_ssh_sc   !    -     -
       !!---------------------------------------------------------------------------
       IF( nn_timing == 1 )   CALL timing_start('dia_hsb')      
 
-      CALL wrk_alloc( jpi, jpj, zsurf )
-  
-      zsurf(:,:) = e1t(:,:) * e2t(:,:) * tmask(:,:,1) * tmask_i(:,:)      ! masked surface grid cell area
-      
       ! ------------------------- !
       ! 1 - Trends due to forcing !
       ! ------------------------- !
-      z_frc_trd_v = r1_rau0 * glob_sum( - ( emp(:,:) - rnf(:,:) ) * zsurf(:,:) ) ! volume fluxes
-      z_frc_trd_t =           glob_sum( sbc_tsc(:,:,jp_tem) * zsurf(:,:) )       ! heat fluxes
-      z_frc_trd_s =           glob_sum( sbc_tsc(:,:,jp_sal) * zsurf(:,:) )       ! salt fluxes
-      !
-      IF( ln_rnf    )   z_frc_trd_t = z_frc_trd_t + glob_sum( rnf_tsc(:,:,jp_tem) * zsurf(:,:) )
-      IF( ln_rnf_sal)   z_frc_trd_s = z_frc_trd_s + glob_sum( rnf_tsc(:,:,jp_sal) * zsurf(:,:) )
+      z_frc_trd_v = r1_rau0 * glob_sum( - ( emp(:,:) - rnf(:,:) ) * surf(:,:) ) ! volume fluxes
+      z_frc_trd_t =           glob_sum( sbc_tsc(:,:,jp_tem) * surf(:,:) )       ! heat fluxes
+      z_frc_trd_s =           glob_sum( sbc_tsc(:,:,jp_sal) * surf(:,:) )       ! salt fluxes
+      ! Add runoff heat & salt input
+      IF( ln_rnf    )   z_frc_trd_t = z_frc_trd_t + glob_sum( rnf_tsc(:,:,jp_tem) * surf(:,:) )
+      IF( ln_rnf_sal)   z_frc_trd_s = z_frc_trd_s + glob_sum( rnf_tsc(:,:,jp_sal) * surf(:,:) )
 
       ! Add penetrative solar radiation
-      IF( ln_traqsr )   z_frc_trd_t = z_frc_trd_t + r1_rau0_rcp * glob_sum( qsr     (:,:) * zsurf(:,:) )
+      IF( ln_traqsr )   z_frc_trd_t = z_frc_trd_t + r1_rau0_rcp * glob_sum( qsr     (:,:) * surf(:,:) )
       ! Add geothermal heat flux
-      IF( ln_trabbc )   z_frc_trd_t = z_frc_trd_t +               glob_sum( qgh_trd0(:,:) * zsurf(:,:) )
-      !
+      IF( ln_trabbc )   z_frc_trd_t = z_frc_trd_t +               glob_sum( qgh_trd0(:,:) * surf(:,:) )
+      !
+      IF( .NOT. lk_vvl ) THEN
+         z_wn_trd_t = - glob_sum( surf(:,:) * wn(:,:,1) * tsb(:,:,1,jp_tem) )
+         z_wn_trd_s = - glob_sum( surf(:,:) * wn(:,:,1) * tsb(:,:,1,jp_sal) )
+      ENDIF
+
       frc_v = frc_v + z_frc_trd_v * rdt
       frc_t = frc_t + z_frc_trd_t * rdt
       frc_s = frc_s + z_frc_trd_s * rdt
+      !                                          ! Advection flux through fixed surface (z=0)
+      IF( .NOT. lk_vvl ) THEN
+         frc_wn_t = frc_wn_t + z_wn_trd_t * rdt
+         frc_wn_s = frc_wn_s + z_wn_trd_s * rdt
+      ENDIF
 
       ! ------------------------ !
-      ! 2a -  Content variations !
+      ! 2 -  Content variations !
       ! ------------------------ !
-      zdiff_v2 = 0._wp
-      zdiff_hc = 0._wp
-      zdiff_sc = 0._wp
+      zdiff_v2 = 0.d0
+      zdiff_hc = 0.d0
+      zdiff_sc = 0.d0
+
       ! volume variation (calculated with ssh)
-      zdiff_v1 = glob_sum( zsurf(:,:) * ( sshn(:,:) - ssh_ini(:,:) ) )
+      zdiff_v1 = glob_sum( surf(:,:) * ( sshn(:,:) - ssh_ini(:,:) ) )
+
+      ! heat & salt content variation (associated with ssh)
+      IF( .NOT. lk_vvl ) THEN
+         z_ssh_hc = glob_sum( surf(:,:) * ( tsn(:,:,1,jp_tem) * sshn(:,:) - ssh_hc_loc_ini(:,:) ) )
+         z_ssh_sc = glob_sum( surf(:,:) * ( tsn(:,:,1,jp_sal) * sshn(:,:) - ssh_sc_loc_ini(:,:) ) )
+      ENDIF
+
       DO jk = 1, jpkm1
          ! volume variation (calculated with scale factors)
-         zdiff_v2 = zdiff_v2 + glob_sum( zsurf(:,:) * tmask(:,:,jk) * ( fse3t_n(:,:,jk) - e3t_ini(:,:,jk) ) )
+         zdiff_v2 = zdiff_v2 + glob_sum( surf(:,:) * tmask(:,:,jk) &
+            &                           * ( fse3t_n(:,:,jk) - e3t_ini(:,:,jk) ) )
          ! heat content variation
-         zdiff_hc = zdiff_hc + glob_sum( zsurf(:,:) * tmask(:,:,jk) * ( fse3t_n(:,:,jk) * tsn(:,:,jk,jp_tem)   &
-            &                           - hc_loc_ini(:,:,jk) ) )
+         zdiff_hc = zdiff_hc + glob_sum(  surf(:,:) * tmask(:,:,jk) & 
+            &                           * ( fse3t_n(:,:,jk) * tsn(:,:,jk,jp_tem) - hc_loc_ini(:,:,jk) ) )
          ! salt content variation
-         zdiff_sc = zdiff_sc + glob_sum( zsurf(:,:) * tmask(:,:,jk) * ( fse3t_n(:,:,jk) * tsn(:,:,jk,jp_sal)   &
-            &                           - sc_loc_ini(:,:,jk) ) )
+         zdiff_sc = zdiff_sc + glob_sum(  surf(:,:) * tmask(:,:,jk)   &
+            &                           * ( fse3t_n(:,:,jk) * tsn(:,:,jk,jp_sal) - sc_loc_ini(:,:,jk) ) )
       ENDDO
 
       ! Substract forcing from heat content, salt content and volume variations
-      !frc_v = zdiff_v2 - frc_v
-      !frc_t = zdiff_hc - frc_t
-      !frc_s = zdiff_sc - frc_s
-      
-      ! add ssh if not vvl
+      zdiff_v1 = zdiff_v1 - frc_v
+      IF( lk_vvl )   zdiff_v2 = zdiff_v2 - frc_v
+      zdiff_hc = zdiff_hc - frc_t
+      zdiff_sc = zdiff_sc - frc_s
       IF( .NOT. lk_vvl ) THEN
-        zdiff_v2 = zdiff_v2 + zdiff_v1
-        zdiff_hc = zdiff_hc + glob_sum( zsurf(:,:) * ( sshn(:,:) * tsn(:,:,1,jp_tem)   &
-               &                           - hcssh_loc_ini(:,:) ) )
-        zdiff_sc = zdiff_sc + glob_sum( zsurf(:,:) * ( sshn(:,:) * tsn(:,:,1,jp_sal)   &
-               &                           - scssh_loc_ini(:,:) ) )
-      ENDIF
-      !
-      ! ----------------------- !
-      ! 2b -  Content           !
-      ! ----------------------- !
-      z_v2 = 0._wp
-      z_hc = 0._wp
-      z_sc = 0._wp
-      ! volume (calculated with ssh)
-      z_v1 = glob_sum( zsurf(:,:) * sshn(:,:) )
-      DO jk = 1, jpkm1
-         ! volume (calculated with scale factors)
-         z_v2 = z_v2 + glob_sum( zsurf(:,:) * tmask(:,:,jk) * fse3t_n(:,:,jk) )
-         ! heat content
-         z_hc = z_hc + glob_sum( zsurf(:,:) * tmask(:,:,jk) * fse3t_n(:,:,jk) * tsn(:,:,jk,jp_tem) )
-         ! salt content
-         z_sc = z_sc + glob_sum( zsurf(:,:) * tmask(:,:,jk) * fse3t_n(:,:,jk) * tsn(:,:,jk,jp_sal) )
-      ENDDO
-      ! add ssh if not vvl
-      IF( .NOT. lk_vvl ) THEN
-        z_v2 = z_v2 + z_v1
-        z_hc = z_hc + glob_sum( zsurf(:,:) * sshn(:,:) * tsn(:,:,1,jp_tem) )
-        z_sc = z_sc + glob_sum( zsurf(:,:) * sshn(:,:) * tsn(:,:,1,jp_sal) )
+         zdiff_hc1 = zdiff_hc + z_ssh_hc 
+         zdiff_sc1 = zdiff_sc + z_ssh_sc
+         zerr_hc1  = z_ssh_hc - frc_wn_t
+         zerr_sc1  = z_ssh_sc - frc_wn_s
       ENDIF
 
@@ -161,19 +154,34 @@
       ! 3 - Diagnostics writing !
       ! ----------------------- !
-      zdeltat  = 1.e0 / ( ( kt - nit000 + 1 ) * rdt )
-!
-      CALL iom_put( 'bgtemper' , z_hc / z_v2 )                      ! Temperature (C) 
-      CALL iom_put( 'bgsaline' , z_sc / z_v2 )                      ! Salinity (psu)
-      CALL iom_put( 'bgheatco' , zdiff_hc * rau0 * rcp * 1.e-9_wp ) ! Heat content variation (10^9 J)
-      CALL iom_put( 'bgsaltco' , zdiff_sc * 1.e-9 )                 ! Salt content variation (psu*km3) 
-      CALL iom_put( 'bgvolssh' , zdiff_v1 * 1.e-9 )                    ! volume ssh (km3)  
-      CALL iom_put( 'bgsshtot' , zdiff_v1 / glob_sum(zsurf) )          ! ssh (m)  
-      CALL iom_put( 'bgvoltot' , zdiff_v2 * 1.e-9 )                 ! volume total (km3) 
-      CALL iom_put( 'bgfrcvol' , frc_v * 1.e-9 )                     ! vol - surface forcing (volume) 
-      CALL iom_put( 'bgfrctem' , frc_t * rau0 * rcp * 1.e-9_wp ) ! hc  - surface forcing (heat content) 
-      CALL iom_put( 'bgfrcsal' , frc_s * 1.e-9 )                     ! sc  - surface forcing (salt content) 
-      !
-      CALL wrk_dealloc( jpi, jpj, zsurf )
-      !
+      zvol_tot   = 0.d0                                                   ! total ocean volume
+      DO jk = 1, jpkm1
+         zvol_tot  = zvol_tot + glob_sum( surf(:,:) * tmask(:,:,jk) * fse3t_n(:,:,jk) )
+      END DO
+
+      IF( lk_vvl ) THEN
+        CALL iom_put( 'bgtemper' , zdiff_hc / zvol_tot )              ! Temperature variation (C) 
+        CALL iom_put( 'bgsaline' , zdiff_sc / zvol_tot )              ! Salinity    variation (psu)
+        CALL iom_put( 'bgheatco' , zdiff_hc * 1.e-20 * rau0 * rcp )   ! Heat content variation (1.e20 J) 
+        CALL iom_put( 'bgsaltco' , zdiff_sc * 1.e-9    )              ! Salt content variation (psu*km3)
+        CALL iom_put( 'bgvolssh' , zdiff_v1 * 1.e-9    )              ! volume ssh variation (km3)  
+        CALL iom_put( 'bgvole3t' , zdiff_v2 * 1.e-9    )              ! volume e3t variation (km3)  
+        CALL iom_put( 'bgfrcvol' , frc_v    * 1.e-9    )              ! vol - surface forcing (km3) 
+        CALL iom_put( 'bgfrctem' , frc_t / zvol_tot    )              ! hc  - surface forcing (C) 
+        CALL iom_put( 'bgfrcsal' , frc_s / zvol_tot    )              ! sc  - surface forcing (psu) 
+      ELSE
+        CALL iom_put( 'bgtemper' , zdiff_hc1 / zvol_tot)              ! Heat content variation (C) 
+        CALL iom_put( 'bgsaline' , zdiff_sc1 / zvol_tot)              ! Salt content variation (psu)
+        CALL iom_put( 'bgheatco' , zdiff_hc1 * 1.e-20 * rau0 * rcp )  ! Heat content variation (1.e20 J) 
+        CALL iom_put( 'bgsaltco' , zdiff_sc1 * 1.e-9    )             ! Salt content variation (psu*km3)
+        CALL iom_put( 'bgvolssh' , zdiff_v1 * 1.e-9    )              ! volume ssh variation (km3)  
+        CALL iom_put( 'bgfrcvol' , frc_v    * 1.e-9    )              ! vol - surface forcing (km3) 
+        CALL iom_put( 'bgfrctem' , frc_t / zvol_tot    )              ! hc  - surface forcing (C) 
+        CALL iom_put( 'bgfrcsal' , frc_s / zvol_tot    )              ! sc  - surface forcing (psu) 
+        CALL iom_put( 'bgmistem' , zerr_hc1 / zvol_tot )              ! hc  - error due to free surface (C)
+        CALL iom_put( 'bgmissal' , zerr_sc1 / zvol_tot )              ! sc  - error due to free surface (psu)
+      ENDIF
+      !
+      IF( lrst_oce )   CALL dia_hsb_rst( kt, 'WRITE' )
+
       IF( nn_timing == 1 )   CALL timing_stop('dia_hsb')
 !
@@ -208,45 +216,41 @@
          WRITE(numout,*) '   Namelist namhsb : set hsb parameters'
          WRITE(numout,*) '      Switch for hsb diagnostic (T) or not (F)  ln_diahsb  = ', ln_diahsb
+         WRITE(numout,*)
       ENDIF
 
       IF( .NOT. ln_diahsb )   RETURN
-
-         ! ------------------- !
-         ! 1 - Allocate memory !
-         ! ------------------- !
-         ALLOCATE( hc_loc_ini(jpi,jpj,jpk), STAT=ierror )
-         IF( ierror > 0 ) THEN
-            CALL ctl_stop( 'dia_hsb: unable to allocate hc_loc_ini' )   ;   RETURN
-         ENDIF
-         ALLOCATE( sc_loc_ini(jpi,jpj,jpk), STAT=ierror )
-         IF( ierror > 0 ) THEN
-            CALL ctl_stop( 'dia_hsb: unable to allocate sc_loc_ini' )   ;   RETURN
-         ENDIF
-         ALLOCATE( hcssh_loc_ini(jpi,jpj), STAT=ierror )
-         IF( ierror > 0 ) THEN
-            CALL ctl_stop( 'dia_hsb: unable to allocate hcssh_loc_ini' )   ;   RETURN
-         ENDIF
-         ALLOCATE( scssh_loc_ini(jpi,jpj), STAT=ierror )
-         IF( ierror > 0 ) THEN
-            CALL ctl_stop( 'dia_hsb: unable to allocate scssh_loc_ini' )   ;   RETURN
-         ENDIF
-         ALLOCATE( e3t_ini(jpi,jpj,jpk)   , STAT=ierror )
-         IF( ierror > 0 ) THEN
-            CALL ctl_stop( 'dia_hsb: unable to allocate e3t_ini' )      ;   RETURN
-         ENDIF
-         ALLOCATE( ssh_ini(jpi,jpj)       , STAT=ierror )
-         IF( ierror > 0 ) THEN
-            CALL ctl_stop( 'dia_hsb: unable to allocate ssh_ini' )      ;   RETURN
-         ENDIF
-         
-         ! ----------------------------------------------- !
-         ! 2 - Time independant variables and file opening !
-         ! ----------------------------------------------- !
-         IF(lwp) WRITE(numout,*) "dia_hsb: heat salt volume budgets activated"
-         IF( lk_obc .or. lk_bdy ) THEN
-            CALL ctl_warn( 'dia_hsb does not take open boundary fluxes into account' )         
-         ENDIF
-         !
-         CALL dia_hsb_rst( nit000, 'READ' )  !* read or initialize all required files
+!      IF( .NOT. lk_mpp_rep ) &
+!        CALL ctl_stop (' Your global mpp_sum if performed in single precision - 64 bits -', &
+!             &         ' whereas the global sum to be precise must be done in double precision ',&
+!             &         ' please add key_mpp_rep')
+
+      ! ------------------- !
+      ! 1 - Allocate memory !
+      ! ------------------- !
+      ALLOCATE( hc_loc_ini(jpi,jpj,jpk), sc_loc_ini(jpi,jpj,jpk), &
+         &      e3t_ini(jpi,jpj,jpk), surf(jpi,jpj),  ssh_ini(jpi,jpj), STAT=ierror )
+      IF( ierror > 0 ) THEN
+         CALL ctl_stop( 'dia_hsb: unable to allocate hc_loc_ini' )   ;   RETURN
+      ENDIF
+
+      IF(.NOT. lk_vvl ) ALLOCATE( ssh_hc_loc_ini(jpi,jpj), ssh_sc_loc_ini(jpi,jpj),STAT=ierror )
+      IF( ierror > 0 ) THEN
+         CALL ctl_stop( 'dia_hsb: unable to allocate hc_loc_ini' )   ;   RETURN
+      ENDIF
+
+      ! ----------------------------------------------- !
+      ! 2 - Time independant variables and file opening !
+      ! ----------------------------------------------- !
+      IF(lwp) WRITE(numout,*) "dia_hsb: heat salt volume budgets activated"
+      IF(lwp) WRITE(numout,*) '~~~~~~~'
+      surf(:,:) = e1t(:,:) * e2t(:,:) * tmask(:,:,1) * tmask_i(:,:)      ! masked surface grid cell area
+      surf_tot  = glob_sum( surf(:,:) )                                       ! total ocean surface area
+
+      IF( lk_bdy ) CALL ctl_warn( 'dia_hsb does not take open boundary fluxes into account' )         
+      !
+      ! ---------------------------------- !
+      ! 4 - initial conservation variables !
+      ! ---------------------------------- !
+      CALL dia_hsb_rst( nit000, 'READ' )  !* read or initialize all required files
       !
    END SUBROUTINE dia_hsb_init
@@ -271,15 +275,26 @@
            !id1 = iom_varid( numror, 'frc_vol'  , ldstop = .FALSE. )
            !
+           IF(lwp) WRITE(numout,*) '~~~~~~~'
+           IF(lwp) WRITE(numout,*) ' dia_hsb_rst at it= ', kt,' date= ', ndastp
+           IF(lwp) WRITE(numout,*) '~~~~~~~'
            CALL iom_get( numror, 'frc_v', frc_v )
            CALL iom_get( numror, 'frc_t', frc_t )
            CALL iom_get( numror, 'frc_s', frc_s )
-
+           IF( .NOT. lk_vvl ) THEN
+              CALL iom_get( numror, 'frc_wn_t', frc_wn_t )
+              CALL iom_get( numror, 'frc_wn_s', frc_wn_s )
+           ENDIF
            CALL iom_get( numror, jpdom_autoglo, 'ssh_ini', ssh_ini )
            CALL iom_get( numror, jpdom_autoglo, 'e3t_ini', e3t_ini )
            CALL iom_get( numror, jpdom_autoglo, 'hc_loc_ini', hc_loc_ini )
            CALL iom_get( numror, jpdom_autoglo, 'sc_loc_ini', sc_loc_ini )
-           CALL iom_get( numror, jpdom_autoglo, 'hcssh_loc_ini', hcssh_loc_ini )
-           CALL iom_get( numror, jpdom_autoglo, 'scssh_loc_ini', scssh_loc_ini )
+           IF( .NOT. lk_vvl ) THEN
+              CALL iom_get( numror, jpdom_autoglo, 'ssh_hc_loc_ini', ssh_hc_loc_ini )
+              CALL iom_get( numror, jpdom_autoglo, 'ssh_sc_loc_ini', ssh_sc_loc_ini )
+           ENDIF
        ELSE
+          IF(lwp) WRITE(numout,*) '~~~~~~~'
+          IF(lwp) WRITE(numout,*) ' dia_hsb at initial state '
+          IF(lwp) WRITE(numout,*) '~~~~~~~'
           ssh_ini(:,:) = sshn(:,:)                                       ! initial ssh
           DO jk = 1, jpk
@@ -288,24 +303,36 @@
              sc_loc_ini(:,:,jk) = tsn(:,:,jk,jp_sal) * fse3t_n(:,:,jk)   ! initial salt content
           END DO
-          hcssh_loc_ini(:,:) = tsn(:,:,1,jp_tem) * sshn(:,:)   ! initial heat content in ssh
-          scssh_loc_ini(:,:) = tsn(:,:,1,jp_sal) * sshn(:,:)   ! initial salt content in ssh
-          frc_v = 0._wp                                           
-          frc_t = 0._wp                                           
-          frc_s = 0._wp                                                  
+          frc_v = 0.d0                                           ! volume       trend due to forcing
+          frc_t = 0.d0                                           ! heat content   -    -   -    -   
+          frc_s = 0.d0                                           ! salt content   -    -   -    -        
+          IF( .NOT. lk_vvl ) THEN
+             ssh_hc_loc_ini(:,:) = tsn(:,:,1,jp_tem) * sshn(:,:)   ! initial heat content in ssh
+             ssh_sc_loc_ini(:,:) = tsn(:,:,1,jp_sal) * sshn(:,:)   ! initial salt content in ssh
+             frc_wn_t = 0.d0                                       ! initial heat content misfit due to free surface
+             frc_wn_s = 0.d0                                       ! initial salt content misfit due to free surface
+          ENDIF
        ENDIF
 
      ELSEIF( TRIM(cdrw) == 'WRITE' ) THEN   ! Create restart file
         !                                   ! -------------------
-        IF(lwp) WRITE(numout,*) '---- dia-rst ----'
+        IF(lwp) WRITE(numout,*) '~~~~~~~'
+        IF(lwp) WRITE(numout,*) ' dia_hsb_rst at it= ', kt,' date= ', ndastp
+        IF(lwp) WRITE(numout,*) '~~~~~~~'
+
         CALL iom_rstput( kt, nitrst, numrow, 'frc_v'   , frc_v     )
         CALL iom_rstput( kt, nitrst, numrow, 'frc_t'   , frc_t     )
         CALL iom_rstput( kt, nitrst, numrow, 'frc_s'   , frc_s     )
-        
+        IF( .NOT. lk_vvl ) THEN
+           CALL iom_rstput( kt, nitrst, numrow, 'frc_wn_t', frc_wn_t )
+           CALL iom_rstput( kt, nitrst, numrow, 'frc_wn_s', frc_wn_s )
+        ENDIF
         CALL iom_rstput( kt, nitrst, numrow, 'ssh_ini', ssh_ini )
         CALL iom_rstput( kt, nitrst, numrow, 'e3t_ini', e3t_ini )
         CALL iom_rstput( kt, nitrst, numrow, 'hc_loc_ini', hc_loc_ini )
         CALL iom_rstput( kt, nitrst, numrow, 'sc_loc_ini', sc_loc_ini )
-        CALL iom_rstput( kt, nitrst, numrow, 'hcssh_loc_ini', hcssh_loc_ini )
-        CALL iom_rstput( kt, nitrst, numrow, 'scssh_loc_ini', scssh_loc_ini )
+        IF( .NOT. lk_vvl ) THEN
+           CALL iom_rstput( kt, nitrst, numrow, 'ssh_hc_loc_ini', ssh_hc_loc_ini )
+           CALL iom_rstput( kt, nitrst, numrow, 'ssh_sc_loc_ini', ssh_sc_loc_ini )
+        ENDIF
         !
      ENDIF
Index: /branches/2013/dev_r4028_CNRS_LIM3/NEMOGCM/NEMO/OPA_SRC/IOM/iom.F90
===================================================================
--- /branches/2013/dev_r4028_CNRS_LIM3/NEMOGCM/NEMO/OPA_SRC/IOM/iom.F90	(revision 4344)
+++ /branches/2013/dev_r4028_CNRS_LIM3/NEMOGCM/NEMO/OPA_SRC/IOM/iom.F90	(revision 4345)
@@ -982,6 +982,9 @@
       CHARACTER(LEN=*), INTENT(in) ::   cdname
       REAL(wp)        , INTENT(in) ::   pfield0d
+      REAL(wp)        , DIMENSION(jpi,jpj) ::   zz     ! masson
 #if defined key_iomput
-      CALL xios_send_field(cdname, (/pfield0d/))
+      zz(:,:)=pfield0d
+      CALL xios_send_field(cdname, zz)
+      !CALL xios_send_field(cdname, (/pfield0d/)) 
 #else
       IF( .FALSE. )   WRITE(numout,*) cdname, pfield0d   ! useless test to avoid compilation warnings
@@ -1155,9 +1158,10 @@
       !!
       !!----------------------------------------------------------------------
-      REAL(wp), DIMENSION(1,1) ::   zz = 1.
+      REAL(wp), DIMENSION(1) ::   zz = 1.
       !!----------------------------------------------------------------------
       CALL iom_set_domain_attr('scalarpoint', ni_glo=jpnij, nj_glo=1, ibegin=narea, jbegin=1, ni=1, nj=1)
-      CALL iom_set_domain_attr('scalarpoint', data_dim=1)
-      CALL iom_set_domain_attr('scalarpoint', lonvalue=(/ zz /), latvalue=(/ zz /))
+      CALL iom_set_domain_attr('scalarpoint', data_dim=2, data_ibegin = 1, data_ni = 1, data_jbegin = 1, data_nj = 1)
+      zz=REAL(narea,wp)
+      CALL iom_set_domain_attr('scalarpoint', lonvalue=zz, latvalue=zz)
 
    END SUBROUTINE set_scalar
Index: /branches/2013/dev_r4028_CNRS_LIM3/NEMOGCM/NEMO/OPA_SRC/IOM/iom_nf90.F90
===================================================================
--- /branches/2013/dev_r4028_CNRS_LIM3/NEMOGCM/NEMO/OPA_SRC/IOM/iom_nf90.F90	(revision 4344)
+++ /branches/2013/dev_r4028_CNRS_LIM3/NEMOGCM/NEMO/OPA_SRC/IOM/iom_nf90.F90	(revision 4345)
@@ -217,4 +217,5 @@
          CALL iom_nf90_check(NF90_Inquire_Variable(if90id, ivarid, dimids = idimid(1:i_nvd)), clinfo)   ! dimensions ids
          iom_file(kiomid)%luld(kiv) = .FALSE.   ! default value
+         iom_file(kiomid)%dimsz(:,kiv) = 0      ! reset dimsz in case previously used
          DO ji = 1, i_nvd                       ! dimensions size
             CALL iom_nf90_check(NF90_Inquire_Dimension(if90id, idimid(ji), len = iom_file(kiomid)%dimsz(ji,kiv)), clinfo)   
Index: /branches/2013/dev_r4028_CNRS_LIM3/NEMOGCM/NEMO/OPA_SRC/SBC/sbcice_lim.F90
===================================================================
--- /branches/2013/dev_r4028_CNRS_LIM3/NEMOGCM/NEMO/OPA_SRC/SBC/sbcice_lim.F90	(revision 4344)
+++ /branches/2013/dev_r4028_CNRS_LIM3/NEMOGCM/NEMO/OPA_SRC/SBC/sbcice_lim.F90	(revision 4345)
@@ -27,5 +27,4 @@
    USE iceini          ! LIM-3: ice initialisation
    USE dom_ice         ! LIM-3: ice domain
-   USE domvvl          ! domain: variable volume level(fse3t_m)
 
    USE sbc_oce         ! Surface boundary condition: ocean fields
Index: /branches/2013/dev_r4028_CNRS_LIM3/NEMOGCM/NEMO/OPA_SRC/step.F90
===================================================================
--- /branches/2013/dev_r4028_CNRS_LIM3/NEMOGCM/NEMO/OPA_SRC/step.F90	(revision 4344)
+++ /branches/2013/dev_r4028_CNRS_LIM3/NEMOGCM/NEMO/OPA_SRC/step.F90	(revision 4345)
@@ -244,5 +244,4 @@
       IF( lk_diaobs  )         CALL dia_obs( kstp )         ! obs-minus-model (assimilation) diagnostics (call after dynamics update)
 
-      IF( lrst_oce .AND. ln_diahsb )   CALL dia_hsb_rst( kstp, 'WRITE' )
       !>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
       ! Control and restarts
