Index: /LMDZ6/trunk/libf/phylmd/lmdz_cloud_optics_prop.f90
===================================================================
--- /LMDZ6/trunk/libf/phylmd/lmdz_cloud_optics_prop.f90	(revision 6175)
+++ /LMDZ6/trunk/libf/phylmd/lmdz_cloud_optics_prop.f90	(revision 6176)
@@ -10,4 +10,5 @@
 CONTAINS
 
+!=================================================================================================        
 SUBROUTINE cloud_optics_prop_post()
   USE lmdz_cloud_optics_prop_ini, ONLY: novlp
@@ -34,6 +35,8 @@
 END SUBROUTINE cloud_optics_prop_post
 
+
+!=================================================================================================
 SUBROUTINE cloud_optics_prop(klon, klev, paprs, pplay, temp, radocond, picefra, pclc, &
-    pcltau, pclemi, pch, pcl, pcm, pct, radocondwp, xflwp, xfiwp, xflwc, xfiwc, &
+    pcldtau, pclemi, pch, pcl, pcm, pct, radocondwp, xflwp, xfiwp, xflwc, xfiwc, &
     mass_solu_aero, mass_solu_aero_pi, pcldtaupi, distcltop, temp_cltop, re, fl, reliq, reice, &
     reliq_pi, reice_pi, scdnc, cdnc, cdnc_pi, cldncl, reffclwtop, lcc, reffclws, &
@@ -59,5 +62,5 @@
   USE lmdz_cloud_optics_prop_ini , ONLY : rei_coef, rei_min_temp
   USE lmdz_cloud_optics_prop_ini , ONLY : zepsec, novlp, iflag_ice_thermo, ok_new_lscp
-  USE lmdz_cloud_optics_prop_ini , ONLY : first
+  USE lmdz_cloud_optics_prop_ini , ONLY : first, iflag_cdreff
   
 
@@ -77,7 +80,8 @@
   !          "atelier optics of clouds": careful reading and comments 
   !                                   things to address -> see ?aoc
+  !          E. Vignon: comments + cleaning + structuration
   !
   ! Aim: compute condensates' optical properties
-  !      (cloud optical depth,) and emissivity ?aoc
+  !      (cloud optical depth,) and emissivity 
   ! ======================================================================
   
@@ -126,8 +130,8 @@
  
   ! diagnostics or properties if one uses oldrad
-  REAL, INTENT(OUT) :: pcltau(klon, klev) ! cloud optical depth [m]
+  REAL, INTENT(OUT) :: pcldtau(klon, klev) ! cloud optical depth [m]
   REAL, INTENT(OUT) :: pclemi(klon, klev) ! cloud emissivity [-]
-  REAL, INTENT(OUT) :: pcldtaupi(klon, klev) ! pre-industrial value of cloud optical thickness, ie.
-                                             ! values of optical thickness that does not account
+  REAL, INTENT(OUT) :: pcldtaupi(klon, klev) ! pre-industrial value of cloud optical depth, ie.
+                                             ! values of optical depth that does not account
                                              ! for aerosol effects on cloud droplet radius [m]
   REAL, INTENT(OUT) :: scdnc(klon, klev)   ! cloud droplet number concentration, mean over the whole mesh [m-3]
@@ -158,5 +162,5 @@
   INTEGER flag_max
 
-  ! threshold PARAMETERs
+  ! threshold parameters
   REAL phase3d(klon, klev)
   REAL tcc(klon), ftmp(klon), lcc_integrat(klon), height(klon)
@@ -168,7 +172,7 @@
   REAL rel, tc, rei, iwc, dei, deimin, deimax
   REAL k_ice
+  REAL rhol ! density of liquid water in kg/m3
   REAL re_pi(klon, klev) ! cloud droplet effective radius [um] (pi value)
 
-  ! IM cf. CR:parametres supplementaires
   REAL dzfice(klon,klev)
   REAL zclear(klon)
@@ -177,84 +181,86 @@
   REAL zcloudm(klon)
   REAL zcloudl(klon)
-  REAL rhodz(klon, klev) !--rho*dz pour la couche
-  REAL zrho(klon, klev) !--rho pour la couche
-  REAL dh(klon, klev) !--dz pour la couche
-  REAL rad_chaud(klon, klev) !--rayon pour les nuages chauds
-  REAL rad_chaud_pi(klon, klev) !--rayon pour les nuages chauds pre-industriels
+  REAL rhodz(klon, klev) !--rho*dz of layer
+  REAL zrho(klon, klev) !--rho of layer
+  REAL dh(klon, klev) !--dz of layer
+  REAL rad_chaud(klon, klev) !--radius for warm ("chaud") liquid clouds
+  REAL rad_chaud_pi(klon, klev) !--radius for warm ("chaud") liquid clouds, pre-industrial
   REAL zflwp_var, zfiwp_var
   REAL d_rei_dt
-
-
-  ! FH : 2011/05/24
-  ! rei = ( rei_max - rei_min ) * T(°C) / 81.4 + rei_max
-  ! to be used for a temperature in celcius T(°C) < 0
-  ! rei=rei_min for T(°C) < -81.4
-  ! Calcul de la pente de la relation entre rayon effective des cristaux
-  ! et la température Pour retrouver les résultats numériques de la version d'origine,
-  ! on impose 0.71 quand on est proche de 0.71
-  d_rei_dt = (rei_max-rei_min)/81.4
-  IF (abs(d_rei_dt-0.71)<1.E-4) d_rei_dt = 0.71
-
-  ! Calculer l'epaisseur optique et l'emmissivite des nuages
-  ! IM inversion des DO
-
-  xflwp = 0.D0
-  xfiwp = 0.D0
-  xflwc = 0.D0
-  xfiwc = 0.D0
-
-  reliq = 0.
-  reice = 0.
-  reliq_pi = 0.
-  reice_pi = 0.
-
+!=====================================================================================
+
+! Initialisation
+!===============
+  xflwp(:) = 0.D0
+  xfiwp(:) = 0.D0
+  xflwc(:,:) = 0.D0
+  xfiwc(:,:) = 0.D0
+  radocondwp(:) = 0.
+  rhol=1000.0
+
+  reliq(:,:) = 0.
+  reice(:,:) = 0.
+  reliq_pi(:,:) = 0.
+  reice_pi(:,:) = 0.
+
+! Preliminary calculations
+!==========================
+
+
+! for 'old' (pre-CMIP7) large-scale condensation scheme
+! (firstilp), ice fraction is recomputed here
   IF ((.NOT. ok_new_lscp) .AND. iflag_t_glace.EQ.0) THEN
     DO k = 1, klev
       DO i = 1, klon
-        ! -layer calculation
-        rhodz(i, k) = (paprs(i,k)-paprs(i,k+1))/rg ! kg/m2
-        zrho(i, k) = pplay(i, k)/temp(i, k)/rd ! kg/m3
-        dh(i, k) = rhodz(i, k)/zrho(i, k) ! m
-        ! -Fraction of ice in cloud using a linear transition
         icefrac_optics(i, k) = 1.0 - (temp(i,k)-t_glace_min_old)/(t_glace_max_old-t_glace_min_old)
         icefrac_optics(i, k) = min(max(icefrac_optics(i,k),0.0), 1.0)
-        ! -IM Total Liquid/Ice water content
-        xflwc(i, k) = (1.-icefrac_optics(i,k))*radocond(i, k)
-        xfiwc(i, k) = icefrac_optics(i, k)*radocond(i, k)
-      ENDDO
-    ENDDO
-  ELSE ! of IF (iflag_t_glace.EQ.0)
-    DO k = 1, klev
-
-
-      DO i = 1, klon
-
+      ENDDO
+    ENDDO
+
+  ELSE 
+! ice fraction directly from the lscp param, except for convective grid point           
+! where we take the temperature-dependent icefrac_optics computed in lmdz_call_cloud_optics
+
+   DO k = 1, klev
+      DO i = 1, klon
         IF ((.NOT. ptconv(i,k)) .AND. ok_new_lscp .AND. ok_icefra_lscp) THEN
-        ! EV: take the ice fraction directly from the lscp code
-        ! consistent only for non convective grid points
-        ! critical for mixed phase clouds
-            icefrac_optics(i,k)=picefra(i,k)
+           icefrac_optics(i,k)=picefra(i,k) ! picefra is the ice fraction computed in lscp
         ENDIF
-
-        ! -layer calculation
-        rhodz(i, k) = (paprs(i,k)-paprs(i,k+1))/rg ! kg/m2
-        zrho(i, k) = pplay(i, k)/temp(i, k)/rd ! kg/m3
-        dh(i, k) = rhodz(i, k)/zrho(i, k) ! m
-        ! -IM Total Liquid/Ice water content
-        xflwc(i, k) = (1.-icefrac_optics(i,k))*radocond(i, k)
-        xfiwc(i, k) = icefrac_optics(i, k)*radocond(i, k)
       ENDDO
     ENDDO
   ENDIF
 
-
-
-
-
+! computation of layers'mass and water contents for radiation
+DO k = 1,klev
+  DO i = 1,klon
+    rhodz(i, k) = (paprs(i,k)-paprs(i,k+1))/rg ! kg/m2
+    zrho(i, k) = pplay(i, k)/temp(i, k)/rd ! kg/m3
+    dh(i, k) = rhodz(i, k)/zrho(i, k) ! m
+    ! -Liquid/Ice water specific content, mesh averaged
+    xflwc(i, k) = (1.-icefrac_optics(i,k))*radocond(i, k)
+    xfiwc(i, k) = icefrac_optics(i, k)*radocond(i, k)
+   ! vertically integrated contents (water paths)
+    xflwp(i) = xflwp(i) + xflwc(i, k)*rhodz(i, k)
+    xfiwp(i) = xfiwp(i) + xfiwc(i, k)*rhodz(i, k)
+    radocondwp(i) = radocondwp(i) + radocond(i, k)*rhodz(i, k)
+  END DO
+END DO
+
+
+
+! Computation of cloud droplet effective radius
+!===============================================
+! There 2 options to compute cloud droplet effective radius:
+! if ok_cdnc: we compute cloud radius as a function of an in-cloud number concentration of cloud droplets (cdnc)
+! depending on the concentration of soluble aerosols
+! otherwise, cloud droplet radius is fixed to a constant value (in fact one constant for the first three layers, another
+! one for layers above
+
+
+! if ok_cdnc, let's first compute the in-cloud droplet number concentration
 
   IF (ok_cdnc) THEN
-
-    ! --we compute cloud properties as a function of the aerosol load
-
+   
+    ! Pre-industrial cloud droplet concentrations
     DO k = 1, klev
       DO i = 1, klon
@@ -262,6 +268,4 @@
         ! Cloud droplet number concentration (CDNC) is restricted
         ! to be within [20, 1000 cm^3]
-
-        ! --pre-industrial case
         cdnc_pi(i, k) = 10.**(bl95_b0+bl95_b1*log(max(mass_solu_aero_pi(i,k), &
           1.E-4))/log(10.))*1.E6 !-m-3
@@ -271,9 +275,9 @@
     ENDDO
 
-    !--flag_aerosol=7 => MACv2SP climatology 
-    !--in this case there is an enhancement factor
-    IF (flag_aerosol .EQ. 7) THEN 
-
-      !--present-day
+   ! Present day cloud droplet concentrations
+   IF (flag_aerosol .EQ. 7) THEN 
+
+    ! flag_aerosol=7 => MACv2SP climatology 
+    ! in this case we apply an enhancement factor dNovrN on the pi value
       DO k = 1, klev
         DO i = 1, klon
@@ -282,19 +286,12 @@
       ENDDO
 
-    !--standard case
-    ELSE
-
+   ELSE
+   ! standard configuration using the same formula as above but
+   ! considering present day aerosols concentrations
       DO k = 1, klev
         DO i = 1, klon
-
-          ! Formula "D" of Boucher and Lohmann, Tellus, 1995
-          ! Cloud droplet number concentration (CDNC) is restricted
-          ! to be within [20, 1000 cm^3]
-
-          ! --present-day case
           cdnc(i, k) = 10.**(bl95_b0+bl95_b1*log(max(mass_solu_aero(i,k), &
             1.E-4))/log(10.))*1.E6 !-m-3
           cdnc(i, k) = min(cdnc_max_m3, max(cdnc_min_m3,cdnc(i,k)))
-
         ENDDO
       ENDDO
@@ -302,94 +299,53 @@
     ENDIF !--flag_aerosol
 
-    !--computing cloud droplet size
+ ENDIF
+
+! Cloud droplet effective radius calculation
+! controled by ok_cdnc and iflag_cdreff
+
+ IF (ok_cdnc .AND. iflag_cdreff .EQ. 0) THEN
+    ! aerosol-aware formulation used until CMIP6
+    ! Warning! the formula is erroneous as it
+    ! considers the liq+ice water mass and 
+    ! the mesh-averaged (and not the in-cloud)
+    ! contents
     DO k = 1, klev
       DO i = 1, klon
+
+        ! --pre-industrial case
+        rad_chaud_pi(i, k) = 1.1*((radocond(i,k)*pplay(i, &
+          k)/(rd*temp(i,k)))/(4./3.*rpi*rhol*cdnc_pi(i,k)))**(1./3.)
+        rad_chaud_pi(i, k) = max(rad_chaud_pi(i,k)*1.E6, 5.)
 
         ! --present-day case
         rad_chaud(i, k) = 1.1*((radocond(i,k)*pplay(i, &
-          k)/(rd*temp(i,k)))/(4./3*rpi*1000.*cdnc(i,k)))**(1./3.)
+          k)/(rd*temp(i,k)))/(4./3*rpi*rhol*cdnc(i,k)))**(1./3.)
         rad_chaud(i, k) = max(rad_chaud(i,k)*1.E6, 5.)
 
+        END DO
+    ENDDO
+
+ ELSE IF (ok_cdnc .AND. iflag_cdreff .EQ. 1) THEN
+     ! similar as above but debugged
+
+    DO k = 1, klev
+      DO i = 1, klon
+
         ! --pre-industrial case
-        rad_chaud_pi(i, k) = 1.1*((radocond(i,k)*pplay(i, &
-          k)/(rd*temp(i,k)))/(4./3.*rpi*1000.*cdnc_pi(i,k)))**(1./3.)
-        rad_chaud_pi(i, k) = max(rad_chaud_pi(i,k)*1.E6, 5.)
-
-        ! --pre-industrial case
-        ! --liquid/ice cloud water paths:
-        IF (pclc(i,k)<=seuil_neb) THEN
-
-          pcldtaupi(i, k) = 0.0
-
-        ELSE
-
-          zflwp_var = 1000.*(1.-icefrac_optics(i,k))*radocond(i, k)/pclc(i, k)* &
-            rhodz(i, k)
-          zfiwp_var = 1000.*icefrac_optics(i, k)*radocond(i, k)/pclc(i, k)*rhodz(i, k)
-          ! Calculation of ice cloud effective radius in micron
-          IF (iflag_rei .EQ. 2) THEN
-            ! in-cloud ice water content in g/m3
-            iwc = icefrac_optics(i,k) * radocond(i,k) / pclc(i,k) * zrho(i,k) * 1000.
-            ! this formula is a simplified version of the Sun 2001 one (as in the IFS model,
-            ! and which is activated for iflag_rei = 1).
-            ! In particular, the term in temperature**2 has been simplified.
-            ! The new coefs are tunable, and are by default set so that the results fit well
-            ! to the Sun 2001 formula
-            ! By default, rei_coef = 2.4 and rei_min_temp = 175.
-            ! The ranges of these parameters are determined so that the RMSE between this
-            ! formula and the one from Sun 2001 is less than 4 times the minimum RMSE
-            ! The ranges are [1.9, 2.9] for rei_coef and [160., 185.] for rei_min_temp
-            dei = rei_coef * (iwc**0.2445) * ( temp(i,k) - rei_min_temp )
-            ! we clip the results
-            deimin = 20.
-            deimax = 155.
-            dei = MIN(MAX(dei, deimin), deimax)
-            ! formula to convert effective diameter in effective radius
-            rei = 3. * SQRT(3.) / 8. * dei
-          ELSEIF (iflag_rei .EQ. 1) THEN
-            ! when we account for precipitation in the radiation scheme,
-            ! It is recommended to use the rei formula from Sun and Rikkus 1999 with a revision
-            ! from Sun 2001 (as in the IFS model)
-            iwc=icefrac_optics(i, k)*radocond(i, k)/pclc(i,k)*zrho(i,k)*1000. !in cloud ice water content in g/m3
-            dei=(1.2351+0.0105*(temp(i,k)-273.15))*(45.8966*(iwc**0.2214) + &
-               & 0.7957*(iwc**0.2535)*(temp(i,k)-83.15))
-            !deimax=155.0
-            !deimin=20.+40*cos(abs(latitude_deg(i))/180.*RPI)
-            !Etienne: deimax and deimin controled by rei_max and rei_min in physiq.def
-            deimax=rei_max*2.0
-            deimin=2.0*rei_min+40*cos(abs(latitude_deg(i))/180.*RPI) 
-            dei=min(dei,deimax)
-            dei=max(dei,deimin)
-            rei=3.*sqrt(3.)/8.*dei
-           ELSE
-            ! Default
-            ! for ice clouds: as a function of the ambiant temperature
-            ! [formula used by Iacobellis and Somerville (2000), with an
-            ! asymptotical value of 3.5 microns at T<-81.4 C added to be
-            ! consistent with observations of Heymsfield et al. 1986]:
-            ! 2011/05/24 : rei_min = 3.5 becomes a free PARAMETER as well as
-            ! rei_max=61.29
-            tc = temp(i, k) - 273.15
-            rei = d_rei_dt*tc + rei_max
-            IF (tc<=-81.4) rei = rei_min
-           ENDIF
-
-          ! -- cloud optical thickness :
-          ! [for liquid clouds, traditional formula,
-          ! for ice clouds, Ebert & Curry (1992)]
-
-          IF (zfiwp_var==0. .OR. rei<=0.) rei = 1.
-          pcldtaupi(i, k) = 3.0/2.0*zflwp_var/rad_chaud_pi(i, k) + &
-            zfiwp_var*(3.448E-03+2.431/rei)
-
-        ENDIF
-
-      ENDDO
-    ENDDO
-
-  ELSE !--not ok_cdnc
-
-    ! -prescribed cloud droplet radius
-
+        rad_chaud_pi(i, k) = (xflwc(i,k)/max(pclc(i,k),seuil_neb)*pplay(i, &
+          k)/(rd*temp(i,k))/(4./3.*rpi*rhol*cdnc_pi(i,k)))**(1./3.)
+        rad_chaud_pi(i, k) = min(max(rad_chaud_pi(i,k)*1.E6, 5.),100.)
+
+        ! --present-day case
+        rad_chaud(i, k) = (xflwc(i,k)/max(pclc(i,k),seuil_neb)*pplay(i, &
+          k)/(rd*temp(i,k))/(4./3*rpi*rhol*cdnc(i,k)))**(1./3.)
+        rad_chaud(i, k) = min(max(rad_chaud(i,k)*1.E6, 5.),100.)
+
+        END DO
+    ENDDO
+
+ ELSE ! ok_cdnc
+
+    ! -fixed (prescribed) cloud droplet effective radius values
     DO k = 1, min(3, klev)
       DO i = 1, klon
@@ -404,53 +360,42 @@
       ENDDO
     ENDDO
-
-  ENDIF !--ok_cdnc
-
-  ! --computation of cloud optical depth and emissivity
-  ! --in the general case
+ 
+ ENDIF ! ok_cdnc
+
+  ! For output diagnostics of cloud droplet effective radius [um]
+  ! we multiply here with f * xl (fraction of liquid water
+  ! clouds in the grid cell) to avoid problems in the averaging of the output.
+  ! The actual cloud droplet effective radius can be computed from outputs as re/fl
 
   DO k = 1, klev
     DO i = 1, klon
 
+      reliq(i, k) = rad_chaud(i, k)
+      reliq_pi(i, k) = rad_chaud_pi(i, k)     
+
       IF (pclc(i,k)<=seuil_neb) THEN
-
-        ! effective cloud droplet radius (microns) for liquid water clouds:
-        ! For output diagnostics cloud droplet effective radius [um]
-        ! we multiply here with f * xl (fraction of liquid water
-        ! clouds in the grid cell) to avoid problems in the averaging of the
-        ! output.
-        ! In the output of IOIPSL, derive the REAL cloud droplet
-        ! effective radius as re/fl
 
         fl(i, k) = seuil_neb*(1.-icefrac_optics(i,k))
         re(i, k) = rad_chaud(i, k)*fl(i, k)
-        rel = 0.
-        rei = 0.
-        pclc(i, k) = 0.0
-        pcltau(i, k) = 0.0
-        pclemi(i, k) = 0.0
 
       ELSE
-
-        ! -- liquid/ice cloud water paths:
-
-        zflwp_var = 1000.*(1.-icefrac_optics(i,k))*radocond(i, k)/pclc(i, k)*rhodz(i, k)
-        zfiwp_var = 1000.*icefrac_optics(i, k)*radocond(i, k)/pclc(i, k)*rhodz(i, k)
-
-        ! effective cloud droplet radius (microns) for liquid water clouds:
-        ! For output diagnostics cloud droplet effective radius [um]
-        ! we multiply here with f Effective radius of cloud droplet at top of cloud (m)* xl (fraction of liquid water
-        ! clouds in the grid cell) to avoid problems in the averaging of the
-        ! output.
-        ! In the output of IOIPSL, derive the REAL cloud droplet
-        ! effective radius as re/fl
 
         fl(i, k) = pclc(i, k)*(1.-icefrac_optics(i,k))
         re(i, k) = rad_chaud(i, k)*fl(i, k)
-
-        rel = rad_chaud(i, k)
+  
+       ENDIF
+
+    END DO
+  END DO
+
+! Computation of ice crystal effective radius
+!=============================================
+
+  DO k = 1, klev
+    DO i = 1, klon
+
+      IF (pclc(i,k)>seuil_neb) THEN
 
         ! Calculation of ice cloud effective radius in micron
-
 
         IF (iflag_rei .EQ. 2) THEN
@@ -498,58 +443,85 @@
             ! 2011/05/24 : rei_min = 3.5 becomes a free PARAMETER as well as
             ! rei_max=61.29
+           
+            ! rei = ( rei_max - rei_min ) * T(°C) / 81.4 + rei_max
+            ! to be used for a temperature in celcius T(°C) < 0
+            ! rei=rei_min for T(°C) < -81.4
+            ! Computation of slope for ice crystal effective radius=f(T)
+            ! For consistency with original version, we impoe 0.71 when
+            ! close to this value
+            d_rei_dt = (rei_max-rei_min)/81.4
+            IF (abs(d_rei_dt-0.71)<1.E-4) d_rei_dt = 0.71          
+           
             tc = temp(i, k) - 273.15
             rei = d_rei_dt*tc + rei_max
             IF (tc<=-81.4) rei = rei_min
+
         ENDIF
+
+      ELSE ! pclc > rneb
+
+           rei = 0.
+
+      ENDIF
+
+      reice(i, k) = rei
+      ! same radius for pi conditions
+      reice_pi(i,k) = reice(i,k)
+
+    ENDDO
+  ENDDO
+
+ 
+
+! Computation of cloud optical depth and emissivity
+!===================================================
+
+  DO k = 1, klev
+    DO i = 1, klon
+
+      IF (pclc(i,k)<=seuil_neb) THEN
+
+        rel = 0.
+        rei = 0.
+        pcldtau(i, k) = 0.0
+        pcldtaupi(i, k) = 0.0
+        pclemi(i, k) = 0.0
+
+      ELSE
+
+        rel = rad_chaud(i, k)
+        rei = reice(i,k)
+        ! mass of in-cloud condensates in g
+        zflwp_var = 1000.*(1.-icefrac_optics(i,k))*radocond(i, k)/pclc(i, k)*rhodz(i, k)
+        zfiwp_var = 1000.*icefrac_optics(i, k)*radocond(i, k)/pclc(i, k)*rhodz(i, k)
+        IF (zflwp_var==0.) rel = 1.
+        IF (zfiwp_var==0. .OR. rei<=0.) rei = 1.
         ! -- cloud optical thickness :
         ! [for liquid clouds, traditional formula,
-        ! for ice clouds, Ebert & Curry (1992)]
-
-        IF (zflwp_var==0.) rel = 1.
-        IF (zfiwp_var==0. .OR. rei<=0.) rei = 1.
-        pcltau(i, k) = 3.0/2.0*(zflwp_var/rel) + zfiwp_var*(3.448E-03+2.431/ &
-          rei)
-
+        ! for ice clouds, Ebert & Curry (1992)]       
+        pcldtau(i, k) = 3.0/2.0*(zflwp_var/rel) & 
+                    + zfiwp_var*(3.448E-03+2.431/ rei)
+        IF (ok_cdnc) THEN
+            pcldtaupi(i, k) = 3.0/2.0*zflwp_var/rad_chaud_pi(i, k) + &
+                            zfiwp_var*(3.448E-03+2.431/rei)
+        ELSE
+        ! -- if cloud droplet radius is fixed, plcdtaupi = plcdtau
+            pcldtaupi(i, k) = pcldtau(i,k)
+        END IF
         ! -- cloud infrared emissivity:
-        ! [the broadband infrared absorption coefficient is PARAMETERized
-        ! as a function of the effective cld droplet radius]
+        ! [the broadband infrared absorption coefficient is parameterized
+        ! as a function of the effective cloud droplet radius]
         ! Ebert and Curry (1992) formula as used by Kiehl & Zender (1995):
-
         k_ice = k_ice0 + 1.0/rei
-
         pclemi(i, k) = 1.0 - exp(-coef_chau*zflwp_var-df*k_ice*zfiwp_var)
 
       ENDIF
 
-      reice(i, k) = rei
-
-      xflwp(i) = xflwp(i) + xflwc(i, k)*rhodz(i, k)
-      xfiwp(i) = xfiwp(i) + xfiwc(i, k)*rhodz(i, k)
-
     ENDDO
   ENDDO
 
-  ! --if cloud droplet radius is fixed, then pcldtaupi=pcltau
-
-  IF (.NOT. ok_cdnc) THEN
-    DO k = 1, klev
-      DO i = 1, klon
-        pcldtaupi(i, k) = pcltau(i, k)
-        reice_pi(i, k) = reice(i, k)
-      ENDDO
-    ENDDO
-  ENDIF
-
-  DO k = 1, klev
-    DO i = 1, klon
-      reliq(i, k) = rad_chaud(i, k)
-      reliq_pi(i, k) = rad_chaud_pi(i, k)
-      reice_pi(i, k) = reice(i, k)
-    ENDDO
-  ENDDO
-
-  ! COMPUTE CLOUD LIQUID PATH AND TOTAL CLOUDINESS
-  ! IM cf. CR:test: calcul prenant ou non en compte le recouvrement
-  ! initialisations
+
+! Cloud cover calculation 
+! ========================
 
   DO i = 1, klon
@@ -562,20 +534,20 @@
     pcm(i) = 1.0
     pcl(i) = 1.0
-    radocondwp(i) = 0.0
+
   ENDDO
 
-  ! --calculation of liquid water path
-
-  DO k = klev, 1, -1
-    DO i = 1, klon
-      radocondwp(i) = radocondwp(i) + radocond(i, k)*rhodz(i, k)
-    ENDDO
-  ENDDO
-
-  ! --calculation of cloud properties with cloud overlap
-  ! choix de l'hypothese de recouvrement nuageuse via radopt.h (IM, 19.07.2016)
-  ! !novlp=1: max-random
-  ! !novlp=2: maximum
-  ! !novlp=3: random
+  DO k=1, klev
+     DO i=1,klon
+       IF (pclc(i,k) <= seuil_neb) THEN
+            pclc(i,k) = 0.
+       END IF
+     END DO
+  END DO
+
+  ! Cloud overlap approximation
+  ! choix made through radopt.h
+  ! novlp=1: max-random
+  ! novlp=2: maximum
+  ! novlp=3: random
 
 
@@ -638,7 +610,6 @@
   ENDDO
 
-  ! ========================================================
-  ! DIAGNOSTICS CALCULATION FOR CMIP5 PROTOCOL
-  ! ========================================================
+  ! Diagnostics computation for CMIP protocol
+  ! =========================================
   ! change by Nicolas Yan (LSCE)
   ! Cloud Droplet Number Concentration (CDNC) : 3D variable
@@ -676,5 +647,5 @@
           ! threshold:
 
-        IF (pcltau(i,k)>thres_tau .AND. pclc(i,k)>thres_neb) THEN
+        IF (pcldtau(i,k)>thres_tau .AND. pclc(i,k)>thres_neb) THEN
 
           IF (novlp.EQ.2) THEN
@@ -720,6 +691,5 @@
     ENDDO ! loop over i
 
-    ! ! Convective and Stratiform Cloud Droplet Effective Radius (REFFCLWC
-    ! REFFCLWS)
+    ! Convective and Stratiform Cloud Droplet Effective Radius (REFFCLWC, REFFCLWS)
     DO i = 1, klon
       DO k = 1, klev
@@ -729,10 +699,8 @@
         lcc3dstra(i, k) = lcc3dstra(i, k) - lcc3dcon(i, k) ! eau liquide stratiforme
         lcc3dstra(i, k) = max(lcc3dstra(i,k), 0.0)
-        !FC pour la glace (CAUSES)
         icc3dcon(i, k) = rnebcon(i, k)*(1-phase3d(i, k))*ccwcon(i, k) !  glace convective
         icc3dstra(i, k)= pclc(i, k)*radocond(i, k)*(1-phase3d(i, k))
         icc3dstra(i, k) = icc3dstra(i, k) - icc3dcon(i, k) ! glace stratiforme
         icc3dstra(i, k) = max( icc3dstra(i, k), 0.0)
-        !FC (CAUSES)
 
         ! Compute cloud droplet radius as above in meter
@@ -776,8 +744,6 @@
         IF (lcc3dcon(i,k)<=0.0) lcc3dcon(i, k) = 0.0
         IF (lcc3dstra(i,k)<=0.0) lcc3dstra(i, k) = 0.0
-!FC (CAUSES)
         IF (icc3dcon(i,k)<=0.0) icc3dcon(i, k) = 0.0
         IF (icc3dstra(i,k)<=0.0) icc3dstra(i, k) = 0.0
-!FC (CAUSES)
       ENDDO
       IF (reffclwtop(i)<=0.0) reffclwtop(i) = 0.0
Index: /LMDZ6/trunk/libf/phylmd/lmdz_cloud_optics_prop_ini.f90
===================================================================
--- /LMDZ6/trunk/libf/phylmd/lmdz_cloud_optics_prop_ini.f90	(revision 6175)
+++ /LMDZ6/trunk/libf/phylmd/lmdz_cloud_optics_prop_ini.f90	(revision 6176)
@@ -8,4 +8,5 @@
   INTEGER, PROTECTED :: iflag_t_glace=0
   INTEGER, PROTECTED :: iflag_rei
+  INTEGER, PROTECTED :: iflag_cdreff
   INTEGER, PROTECTED :: novlp, iflag_ice_thermo
   LOGICAL, PROTECTED :: ok_cdnc
@@ -109,5 +110,6 @@
     rei_min_temp = 175.
     CALL getin_p('rei_min_temp',rei_min_temp)
-
+    iflag_cdreff = 0
+    CALL getin_p('iflag_cdreff',iflag_cdreff)
    
   END SUBROUTINE cloud_optics_prop_ini
Index: /LMDZ6/trunk/libf/phylmd/ocean_forced_mod.F90
===================================================================
--- /LMDZ6/trunk/libf/phylmd/ocean_forced_mod.F90	(revision 6175)
+++ /LMDZ6/trunk/libf/phylmd/ocean_forced_mod.F90	(revision 6176)
@@ -1015,5 +1015,5 @@
             ! ice or snow depending on snow thickness
             alb_snow = alb_snow - (alb_snow - alb_ice)*EXP(-snow(i)*z1_s)
-            ! Effect of clouds (polynomial fit with 83% clouds)
+            ! Effect of clouds (polynomial fit with 81% clouds)
             alb1_new(i) = alb_snow - 0.81*(-0.1010*alb_snow*alb_snow &
                                           + 0.1933*alb_snow - 0.0148)
