1 |
module interfsur_lim_m |
2 |
|
3 |
implicit none |
4 |
|
5 |
contains |
6 |
|
7 |
SUBROUTINE interfsur_lim(jour, knindex, albedo, z0_new) |
8 |
|
9 |
! Cette routine sert d'interface entre le mod\`ele atmosph\'erique et |
10 |
! un fichier de conditions aux limites. |
11 |
|
12 |
! Laurent FAIRHEAD, February 2000 |
13 |
|
14 |
use conf_gcm_m, only: lmt_pas |
15 |
USE dimphy, ONLY: klon |
16 |
use netcdf, only: NF90_NOWRITE |
17 |
use netcdf95, only: NF95_close, NF95_GET_VAR, NF95_INQ_VARID, NF95_OPEN |
18 |
use time_phylmdz, only: itap |
19 |
|
20 |
integer, intent(IN):: jour ! jour a lire dans l'annee |
21 |
|
22 |
integer, intent(in):: knindex(:) ! (knon) |
23 |
! index des points de la surface \`a traiter |
24 |
|
25 |
real, intent(out):: albedo(:) ! (knon) albedo lu |
26 |
real, intent(out):: z0_new(:) ! (knon) longueur de rugosit\'e lue |
27 |
|
28 |
! Local: |
29 |
|
30 |
logical, save:: deja_lu_sur |
31 |
! jour \`a lire d\'ej\`a lu pour une surface pr\'ec\'edente |
32 |
|
33 |
integer:: jour_lu_sur = - 1 |
34 |
|
35 |
! Champs lus dans le fichier de conditions aux limites : |
36 |
real, save:: alb_lu(klon), rug_lu(klon) |
37 |
|
38 |
integer ncid, varid |
39 |
|
40 |
!------------------------------------------------------------ |
41 |
|
42 |
if (jour - jour_lu_sur /= 0) deja_lu_sur = .false. |
43 |
|
44 |
! Tester d'abord si c'est le moment de lire le fichier |
45 |
if (mod(itap - 1, lmt_pas) == 0 .and. .not. deja_lu_sur) then |
46 |
call NF95_OPEN('limit.nc', NF90_NOWRITE, ncid) |
47 |
|
48 |
! Lecture Albedo |
49 |
call NF95_INQ_VARID(ncid, 'ALB', varid) |
50 |
call NF95_GET_VAR(ncid, varid, alb_lu, start=(/1, jour/)) |
51 |
|
52 |
! Lecture rugosit\'e |
53 |
call NF95_INQ_VARID(ncid, 'RUG', varid) |
54 |
call NF95_GET_VAR(ncid, varid, rug_lu, start=(/1, jour/)) |
55 |
|
56 |
call NF95_CLOSE(ncid) |
57 |
deja_lu_sur = .true. |
58 |
jour_lu_sur = jour |
59 |
endif |
60 |
|
61 |
! Recopie des variables dans les champs de sortie |
62 |
albedo = alb_lu(knindex) |
63 |
z0_new = rug_lu(knindex) |
64 |
|
65 |
END SUBROUTINE interfsur_lim |
66 |
|
67 |
end module interfsur_lim_m |