Index: /trunk/SOURCES/GrIce2sea_files/module_choix_GrIce2sea.f90
===================================================================
--- /trunk/SOURCES/GrIce2sea_files/module_choix_GrIce2sea.f90	(revision 20)
+++ /trunk/SOURCES/GrIce2sea_files/module_choix_GrIce2sea.f90	(revision 21)
@@ -109,6 +109,6 @@
 ! use dragging_vit_bil_CISM_gen
 ! use dragging_calc_beta           ! tourne en "no_spinup" qui contient les fake
-use dragging_prescr_beta
-!use beta_iter_vitbil_mod
+!use dragging_prescr_beta
+use beta_iter_vitbil_mod
 !use dragging_LGM
 !use dragging_plastic_LGM
Index: /trunk/SOURCES/climat-forcage-insolation_mod.f90
===================================================================
--- /trunk/SOURCES/climat-forcage-insolation_mod.f90	(revision 20)
+++ /trunk/SOURCES/climat-forcage-insolation_mod.f90	(revision 21)
@@ -35,4 +35,5 @@
 character(len=12) :: interpolation_ice='nonlinear'   !Choose between linear and nonlinear
 integer :: rayon_interpolation_ice=60  !(In km) Choose a multiple of nx.
+
 !real :: poids_nb_points=0.5
 !real :: poids_proximity=0.5
@@ -322,5 +323,5 @@
       !value, the proximity parameter associated with each point within the
       !radius of search.
-      allocate(maillage_prox(2*grid_int+1,2*grid_int+1),stat=error)
+      allocate(maillage_prox(-grid_int:grid_int,-grid_int:grid_int),stat=error)
       if (error.ne.0) then
          print *,'error: could not allocate memory for array'
@@ -344,35 +345,24 @@
       !of exponential functions.
 !cdc      do k=1,grid_int
-         do d2=-grid_int,grid_int
-            do d1=-grid_int,grid_int
-               distsq=(abs(d1)*(dx/1000.))**2+(abs(d2)*(dx/1000.))**2
+      do d2=-grid_int,grid_int
+        do d1=-grid_int,grid_int
+          distsq=(abs(d1)*(dx/1000.))**2+(abs(d2)*(dx/1000.))**2
                !print *,'distsq = ',distsq,'real_rayon_ice =',real_rayon_ice
-               if ((sqrt(distsq).le.real_rayon_ice).and.((d1/=0).or.(d2/=0))) then
+          if ((sqrt(distsq).le.real_rayon_ice).and.((d1/=0).or.(d2/=0))) then
                   !nb_points_max(k)=nb_points_max(k)+1
 !cdc                  prox_max(k)=prox_max(k)+100*exp(-((-1*log(0.001))/real_rayon_ice)*(sqrt(distsq)))/exp(-((-1*log(0.001))/real_rayon_ice)*(dx/1000.))
                   !Indexes displacement to match elements 
-                  maillage_prox(d1+(k+1),d2+(k+1))=100*exp(-((-1*log(0.001))/real_rayon_ice)*(sqrt(distsq)))/exp(-((-1*log(0.001))/real_rayon_ice)*(dx/1000.))
+              maillage_prox(d1,d2)=100*exp(-((-1*log(0.001))/real_rayon_ice)*(sqrt(distsq)))/exp(-((-1*log(0.001))/real_rayon_ice)*(dx/1000.))
                   !print *,'nb_points_max = ',nb_points_max(k),'prox_max = ',prox_max(k),'maillage_prox = ',maillage_prox(k,d1+(k+1),d2+(k+1))
-               endif
-            enddo 
-         enddo
+          endif
+        enddo
+      enddo
 !cdc      enddo
 
-      do j=1,ny
-         do i=1,nx
-            do d2=max(j-grid_int,1),min(j+grid_int,ny)
-               do d1=max(i-grid_int,1),min(i+grid_int,nx)
-                  distsq=(abs(d1-i)*(dx/1000.))**2+(abs(d2-j)*(dx/1000.))**2
-                  if ((sqrt(distsq).le.real_rayon_ice).and.((d1/=0).or.(d2/=0))) then
-                     prox_max(i,j)=prox_max(i,j)+100*exp(-((-1*log(0.001))/real_rayon_ice)*(sqrt(distsq)))/exp(-((-1*log(0.001))/real_rayon_ice)*(dx/1000.))
-                  endif
-               enddo
-            enddo
-         enddo
-      enddo
-      !do k=1,grid_int
-      !   print *,'k =',k,'nb_points_max =',nb_points_max(k),'prox_max =',prox_max(k),'maillage_prox =',maillage_prox(k,:,:)
-      !enddo
-
+      
+      prox_max(:,:)=SUM(maillage_prox(:,:))
+!      PRINT *,'maillage_prox =',maillage_prox(:,:)
+!      PRINT*,'sum(maillage_prox)',SUM(maillage_prox(:,:))
+!      PRINT*,'fin calcul maillage prox' 
    end select
 end select
@@ -751,7 +741,7 @@
                   if (Mask(i,j).eq.1) then
                      !print *,'i = ',i,'j = ',j,'Mask = ',Mask(i,j)
-                     do m2=max(1,-grid_int),min(grid_int,ny)  !cdc
-                        do m1=max(-grid_int,1),min(grid_int,nx)  !cdc
-                           Mask2(i+m1,j+m2) = 1.
+                     do m2=max(1,j-grid_int),min(j+grid_int,ny)  !cdc
+                        do m1=max(i-grid_int,1),min(i+grid_int,nx)  !cdc
+                           Mask2(m1,m2) = 1.
                         end do
                      end do
@@ -768,5 +758,5 @@
                      !Same for the proximity parameter, prox.
                      !nb_points=0
-                     prox=0
+!                     prox=0
                      !Case where indice = 0, on the edges of the grid.
                      !We actually dont care here because Antarctica is far from the
@@ -839,4 +829,9 @@
 !                           enddo
 !                        enddo
+
+!                        maillage_prox_ij(i-grid_int:i+grid_int:1,j-grid_int:j+grid_int:1)=maillage_prox
+
+
+
                         prox=sum(maillage_prox,mask=Hlarge(i-grid_int:i+grid_int:1,j-grid_int:j+grid_int:1).ge.5)
                         
@@ -852,4 +847,13 @@
                         !coeff1(i,j)=nb_points/nb_points_max(indice(i,j))
                         coeff2(i,j)=prox/prox_max(i,j)
+!                        PRINT*,'i=',i,'j=',j
+!                        PRINT*,'prox=',prox
+!                        PRINT*,'prox_max=',prox_max(i,j)
+!                        PRINT*,'coeff2=',coeff2(i,j)
+!                        DO m1=j+grid_int,j-grid_int,-1
+!                          PRINT*,'Hlarge',Hlarge(i-grid_int:i+grid_int:1,m1)
+!                        ENDDO
+!                        PRINT*
+
                         !if (((j.eq.154).and.(i.eq.154)).or.((j.eq.184).and.(i.eq.184)).or.((j.eq.117).and.(i.eq.200))) then
                         !       print *,'time = ',time,'i = ',i,'j = ',j,'coeff1 = ',coeff1(i,j),'coeff2 = ',coeff2(i,j)
