Index: /trunk/SOURCES/bmelt-ismip6-param_mod.f90
===================================================================
--- /trunk/SOURCES/bmelt-ismip6-param_mod.f90	(revision 288)
+++ /trunk/SOURCES/bmelt-ismip6-param_mod.f90	(revision 289)
@@ -43,6 +43,6 @@
   integer                            :: bmelt_time        !< pour selectionner le type de calcul de bmelt  
   double precision,dimension(nx,ny)  :: bmelt_anom        !< anomalie de bmelt pour exp initMIP abmb
-  double precision,dimension(nx,ny,nzoc)  :: TF_0              !> thermal_forcing initial
-  double precision,dimension(:,:,:,:),allocatable  :: TF_anom  !< anomalie de thermal_forcing pour exp ISMIP
+!  double precision,dimension(nx,ny,nzoc)  :: TF_0              !> thermal_forcing initial
+  double precision,dimension(:,:,:,:),allocatable  :: TF_time  !< snapshots thermal_forcing pour exp ISMIP
   real,dimension(:),allocatable      :: time_snap         !> date des snapshots  indice : nb de nb_snap
   real                               :: time_depart_snaps !> temps du debut premier snapshot
@@ -112,5 +112,5 @@
        thermal_forcing(:,:,:) = 3.5
     endwhere
-    TF_0(:,:,:) = thermal_forcing(:,:,:)
+!    TF_0(:,:,:) = thermal_forcing(:,:,:)
     
     ! ______ Anomalies...
@@ -132,5 +132,5 @@
       call Read_Ncdf_var('abmb',file_bmelt_anom,tab2d)
       bmelt_anom (:,:) = tab2d(:,:)
-    elseif (bmelt_time == 2) then ! fichier 3D de TF_anom : lecture des snapshots
+    elseif (bmelt_time == 2) then ! fichier 3D de TF_time : lecture des snapshots
 ! allocation dynamique de time_snap
       if (allocated(time_snap)) then 
@@ -148,16 +148,16 @@
         stop 
       end if
-! allocation dynamique de TF_anom
-      if (allocated(TF_anom)) then 
-        deallocate(TF_anom,stat=err)
+! allocation dynamique de TF_time
+      if (allocated(TF_time)) then 
+        deallocate(TF_time,stat=err)
         if (err/=0) then
-          print *,"Erreur Ã  la desallocation de TF_anom",err
+          print *,"Erreur Ã  la desallocation de TF_time",err
           stop 
         end if
       end if
 
-      allocate(TF_anom(nx,ny,nzoc,nb_snap),stat=err)
+      allocate(TF_time(nx,ny,nzoc,nb_snap),stat=err)
       if (err/=0) then
-        print *,"erreur a l'allocation du tableau TF_anom ",err
+        print *,"erreur a l'allocation du tableau TF_time ",err
         print *,"nx,ny,nb_snap = ",nx,',',ny,',',nb_snap
         stop 
@@ -165,5 +165,5 @@
     ! lecture de tann_snap
       call Read_Ncdf_var('thermal_forcing',file_bmelt_anom,tab4D)
-      TF_anom(:,:,:,:) = tab4D(:,:,:,:)
+      TF_time(:,:,:,:) = tab4D(:,:,:,:)
 
 ! lecture de time_snap
@@ -299,9 +299,8 @@
   end subroutine bmeltshelf
   
-subroutine TF_ISMIP_RCM                ! calcule le thermal forcing a partir des snapshots d'anomalies
+subroutine TF_ISMIP_RCM                ! calcule le thermal forcing a partir des snapshots
 
   implicit none
-  integer             :: k, k_snap               ! pour calculer les indices de temps
-  real :: time_prec
+  integer             :: k             ! pour calculer les indices de temps
   real,dimension(nx,ny,nzoc) :: thermal_forcing_time  ! pour calcul Thermal forcing
 
@@ -314,25 +313,15 @@
 ! en general les snapshots vont de 1995 a 2100 (time_snap de 0 Ã  105)
   if(time.lt.time_snap(1)) then              ! time avant le forcage
-     thermal_forcing_time(:,:,:) = TF_0(:,:,:)
-     k_snap       = 1
-!     S_ref(:,:)   = S(:,:)                   ! du coup sera la surface de reference avant le forcage
-     time_prec    = time
+     thermal_forcing_time(:,:,:) = TF_time(:,:,:,1)
   else if (time.ge.time_snap(nb_snap)) then  ! time apres le forcage
-     thermal_forcing_time(:,:,:) =  TF_0(:,:,:) + TF_anom(:,:,:,nb_snap)
-     if (abs(time-time_prec-1.).lt.dt) then   ! 
-        time_prec = time_prec + 1
-     endif
+     thermal_forcing_time(:,:,:) = TF_time(:,:,:,nb_snap)
   else                                       ! cas general
      do k = 1 , nb_snap-1
         if((time.ge.time_snap(k)).and.(time.lt.time_snap(k+1))) then ! entre k et k+1 
-           thermal_forcing_time(:,:,:) = TF_0(:,:,:) + TF_anom(:,:,:,k) + (TF_anom(:,:,:,k+1)-TF_anom(:,:,:,k)) *   &
-                (time-time_snap(k))/(time_snap(k+1)-time_snap(k))
-! exactement sur le snapshot et avec un ecart 1 an par rapport au precedent stockage
-!           write(6,*) 'time,tests',k,time,time-time_snap(k),time-time_prec-1.
-           if ((abs(time-time_snap(k)).le.dt).and.(abs(time-time_prec-1.).lt.dt)) then    
-              k_snap    = k
-              time_prec = time_snap(k)     ! time_prec est le temps du precedent
-           endif
-           exit
+!cdc version avec interpolation lineaire entre 2 annees        
+!~            thermal_forcing_time(:,:,:) = TF_time(:,:,:,k) + (TF_time(:,:,:,k+1)-TF_time(:,:,:,k)) *   &
+!~                 (time-time_snap(k))/(time_snap(k+1)-time_snap(k))
+!cdc version IMSIP avec annee n => TF(n) pendant un an
+           thermal_forcing_time(:,:,:) = TF_time(:,:,:,k)
         endif
      end do
@@ -340,5 +329,5 @@
 
   thermal_forcing(:,:,:) = thermal_forcing_time(:,:,:)
-!  print*,'TF_ISMIP_RCM time_snap TF', k, time_snap(k), time_snap(k+1), thermal_forcing_time(163,89,1), thermal_forcing_time(194,131,1),TF_0(163,89,1),TF_0(194,131,1)
+!~   print*,'TF_ISMIP_RCM time_snap TF', k, time_snap(k), time_snap(k+1), thermal_forcing_time(190,220,1), thermal_forcing_time(190,220,30),TF_time(190,220,1,1),TF_time(190,220,30,1)
 
 end subroutine TF_ISMIP_RCM
