/[lmdze]/trunk/phylmd/Interface_surf/limit_read_sst.f
ViewVC logotype

Diff of /trunk/phylmd/Interface_surf/limit_read_sst.f

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

trunk/Sources/phylmd/Interface_surf/read_sst.f revision 202 by guez, Wed Jun 8 12:23:41 2016 UTC trunk/phylmd/Interface_surf/read_sst.f revision 279 by guez, Fri Jul 20 14:30:23 2018 UTC
# Line 4  module read_sst_m Line 4  module read_sst_m
4    
5  contains  contains
6    
7    SUBROUTINE read_sst(dtime, jour, knindex, debut, lmt_sst)    SUBROUTINE read_sst(julien, knindex, tsurf)
8    
9      ! From interfoce_lim      ! From interfoce_lim
10    
11      USE dimphy, ONLY: klon      ! Libraries:
12      USE netcdf, ONLY: nf90_nowrite      USE netcdf, ONLY: nf90_nowrite
13      use netcdf95, only: NF95_CLOSE, nf95_get_var, NF95_INQ_VARID, nf95_open      use netcdf95, only: NF95_CLOSE, nf95_get_var, NF95_INQ_VARID, nf95_open
14      use nr_util, only: assert      use nr_util, only: assert
15    
16        use conf_gcm_m, only: lmt_pas
17        USE dimphy, ONLY: klon
18      use time_phylmdz, only: itap      use time_phylmdz, only: itap
19    
20      real, intent(IN):: dtime ! pas de temps de la physique (en s)      integer, intent(IN):: julien ! jour a lire dans l'annee
     integer, intent(IN):: jour ! jour a lire dans l'annee  
21    
22      integer, intent(in):: knindex(:) ! (knon)      integer, intent(in):: knindex(:) ! (knon)
23      ! index des points de la surface a traiter      ! index des points de la surface a traiter
24    
25      logical, intent(IN):: debut ! 1er appel a la physique (initialisation)      real, intent(out):: tsurf(:) ! (knon)
   
     real, intent(out):: lmt_sst(:) ! (knon)  
26      ! SST lues dans le fichier de conditions aux limites      ! SST lues dans le fichier de conditions aux limites
27    
28      ! Local:      ! Local:
29    
     INTEGER, save:: lmt_pas ! frequence de lecture des conditions limites  
     ! (en pas de physique)  
   
     logical, save:: deja_lu  
     ! pour indiquer que le jour à lire a déjà été lu pour une surface  
     ! précédente  
   
     integer, save:: jour_lu  
   
30      ! Champ lu dans le fichier de conditions aux limites :      ! Champ lu dans le fichier de conditions aux limites :
31      real, allocatable, save:: sst_lu(:)      real, save:: sst_lu(klon)
32    
33      integer ncid, varid ! pour NetCDF      integer ncid, varid ! pour NetCDF
34    
35      ! --------------------------------------------------      ! --------------------------------------------------
36    
37      call assert(size(knindex) == size(lmt_sst), "read_sst knon")      call assert(size(knindex) == size(tsurf), "read_sst knon")
   
     if (debut .and. .not. allocated(sst_lu)) then  
        lmt_pas = nint(86400. / dtime) ! pour une lecture une fois par jour  
        jour_lu = jour - 1  
        allocate(sst_lu(klon))  
     endif  
   
     if ((jour - jour_lu) /= 0) deja_lu = .false.  
38    
39      ! Tester d'abord si c'est le moment de lire le fichier      ! Tester d'abord si c'est le moment de lire le fichier
40      if (mod(itap - 1, lmt_pas) == 0 .and. .not. deja_lu) then      if (mod(itap - 1, lmt_pas) == 0) then
41         call NF95_OPEN ('limit.nc', NF90_NOWRITE, ncid)         call NF95_OPEN ('limit.nc', NF90_NOWRITE, ncid)
42    
43         call NF95_INQ_VARID(ncid, 'SST', varid)         call NF95_INQ_VARID(ncid, 'SST', varid)
44         call NF95_GET_VAR(ncid, varid, sst_lu, start = (/1, jour/))         call NF95_GET_VAR(ncid, varid, sst_lu, start = (/1, julien/))
45    
46         call NF95_CLOSE(ncid)         call NF95_CLOSE(ncid)
        deja_lu = .true.  
        jour_lu = jour  
47      endif      endif
48    
49      ! Recopie dans le champ de sortie      tsurf = sst_lu(knindex)
     lmt_sst = sst_lu(knindex)  
50    
51    END SUBROUTINE read_sst    END SUBROUTINE read_sst
52    

Legend:
Removed from v.202  
changed lines
  Added in v.279

  ViewVC Help
Powered by ViewVC 1.1.21