/[lmdze]/trunk/Sources/phylmd/phyetat0.f
ViewVC logotype

Annotation of /trunk/Sources/phylmd/phyetat0.f

Parent Directory Parent Directory | Revision Log Revision Log


Revision 175 - (hide annotations)
Fri Feb 5 16:02:34 2016 UTC (8 years, 3 months ago) by guez
File size: 11312 byte(s)
Added argument itau_phy to ini_histins, phyetat0, phytrac and
phyredem0. Removed variable itau_phy of module temps. Avoiding side
effect in etat0 and phyetat0. The procedures ini_histins, phyetat0,
phytrac and phyredem0 are all called by physiq so there is no
cascading variable penalty.

In procedure inifilr, made the condition on colat0 weaker to allow for
rounding error.

Removed arguments flux_o, flux_g and t_slab of clmain, flux_o and
flux_g of clqh and interfsurf_hq, tslab and seaice of phyetat0 and
phyredem. NetCDF variables TSLAB and SEAICE no longer in
restartphy.nc. All these variables were related to the not-implemented
slab ocean. seaice and tslab were just set to 0 in phyetat0 and never
used nor changed. flux_o and flux_g were computed in clmain but never
used in physiq.

Removed argument swnet of clqh. Was used only to compute a local
variable, swdown, which was not used.

1 guez 3 module phyetat0_m
2    
3 guez 15 use dimphy, only: klon
4 guez 12
5 guez 3 IMPLICIT none
6    
7 guez 138 REAL, save:: rlat(klon), rlon(klon)
8     ! latitude and longitude of a point of the scalar grid identified
9     ! by a simple index, in degrees
10 guez 3
11 guez 15 private klon
12 guez 3
13     contains
14    
15 guez 175 SUBROUTINE phyetat0(pctsrf, tsol, tsoil, qsurf, qsol, snow, albe, evap, &
16     rain_fall, snow_fall, solsw, sollw, fder, radsol, frugs, agesno, zmea, &
17     zstd, zsig, zgam, zthe, zpic, zval, t_ancien, q_ancien, ancien_ok, &
18     rnebcon, ratqs, clwcon, run_off_lic_0, sig1, w01, ncid_startphy, &
19     itau_phy)
20 guez 3
21 guez 49 ! From phylmd/phyetat0.F, version 1.4 2005/06/03 10:03:07
22     ! Author: Z.X. Li (LMD/CNRS)
23 guez 50 ! Date: 1993/08/18
24 guez 69 ! Objet : lecture de l'état initial pour la physique
25 guez 3
26 guez 69 use dimphy, only: zmasq, klev
27     USE dimsoil, ONLY : nsoilmx
28 guez 12 USE indicesol, ONLY : epsfra, is_lic, is_oce, is_sic, is_ter, nbsrf
29 guez 175 use netcdf, only: nf90_global, nf90_inq_varid, NF90_NOERR, NF90_NOWRITE
30 guez 101 use netcdf95, only: nf95_close, nf95_get_att, nf95_get_var, &
31     nf95_inq_varid, nf95_inquire_variable, NF95_OPEN
32 guez 12
33 guez 175 REAL, intent(out):: pctsrf(klon, nbsrf)
34     REAL, intent(out):: tsol(klon, nbsrf)
35     REAL, intent(out):: tsoil(klon, nsoilmx, nbsrf)
36     REAL, intent(out):: qsurf(klon, nbsrf)
37 guez 99 REAL, intent(out):: qsol(:) ! (klon)
38 guez 175 REAL, intent(out):: snow(klon, nbsrf)
39     REAL, intent(out):: albe(klon, nbsrf)
40     REAL, intent(out):: evap(klon, nbsrf)
41 guez 62 REAL, intent(out):: rain_fall(klon)
42 guez 175 REAL, intent(out):: snow_fall(klon)
43     real, intent(out):: solsw(klon)
44 guez 72 REAL, intent(out):: sollw(klon)
45 guez 175 real, intent(out):: fder(klon)
46     REAL, intent(out):: radsol(klon)
47     REAL, intent(out):: frugs(klon, nbsrf)
48     REAL, intent(out):: agesno(klon, nbsrf)
49 guez 174 REAL, intent(out):: zmea(klon)
50 guez 13 REAL, intent(out):: zstd(klon)
51     REAL, intent(out):: zsig(klon)
52 guez 175 REAL, intent(out):: zgam(klon)
53     REAL, intent(out):: zthe(klon)
54     REAL, intent(out):: zpic(klon)
55     REAL, intent(out):: zval(klon)
56     REAL, intent(out):: t_ancien(klon, klev), q_ancien(klon, klev)
57 guez 49 LOGICAL, intent(out):: ancien_ok
58 guez 175 real, intent(out):: rnebcon(klon, klev), ratqs(klon, klev)
59     REAL, intent(out):: clwcon(klon, klev), run_off_lic_0(klon)
60 guez 72 real, intent(out):: sig1(klon, klev) ! section adiabatic updraft
61 guez 3
62 guez 72 real, intent(out):: w01(klon, klev)
63     ! vertical velocity within adiabatic updraft
64 guez 3
65 guez 175 integer, intent(out):: ncid_startphy, itau_phy
66 guez 157
67 guez 72 ! Local:
68     REAL fractint(klon)
69 guez 157 INTEGER varid, ndims
70 guez 156 INTEGER ierr, i
71 guez 3
72     !---------------------------------------------------------------
73    
74     print *, "Call sequence information: phyetat0"
75    
76 guez 72 ! Fichier contenant l'état initial :
77 guez 157 call NF95_OPEN("startphy.nc", NF90_NOWRITE, ncid_startphy)
78 guez 3
79 guez 157 call nf95_get_att(ncid_startphy, nf90_global, "itau_phy", itau_phy)
80 guez 3
81     ! Lecture des latitudes (coordonnees):
82    
83 guez 157 call NF95_INQ_VARID(ncid_startphy, "latitude", varid)
84     call NF95_GET_VAR(ncid_startphy, varid, rlat)
85 guez 3
86     ! Lecture des longitudes (coordonnees):
87    
88 guez 157 call NF95_INQ_VARID(ncid_startphy, "longitude", varid)
89     call NF95_GET_VAR(ncid_startphy, varid, rlon)
90 guez 3
91     ! Lecture du masque terre mer
92    
93 guez 157 call NF95_INQ_VARID(ncid_startphy, "masque", varid)
94     call nf95_get_var(ncid_startphy, varid, zmasq)
95 guez 101
96 guez 3 ! Lecture des fractions pour chaque sous-surface
97    
98     ! initialisation des sous-surfaces
99    
100     pctsrf = 0.
101    
102     ! fraction de terre
103    
104 guez 157 ierr = NF90_INQ_VARID(ncid_startphy, "FTER", varid)
105 guez 50 IF (ierr == NF90_NOERR) THEN
106 guez 157 call nf95_get_var(ncid_startphy, varid, pctsrf(:, is_ter))
107 guez 3 else
108 guez 43 PRINT *, 'phyetat0: Le champ <FTER> est absent'
109 guez 3 ENDIF
110    
111     ! fraction de glace de terre
112    
113 guez 157 ierr = NF90_INQ_VARID(ncid_startphy, "FLIC", varid)
114 guez 50 IF (ierr == NF90_NOERR) THEN
115 guez 157 call nf95_get_var(ncid_startphy, varid, pctsrf(:, is_lic))
116 guez 3 else
117 guez 43 PRINT *, 'phyetat0: Le champ <FLIC> est absent'
118 guez 3 ENDIF
119    
120     ! fraction d'ocean
121    
122 guez 157 ierr = NF90_INQ_VARID(ncid_startphy, "FOCE", varid)
123 guez 50 IF (ierr == NF90_NOERR) THEN
124 guez 157 call nf95_get_var(ncid_startphy, varid, pctsrf(:, is_oce))
125 guez 3 else
126 guez 43 PRINT *, 'phyetat0: Le champ <FOCE> est absent'
127 guez 3 ENDIF
128    
129     ! fraction glace de mer
130    
131 guez 157 ierr = NF90_INQ_VARID(ncid_startphy, "FSIC", varid)
132 guez 50 IF (ierr == NF90_NOERR) THEN
133 guez 157 call nf95_get_var(ncid_startphy, varid, pctsrf(:, is_sic))
134 guez 3 else
135 guez 43 PRINT *, 'phyetat0: Le champ <FSIC> est absent'
136 guez 3 ENDIF
137    
138 guez 50 ! Verification de l'adequation entre le masque et les sous-surfaces
139 guez 3
140 guez 50 fractint = pctsrf(:, is_ter) + pctsrf(:, is_lic)
141 guez 3 DO i = 1 , klon
142 guez 50 IF ( abs(fractint(i) - zmasq(i) ) > EPSFRA ) THEN
143     WRITE(*, *) 'phyetat0: attention fraction terre pas ', &
144 guez 3 'coherente ', i, zmasq(i), pctsrf(i, is_ter) &
145 guez 49 , pctsrf(i, is_lic)
146 guez 3 ENDIF
147     END DO
148 guez 50 fractint = pctsrf(:, is_oce) + pctsrf(:, is_sic)
149 guez 3 DO i = 1 , klon
150 guez 50 IF ( abs( fractint(i) - (1. - zmasq(i))) > EPSFRA ) THEN
151     WRITE(*, *) 'phyetat0 attention fraction ocean pas ', &
152 guez 3 'coherente ', i, zmasq(i) , pctsrf(i, is_oce) &
153 guez 49 , pctsrf(i, is_sic)
154 guez 3 ENDIF
155     END DO
156    
157     ! Lecture des temperatures du sol:
158 guez 157 call NF95_INQ_VARID(ncid_startphy, "TS", varid)
159     call nf95_inquire_variable(ncid_startphy, varid, ndims = ndims)
160 guez 101 if (ndims == 2) then
161 guez 157 call NF95_GET_VAR(ncid_startphy, varid, tsol)
162 guez 101 else
163     print *, "Found only one surface type for soil temperature."
164 guez 157 call nf95_get_var(ncid_startphy, varid, tsol(:, 1))
165 guez 101 tsol(:, 2:nbsrf) = spread(tsol(:, 1), dim = 2, ncopies = nbsrf - 1)
166 guez 156 end if
167 guez 3
168 guez 156 ! Lecture des temperatures du sol profond:
169 guez 3
170 guez 157 call NF95_INQ_VARID(ncid_startphy, 'Tsoil', varid)
171     call NF95_GET_VAR(ncid_startphy, varid, tsoil)
172 guez 3
173     ! Lecture de l'humidite de l'air juste au dessus du sol:
174    
175 guez 157 call NF95_INQ_VARID(ncid_startphy, "QS", varid)
176     call nf95_get_var(ncid_startphy, varid, qsurf)
177 guez 3
178     ! Eau dans le sol (pour le modele de sol "bucket")
179    
180 guez 157 ierr = NF90_INQ_VARID(ncid_startphy, "QSOL", varid)
181 guez 50 IF (ierr == NF90_NOERR) THEN
182 guez 157 call nf95_get_var(ncid_startphy, varid, qsol)
183 guez 3 else
184 guez 43 PRINT *, 'phyetat0: Le champ <QSOL> est absent'
185 guez 50 PRINT *, ' Valeur par defaut nulle'
186 guez 43 qsol = 0.
187 guez 3 ENDIF
188    
189     ! Lecture de neige au sol:
190    
191 guez 157 call NF95_INQ_VARID(ncid_startphy, "SNOW", varid)
192     call nf95_get_var(ncid_startphy, varid, snow)
193 guez 3
194     ! Lecture de albedo au sol:
195    
196 guez 157 call NF95_INQ_VARID(ncid_startphy, "ALBE", varid)
197     call nf95_get_var(ncid_startphy, varid, albe)
198 guez 3
199 guez 50 ! Lecture de evaporation:
200 guez 3
201 guez 157 call NF95_INQ_VARID(ncid_startphy, "EVAP", varid)
202     call nf95_get_var(ncid_startphy, varid, evap)
203 guez 3
204     ! Lecture precipitation liquide:
205    
206 guez 157 call NF95_INQ_VARID(ncid_startphy, "rain_f", varid)
207     call NF95_GET_VAR(ncid_startphy, varid, rain_fall)
208 guez 3
209     ! Lecture precipitation solide:
210    
211 guez 157 call NF95_INQ_VARID(ncid_startphy, "snow_f", varid)
212     call NF95_GET_VAR(ncid_startphy, varid, snow_fall)
213 guez 3
214     ! Lecture rayonnement solaire au sol:
215    
216 guez 157 ierr = NF90_INQ_VARID(ncid_startphy, "solsw", varid)
217 guez 49 IF (ierr /= NF90_NOERR) THEN
218 guez 43 PRINT *, 'phyetat0: Le champ <solsw> est absent'
219     PRINT *, 'mis a zero'
220 guez 3 solsw = 0.
221     ELSE
222 guez 157 call nf95_get_var(ncid_startphy, varid, solsw)
223 guez 3 ENDIF
224    
225     ! Lecture rayonnement IF au sol:
226    
227 guez 157 ierr = NF90_INQ_VARID(ncid_startphy, "sollw", varid)
228 guez 49 IF (ierr /= NF90_NOERR) THEN
229 guez 43 PRINT *, 'phyetat0: Le champ <sollw> est absent'
230     PRINT *, 'mis a zero'
231 guez 3 sollw = 0.
232     ELSE
233 guez 157 call nf95_get_var(ncid_startphy, varid, sollw)
234 guez 3 ENDIF
235    
236     ! Lecture derive des flux:
237    
238 guez 157 ierr = NF90_INQ_VARID(ncid_startphy, "fder", varid)
239 guez 49 IF (ierr /= NF90_NOERR) THEN
240 guez 43 PRINT *, 'phyetat0: Le champ <fder> est absent'
241     PRINT *, 'mis a zero'
242 guez 3 fder = 0.
243     ELSE
244 guez 157 call nf95_get_var(ncid_startphy, varid, fder)
245 guez 3 ENDIF
246    
247     ! Lecture du rayonnement net au sol:
248    
249 guez 157 call NF95_INQ_VARID(ncid_startphy, "RADS", varid)
250     call NF95_GET_VAR(ncid_startphy, varid, radsol)
251 guez 3
252     ! Lecture de la longueur de rugosite
253    
254 guez 157 call NF95_INQ_VARID(ncid_startphy, "RUG", varid)
255     call nf95_get_var(ncid_startphy, varid, frugs)
256 guez 3
257     ! Lecture de l'age de la neige:
258    
259 guez 157 call NF95_INQ_VARID(ncid_startphy, "AGESNO", varid)
260     call nf95_get_var(ncid_startphy, varid, agesno)
261 guez 3
262 guez 157 call NF95_INQ_VARID(ncid_startphy, "ZMEA", varid)
263     call NF95_GET_VAR(ncid_startphy, varid, zmea)
264 guez 3
265 guez 157 call NF95_INQ_VARID(ncid_startphy, "ZSTD", varid)
266     call NF95_GET_VAR(ncid_startphy, varid, zstd)
267 guez 3
268 guez 157 call NF95_INQ_VARID(ncid_startphy, "ZSIG", varid)
269     call NF95_GET_VAR(ncid_startphy, varid, zsig)
270 guez 3
271 guez 157 call NF95_INQ_VARID(ncid_startphy, "ZGAM", varid)
272     call NF95_GET_VAR(ncid_startphy, varid, zgam)
273 guez 3
274 guez 157 call NF95_INQ_VARID(ncid_startphy, "ZTHE", varid)
275     call NF95_GET_VAR(ncid_startphy, varid, zthe)
276 guez 3
277 guez 157 call NF95_INQ_VARID(ncid_startphy, "ZPIC", varid)
278     call NF95_GET_VAR(ncid_startphy, varid, zpic)
279 guez 3
280 guez 157 call NF95_INQ_VARID(ncid_startphy, "ZVAL", varid)
281     call NF95_GET_VAR(ncid_startphy, varid, zval)
282 guez 3
283     ancien_ok = .TRUE.
284    
285 guez 157 ierr = NF90_INQ_VARID(ncid_startphy, "TANCIEN", varid)
286 guez 49 IF (ierr /= NF90_NOERR) THEN
287 guez 43 PRINT *, "phyetat0: Le champ <TANCIEN> est absent"
288     PRINT *, "Depart legerement fausse. Mais je continue"
289 guez 3 ancien_ok = .FALSE.
290     ELSE
291 guez 157 call nf95_get_var(ncid_startphy, varid, t_ancien)
292 guez 3 ENDIF
293    
294 guez 157 ierr = NF90_INQ_VARID(ncid_startphy, "QANCIEN", varid)
295 guez 49 IF (ierr /= NF90_NOERR) THEN
296 guez 43 PRINT *, "phyetat0: Le champ <QANCIEN> est absent"
297     PRINT *, "Depart legerement fausse. Mais je continue"
298 guez 3 ancien_ok = .FALSE.
299     ELSE
300 guez 157 call nf95_get_var(ncid_startphy, varid, q_ancien)
301 guez 3 ENDIF
302    
303 guez 157 ierr = NF90_INQ_VARID(ncid_startphy, "CLWCON", varid)
304 guez 49 IF (ierr /= NF90_NOERR) THEN
305 guez 43 PRINT *, "phyetat0: Le champ CLWCON est absent"
306     PRINT *, "Depart legerement fausse. Mais je continue"
307 guez 3 clwcon = 0.
308     ELSE
309 guez 157 call nf95_get_var(ncid_startphy, varid, clwcon(:, 1))
310 guez 72 clwcon(:, 2:) = 0.
311 guez 3 ENDIF
312    
313 guez 157 ierr = NF90_INQ_VARID(ncid_startphy, "RNEBCON", varid)
314 guez 49 IF (ierr /= NF90_NOERR) THEN
315 guez 43 PRINT *, "phyetat0: Le champ RNEBCON est absent"
316     PRINT *, "Depart legerement fausse. Mais je continue"
317 guez 3 rnebcon = 0.
318     ELSE
319 guez 157 call nf95_get_var(ncid_startphy, varid, rnebcon(:, 1))
320 guez 72 rnebcon(:, 2:) = 0.
321 guez 3 ENDIF
322    
323     ! Lecture ratqs
324    
325 guez 157 ierr = NF90_INQ_VARID(ncid_startphy, "RATQS", varid)
326 guez 49 IF (ierr /= NF90_NOERR) THEN
327 guez 43 PRINT *, "phyetat0: Le champ <RATQS> est absent"
328     PRINT *, "Depart legerement fausse. Mais je continue"
329 guez 3 ratqs = 0.
330     ELSE
331 guez 157 call nf95_get_var(ncid_startphy, varid, ratqs(:, 1))
332 guez 72 ratqs(:, 2:) = 0.
333 guez 3 ENDIF
334    
335     ! Lecture run_off_lic_0
336    
337 guez 157 ierr = NF90_INQ_VARID(ncid_startphy, "RUNOFFLIC0", varid)
338 guez 49 IF (ierr /= NF90_NOERR) THEN
339 guez 43 PRINT *, "phyetat0: Le champ <RUNOFFLIC0> est absent"
340     PRINT *, "Depart legerement fausse. Mais je continue"
341 guez 3 run_off_lic_0 = 0.
342     ELSE
343 guez 157 call nf95_get_var(ncid_startphy, varid, run_off_lic_0)
344 guez 3 ENDIF
345    
346 guez 157 call nf95_inq_varid(ncid_startphy, "sig1", varid)
347     call nf95_get_var(ncid_startphy, varid, sig1)
348 guez 72
349 guez 157 call nf95_inq_varid(ncid_startphy, "w01", varid)
350     call nf95_get_var(ncid_startphy, varid, w01)
351 guez 72
352 guez 3 END SUBROUTINE phyetat0
353    
354     end module phyetat0_m

  ViewVC Help
Powered by ViewVC 1.1.21