Index: LMDZ4/branches/IPSL-CM4_IPCC_patches/libf/phylmd/clesphys.h
===================================================================
--- LMDZ4/branches/IPSL-CM4_IPCC_patches/libf/phylmd/clesphys.h	(revision 610)
+++ LMDZ4/branches/IPSL-CM4_IPCC_patches/libf/phylmd/clesphys.h	(revision 705)
@@ -10,4 +10,10 @@
        REAL*8 RCO2, RCH4, RN2O, RCFC11, RCFC12  
        REAL*8 CH4_ppb, N2O_ppb, CFC11_ppt, CFC12_ppt
+cOM ---> correction du bilan d'eau global
+cOM Correction sur precip KE
+       REAL cvl_corr
+cOM Fonte calotte dans bilan eau
+       LOGICAL ok_lic_melt
+
 cIM simulateur ISCCP 
        INTEGER top_height, overlap
@@ -29,2 +35,3 @@
      ,     , top_height, overlap, cdmmax, cdhmax, ksta, ksta_ter
      ,     , ok_kzmin, lev_histhf, lev_histday, lev_histmth
+     ,     , ok_lic_melt, cvl_corr
Index: LMDZ4/branches/IPSL-CM4_IPCC_patches/libf/phylmd/clesphys.inc
===================================================================
--- LMDZ4/branches/IPSL-CM4_IPCC_patches/libf/phylmd/clesphys.inc	(revision 610)
+++ LMDZ4/branches/IPSL-CM4_IPCC_patches/libf/phylmd/clesphys.inc	(revision 705)
@@ -16,4 +16,10 @@
        INTEGER :: lev_histhf, lev_histday, lev_histmth
 
+!OM ---> correction du bilan d'eau global
+!OM Correction sur precip KE
+       REAL cvl_corr
+!OM Fonte calotte dans bilan eau
+       LOGICAL ok_lic_melt
+
        COMMON/clesphys/cycle_diurne, soil_model, new_oliq, &
      &     ok_orodr, ok_orolf, ok_limitvrai, nbapp_rad, iflag_con &
@@ -21,3 +27,4 @@
      &     , CH4_ppb, N2O_ppb, CFC11_ppt, CFC12_ppt &
      &     , top_height, overlap, cdmmax, cdhmax, ksta, ksta_ter &
-     &     , ok_kzmin, lev_histhf, lev_histday, lev_histmth
+     &     , ok_kzmin, lev_histhf, lev_histday, lev_histmth  &
+     &     , ok_lic_melt, cvl_corr
Index: LMDZ4/branches/IPSL-CM4_IPCC_patches/libf/phylmd/clmain.F
===================================================================
--- LMDZ4/branches/IPSL-CM4_IPCC_patches/libf/phylmd/clmain.F	(revision 610)
+++ LMDZ4/branches/IPSL-CM4_IPCC_patches/libf/phylmd/clmain.F	(revision 705)
@@ -20,5 +20,5 @@
 cIM cf JLD    .                  zcoefh,zu1,zv1, t2m, q2m, u10m, v10m)
      .                  zcoefh,zu1,zv1, t2m, q2m, u10m, v10m,
-     .                  fqcalving,ffonte, run_off_lic_0)
+     .                  fqcalving,fqfonte,ffonte, run_off_lic_0)
 cAA .                  itr, tr, flux_surf, d_tr)
 cAA REM:
@@ -73,4 +73,5 @@
 c dflux_q derive du flux latent
 c ffonte----Flux thermique utilise pour fondre la neige
+c fqfonte -- quantite d'eau due a la fonte de la calotte
 c fqcalving-Flux d'eau "perdue" par la surface et necessaire pour limiter la
 c           hauteur de neige, en kg/m2/s
@@ -102,6 +103,6 @@
       REAL dflux_t(klon), dflux_q(klon)
 cIM cf JLD
-      REAL y_fqcalving(klon), y_ffonte(klon)
-      REAL fqcalving(klon,nbsrf), ffonte(klon,nbsrf)
+      REAL y_fqcalving(klon), y_fqfonte(klon), y_ffonte(klon)
+      REAL fqcalving(klon,nbsrf), fqfonte(klon,nbsrf), ffonte(klon,nbsrf)
       REAL run_off_lic_0(klon), y_run_off_lic_0(klon)
 
@@ -579,5 +580,5 @@
 cIM cf JLD    s          y_flux_t, y_flux_q, y_dflux_t, y_dflux_q)
      s          y_flux_t, y_flux_q, y_dflux_t, y_dflux_q,
-     s          y_fqcalving,y_ffonte,y_run_off_lic_0)
+     s          y_fqcalving,y_fqfonte,y_ffonte,y_run_off_lic_0)
 c
 c calculer la longueur de rugosite sur ocean
@@ -643,4 +644,5 @@
 cIM cf JLD ??
          fqcalving(i,nsrf) = y_fqcalving(j)        
+         fqfonte(i,nsrf) = y_fqfonte(j)        
          ffonte(i,nsrf) = y_ffonte(j)        
          cdragh(i) = cdragh(i) + ycoefh(j,1)
@@ -824,5 +826,5 @@
 cIM cf JLD    s                flux_t, flux_q,dflux_s,dflux_l)
      s                flux_t, flux_q,dflux_s,dflux_l,
-     s                fqcalving,ffonte,run_off_lic_0)
+     s                fqcalving,fqfonte,ffonte,run_off_lic_0)
 
       USE interface_surf
@@ -900,4 +902,6 @@
 c hauteur de neige, en kg/m2/s
       REAL fqcalving(klon)
+c Quantite d'eau de fonte de la calotte kg/mé/s
+      REAL fqfonte(klon)
 c======================================================================
       REAL t_grnd  ! temperature de rappel pour glace de mer
@@ -1120,5 +1124,5 @@
      s tsol_rad, tsurf_new, alb_new, alblw, emis_new, z0_new, 
 cIM cf JLD    s pctsrf_new, agesno)
-     s pctsrf_new, agesno,fqcalving,ffonte, run_off_lic_0)
+     s pctsrf_new, agesno,fqcalving,fqfonte,ffonte, run_off_lic_0)
 
 
Index: LMDZ4/branches/IPSL-CM4_IPCC_patches/libf/phylmd/conf_phys.F90
===================================================================
--- LMDZ4/branches/IPSL-CM4_IPCC_patches/libf/phylmd/conf_phys.F90	(revision 610)
+++ LMDZ4/branches/IPSL-CM4_IPCC_patches/libf/phylmd/conf_phys.F90	(revision 705)
@@ -275,4 +275,11 @@
 !! KE
 !
+!Config key  = cvl_corr
+!Config Desc = Facteur multiplication des precip convectives dans KE
+!Config Def  = 1.00
+!Config Help = 1.02 pour un moderne ou un pre-ind. A ajuster pour un glaciaire
+  cvl_corr = 1.00
+  CALL getin('cvl_corr', cvl_corr)
+
 !Config Key  = epmax
 !Config Desc = Efficacite precip
@@ -514,4 +521,11 @@
   ok_kzmin = .true.
   call getin('ok_kzmin',ok_kzmin)
+
+!Config Key = ok_lic_melt
+!Config Desc = Prise en compte de la fonte de la calotte dans le bilan d'eau
+!Config Def  = .false.
+!Config Help = mettre a .false. pour assurer la conservation en eau
+  ok_lic_melt = .false.
+  call getin('ok_lic_melt', ok_lic_melt)
 
 !
@@ -574,4 +588,6 @@
   write(numout,*)' CFC11_ppt=',CFC11_ppt,' RCFC11 =  ',RCFC11
   write(numout,*)' CFC12_ppt=',CFC12_ppt,' RCFC12 =  ',RCFC12
+  write(numout,*)' cvl_corr=', cvl_corr
+  write(numout,*)'ok_lic_melt=', ok_lic_melt
   write(numout,*)' epmax = ', epmax
   write(numout,*)' ok_adj_ema = ', ok_adj_ema
Index: LMDZ4/branches/IPSL-CM4_IPCC_patches/libf/phylmd/ini_histmth.h
===================================================================
--- LMDZ4/branches/IPSL-CM4_IPCC_patches/libf/phylmd/ini_histmth.h	(revision 610)
+++ LMDZ4/branches/IPSL-CM4_IPCC_patches/libf/phylmd/ini_histmth.h	(revision 705)
@@ -317,4 +317,8 @@
      .                "kg/m2/s",iim,jjmp1,nhori, 1,1,1, -99, 32,
      .                "ave(X)", zsto,zout)
+c
+         CALL histdef(nid_mth, "fqfonte","Land ice melt",
+     .                "kg/m2/s",iim,jjmp1,nhori, 1,1,1, -99, 32,
+     .                "ave(X)", zsto,zout)
 cIM: 171003
          DO nsrf = 1, nbsrf
Index: LMDZ4/branches/IPSL-CM4_IPCC_patches/libf/phylmd/interface_surf.F90
===================================================================
--- LMDZ4/branches/IPSL-CM4_IPCC_patches/libf/phylmd/interface_surf.F90	(revision 610)
+++ LMDZ4/branches/IPSL-CM4_IPCC_patches/libf/phylmd/interface_surf.F90	(revision 705)
@@ -39,5 +39,6 @@
 #include "YOMCST.inc"
 #include "indicesol.inc"
-
+!IM
+#include "clesphys.inc"
 
 ! run_off      ruissellement total
@@ -74,5 +75,5 @@
       & evap, fluxsens, fluxlat, dflux_l, dflux_s, &              
       & tsol_rad, tsurf_new, alb_new, alblw, emis_new, &
-      & z0_new, pctsrf_new, agesno,fqcalving,ffonte, run_off_lic_0)
+      & z0_new, pctsrf_new, agesno,fqcalving,fqfonte,ffonte, run_off_lic_0)
 
 
@@ -282,4 +283,5 @@
   ffonte(1:knon)=0.
   fqcalving(1:knon)=0.
+  fqfonte  (1:knon)=0.
 
   cal = 999999. ; beta = 999999. ; dif_grnd = 999999. ; capsol = 999999.
@@ -375,5 +377,5 @@
      &   petAcoef, peqAcoef, petBcoef, peqBcoef, &
      &   tsurf_new, evap, fluxlat, fluxsens, dflux_s, dflux_l, &
-     &   fqcalving,ffonte, run_off_lic_0)
+     &   fqcalving,fqfonte,ffonte, run_off_lic_0)
 
 
@@ -628,5 +630,5 @@
              &   petAcoef, peqAcoef, petBcoef, peqBcoef, &
              &   tsurf_new, evap, fluxlat, fluxsens, dflux_s, dflux_l, &
-             &   fqcalving,ffonte, run_off_lic_0)
+             &   fqcalving,fqfonte,ffonte, run_off_lic_0)
 
 !     calcul albedo
@@ -723,5 +725,5 @@
      &   petAcoef, peqAcoef, petBcoef, peqBcoef, &
      &   tsurf_new, evap, fluxlat, fluxsens, dflux_s, dflux_l, &
-     &   fqcalving,ffonte, run_off_lic_0)
+     &   fqcalving,fqfonte,ffonte, run_off_lic_0)
 
 ! passage du run-off des glaciers calcule dans fonte_neige au coupleur
@@ -1364,5 +1366,5 @@
 ! l'avoir lu
   real, allocatable,dimension(:,:),save :: pctsrf_sav
-  real, dimension(iim, jjm+1, 2) :: tamp_srf
+  real, dimension(iim, jjm+1, 3) :: tamp_srf
   integer, allocatable, dimension(:), save :: tamp_ind
   real, allocatable, dimension(:,:),save :: tamp_zmasq
@@ -1715,7 +1717,10 @@
       wri_rriv = cpl_rriv(:,:)
       wri_rcoa = cpl_rcoa(:,:)
-      DO j = 1, jjm + 1
-        wri_calv(:,j) = sum(cpl_rlic(:,j)) / iim
-      enddo
+!Essai OM+JLD : ca marche !!!! (17 mars 2006)
+      CALL gath2cpl( pctsrf(1,is_lic), tamp_srf(1,1,3), klon, klon, iim, jjm, tamp_ind)
+      DO j = 1, jjm+1
+         wri_calv(1,j) = DOT_PRODUCT (cpl_rlic(1:iim,j), tamp_srf(1:iim,j,3)) / REAL(iim)
+         wri_calv(2:iim,j) = wri_calv(1,j)
+      ENDDO
 
       where (tamp_zmasq /= 1.)
@@ -2642,5 +2647,5 @@
      & petAcoef, peqAcoef, petBcoef, peqBcoef, &
      & tsurf_new, evap, fluxlat, fluxsens, dflux_s, dflux_l, &
-     & fqcalving,ffonte,run_off_lic_0)
+     & fqcalving,fqfonte,ffonte,run_off_lic_0)
 
 ! Routine de traitement de la fonte de la neige dans le cas du traitement
@@ -2703,6 +2708,6 @@
   real, dimension(klon), intent(INOUT):: ffonte
 ! Flux d'eau "perdue" par la surface et necessaire pour que limiter la
-! hauteur de neige, en kg/m2/s
-  real, dimension(klon), intent(INOUT):: fqcalving
+! hauteur de neige, en kg/m2/s. Et flux d'eau de fonte de la calotte.
+  REAL, DIMENSION(klon), INTENT(INOUT):: fqcalving, fqfonte
   real, dimension(klon), intent(INOUT):: run_off_lic_0
 ! Variables locales
@@ -2824,4 +2829,5 @@
       fq_fonte = MIN( MAX((tsurf_new(i)-RTT )/chasno,0.0),snow(i))
       ffonte(i) = fq_fonte * RLMLT/dtime
+      fqfonte(i) = fq_fonte/dtime
       snow(i) = max(0., snow(i) - fq_fonte)
       bil_eau_s(i) = bil_eau_s(i) + fq_fonte 
@@ -2832,5 +2838,8 @@
         fq_fonte = MAX((tsurf_new(i)-RTT )/chaice,0.0)
         ffonte(i) = ffonte(i) + fq_fonte * RLMLT/dtime
-        bil_eau_s(i) = bil_eau_s(i) + fq_fonte
+        IF ( ok_lic_melt ) THEN
+           fqfonte(i) = fqfonte(i) + fq_fonte/dtime
+           bil_eau_s(i) = bil_eau_s(i) + fq_fonte
+        ENDIF
         tsurf_new(i) = RTT
       ENDIF
@@ -2850,5 +2859,5 @@
  &                        (1. - coeff_rel) * run_off_lic_0(i)
       run_off_lic_0(i) = run_off_lic(i)
-      run_off_lic(i) = run_off_lic(i) + bil_eau_s(i)/dtime
+      run_off_lic(i) = run_off_lic(i) + fqfonte(i)/dtime
     endif
   enddo
Index: LMDZ4/branches/IPSL-CM4_IPCC_patches/libf/phylmd/physiq.F
===================================================================
--- LMDZ4/branches/IPSL-CM4_IPCC_patches/libf/phylmd/physiq.F	(revision 610)
+++ LMDZ4/branches/IPSL-CM4_IPCC_patches/libf/phylmd/physiq.F	(revision 705)
@@ -592,5 +592,6 @@
 c                               !et necessaire pour limiter la
 c                               !hauteur de neige, en kg/m2/s
-      REAL zxffonte(klon), zxfqcalving(klon)
+      REAL fqfonte(klon,nbsrf)  !Quantite d'eau de fonte des glaciers
+      REAL zxffonte(klon), zxfqcalving(klon),zxfqfonte(klon)
 
       LOGICAL offline           ! Controle du stockage ds "physique"
@@ -972,4 +973,5 @@
 c Declaration des constantes et des fonctions thermodynamiques
 c
+         SAVE fqfonte
 #include "YOMCST.h"
 #include "YOETHF.h"
@@ -1026,4 +1028,5 @@
        IF (debut) THEN
 C
+         fqfonte(:,:)=0.
          IF (if_ebil.ge.1) d_h_vcol_phy=0.
 c
@@ -1510,5 +1513,5 @@
      s            dsens, devap,
      s            ycoefh,yu1,yv1, t2m, q2m, u10m, v10m,
-     s            fqcalving, ffonte, run_off_lic_0) 
+     s            fqcalving, fqfonte,ffonte, run_off_lic_0) 
 c
 CXXX PB
@@ -1577,4 +1580,5 @@
          zxffonte(i) = 0.0
          zxfqcalving(i) = 0.0
+         zxfqfonte(i) = 0.0
 c
          IF ( abs( pctsrf(i, is_ter) + pctsrf(i, is_lic) + 
@@ -1603,4 +1607,6 @@
             zxfqcalving(i) = zxfqcalving(i) + 
      .                      fqcalving(i,nsrf)*pctsrf(i,nsrf)
+            zxfqfonte(i) = zxfqfonte(i) + 
+     .                      fqfonte(i,nsrf)*pctsrf(i,nsrf)
 c        ENDIF 
         ENDDO
@@ -1622,4 +1628,6 @@
           IF (pctsrf(i,nsrf) .LT. epsfra) 
      .    fqcalving(i,nsrf) = zxfqcalving(i)
+          IF (pctsrf(i,nsrf) .LT. epsfra) 
+     .    fqfonte(i,nsrf) = zxfqfonte(i)
         ENDDO
       ENDDO
Index: LMDZ4/branches/IPSL-CM4_IPCC_patches/physiq.def
===================================================================
--- LMDZ4/branches/IPSL-CM4_IPCC_patches/physiq.def	(revision 610)
+++ LMDZ4/branches/IPSL-CM4_IPCC_patches/physiq.def	(revision 705)
@@ -15,4 +15,6 @@
 ok_adj_ema = n
 iflag_clw = 1
+cvl_corr=1.02
+ok_lic_melt=no
 # 
 # parametres nuages
