Index: trunk/LMDZ.MARS/libf/phymars/co2cloud.F90
===================================================================
--- trunk/LMDZ.MARS/libf/phymars/co2cloud.F90	(revision 2449)
+++ trunk/LMDZ.MARS/libf/phymars/co2cloud.F90	(revision 2456)
@@ -162,5 +162,4 @@
      pcondicea(ngrid,nlay),     & ! Rate of condensation/sublimation of co2 ice in layers
      pdtcloudco2(ngrid,nlay),   & ! Tendency on temperature due to latent heat
-     riceco2(ngrid,nlay),       & ! Ice mass mean radius (m) r_c in Montmessin et al. (2004)
      rsedcloudco2(ngrid,nlay)     ! Cloud sedimentation radius
 
@@ -168,4 +167,6 @@
      rdust(ngrid,nlay) ! Dust geometric mean radius (m)
 
+  double precision, intent(out) :: &
+     riceco2(ngrid,nlay)          ! Ice mass mean radius (m) r_c in Montmessin et al. (2004)
 !----------------------------------------------------------------------------------------------------------------------!
 ! Local:
@@ -265,5 +266,5 @@
 ! ---Extinction coefficients at 1 micron of CO2 particles
      vrat_cld,                      &! Volume ratio
-     n_derf,                        &! derf( (rb_cldco2(1)-dlog(riceco2(ig,l))) *dev2)
+     n_derf,                        &! derf( (rb_cldco2(1)-log(riceco2(ig,l))) *dev2)
      Qtemp,                         &! mean value in the interval during the interpolation
      ltemp1(var_dim_qext),          &! abs(radv(:)-rb_cldco2(i))
@@ -678,5 +679,5 @@
 
           ! density of co2 ice
-          call density_co2_ice(ztsed(ig,l), rho_ice_co2T(ig,l))
+          call density_co2_ice(dble(ztsed(ig,l)), rho_ice_co2T(ig,l))
 
           ! assure positive value of co2_ice mmr, ccnco2 number, ccnco2 mass
@@ -687,5 +688,5 @@
           ! Get density cloud and co2 ice particle radius
           if (Niceco2.ne.0d0) then
-            call updaterice_microco2(Niceco2, Qccnco2, Nccnco2, tauscaling(ig), riceco2(ig,l), rhocloudco2t(ig,l))
+            call updaterice_microco2(dble(Niceco2), dble(Qccnco2), dble(Nccnco2), tauscaling(ig), riceco2(ig,l), rhocloudco2t(ig,l))
           else
             riceco2(ig,l) = 0.
@@ -836,5 +837,5 @@
 
       ! Compute particle size
-      call updaterice_microco2(Niceco2, Qccnco2, Nccnco2, tauscaling(ig), riceco2(ig,l), rhocloudco2(ig,l))
+      call updaterice_microco2(dble(Niceco2), dble(Qccnco2), dble(Nccnco2), tauscaling(ig), riceco2(ig,l), rhocloudco2(ig,l))
 
      ! Compute opacities
@@ -843,5 +844,5 @@
         Qext1bins2(ig,l) = 0.
       else
-        n_derf = derf( (rb_cldco2(1)-dlog(riceco2(ig,l))) *dev2)
+        n_derf = derf( (rb_cldco2(1)-log(riceco2(ig,l))) *dev2)
         Qext1bins2(ig,l) = 0.
 
@@ -849,5 +850,5 @@
           n_aer(i) = -0.5 * Nccnco2*tauscaling(ig) * n_derf
 
-          n_derf = derf((rb_cldco2(i+1)-dlog(riceco2(ig,l))) *dev2)
+          n_derf = derf((rb_cldco2(i+1)-log(riceco2(ig,l))) *dev2)
           n_aer(i) = n_aer(i) + (0.5 * Nccnco2*tauscaling(ig) * n_derf)
 
Index: trunk/LMDZ.MARS/libf/phymars/co2condens_mod4micro.F90
===================================================================
--- trunk/LMDZ.MARS/libf/phymars/co2condens_mod4micro.F90	(revision 2449)
+++ trunk/LMDZ.MARS/libf/phymars/co2condens_mod4micro.F90	(revision 2456)
@@ -374,5 +374,10 @@
 !----------------------------------------------------------------------------------------------------------------------!
 !     Available CO2 tracer in layer 1 at end of timestep (kg/m2)
+#ifndef MESOSCALE
       availco2 = pq(ig,1,igcm_co2) * ( (ap(1)-ap(2)) + (bp(1)-bp(2)) * (pplev(ig,1)/g - zcondices(ig)*ptimestep) )
+#else
+      availco2 = pq(ig,1,igcm_co2)
+      PRINT*, "MESOSCALE: CO2 tracer AT FIRST LEVEL IS NOT CORRECTED FROM SIGMA LEVELS"
+#endif
       if ( zcondices(ig) * ptimestep>availco2 ) then
         zcondices(ig) = availco2/ptimestep
@@ -438,6 +443,6 @@
       zmflux(1) = - zcondices(ig) - zfallice(ig)
       do l = 1, nlayer
+#ifndef MESOSCALE
         zmflux(l+1) = zmflux(l) - zcondicea(ig,l) &
-#ifndef MESOSCALE
                       + (bp(l)-bp(l+1)) * (-pdpsrf(ig)/g)
 ! zmflux set to 0 if very low to avoid: top layer is disappearing in v1ld
@@ -446,7 +451,9 @@
         end if
 #else
+        zmflux(l+1) = zmflux(l) - zcondicea(ig,l)
         if (abs(zmflux(l+1))<1E-13) then
           zmflux(l+1) = 0.
         end if
+        PRINT*, "MESOSCALE: FLUX THROUGH SIGMA LEVELS from dPS HAVE TO BE IMPLEMENTED"
 #endif
       end do
@@ -455,5 +462,10 @@
 !----------------------------------------------------------------------------------------------------------------------!
       do l = 1, nlayer
+#ifndef MESOSCALE
         masse(l) = (pplev(ig,l) - pplev(ig,l+1) + (bp(l)-bp(l+1))*pdpsrf(ig)*ptimestep)/g
+#else
+        masse(l) = (pplev(ig,l) - pplev(ig,l+1))/g
+        PRINT*, "MESOSCALE: MASS OF EACH LAYER IS NOT CORRECTED AT END OF TIMESTEP (from SIGMA LEVELS and dPS)"
+#endif
       end do
 !----------------------------------------------------------------------------------------------------------------------!
Index: trunk/LMDZ.MARS/libf/phymars/improvedco2clouds_mod.F90
===================================================================
--- trunk/LMDZ.MARS/libf/phymars/improvedco2clouds_mod.F90	(revision 2449)
+++ trunk/LMDZ.MARS/libf/phymars/improvedco2clouds_mod.F90	(revision 2456)
@@ -214,6 +214,6 @@
     riceco2(ngrid,nlay),               &! CO2 ice mean radius (m)
     vrat_cld,                          &! Volume ratio
-    Proba,                             &! 1.0 - dexp(-1.*microtimestep*rate(i))
-    Probah2o,                          &! 1.0 - dexp(-1.*microtimestep*rateh2o(i))
+    Proba,                             &! 1.0 - exp(-1.*microtimestep*rate(i))
+    Probah2o,                          &! 1.0 - exp(-1.*microtimestep*rateh2o(i))
     mtemp(nbinco2_cld),                &! sum(meteor(lebon1:lebon2,ibin))
     pression_meteor(nlev_meteor),      &! pressure from meteoritic flux input file
@@ -338,5 +338,5 @@
 
       !T-dependant CO2 ice density
-      call density_co2_ice(zt(ig,l), rho_ice_co2T(ig,l))
+      call density_co2_ice(dble(zt(ig,l)), rho_ice_co2T(ig,l))
 
       vo2co2 = m0co2 / dble(rho_ice_co2T(ig,l))
@@ -355,8 +355,8 @@
         No = zq(ig,l,igcm_dust_number) * tauscaling(ig)
 
-        Mo = (4./3.) * pi * rho_dust * No * rdust(ig,l)**3 *dexp(9.*nuiceco2_ref/2.)
+        Mo = (4./3.) * pi * rho_dust * No * rdust(ig,l)**3 *exp(9.*nuiceco2_ref/2.)
 
         if (No > threshold) then
-          Rn = -dlog(rdust(ig,l))
+          Rn = -log(rdust(ig,l))
 
           Rm = Rn - 3. * sigma_iceco2 * sigma_iceco2
@@ -398,5 +398,5 @@
             No = zq(ig,l,igcm_ccn_number) * tauscaling(ig) + threshold
 
-            Rn = -dlog(rice(ig,l))
+            Rn = -log(rice(ig,l))
 
             Rm = Rn - 3. * sigma_ice * sigma_ice
@@ -427,5 +427,5 @@
 
           do i = 1, nbinco2_cld
-            Proba = 1.0 - dexp(-1.*microtimestep*rate(i))
+            Proba = 1.0 - exp(-1.*microtimestep*rate(i))
             dN = dN + n_aer(i) * Proba
             dM = dM + m_aer(i) * Proba
@@ -434,5 +434,5 @@
           if (co2useh2o) then
             do i = 1, nbinco2_cld
-              Probah2o = 1.0 - dexp(-1.*microtimestep*rateh2o(i))
+              Probah2o = 1.0 - exp(-1.*microtimestep*rateh2o(i))
               dNh2o = dNh2o + n_aer_h2oice(i) * Probah2o
               dMh2o = dMh2o + m_aer_h2oice(i) * Probah2o
@@ -492,5 +492,5 @@
       if (zq(ig,l,igcm_ccnco2_number) * tauscaling(ig) + threshold >= 1) then
 
-        call updaterice_microco2(zq(ig,l,igcm_co2_ice), zq(ig,l,igcm_ccnco2_mass), zq(ig,l,igcm_ccnco2_number), &
+        call updaterice_microco2(dble(zq(ig,l,igcm_co2_ice)), dble(zq(ig,l,igcm_ccnco2_mass)), dble(zq(ig,l,igcm_ccnco2_number)), &
                                  tauscaling(ig), riceco2(ig,l), rhocloudco2(ig,l))
 
Index: trunk/LMDZ.MARS/libf/phymars/nuclea.F
===================================================================
--- trunk/LMDZ.MARS/libf/phymars/nuclea.F	(revision 2449)
+++ trunk/LMDZ.MARS/libf/phymars/nuclea.F	(revision 2456)
@@ -87,5 +87,5 @@
 
         nh2o   = ph2o / kbz / temp
-        rstar  = 2. * sig(temp) * vo1 / (rgp*temp*dlog(sat))
+        rstar  = 2. * sig(temp) * vo1 / (rgp*temp*log(sat))
         gstar  = 4. * nav * pi * (rstar * rstar * rstar) / (3.*vo1)
         
@@ -124,5 +124,5 @@
      &                  * ( nh2o*rad_cld(i) )
      &                  / ( zefshape * nus * m0 )
-     &                  * dexp (deltaf))
+     &                  * exp (deltaf))
           endif
 
Index: trunk/LMDZ.MARS/libf/phymars/nucleaco2.F
===================================================================
--- trunk/LMDZ.MARS/libf/phymars/nucleaco2.F	(revision 2449)
+++ trunk/LMDZ.MARS/libf/phymars/nucleaco2.F	(revision 2456)
@@ -58,5 +58,5 @@
 
         nco2   = pco2 / kbz / temp
-        rstar  = 2. * sigco2 * vo2co2 / (kbz*temp*dlog(sat))
+        rstar  = 2. * sigco2 * vo2co2 / (kbz*temp*log(sat))
         gstar  = 4. * pi * (rstar * rstar * rstar) / (3.*vo2co2)
         
@@ -97,5 +97,5 @@
      &                  * ( nco2*rad_cldco2(i) )
      &                  / ( zefshapeco2 * nusco2 * m0co2 )
-     &                  * dexp (deltaf))
+     &                  * exp (deltaf))
 
             
@@ -133,5 +133,5 @@
      &                  * ( nco2*rad_h2oice(i) )
      &                  / ( zefshapeco2 * nusco2 * m0co2 )
-     &                  * dexp (deltaf))
+     &                  * exp (deltaf))
               endif
             endif
Index: trunk/LMDZ.MARS/libf/phymars/tcondco2.F90
===================================================================
--- trunk/LMDZ.MARS/libf/phymars/tcondco2.F90	(revision 2449)
+++ trunk/LMDZ.MARS/libf/phymars/tcondco2.F90	(revision 2456)
@@ -17,5 +17,5 @@
 integer:: ig,l
 
-A=dlog(1.382d12)
+A=log(1.382d12)
 B=-3182.48
 qco2=0.
@@ -23,5 +23,5 @@
    DO ig=1,ngrid
       pco2 = q(ig,l) * (mmean(ig,l)/44.01) * p(ig,l)
-      tcond(ig,l)=B/(dlog(pco2)-A)
+      tcond(ig,l)=B/(log(pco2)-A)
     enddo
 enddo
