Index: trunk/LMDZ.GENERIC/libf/phystd/convadj.F
===================================================================
--- trunk/LMDZ.GENERIC/libf/phystd/convadj.F	(revision 3312)
+++ trunk/LMDZ.GENERIC/libf/phystd/convadj.F	(revision 3322)
@@ -1,2 +1,8 @@
+      module convadj_mod
+      
+      implicit none
+      
+      contains
+
       subroutine convadj(ngrid,nlay,nq,ptimestep,
      &                   pplay,pplev,ppopsk,
@@ -5,7 +11,7 @@
      &                   pduadj,pdvadj,pdhadj,pdqadj)
 
-      USE tracer_h
+      use tracer_h, only: igcm_h2o_vap
       use comcstfi_mod, only: g
-      use generic_cloud_common_h
+      use generic_cloud_common_h, only: epsi_generic
       use generic_tracer_index_mod, only: generic_tracer_index
       use callkeys_mod, only: tracer,water,generic_condensation,
@@ -18,34 +24,36 @@
 !     Purpose
 !     -------
-!     Calculates dry convective adjustment. If one tracer is CO2,
-!     we take into account the molecular mass variation (e.g. when
-!     CO2 condenses) to trigger convection (F. Forget 01/2005)
-!
-!     Authors
-!     -------
-!     Original author unknown.
-!     Modif. 2005 by F. Forget.
-!     
+!  Compute dry convective adjustment.
+!  See old reference paper: Hourdin et al. JAS 1993
+!      "Meteorological Variability and the Annual Surface 
+!       Pressure Cycle on Mars"
+! https://doi.org/10.1175/1520-0469(1993)050%3C3625:MVATAS%3E2.0.CO;2
 !==================================================================
-
-!     ------------
-!     Declarations
-!     ------------
-
 
 !     Arguments
 !     ---------
 
-      INTEGER ngrid,nlay
-      REAL ptimestep
-      REAL ph(ngrid,nlay),pdhfi(ngrid,nlay),pdhadj(ngrid,nlay)
-      REAL pplay(ngrid,nlay),pplev(ngrid,nlay+1),ppopsk(ngrid,nlay)
-      REAL pu(ngrid,nlay),pdufi(ngrid,nlay),pduadj(ngrid,nlay)
-      REAL pv(ngrid,nlay),pdvfi(ngrid,nlay),pdvadj(ngrid,nlay)
-
-!     Tracers
-      integer nq
-      real pq(ngrid,nlay,nq), pdqfi(ngrid,nlay,nq)
-      real pdqadj(ngrid,nlay,nq)
+      INTEGER,INTENT(IN) :: ngrid ! number of atmospheric columns
+      INTEGER,INTENT(IN) :: nlay ! number of atmospheric layers
+      INTEGER,INTENT(IN) :: nq ! number of tracers
+      REAL,INTENT(IN) :: ptimestep ! physics time step (s)
+      REAL,INTENT(IN) :: pplay(ngrid,nlay) ! mi-layer pressure (Pa)
+      REAL,INTENT(IN) :: pplev(ngrid,nlay+1) ! inter-layer pressure (Pa)
+      REAL,INTENT(IN) :: ppopsk(ngrid,nlay) ! Exner (wrt surface pressure)
+      ! fields from dynamics
+      REAL,INTENT(IN) :: ph(ngrid,nlay) ! potential temperature (K)
+      REAL,INTENT(IN) :: pu(ngrid,nlay) ! zonal wind (m/s)
+      REAL,INTENT(IN) :: pv(ngrid,nlay) ! meridioanl wind (m/s)
+      REAL,INTENT(IN) :: pq(ngrid,nlay,nq) ! tracers (../kg_air)
+      ! tendencies due to previous physical processes
+      REAL,INTENT(IN) :: pdufi(ngrid,nlay) ! on zonal wind (m/s/s)
+      REAL,INTENT(IN) :: pdvfi(ngrid,nlay) ! on meridional wind (m/s/s)
+      REAL,INTENT(IN) :: pdhfi(ngrid,nlay)! on potential temperature (/K/s)
+      REAL,INTENT(IN) :: pdqfi(ngrid,nlay,nq) ! on tracers (../kg_air/s)
+      ! tendencies due to convetive adjustement
+      REAL,INTENT(OUT) :: pduadj(ngrid,nlay) ! on zonal wind (m/s/s)
+      REAL,INTENT(OUT) :: pdvadj(ngrid,nlay) ! on meridinal wind (m/s/s)
+      REAL,INTENT(OUT) :: pdhadj(ngrid,nlay) ! on potential temperature (/K/s)
+      REAL,INTENT(OUT) :: pdqadj(ngrid,nlay,nq) ! on traceurs (../kg_air/s)
 
 
@@ -66,5 +74,5 @@
       INTEGER iq
       REAL zq(ngrid,nlay,nq), zq2(ngrid,nlay,nq)
-      REAL zqm(nq),zqco2m
+      REAL zqm(nq)
       
       integer igcm_generic_vap, igcm_generic_ice
@@ -75,6 +83,4 @@
 !     for conservation test
       real masse,cadjncons
-
-      EXTERNAL SCOPY
 
 !     --------------
@@ -87,12 +93,10 @@
       if(tracer) then      
         zq(:,:,:)=pq(:,:,:)+pdqfi(:,:,:)*ptimestep
-        !zq(:,:,:)=0
       end if
 
-      CALL scopy(ngrid*nlay,zh,1,zh2,1)
-      CALL scopy(ngrid*nlay,zu,1,zu2,1)
-      CALL scopy(ngrid*nlay,zv,1,zv2,1)
-      CALL scopy(ngrid*nlay*nq,zq,1,zq2,1)
-
+      zh2(:,:)=zh(:,:)
+      zu2(:,:)=zu(:,:)
+      zv2(:,:)=zv(:,:)
+      zq2(:,:,:)=zq(:,:,:)
 
 !     -----------------------------
@@ -115,8 +119,8 @@
           endif
         ENDDO
-        CALL scopy(ngrid*nlay,zvh,1,zvh2,1)
-        CALL scopy(ngrid*nlay,zvh2,1,zhc,1)
+        zvh2(:,:)=zvh(:,:)
+        zhc(:,:)=zvh2(:,:)
       else        
-        CALL scopy(ngrid*nlay,zh2,1,zhc,1)
+        zhc(:,:)=zh2(:,:)
       endif
 
@@ -285,10 +289,10 @@
          cadjncons=0.0
          if(water)then
-         do l = 1, nlay
+           do l = 1, nlay
             masse = (pplev(i,l) - pplev(i,l+1))/g
             iq    = igcm_h2o_vap
             cadjncons = cadjncons + 
      &           masse*(zq2(i,l,iq)-zq(i,l,iq))/ptimestep 
-         end do
+           end do
          endif
 
@@ -353,16 +357,5 @@
       end if
 
-
-!     output
-!      if (ngrid.eq.1) then
-!         ig=1
-!         iq =1 
-!         write(*,*)'**** l, pq(ig,l,iq),zq(ig,l,iq),zq2(ig,l,iq)'  
-!         do l=nlay,1,-1
-!           write(*,*) l, pq(ig,l,iq),zq(ig,l,iq),zq2(ig,l,iq)
-!         end do
-!      end if
-
-
-      return
-      end
+      end subroutine convadj
+
+      end module convadj_mod
Index: trunk/LMDZ.GENERIC/libf/phystd/physiq_mod.F90
===================================================================
--- trunk/LMDZ.GENERIC/libf/phystd/physiq_mod.F90	(revision 3312)
+++ trunk/LMDZ.GENERIC/libf/phystd/physiq_mod.F90	(revision 3322)
@@ -80,4 +80,5 @@
       use volcano_mod, only: volcano
       use pindex_mod, only: pindex
+      use convadj_mod, only: convadj
       use vdifc_mod, only: vdifc
       use turbdiff_mod, only: turbdiff
