Index: trunk/LMDZ.MARS/libf/phymars/comslope_mod.F90
===================================================================
--- trunk/LMDZ.MARS/libf/phymars/comslope_mod.F90	(revision 2908)
+++ trunk/LMDZ.MARS/libf/phymars/comslope_mod.F90	(revision 2909)
@@ -23,13 +23,14 @@
 
 CONTAINS 
-  SUBROUTINE ini_comslope_h(ngrid)
+  SUBROUTINE ini_comslope_h(ngrid,nslope_in)
 
   IMPLICIT NONE
   INTEGER, INTENT(IN) :: ngrid
+  INTEGER, INTENT(IN) :: nslope_in
 
-    allocate(def_slope(nslope+1))
-    allocate(def_slope_mean(nslope))
-    allocate(sky_slope(nslope))
-    allocate(subslope_dist(ngrid,nslope))
+    allocate(def_slope(nslope_in+1))
+    allocate(def_slope_mean(nslope_in))
+    allocate(sky_slope(nslope_in))
+    allocate(subslope_dist(ngrid,nslope_in))
     allocate(major_slope(ngrid))
   END SUBROUTINE ini_comslope_h
@@ -70,4 +71,11 @@
       qsurf_meshavg(:,:) = 0.
 
+  if(nslope.eq.1) then
+      albedo_meshavg(:,:) = albedo_slope(:,:,1)
+      emis_meshavg(:) = emis_slope(:,1)
+      tsurf_meshavg(:) = tsurf_slope(:,1)
+      qsurf_meshavg(:,:) = qsurf_slope(:,:,1)
+  else
+
   DO ig = 1,ngrid
       DO islope = 1,nslope
@@ -84,4 +92,6 @@
   ENDDO
 
+  endif
+
   END SUBROUTINE compute_meshgridavg
 
Index: trunk/LMDZ.MARS/libf/phymars/comsoil_h.F90
===================================================================
--- trunk/LMDZ.MARS/libf/phymars/comsoil_h.F90	(revision 2908)
+++ trunk/LMDZ.MARS/libf/phymars/comsoil_h.F90	(revision 2909)
@@ -70,3 +70,32 @@
   end subroutine end_comsoil_h
 
+  subroutine ini_comsoil_h_slope_var(ngrid,nslope)
+  
+  implicit none
+  integer,intent(in) :: ngrid ! number of atmospheric columns
+  integer,intent(in) :: nslope ! number of sub grid slopes
+ 
+    allocate(tsoil(ngrid,nsoilmx,nslope)) ! soil temperatures
+    allocate(mthermdiff(ngrid,0:nsoilmx-1,nslope))
+    allocate(thermdiff(ngrid,nsoilmx-1,nslope))
+    allocate(coefd(ngrid,nsoilmx-1,nslope))
+    allocate(alph(ngrid,nsoilmx-1,nslope))
+    allocate(beta(ngrid,nsoilmx-1,nslope))
+ 
+  end subroutine ini_comsoil_h_slope_var
+
+
+  subroutine end_comsoil_h_slope_var
+
+  implicit none
+
+    if (allocated(tsoil)) deallocate(tsoil)
+    if (allocated(mthermdiff)) deallocate(mthermdiff)
+    if (allocated(thermdiff)) deallocate(thermdiff)
+    if (allocated(coefd)) deallocate(coefd)
+    if (allocated(alph)) deallocate(alph)
+    if (allocated(beta)) deallocate(beta)
+
+  end subroutine end_comsoil_h_slope_var
+
 end module comsoil_h
Index: trunk/LMDZ.MARS/libf/phymars/dimradmars_mod.F90
===================================================================
--- trunk/LMDZ.MARS/libf/phymars/dimradmars_mod.F90	(revision 2908)
+++ trunk/LMDZ.MARS/libf/phymars/dimradmars_mod.F90	(revision 2909)
@@ -216,4 +216,27 @@
 
   end subroutine end_dimradmars_mod
+
+  subroutine ini_dimradmars_mod_slope_var(ngrid,nslope)
+  
+  implicit none
+  
+  integer,intent(in) :: ngrid ! number of atmospheric columns
+  integer,intent(in) :: nslope ! number of subgrid scale slopes
+
+   allocate(albedo(ngrid,2,nslope))
+   allocate(fluxrad_sky(ngrid,nslope))
+   allocate(fluxrad(ngrid,nslope))
+
+  end subroutine ini_dimradmars_mod_slope_var
+
+  subroutine end_dimradmars_mod_slope_var
+
+  implicit none
+
+   if (allocated(albedo))      deallocate(albedo)
+   if (allocated(fluxrad_sky)) deallocate(fluxrad_sky)
+   if (allocated(fluxrad))     deallocate(fluxrad)
+
+  end subroutine end_dimradmars_mod_slope_var
 
  
Index: trunk/LMDZ.MARS/libf/phymars/phyetat0_mod.F90
===================================================================
--- trunk/LMDZ.MARS/libf/phymars/phyetat0_mod.F90	(revision 2908)
+++ trunk/LMDZ.MARS/libf/phymars/phyetat0_mod.F90	(revision 2909)
@@ -134,32 +134,4 @@
 endif ! of if (startphy_file)
 
-if(nslope.ne.1) then
-  call abort_physic(modname, &
-                "phyetat0: For now, nslope should be 1 (set in comslope_mod)",1)
-endif
-
-allocate(default_def_slope(nslope+1))
-!Sub-grid scale  subslopes
-if (nslope.eq.7) then
-  default_def_slope(1) = -43.
-  default_def_slope(2) = -19.
-  default_def_slope(3) = -9.
-  default_def_slope(4) = -3.
-  default_def_slope(5) = 3.
-  default_def_slope(6) = 9.
-  default_def_slope(7) = 19.
-  default_def_slope(8) = 43.
-elseif (nslope.eq.5) then
-  default_def_slope(1) = -43.
-  default_def_slope(2) = -9.
-  default_def_slope(3) = -3.
-  default_def_slope(4) = 3.
-  default_def_slope(5) = 9.
-  default_def_slope(6) = 43.
-elseif (nslope.eq.1) then
-  default_def_slope(1) = 0.
-  default_def_slope(2) = 0.
-endif
-
 if (startphy_file) then
  call get_var("def_slope",def_slope,found)
@@ -167,13 +139,16 @@
      startphy_slope=.false.
      write(*,*)'slope_settings: Problem while reading <def_slope>'
-     write(*,*)'default def_slope will be used'
-     do islope=1,nslope+1
-       def_slope(islope) = default_def_slope(islope)
-     enddo
-     write(*,*)'computing corresponding distribution <subslope_dist>'
-     write(*,*)'For now, woth nslope=1, subslope_dist is straigforward'
-     write(*,*)'Later this operation will be done by newstart with a specific routine'
-     subslope_dist(:,:)=1.
-     !call subslope_mola(ngrid,nslope,def_slope,subslope_dist)
+     write(*,*)'Checking that nslope=1'
+     if(nslope.eq.1) then
+      write(*,*)'We take default def_slope and subslope dist'
+      allocate(default_def_slope(nslope+1))
+      default_def_slope(1) = 0.
+      default_def_slope(2) = 0.
+      subslope_dist(:,:)=1.
+     else
+       write(*,*)'Variable def_slope is not present in the start and'
+       write(*,*)'you are trying to run with nslope!=1'
+       write(*,*)'This is not possible, you have to go through newstart'
+     endif
    else
      startphy_slope=.true.
@@ -181,20 +156,21 @@
      if(.not.found) then 
        write(*,*)'slope_settings: Problem while reading <subslope_dist>'
-       write(*,*)'computing a new distribution'
-       write(*,*)'For now, woth nslope=1, subslope_dist is straigforward'
-       write(*,*)'Later this operation will be done by newstart with a specific routine'
-       subslope_dist(:,:)=1.
-     !call subslope_mola(ngrid,nslope,def_slope,subslope_dist)
+       write(*,*)'We have to abort.'
+       write(*,*)'Please check that nslope is coherent, you can modify this parameter with newstart'
+       call abort_physic(modname, &
+                "phyetat0: Failed loading <subslope_dist>",1)
      endif
     endif
-else ! startphy_file  
- do islope=1,nslope+1
-       def_slope(islope) = default_def_slope(islope)
-     enddo
-     write(*,*)'computing corresponding distribution <subslope_dist>'
-     write(*,*)'For now, woth nslope=1, subslope_dist is straigforward'
-     write(*,*)'Later this operation will be done by newstart with a specific routine'
-     subslope_dist(:,:)=1.
-     !call subslope_mola(ngrid,nslope,def_slope,subslope_dist)
+else ! (no startphy_file)
+     if(nslope.eq.1) then
+      allocate(default_def_slope(nslope+1))
+      default_def_slope(1) = 0.
+      default_def_slope(2) = 0.
+      subslope_dist(:,:)=1.
+    else
+     write(*,*)'Without starfi, lets first run with nslope=1'
+       call abort_physic(modname, &
+                "phyetat0: No startfi and nslope!=1",1)
+   endif
 endif   
 
Index: trunk/LMDZ.MARS/libf/phymars/phys_state_var_init_mod.F90
===================================================================
--- trunk/LMDZ.MARS/libf/phymars/phys_state_var_init_mod.F90	(revision 2908)
+++ trunk/LMDZ.MARS/libf/phymars/phys_state_var_init_mod.F90	(revision 2909)
@@ -61,5 +61,5 @@
       use dust_rad_adjust_mod, only: ini_dust_rad_adjust_mod, &
                                      end_dust_rad_adjust_mod
-      use comslope_mod, ONLY: nslope
+      use comslope_mod, ONLY: nslope,end_comslope_h,ini_comslope_h
       use netcdf
       USE mod_phys_lmdz_para, ONLY: is_master,bcast
@@ -182,4 +182,8 @@
       call ini_dust_rad_adjust_mod(ngrid)
 
+      ! allocate arrays in "comslope_mod"
+      call end_comslope_h
+      call ini_comslope_h(ngrid,nslope)
+
       END SUBROUTINE phys_state_var_init
 
Index: trunk/LMDZ.MARS/libf/phymars/physiq_mod.F
===================================================================
--- trunk/LMDZ.MARS/libf/phymars/physiq_mod.F	(revision 2908)
+++ trunk/LMDZ.MARS/libf/phymars/physiq_mod.F	(revision 2909)
@@ -577,6 +577,4 @@
 c        ~~~~~~~~~~~~
 #ifndef MESOSCALE
-
-         call ini_comslope_h(ngrid)
 
 ! GCM. Read netcdf initial physical parameters.
Index: trunk/LMDZ.MARS/libf/phymars/surfdat_h.F90
===================================================================
--- trunk/LMDZ.MARS/libf/phymars/surfdat_h.F90	(revision 2908)
+++ trunk/LMDZ.MARS/libf/phymars/surfdat_h.F90	(revision 2909)
@@ -116,3 +116,31 @@
   end subroutine end_surfdat_h
 
+  subroutine ini_surfdat_h_slope_var(ngrid,nq,nslope)
+  
+  implicit none
+  integer,intent(in) :: ngrid ! number of atmospheric columns
+  integer,intent(in) :: nq ! number of tracers  
+  integer,intent(in) :: nslope ! number of sub-grid scale slope  
+    allocate(qsurf(ngrid,nq,nslope))
+    allocate(tsurf(ngrid,nslope))
+    allocate(watercap(ngrid,nslope))
+    allocate(emis(ngrid,nslope))
+    allocate(capcal(ngrid,nslope))
+    allocate(fluxgrd(ngrid,nslope))
+       
+  end subroutine ini_surfdat_h_slope_var
+
+  subroutine end_surfdat_h_slope_var
+
+  implicit none
+
+    if (allocated(qsurf))         deallocate(qsurf)
+    if (allocated(tsurf))         deallocate(tsurf)
+    if (allocated(watercap))      deallocate(watercap)
+    if (allocated(emis))          deallocate(emis)
+    if (allocated(capcal))        deallocate(capcal)
+    if (allocated(fluxgrd))       deallocate(fluxgrd)
+    
+  end subroutine end_surfdat_h_slope_var
+
 end module surfdat_h
