Changeset 220


Ignore:
Timestamp:
12/05/18 14:32:29 (6 years ago)
Author:
aquiquet
Message:

Further development of the new climat_forcage_mod: possibility to run transient OR equilibrium simulations using the snapshots provided (integer typerun).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/SOURCES/climat_forcage_mod.f90

    r219 r220  
    3838  real,dimension(nx,ny) :: Zs        !< surface topography above sea level 
    3939 
     40  integer :: typerun ! 1 for steady state using snap 1,  
     41                     ! 2 for steady state using snap 2 ... 
     42                     ! 0 for transient 
    4043 
    4144! S0 topo de ref correspondant a la climato est lu dans lect_topo  
     
    188191 
    189192 
    190   namelist/clim_forcage/clim_ref_file,ttr,forcage_file1,forcage_file2,rappact,mincoefbmelt,maxcoefbmelt,filforc,lapserate 
     193  namelist/clim_forcage/clim_ref_file,ttr,forcage_file1,forcage_file2,typerun,rappact,mincoefbmelt,maxcoefbmelt,filforc,lapserate 
    191194 
    192195  rewind(num_param)        ! pour revenir au debut du fichier param_list.dat 
     
    204207  write(num_rep_42,'(A,A)') 'forcage_file1 = ', forcage_file1 
    205208  write(num_rep_42,'(A,A)') 'forcage_file2 = ', forcage_file2 
     209  write(num_rep_42,'(A,A)') 'typerun = ', typerun 
    206210  write(num_rep_42,'(A,A)') 'rappact = ', rappact 
    207211  write(num_rep_42,*) 'mincoefbmelt = ', mincoefbmelt 
     
    234238  real,dimension(nx,ny,12) :: prmois ! precip sur topo Zs 
    235239   
    236    
    237    
    238   if(time.le.tdate(1)) then   ! time avant le debut du fichier forcage 
     240  real (kind=kind(0.d0)) ::  timeloc 
     241   
     242  if (typerun.eq.0) then 
     243     timeloc = time 
     244  else if ( (typerun .gt. 0) .and. (typerun .le. ubound(ttr,dim=1)) ) then 
     245     timeloc = ttr(typerun) 
     246  else 
     247     write(*,*) "Unknown type of simulation for climat_forcage, abort" 
     248     STOP 
     249  end if 
     250 
     251  if(timeloc.le.tdate(1)) then   ! time avant le debut du fichier forcage 
    239252     sealevel=spert(1) 
    240253     coeft=alphat(1) 
     
    242255     ift=1 
    243256 
    244   else if (time.ge.tdate(nft)) then     ! time apres la fin du fichier forcage 
     257  else if (timeloc.ge.tdate(nft)) then     ! time apres la fin du fichier forcage 
    245258     sealevel=spert(nft) 
    246259     coeft=alphat(nft) 
     
    253266     do i=ift,nft-1  ! interpolation entre i et i+1 
    254267 
    255         if((time.ge.tdate(i)).and.(time.lt.tdate(i+1))) then  ! cas general 
     268        if((timeloc.ge.tdate(i)).and.(timeloc.lt.tdate(i+1))) then  ! cas general 
    256269           sealevel=spert(i)+(spert(i+1)-spert(i))*    & 
    257                 (time-tdate(i))/(tdate(i+1)-tdate(i)) 
     270                (timeloc-tdate(i))/(tdate(i+1)-tdate(i)) 
    258271 
    259272           coeft=alphat(i)+(alphat(i+1)-alphat(i))*      & 
    260                 (time-tdate(i))/(tdate(i+1)-tdate(i)) 
     273                (timeloc-tdate(i))/(tdate(i+1)-tdate(i)) 
    261274 
    262275           coefp=alphap(i)+(alphap(i+1)-alphap(i))*      & 
    263                 (time-tdate(i))/(tdate(i+1)-tdate(i)) 
     276                (timeloc-tdate(i))/(tdate(i+1)-tdate(i)) 
    264277                 
    265278           ift=i 
     
    272285  slv(:,:)=sealevel 
    273286 
    274   if(time.le.ttr(1)) then   ! time en dehors des limites du fichier forcage 
     287  if(timeloc.le.ttr(1)) then   ! time en dehors des limites du fichier forcage 
    275288    coeftime=0. 
    276289!~     do j=1,ny 
     
    282295!~     end do 
    283296    itr=1 
    284   else if (time.ge.ttr(ntr)) then        ! mis a 0 
     297  else if (timeloc.ge.ttr(ntr)) then        ! mis a 0 
    285298    coeftime=1. 
    286299    itr=ntr 
     
    295308     itr=1 
    296309     do l=itr,ntr-1    ! interpolation entre i et i+1 
    297         if((time.ge.ttr(l)).and.(time.lt.ttr(l+1))) then  ! test tranche 
    298            coeftime= (time-ttr(l))/(ttr(l+1)-ttr(l)) 
     310        if((timeloc.ge.ttr(l)).and.(timeloc.lt.ttr(l+1))) then  ! test tranche 
     311           coeftime= (timeloc-ttr(l))/(ttr(l+1)-ttr(l)) 
    299312!           do j=1,ny 
    300313!              do i=1,nx 
     
    345358 
    346359 
    347 print*,'Tmois',Tmois(142,14,1) 
    348 print*,'prmois',prmois(142,14,1) 
    349360  !$OMP WORKSHARE 
    350361  Tann=sum(Tmois,dim=3)/12. 
Note: See TracChangeset for help on using the changeset viewer.