/[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 225 - (show annotations)
Mon Oct 16 12:35:41 2017 UTC (6 years, 6 months ago) by guez
File size: 11001 byte(s)
LMDZE is now in Fortran 2003 (use of allocatable arguments).

gradsdef was not used.

Change names: [uv]10m to [uv]10m_srf in clmain, y[uv]1 to
[uv]1lay. Remove useless complication: zx_alf[12]. Do not modify
[uv]1lay after initial definition from [uv].

Add [uv]10m_srf to output.

Change names in physiq: [uv]10m to [uv]10m_srf, z[uv]10m to [uv]10m,
corresponding to NetCDF output names.

Remove unused complication couchelimite and useless variable inirnpb
in phytrac.

1 module interfsurf_hq_m
2
3 implicit none
4
5 contains
6
7 SUBROUTINE interfsurf_hq(dtime, julien, rmu0, nisurf, knindex, debut, &
8 tsoil, qsol, u1_lay, v1_lay, temp_air, spechum, tq_cdrag, petAcoef, &
9 peqAcoef, petBcoef, peqBcoef, precip_rain, precip_snow, rugos, rugoro, &
10 snow, qsurf, ts, p1lay, ps, radsol, evap, flux_t, fluxlat, dflux_l, &
11 dflux_s, tsurf_new, albedo, z0_new, pctsrf_new_sic, agesno, fqcalving, &
12 ffonte, run_off_lic_0)
13
14 ! Cette routine sert d'aiguillage entre l'atmosph\`ere et la surface
15 ! en g\'en\'eral (sols continentaux, oc\'eans, glaces) pour les flux de
16 ! chaleur et d'humidit\'e.
17
18 ! Laurent Fairhead, February 2000
19
20 USE abort_gcm_m, ONLY: abort_gcm
21 use alboc_cd_m, only: alboc_cd
22 USE albsno_m, ONLY: albsno
23 use calbeta_m, only: calbeta
24 USE calcul_fluxs_m, ONLY: calcul_fluxs
25 use clesphys2, only: soil_model
26 USE dimphy, ONLY: klon
27 USE fonte_neige_m, ONLY: fonte_neige
28 USE indicesol, ONLY: epsfra, is_lic, is_oce, is_sic, is_ter
29 USE interface_surf, ONLY: conf_interface
30 USE interfsur_lim_m, ONLY: interfsur_lim
31 use read_sst_m, only: read_sst
32 use soil_m, only: soil
33 USE suphec_m, ONLY: rcpd, rtt
34
35 real, intent(IN):: dtime ! pas de temps de la physique (en s)
36 integer, intent(IN):: julien ! jour dans l'annee en cours
37 real, intent(IN):: rmu0(klon) ! cosinus de l'angle solaire zenithal
38 integer, intent(IN):: nisurf ! index de la surface a traiter
39
40 integer, intent(in):: knindex(:) ! (knon)
41 ! index des points de la surface a traiter
42
43 logical, intent(IN):: debut ! 1er appel a la physique
44 ! (si false calcul simplifie des fluxs sur les continents)
45
46 REAL, intent(inout):: tsoil(:, :) ! (knon, nsoilmx)
47
48 REAL, intent(INOUT):: qsol(:) ! (knon)
49 ! column-density of water in soil, in kg m-2
50
51 real, intent(IN):: u1_lay(:), v1_lay(:) ! (knon) vitesse 1ere couche
52
53 real, dimension(klon), intent(IN):: temp_air, spechum
54 ! temp_air temperature de l'air 1ere couche
55 ! spechum humidite specifique 1ere couche
56 real, dimension(klon), intent(INOUT):: tq_cdrag ! coefficient d'echange
57
58 real, dimension(klon), intent(IN):: petAcoef, peqAcoef
59 ! coefficients A de la r\'esolution de la couche limite pour t et q
60
61 real, dimension(klon), intent(IN):: petBcoef, peqBcoef
62 ! coefficients B de la r\'esolution de la couche limite pour t et q
63
64 real, intent(IN):: precip_rain(klon)
65 ! precipitation, liquid water mass flux (kg / m2 / s), positive down
66
67 real, intent(IN):: precip_snow(klon)
68 ! precipitation, solid water mass flux (kg / m2 / s), positive down
69
70 real, intent(IN):: rugos(klon) ! rugosite
71 real, intent(IN):: rugoro(klon) ! rugosite orographique
72 real, intent(INOUT):: snow(:) ! (knon)
73 real, intent(INOUT):: qsurf(klon)
74 real, intent(IN):: ts(:) ! (knon) temp\'erature de surface
75 real, intent(IN):: p1lay(klon) ! pression 1er niveau (milieu de couche)
76 real, dimension(klon), intent(IN):: ps ! pression au sol
77 REAL, INTENT(INOUT):: radsol(:) ! (knon) rayonnement net au sol (LW + SW)
78 real, intent(OUT):: evap(:) ! (knon) evaporation totale
79
80 real, intent(OUT):: flux_t(:) ! (knon) flux de chaleur sensible
81 ! (Cp T) à la surface, positif vers le bas, W / m2
82
83 real, intent(OUT):: fluxlat(:) ! (knon) flux de chaleur latente
84 real, intent(OUT):: dflux_l(:), dflux_s(:) ! (knon)
85 real, intent(OUT):: tsurf_new(:) ! (knon) temp\'erature au sol
86 real, intent(OUT):: albedo(:) ! (knon) albedo
87 real, intent(OUT):: z0_new(klon) ! surface roughness
88
89 real, intent(in):: pctsrf_new_sic(:) ! (klon)
90 ! nouvelle repartition des surfaces
91
92 real, intent(INOUT):: agesno(:) ! (knon)
93
94 ! Flux d'eau "perdue" par la surface et n\'ecessaire pour limiter la
95 ! hauteur de neige, en kg / m2 / s
96 real, dimension(klon), intent(INOUT):: fqcalving
97
98 ! Flux thermique utiliser pour fondre la neige
99 real, dimension(klon), intent(INOUT):: ffonte
100
101 real, dimension(klon), intent(INOUT):: run_off_lic_0
102 ! run_off_lic_0 runoff glacier du pas de temps precedent
103
104 ! Local:
105 integer knon ! nombre de points de la surface a traiter
106 REAL soilcap(size(knindex)) ! (knon)
107 REAL soilflux(size(knindex)) ! (knon)
108 logical:: first_call = .true.
109 integer ii
110 real cal(size(knindex)) ! (knon)
111 real beta(size(knindex)) ! (knon) evap reelle
112 real dif_grnd(klon), capsol(klon)
113 real, parameter:: calice = 1. / (5.1444e6 * 0.15), tau_gl = 86400. * 5.
114 real, parameter:: calsno = 1. / (2.3867e6 * 0.15)
115 real tsurf(size(knindex)) ! (knon)
116 real alb_neig(size(knindex)) ! (knon)
117 real zfra(size(knindex)) ! (knon)
118 REAL, PARAMETER:: fmagic = 1. ! facteur magique pour r\'egler l'alb\'edo
119
120 !-------------------------------------------------------------
121
122 knon = size(knindex)
123
124 ! On doit commencer par appeler les schemas de surfaces continentales
125 ! car l'ocean a besoin du ruissellement qui est y calcule
126
127 if (first_call) then
128 call conf_interface
129
130 if (nisurf /= is_ter .and. klon > 1) then
131 print *, ' nisurf = ', nisurf, ' /= is_ter = ', is_ter
132 print *, 'or on doit commencer par les surfaces continentales'
133 call abort_gcm("interfsurf_hq", &
134 'On doit commencer par les surfaces continentales')
135 endif
136
137 if (is_oce > is_sic) then
138 print *, 'is_oce = ', is_oce, '> is_sic = ', is_sic
139 call abort_gcm("interfsurf_hq", &
140 "L'ocean doit etre traite avant la banquise")
141 endif
142
143 first_call = .false.
144 endif
145
146 ! Initialisations diverses
147
148 ffonte(1:knon) = 0.
149 fqcalving(1:knon) = 0.
150 dif_grnd = 999999.
151 capsol = 999999.
152 z0_new = 999999.
153
154 ! Aiguillage vers les differents schemas de surface
155
156 select case (nisurf)
157 case (is_ter)
158 ! Surface "terre", appel \`a l'interface avec les sols continentaux
159
160 ! Calcul age de la neige
161
162 ! Read albedo from the file containing boundary conditions then
163 ! add the albedo of snow:
164
165 call interfsur_lim(dtime, julien, knindex, debut, albedo, z0_new)
166
167 ! Calcul de snow et qsurf, hydrologie adapt\'ee
168 CALL calbeta(is_ter, snow, qsol, beta, capsol(:knon), dif_grnd(:knon))
169
170 IF (soil_model) THEN
171 CALL soil(dtime, is_ter, snow, ts, tsoil, soilcap, soilflux)
172 cal = RCPD / soilcap
173 radsol = radsol + soilflux
174 ELSE
175 cal = RCPD * capsol(:knon)
176 ENDIF
177
178 CALL calcul_fluxs(dtime, ts, p1lay(:knon), cal, beta, tq_cdrag(:knon), &
179 ps(:knon), qsurf(:knon), radsol, dif_grnd(:knon), &
180 temp_air(:knon), spechum(:knon), u1_lay, v1_lay, &
181 petAcoef(:knon), peqAcoef(:knon), petBcoef(:knon), &
182 peqBcoef(:knon), tsurf_new, evap, fluxlat, flux_t, dflux_s, dflux_l)
183 CALL fonte_neige(is_ter, dtime, precip_rain(:knon), &
184 precip_snow(:knon), snow, qsol, tsurf_new, evap, &
185 fqcalving(:knon), ffonte(:knon), run_off_lic_0(:knon))
186
187 call albsno(dtime, agesno, alb_neig, precip_snow(:knon))
188 where (snow < 0.0001) agesno = 0.
189 zfra = max(0., min(1., snow / (snow + 10.)))
190 albedo = alb_neig * zfra + albedo * (1. - zfra)
191 z0_new = sqrt(z0_new**2 + rugoro**2)
192 case (is_oce)
193 ! Surface "oc\'ean", appel \`a l'interface avec l'oc\'ean
194
195 call read_sst(julien, knindex, tsurf)
196 cal = 0.
197 beta = 1.
198 dif_grnd = 0.
199 call calcul_fluxs(dtime, tsurf, p1lay(:knon), cal, beta, &
200 tq_cdrag(:knon), ps(:knon), qsurf(:knon), radsol, &
201 dif_grnd(:knon), temp_air(:knon), spechum(:knon), u1_lay, &
202 v1_lay, petAcoef(:knon), peqAcoef(:knon), petBcoef(:knon), &
203 peqBcoef(:knon), tsurf_new, evap, fluxlat, flux_t, dflux_s, dflux_l)
204 agesno = 0.
205 albedo = alboc_cd(rmu0(knindex)) * fmagic
206 z0_new = sqrt(rugos**2 + rugoro**2)
207 case (is_sic)
208 ! Surface "glace de mer" appel a l'interface avec l'ocean
209
210 DO ii = 1, knon
211 IF (pctsrf_new_sic(knindex(ii)) < EPSFRA) then
212 snow(ii) = 0.
213 tsurf_new(ii) = RTT - 1.8
214 IF (soil_model) tsoil(ii, :) = RTT - 1.8
215 else
216 tsurf_new(ii) = ts(ii)
217 endif
218 enddo
219
220 CALL calbeta(is_sic, snow, qsol, beta, capsol(:knon), dif_grnd(:knon))
221
222 IF (soil_model) THEN
223 CALL soil(dtime, is_sic, snow, tsurf_new, tsoil, soilcap, &
224 soilflux)
225 cal = RCPD / soilcap
226 radsol = radsol + soilflux
227 dif_grnd = 0.
228 ELSE
229 dif_grnd = 1. / tau_gl
230 cal = RCPD * calice
231 WHERE (snow > 0.) cal = RCPD * calsno
232 ENDIF
233 tsurf = tsurf_new
234 beta = 1.
235
236 CALL calcul_fluxs(dtime, tsurf, p1lay(:knon), cal, beta, &
237 tq_cdrag(:knon), ps(:knon), qsurf(:knon), radsol, &
238 dif_grnd(:knon), temp_air(:knon), spechum(:knon), u1_lay, &
239 v1_lay, petAcoef(:knon), peqAcoef(:knon), petBcoef(:knon), &
240 peqBcoef(:knon), tsurf_new, evap, fluxlat, flux_t, dflux_s, dflux_l)
241 CALL fonte_neige(is_sic, dtime, precip_rain(:knon), &
242 precip_snow(:knon), snow, qsol, tsurf_new, evap, &
243 fqcalving(:knon), ffonte(:knon), run_off_lic_0(:knon))
244
245 ! Compute the albedo:
246
247 CALL albsno(dtime, agesno, alb_neig, precip_snow(:knon))
248 WHERE (snow < 0.0001) agesno = 0.
249 zfra = MAX(0., MIN(1., snow / (snow + 10.)))
250 albedo = alb_neig * zfra + 0.6 * (1. - zfra)
251
252 z0_new = SQRT(0.002**2 + rugoro**2)
253 case (is_lic)
254 ! Surface "glacier continentaux" appel a l'interface avec le sol
255
256 IF (soil_model) THEN
257 CALL soil(dtime, is_lic, snow, ts, tsoil, soilcap, soilflux)
258 cal = RCPD / soilcap
259 radsol = radsol + soilflux
260 ELSE
261 cal = RCPD * calice
262 WHERE (snow > 0.) cal = RCPD * calsno
263 ENDIF
264 beta = 1.
265 dif_grnd = 0.
266
267 call calcul_fluxs(dtime, ts, p1lay(:knon), cal, beta, tq_cdrag(:knon), &
268 ps(:knon), qsurf(:knon), radsol, dif_grnd(:knon), &
269 temp_air(:knon), spechum(:knon), u1_lay, v1_lay, &
270 petAcoef(:knon), peqAcoef(:knon), petBcoef(:knon), &
271 peqBcoef(:knon), tsurf_new, evap, fluxlat, flux_t, dflux_s, dflux_l)
272 call fonte_neige(is_lic, dtime, precip_rain(:knon), &
273 precip_snow(:knon), snow, qsol, tsurf_new, evap, &
274 fqcalving(:knon), ffonte(:knon), run_off_lic_0(:knon))
275
276 ! calcul albedo
277 CALL albsno(dtime, agesno, alb_neig, precip_snow(:knon))
278 WHERE (snow < 0.0001) agesno = 0.
279 albedo = 0.77
280
281 ! Rugosite
282 z0_new = rugoro
283 case default
284 print *, 'Index surface = ', nisurf
285 call abort_gcm("interfsurf_hq", 'Index surface non valable')
286 end select
287
288 END SUBROUTINE interfsurf_hq
289
290 end module interfsurf_hq_m

  ViewVC Help
Powered by ViewVC 1.1.21