Index: trunk/LMDZ.GENERIC/README
===================================================================
--- trunk/LMDZ.GENERIC/README	(revision 1484)
+++ trunk/LMDZ.GENERIC/README	(revision 1485)
@@ -1093,6 +1093,9 @@
 
 == 14/10/2015 == MT
-- Cleanup of callcorrk.F90
+- Cleanup of callcorrk.F90.
 
 == 15/10/2015 == MT
 - Harmonization of the calculation of the surface tracer tendencies in physiq.F90.
+
+== 22/10/2015 == MT
+- Cleaning of condense_co2.F90.
Index: trunk/LMDZ.GENERIC/libf/phystd/condense_co2.F90
===================================================================
--- trunk/LMDZ.GENERIC/libf/phystd/condense_co2.F90	(revision 1484)
+++ trunk/LMDZ.GENERIC/libf/phystd/condense_co2.F90	(revision 1485)
@@ -1,9 +1,8 @@
       subroutine condense_co2(ngrid,nlayer,nq,ptimestep, &
           pcapcal,pplay,pplev,ptsrf,pt,                  &
-          pphi,pdt,pdu,pdv,pdtsrf,pu,pv,pq,pdq,          &
-          piceco2,pdqsurfc,albedo,pemisurf,              &
+          pdt,pdtsrf,pq,pdq,                             &
+          pqsurf,pdqsurfc,albedo,pemisurf,               &
           albedo_bareground,albedo_co2_ice_SPECTV,       &
-          pdtc,pdtsrfc,pdpsrf,pduc,pdvc,                 &
-          pdqc)
+          pdtc,pdtsrfc,pdpsrfc,pdqc)
 
       use radinc_h, only : L_NSPECTV, naerkind
@@ -21,31 +20,39 @@
 !     Purpose
 !     -------
-!     Condense and/or sublime CO2 ice on the ground and in the
-!     atmosphere, and sediment the ice.
+!     Condense and/or sublime CO2 ice on the ground and in the atmosphere, and sediment the ice.
 !  
 !     Inputs
 !     ------
-!     ngrid                 Number of vertical columns
-!     nlayer                Number of layers
-!     pplay(ngrid,nlayer)   Pressure layers
-!     pplev(ngrid,nlayer+1) Pressure levels 
-!     pt(ngrid,nlayer)      Temperature (in K)
-!     ptsrf(ngrid)          Surface temperature
+!     ngrid                 Number of vertical columns.
+!     nlayer                Number of vertical layers.
+!     nq                    Number of tracers.
+!     ptimestep             Duration of the physical timestep (s).
+!     pplay(ngrid,nlayer)   Pressure layers (Pa).
+!     pplev(ngrid,nlayer+1) Pressure levels (Pa).
+!     pt(ngrid,nlayer)      Atmospheric Temperatures (K).
+!     ptsrf(ngrid)          Surface temperatures (K).
+!     pq(ngrid,nlayer,nq)   Atmospheric tracers mixing ratios (kg/kg of air).
+!     pqsurf(ngrid,nq)      Surface tracers (kg/m2).
 !     
-!     pdt(ngrid,nlayer)     Time derivative before condensation/sublimation of pt
-!     pdtsrf(ngrid)         Time derivative before condensation/sublimation of ptsrf
-!     pqsurf(ngrid,nq)      Sedimentation flux at the surface (kg.m-2.s-1)
+!     pdt(ngrid,nlayer)     Time derivative before condensation/sublimation of pt.
+!     pdtsrf(ngrid)         Time derivative before condensation/sublimation of ptsrf.
+!     pdq(ngrid,nlayer,nq)  Time derivative before condensation/sublimation of
+!
+!     albedo_bareground(ngrid)           Albedo of the bare ground.
+!     albedo_co2_ice_SPECTV(L_NSPECTV)   Spectral albedo of CO2 ice.
 !     
 !     Outputs
 !     -------
-!     pdpsrf(ngrid)       \  Contribution of condensation/sublimation
-!     pdtc(ngrid,nlayer)  /  to the time derivatives of Ps, pt, and ptsrf
-!     pdtsrfc(ngrid)     /
+!     pdpsrfc(ngrid)          \       Contribution of condensation/sublimation 
+!     pdtc(ngrid,nlayer)       \            to the time derivatives of 
+!     pdtsrfc(ngrid)           /     Surface Pressure, Atmospheric Temperatures,
+!     pdqsurfc(ngrid)         /         Surface Temperatures, Surface Tracers,
+!     pdqc(ngrid,nlayer,nq)  /                and Atmospheric Tracers.*
+!
+!     pemisurf(ngrid)              Emissivity of the surface.
 !     
 !     Both
 !     ----
-!     piceco2(ngrid)               CO2 ice at the surface (kg/m2)
-!     albedo(ngrid,L_NSPECTV)      Spectral albedo at the surface
-!     pemisurf(ngrid)              Emissivity of the surface
+!     albedo(ngrid,L_NSPECTV)      Spectral albedo of the surface.
 !
 !     Authors
@@ -57,6 +64,8 @@
 !==================================================================
 
-!-----------------------------------------------------------------------
-!     Arguments
+!--------------------------
+!        Arguments
+!--------------------------
+
 
       INTEGER,INTENT(IN) :: ngrid
@@ -69,95 +78,70 @@
       REAL,INTENT(IN) :: ptsrf(ngrid)
       REAL,INTENT(IN) :: pt(ngrid,nlayer)
-      REAL,INTENT(IN) :: pphi(ngrid,nlayer)
       REAL,INTENT(IN) :: pdt(ngrid,nlayer)
-      REAL,INTENT(IN) :: pdu(ngrid,nlayer)
-      REAL,INTENT(IN) :: pdv(ngrid,nlayer)
       REAL,INTENT(IN) :: pdtsrf(ngrid)
-      REAL,INTENT(IN) :: pu(ngrid,nlayer)
-      REAL,INTENT(IN) :: pv(ngrid,nlayer)
       REAL,INTENT(IN) :: pq(ngrid,nlayer,nq)
+      REAL,INTENT(IN) :: pqsurf(ngrid,nq)
       REAL,INTENT(IN) :: pdq(ngrid,nlayer,nq)
       REAL,INTENT(IN) :: albedo_bareground(ngrid)
       REAL,INTENT(IN) :: albedo_co2_ice_SPECTV(L_NSPECTV)
-      REAL,INTENT(INOUT) :: piceco2(ngrid)
-      REAL,INTENT(OUT) :: albedo(ngrid,L_NSPECTV)
+      REAL,INTENT(INOUT) :: albedo(ngrid,L_NSPECTV)
       REAL,INTENT(OUT) :: pemisurf(ngrid)
       REAL,INTENT(OUT) :: pdtc(ngrid,nlayer)
       REAL,INTENT(OUT) :: pdtsrfc(ngrid)
-      REAL,INTENT(OUT) :: pdpsrf(ngrid)
-      REAL,INTENT(OUT) :: pduc(ngrid,nlayer)
-      REAL,INTENT(OUT) :: pdvc(ngrid,nlayer)
+      REAL,INTENT(OUT) :: pdpsrfc(ngrid)
       REAL,INTENT(OUT) :: pdqc(ngrid,nlayer,nq)
       REAL,INTENT(OUT) :: pdqsurfc(ngrid)
 
-!-----------------------------------------------------------------------
-!     Local variables
-
-      INTEGER l,ig,icap,ilay,it,iq,nw
-
-      REAL reffrad(ngrid,nlayer) ! radius (m) of the co2 ice particles
-      REAL*8 zt(ngrid,nlayer)
-      REAL zq(ngrid,nlayer,nq)
-      REAL zcpi
-      REAL ztcond (ngrid,nlayer)
-      REAL ztnuc (ngrid,nlayer)
-      REAL ztcondsol(ngrid) 
-      REAL zcondicea(ngrid,nlayer), zcondices(ngrid)
-      REAL zfallice(ngrid), Mfallice(ngrid) 
-      REAL zmflux(nlayer+1)
-      REAL zu(nlayer),zv(nlayer)
-      REAL ztsrf(ngrid)
-      REAL ztc(nlayer), ztm(nlayer+1) 
-      REAL zum(nlayer+1) , zvm(nlayer+1)
-      LOGICAL condsub(ngrid)
-      REAL subptimestep
-      Integer Ntime
-      real masse (ngrid,nlayer), w(ngrid,nlayer,nq)
-      real wq(ngrid,nlayer+1)
-      real vstokes,reff
-
-!     Special diagnostic variables
-      real tconda1(ngrid,nlayer)
-      real tconda2(ngrid,nlayer)
-      real zdtsig (ngrid,nlayer)
-      real zdt (ngrid,nlayer)
-
-!-----------------------------------------------------------------------
-!     Saved local variables
+!------------------------------
+!       Local variables
+!------------------------------
+
+      INTEGER l,ig,icap,ilay,iq,nw,igas,it
+
+      REAL reffrad(ngrid,nlayer) ! Radius (m) of the CO2 ice particles.
+      REAL*8 zt(ngrid,nlayer)    ! Updated Atmospheric Temperatures (K).
+      REAL ztsrf(ngrid)          ! Updated Surface Temperatures (K).
+      REAL zq(ngrid,nlayer,nq)   ! Updated Atmospheric tracers mixing ratios (kg/kg of air).
+      REAL piceco2(ngrid)        ! Updated Surface Tracer (kg/m2).
+      REAL ztcond (ngrid,nlayer) ! Atmospheric Temperatures of condensation of CO2.
+      REAL ztnuc (ngrid,nlayer)  ! Atmospheric Nucleation Temperatures.
+      REAL ztcondsol(ngrid)      ! Temperatures of condensation of CO2 at the surface.
+      REAL zcondices(ngrid)      ! Condensation rate on the ground (kg/m2/s).
+      REAL zfallice(ngrid)       ! Flux of ice falling on the surface (kg/m2/s).
+      REAL Mfallice(ngrid)       ! Total amount of ice fallen to the ground during the timestep (kg/m2).
+      REAL wq(ngrid,nlayer+1)    ! Total amount of ice fallen to the ground during the timestep (kg/m2).
+      REAL subptimestep          ! Duration of the subtimestep (s) for the sedimentation.
+      Integer Ntime              ! Number of subtimesteps.
+      REAL masse (ngrid,nlayer)  ! Mass of atmospheric layers (kg/m2)
+      REAL w(ngrid,nlayer,nq)    !
+      REAL vstokes,reff          !
+      REAL ppco2                 !
+
+
+!------------------------------------------
+!         Saved local variables
+!------------------------------------------
+
 
       REAL,SAVE :: latcond=5.9e5
       REAL,SAVE :: ccond
-      REAL,SAVE :: cpice=1000.
       REAL,SAVE,ALLOCATABLE,DIMENSION(:) :: emisref
-!$OMP THREADPRIVATE(latcond,ccond,cpice,emisref)
-
+!$OMP THREADPRIVATE(latcond,ccond,emisref)
       LOGICAL,SAVE :: firstcall=.true.
 !$OMP THREADPRIVATE(firstcall)
-      REAL,EXTERNAL :: SSUM
-
-      REAL,EXTERNAL :: CBRT
-
       INTEGER,SAVE :: i_co2ice=0      ! co2 ice
 !$OMP THREADPRIVATE(i_co2ice)
       CHARACTER(LEN=20) :: tracername ! to temporarily store text
 
-      integer igas
-
-      real ppco2
-
-!-----------------------------------------------------------------------
-!     Initializations
-
-      pdqc(1:ngrid,1:nlayer,1:nq)=0
-      pdtc(1:ngrid,1:nlayer)=0
-      zq(1:ngrid,1:nlayer,1:nq)=0
-      zt(1:ngrid,1:nlayer)=0
-
-!     Initialisation
+
+!------------------------------------------------
+!       Initialization at the first call
+!------------------------------------------------
+
+
       IF (firstcall) THEN
 
-         ALLOCATE(emisref(ngrid)) !! this should be deallocated in lastcall...
-
-         ! find CO2 ice tracer
+         ALLOCATE(emisref(ngrid))
+         ! Find CO2 ice tracer.
          do iq=1,nq
             tracername=noms(iq)
@@ -167,67 +151,53 @@
          enddo
          
-        write(*,*) "condense_co2: i_co2ice=",i_co2ice       
-
-        if((i_co2ice.lt.1))then
-           print*,'In condens_cloud but no CO2 ice tracer, exiting.'
-           print*,'Still need generalisation to arbitrary species!'
-           stop
-        endif
+         write(*,*) "condense_co2: i_co2ice=",i_co2ice       
+
+         if((i_co2ice.lt.1))then
+            print*,'In condens_cloud but no CO2 ice tracer, exiting.'
+            print*,'Still need generalisation to arbitrary species!'
+            stop
+         endif
 
          ccond=cpp/(g*latcond)
          print*,'In condens_cloud: ccond=',ccond,' latcond=',latcond
 
-!          Prepare special treatment if gas is not pure CO2
-             !if (addn2) then
-             !   m_co2   = 44.01E-3 ! CO2 molecular mass (kg/mol)   
-             !   m_noco2 = 28.02E-3 ! N2 molecular mass (kg/mol)  
-!               Compute A and B coefficient use to compute
-!               mean molecular mass Mair defined by
-!               1/Mair = q(ico2)/m_co2 + (1-q(ico2))/m_noco2
-!               1/Mair = A*q(ico2) + B
-             !   A = (1/m_co2 - 1/m_noco2)
-             !   B = 1/m_noco2
-             !endif
-
-!          Minimum CO2 mixing ratio below which mixing occurs with layer above: 
-           !qco2min =0.75  
+         ! Prepare special treatment if gas is not pure CO2
+         ! if (addn2) then
+         !    m_co2   = 44.01E-3 ! CO2 molecular mass (kg/mol)   
+         !    m_noco2 = 28.02E-3 ! N2 molecular mass (kg/mol)  
+         ! Compute A and B coefficient use to compute
+         ! mean molecular mass Mair defined by
+         ! 1/Mair = q(ico2)/m_co2 + (1-q(ico2))/m_noco2
+         ! 1/Mair = A*q(ico2) + B
+         ! A = (1/m_co2 - 1/m_noco2)
+         ! B = 1/m_noco2
+         ! endif
+
+         ! Minimum CO2 mixing ratio below which mixing occurs with layer above : qco2min =0.75  
 
            firstcall=.false.
       ENDIF
-      zcpi=1./cpp
-
-!-----------------------------------------------------------------------
-!     Calculation of CO2 condensation / sublimation 
-!
-!     Variables used:
-!     piceco2(ngrid)       amount of co2 ice on the ground  (kg/m2)
-!     zcondicea(ngrid,l)   condensation rate in layer l     (kg/m2/s)
-!     zcondices(ngrid)     condensation rate on the ground  (kg/m2/s)
-!     zfallice(ngrid)      flux of ice falling on surface   (kg/m2/s)
-!     pdtc(ngrid,nlayer) dT/dt due to phase changes       (K/s)
-     
-
-!     Tendencies initially set to 0 (except pdtc)
-      DO l=1,nlayer
-         DO ig=1,ngrid
-            zcondicea(ig,l) = 0.
-            pduc(ig,l)  = 0
-            pdvc(ig,l)  = 0
-            pdqc(ig,l,i_co2ice)  = 0
-         END DO
-      END DO
-      
-      DO ig=1,ngrid
-         Mfallice(ig) = 0.
-         zfallice(ig) = 0.
-         zcondices(ig) = 0.
-         pdtsrfc(ig) = 0.
-         pdpsrf(ig) = 0.
-         condsub(ig) = .false.
-         pdqsurfc(ig) = 0.
-      ENDDO
-
-!-----------------------------------------------------------------------
+
+
+!------------------------------------------------
+!        Tendencies initially set to 0
+!------------------------------------------------
+
+
+      pdqc(1:ngrid,1:nlayer,1:nq)     = 0.
+      pdtc(1:ngrid,1:nlayer)          = 0.
+      zq(1:ngrid,1:nlayer,1:nq)       = 0.
+      zt(1:ngrid,1:nlayer)            = 0.
+      Mfallice(1:ngrid)               = 0.      
+      zfallice(1:ngrid)               = 0.
+      zcondices(1:ngrid)              = 0.
+      pdtsrfc(1:ngrid)                = 0.
+      pdpsrfc(1:ngrid)                = 0.
+      pdqsurfc(1:ngrid)               = 0.
+
+
+!----------------------------------
 !     Atmospheric condensation
+!----------------------------------
 
 
@@ -238,5 +208,5 @@
 !            DO ig=1,ngrid
 !              qco2=pq(ig,l,ico2)+pdq(ig,l,ico2)*ptimestep
-!!             Mean air molecular mass = 1/(q(ico2)/m_co2 + (1-q(ico2))/m_noco2)
+!              Mean air molecular mass = 1/(q(ico2)/m_co2 + (1-q(ico2))/m_noco2)
 !              mmean=1/(A*qco2 +B)
 !              vmr_co2(ig,l) = qco2*mmean/m_co2 
@@ -251,5 +221,6 @@
 !      end if
 
-!     Forecast the atmospheric frost temperature 'ztcond' and nucleation temperature 'ztnuc'
+
+      ! Forecast the atmospheric frost temperature 'ztcond' and nucleation temperature 'ztnuc'.
       DO l=1,nlayer
          DO ig=1,ngrid
@@ -260,7 +231,8 @@
       ENDDO
       
-!     Initialize zq and zt at the beginning of the sub-timestep loop
-      DO l=1,nlayer
-         DO ig=1,ngrid
+      ! Initialize zq and zt at the beginning of the sub-timestep loop and qsurf.
+      DO ig=1,ngrid
+         piceco2(ig)=pqsurf(ig,i_co2ice)
+         DO l=1,nlayer
             zt(ig,l)=pt(ig,l)
             zq(ig,l,i_co2ice)=pq(ig,l,i_co2ice)
@@ -274,5 +246,5 @@
       ENDDO
 
-!     Calculate the mass of each atmospheric layer (kg.m-2)
+      ! Calculate the mass of each atmospheric layer (kg.m-2)
       do  ilay=1,nlayer
          DO ig=1,ngrid
@@ -281,13 +253,15 @@
       end do
 
-!     -----------------------------------------------
+
+!-----------------------------------------------------------
 !     START CONDENSATION/SEDIMENTATION SUB-TIME LOOP
-!     -----------------------------------------------
-      Ntime =  20               ! number of sub-timestep 
+!-----------------------------------------------------------
+
+
+      Ntime =  20  ! number of sub-timestep 
       subptimestep = ptimestep/float(Ntime)           
 
+      ! Add the tendencies from other physical processes at each subtimstep.
       DO it=1,Ntime
-
-!     Add the tendencies from other physical processes at each subtimstep
          DO l=1,nlayer
             DO ig=1,ngrid
@@ -297,11 +271,10 @@
          END DO
 
-
-!     Gravitational sedimentation
+         ! Gravitational sedimentation starts.
             
-!     sedimentation computed from radius computed from q in module radii_mod
+         ! Sedimentation computed from radius computed from q in module radii_mod.
 	 call co2_reffrad(ngrid,nlayer,nq,zq,reffrad)
 	 
-         do  ilay=1,nlayer
+         DO  ilay=1,nlayer
             DO ig=1,ngrid
 
@@ -316,24 +289,22 @@
                    pplev(ig,ilay)/(r*pt(ig,ilay))
 
-            end do
-         end do
-
-!     Computing q after sedimentation
-
+            END DO
+         END DO
+
+         ! Computing q after sedimentation
          call vlz_fi(ngrid,nlayer,zq(1,1,i_co2ice),2.,masse,w(1,1,i_co2ice),wq)
 
 
-!     Progressively accumulating the flux to the ground
-!     Mfallice is the total amount of ice fallen to the ground
+         ! Progressively accumulating the flux to the ground.
+         ! Mfallice is the total amount of ice fallen to the ground.
          DO ig=1,ngrid
             Mfallice(ig) =  Mfallice(ig) + wq(ig,i_co2ice)
-         end do
-
-
-!     Condensation / sublimation in the atmosphere
-!     --------------------------------------------
-!     (calculation of zcondicea, zfallice and pdtc)
-!     (MODIFICATIONS FOR EARLY MARS: falling heat neglected, condensation
-!     of CO2 into tracer i_co2ice)
+         END DO
+
+!----------------------------------------------------------
+!       Condensation / sublimation in the atmosphere
+!----------------------------------------------------------
+!     (MODIFICATIONS FOR EARLY MARS: falling heat neglected, condensation of CO2 into tracer i_co2ice)
+
 
          DO l=nlayer , 1, -1
@@ -341,12 +312,10 @@
                pdtc(ig,l)=0.
 
-
-   !     ztcond-> ztnuc in test beneath to nucleate only when super saturation occurs(JL 2011)
+               ! ztcond-> ztnuc in test beneath to nucleate only when super saturation occurs(JL 2011)
                IF ((zt(ig,l).LT.ztnuc(ig,l)).or.(zq(ig,l,i_co2ice).gt.1.E-10)) THEN 
-                  condsub(ig)=.true.
                   pdtc(ig,l)   = (ztcond(ig,l) - zt(ig,l))/subptimestep
                   pdqc(ig,l,i_co2ice) = pdtc(ig,l)*ccond*g
 
-!     Case when the ice from above sublimes entirely
+                  ! Case when the ice from above sublimes entirely
                   IF ((zq(ig,l,i_co2ice).lt.-pdqc(ig,l,i_co2ice)*subptimestep) &
                       .AND. (zq(ig,l,i_co2ice).gt.0)) THEN
@@ -357,5 +326,5 @@
                   END IF
 
-!     Temperature and q after condensation
+                  ! Temperature and q after condensation
                   zt(ig,l)   = zt(ig,l)   + pdtc(ig,l)   * subptimestep
                   zq(ig,l,i_co2ice) = zq(ig,l,i_co2ice) + pdqc(ig,l,i_co2ice) * subptimestep
@@ -364,7 +333,8 @@
             ENDDO
          ENDDO
-      ENDDO                     ! end of subtimestep loop
-
-!     Computing global tendencies after the subtimestep
+         
+      ENDDO! end of subtimestep loop.
+
+      ! Computing global tendencies after the subtimestep.
       DO l=1,nlayer
          DO ig=1,ngrid
@@ -381,8 +351,9 @@
 
 !-----------------------------------------------------------------------
-!     Condensation/sublimation on the ground
-!     (calculation of zcondices and pdtsrfc)
-
-!     forecast of ground temperature ztsrf and frost temperature ztcondsol
+!              Condensation/sublimation on the ground
+!-----------------------------------------------------------------------
+
+
+      ! Forecast of ground temperature ztsrf and frost temperature ztcondsol.
       DO ig=1,ngrid
          ppco2=gfrac(igas_CO2)*pplay(ig,1)
@@ -406,4 +377,5 @@
      
       DO ig=1,ngrid
+      
          IF(ig.GT.ngrid/2+1) THEN
             icap=2
@@ -412,18 +384,18 @@
          ENDIF
 
-!     Loop over where we have condensation / sublimation
+         ! Loop over where we have condensation / sublimation
          IF ((ztsrf(ig) .LT. ztcondsol(ig)) .OR.           &        ! ground condensation
                     (zfallice(ig).NE.0.) .OR.              &        ! falling snow
                     ((ztsrf(ig) .GT. ztcondsol(ig)) .AND.  &        ! ground sublimation
                     ((piceco2(ig)+zfallice(ig)*ptimestep) .NE. 0.))) THEN
-            condsub(ig) = .true.
-
-!     Condensation or partial sublimation of CO2 ice
+
+
+            ! Condensation or partial sublimation of CO2 ice
             zcondices(ig)=pcapcal(ig)*(ztcondsol(ig)-ztsrf(ig)) &
                 /(latcond*ptimestep)         
             pdtsrfc(ig) = (ztcondsol(ig) - ztsrf(ig))/ptimestep
 
-!     If the entire CO_2 ice layer sublimes
-!     (including what has just condensed in the atmosphere)
+            ! If the entire CO_2 ice layer sublimes
+            ! (including what has just condensed in the atmosphere)
             IF((piceco2(ig)/ptimestep+zfallice(ig)).LE. &
                 -zcondices(ig))THEN
@@ -433,24 +405,29 @@
             END IF
 
-!     Changing CO2 ice amount and pressure
-
-            pdqsurfc(ig) = zcondices(ig) + zfallice(ig)
-            piceco2(ig)  = piceco2(ig) + pdqsurfc(ig)*ptimestep
-            pdpsrf(ig)   = -pdqsurfc(ig)*g
-
-            IF(ABS(pdpsrf(ig)*ptimestep).GT.pplev(ig,1)) THEN
+            ! Changing CO2 ice amount and pressure
+            piceco2(ig)  =  piceco2(ig)   + pdqsurfc(ig)*ptimestep
+            pdqsurfc(ig) =  zcondices(ig) + zfallice(ig)
+            pdpsrfc(ig)  = -pdqsurfc(ig)*g
+
+            IF(ABS(pdpsrfc(ig)*ptimestep).GT.pplev(ig,1)) THEN
                PRINT*,'STOP in condens'
                PRINT*,'condensing more than total mass'
                PRINT*,'Grid point ',ig
                PRINT*,'Ps = ',pplev(ig,1)
-               PRINT*,'d Ps = ',pdpsrf(ig)
+               PRINT*,'d Ps = ',pdpsrfc(ig)
                STOP
             ENDIF
          END IF
-      ENDDO
-
+         
+      ENDDO ! end of ngrid loop.
+
+
+!---------------------------------------------------------------------------------------------
 !     Surface albedo and emissivity of the ground below the snow (emisref)
-!     --------------------------------------------------------------------
+!---------------------------------------------------------------------------------------------
+
+
       DO ig=1,ngrid
+      
          IF(lati(ig).LT.0.) THEN
             icap=2 ! Southern Hemisphere
@@ -477,19 +454,23 @@
          end if
          
-         piceco2(ig)  = piceco2(ig) - pdqsurfc(ig)*ptimestep ! This line was added so that tendencies are added outside the routine. MT2015.
-         if(.not.piceco2(ig).ge.0.) THEN
-            if(piceco2(ig).le.-1.e-8) print*,   &
-              'WARNING 2 : in condense_co2cloud: piceco2(',ig,')=', piceco2(ig)
-            piceco2(ig)=0.
-         endif
-         
-      end do
+      END DO
 
       return
-    end subroutine condense_co2
-
-!-------------------------------------------------------------------------
-    subroutine get_tcond_co2(p,tcond)
-!   Calculates the condensation temperature for CO2
+      
+      end subroutine condense_co2
+
+
+
+!-------------------------------------------------------------------------
+!-------------------------------------------------------------------------
+!-------------------------------------------------------------------------
+!-------------------------------------------------------------------------
+!-------------------------------------------------------------------------
+!-------------------------------------------------------------------------
+
+
+
+      subroutine get_tcond_co2(p,tcond)  ! Calculates the condensation temperature for CO2
+     
 
       implicit none
@@ -500,21 +481,26 @@
       peff=p
 
-      if(peff.lt.ptriple)then
-         tcond = (-3167.8)/(log(.01*peff)-23.23) ! Fanale's formula
+      if(peff.lt.ptriple) then
+         tcond = (-3167.8)/(log(.01*peff)-23.23) ! Fanale's formula.
       else
-         tcond = 684.2-92.3*log(peff)+4.32*log(peff)**2 
-         ! liquid-vapour transition (based on CRC handbook 2003 data)
+         tcond = 684.2-92.3*log(peff)+4.32*log(peff)**2 ! liquid-vapour transition (based on CRC handbook 2003 data)        
       endif
       return
 
-    end subroutine get_tcond_co2
-    
-    
-    
- 
-!-------------------------------------------------------------------------
-    subroutine get_tnuc_co2(p,tnuc)
-!   Calculates the nucleation temperature for CO2, based on a simple super saturation criterion 
-!     (JL 2011)
+      end subroutine get_tcond_co2
+
+
+
+!-------------------------------------------------------------------------
+!-------------------------------------------------------------------------
+!-------------------------------------------------------------------------
+!-------------------------------------------------------------------------
+!-------------------------------------------------------------------------
+!-------------------------------------------------------------------------
+
+
+
+      subroutine get_tnuc_co2(p,tnuc)
+      ! Calculates the nucleation temperature for CO2, based on a simple super saturation criterion. JL 2011.
 
       use callkeys_mod, only: co2supsat
@@ -527,5 +513,5 @@
       peff=p/co2supsat
 
-      if(peff.lt.ptriple)then
+      if(peff.lt.ptriple) then
          tnuc = (-3167.8)/(log(.01*peff)-23.23) ! Fanale's formula
       else
@@ -533,5 +519,6 @@
          ! liquid-vapour transition (based on CRC handbook 2003 data)
       endif
+      
       return
 
-    end subroutine get_tnuc_co2
+      end subroutine get_tnuc_co2
Index: trunk/LMDZ.GENERIC/libf/phystd/physiq.F90
===================================================================
--- trunk/LMDZ.GENERIC/libf/phystd/physiq.F90	(revision 1484)
+++ trunk/LMDZ.GENERIC/libf/phystd/physiq.F90	(revision 1485)
@@ -299,5 +299,4 @@
                         
       ! For Winds : (m/s/s)
-      real zdvc(ngrid,nlayer),zduc(ngrid,nlayer)     ! Condense_co2 routine.
       real zdvadj(ngrid,nlayer),zduadj(ngrid,nlayer) ! Convadj routine.
       real zdumr(ngrid,nlayer),zdvmr(ngrid,nlayer)   ! Mass_redistribution routine.
@@ -1199,14 +1198,10 @@
          call condense_co2(ngrid,nlayer,nq,ptimestep,                    &
                            capcal,pplay,pplev,tsurf,pt,                  &
-                           pphi,pdt,pdu,pdv,zdtsurf,pu,pv,pq,pdq,        &
-                           qsurf(1:ngrid,igcm_co2_ice),zdqsurfc,         &
-                           albedo,emis,                                  &
+                           pdt,zdtsurf,pq,pdq,                           &
+                           qsurf,zdqsurfc,albedo,emis,                   &
                            albedo_bareground,albedo_co2_ice_SPECTV,      &
-                           zdtc,zdtsurfc,pdpsrf,zduc,zdvc,               &
-                           zdqc)
+                           zdtc,zdtsurfc,pdpsrf,zdqc)
 
          pdt(1:ngrid,1:nlayer) = pdt(1:ngrid,1:nlayer)+zdtc(1:ngrid,1:nlayer)
-         pdv(1:ngrid,1:nlayer) = pdv(1:ngrid,1:nlayer)+zdvc(1:ngrid,1:nlayer)
-         pdu(1:ngrid,1:nlayer) = pdu(1:ngrid,1:nlayer)+zduc(1:ngrid,1:nlayer)
          zdtsurf(1:ngrid)      = zdtsurf(1:ngrid) + zdtsurfc(1:ngrid)
 
