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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 154 - (show annotations)
Tue Jul 7 17:49:23 2015 UTC (8 years, 10 months ago) by guez
File size: 15374 byte(s)
Removed argument dtphys of physiq. Use it directly from comconst in
physiq instead.

Donwgraded variables eignfnu, eignfnv of module inifgn_m to dummy
arguments of SUBROUTINE inifgn. They were not used elsewhere than in
the calling procedure inifilr. Renamed argument dv of inifgn to eignval_v.

Made alboc and alboc_cd independent of the size of arguments. Now we
can call them only at indices knindex in interfsurf_hq, where we need
them. Fixed a bug in alboc_cd: rmu0 was modified, and the
corresponding actual argument in interfsurf_hq is an intent(in)
argument of interfsurf_hq.

Variables of size knon instead of klon in interfsur_lim and interfsurf_hq.

Removed argument alb_new of interfsurf_hq because it was the same than
alblw. Simplified test on cycle_diurne, following LMDZ.

Moved tests on nbapp_rad from physiq to read_clesphys2. No need for
separate counter itaprad, we can use itap. Define lmt_pas and radpas
from integer input parameters instead of real-type computed values.

1 module interfsurf_hq_m
2
3 implicit none
4
5 contains
6
7 SUBROUTINE interfsurf_hq(itime, dtime, jour, rmu0, nisurf, knon, knindex, &
8 pctsrf, rlat, debut, nsoilmx, tsoil, qsol, u1_lay, v1_lay, temp_air, &
9 spechum, tq_cdrag, petAcoef, peqAcoef, petBcoef, peqBcoef, &
10 precip_rain, precip_snow, fder, rugos, rugoro, snow, qsurf, tsurf, &
11 p1lay, ps, radsol, evap, fluxsens, fluxlat, dflux_l, dflux_s, &
12 tsurf_new, alblw, z0_new, pctsrf_new, agesno, fqcalving, ffonte, &
13 run_off_lic_0, flux_o, flux_g)
14
15 ! Cette routine sert d'aiguillage entre l'atmosph\`ere et la surface
16 ! en g\'en\'eral (sols continentaux, oc\'eans, glaces) pour les flux de
17 ! chaleur et d'humidit\'e.
18
19 ! Laurent Fairhead, February 2000
20
21 USE abort_gcm_m, ONLY: abort_gcm
22 use alboc_cd_m, only: alboc_cd
23 use alboc_m, only: alboc
24 USE albsno_m, ONLY: albsno
25 use calbeta_m, only: calbeta
26 USE calcul_fluxs_m, ONLY: calcul_fluxs
27 use clesphys2, only: soil_model, cycle_diurne
28 USE dimphy, ONLY: klon
29 USE fonte_neige_m, ONLY: fonte_neige
30 USE indicesol, ONLY: epsfra, is_lic, is_oce, is_sic, is_ter, nbsrf
31 USE interface_surf, ONLY: run_off, run_off_lic, conf_interface
32 USE interfoce_lim_m, ONLY: interfoce_lim
33 USE interfsur_lim_m, ONLY: interfsur_lim
34 use soil_m, only: soil
35 USE suphec_m, ONLY: rcpd, rlstt, rlvtt, rtt
36
37 integer, intent(IN):: itime ! numero du pas de temps
38 real, intent(IN):: dtime ! pas de temps de la physique (en s)
39 integer, intent(IN):: jour ! jour dans l'annee en cours
40 real, intent(IN):: rmu0(klon) ! cosinus de l'angle solaire zenithal
41 integer, intent(IN):: nisurf ! index de la surface a traiter
42 integer, intent(IN):: knon ! nombre de points de la surface a traiter
43
44 integer, intent(in):: knindex(:) ! (knon)
45 ! index des points de la surface a traiter
46
47 real, intent(IN):: pctsrf(klon, nbsrf)
48 ! tableau des pourcentages de surface de chaque maille
49
50 real, intent(IN):: rlat(klon) ! latitudes
51
52 logical, intent(IN):: debut ! 1er appel a la physique
53 ! (si false calcul simplifie des fluxs sur les continents)
54
55 integer, intent(in):: nsoilmx
56 REAL tsoil(klon, nsoilmx)
57
58 REAL, intent(INOUT):: qsol(klon)
59 ! column-density of water in soil, in kg m-2
60
61 real, dimension(klon), intent(IN):: u1_lay, v1_lay
62 ! u1_lay vitesse u 1ere couche
63 ! v1_lay vitesse v 1ere couche
64 real, dimension(klon), intent(IN):: temp_air, spechum
65 ! temp_air temperature de l'air 1ere couche
66 ! spechum humidite specifique 1ere couche
67 real, dimension(klon), intent(INOUT):: tq_cdrag
68 ! tq_cdrag cdrag
69 real, dimension(klon), intent(IN):: petAcoef, peqAcoef
70 ! petAcoef coeff. A de la resolution de la CL pour t
71 ! peqAcoef coeff. A de la resolution de la CL pour q
72 real, dimension(klon), intent(IN):: petBcoef, peqBcoef
73 ! petBcoef coeff. B de la resolution de la CL pour t
74 ! peqBcoef coeff. B de la resolution de la CL pour q
75
76 real, intent(IN):: precip_rain(klon)
77 ! precipitation, liquid water mass flux (kg/m2/s), positive down
78
79 real, intent(IN):: precip_snow(klon)
80 ! precipitation, solid water mass flux (kg/m2/s), positive down
81
82 REAL, INTENT(INOUT):: fder(klon) ! derivee des flux (pour le couplage)
83 real, intent(IN):: rugos(klon) ! rugosite
84 real, intent(IN):: rugoro(klon) ! rugosite orographique
85 real, intent(INOUT):: snow(klon), qsurf(klon)
86 real, intent(IN):: tsurf(:) ! (knon) temp\'erature de surface
87 real, dimension(klon), intent(IN):: p1lay
88 ! p1lay pression 1er niveau (milieu de couche)
89 real, dimension(klon), intent(IN):: ps
90 ! ps pression au sol
91 REAL, DIMENSION(klon), INTENT(INOUT):: radsol
92 ! radsol rayonnement net aus sol (LW + SW)
93 real, intent(INOUT):: evap(klon) ! evaporation totale
94 real, dimension(klon), intent(OUT):: fluxsens, fluxlat
95 ! fluxsens flux de chaleur sensible
96 ! fluxlat flux de chaleur latente
97 real, dimension(klon), intent(OUT):: dflux_l, dflux_s
98 real, intent(OUT):: tsurf_new(knon) ! temp\'erature au sol
99 real, intent(OUT):: alblw(:) ! (knon) albedo
100 real, intent(OUT):: z0_new(klon) ! surface roughness
101 real, dimension(klon, nbsrf), intent(OUT):: pctsrf_new
102 ! pctsrf_new nouvelle repartition des surfaces
103 real, dimension(klon), intent(INOUT):: agesno
104
105 ! Flux d'eau "perdue" par la surface et n\'ecessaire pour que limiter la
106 ! hauteur de neige, en kg/m2/s
107 !jld a rajouter real, dimension(klon), intent(INOUT):: fqcalving
108 real, dimension(klon), intent(INOUT):: fqcalving
109
110 ! Flux thermique utiliser pour fondre la neige
111 !jld a rajouter real, dimension(klon), intent(INOUT):: ffonte
112 real, dimension(klon), intent(INOUT):: ffonte
113
114 real, dimension(klon), intent(INOUT):: run_off_lic_0
115 ! run_off_lic_0 runoff glacier du pas de temps precedent
116
117 !IM: "slab" ocean
118 real, dimension(klon), intent(OUT):: flux_o, flux_g
119
120 ! Local:
121
122 REAL, dimension(klon):: soilcap
123 REAL, dimension(klon):: soilflux
124
125 !IM: "slab" ocean
126 real, parameter:: t_grnd=271.35
127 integer i
128
129 character (len = 20), save:: modname = 'interfsurf_hq'
130 character (len = 80):: abort_message
131 logical, save:: first_call = .true.
132 integer:: ii
133 real, dimension(klon):: cal, beta, dif_grnd, capsol
134 real, parameter:: calice=1.0/(5.1444e6 * 0.15), tau_gl=86400. * 5.
135 real, parameter:: calsno=1./(2.3867e6 * 0.15)
136 real tsurf_temp(knon)
137 real alb_neig(klon)
138 real zfra(klon)
139
140 !-------------------------------------------------------------
141
142 ! On doit commencer par appeler les schemas de surfaces continentales
143 ! car l'ocean a besoin du ruissellement qui est y calcule
144
145 if (first_call) then
146 call conf_interface
147 if (nisurf /= is_ter .and. klon > 1) then
148 print *, ' Warning:'
149 print *, ' nisurf = ', nisurf, ' /= is_ter = ', is_ter
150 print *, 'or on doit commencer par les surfaces continentales'
151 abort_message='voir ci-dessus'
152 call abort_gcm(modname, abort_message, 1)
153 endif
154 if (is_oce > is_sic) then
155 print *, 'Warning:'
156 print *, ' Pour des raisons de sequencement dans le code'
157 print *, ' l''ocean doit etre traite avant la banquise'
158 print *, ' or is_oce = ', is_oce, '> is_sic = ', is_sic
159 abort_message='voir ci-dessus'
160 call abort_gcm(modname, abort_message, 1)
161 endif
162 endif
163 first_call = .false.
164
165 ! Initialisations diverses
166
167 ffonte(1:knon)=0.
168 fqcalving(1:knon)=0.
169 cal = 999999.
170 beta = 999999.
171 dif_grnd = 999999.
172 capsol = 999999.
173 z0_new = 999999.
174 alb_neig = 999999.
175 tsurf_new = 999999.
176
177 !IM: "slab" ocean; initialisations
178 flux_o = 0.
179 flux_g = 0.
180
181 ! Aiguillage vers les differents schemas de surface
182
183 select case (nisurf)
184 case (is_ter)
185 ! Surface "terre" appel a l'interface avec les sols continentaux
186
187 ! allocation du run-off
188 if (.not. allocated(run_off)) then
189 allocate(run_off(knon))
190 run_off = 0.
191 else if (size(run_off) /= knon) then
192 print *, 'Bizarre, le nombre de points continentaux'
193 print *, 'a change entre deux appels. J''arrete '
194 abort_message='voir ci-dessus'
195 call abort_gcm(modname, abort_message, 1)
196 endif
197
198 ! Calcul age de la neige
199
200 ! calcul albedo: lecture albedo fichier boundary conditions
201 ! puis ajout albedo neige
202 call interfsur_lim(itime, dtime, jour, knindex, debut, alblw, z0_new)
203
204 ! calcul snow et qsurf, hydrol adapt\'e
205 CALL calbeta(nisurf, snow(:knon), qsol(:knon), beta(:knon), &
206 capsol(:knon), dif_grnd(:knon))
207
208 IF (soil_model) THEN
209 CALL soil(dtime, nisurf, knon, snow, tsurf, tsoil, soilcap, soilflux)
210 cal(1:knon) = RCPD / soilcap(1:knon)
211 radsol(1:knon) = radsol(1:knon) + soilflux(:knon)
212 ELSE
213 cal = RCPD * capsol
214 ENDIF
215 CALL calcul_fluxs(nisurf, dtime, tsurf, p1lay(:knon), cal(:knon), &
216 beta(:knon), tq_cdrag(:knon), ps(:knon), qsurf(:knon), &
217 radsol(:knon), dif_grnd(:knon), temp_air(:knon), spechum(:knon), &
218 u1_lay(:knon), v1_lay(:knon), petAcoef(:knon), peqAcoef(:knon), &
219 petBcoef(:knon), peqBcoef(:knon), tsurf_new, evap(:knon), &
220 fluxlat(:knon), fluxsens(:knon), dflux_s(:knon), dflux_l(:knon))
221
222 CALL fonte_neige(nisurf, dtime, tsurf, p1lay(:knon), beta(:knon), &
223 tq_cdrag(:knon), ps(:knon), precip_rain(:knon), &
224 precip_snow(:knon), snow(:knon), qsol(:knon), temp_air(:knon), &
225 spechum(:knon), u1_lay(:knon), v1_lay(:knon), petAcoef(:knon), &
226 peqAcoef(:knon), petBcoef(:knon), peqBcoef(:knon), tsurf_new, &
227 evap(:knon), fqcalving(:knon), ffonte(:knon), run_off_lic_0(:knon))
228
229 call albsno(klon, knon, dtime, agesno, alb_neig, precip_snow)
230 where (snow(1 : knon) < 0.0001) agesno(1 : knon) = 0.
231 zfra(:knon) = max(0.0, min(1.0, snow(1:knon)/(snow(1:knon) + 10.0)))
232 alblw = alb_neig(:knon) * zfra(:knon) &
233 + alblw * (1. - zfra(:knon))
234 z0_new = sqrt(z0_new**2 + rugoro**2)
235
236 ! Remplissage des pourcentages de surface
237 pctsrf_new(:, nisurf) = pctsrf(:, nisurf)
238 case (is_oce)
239 ! Surface "ocean" appel \`a l'interface avec l'oc\'ean
240 ! lecture conditions limites
241 call interfoce_lim(itime, dtime, jour, knindex, debut, tsurf_temp, &
242 pctsrf_new)
243
244 cal = 0.
245 beta = 1.
246 dif_grnd = 0.
247 alb_neig = 0.
248 agesno = 0.
249 call calcul_fluxs(nisurf, dtime, tsurf_temp, p1lay(:knon), &
250 cal(:knon), beta(:knon), tq_cdrag(:knon), ps(:knon), &
251 qsurf(:knon), radsol(:knon), dif_grnd(:knon), temp_air(:knon), &
252 spechum(:knon), u1_lay(:knon), v1_lay(:knon), petAcoef(:knon), &
253 peqAcoef(:knon), petBcoef(:knon), peqBcoef(:knon), &
254 tsurf_new, evap(:knon), fluxlat(:knon), fluxsens(:knon), &
255 dflux_s(:knon), dflux_l(:knon))
256 fder = fder + dflux_s + dflux_l
257
258 !IM: flux ocean-atmosphere utile pour le "slab" ocean
259 flux_o(:knon) = fluxsens(:knon) - evap(:knon) &
260 * merge(RLSTT, RLVTT, tsurf_new < RTT)
261
262 ! calcul albedo
263 if (cycle_diurne) then
264 CALL alboc_cd(rmu0(knindex), alblw)
265 else
266 CALL alboc(jour, rlat(knindex), alblw)
267 endif
268
269 z0_new = sqrt(rugos**2 + rugoro**2)
270 case (is_sic)
271 ! Surface "glace de mer" appel a l'interface avec l'ocean
272
273 ! ! lecture conditions limites
274 CALL interfoce_lim(itime, dtime, jour, knindex, debut, tsurf_new, &
275 pctsrf_new)
276
277 DO ii = 1, knon
278 tsurf_new(ii) = tsurf(ii)
279 IF (pctsrf_new(knindex(ii), nisurf) < EPSFRA) then
280 snow(ii) = 0.0
281 tsurf_new(ii) = RTT - 1.8
282 IF (soil_model) tsoil(ii, :) = RTT - 1.8
283 endif
284 enddo
285
286 CALL calbeta(nisurf, snow(:knon), qsol(:knon), beta(:knon), &
287 capsol(:knon), dif_grnd(:knon))
288
289 IF (soil_model) THEN
290 CALL soil(dtime, nisurf, knon, snow, tsurf_new, tsoil, soilcap, &
291 soilflux)
292 cal(1:knon) = RCPD / soilcap(1:knon)
293 radsol(1:knon) = radsol(1:knon) + soilflux(1:knon)
294 dif_grnd = 0.
295 ELSE
296 dif_grnd = 1.0 / tau_gl
297 cal = RCPD * calice
298 WHERE (snow > 0.0) cal = RCPD * calsno
299 ENDIF
300 tsurf_temp = tsurf_new
301 beta = 1.0
302
303 CALL calcul_fluxs(nisurf, dtime, tsurf_temp, p1lay(:knon), cal(:knon), &
304 beta(:knon), tq_cdrag(:knon), ps(:knon), qsurf(:knon), &
305 radsol(:knon), dif_grnd(:knon), temp_air(:knon), spechum(:knon), &
306 u1_lay(:knon), v1_lay(:knon), petAcoef(:knon), peqAcoef(:knon), &
307 petBcoef(:knon), peqBcoef(:knon), tsurf_new, evap(:knon), &
308 fluxlat(:knon), fluxsens(:knon), dflux_s(:knon), dflux_l(:knon))
309
310 !IM: flux entre l'ocean et la glace de mer pour le "slab" ocean
311 DO i = 1, knon
312 flux_g(i) = 0.0
313 IF (cal(i) > 1e-15) flux_g(i) = (tsurf_new(i) - t_grnd) &
314 * dif_grnd(i) * RCPD / cal(i)
315 ENDDO
316
317 CALL fonte_neige(nisurf, dtime, tsurf_temp, p1lay(:knon), beta(:knon), &
318 tq_cdrag(:knon), ps(:knon), precip_rain(:knon), &
319 precip_snow(:knon), snow(:knon), qsol(:knon), temp_air(:knon), &
320 spechum(:knon), u1_lay(:knon), v1_lay(:knon), petAcoef(:knon), &
321 peqAcoef(:knon), petBcoef(:knon), peqBcoef(:knon), tsurf_new, &
322 evap(:knon), fqcalving(:knon), ffonte(:knon), run_off_lic_0(:knon))
323
324 ! calcul albedo
325
326 CALL albsno(klon, knon, dtime, agesno, alb_neig, precip_snow)
327 WHERE (snow(1 : knon) < 0.0001) agesno(1 : knon) = 0.
328 zfra(:knon) = MAX(0.0, MIN(1.0, snow(1:knon)/(snow(1:knon) + 10.0)))
329 alblw = alb_neig(:knon) * zfra(:knon) + 0.6 * (1.0 - zfra(:knon))
330
331 fder = fder + dflux_s + dflux_l
332
333 ! 2eme appel a interfoce pour le cumul et le passage des flux a l'ocean
334
335 z0_new = 0.002
336 z0_new = SQRT(z0_new**2 + rugoro**2)
337 case (is_lic)
338 if (.not. allocated(run_off_lic)) then
339 allocate(run_off_lic(knon))
340 run_off_lic = 0.
341 endif
342
343 ! Surface "glacier continentaux" appel a l'interface avec le sol
344
345 IF (soil_model) THEN
346 CALL soil(dtime, nisurf, knon, snow, tsurf, tsoil, soilcap, soilflux)
347 cal(1:knon) = RCPD / soilcap(1:knon)
348 radsol(1:knon) = radsol(1:knon) + soilflux(1:knon)
349 ELSE
350 cal = RCPD * calice
351 WHERE (snow > 0.0) cal = RCPD * calsno
352 ENDIF
353 beta = 1.0
354 dif_grnd = 0.0
355
356 call calcul_fluxs(nisurf, dtime, tsurf, p1lay(:knon), cal(:knon), &
357 beta(:knon), tq_cdrag(:knon), ps(:knon), qsurf(:knon), &
358 radsol(:knon), dif_grnd(:knon), temp_air(:knon), spechum(:knon), &
359 u1_lay(:knon), v1_lay(:knon), petAcoef(:knon), peqAcoef(:knon), &
360 petBcoef(:knon), peqBcoef(:knon), tsurf_new, evap(:knon), &
361 fluxlat(:knon), fluxsens(:knon), dflux_s(:knon), dflux_l(:knon))
362
363 call fonte_neige(nisurf, dtime, tsurf, p1lay(:knon), beta(:knon), &
364 tq_cdrag(:knon), ps(:knon), precip_rain(:knon), &
365 precip_snow(:knon), snow(:knon), qsol(:knon), temp_air(:knon), &
366 spechum(:knon), u1_lay(:knon), v1_lay(:knon), petAcoef(:knon), &
367 peqAcoef(:knon), petBcoef(:knon), peqBcoef(:knon), tsurf_new, &
368 evap(:knon), fqcalving(:knon), ffonte(:knon), run_off_lic_0(:knon))
369
370 ! calcul albedo
371 CALL albsno(klon, knon, dtime, agesno, alb_neig, precip_snow)
372 WHERE (snow(1 : knon) < 0.0001) agesno(1 : knon) = 0.
373 zfra(:knon) = MAX(0.0, MIN(1.0, snow(1:knon)/(snow(1:knon) + 10.0)))
374 alblw = 0.77
375
376 ! Rugosite
377 z0_new = rugoro
378
379 ! Remplissage des pourcentages de surface
380 pctsrf_new(:, nisurf) = pctsrf(:, nisurf)
381
382 case default
383 print *, 'Index surface = ', nisurf
384 abort_message = 'Index surface non valable'
385 call abort_gcm(modname, abort_message, 1)
386 end select
387
388 END SUBROUTINE interfsurf_hq
389
390 end module interfsurf_hq_m

  ViewVC Help
Powered by ViewVC 1.1.21