/[lmdze]/trunk/Sources/phylmd/Interface_surf/read_sst.f
ViewVC logotype

Contents of /trunk/Sources/phylmd/Interface_surf/read_sst.f

Parent Directory Parent Directory | Revision Log Revision Log


Revision 202 - (show annotations)
Wed Jun 8 12:23:41 2016 UTC (8 years ago) by guez
File size: 2001 byte(s)
Promoted lmt_pas from local variable of physiq to variable of module
conf_gcm_m.

Removed variable run_off of module interface_surf. Was not
used. Called run_off_ter in LMDZ, but not used nor printed there
either.

Simplified logic in interfoce_lim. The way it was convoluted with
interfsurf_hq and clmain was quite a mess. Extracted reading of SST
into a separate procedure: read_sst. We do not need SST and pctsrf_new
at the same time: SST is not needed for sea-ice surface. I did not
like this programming: going through the procedure repeatedly for
different purposes and testing inside whether there was something to
do or it was already done. Reading is now only controlled by itap and
lmt_pas, instead of debut, jour, jour_lu and deja_lu. Now we do not
copy from pct_tmp to pctsrf_new every time step.

Simplified processing of pctsrf in clmain and below. It was quite
troubling: pctsrf_new was intent out in interfoce_lim but only defined
for ocean and sea-ice. Also the idea of having arrays for all
surfaces, pcsrf and pctsrf_new, in interfsurf_hq, which is called for
a particular surface, was troubling. pctsrf_new for all surfaces was
intent out in intefsurf_hq, but not defined for all surfaces at each
call. Removed argument pctsrf_new of clmain: was a duplicate of pctsrf
on output, and not used in physiq. Replaced pctsrf_new in clmain by
pctsrf_new_oce and pctsrf_new_sic, which were the only ones modified.

1 module read_sst_m
2
3 implicit none
4
5 contains
6
7 SUBROUTINE read_sst(dtime, jour, knindex, debut, lmt_sst)
8
9 ! From interfoce_lim
10
11 USE dimphy, ONLY: klon
12 USE netcdf, ONLY: nf90_nowrite
13 use netcdf95, only: NF95_CLOSE, nf95_get_var, NF95_INQ_VARID, nf95_open
14 use nr_util, only: assert
15 use time_phylmdz, only: itap
16
17 real, intent(IN):: dtime ! pas de temps de la physique (en s)
18 integer, intent(IN):: jour ! jour a lire dans l'annee
19
20 integer, intent(in):: knindex(:) ! (knon)
21 ! index des points de la surface a traiter
22
23 logical, intent(IN):: debut ! 1er appel a la physique (initialisation)
24
25 real, intent(out):: lmt_sst(:) ! (knon)
26 ! SST lues dans le fichier de conditions aux limites
27
28 ! Local:
29
30 INTEGER, save:: lmt_pas ! frequence de lecture des conditions limites
31 ! (en pas de physique)
32
33 logical, save:: deja_lu
34 ! pour indiquer que le jour à lire a déjà été lu pour une surface
35 ! précédente
36
37 integer, save:: jour_lu
38
39 ! Champ lu dans le fichier de conditions aux limites :
40 real, allocatable, save:: sst_lu(:)
41
42 integer ncid, varid ! pour NetCDF
43
44 ! --------------------------------------------------
45
46 call assert(size(knindex) == size(lmt_sst), "read_sst knon")
47
48 if (debut .and. .not. allocated(sst_lu)) then
49 lmt_pas = nint(86400. / dtime) ! pour une lecture une fois par jour
50 jour_lu = jour - 1
51 allocate(sst_lu(klon))
52 endif
53
54 if ((jour - jour_lu) /= 0) deja_lu = .false.
55
56 ! Tester d'abord si c'est le moment de lire le fichier
57 if (mod(itap - 1, lmt_pas) == 0 .and. .not. deja_lu) then
58 call NF95_OPEN ('limit.nc', NF90_NOWRITE, ncid)
59
60 call NF95_INQ_VARID(ncid, 'SST', varid)
61 call NF95_GET_VAR(ncid, varid, sst_lu, start = (/1, jour/))
62
63 call NF95_CLOSE(ncid)
64 deja_lu = .true.
65 jour_lu = jour
66 endif
67
68 ! Recopie dans le champ de sortie
69 lmt_sst = sst_lu(knindex)
70
71 END SUBROUTINE read_sst
72
73 end module read_sst_m

  ViewVC Help
Powered by ViewVC 1.1.21