Changeset 289


Ignore:
Timestamp:
11/15/19 17:38:11 (5 years ago)
Author:
dumas
Message:

ISMIP forcing : thermal forcing is not interpolated between years

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/SOURCES/bmelt-ismip6-param_mod.f90

    r276 r289  
    4343  integer                            :: bmelt_time        !< pour selectionner le type de calcul de bmelt   
    4444  double precision,dimension(nx,ny)  :: bmelt_anom        !< anomalie de bmelt pour exp initMIP abmb 
    45   double precision,dimension(nx,ny,nzoc)  :: TF_0              !> thermal_forcing initial 
    46   double precision,dimension(:,:,:,:),allocatable  :: TF_anom  !< anomalie de thermal_forcing pour exp ISMIP 
     45!  double precision,dimension(nx,ny,nzoc)  :: TF_0              !> thermal_forcing initial 
     46  double precision,dimension(:,:,:,:),allocatable  :: TF_time  !< snapshots thermal_forcing pour exp ISMIP 
    4747  real,dimension(:),allocatable      :: time_snap         !> date des snapshots  indice : nb de nb_snap 
    4848  real                               :: time_depart_snaps !> temps du debut premier snapshot 
     
    112112       thermal_forcing(:,:,:) = 3.5 
    113113    endwhere 
    114     TF_0(:,:,:) = thermal_forcing(:,:,:) 
     114!    TF_0(:,:,:) = thermal_forcing(:,:,:) 
    115115     
    116116    ! ______ Anomalies... 
     
    132132      call Read_Ncdf_var('abmb',file_bmelt_anom,tab2d) 
    133133      bmelt_anom (:,:) = tab2d(:,:) 
    134     elseif (bmelt_time == 2) then ! fichier 3D de TF_anom : lecture des snapshots 
     134    elseif (bmelt_time == 2) then ! fichier 3D de TF_time : lecture des snapshots 
    135135! allocation dynamique de time_snap 
    136136      if (allocated(time_snap)) then  
     
    148148        stop  
    149149      end if 
    150 ! allocation dynamique de TF_anom 
    151       if (allocated(TF_anom)) then  
    152         deallocate(TF_anom,stat=err) 
     150! allocation dynamique de TF_time 
     151      if (allocated(TF_time)) then  
     152        deallocate(TF_time,stat=err) 
    153153        if (err/=0) then 
    154           print *,"Erreur à la desallocation de TF_anom",err 
     154          print *,"Erreur à la desallocation de TF_time",err 
    155155          stop  
    156156        end if 
    157157      end if 
    158158 
    159       allocate(TF_anom(nx,ny,nzoc,nb_snap),stat=err) 
     159      allocate(TF_time(nx,ny,nzoc,nb_snap),stat=err) 
    160160      if (err/=0) then 
    161         print *,"erreur a l'allocation du tableau TF_anom ",err 
     161        print *,"erreur a l'allocation du tableau TF_time ",err 
    162162        print *,"nx,ny,nb_snap = ",nx,',',ny,',',nb_snap 
    163163        stop  
     
    165165    ! lecture de tann_snap 
    166166      call Read_Ncdf_var('thermal_forcing',file_bmelt_anom,tab4D) 
    167       TF_anom(:,:,:,:) = tab4D(:,:,:,:) 
     167      TF_time(:,:,:,:) = tab4D(:,:,:,:) 
    168168 
    169169! lecture de time_snap 
     
    299299  end subroutine bmeltshelf 
    300300   
    301 subroutine TF_ISMIP_RCM                ! calcule le thermal forcing a partir des snapshots d'anomalies 
     301subroutine TF_ISMIP_RCM                ! calcule le thermal forcing a partir des snapshots 
    302302 
    303303  implicit none 
    304   integer             :: k, k_snap               ! pour calculer les indices de temps 
    305   real :: time_prec 
     304  integer             :: k             ! pour calculer les indices de temps 
    306305  real,dimension(nx,ny,nzoc) :: thermal_forcing_time  ! pour calcul Thermal forcing 
    307306 
     
    314313! en general les snapshots vont de 1995 a 2100 (time_snap de 0 à 105) 
    315314  if(time.lt.time_snap(1)) then              ! time avant le forcage 
    316      thermal_forcing_time(:,:,:) = TF_0(:,:,:) 
    317      k_snap       = 1 
    318 !     S_ref(:,:)   = S(:,:)                   ! du coup sera la surface de reference avant le forcage 
    319      time_prec    = time 
     315     thermal_forcing_time(:,:,:) = TF_time(:,:,:,1) 
    320316  else if (time.ge.time_snap(nb_snap)) then  ! time apres le forcage 
    321      thermal_forcing_time(:,:,:) =  TF_0(:,:,:) + TF_anom(:,:,:,nb_snap) 
    322      if (abs(time-time_prec-1.).lt.dt) then   !  
    323         time_prec = time_prec + 1 
    324      endif 
     317     thermal_forcing_time(:,:,:) = TF_time(:,:,:,nb_snap) 
    325318  else                                       ! cas general 
    326319     do k = 1 , nb_snap-1 
    327320        if((time.ge.time_snap(k)).and.(time.lt.time_snap(k+1))) then ! entre k et k+1  
    328            thermal_forcing_time(:,:,:) = TF_0(:,:,:) + TF_anom(:,:,:,k) + (TF_anom(:,:,:,k+1)-TF_anom(:,:,:,k)) *   & 
    329                 (time-time_snap(k))/(time_snap(k+1)-time_snap(k)) 
    330 ! exactement sur le snapshot et avec un ecart 1 an par rapport au precedent stockage 
    331 !           write(6,*) 'time,tests',k,time,time-time_snap(k),time-time_prec-1. 
    332            if ((abs(time-time_snap(k)).le.dt).and.(abs(time-time_prec-1.).lt.dt)) then     
    333               k_snap    = k 
    334               time_prec = time_snap(k)     ! time_prec est le temps du precedent 
    335            endif 
    336            exit 
     321!cdc version avec interpolation lineaire entre 2 annees         
     322!~            thermal_forcing_time(:,:,:) = TF_time(:,:,:,k) + (TF_time(:,:,:,k+1)-TF_time(:,:,:,k)) *   & 
     323!~                 (time-time_snap(k))/(time_snap(k+1)-time_snap(k)) 
     324!cdc version IMSIP avec annee n => TF(n) pendant un an 
     325           thermal_forcing_time(:,:,:) = TF_time(:,:,:,k) 
    337326        endif 
    338327     end do 
     
    340329 
    341330  thermal_forcing(:,:,:) = thermal_forcing_time(:,:,:) 
    342 !  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) 
     331!~   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) 
    343332 
    344333end subroutine TF_ISMIP_RCM 
Note: See TracChangeset for help on using the changeset viewer.