Index: trunk/LMDZ.MARS/libf/phymars/lwflux.F
===================================================================
--- trunk/LMDZ.MARS/libf/phymars/lwflux.F	(revision 1913)
+++ trunk/LMDZ.MARS/libf/phymars/lwflux.F	(revision 1917)
@@ -15,6 +15,6 @@
       implicit none
  
-#include "callkeys.h"
-#include "comg1d.h"
+      include "callkeys.h"
+      include "comg1d.h"
 
 c----------------------------------------------------------------------
@@ -23,35 +23,35 @@
 c                                                            inputs:
 c                                                            -------
-      integer ig0
-      integer kdlon                 ! part of ngrid
-      integer kflev                 ! part of nlayer
-
-      real dp (ndlo2,kflev)         ! layer pressure thickness (Pa)
-
-      real bsurf (ndlo2,nir)             ! surface spectral planck function
-      real blev (ndlo2,nir,kflev+1)      ! level   spectral planck function
-      real blay (ndlo2,nir,kflev)        ! layer   spectral planck function
-      real btop (ndlo2,nir)              ! top spectral planck function
-      real dbsublay (ndlo2,nir,2*kflev)  ! layer gradient spectral planck
-                                         ! function in sub layers
-
-      real dt0 (ndlo2)                 ! surface temperature discontinuity
-      real tlay (ndlo2,kflev)          ! layer temperature
-      real tlev (ndlo2,kflev+1)        ! level temperature
-
-      real emis (ndlo2)                  ! surface emissivity
-
-      real tautotal(ndlo2,kflev,nir)  ! \   Total single scattering
-      real omegtotal(ndlo2,kflev,nir) !  >  properties (Addition of the
-      real gtotal(ndlo2,kflev,nir)    ! /   NAERKIND aerosols prop.)
+      integer,intent(in) :: ig0
+      integer,intent(in) :: kdlon           ! part of ngrid
+      integer,intent(in) :: kflev           ! part of nlayer
+
+      real,intent(in) :: dp (ndlo2,kflev)   ! layer pressure thickness (Pa)
+
+      real,intent(in) :: bsurf (ndlo2,nir) ! surface spectral planck function
+      real,intent(in) :: blev (ndlo2,nir,kflev+1) ! level   spectral planck function
+      real,intent(in) :: blay (ndlo2,nir,kflev) ! layer   spectral planck function
+      real,intent(in) :: btop (ndlo2,nir) ! top spectral planck function
+      real,intent(in) :: dbsublay (ndlo2,nir,2*kflev)  ! layer gradient spectral planck
+                                                       ! function in sub layers
+
+      real,intent(in) :: dt0 (ndlo2) ! surface temperature discontinuity
+      real,intent(in) :: tlay (ndlo2,kflev) ! layer temperature
+      real,intent(in) :: tlev (ndlo2,kflev+1) ! level temperature
+
+      real,intent(in) :: emis (ndlo2) ! surface emissivity
+
+      real,intent(in) :: tautotal(ndlo2,kflev,nir)  ! \   Total single scattering
+      real,intent(in) :: omegtotal(ndlo2,kflev,nir) !  >  properties (Addition of the
+      real,intent(in) :: gtotal(ndlo2,kflev,nir)    ! /   NAERKIND aerosols prop.)
 
 
 c                                                            outputs:
 c                                                            --------
-      real coolrate(ndlo2,kflev)    ! radiative cooling rate (K/s) 
-      real netrad (ndlo2,kflev)     ! radiative budget (W/m2) 
-      real fluxground(ndlo2)        ! downward flux on the ground
-                                    ! for surface radiative budget
-      real fluxtop(ndlo2)           ! upward flux on the top of atm ("OLR")
+      real,intent(out) :: coolrate(ndlo2,kflev) ! radiative cooling rate (K/s) 
+      real,intent(out) :: netrad (ndlo2,kflev) ! radiative budget (W/m2) 
+      real,intent(out) :: fluxground(ndlo2) ! downward flux on the ground
+                                            ! for surface radiative budget
+      real,intent(out) :: fluxtop(ndlo2) ! upward flux on the top of atm ("OLR")
 
 
@@ -60,6 +60,5 @@
 c               ------------
 
-      integer ja,jl,j,i,ig1d,ig,l,ndim
-!      parameter(ndim = ndlon*(nuco2+1)*(nflev+2)*(nflev+2))
+      integer ja,jl,j,i,ig1d,ig,l
       real  ksidb (ndlon,nuco2+1,0:nflev+1,0:nflev+1) ! net exchange rate (W/m2)
 
@@ -78,6 +77,5 @@
 
 
-      ndim = ndlon*(nuco2+1)*(nflev+2)*(nflev+2)
-      call zerophys(ndim, ksidb)
+      ksidb(:,:,:,:)=0
 
 c----------------------------------------------------------------------
@@ -358,5 +356,4 @@
 c ig0+1:  point du decoupage de la grille physique
 
-c#ifdef undim
       if (callg2d) then
 
@@ -504,7 +501,5 @@
       endif
 c************************************************************************
-c#endif 
       endif  !   callg2d
 
-      return
       end
Index: trunk/LMDZ.MARS/libf/phymars/lwu.F
===================================================================
--- trunk/LMDZ.MARS/libf/phymars/lwu.F	(revision 1913)
+++ trunk/LMDZ.MARS/libf/phymars/lwu.F	(revision 1917)
@@ -34,8 +34,8 @@
       use dimradmars_mod, only: naerkind
       use yomlw_h, only: nlaylte, tref, at, bt, cst_voigt
-      USE comcstfi_h
+      use comcstfi_h, only: g
       implicit none
 
-#include "callkeys.h"
+      include "callkeys.h"
 
 c----------------------------------------------------------------------
@@ -44,27 +44,27 @@
 c                                                            inputs:
 c                                                            -------
-      integer kdlon        ! part of ngrid
-      integer kflev        ! part of nalyer
-
-      real dp (ndlo2,kflev)         ! layer pressure thickness (Pa)
-      real plev (ndlo2,kflev+1)     ! level pressure (Pa)
-      real tlay (ndlo2,kflev)       ! layer temperature (K)
-      real aerosol (ndlo2,kflev,naerkind) ! aerosol extinction optical depth
+      integer,intent(in) :: kdlon ! part of ngrid
+      integer,intent(in) :: kflev ! part of nalyer
+
+      real,intent(in) :: dp(ndlo2,kflev) ! layer pressure thickness (Pa)
+      real,intent(in) :: plev(ndlo2,kflev+1) ! level pressure (Pa)
+      real,intent(in) :: tlay(ndlo2,kflev) ! layer temperature (K)
+      real,intent(in) :: aerosol(ndlo2,kflev,naerkind) ! aerosol extinction optical depth
 c                         at reference wavelength "longrefvis" set
 c                         in dimradmars_mod , in each layer, for one of
 c                         the "naerkind" kind of aerosol optical properties.
-      REAL QIRsQREF3d(ndlo2,kflev,nir,naerkind)  ! 3d ext. coef.
-      REAL omegaIR3d(ndlo2,kflev,nir,naerkind)   ! 3d ssa
-      REAL gIR3d(ndlo2,kflev,nir,naerkind)       ! 3d assym. param.
+      real,intent(in) :: QIRsQREF3d(ndlo2,kflev,nir,naerkind) ! 3d ext. coef.
+      real,intent(in) :: omegaIR3d(ndlo2,kflev,nir,naerkind) ! 3d ssa
+      real,intent(in) :: gIR3d(ndlo2,kflev,nir,naerkind) ! 3d assym. param.
 
 c                                                            outputs:
 c                                                            --------
-      real aer_t (ndlo2,nuco2,kflev+1)   ! transmission (aer) 
-      real co2_u (ndlo2,nuco2,kflev+1)   ! absorber amounts (co2)
-      real co2_up (ndlo2,nuco2,kflev+1)  ! idem scaled by the pressure (co2)
-
-      real tautotal(ndlo2,kflev,nir)  ! \   Total single scattering
-      real omegtotal(ndlo2,kflev,nir) !  >  properties (Addition of the
-      real gtotal(ndlo2,kflev,nir)    ! /   NAERKIND aerosols properties)
+      real,intent(out) :: aer_t(ndlo2,nuco2,kflev+1)   ! transmission (aer) 
+      real,intent(out) :: co2_u(ndlo2,nuco2,kflev+1)   ! absorber amounts (co2)
+      real,intent(out) :: co2_up(ndlo2,nuco2,kflev+1)  ! idem scaled by the pressure (co2)
+
+      real,intent(out) :: tautotal(ndlo2,kflev,nir)  ! \   Total single scattering
+      real,intent(out) :: omegtotal(ndlo2,kflev,nir) !  >  properties (Addition of the
+      real,intent(out) :: gtotal(ndlo2,kflev,nir)    ! /   NAERKIND aerosols properties)
 
 c----------------------------------------------------------------------
@@ -105,7 +105,7 @@
 c  all the NAERKIND kind of aerosols in each IR band
 
-      call zerophys(ndlon*kflev*nir,tautotal)
-      call zerophys(ndlon*kflev*nir,omegtotal)
-      call zerophys(ndlon*kflev*nir,gtotal)
+      tautotal(:,:,:)=0
+      omegtotal(:,:,:)=0
+      gtotal(:,:,:)=0
 
       do n=1,naerkind
@@ -210,4 +210,3 @@
       
 c----------------------------------------------------------------------
-      return
       end
Index: trunk/LMDZ.MARS/libf/phymars/lwxd.F
===================================================================
--- trunk/LMDZ.MARS/libf/phymars/lwxd.F	(revision 1913)
+++ trunk/LMDZ.MARS/libf/phymars/lwxd.F	(revision 1917)
@@ -36,5 +36,5 @@
       implicit none
 
-#include "callkeys.h"
+      include "callkeys.h"
 
 c----------------------------------------------------------------------
@@ -43,12 +43,12 @@
 c                                                            inputs:
 c                                                            -------
-      integer ig0
-      integer kdlon      ! part of ngrid
-      integer kflev      ! part of nalyer
+      integer,intent(in) :: ig0
+      integer,intent(in) :: kdlon      ! part of ngrid
+      integer,intent(in) :: kflev      ! part of nalyer
  
-      real emis (ndlo2)                  ! surface emissivity
-      real aer_t (ndlo2,nuco2,kflev+1)   ! transmission (aer)
-      real co2_u (ndlo2,nuco2,kflev+1)   ! absorber amounts (co2)
-      real co2_up (ndlo2,nuco2,kflev+1)  ! idem scaled by the pressure (co2)
+      real,intent(in) :: emis (ndlo2) ! surface emissivity
+      real,intent(in) :: aer_t (ndlo2,nuco2,kflev+1) ! transmission (aer)
+      real,intent(in) :: co2_u (ndlo2,nuco2,kflev+1) ! absorber amounts (co2)
+      real,intent(in) :: co2_up (ndlo2,nuco2,kflev+1) ! idem scaled by the pressure (co2)
 
 c----------------------------------------------------------------------
@@ -56,8 +56,5 @@
 c               ------------
 
-      integer ja,jl,jk,jkk,ndim
-!      parameter(ndim = ndlon*nuco2*(nflev+2)*(nflev+2))
-
-
+      integer ja,jl,jk,jkk
       real zu (ndlon,nuco2)
       real zup (ndlon,nuco2)
@@ -71,6 +68,5 @@
 
 c----------------------------------------------------------------------
-      ndim = ndlon*nuco2*(nflev+2)*(nflev+2)
-      call zerophys(ndim,ksi_emis)
+      ksi_emis(:,:,:,:)=0
 c----------------------------------------------------------------------
 c         1.0   Transmission functions
@@ -252,4 +248,3 @@
 
 c----------------------------------------------------------------------
-      return
       end
Index: trunk/LMDZ.MARS/libf/phymars/zerophys.F
===================================================================
--- trunk/LMDZ.MARS/libf/phymars/zerophys.F	(revision 1913)
+++ 	(revision )
@@ -1,11 +1,0 @@
-      SUBROUTINE zerophys(n,x)
-      IMPLICIT NONE
-      INTEGER n
-      REAL x(n)
-      INTEGER i
-
-      DO i=1,n
-         x(i)=0.
-      ENDDO
-      RETURN
-      END
