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

  ViewVC Help
Powered by ViewVC 1.1.21