Index: trunk/LMDZ.GENERIC/libf/phystd/optcv.F90
===================================================================
--- trunk/LMDZ.GENERIC/libf/phystd/optcv.F90	(revision 1984)
+++ trunk/LMDZ.GENERIC/libf/phystd/optcv.F90	(revision 1987)
@@ -128,7 +128,13 @@
 
   ! Spectral dependance of aerosol absorption
+            !JL18 It seems to be good to have aerosols in the first "radiative layer" of the gcm in the IR
+	    !   but visible does not handle very well diffusion in first layer.
+	    !   The tauaero and tauray are thus set to 0 (a small value for rayleigh because the code crashes otherwise)
+	    !   in the 4 first semilayers in optcv, but not optci.
+	    !   This solves random variations of the sw heating at the model top. 
   do iaer=1,naerkind
      do NW=1,L_NSPECTV
-        do K=2,L_LEVELS
+        TAEROS(1:4,NW,IAER)=0.d0
+        do K=5,L_LEVELS
            TAEROS(K,NW,IAER) = TAUAERO(K,IAER) * QXVAER(K,NW,IAER)
         end do                    ! levels
@@ -138,5 +144,6 @@
   ! Rayleigh scattering
   do NW=1,L_NSPECTV
-     do K=2,L_LEVELS
+     TRAY(1:4,NW)   = 1d-30
+     do K=5,L_LEVELS
         TRAY(K,NW)   = TAURAY(NW) * DPR(K)
      end do                    ! levels
@@ -289,7 +296,12 @@
   !     we need to calculate the scattering albedo and asymmetry factors
 
+            !JL18 It seems to be good to have aerosols in the first "radiative layer" of the gcm in the IR
+	    !   but not in the visible
+	    !   The tauaero is thus set to 0 in the 4 first semilayers in optcv, but not optci.
+	    !   This solves random variations of the sw heating at the model top. 
   do iaer=1,naerkind
     DO NW=1,L_NSPECTV
-      DO K=2,L_LEVELS
+      TAUAEROLK(1:4,NW,IAER)=0.d0
+      DO K=5,L_LEVELS
            TAUAEROLK(K,NW,IAER) = TAUAERO(K,IAER) * QSVAER(K,NW,IAER) ! effect of scattering albedo
       ENDDO
@@ -344,13 +356,12 @@
   DO NG=1,L_NGAUSS       ! full gauss loop
      DO NW=1,L_NSPECTV       
-        TAUV(1,NW,NG)=0.0D0
-        DO L=1,L_NLAYRAD
-           TAUV(L+1,NW,NG)=TAUV(L,NW,NG)+DTAUV(L,NW,NG)
-        END DO
-
         TAUCUMV(1,NW,NG)=0.0D0
         DO K=2,L_LEVELS
            TAUCUMV(K,NW,NG)=TAUCUMV(K-1,NW,NG)+DTAUKV(K,NW,NG)
         END DO
+
+        DO L=1,L_NLAYRAD+1
+           TAUV(L,NW,NG)=TAUCUMV(2*L,NW,NG)
+        END DO
      END DO            
   END DO                 ! end full gauss loop
