/[lmdze]/trunk/phylmd/condsurf.f
ViewVC logotype

Contents of /trunk/phylmd/condsurf.f

Parent Directory Parent Directory | Revision Log Revision Log


Revision 82 - (show annotations)
Wed Mar 5 14:57:53 2014 UTC (10 years, 2 months ago) by guez
File size: 3002 byte(s)
Changed all ".f90" suffixes to ".f".
1 ! $Header: /home/cvsroot/LMDZ4/libf/phylmd/condsurf.F,v 1.2 2005/12/01
2 ! 11:27:29 fairhead Exp $
3
4 SUBROUTINE condsurf(jour, jourvrai, lmt_bils)
5 USE dimens_m
6 USE indicesol
7 USE dimphy
8 USE temps
9 USE clesphys2, ONLY: ok_limitvrai
10 USE netcdf
11 IMPLICIT NONE
12
13 ! I. Musat 05.2005
14
15 ! Lire chaque jour le bilan de chaleur au sol issu
16 ! d'un run atmospherique afin de l'utiliser dans
17 ! dans un run "slab" ocean
18 ! -----------------------------------------
19 ! jour : input , numero du jour a lire
20 ! jourvrai : input , vrai jour de la simulation
21
22 ! lmt_bils: bilan chaleur au sol (a utiliser pour "slab-ocean")
23
24 INTEGER nid, nvarid
25 INTEGER debut(2)
26 INTEGER epais(2)
27
28
29 INTEGER nannemax
30 PARAMETER (nannemax=60)
31
32 INTEGER jour
33 INTEGER jourvrai
34 REAL lmt_bils(klon) !bilan chaleur au sol
35
36 ! Variables locales:
37 INTEGER ig, i, kt, ierr
38 LOGICAL ok
39 INTEGER anneelim, anneemax
40 CHARACTER *20 fich
41 ! c
42 ! c .....................................................................
43 ! c
44 ! c Pour lire le fichier limit correspondant vraiment a l'annee de la
45 ! c simulation en cours , il suffit de mettre ok_limitvrai = .TRUE.
46 ! c
47 ! c
48 ! ......................................................................
49
50
51 IF (jour<0 .OR. jour>(360-1)) THEN
52 PRINT *, 'Le jour demande n est pas correct: ', jour
53 STOP 1
54 END IF
55
56 anneelim = annee_ref
57 anneemax = annee_ref + nannemax
58
59
60 IF (ok_limitvrai) THEN
61 DO kt = 1, nannemax
62 IF (jourvrai<=(kt-1)*360+359) THEN
63 WRITE (fich, '("limit",i4,".nc")') anneelim
64 ! PRINT *,' Fichier Limite ',fich
65 GO TO 100
66 END IF
67 anneelim = anneelim + 1
68 END DO
69
70 PRINT *, ' PBS ! Le jour a lire sur le fichier limit ne se '
71 PRINT *, ' trouve pas sur les ', nannemax, ' annees a partir de '
72 PRINT *, ' l annee de debut', annee_ref
73 STOP 1
74
75 100 CONTINUE
76
77 ELSE
78
79 WRITE (fich, '("limitNEW.nc")')
80 ! PRINT *,' Fichier Limite ',fich
81 END IF
82
83 ! Ouvrir le fichier en format NetCDF:
84
85 ierr = nf90_open(fich, nf90_nowrite, nid)
86 IF (ierr/=nf90_noerr) THEN
87 WRITE (6, *) ' Pb d''ouverture du fichier ', fich
88 WRITE (6, *) ' Le fichier limit ', fich, ' (avec 4 chiffres , pour'
89 WRITE (6, *) ' l an 2000 ) , n existe pas ! '
90 WRITE (6, *) ' ierr = ', ierr
91 STOP 1
92 END IF
93 ! DO k = 1, jour
94 ! La tranche de donnees a lire:
95
96 debut(1) = 1
97 debut(2) = jour
98 epais(1) = klon
99 epais(2) = 1
100
101 ! Bilan flux de chaleur au sol:
102
103 ierr = nf90_inq_varid(nid, 'BILS', nvarid)
104 IF (ierr/=nf90_noerr) THEN
105 PRINT *, 'condsurf: Le champ <BILS> est absent'
106 STOP 1
107 END IF
108 ! PRINT*,'debut,epais',debut,epais
109 ierr = nf90_get_var(nid, nvarid, lmt_bils, debut, epais)
110 IF (ierr/=nf90_noerr) THEN
111 PRINT *, 'condsurf: Lecture echouee pour <BILS>'
112 STOP 1
113 END IF
114 ! ENDDO !k = 1, jour
115
116 ! Fermer le fichier:
117
118 ierr = nf90_close(nid)
119
120
121 ! PRINT*, 'lmt_bils est lu pour jour: ', jour
122
123 RETURN
124 END SUBROUTINE condsurf

Properties

Name Value
svn:executable

  ViewVC Help
Powered by ViewVC 1.1.21