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

Annotation of /trunk/phylmd/Interface_surf/interfsurf_hq.f

Parent Directory Parent Directory | Revision Log Revision Log


Revision 171 - (hide annotations)
Tue Sep 29 19:48:59 2015 UTC (8 years, 7 months ago) by guez
Original Path: trunk/Sources/phylmd/Interface_surf/interfsurf_hq.f
File size: 15272 byte(s)
Removed argument ierr of abort_gcm. It was always 1 and not used.

Just encapsulated pres2lev into a module.

Removed test on run_off in procedure calcul_fluxs. Useless. The test
is always done just before in interfsurf_hq.

Removed named constants rea and repsm in module suphec: never used.

1 guez 54 module interfsurf_hq_m
2    
3     implicit none
4    
5     contains
6    
7 guez 104 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 guez 156 tsurf_new, albedo, z0_new, pctsrf_new, agesno, fqcalving, ffonte, &
13 guez 154 run_off_lic_0, flux_o, flux_g)
14 guez 54
15 guez 150 ! 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 guez 54
19 guez 104 ! Laurent Fairhead, February 2000
20 guez 54
21 guez 72 USE abort_gcm_m, ONLY: abort_gcm
22 guez 154 use alboc_cd_m, only: alboc_cd
23 guez 125 use alboc_m, only: alboc
24 guez 72 USE albsno_m, ONLY: albsno
25 guez 101 use calbeta_m, only: calbeta
26 guez 72 USE calcul_fluxs_m, ONLY: calcul_fluxs
27 guez 154 use clesphys2, only: soil_model, cycle_diurne
28 guez 98 USE dimphy, ONLY: klon
29 guez 72 USE fonte_neige_m, ONLY: fonte_neige
30     USE indicesol, ONLY: epsfra, is_lic, is_oce, is_sic, is_ter, nbsrf
31 guez 101 USE interface_surf, ONLY: run_off, run_off_lic, conf_interface
32 guez 72 USE interfoce_lim_m, ONLY: interfoce_lim
33     USE interfsur_lim_m, ONLY: interfsur_lim
34 guez 101 use soil_m, only: soil
35 guez 72 USE suphec_m, ONLY: rcpd, rlstt, rlvtt, rtt
36 guez 54
37 guez 99 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 guez 101 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 guez 106 integer, intent(in):: knindex(:) ! (knon)
45 guez 101 ! index des points de la surface a traiter
46    
47 guez 99 real, intent(IN):: pctsrf(klon, nbsrf)
48 guez 101 ! 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 guez 54 ! (si false calcul simplifie des fluxs sur les continents)
54 guez 101
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 guez 99 real, dimension(klon), intent(IN):: u1_lay, v1_lay
62 guez 54 ! u1_lay vitesse u 1ere couche
63     ! v1_lay vitesse v 1ere couche
64 guez 99 real, dimension(klon), intent(IN):: temp_air, spechum
65 guez 54 ! temp_air temperature de l'air 1ere couche
66     ! spechum humidite specifique 1ere couche
67 guez 99 real, dimension(klon), intent(INOUT):: tq_cdrag
68 guez 54 ! tq_cdrag cdrag
69 guez 99 real, dimension(klon), intent(IN):: petAcoef, peqAcoef
70 guez 54 ! petAcoef coeff. A de la resolution de la CL pour t
71     ! peqAcoef coeff. A de la resolution de la CL pour q
72 guez 99 real, dimension(klon), intent(IN):: petBcoef, peqBcoef
73 guez 54 ! petBcoef coeff. B de la resolution de la CL pour t
74     ! peqBcoef coeff. B de la resolution de la CL pour q
75 guez 101
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 guez 154 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 guez 101 real, intent(INOUT):: snow(klon), qsurf(klon)
86 guez 150 real, intent(IN):: tsurf(:) ! (knon) temp\'erature de surface
87 guez 104 real, dimension(klon), intent(IN):: p1lay
88 guez 54 ! p1lay pression 1er niveau (milieu de couche)
89 guez 99 real, dimension(klon), intent(IN):: ps
90 guez 54 ! ps pression au sol
91 guez 99 REAL, DIMENSION(klon), INTENT(INOUT):: radsol
92 guez 54 ! radsol rayonnement net aus sol (LW + SW)
93 guez 106 real, intent(INOUT):: evap(klon) ! evaporation totale
94 guez 99 real, dimension(klon), intent(OUT):: fluxsens, fluxlat
95 guez 54 ! fluxsens flux de chaleur sensible
96     ! fluxlat flux de chaleur latente
97 guez 99 real, dimension(klon), intent(OUT):: dflux_l, dflux_s
98 guez 150 real, intent(OUT):: tsurf_new(knon) ! temp\'erature au sol
99 guez 156 real, intent(OUT):: albedo(:) ! (knon) albedo
100 guez 154 real, intent(OUT):: z0_new(klon) ! surface roughness
101 guez 72 real, dimension(klon, nbsrf), intent(OUT):: pctsrf_new
102 guez 99 ! pctsrf_new nouvelle repartition des surfaces
103 guez 54 real, dimension(klon), intent(INOUT):: agesno
104    
105 guez 150 ! Flux d'eau "perdue" par la surface et n\'ecessaire pour que limiter la
106 guez 54 ! 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 guez 99
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 guez 72 real, parameter:: t_grnd=271.35
127 guez 54 integer i
128    
129 guez 72 character (len = 20), save:: modname = 'interfsurf_hq'
130     character (len = 80):: abort_message
131     logical, save:: first_call = .true.
132     integer:: ii
133 guez 54 real, dimension(klon):: cal, beta, dif_grnd, capsol
134 guez 154 real, parameter:: calice=1.0/(5.1444e6 * 0.15), tau_gl=86400. * 5.
135 guez 101 real, parameter:: calsno=1./(2.3867e6 * 0.15)
136 guez 104 real tsurf_temp(knon)
137 guez 154 real alb_neig(klon)
138     real zfra(klon)
139 guez 54
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 guez 72 call conf_interface
147 guez 54 if (nisurf /= is_ter .and. klon > 1) then
148 guez 101 print *, ' Warning:'
149     print *, ' nisurf = ', nisurf, ' /= is_ter = ', is_ter
150     print *, 'or on doit commencer par les surfaces continentales'
151 guez 54 abort_message='voir ci-dessus'
152 guez 171 call abort_gcm(modname, abort_message)
153 guez 54 endif
154 guez 101 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 guez 54 abort_message='voir ci-dessus'
160 guez 171 call abort_gcm(modname, abort_message)
161 guez 54 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 guez 104 select case (nisurf)
184     case (is_ter)
185 guez 171 ! Surface "terre", appel \`a l'interface avec les sols continentaux
186 guez 54
187     ! allocation du run-off
188 guez 101 if (.not. allocated(run_off)) then
189     allocate(run_off(knon))
190     run_off = 0.
191     else if (size(run_off) /= knon) then
192 guez 171 call abort_gcm(modname, 'Something is wrong: the number of ' &
193     // 'continental points has changed since last call.')
194 guez 54 endif
195    
196     ! Calcul age de la neige
197    
198 guez 99 ! calcul albedo: lecture albedo fichier boundary conditions
199     ! puis ajout albedo neige
200 guez 156 call interfsur_lim(itime, dtime, jour, knindex, debut, albedo, z0_new)
201 guez 54
202 guez 150 ! calcul snow et qsurf, hydrol adapt\'e
203 guez 101 CALL calbeta(nisurf, snow(:knon), qsol(:knon), beta(:knon), &
204     capsol(:knon), dif_grnd(:knon))
205 guez 54
206 guez 99 IF (soil_model) THEN
207 guez 101 CALL soil(dtime, nisurf, knon, snow, tsurf, tsoil, soilcap, soilflux)
208 guez 99 cal(1:knon) = RCPD / soilcap(1:knon)
209 guez 104 radsol(1:knon) = radsol(1:knon) + soilflux(:knon)
210 guez 99 ELSE
211     cal = RCPD * capsol
212     ENDIF
213 guez 171
214     CALL calcul_fluxs(dtime, tsurf, p1lay(:knon), cal(:knon), &
215 guez 116 beta(:knon), tq_cdrag(:knon), ps(:knon), qsurf(:knon), &
216     radsol(:knon), dif_grnd(:knon), temp_air(:knon), spechum(:knon), &
217     u1_lay(:knon), v1_lay(:knon), petAcoef(:knon), peqAcoef(:knon), &
218     petBcoef(:knon), peqBcoef(:knon), tsurf_new, evap(:knon), &
219     fluxlat(:knon), fluxsens(:knon), dflux_s(:knon), dflux_l(:knon))
220 guez 54
221 guez 104 CALL fonte_neige(nisurf, dtime, tsurf, p1lay(:knon), beta(:knon), &
222 guez 116 tq_cdrag(:knon), ps(:knon), precip_rain(:knon), &
223     precip_snow(:knon), snow(:knon), qsol(:knon), temp_air(:knon), &
224     spechum(:knon), u1_lay(:knon), v1_lay(:knon), petAcoef(:knon), &
225     peqAcoef(:knon), petBcoef(:knon), peqBcoef(:knon), tsurf_new, &
226     evap(:knon), fqcalving(:knon), ffonte(:knon), run_off_lic_0(:knon))
227 guez 54
228 guez 99 call albsno(klon, knon, dtime, agesno, alb_neig, precip_snow)
229 guez 104 where (snow(1 : knon) < 0.0001) agesno(1 : knon) = 0.
230 guez 154 zfra(:knon) = max(0.0, min(1.0, snow(1:knon)/(snow(1:knon) + 10.0)))
231 guez 156 albedo = alb_neig(:knon) * zfra(:knon) &
232     + albedo * (1. - zfra(:knon))
233 guez 101 z0_new = sqrt(z0_new**2 + rugoro**2)
234 guez 54
235     ! Remplissage des pourcentages de surface
236     pctsrf_new(:, nisurf) = pctsrf(:, nisurf)
237 guez 104 case (is_oce)
238 guez 150 ! Surface "ocean" appel \`a l'interface avec l'oc\'ean
239 guez 99 ! lecture conditions limites
240 guez 106 call interfoce_lim(itime, dtime, jour, knindex, debut, tsurf_temp, &
241     pctsrf_new)
242 guez 54
243     cal = 0.
244     beta = 1.
245     dif_grnd = 0.
246     alb_neig = 0.
247     agesno = 0.
248 guez 171 call calcul_fluxs(dtime, tsurf_temp, p1lay(:knon), &
249 guez 104 cal(:knon), beta(:knon), tq_cdrag(:knon), ps(:knon), &
250     qsurf(:knon), radsol(:knon), dif_grnd(:knon), temp_air(:knon), &
251     spechum(:knon), u1_lay(:knon), v1_lay(:knon), petAcoef(:knon), &
252     peqAcoef(:knon), petBcoef(:knon), peqBcoef(:knon), &
253     tsurf_new, evap(:knon), fluxlat(:knon), fluxsens(:knon), &
254     dflux_s(:knon), dflux_l(:knon))
255 guez 154 fder = fder + dflux_s + dflux_l
256 guez 54
257     !IM: flux ocean-atmosphere utile pour le "slab" ocean
258 guez 154 flux_o(:knon) = fluxsens(:knon) - evap(:knon) &
259     * merge(RLSTT, RLVTT, tsurf_new < RTT)
260 guez 54
261     ! calcul albedo
262 guez 154 if (cycle_diurne) then
263 guez 156 CALL alboc_cd(rmu0(knindex), albedo)
264 guez 154 else
265 guez 156 CALL alboc(jour, rlat(knindex), albedo)
266 guez 54 endif
267    
268     z0_new = sqrt(rugos**2 + rugoro**2)
269 guez 104 case (is_sic)
270 guez 54 ! Surface "glace de mer" appel a l'interface avec l'ocean
271    
272 guez 99 ! ! lecture conditions limites
273 guez 106 CALL interfoce_lim(itime, dtime, jour, knindex, debut, tsurf_new, &
274     pctsrf_new)
275 guez 54
276 guez 99 DO ii = 1, knon
277     tsurf_new(ii) = tsurf(ii)
278     IF (pctsrf_new(knindex(ii), nisurf) < EPSFRA) then
279     snow(ii) = 0.0
280     tsurf_new(ii) = RTT - 1.8
281 guez 154 IF (soil_model) tsoil(ii, :) = RTT - 1.8
282 guez 99 endif
283     enddo
284 guez 54
285 guez 101 CALL calbeta(nisurf, snow(:knon), qsol(:knon), beta(:knon), &
286     capsol(:knon), dif_grnd(:knon))
287 guez 54
288 guez 99 IF (soil_model) THEN
289     CALL soil(dtime, nisurf, knon, snow, tsurf_new, tsoil, soilcap, &
290     soilflux)
291     cal(1:knon) = RCPD / soilcap(1:knon)
292     radsol(1:knon) = radsol(1:knon) + soilflux(1:knon)
293     dif_grnd = 0.
294 guez 54 ELSE
295 guez 99 dif_grnd = 1.0 / tau_gl
296     cal = RCPD * calice
297     WHERE (snow > 0.0) cal = RCPD * calsno
298 guez 54 ENDIF
299 guez 99 tsurf_temp = tsurf_new
300     beta = 1.0
301 guez 54
302 guez 171 CALL calcul_fluxs(dtime, tsurf_temp, p1lay(:knon), cal(:knon), &
303 guez 104 beta(:knon), tq_cdrag(:knon), ps(:knon), qsurf(:knon), &
304 guez 116 radsol(:knon), dif_grnd(:knon), temp_air(:knon), spechum(:knon), &
305     u1_lay(:knon), v1_lay(:knon), petAcoef(:knon), peqAcoef(:knon), &
306     petBcoef(:knon), peqBcoef(:knon), tsurf_new, evap(:knon), &
307     fluxlat(:knon), fluxsens(:knon), dflux_s(:knon), dflux_l(:knon))
308 guez 54
309     !IM: flux entre l'ocean et la glace de mer pour le "slab" ocean
310     DO i = 1, knon
311     flux_g(i) = 0.0
312 guez 101 IF (cal(i) > 1e-15) flux_g(i) = (tsurf_new(i) - t_grnd) &
313     * dif_grnd(i) * RCPD / cal(i)
314 guez 54 ENDDO
315    
316 guez 104 CALL fonte_neige(nisurf, dtime, tsurf_temp, p1lay(:knon), beta(:knon), &
317 guez 116 tq_cdrag(:knon), ps(:knon), precip_rain(:knon), &
318     precip_snow(:knon), snow(:knon), qsol(:knon), temp_air(:knon), &
319     spechum(:knon), u1_lay(:knon), v1_lay(:knon), petAcoef(:knon), &
320     peqAcoef(:knon), petBcoef(:knon), peqBcoef(:knon), tsurf_new, &
321     evap(:knon), fqcalving(:knon), ffonte(:knon), run_off_lic_0(:knon))
322 guez 54
323     ! calcul albedo
324    
325     CALL albsno(klon, knon, dtime, agesno, alb_neig, precip_snow)
326 guez 104 WHERE (snow(1 : knon) < 0.0001) agesno(1 : knon) = 0.
327 guez 154 zfra(:knon) = MAX(0.0, MIN(1.0, snow(1:knon)/(snow(1:knon) + 10.0)))
328 guez 156 albedo = alb_neig(:knon) * zfra(:knon) + 0.6 * (1.0 - zfra(:knon))
329 guez 54
330 guez 154 fder = fder + dflux_s + dflux_l
331 guez 54
332     ! 2eme appel a interfoce pour le cumul et le passage des flux a l'ocean
333    
334     z0_new = 0.002
335 guez 101 z0_new = SQRT(z0_new**2 + rugoro**2)
336 guez 104 case (is_lic)
337 guez 54 if (.not. allocated(run_off_lic)) then
338 guez 101 allocate(run_off_lic(knon))
339 guez 54 run_off_lic = 0.
340     endif
341    
342     ! Surface "glacier continentaux" appel a l'interface avec le sol
343    
344     IF (soil_model) THEN
345     CALL soil(dtime, nisurf, knon, snow, tsurf, tsoil, soilcap, soilflux)
346     cal(1:knon) = RCPD / soilcap(1:knon)
347     radsol(1:knon) = radsol(1:knon) + soilflux(1:knon)
348     ELSE
349     cal = RCPD * calice
350     WHERE (snow > 0.0) cal = RCPD * calsno
351     ENDIF
352     beta = 1.0
353     dif_grnd = 0.0
354    
355 guez 171 call calcul_fluxs(dtime, tsurf, p1lay(:knon), cal(:knon), &
356 guez 116 beta(:knon), tq_cdrag(:knon), ps(:knon), qsurf(:knon), &
357     radsol(:knon), dif_grnd(:knon), temp_air(:knon), spechum(:knon), &
358     u1_lay(:knon), v1_lay(:knon), petAcoef(:knon), peqAcoef(:knon), &
359     petBcoef(:knon), peqBcoef(:knon), tsurf_new, evap(:knon), &
360     fluxlat(:knon), fluxsens(:knon), dflux_s(:knon), dflux_l(:knon))
361 guez 54
362 guez 104 call fonte_neige(nisurf, dtime, tsurf, p1lay(:knon), beta(:knon), &
363 guez 116 tq_cdrag(:knon), ps(:knon), precip_rain(:knon), &
364     precip_snow(:knon), snow(:knon), qsol(:knon), temp_air(:knon), &
365     spechum(:knon), u1_lay(:knon), v1_lay(:knon), petAcoef(:knon), &
366     peqAcoef(:knon), petBcoef(:knon), peqBcoef(:knon), tsurf_new, &
367     evap(:knon), fqcalving(:knon), ffonte(:knon), run_off_lic_0(:knon))
368 guez 54
369     ! calcul albedo
370     CALL albsno(klon, knon, dtime, agesno, alb_neig, precip_snow)
371 guez 104 WHERE (snow(1 : knon) < 0.0001) agesno(1 : knon) = 0.
372 guez 154 zfra(:knon) = MAX(0.0, MIN(1.0, snow(1:knon)/(snow(1:knon) + 10.0)))
373 guez 156 albedo = 0.77
374 guez 54
375     ! Rugosite
376     z0_new = rugoro
377    
378     ! Remplissage des pourcentages de surface
379     pctsrf_new(:, nisurf) = pctsrf(:, nisurf)
380    
381 guez 104 case default
382 guez 101 print *, 'Index surface = ', nisurf
383 guez 54 abort_message = 'Index surface non valable'
384 guez 171 call abort_gcm(modname, abort_message)
385 guez 104 end select
386 guez 54
387     END SUBROUTINE interfsurf_hq
388    
389     end module interfsurf_hq_m

  ViewVC Help
Powered by ViewVC 1.1.21