1 |
MODULE interface_surf |
2 |
|
3 |
! From phylmd/interface_surf.F90,v 1.8 2005/05/25 13:10:09 |
4 |
|
5 |
! Ce module regroupe toutes les routines gérant l'interface entre le modèle |
6 |
! atmosphérique et les modèles de surface (sols continentaux, |
7 |
! océans, glaces). |
8 |
! Les routines sont les suivantes: |
9 |
! interfsurf_hq : routine d'aiguillage vers les interfaces avec les |
10 |
! différents modèles de surface |
11 |
! interfoce_* : routines d'interface proprement dites |
12 |
|
13 |
! L. Fairhead, LMD, 02/2000 |
14 |
|
15 |
IMPLICIT none |
16 |
|
17 |
PRIVATE |
18 |
PUBLIC :: interfsurf_hq |
19 |
|
20 |
! run_off ruissellement total |
21 |
REAL, ALLOCATABLE, DIMENSION(:),SAVE :: run_off, run_off_lic |
22 |
real, allocatable, dimension(:),save :: coastalflow, riverflow |
23 |
|
24 |
REAL, ALLOCATABLE, DIMENSION(:,:), SAVE :: tmp_rriv, tmp_rcoa,tmp_rlic |
25 |
!! pour simuler la fonte des glaciers antarctiques |
26 |
REAL, ALLOCATABLE, DIMENSION(:,:), SAVE :: coeff_iceberg |
27 |
real, save :: surf_maille |
28 |
real, save :: cte_flux_iceberg = 6.3e7 |
29 |
integer, save :: num_antarctic = 1 |
30 |
REAL, save :: tau_calv |
31 |
|
32 |
CONTAINS |
33 |
|
34 |
SUBROUTINE interfsurf_hq(itime, dtime, date0, jour, rmu0, & |
35 |
& klon, iim, jjm, nisurf, knon, knindex, pctsrf, & |
36 |
& rlon, rlat, cufi, cvfi,& |
37 |
& debut, lafin, ok_veget, soil_model, nsoilmx, tsoil, qsol,& |
38 |
& zlev, u1_lay, v1_lay, temp_air, spechum, epot_air, ccanopy, & |
39 |
& tq_cdrag, petAcoef, peqAcoef, petBcoef, peqBcoef, & |
40 |
& precip_rain, precip_snow, sollw, sollwdown, swnet, swdown, & |
41 |
& fder, taux, tauy, & |
42 |
& windsp, & |
43 |
& rugos, rugoro, & |
44 |
& albedo, snow, qsurf, & |
45 |
& tsurf, p1lay, ps, radsol, & |
46 |
& ocean, npas, nexca, zmasq, & |
47 |
& evap, fluxsens, fluxlat, dflux_l, dflux_s, & |
48 |
& tsol_rad, tsurf_new, alb_new, alblw, emis_new, & |
49 |
& z0_new, pctsrf_new, agesno,fqcalving,ffonte, run_off_lic_0,& |
50 |
!IM "slab" ocean |
51 |
& flux_o, flux_g, tslab, seaice) |
52 |
|
53 |
! Cette routine sert d'aiguillage entre l'atmosphère et la surface |
54 |
! en général (sols continentaux, océans, glaces) pour les fluxs de |
55 |
! chaleur et d'humidité. |
56 |
! En pratique l'interface se fait entre la couche limite du modèle |
57 |
! atmosphérique ("clmain.F") et les routines de surface |
58 |
! ("sechiba", "oasis"...). |
59 |
|
60 |
! L.Fairhead 02/2000 |
61 |
|
62 |
! input: |
63 |
! klon nombre total de points de grille |
64 |
! iim, jjm nbres de pts de grille |
65 |
! dtime pas de temps de la physique (en s) |
66 |
! date0 jour initial |
67 |
! jour jour dans l'annee en cours, |
68 |
! rmu0 cosinus de l'angle solaire zenithal |
69 |
! nexca pas de temps couplage |
70 |
! nisurf index de la surface a traiter (1 = sol continental) |
71 |
! knon nombre de points de la surface a traiter |
72 |
! knindex index des points de la surface a traiter |
73 |
! pctsrf tableau des pourcentages de surface de chaque maille |
74 |
! rlon longitudes |
75 |
! rlat latitudes |
76 |
! cufi,cvfi resolution des mailles en x et y (m) |
77 |
! debut logical: 1er appel a la physique |
78 |
! lafin logical: dernier appel a la physique |
79 |
! ok_veget logical: appel ou non au schema de surface continental |
80 |
! (si false calcul simplifie des fluxs sur les continents) |
81 |
! zlev hauteur de la premiere couche |
82 |
! u1_lay vitesse u 1ere couche |
83 |
! v1_lay vitesse v 1ere couche |
84 |
! temp_air temperature de l'air 1ere couche |
85 |
! spechum humidite specifique 1ere couche |
86 |
! epot_air temp potentielle de l'air |
87 |
! ccanopy concentration CO2 canopee |
88 |
! tq_cdrag cdrag |
89 |
! petAcoef coeff. A de la resolution de la CL pour t |
90 |
! peqAcoef coeff. A de la resolution de la CL pour q |
91 |
! petBcoef coeff. B de la resolution de la CL pour t |
92 |
! peqBcoef coeff. B de la resolution de la CL pour q |
93 |
! precip_rain precipitation liquide |
94 |
! precip_snow precipitation solide |
95 |
! sollw flux IR net a la surface |
96 |
! sollwdown flux IR descendant a la surface |
97 |
! swnet flux solaire net |
98 |
! swdown flux solaire entrant a la surface |
99 |
! albedo albedo de la surface |
100 |
! tsurf temperature de surface |
101 |
! tslab temperature slab ocean |
102 |
! pctsrf_slab pourcentages (0-1) des sous-surfaces dans le slab |
103 |
! tmp_pctsrf_slab = pctsrf_slab |
104 |
! p1lay pression 1er niveau (milieu de couche) |
105 |
! ps pression au sol |
106 |
! radsol rayonnement net aus sol (LW + SW) |
107 |
! ocean type d'ocean utilise (force, slab, couple) |
108 |
! fder derivee des flux (pour le couplage) |
109 |
! taux, tauy tension de vents |
110 |
! windsp module du vent a 10m |
111 |
! rugos rugosite |
112 |
! zmasq masque terre/ocean |
113 |
! rugoro rugosite orographique |
114 |
! run_off_lic_0 runoff glacier du pas de temps precedent |
115 |
|
116 |
! output: |
117 |
! evap evaporation totale |
118 |
! fluxsens flux de chaleur sensible |
119 |
! fluxlat flux de chaleur latente |
120 |
! tsol_rad |
121 |
! tsurf_new temperature au sol |
122 |
! alb_new albedo |
123 |
! emis_new emissivite |
124 |
! z0_new surface roughness |
125 |
! pctsrf_new nouvelle repartition des surfaces |
126 |
|
127 |
use abort_gcm_m, only: abort_gcm |
128 |
use gath_cpl, only: gath2cpl |
129 |
use indicesol |
130 |
use YOMCST |
131 |
use albsno_m, only: albsno |
132 |
|
133 |
! Parametres d'entree |
134 |
integer, intent(IN) :: itime ! numero du pas de temps |
135 |
integer, intent(IN) :: iim, jjm |
136 |
integer, intent(IN) :: klon |
137 |
real, intent(IN) :: dtime |
138 |
real, intent(IN) :: date0 |
139 |
integer, intent(IN) :: jour |
140 |
real, intent(IN) :: rmu0(klon) |
141 |
integer, intent(IN) :: nisurf |
142 |
integer, intent(IN) :: knon |
143 |
integer, dimension(klon), intent(in) :: knindex |
144 |
real, dimension(klon,nbsrf), intent(IN) :: pctsrf |
145 |
logical, intent(IN) :: debut, lafin, ok_veget |
146 |
real, dimension(klon), intent(IN) :: rlon, rlat |
147 |
real, dimension(klon), intent(IN) :: cufi, cvfi |
148 |
real, dimension(klon), intent(INOUT) :: tq_cdrag |
149 |
real, dimension(klon), intent(IN) :: zlev |
150 |
real, dimension(klon), intent(IN) :: u1_lay, v1_lay |
151 |
real, dimension(klon), intent(IN) :: temp_air, spechum |
152 |
real, dimension(klon), intent(IN) :: epot_air, ccanopy |
153 |
real, dimension(klon), intent(IN) :: petAcoef, peqAcoef |
154 |
real, dimension(klon), intent(IN) :: petBcoef, peqBcoef |
155 |
real, dimension(klon), intent(IN) :: precip_rain, precip_snow |
156 |
real, dimension(klon), intent(IN) :: sollw, sollwdown, swnet, swdown |
157 |
real, dimension(klon), intent(IN) :: ps, albedo |
158 |
real, dimension(klon), intent(IN) :: tsurf, p1lay |
159 |
!IM: "slab" ocean |
160 |
real, dimension(klon), intent(INOUT) :: tslab |
161 |
real, allocatable, dimension(:), save :: tmp_tslab |
162 |
real, dimension(klon), intent(OUT) :: flux_o, flux_g |
163 |
real, dimension(klon), intent(INOUT) :: seaice ! glace de mer (kg/m2) |
164 |
REAL, DIMENSION(klon), INTENT(INOUT) :: radsol,fder |
165 |
real, dimension(klon), intent(IN) :: zmasq |
166 |
real, dimension(klon), intent(IN) :: taux, tauy, rugos, rugoro |
167 |
real, dimension(klon), intent(IN) :: windsp |
168 |
character (len = 6) :: ocean |
169 |
integer :: npas, nexca ! nombre et pas de temps couplage |
170 |
real, dimension(klon), intent(INOUT) :: evap, snow, qsurf |
171 |
!! PB ajout pour soil |
172 |
logical :: soil_model |
173 |
integer :: nsoilmx |
174 |
REAL, DIMENSION(klon, nsoilmx) :: tsoil |
175 |
REAL, dimension(klon), intent(INOUT) :: qsol |
176 |
REAL, dimension(klon) :: soilcap |
177 |
REAL, dimension(klon) :: soilflux |
178 |
! Parametres de sortie |
179 |
real, dimension(klon), intent(OUT):: fluxsens, fluxlat |
180 |
real, dimension(klon), intent(OUT):: tsol_rad, tsurf_new, alb_new |
181 |
real, dimension(klon), intent(OUT):: alblw |
182 |
real, dimension(klon), intent(OUT):: emis_new, z0_new |
183 |
real, dimension(klon), intent(OUT):: dflux_l, dflux_s |
184 |
real, dimension(klon,nbsrf), intent(OUT) :: pctsrf_new |
185 |
real, dimension(klon), intent(INOUT):: agesno |
186 |
real, dimension(klon), intent(INOUT):: run_off_lic_0 |
187 |
|
188 |
! Flux thermique utiliser pour fondre la neige |
189 |
!jld a rajouter real, dimension(klon), intent(INOUT):: ffonte |
190 |
real, dimension(klon), intent(INOUT):: ffonte |
191 |
! Flux d'eau "perdue" par la surface et nécessaire pour que limiter la |
192 |
! hauteur de neige, en kg/m2/s |
193 |
!jld a rajouter real, dimension(klon), intent(INOUT):: fqcalving |
194 |
real, dimension(klon), intent(INOUT):: fqcalving |
195 |
!IM: "slab" ocean - Local |
196 |
real, parameter :: t_grnd=271.35 |
197 |
real, dimension(klon) :: zx_sl |
198 |
integer i |
199 |
real, allocatable, dimension(:), save :: tmp_flux_o, tmp_flux_g |
200 |
real, allocatable, dimension(:), save :: tmp_radsol |
201 |
real, allocatable, dimension(:,:), save :: tmp_pctsrf_slab |
202 |
real, allocatable, dimension(:), save :: tmp_seaice |
203 |
|
204 |
! Local |
205 |
character (len = 20),save :: modname = 'interfsurf_hq' |
206 |
character (len = 80) :: abort_message |
207 |
logical, save :: first_call = .true. |
208 |
integer, save :: error |
209 |
integer :: ii |
210 |
logical,save :: check = .false. |
211 |
real, dimension(klon):: cal, beta, dif_grnd, capsol |
212 |
!!$PB real, parameter :: calice=1.0/(5.1444e+06*0.15), tau_gl=86400.*5. |
213 |
real, parameter :: calice=1.0/(5.1444e+06*0.15), tau_gl=86400.*5. |
214 |
real, parameter :: calsno=1./(2.3867e+06*.15) |
215 |
real, dimension(klon):: tsurf_temp |
216 |
real, dimension(klon):: alb_neig, alb_eau |
217 |
real, DIMENSION(klon):: zfra |
218 |
logical :: cumul = .false. |
219 |
INTEGER,dimension(1) :: iloc |
220 |
real, dimension(klon):: fder_prev |
221 |
REAL, dimension(klon) :: bidule |
222 |
|
223 |
!------------------------------------------------------------- |
224 |
|
225 |
if (check) write(*,*) 'Entree ', modname |
226 |
|
227 |
! On doit commencer par appeler les schemas de surfaces continentales |
228 |
! car l'ocean a besoin du ruissellement qui est y calcule |
229 |
|
230 |
if (first_call) then |
231 |
call conf_interface(tau_calv) |
232 |
if (nisurf /= is_ter .and. klon > 1) then |
233 |
write(*,*)' *** Warning ***' |
234 |
write(*,*)' nisurf = ',nisurf,' /= is_ter = ',is_ter |
235 |
write(*,*)'or on doit commencer par les surfaces continentales' |
236 |
abort_message='voir ci-dessus' |
237 |
call abort_gcm(modname,abort_message,1) |
238 |
endif |
239 |
if (ocean /= 'slab' .and. ocean /= 'force' .and. ocean /= 'couple') then |
240 |
write(*,*)' *** Warning ***' |
241 |
write(*,*)'Option couplage pour l''ocean = ', ocean |
242 |
abort_message='option pour l''ocean non valable' |
243 |
call abort_gcm(modname,abort_message,1) |
244 |
endif |
245 |
if ( is_oce > is_sic ) then |
246 |
write(*,*)' *** Warning ***' |
247 |
write(*,*)' Pour des raisons de sequencement dans le code' |
248 |
write(*,*)' l''ocean doit etre traite avant la banquise' |
249 |
write(*,*)' or is_oce = ',is_oce, '> is_sic = ',is_sic |
250 |
abort_message='voir ci-dessus' |
251 |
call abort_gcm(modname,abort_message,1) |
252 |
endif |
253 |
endif |
254 |
first_call = .false. |
255 |
|
256 |
! Initialisations diverses |
257 |
! |
258 |
ffonte(1:knon)=0. |
259 |
fqcalving(1:knon)=0. |
260 |
|
261 |
cal = 999999. ; beta = 999999. ; dif_grnd = 999999. ; capsol = 999999. |
262 |
alb_new = 999999. ; z0_new = 999999. ; alb_neig = 999999. |
263 |
tsurf_new = 999999. |
264 |
alblw = 999999. |
265 |
|
266 |
!IM: "slab" ocean; initialisations |
267 |
flux_o = 0. |
268 |
flux_g = 0. |
269 |
! |
270 |
if (.not. allocated(tmp_flux_o)) then |
271 |
allocate(tmp_flux_o(klon), stat = error) |
272 |
DO i=1, knon |
273 |
tmp_flux_o(knindex(i))=flux_o(i) |
274 |
ENDDO |
275 |
if (error /= 0) then |
276 |
abort_message='Pb allocation tmp_flux_o' |
277 |
call abort_gcm(modname,abort_message,1) |
278 |
endif |
279 |
endif |
280 |
if (.not. allocated(tmp_flux_g)) then |
281 |
allocate(tmp_flux_g(klon), stat = error) |
282 |
DO i=1, knon |
283 |
tmp_flux_g(knindex(i))=flux_g(i) |
284 |
ENDDO |
285 |
if (error /= 0) then |
286 |
abort_message='Pb allocation tmp_flux_g' |
287 |
call abort_gcm(modname,abort_message,1) |
288 |
endif |
289 |
endif |
290 |
if (.not. allocated(tmp_radsol)) then |
291 |
allocate(tmp_radsol(klon), stat = error) |
292 |
if (error /= 0) then |
293 |
abort_message='Pb allocation tmp_radsol' |
294 |
call abort_gcm(modname,abort_message,1) |
295 |
endif |
296 |
endif |
297 |
DO i=1, knon |
298 |
tmp_radsol(knindex(i))=radsol(i) |
299 |
ENDDO |
300 |
if (.not. allocated(tmp_pctsrf_slab)) then |
301 |
allocate(tmp_pctsrf_slab(klon,nbsrf), stat = error) |
302 |
if (error /= 0) then |
303 |
abort_message='Pb allocation tmp_pctsrf_slab' |
304 |
call abort_gcm(modname,abort_message,1) |
305 |
endif |
306 |
DO i=1, klon |
307 |
tmp_pctsrf_slab(i,1:nbsrf)=pctsrf(i,1:nbsrf) |
308 |
ENDDO |
309 |
endif |
310 |
! |
311 |
if (.not. allocated(tmp_seaice)) then |
312 |
allocate(tmp_seaice(klon), stat = error) |
313 |
if (error /= 0) then |
314 |
abort_message='Pb allocation tmp_seaice' |
315 |
call abort_gcm(modname,abort_message,1) |
316 |
endif |
317 |
DO i=1, klon |
318 |
tmp_seaice(i)=seaice(i) |
319 |
ENDDO |
320 |
endif |
321 |
! |
322 |
if (.not. allocated(tmp_tslab)) then |
323 |
allocate(tmp_tslab(klon), stat = error) |
324 |
if (error /= 0) then |
325 |
abort_message='Pb allocation tmp_tslab' |
326 |
call abort_gcm(modname,abort_message,1) |
327 |
endif |
328 |
endif |
329 |
DO i=1, klon |
330 |
tmp_tslab(i)=tslab(i) |
331 |
ENDDO |
332 |
! |
333 |
! Aiguillage vers les differents schemas de surface |
334 |
|
335 |
if (nisurf == is_ter) then |
336 |
! |
337 |
! Surface "terre" appel a l'interface avec les sols continentaux |
338 |
! |
339 |
! allocation du run-off |
340 |
if (.not. allocated(coastalflow)) then |
341 |
allocate(coastalflow(knon), stat = error) |
342 |
if (error /= 0) then |
343 |
abort_message='Pb allocation coastalflow' |
344 |
call abort_gcm(modname,abort_message,1) |
345 |
endif |
346 |
allocate(riverflow(knon), stat = error) |
347 |
if (error /= 0) then |
348 |
abort_message='Pb allocation riverflow' |
349 |
call abort_gcm(modname,abort_message,1) |
350 |
endif |
351 |
allocate(run_off(knon), stat = error) |
352 |
if (error /= 0) then |
353 |
abort_message='Pb allocation run_off' |
354 |
call abort_gcm(modname,abort_message,1) |
355 |
endif |
356 |
!cym |
357 |
run_off=0.0 |
358 |
!cym |
359 |
|
360 |
!!$PB |
361 |
ALLOCATE (tmp_rriv(iim,jjm+1), stat=error) |
362 |
if (error /= 0) then |
363 |
abort_message='Pb allocation tmp_rriv' |
364 |
call abort_gcm(modname,abort_message,1) |
365 |
endif |
366 |
ALLOCATE (tmp_rcoa(iim,jjm+1), stat=error) |
367 |
if (error /= 0) then |
368 |
abort_message='Pb allocation tmp_rcoa' |
369 |
call abort_gcm(modname,abort_message,1) |
370 |
endif |
371 |
ALLOCATE (tmp_rlic(iim,jjm+1), stat=error) |
372 |
if (error /= 0) then |
373 |
abort_message='Pb allocation tmp_rlic' |
374 |
call abort_gcm(modname,abort_message,1) |
375 |
endif |
376 |
tmp_rriv = 0.0 |
377 |
tmp_rcoa = 0.0 |
378 |
tmp_rlic = 0.0 |
379 |
|
380 |
!!$ |
381 |
else if (size(coastalflow) /= knon) then |
382 |
write(*,*)'Bizarre, le nombre de points continentaux' |
383 |
write(*,*)'a change entre deux appels. J''arrete ...' |
384 |
abort_message='voir ci-dessus' |
385 |
call abort_gcm(modname,abort_message,1) |
386 |
endif |
387 |
coastalflow = 0. |
388 |
riverflow = 0. |
389 |
! |
390 |
! Calcul age de la neige |
391 |
|
392 |
if (.not. ok_veget) then |
393 |
! |
394 |
! calcul albedo: lecture albedo fichier CL puis ajout albedo neige |
395 |
! |
396 |
call interfsur_lim(itime, dtime, jour, & |
397 |
& klon, nisurf, knon, knindex, debut, & |
398 |
& alb_new, z0_new) |
399 |
! |
400 |
! calcul snow et qsurf, hydrol adapté |
401 |
! |
402 |
CALL calbeta(dtime, nisurf, knon, snow, qsol, beta, capsol, dif_grnd) |
403 |
|
404 |
IF (soil_model) THEN |
405 |
CALL soil(dtime, nisurf, knon,snow, tsurf, tsoil,soilcap, soilflux) |
406 |
cal(1:knon) = RCPD / soilcap(1:knon) |
407 |
radsol(1:knon) = radsol(1:knon) + soilflux(1:knon) |
408 |
ELSE |
409 |
cal = RCPD * capsol |
410 |
!!$ cal = capsol |
411 |
ENDIF |
412 |
CALL calcul_fluxs( klon, knon, nisurf, dtime, & |
413 |
& tsurf, p1lay, cal, beta, tq_cdrag, ps, & |
414 |
& precip_rain, precip_snow, snow, qsurf, & |
415 |
& radsol, dif_grnd, temp_air, spechum, u1_lay, v1_lay, & |
416 |
& petAcoef, peqAcoef, petBcoef, peqBcoef, & |
417 |
& tsurf_new, evap, fluxlat, fluxsens, dflux_s, dflux_l) |
418 |
|
419 |
CALL fonte_neige( klon, knon, nisurf, dtime, & |
420 |
& tsurf, p1lay, cal, beta, tq_cdrag, ps, & |
421 |
& precip_rain, precip_snow, snow, qsol, & |
422 |
& radsol, dif_grnd, temp_air, spechum, u1_lay, v1_lay, & |
423 |
& petAcoef, peqAcoef, petBcoef, peqBcoef, & |
424 |
& tsurf_new, evap, fluxlat, fluxsens, dflux_s, dflux_l, & |
425 |
& fqcalving,ffonte, run_off_lic_0) |
426 |
|
427 |
call albsno(klon,knon,dtime,agesno(:),alb_neig(:), precip_snow(:)) |
428 |
where (snow(1 : knon) .LT. 0.0001) agesno(1 : knon) = 0. |
429 |
zfra(1:knon) = max(0.0,min(1.0,snow(1:knon)/(snow(1:knon)+10.0))) |
430 |
alb_new(1 : knon) = alb_neig(1 : knon) *zfra(1:knon) + & |
431 |
& alb_new(1 : knon)*(1.0-zfra(1:knon)) |
432 |
z0_new = sqrt(z0_new**2+rugoro**2) |
433 |
alblw(1 : knon) = alb_new(1 : knon) |
434 |
|
435 |
else |
436 |
endif |
437 |
! |
438 |
! Remplissage des pourcentages de surface |
439 |
! |
440 |
pctsrf_new(:,nisurf) = pctsrf(:,nisurf) |
441 |
|
442 |
else if (nisurf == is_oce) then |
443 |
|
444 |
if (check) write(*,*)'ocean, nisurf = ',nisurf |
445 |
|
446 |
! |
447 |
! Surface "ocean" appel a l'interface avec l'ocean |
448 |
! |
449 |
if (ocean == 'couple') then |
450 |
if (nexca == 0) then |
451 |
abort_message='nexca = 0 dans interfoce_cpl' |
452 |
call abort_gcm(modname,abort_message,1) |
453 |
endif |
454 |
|
455 |
cumul = .false. |
456 |
|
457 |
iloc = maxloc(fder(1:klon)) |
458 |
if (check) then |
459 |
if (fder(iloc(1))> 0.) then |
460 |
WRITE(*,*)'**** Debug fder ****' |
461 |
WRITE(*,*)'max fder(',iloc(1),') = ',fder(iloc(1)) |
462 |
endif |
463 |
endif |
464 |
!!$ |
465 |
!!$ where(fder.gt.0.) |
466 |
!!$ fder = 0. |
467 |
!!$ endwhere |
468 |
|
469 |
call interfoce_cpl(itime, dtime, cumul, & |
470 |
& klon, iim, jjm, nisurf, pctsrf, knon, knindex, rlon, rlat, & |
471 |
& ocean, npas, nexca, debut, lafin, & |
472 |
& swdown, sollw, precip_rain, precip_snow, evap, tsurf, & |
473 |
& fluxlat, fluxsens, fder, albedo, taux, tauy, & |
474 |
& windsp, & |
475 |
& zmasq, & |
476 |
& tsurf_new, alb_new, & |
477 |
& pctsrf_new) |
478 |
|
479 |
!IM: "slab" ocean |
480 |
else if (ocean == 'slab ') then |
481 |
tsurf_new = tsurf |
482 |
pctsrf_new = tmp_pctsrf_slab |
483 |
! |
484 |
else ! lecture conditions limites |
485 |
call interfoce_lim(itime, dtime, jour, & |
486 |
& klon, nisurf, knon, knindex, & |
487 |
& debut, & |
488 |
& tsurf_new, pctsrf_new) |
489 |
|
490 |
endif |
491 |
|
492 |
tsurf_temp = tsurf_new |
493 |
cal = 0. |
494 |
beta = 1. |
495 |
dif_grnd = 0. |
496 |
alb_neig(:) = 0. |
497 |
agesno(:) = 0. |
498 |
|
499 |
call calcul_fluxs( klon, knon, nisurf, dtime, & |
500 |
& tsurf_temp, p1lay, cal, beta, tq_cdrag, ps, & |
501 |
& precip_rain, precip_snow, snow, qsurf, & |
502 |
& radsol, dif_grnd, temp_air, spechum, u1_lay, v1_lay, & |
503 |
& petAcoef, peqAcoef, petBcoef, peqBcoef, & |
504 |
& tsurf_new, evap, fluxlat, fluxsens, dflux_s, dflux_l) |
505 |
|
506 |
fder_prev = fder |
507 |
fder = fder_prev + dflux_s + dflux_l |
508 |
|
509 |
iloc = maxloc(fder(1:klon)) |
510 |
if (check.and.fder(iloc(1))> 0.) then |
511 |
WRITE(*,*)'**** Debug fder****' |
512 |
WRITE(*,*)'max fder(',iloc(1),') = ',fder(iloc(1)) |
513 |
WRITE(*,*)'fder_prev, dflux_s, dflux_l',fder_prev(iloc(1)), & |
514 |
& dflux_s(iloc(1)), dflux_l(iloc(1)) |
515 |
endif |
516 |
!!$ |
517 |
!!$ where(fder.gt.0.) |
518 |
!!$ fder = 0. |
519 |
!!$ endwhere |
520 |
|
521 |
!IM: flux ocean-atmosphere utile pour le "slab" ocean |
522 |
DO i=1, knon |
523 |
zx_sl(i) = RLVTT |
524 |
if (tsurf_new(i) .LT. RTT) zx_sl(i) = RLSTT |
525 |
flux_o(i) = fluxsens(i)-evap(i)*zx_sl(i) |
526 |
tmp_flux_o(knindex(i)) = flux_o(i) |
527 |
tmp_radsol(knindex(i))=radsol(i) |
528 |
ENDDO |
529 |
! |
530 |
! 2eme appel a interfoce pour le cumul des champs (en particulier |
531 |
! fluxsens et fluxlat calcules dans calcul_fluxs) |
532 |
! |
533 |
if (ocean == 'couple') then |
534 |
|
535 |
cumul = .true. |
536 |
|
537 |
call interfoce_cpl(itime, dtime, cumul, & |
538 |
& klon, iim, jjm, nisurf, pctsrf, knon, knindex, rlon, rlat, & |
539 |
& ocean, npas, nexca, debut, lafin, & |
540 |
& swdown, sollw, precip_rain, precip_snow, evap, tsurf, & |
541 |
& fluxlat, fluxsens, fder, albedo, taux, tauy, & |
542 |
& windsp, & |
543 |
& zmasq, & |
544 |
& tsurf_new, alb_new, & |
545 |
& pctsrf_new) |
546 |
|
547 |
!IM: "slab" ocean |
548 |
else if (ocean == 'slab ') then |
549 |
! |
550 |
seaice=tmp_seaice |
551 |
cumul = .true. |
552 |
call interfoce_slab(klon, debut, itime, dtime, jour, & |
553 |
& tmp_radsol, tmp_flux_o, tmp_flux_g, pctsrf, & |
554 |
& tslab, seaice, pctsrf_new) |
555 |
! |
556 |
tmp_pctsrf_slab=pctsrf_new |
557 |
DO i=1, knon |
558 |
tsurf_new(i)=tslab(knindex(i)) |
559 |
ENDDO !i |
560 |
! |
561 |
endif |
562 |
|
563 |
! |
564 |
! calcul albedo |
565 |
! |
566 |
|
567 |
if ( minval(rmu0) == maxval(rmu0) .and. minval(rmu0) == -999.999 ) then |
568 |
CALL alboc(FLOAT(jour),rlat,alb_eau) |
569 |
else ! cycle diurne |
570 |
CALL alboc_cd(rmu0,alb_eau) |
571 |
endif |
572 |
DO ii =1, knon |
573 |
alb_new(ii) = alb_eau(knindex(ii)) |
574 |
enddo |
575 |
|
576 |
z0_new = sqrt(rugos**2 + rugoro**2) |
577 |
alblw(1:knon) = alb_new(1:knon) |
578 |
|
579 |
! |
580 |
else if (nisurf == is_sic) then |
581 |
|
582 |
if (check) write(*,*)'sea ice, nisurf = ',nisurf |
583 |
|
584 |
! |
585 |
! Surface "glace de mer" appel a l'interface avec l'ocean |
586 |
! |
587 |
! |
588 |
if (ocean == 'couple') then |
589 |
|
590 |
cumul =.false. |
591 |
|
592 |
iloc = maxloc(fder(1:klon)) |
593 |
if (check.and.fder(iloc(1))> 0.) then |
594 |
WRITE(*,*)'**** Debug fder ****' |
595 |
WRITE(*,*)'max fder(',iloc(1),') = ',fder(iloc(1)) |
596 |
endif |
597 |
!!$ |
598 |
!!$ where(fder.gt.0.) |
599 |
!!$ fder = 0. |
600 |
!!$ endwhere |
601 |
|
602 |
call interfoce_cpl(itime, dtime, cumul, & |
603 |
& klon, iim, jjm, nisurf, pctsrf, knon, knindex, rlon, rlat, & |
604 |
& ocean, npas, nexca, debut, lafin, & |
605 |
& swdown, sollw, precip_rain, precip_snow, evap, tsurf, & |
606 |
& fluxlat, fluxsens, fder, albedo, taux, tauy, & |
607 |
& windsp, & |
608 |
& zmasq, & |
609 |
& tsurf_new, alb_new, & |
610 |
& pctsrf_new) |
611 |
|
612 |
tsurf_temp = tsurf_new |
613 |
cal = 0. |
614 |
dif_grnd = 0. |
615 |
beta = 1.0 |
616 |
|
617 |
!IM: "slab" ocean |
618 |
else if (ocean == 'slab ') then |
619 |
pctsrf_new=tmp_pctsrf_slab |
620 |
! |
621 |
DO ii = 1, knon |
622 |
tsurf_new(ii) = tsurf(ii) |
623 |
IF (pctsrf_new(knindex(ii),nisurf) < EPSFRA) then |
624 |
snow(ii) = 0.0 |
625 |
tsurf_new(ii) = RTT - 1.8 |
626 |
IF (soil_model) tsoil(ii,:) = RTT -1.8 |
627 |
ENDIF |
628 |
ENDDO |
629 |
|
630 |
CALL calbeta(dtime, nisurf, knon, snow, qsol, beta, capsol, dif_grnd) |
631 |
|
632 |
IF (soil_model) THEN |
633 |
CALL soil(dtime, nisurf, knon,snow, tsurf_new, tsoil,soilcap, soilflux) |
634 |
cal(1:knon) = RCPD / soilcap(1:knon) |
635 |
radsol(1:knon) = radsol(1:knon) + soilflux(1:knon) |
636 |
ELSE |
637 |
dif_grnd = 1.0 / tau_gl |
638 |
cal = RCPD * calice |
639 |
WHERE (snow > 0.0) cal = RCPD * calsno |
640 |
ENDIF |
641 |
tsurf_temp = tsurf_new |
642 |
beta = 1.0 |
643 |
! |
644 |
ELSE |
645 |
! ! lecture conditions limites |
646 |
CALL interfoce_lim(itime, dtime, jour, & |
647 |
& klon, nisurf, knon, knindex, & |
648 |
& debut, & |
649 |
& tsurf_new, pctsrf_new) |
650 |
|
651 |
!IM cf LF |
652 |
DO ii = 1, knon |
653 |
tsurf_new(ii) = tsurf(ii) |
654 |
!IMbad IF (pctsrf_new(ii,nisurf) < EPSFRA) then |
655 |
IF (pctsrf_new(knindex(ii),nisurf) < EPSFRA) then |
656 |
snow(ii) = 0.0 |
657 |
!IM cf LF/JLD tsurf(ii) = RTT - 1.8 |
658 |
tsurf_new(ii) = RTT - 1.8 |
659 |
IF (soil_model) tsoil(ii,:) = RTT -1.8 |
660 |
endif |
661 |
enddo |
662 |
|
663 |
CALL calbeta(dtime, nisurf, knon, snow, qsol, beta, capsol, dif_grnd) |
664 |
|
665 |
IF (soil_model) THEN |
666 |
!IM cf LF/JLD CALL soil(dtime, nisurf, knon,snow, tsurf, tsoil,soilcap, soilflux) |
667 |
CALL soil(dtime, nisurf, knon,snow, tsurf_new, tsoil,soilcap, soilflux) |
668 |
cal(1:knon) = RCPD / soilcap(1:knon) |
669 |
radsol(1:knon) = radsol(1:knon) + soilflux(1:knon) |
670 |
dif_grnd = 0. |
671 |
ELSE |
672 |
dif_grnd = 1.0 / tau_gl |
673 |
cal = RCPD * calice |
674 |
WHERE (snow > 0.0) cal = RCPD * calsno |
675 |
ENDIF |
676 |
!IMbadtsurf_temp = tsurf |
677 |
tsurf_temp = tsurf_new |
678 |
beta = 1.0 |
679 |
ENDIF |
680 |
|
681 |
CALL calcul_fluxs( klon, knon, nisurf, dtime, & |
682 |
& tsurf_temp, p1lay, cal, beta, tq_cdrag, ps, & |
683 |
& precip_rain, precip_snow, snow, qsurf, & |
684 |
& radsol, dif_grnd, temp_air, spechum, u1_lay, v1_lay, & |
685 |
& petAcoef, peqAcoef, petBcoef, peqBcoef, & |
686 |
& tsurf_new, evap, fluxlat, fluxsens, dflux_s, dflux_l) |
687 |
! |
688 |
!IM: flux entre l'ocean et la glace de mer pour le "slab" ocean |
689 |
DO i = 1, knon |
690 |
flux_g(i) = 0.0 |
691 |
! |
692 |
!IM: faire dependre le coefficient de conduction de la glace de mer |
693 |
! de l'epaisseur de la glace de mer, dans l'hypothese ou le coeff. |
694 |
! actuel correspond a 3m de glace de mer, cf. L.Li |
695 |
! |
696 |
! IF(1.EQ.0) THEN |
697 |
! IF(siceh(i).GT.0.) THEN |
698 |
! new_dif_grnd(i) = dif_grnd(i)*3./siceh(i) |
699 |
! ELSE |
700 |
! new_dif_grnd(i) = 0. |
701 |
! ENDIF |
702 |
! ENDIF !(1.EQ.0) THEN |
703 |
! |
704 |
IF (cal(i).GT.1.0e-15) flux_g(i)=(tsurf_new(i)-t_grnd) & |
705 |
& * dif_grnd(i) *RCPD/cal(i) |
706 |
! & * new_dif_grnd(i) *RCPD/cal(i) |
707 |
tmp_flux_g(knindex(i))=flux_g(i) |
708 |
tmp_radsol(knindex(i))=radsol(i) |
709 |
ENDDO |
710 |
|
711 |
IF (ocean /= 'couple') THEN |
712 |
CALL fonte_neige( klon, knon, nisurf, dtime, & |
713 |
& tsurf_temp, p1lay, cal, beta, tq_cdrag, ps, & |
714 |
& precip_rain, precip_snow, snow, qsol, & |
715 |
& radsol, dif_grnd, temp_air, spechum, u1_lay, v1_lay, & |
716 |
& petAcoef, peqAcoef, petBcoef, peqBcoef, & |
717 |
& tsurf_new, evap, fluxlat, fluxsens, dflux_s, dflux_l, & |
718 |
& fqcalving,ffonte, run_off_lic_0) |
719 |
|
720 |
! calcul albedo |
721 |
|
722 |
CALL albsno(klon,knon,dtime,agesno(:),alb_neig(:), precip_snow(:)) |
723 |
WHERE (snow(1 : knon) .LT. 0.0001) agesno(1 : knon) = 0. |
724 |
zfra(1:knon) = MAX(0.0,MIN(1.0,snow(1:knon)/(snow(1:knon)+10.0))) |
725 |
alb_new(1 : knon) = alb_neig(1 : knon) *zfra(1:knon) + & |
726 |
& 0.6 * (1.0-zfra(1:knon)) |
727 |
!! alb_new(1 : knon) = 0.6 |
728 |
ENDIF |
729 |
|
730 |
fder_prev = fder |
731 |
fder = fder_prev + dflux_s + dflux_l |
732 |
|
733 |
iloc = maxloc(fder(1:klon)) |
734 |
if (check.and.fder(iloc(1))> 0.) then |
735 |
WRITE(*,*)'**** Debug fder ****' |
736 |
WRITE(*,*)'max fder(',iloc(1),') = ',fder(iloc(1)) |
737 |
WRITE(*,*)'fder_prev, dflux_s, dflux_l',fder_prev(iloc(1)), & |
738 |
& dflux_s(iloc(1)), dflux_l(iloc(1)) |
739 |
endif |
740 |
!!$ where(fder.gt.0.) |
741 |
!!$ fder = 0. |
742 |
!!$ endwhere |
743 |
|
744 |
! |
745 |
! 2eme appel a interfoce pour le cumul et le passage des flux a l'ocean |
746 |
! |
747 |
if (ocean == 'couple') then |
748 |
|
749 |
cumul =.true. |
750 |
|
751 |
call interfoce_cpl(itime, dtime, cumul, & |
752 |
& klon, iim, jjm, nisurf, pctsrf, knon, knindex, rlon, rlat, & |
753 |
& ocean, npas, nexca, debut, lafin, & |
754 |
& swdown, sollw, precip_rain, precip_snow, evap, tsurf, & |
755 |
& fluxlat, fluxsens, fder, albedo, taux, tauy, & |
756 |
& windsp, & |
757 |
& zmasq, & |
758 |
& tsurf_new, alb_new, & |
759 |
& pctsrf_new) |
760 |
endif |
761 |
|
762 |
z0_new = 0.002 |
763 |
z0_new = SQRT(z0_new**2+rugoro**2) |
764 |
alblw(1:knon) = alb_new(1:knon) |
765 |
|
766 |
else if (nisurf == is_lic) then |
767 |
|
768 |
if (check) write(*,*)'glacier, nisurf = ',nisurf |
769 |
|
770 |
if (.not. allocated(run_off_lic)) then |
771 |
allocate(run_off_lic(knon), stat = error) |
772 |
if (error /= 0) then |
773 |
abort_message='Pb allocation run_off_lic' |
774 |
call abort_gcm(modname,abort_message,1) |
775 |
endif |
776 |
run_off_lic = 0. |
777 |
endif |
778 |
! |
779 |
! Surface "glacier continentaux" appel a l'interface avec le sol |
780 |
! |
781 |
IF (soil_model) THEN |
782 |
CALL soil(dtime, nisurf, knon, snow, tsurf, tsoil,soilcap, soilflux) |
783 |
cal(1:knon) = RCPD / soilcap(1:knon) |
784 |
radsol(1:knon) = radsol(1:knon) + soilflux(1:knon) |
785 |
ELSE |
786 |
cal = RCPD * calice |
787 |
WHERE (snow > 0.0) cal = RCPD * calsno |
788 |
ENDIF |
789 |
beta = 1.0 |
790 |
dif_grnd = 0.0 |
791 |
|
792 |
call calcul_fluxs( klon, knon, nisurf, dtime, & |
793 |
& tsurf, p1lay, cal, beta, tq_cdrag, ps, & |
794 |
& precip_rain, precip_snow, snow, qsurf, & |
795 |
& radsol, dif_grnd, temp_air, spechum, u1_lay, v1_lay, & |
796 |
& petAcoef, peqAcoef, petBcoef, peqBcoef, & |
797 |
& tsurf_new, evap, fluxlat, fluxsens, dflux_s, dflux_l) |
798 |
|
799 |
call fonte_neige( klon, knon, nisurf, dtime, & |
800 |
& tsurf, p1lay, cal, beta, tq_cdrag, ps, & |
801 |
& precip_rain, precip_snow, snow, qsol, & |
802 |
& radsol, dif_grnd, temp_air, spechum, u1_lay, v1_lay, & |
803 |
& petAcoef, peqAcoef, petBcoef, peqBcoef, & |
804 |
& tsurf_new, evap, fluxlat, fluxsens, dflux_s, dflux_l, & |
805 |
& fqcalving,ffonte, run_off_lic_0) |
806 |
|
807 |
! passage du run-off des glaciers calcule dans fonte_neige au coupleur |
808 |
bidule=0. |
809 |
bidule(1:knon)= run_off_lic(1:knon) |
810 |
call gath2cpl(bidule, tmp_rlic, klon, knon,iim,jjm,knindex) |
811 |
! |
812 |
! calcul albedo |
813 |
! |
814 |
CALL albsno(klon,knon,dtime,agesno(:),alb_neig(:), precip_snow(:)) |
815 |
WHERE (snow(1 : knon) .LT. 0.0001) agesno(1 : knon) = 0. |
816 |
zfra(1:knon) = MAX(0.0,MIN(1.0,snow(1:knon)/(snow(1:knon)+10.0))) |
817 |
alb_new(1 : knon) = alb_neig(1 : knon)*zfra(1:knon) + & |
818 |
& 0.6 * (1.0-zfra(1:knon)) |
819 |
! |
820 |
!IM: plusieurs choix/tests sur l'albedo des "glaciers continentaux" |
821 |
! alb_new(1 : knon) = 0.6 !IM cf FH/GK |
822 |
! alb_new(1 : knon) = 0.82 |
823 |
! alb_new(1 : knon) = 0.77 !211003 Ksta0.77 |
824 |
! alb_new(1 : knon) = 0.8 !KstaTER0.8 & LMD_ARMIP5 |
825 |
!IM: KstaTER0.77 & LMD_ARMIP6 |
826 |
alb_new(1 : knon) = 0.77 |
827 |
|
828 |
! |
829 |
! Rugosite |
830 |
! |
831 |
z0_new = rugoro |
832 |
! |
833 |
! Remplissage des pourcentages de surface |
834 |
! |
835 |
pctsrf_new(:,nisurf) = pctsrf(:,nisurf) |
836 |
|
837 |
alblw(1:knon) = alb_new(1:knon) |
838 |
else |
839 |
write(*,*)'Index surface = ',nisurf |
840 |
abort_message = 'Index surface non valable' |
841 |
call abort_gcm(modname,abort_message,1) |
842 |
endif |
843 |
|
844 |
END SUBROUTINE interfsurf_hq |
845 |
|
846 |
!************************ |
847 |
|
848 |
SUBROUTINE interfoce_cpl(itime, dtime, cumul, & |
849 |
& klon, iim, jjm, nisurf, pctsrf, knon, knindex, rlon, rlat, & |
850 |
& ocean, npas, nexca, debut, lafin, & |
851 |
& swdown, lwdown, precip_rain, precip_snow, evap, tsurf, & |
852 |
& fluxlat, fluxsens, fder, albsol, taux, tauy, & |
853 |
& windsp, & |
854 |
& zmasq, & |
855 |
& tsurf_new, alb_new, & |
856 |
& pctsrf_new) |
857 |
|
858 |
! Cette routine sert d'interface entre le modele atmospherique et un |
859 |
! coupleur avec un modele d'ocean 'complet' derriere |
860 |
! |
861 |
! Le modele de glace qu'il est prevu d'utiliser etant couple directement a |
862 |
! l'ocean presentement, on va passer deux fois dans cette routine par pas de |
863 |
! temps physique, une fois avec les points oceans et l'autre avec les points |
864 |
! glace. A chaque pas de temps de couplage, la lecture des champs provenant |
865 |
! du coupleur se fera "dans" l'ocean et l'ecriture des champs a envoyer |
866 |
! au coupleur "dans" la glace. Il faut donc des tableaux de travail "tampons" |
867 |
! dimensionnes sur toute la grille qui remplissent les champs sur les |
868 |
! domaines ocean/glace quand il le faut. Il est aussi necessaire que l'index |
869 |
! ocean soit traiter avant l'index glace (sinon tout intervertir) |
870 |
! |
871 |
! |
872 |
! L. Fairhead 02/2000 |
873 |
! |
874 |
! input: |
875 |
! itime numero du pas de temps |
876 |
! iim, jjm nbres de pts de grille |
877 |
! dtime pas de temps de la physique |
878 |
! klon nombre total de points de grille |
879 |
! nisurf index de la surface a traiter (1 = sol continental) |
880 |
! pctsrf tableau des fractions de surface de chaque maille |
881 |
! knon nombre de points de la surface a traiter |
882 |
! knindex index des points de la surface a traiter |
883 |
! rlon longitudes |
884 |
! rlat latitudes |
885 |
! debut logical: 1er appel a la physique |
886 |
! lafin logical: dernier appel a la physique |
887 |
! ocean type d'ocean |
888 |
! nexca frequence de couplage |
889 |
! swdown flux solaire entrant a la surface |
890 |
! lwdown flux IR net a la surface |
891 |
! precip_rain precipitation liquide |
892 |
! precip_snow precipitation solide |
893 |
! evap evaporation |
894 |
! tsurf temperature de surface |
895 |
! fder derivee dF/dT |
896 |
! albsol albedo du sol (coherent avec swdown) |
897 |
! taux tension de vent en x |
898 |
! tauy tension de vent en y |
899 |
! windsp module du vent a 10m |
900 |
! nexca frequence de couplage |
901 |
! zmasq masque terre/ocean |
902 |
! |
903 |
! |
904 |
! output: |
905 |
! tsurf_new temperature au sol |
906 |
! alb_new albedo |
907 |
! pctsrf_new nouvelle repartition des surfaces |
908 |
! alb_ice albedo de la glace |
909 |
! |
910 |
use temps |
911 |
use iniprint |
912 |
use abort_gcm_m, only: abort_gcm |
913 |
use gath_cpl, only: gath2cpl, cpl2gath |
914 |
use ioipsl |
915 |
use indicesol |
916 |
use YOMCST |
917 |
|
918 |
! Parametres d'entree |
919 |
integer, intent(IN) :: itime |
920 |
integer, intent(IN) :: iim, jjm |
921 |
real, intent(IN) :: dtime |
922 |
integer, intent(IN) :: klon |
923 |
integer, intent(IN) :: nisurf |
924 |
integer, intent(IN) :: knon |
925 |
real, dimension(klon,nbsrf), intent(IN) :: pctsrf |
926 |
integer, dimension(klon), intent(in) :: knindex |
927 |
logical, intent(IN) :: debut, lafin |
928 |
real, dimension(klon), intent(IN) :: rlon, rlat |
929 |
character (len = 6) :: ocean |
930 |
real, dimension(klon), intent(IN) :: lwdown, swdown |
931 |
real, dimension(klon), intent(IN) :: precip_rain, precip_snow |
932 |
real, dimension(klon), intent(IN) :: tsurf, fder, albsol, taux, tauy |
933 |
real, dimension(klon), intent(IN) :: windsp |
934 |
INTEGER :: nexca, npas |
935 |
real, dimension(klon), intent(IN) :: zmasq |
936 |
real, dimension(klon), intent(IN) :: fluxlat, fluxsens |
937 |
logical, intent(IN) :: cumul |
938 |
real, dimension(klon), intent(INOUT) :: evap |
939 |
|
940 |
! Parametres de sortie |
941 |
real, dimension(klon), intent(OUT):: tsurf_new, alb_new |
942 |
real, dimension(klon,nbsrf), intent(OUT) :: pctsrf_new |
943 |
|
944 |
! Variables locales |
945 |
integer :: j, error, sum_error, ig, cpl_index,i |
946 |
INTEGER :: nsrf |
947 |
character (len = 20) :: modname = 'interfoce_cpl' |
948 |
character (len = 80) :: abort_message |
949 |
logical,save :: check = .FALSE. |
950 |
! variables pour moyenner les variables de couplage |
951 |
real, allocatable, dimension(:,:),save :: cpl_sols, cpl_nsol, cpl_rain |
952 |
real, allocatable, dimension(:,:),save :: cpl_snow, cpl_evap, cpl_tsol |
953 |
real, allocatable, dimension(:,:),save :: cpl_fder, cpl_albe, cpl_taux |
954 |
real, allocatable, dimension(:,:),save :: cpl_windsp |
955 |
real, allocatable, dimension(:,:),save :: cpl_tauy |
956 |
REAL, ALLOCATABLE, DIMENSION(:,:),SAVE :: cpl_rriv, cpl_rcoa, cpl_rlic |
957 |
!!$ |
958 |
! variables tampons avant le passage au coupleur |
959 |
real, allocatable, dimension(:,:,:),save :: tmp_sols, tmp_nsol, tmp_rain |
960 |
real, allocatable, dimension(:,:,:),save :: tmp_snow, tmp_evap, tmp_tsol |
961 |
real, allocatable, dimension(:,:,:),save :: tmp_fder, tmp_albe, tmp_taux |
962 |
real, allocatable, dimension(:,:,:),save :: tmp_windsp |
963 |
REAL, ALLOCATABLE, DIMENSION(:,:,:),SAVE :: tmp_tauy |
964 |
! variables a passer au coupleur |
965 |
real, dimension(iim, jjm+1) :: wri_sol_ice, wri_sol_sea, wri_nsol_ice |
966 |
real, dimension(iim, jjm+1) :: wri_nsol_sea, wri_fder_ice, wri_evap_ice |
967 |
REAL, DIMENSION(iim, jjm+1) :: wri_evap_sea, wri_rcoa, wri_rriv |
968 |
REAL, DIMENSION(iim, jjm+1) :: wri_rain, wri_snow, wri_taux, wri_tauy |
969 |
REAL, DIMENSION(iim, jjm+1) :: wri_windsp |
970 |
REAL, DIMENSION(iim, jjm+1) :: wri_calv |
971 |
REAL, DIMENSION(iim, jjm+1) :: wri_tauxx, wri_tauyy, wri_tauzz |
972 |
REAL, DIMENSION(iim, jjm+1) :: tmp_lon, tmp_lat |
973 |
! variables relues par le coupleur |
974 |
! read_sic = fraction de glace |
975 |
! read_sit = temperature de glace |
976 |
real, allocatable, dimension(:,:),save :: read_sst, read_sic, read_sit |
977 |
real, allocatable, dimension(:,:),save :: read_alb_sic |
978 |
! variable tampon |
979 |
real, dimension(klon) :: tamp_sic |
980 |
! sauvegarde des fractions de surface d'un pas de temps a l'autre apres |
981 |
! l'avoir lu |
982 |
real, allocatable,dimension(:,:),save :: pctsrf_sav |
983 |
real, dimension(iim, jjm+1, 2) :: tamp_srf |
984 |
integer, allocatable, dimension(:), save :: tamp_ind |
985 |
real, allocatable, dimension(:,:),save :: tamp_zmasq |
986 |
real, dimension(iim, jjm+1) :: deno |
987 |
integer :: idtime |
988 |
integer, allocatable,dimension(:),save :: unity |
989 |
! |
990 |
logical, save :: first_appel = .true. |
991 |
logical,save :: print |
992 |
!maf |
993 |
! variables pour avoir une sortie IOIPSL des champs echanges |
994 |
CHARACTER(len=80),SAVE :: clintocplnam, clfromcplnam |
995 |
INTEGER, SAVE :: jf,nhoridct,nidct |
996 |
INTEGER, SAVE :: nhoridcs,nidcs |
997 |
INTEGER :: ndexct(iim*(jjm+1)),ndexcs(iim*(jjm+1)) |
998 |
REAL :: zx_lon(iim,jjm+1), zx_lat(iim,jjm+1), zjulian |
999 |
INTEGER,save :: idayref |
1000 |
!med integer :: itau_w |
1001 |
integer,save :: itau_w |
1002 |
integer :: nb_interf_cpl |
1003 |
include "param_cou.h" |
1004 |
include "inc_cpl.h" |
1005 |
! |
1006 |
! Initialisation |
1007 |
! |
1008 |
if (check) write(*,*)'Entree ',modname,'nisurf = ',nisurf |
1009 |
|
1010 |
if (first_appel) then |
1011 |
error = 0 |
1012 |
allocate(unity(klon), stat = error) |
1013 |
if ( error /=0) then |
1014 |
abort_message='Pb allocation variable unity' |
1015 |
call abort_gcm(modname,abort_message,1) |
1016 |
endif |
1017 |
allocate(pctsrf_sav(klon,nbsrf), stat = error) |
1018 |
if ( error /=0) then |
1019 |
abort_message='Pb allocation variable pctsrf_sav' |
1020 |
call abort_gcm(modname,abort_message,1) |
1021 |
endif |
1022 |
pctsrf_sav = 0. |
1023 |
|
1024 |
do ig = 1, klon |
1025 |
unity(ig) = ig |
1026 |
enddo |
1027 |
sum_error = 0 |
1028 |
allocate(cpl_sols(klon,2), stat = error); sum_error = sum_error + error |
1029 |
allocate(cpl_nsol(klon,2), stat = error); sum_error = sum_error + error |
1030 |
allocate(cpl_rain(klon,2), stat = error); sum_error = sum_error + error |
1031 |
allocate(cpl_snow(klon,2), stat = error); sum_error = sum_error + error |
1032 |
allocate(cpl_evap(klon,2), stat = error); sum_error = sum_error + error |
1033 |
allocate(cpl_tsol(klon,2), stat = error); sum_error = sum_error + error |
1034 |
allocate(cpl_fder(klon,2), stat = error); sum_error = sum_error + error |
1035 |
allocate(cpl_albe(klon,2), stat = error); sum_error = sum_error + error |
1036 |
allocate(cpl_taux(klon,2), stat = error); sum_error = sum_error + error |
1037 |
allocate(cpl_windsp(klon,2), stat = error); sum_error = sum_error + error |
1038 |
allocate(cpl_tauy(klon,2), stat = error); sum_error = sum_error + error |
1039 |
ALLOCATE(cpl_rriv(iim,jjm+1), stat=error); sum_error = sum_error + error |
1040 |
ALLOCATE(cpl_rcoa(iim,jjm+1), stat=error); sum_error = sum_error + error |
1041 |
ALLOCATE(cpl_rlic(iim,jjm+1), stat=error); sum_error = sum_error + error |
1042 |
!! |
1043 |
allocate(read_sst(iim, jjm+1), stat = error); sum_error = sum_error + error |
1044 |
allocate(read_sic(iim, jjm+1), stat = error); sum_error = sum_error + error |
1045 |
allocate(read_sit(iim, jjm+1), stat = error); sum_error = sum_error + error |
1046 |
allocate(read_alb_sic(iim, jjm+1), stat = error); sum_error = sum_error + error |
1047 |
|
1048 |
if (sum_error /= 0) then |
1049 |
abort_message='Pb allocation variables couplees' |
1050 |
call abort_gcm(modname,abort_message,1) |
1051 |
endif |
1052 |
cpl_sols = 0.; cpl_nsol = 0.; cpl_rain = 0.; cpl_snow = 0. |
1053 |
cpl_evap = 0.; cpl_tsol = 0.; cpl_fder = 0.; cpl_albe = 0. |
1054 |
cpl_taux = 0.; cpl_tauy = 0.; cpl_rriv = 0.; cpl_rcoa = 0.; cpl_rlic = 0. |
1055 |
cpl_windsp = 0. |
1056 |
|
1057 |
sum_error = 0 |
1058 |
allocate(tamp_ind(klon), stat = error); sum_error = sum_error + error |
1059 |
allocate(tamp_zmasq(iim, jjm+1), stat = error); sum_error = sum_error + error |
1060 |
do ig = 1, klon |
1061 |
tamp_ind(ig) = ig |
1062 |
enddo |
1063 |
call gath2cpl(zmasq, tamp_zmasq, klon, klon, iim, jjm, tamp_ind) |
1064 |
! |
1065 |
! initialisation couplage |
1066 |
! |
1067 |
idtime = int(dtime) |
1068 |
! |
1069 |
! initialisation sorties netcdf |
1070 |
! |
1071 |
idayref = day_ini |
1072 |
CALL ymds2ju(annee_ref, 1, idayref, 0.0, zjulian) |
1073 |
CALL gr_fi_ecrit(1,klon,iim,jjm+1,rlon,zx_lon) |
1074 |
DO i = 1, iim |
1075 |
zx_lon(i,1) = rlon(i+1) |
1076 |
zx_lon(i,jjm+1) = rlon(i+1) |
1077 |
ENDDO |
1078 |
CALL gr_fi_ecrit(1,klon,iim,jjm+1,rlat,zx_lat) |
1079 |
clintocplnam="cpl_atm_tauflx" |
1080 |
CALL histbeg_totreg(clintocplnam, iim,zx_lon(:,1),jjm+1,zx_lat(1,:),1,iim,1,jjm+1, & |
1081 |
& itau_phy,zjulian,dtime,nhoridct,nidct) |
1082 |
! no vertical axis |
1083 |
CALL histdef(nidct, 'tauxe','tauxe', & |
1084 |
& "-",iim, jjm+1, nhoridct, 1, 1, 1, -99, 32, "inst", dtime,dtime) |
1085 |
CALL histdef(nidct, 'tauyn','tauyn', & |
1086 |
& "-",iim, jjm+1, nhoridct, 1, 1, 1, -99, 32, "inst", dtime,dtime) |
1087 |
CALL histdef(nidct, 'tmp_lon','tmp_lon', & |
1088 |
& "-",iim, jjm+1, nhoridct, 1, 1, 1, -99, 32, "inst", dtime,dtime) |
1089 |
CALL histdef(nidct, 'tmp_lat','tmp_lat', & |
1090 |
& "-",iim, jjm+1, nhoridct, 1, 1, 1, -99, 32, "inst", dtime,dtime) |
1091 |
DO jf=1,jpflda2o1 + jpflda2o2 |
1092 |
CALL histdef(nidct, cl_writ(jf),cl_writ(jf), & |
1093 |
& "-",iim, jjm+1, nhoridct, 1, 1, 1, -99, 32, "inst", dtime,dtime) |
1094 |
END DO |
1095 |
CALL histend(nidct) |
1096 |
CALL histsync(nidct) |
1097 |
|
1098 |
clfromcplnam="cpl_atm_sst" |
1099 |
CALL histbeg_totreg(clfromcplnam, iim,zx_lon(:,1),jjm+1,zx_lat(1,:),1,iim,1,jjm+1, & |
1100 |
& 0,zjulian,dtime,nhoridcs,nidcs) |
1101 |
! no vertical axis |
1102 |
DO jf=1,jpfldo2a |
1103 |
CALL histdef(nidcs, cl_read(jf),cl_read(jf), & |
1104 |
& "-",iim, jjm+1, nhoridcs, 1, 1, 1, -99, 32, "inst", dtime,dtime) |
1105 |
END DO |
1106 |
CALL histend(nidcs) |
1107 |
CALL histsync(nidcs) |
1108 |
|
1109 |
! pour simuler la fonte des glaciers antarctiques |
1110 |
! |
1111 |
surf_maille = (4. * rpi * ra**2) / (iim * (jjm +1)) |
1112 |
ALLOCATE(coeff_iceberg(iim,jjm+1), stat=error) |
1113 |
if (error /= 0) then |
1114 |
abort_message='Pb allocation variable coeff_iceberg' |
1115 |
call abort_gcm(modname,abort_message,1) |
1116 |
endif |
1117 |
open (12,file='flux_iceberg',form='formatted',status='old') |
1118 |
read (12,*) coeff_iceberg |
1119 |
close (12) |
1120 |
num_antarctic = max(1, count(coeff_iceberg > 0)) |
1121 |
|
1122 |
first_appel = .false. |
1123 |
endif ! fin if (first_appel) |
1124 |
|
1125 |
! Initialisations |
1126 |
|
1127 |
! calcul des fluxs a passer |
1128 |
nb_interf_cpl = nb_interf_cpl + 1 |
1129 |
if (check) write(lunout,*)'passage dans interface_surf.F90 : ',nb_interf_cpl |
1130 |
cpl_index = 1 |
1131 |
if (nisurf == is_sic) cpl_index = 2 |
1132 |
if (cumul) then |
1133 |
if (check) write(lunout,*)'passage dans cumul ' |
1134 |
if (check) write(lunout,*)'valeur de cpl_index ', cpl_index |
1135 |
! -- LOOP |
1136 |
if (check) write(*,*) modname, 'cumul des champs' |
1137 |
do ig = 1, knon |
1138 |
cpl_sols(ig,cpl_index) = cpl_sols(ig,cpl_index) & |
1139 |
& + swdown(ig) / FLOAT(nexca) |
1140 |
cpl_nsol(ig,cpl_index) = cpl_nsol(ig,cpl_index) & |
1141 |
& + (lwdown(ig) + fluxlat(ig) +fluxsens(ig))& |
1142 |
& / FLOAT(nexca) |
1143 |
cpl_rain(ig,cpl_index) = cpl_rain(ig,cpl_index) & |
1144 |
& + precip_rain(ig) / FLOAT(nexca) |
1145 |
cpl_snow(ig,cpl_index) = cpl_snow(ig,cpl_index) & |
1146 |
& + precip_snow(ig) / FLOAT(nexca) |
1147 |
cpl_evap(ig,cpl_index) = cpl_evap(ig,cpl_index) & |
1148 |
& + evap(ig) / FLOAT(nexca) |
1149 |
cpl_tsol(ig,cpl_index) = cpl_tsol(ig,cpl_index) & |
1150 |
& + tsurf(ig) / FLOAT(nexca) |
1151 |
cpl_fder(ig,cpl_index) = cpl_fder(ig,cpl_index) & |
1152 |
& + fder(ig) / FLOAT(nexca) |
1153 |
cpl_albe(ig,cpl_index) = cpl_albe(ig,cpl_index) & |
1154 |
& + albsol(ig) / FLOAT(nexca) |
1155 |
cpl_taux(ig,cpl_index) = cpl_taux(ig,cpl_index) & |
1156 |
& + taux(ig) / FLOAT(nexca) |
1157 |
cpl_tauy(ig,cpl_index) = cpl_tauy(ig,cpl_index) & |
1158 |
& + tauy(ig) / FLOAT(nexca) |
1159 |
IF (cpl_index .EQ. 1) THEN |
1160 |
cpl_windsp(ig,cpl_index) = cpl_windsp(ig,cpl_index) & |
1161 |
& + windsp(ig) / FLOAT(nexca) |
1162 |
ENDIF |
1163 |
enddo |
1164 |
IF (cpl_index .EQ. 1) THEN |
1165 |
cpl_rriv(:,:) = cpl_rriv(:,:) + tmp_rriv(:,:) / FLOAT(nexca) |
1166 |
cpl_rcoa(:,:) = cpl_rcoa(:,:) + tmp_rcoa(:,:) / FLOAT(nexca) |
1167 |
cpl_rlic(:,:) = cpl_rlic(:,:) + tmp_rlic(:,:) / FLOAT(nexca) |
1168 |
ENDIF |
1169 |
endif |
1170 |
|
1171 |
if (mod(itime, nexca) == 1) then |
1172 |
! |
1173 |
! Demande des champs au coupleur |
1174 |
! |
1175 |
! Si le domaine considere est l'ocean, on lit les champs venant du coupleur |
1176 |
! |
1177 |
if (nisurf == is_oce .and. .not. cumul) then |
1178 |
if (check) write(*,*)'rentree fromcpl, itime-1 = ',itime-1 |
1179 |
! |
1180 |
! sorties NETCDF des champs recus |
1181 |
! |
1182 |
ndexcs(:)=0 |
1183 |
itau_w = itau_phy + itime |
1184 |
CALL histwrite(nidcs,cl_read(1),itau_w,read_sst,iim*(jjm+1),ndexcs) |
1185 |
CALL histwrite(nidcs,cl_read(2),itau_w,read_sic,iim*(jjm+1),ndexcs) |
1186 |
CALL histwrite(nidcs,cl_read(3),itau_w,read_alb_sic,iim*(jjm+1),ndexcs) |
1187 |
CALL histwrite(nidcs,cl_read(4),itau_w,read_sit,iim*(jjm+1),ndexcs) |
1188 |
CALL histsync(nidcs) |
1189 |
! pas utile IF (npas-itime.LT.nexca )CALL histclo(nidcs) |
1190 |
|
1191 |
do j = 1, jjm + 1 |
1192 |
do ig = 1, iim |
1193 |
if (abs(1. - read_sic(ig,j)) < 0.00001) then |
1194 |
read_sst(ig,j) = RTT - 1.8 |
1195 |
read_sit(ig,j) = read_sit(ig,j) / read_sic(ig,j) |
1196 |
read_alb_sic(ig,j) = read_alb_sic(ig,j) / read_sic(ig,j) |
1197 |
else if (abs(read_sic(ig,j)) < 0.00001) then |
1198 |
read_sst(ig,j) = read_sst(ig,j) / (1. - read_sic(ig,j)) |
1199 |
read_sit(ig,j) = read_sst(ig,j) |
1200 |
read_alb_sic(ig,j) = 0.6 |
1201 |
else |
1202 |
read_sst(ig,j) = read_sst(ig,j) / (1. - read_sic(ig,j)) |
1203 |
read_sit(ig,j) = read_sit(ig,j) / read_sic(ig,j) |
1204 |
read_alb_sic(ig,j) = read_alb_sic(ig,j) / read_sic(ig,j) |
1205 |
endif |
1206 |
enddo |
1207 |
enddo |
1208 |
! |
1209 |
! transformer read_sic en pctsrf_sav |
1210 |
! |
1211 |
call cpl2gath(read_sic, tamp_sic , klon, klon,iim,jjm, unity) |
1212 |
do ig = 1, klon |
1213 |
IF (pctsrf(ig,is_oce) > epsfra .OR. & |
1214 |
& pctsrf(ig,is_sic) > epsfra) THEN |
1215 |
pctsrf_sav(ig,is_sic) = (pctsrf(ig,is_oce) + pctsrf(ig,is_sic)) & |
1216 |
& * tamp_sic(ig) |
1217 |
pctsrf_sav(ig,is_oce) = (pctsrf(ig,is_oce) + pctsrf(ig,is_sic)) & |
1218 |
& - pctsrf_sav(ig,is_sic) |
1219 |
endif |
1220 |
enddo |
1221 |
! |
1222 |
! Pour rattraper des erreurs d'arrondis |
1223 |
! |
1224 |
where (abs(pctsrf_sav(:,is_sic)) .le. 2.*epsilon(pctsrf_sav(1,is_sic))) |
1225 |
pctsrf_sav(:,is_sic) = 0. |
1226 |
pctsrf_sav(:,is_oce) = pctsrf(:,is_oce) + pctsrf(:,is_sic) |
1227 |
endwhere |
1228 |
where (abs(pctsrf_sav(:,is_oce)) .le. 2.*epsilon(pctsrf_sav(1,is_oce))) |
1229 |
pctsrf_sav(:,is_sic) = pctsrf(:,is_oce) + pctsrf(:,is_sic) |
1230 |
pctsrf_sav(:,is_oce) = 0. |
1231 |
endwhere |
1232 |
if (minval(pctsrf_sav(:,is_oce)) < 0.) then |
1233 |
write(*,*)'Pb fraction ocean inferieure a 0' |
1234 |
write(*,*)'au point ',minloc(pctsrf_sav(:,is_oce)) |
1235 |
write(*,*)'valeur = ',minval(pctsrf_sav(:,is_oce)) |
1236 |
abort_message = 'voir ci-dessus' |
1237 |
call abort_gcm(modname,abort_message,1) |
1238 |
endif |
1239 |
if (minval(pctsrf_sav(:,is_sic)) < 0.) then |
1240 |
write(*,*)'Pb fraction glace inferieure a 0' |
1241 |
write(*,*)'au point ',minloc(pctsrf_sav(:,is_sic)) |
1242 |
write(*,*)'valeur = ',minval(pctsrf_sav(:,is_sic)) |
1243 |
abort_message = 'voir ci-dessus' |
1244 |
call abort_gcm(modname,abort_message,1) |
1245 |
endif |
1246 |
endif |
1247 |
endif ! fin mod(itime, nexca) == 1 |
1248 |
|
1249 |
if (mod(itime, nexca) == 0) then |
1250 |
! |
1251 |
! allocation memoire |
1252 |
if (nisurf == is_oce .and. (.not. cumul) ) then |
1253 |
sum_error = 0 |
1254 |
allocate(tmp_sols(iim,jjm+1,2), stat=error); sum_error = sum_error + error |
1255 |
allocate(tmp_nsol(iim,jjm+1,2), stat=error); sum_error = sum_error + error |
1256 |
allocate(tmp_rain(iim,jjm+1,2), stat=error); sum_error = sum_error + error |
1257 |
allocate(tmp_snow(iim,jjm+1,2), stat=error); sum_error = sum_error + error |
1258 |
allocate(tmp_evap(iim,jjm+1,2), stat=error); sum_error = sum_error + error |
1259 |
allocate(tmp_tsol(iim,jjm+1,2), stat=error); sum_error = sum_error + error |
1260 |
allocate(tmp_fder(iim,jjm+1,2), stat=error); sum_error = sum_error + error |
1261 |
allocate(tmp_albe(iim,jjm+1,2), stat=error); sum_error = sum_error + error |
1262 |
allocate(tmp_taux(iim,jjm+1,2), stat=error); sum_error = sum_error + error |
1263 |
allocate(tmp_tauy(iim,jjm+1,2), stat=error); sum_error = sum_error + error |
1264 |
allocate(tmp_windsp(iim,jjm+1,2), stat=error); sum_error = sum_error + error |
1265 |
!!$ allocate(tmp_rriv(iim,jjm+1,2), stat=error); sum_error = sum_error + error |
1266 |
!!$ allocate(tmp_rcoa(iim,jjm+1,2), stat=error); sum_error = sum_error + error |
1267 |
if (sum_error /= 0) then |
1268 |
abort_message='Pb allocation variables couplees pour l''ecriture' |
1269 |
call abort_gcm(modname,abort_message,1) |
1270 |
endif |
1271 |
endif |
1272 |
|
1273 |
! |
1274 |
! Mise sur la bonne grille des champs a passer au coupleur |
1275 |
! |
1276 |
cpl_index = 1 |
1277 |
if (nisurf == is_sic) cpl_index = 2 |
1278 |
call gath2cpl(cpl_sols(1,cpl_index), tmp_sols(1,1,cpl_index), klon, knon,iim,jjm, knindex) |
1279 |
call gath2cpl(cpl_nsol(1,cpl_index), tmp_nsol(1,1,cpl_index), klon, knon,iim,jjm, knindex) |
1280 |
call gath2cpl(cpl_rain(1,cpl_index), tmp_rain(1,1,cpl_index), klon, knon,iim,jjm, knindex) |
1281 |
call gath2cpl(cpl_snow(1,cpl_index), tmp_snow(1,1,cpl_index), klon, knon,iim,jjm, knindex) |
1282 |
call gath2cpl(cpl_evap(1,cpl_index), tmp_evap(1,1,cpl_index), klon, knon,iim,jjm, knindex) |
1283 |
call gath2cpl(cpl_tsol(1,cpl_index), tmp_tsol(1,1,cpl_index), klon, knon,iim,jjm, knindex) |
1284 |
call gath2cpl(cpl_fder(1,cpl_index), tmp_fder(1,1,cpl_index), klon, knon,iim,jjm, knindex) |
1285 |
call gath2cpl(cpl_albe(1,cpl_index), tmp_albe(1,1,cpl_index), klon, knon,iim,jjm, knindex) |
1286 |
call gath2cpl(cpl_taux(1,cpl_index), tmp_taux(1,1,cpl_index), klon, knon,iim,jjm, knindex) |
1287 |
call gath2cpl(cpl_windsp(1,cpl_index), tmp_windsp(1,1,cpl_index), klon, knon,iim,jjm, knindex) |
1288 |
call gath2cpl(cpl_tauy(1,cpl_index), tmp_tauy(1,1,cpl_index), klon, knon,iim,jjm, knindex) |
1289 |
|
1290 |
! |
1291 |
! Si le domaine considere est la banquise, on envoie les champs au coupleur |
1292 |
! |
1293 |
if (nisurf == is_sic .and. cumul) then |
1294 |
wri_rain = 0.; wri_snow = 0.; wri_rcoa = 0.; wri_rriv = 0. |
1295 |
wri_taux = 0.; wri_tauy = 0. |
1296 |
wri_windsp = 0. |
1297 |
! -- LOOP |
1298 |
call gath2cpl(pctsrf(1,is_oce), tamp_srf(1,1,1), klon, klon, iim, jjm, tamp_ind) |
1299 |
call gath2cpl(pctsrf(1,is_sic), tamp_srf(1,1,2), klon, klon, iim, jjm, tamp_ind) |
1300 |
|
1301 |
wri_sol_ice = tmp_sols(:,:,2) |
1302 |
wri_sol_sea = tmp_sols(:,:,1) |
1303 |
wri_nsol_ice = tmp_nsol(:,:,2) |
1304 |
wri_nsol_sea = tmp_nsol(:,:,1) |
1305 |
wri_fder_ice = tmp_fder(:,:,2) |
1306 |
wri_evap_ice = tmp_evap(:,:,2) |
1307 |
wri_evap_sea = tmp_evap(:,:,1) |
1308 |
wri_windsp = tmp_windsp(:,:,1) |
1309 |
|
1310 |
!!$PB |
1311 |
wri_rriv = cpl_rriv(:,:) |
1312 |
wri_rcoa = cpl_rcoa(:,:) |
1313 |
DO j = 1, jjm + 1 |
1314 |
wri_calv(:,j) = sum(cpl_rlic(:,j)) / iim |
1315 |
enddo |
1316 |
|
1317 |
where (tamp_zmasq /= 1.) |
1318 |
deno = tamp_srf(:,:,1) + tamp_srf(:,:,2) |
1319 |
wri_rain = tmp_rain(:,:,1) * tamp_srf(:,:,1) / deno + & |
1320 |
& tmp_rain(:,:,2) * tamp_srf(:,:,2) / deno |
1321 |
wri_snow = tmp_snow(:,:,1) * tamp_srf(:,:,1) / deno + & |
1322 |
& tmp_snow(:,:,2) * tamp_srf(:,:,2) / deno |
1323 |
wri_taux = tmp_taux(:,:,1) * tamp_srf(:,:,1) / deno + & |
1324 |
& tmp_taux(:,:,2) * tamp_srf(:,:,2) / deno |
1325 |
wri_tauy = tmp_tauy(:,:,1) * tamp_srf(:,:,1) / deno + & |
1326 |
& tmp_tauy(:,:,2) * tamp_srf(:,:,2) / deno |
1327 |
endwhere |
1328 |
! |
1329 |
! pour simuler la fonte des glaciers antarctiques |
1330 |
! |
1331 |
!$$$ wri_rain = wri_rain & |
1332 |
!$$$ & + coeff_iceberg * cte_flux_iceberg / (num_antarctic * surf_maille) |
1333 |
! wri_calv = coeff_iceberg * cte_flux_iceberg / (num_antarctic * surf_maille) |
1334 |
! |
1335 |
! on passe les coordonnées de la grille |
1336 |
! |
1337 |
|
1338 |
CALL gr_fi_ecrit(1,klon,iim,jjm+1,rlon,tmp_lon) |
1339 |
CALL gr_fi_ecrit(1,klon,iim,jjm+1,rlat,tmp_lat) |
1340 |
|
1341 |
DO i = 1, iim |
1342 |
tmp_lon(i,1) = rlon(i+1) |
1343 |
tmp_lon(i,jjm + 1) = rlon(i+1) |
1344 |
ENDDO |
1345 |
! |
1346 |
! sortie netcdf des champs pour le changement de repere |
1347 |
! |
1348 |
ndexct(:)=0 |
1349 |
CALL histwrite(nidct,'tauxe',itau_w,wri_taux,iim*(jjm+1),ndexct) |
1350 |
CALL histwrite(nidct,'tauyn',itau_w,wri_tauy,iim*(jjm+1),ndexct) |
1351 |
CALL histwrite(nidct,'tmp_lon',itau_w,tmp_lon,iim*(jjm+1),ndexct) |
1352 |
CALL histwrite(nidct,'tmp_lat',itau_w,tmp_lat,iim*(jjm+1),ndexct) |
1353 |
|
1354 |
! |
1355 |
! calcul 3 coordonnées du vent |
1356 |
! |
1357 |
CALL atm2geo (iim , jjm + 1, wri_taux, wri_tauy, tmp_lon, tmp_lat, & |
1358 |
& wri_tauxx, wri_tauyy, wri_tauzz ) |
1359 |
! |
1360 |
! sortie netcdf des champs apres changement de repere et juste avant |
1361 |
! envoi au coupleur |
1362 |
! |
1363 |
CALL histwrite(nidct,cl_writ(8),itau_w,wri_sol_ice,iim*(jjm+1),ndexct) |
1364 |
CALL histwrite(nidct,cl_writ(9),itau_w,wri_sol_sea,iim*(jjm+1),ndexct) |
1365 |
CALL histwrite(nidct,cl_writ(10),itau_w,wri_nsol_ice,iim*(jjm+1),ndexct) |
1366 |
CALL histwrite(nidct,cl_writ(11),itau_w,wri_nsol_sea,iim*(jjm+1),ndexct) |
1367 |
CALL histwrite(nidct,cl_writ(12),itau_w,wri_fder_ice,iim*(jjm+1),ndexct) |
1368 |
CALL histwrite(nidct,cl_writ(13),itau_w,wri_evap_ice,iim*(jjm+1),ndexct) |
1369 |
CALL histwrite(nidct,cl_writ(14),itau_w,wri_evap_sea,iim*(jjm+1),ndexct) |
1370 |
CALL histwrite(nidct,cl_writ(15),itau_w,wri_rain,iim*(jjm+1),ndexct) |
1371 |
CALL histwrite(nidct,cl_writ(16),itau_w,wri_snow,iim*(jjm+1),ndexct) |
1372 |
CALL histwrite(nidct,cl_writ(17),itau_w,wri_rcoa,iim*(jjm+1),ndexct) |
1373 |
CALL histwrite(nidct,cl_writ(18),itau_w,wri_rriv,iim*(jjm+1),ndexct) |
1374 |
CALL histwrite(nidct,cl_writ(19),itau_w,wri_calv,iim*(jjm+1),ndexct) |
1375 |
CALL histwrite(nidct,cl_writ(1),itau_w,wri_tauxx,iim*(jjm+1),ndexct) |
1376 |
CALL histwrite(nidct,cl_writ(2),itau_w,wri_tauyy,iim*(jjm+1),ndexct) |
1377 |
CALL histwrite(nidct,cl_writ(3),itau_w,wri_tauzz,iim*(jjm+1),ndexct) |
1378 |
CALL histwrite(nidct,cl_writ(4),itau_w,wri_tauxx,iim*(jjm+1),ndexct) |
1379 |
CALL histwrite(nidct,cl_writ(5),itau_w,wri_tauyy,iim*(jjm+1),ndexct) |
1380 |
CALL histwrite(nidct,cl_writ(6),itau_w,wri_tauzz,iim*(jjm+1),ndexct) |
1381 |
CALL histwrite(nidct,cl_writ(7),itau_w,wri_windsp,iim*(jjm+1),ndexct) |
1382 |
CALL histsync(nidct) |
1383 |
! pas utile IF (lafin) CALL histclo(nidct) |
1384 |
! |
1385 |
cpl_sols = 0.; cpl_nsol = 0.; cpl_rain = 0.; cpl_snow = 0. |
1386 |
cpl_evap = 0.; cpl_tsol = 0.; cpl_fder = 0.; cpl_albe = 0. |
1387 |
cpl_taux = 0.; cpl_tauy = 0.; cpl_rriv = 0.; cpl_rcoa = 0.; cpl_rlic = 0. |
1388 |
cpl_windsp = 0. |
1389 |
! |
1390 |
! deallocation memoire variables temporaires |
1391 |
! |
1392 |
sum_error = 0 |
1393 |
deallocate(tmp_sols, stat=error); sum_error = sum_error + error |
1394 |
deallocate(tmp_nsol, stat=error); sum_error = sum_error + error |
1395 |
deallocate(tmp_rain, stat=error); sum_error = sum_error + error |
1396 |
deallocate(tmp_snow, stat=error); sum_error = sum_error + error |
1397 |
deallocate(tmp_evap, stat=error); sum_error = sum_error + error |
1398 |
deallocate(tmp_fder, stat=error); sum_error = sum_error + error |
1399 |
deallocate(tmp_tsol, stat=error); sum_error = sum_error + error |
1400 |
deallocate(tmp_albe, stat=error); sum_error = sum_error + error |
1401 |
deallocate(tmp_taux, stat=error); sum_error = sum_error + error |
1402 |
deallocate(tmp_tauy, stat=error); sum_error = sum_error + error |
1403 |
deallocate(tmp_windsp, stat=error); sum_error = sum_error + error |
1404 |
if (sum_error /= 0) then |
1405 |
abort_message='Pb deallocation variables couplees' |
1406 |
call abort_gcm(modname,abort_message,1) |
1407 |
endif |
1408 |
|
1409 |
endif |
1410 |
|
1411 |
endif ! fin (mod(itime, nexca) == 0) |
1412 |
! |
1413 |
! on range les variables lues/sauvegardees dans les bonnes variables de sortie |
1414 |
! |
1415 |
if (nisurf == is_oce) then |
1416 |
call cpl2gath(read_sst, tsurf_new, klon, knon,iim,jjm, knindex) |
1417 |
else if (nisurf == is_sic) then |
1418 |
call cpl2gath(read_sit, tsurf_new, klon, knon,iim,jjm, knindex) |
1419 |
call cpl2gath(read_alb_sic, alb_new, klon, knon,iim,jjm, knindex) |
1420 |
endif |
1421 |
pctsrf_new(:,nisurf) = pctsrf_sav(:,nisurf) |
1422 |
|
1423 |
! if (lafin) call quitcpl |
1424 |
|
1425 |
END SUBROUTINE interfoce_cpl |
1426 |
|
1427 |
!************************ |
1428 |
|
1429 |
SUBROUTINE interfoce_slab(klon, debut, itap, dtime, ijour, & |
1430 |
& radsol, fluxo, fluxg, pctsrf, & |
1431 |
& tslab, seaice, pctsrf_slab) |
1432 |
! |
1433 |
! Cette routine calcule la temperature d'un slab ocean, la glace de mer |
1434 |
! et les pourcentages de la maille couverte par l'ocean libre et/ou |
1435 |
! la glace de mer pour un "slab" ocean de 50m |
1436 |
! |
1437 |
! I. Musat 04.02.2005 |
1438 |
! |
1439 |
! input: |
1440 |
! klon nombre total de points de grille |
1441 |
! debut logical: 1er appel a la physique |
1442 |
! itap numero du pas de temps |
1443 |
! dtime pas de temps de la physique (en s) |
1444 |
! ijour jour dans l'annee en cours |
1445 |
! radsol rayonnement net au sol (LW + SW) |
1446 |
! fluxo flux turbulent (sensible + latent) sur les mailles oceaniques |
1447 |
! fluxg flux de conduction entre la surface de la glace de mer et l'ocean |
1448 |
! pctsrf tableau des pourcentages de surface de chaque maille |
1449 |
! output: |
1450 |
! tslab temperature de l'ocean libre |
1451 |
! seaice glace de mer (kg/m2) |
1452 |
! pctsrf_slab "pourcentages" (valeurs entre 0. et 1.) surfaces issus du slab |
1453 |
! |
1454 |
use indicesol |
1455 |
use clesphys |
1456 |
use abort_gcm_m, only: abort_gcm |
1457 |
use YOMCST |
1458 |
|
1459 |
! Parametres d'entree |
1460 |
integer, intent(IN) :: klon |
1461 |
logical, intent(IN) :: debut |
1462 |
INTEGER, intent(IN) :: itap |
1463 |
REAL, intent(IN) :: dtime |
1464 |
INTEGER, intent(IN) :: ijour |
1465 |
REAL, dimension(klon), intent(IN) :: radsol |
1466 |
REAL, dimension(klon), intent(IN) :: fluxo |
1467 |
REAL, dimension(klon), intent(IN) :: fluxg |
1468 |
real, dimension(klon, nbsrf), intent(IN) :: pctsrf |
1469 |
! Parametres de sortie |
1470 |
real, dimension(klon), intent(INOUT) :: tslab |
1471 |
real, dimension(klon), intent(INOUT) :: seaice ! glace de mer (kg/m2) |
1472 |
real, dimension(klon, nbsrf), intent(OUT) :: pctsrf_slab |
1473 |
! |
1474 |
! Variables locales : |
1475 |
INTEGER, save :: lmt_pas, julien, idayvrai |
1476 |
REAL, parameter :: unjour=86400. |
1477 |
real, allocatable, dimension(:), save :: tmp_tslab, tmp_seaice |
1478 |
REAL, allocatable, dimension(:), save :: slab_bils |
1479 |
REAL, allocatable, dimension(:), save :: lmt_bils |
1480 |
logical,save :: check = .false. |
1481 |
! |
1482 |
REAL, parameter :: cyang=50.0 * 4.228e+06 ! capacite calorifique volumetrique de l'eau J/(m2 K) |
1483 |
REAL, parameter :: cbing=0.334e+05 ! J/kg |
1484 |
real, dimension(klon) :: siceh !hauteur de la glace de mer (m) |
1485 |
INTEGER :: i |
1486 |
integer :: sum_error, error |
1487 |
REAL :: zz, za, zb |
1488 |
! |
1489 |
character (len = 80) :: abort_message |
1490 |
character (len = 20) :: modname = 'interfoce_slab' |
1491 |
! |
1492 |
julien = MOD(ijour,360) |
1493 |
sum_error = 0 |
1494 |
IF (debut) THEN |
1495 |
allocate(slab_bils(klon), stat = error); sum_error = sum_error + error |
1496 |
allocate(lmt_bils(klon), stat = error); sum_error = sum_error + error |
1497 |
allocate(tmp_tslab(klon), stat = error); sum_error = sum_error + error |
1498 |
allocate(tmp_seaice(klon), stat = error); sum_error = sum_error + error |
1499 |
if (sum_error /= 0) then |
1500 |
abort_message='Pb allocation var. slab_bils,lmt_bils,tmp_tslab,tmp_seaice' |
1501 |
call abort_gcm(modname,abort_message,1) |
1502 |
endif |
1503 |
tmp_tslab=tslab |
1504 |
tmp_seaice=seaice |
1505 |
lmt_pas = nint(86400./dtime * 1.0) ! pour une lecture une fois par jour |
1506 |
! |
1507 |
IF (check) THEN |
1508 |
PRINT*,'interfoce_slab klon, debut, itap, dtime, ijour, & |
1509 |
& lmt_pas ', klon, debut, itap, dtime, ijour, & |
1510 |
& lmt_pas |
1511 |
ENDIF !check |
1512 |
! |
1513 |
PRINT*, '************************' |
1514 |
PRINT*, 'SLAB OCEAN est actif, prenez precautions !' |
1515 |
PRINT*, '************************' |
1516 |
! |
1517 |
! a mettre un slab_bils aussi en force !!! |
1518 |
! |
1519 |
DO i = 1, klon |
1520 |
slab_bils(i) = 0.0 |
1521 |
ENDDO |
1522 |
! |
1523 |
ENDIF !debut |
1524 |
pctsrf_slab(1:klon,1:nbsrf) = pctsrf(1:klon,1:nbsrf) |
1525 |
! |
1526 |
! lecture du bilan au sol lmt_bils issu d'une simulation forcee en debut de journee |
1527 |
! |
1528 |
IF (MOD(itap,lmt_pas) .EQ. 1) THEN !1er pas de temps de la journee |
1529 |
idayvrai = ijour |
1530 |
CALL condsurf(julien,idayvrai, lmt_bils) |
1531 |
ENDIF !(MOD(itap-1,lmt_pas) .EQ. 0) THEN |
1532 |
|
1533 |
DO i = 1, klon |
1534 |
IF((pctsrf_slab(i,is_oce).GT.epsfra).OR. & |
1535 |
& (pctsrf_slab(i,is_sic).GT.epsfra)) THEN |
1536 |
! |
1537 |
! fabriquer de la glace si congelation atteinte: |
1538 |
! |
1539 |
IF (tmp_tslab(i).LT.(RTT-1.8)) THEN |
1540 |
zz = (RTT-1.8)-tmp_tslab(i) |
1541 |
tmp_seaice(i) = tmp_seaice(i) + cyang/cbing * zz |
1542 |
seaice(i) = tmp_seaice(i) |
1543 |
tmp_tslab(i) = RTT-1.8 |
1544 |
ENDIF |
1545 |
! |
1546 |
! faire fondre de la glace si temperature est superieure a 0: |
1547 |
! |
1548 |
IF ((tmp_tslab(i).GT.RTT) .AND. (tmp_seaice(i).GT.0.0)) THEN |
1549 |
zz = cyang/cbing * (tmp_tslab(i)-RTT) |
1550 |
zz = MIN(zz,tmp_seaice(i)) |
1551 |
tmp_seaice(i) = tmp_seaice(i) - zz |
1552 |
seaice(i) = tmp_seaice(i) |
1553 |
tmp_tslab(i) = tmp_tslab(i) - zz*cbing/cyang |
1554 |
ENDIF |
1555 |
! |
1556 |
! limiter la glace de mer a 10 metres (10000 kg/m2) |
1557 |
! |
1558 |
IF(tmp_seaice(i).GT.45.) THEN |
1559 |
tmp_seaice(i) = MIN(tmp_seaice(i),10000.0) |
1560 |
ELSE |
1561 |
tmp_seaice(i) = 0. |
1562 |
ENDIF |
1563 |
seaice(i) = tmp_seaice(i) |
1564 |
siceh(i)=tmp_seaice(i)/1000. !en metres |
1565 |
! |
1566 |
! determiner la nature du sol (glace de mer ou ocean libre): |
1567 |
! |
1568 |
! on fait dependre la fraction de seaice "pctsrf(i,is_sic)" |
1569 |
! de l'epaisseur de seaice : |
1570 |
! pctsrf(i,is_sic)=1. si l'epaisseur de la glace de mer est >= a 20cm |
1571 |
! et pctsrf(i,is_sic) croit lineairement avec seaice de 0. a 20cm d'epaisseur |
1572 |
! |
1573 |
pctsrf_slab(i,is_sic)=MIN(siceh(i)/0.20, & |
1574 |
& 1.-(pctsrf_slab(i,is_ter)+pctsrf_slab(i,is_lic))) |
1575 |
pctsrf_slab(i,is_oce)=1.0 - & |
1576 |
& (pctsrf_slab(i,is_ter)+pctsrf_slab(i,is_lic)+pctsrf_slab(i,is_sic)) |
1577 |
ENDIF !pctsrf |
1578 |
ENDDO |
1579 |
! |
1580 |
! Calculer le bilan du flux de chaleur au sol : |
1581 |
! |
1582 |
DO i = 1, klon |
1583 |
za = radsol(i) + fluxo(i) |
1584 |
zb = fluxg(i) |
1585 |
IF((pctsrf_slab(i,is_oce).GT.epsfra).OR. & |
1586 |
& (pctsrf_slab(i,is_sic).GT.epsfra)) THEN |
1587 |
slab_bils(i)=slab_bils(i)+(za*pctsrf_slab(i,is_oce) & |
1588 |
& +zb*pctsrf_slab(i,is_sic))/ FLOAT(lmt_pas) |
1589 |
ENDIF |
1590 |
ENDDO !klon |
1591 |
! |
1592 |
! calcul tslab |
1593 |
! |
1594 |
IF (MOD(itap,lmt_pas).EQ.0) THEN !fin de journee |
1595 |
DO i = 1, klon |
1596 |
IF ((pctsrf_slab(i,is_oce).GT.epsfra).OR. & |
1597 |
& (pctsrf_slab(i,is_sic).GT.epsfra)) THEN |
1598 |
tmp_tslab(i) = tmp_tslab(i) + & |
1599 |
& (slab_bils(i)-lmt_bils(i)) & |
1600 |
& /cyang*unjour |
1601 |
! on remet l'accumulation a 0 |
1602 |
slab_bils(i) = 0. |
1603 |
ENDIF !pctsrf |
1604 |
ENDDO !klon |
1605 |
ENDIF !(MOD(itap,lmt_pas).EQ.0) THEN |
1606 |
! |
1607 |
tslab = tmp_tslab |
1608 |
seaice = tmp_seaice |
1609 |
END SUBROUTINE interfoce_slab |
1610 |
|
1611 |
!************************ |
1612 |
|
1613 |
SUBROUTINE interfoce_lim(itime, dtime, jour, & |
1614 |
& klon, nisurf, knon, knindex, & |
1615 |
& debut, & |
1616 |
& lmt_sst, pctsrf_new) |
1617 |
|
1618 |
! Cette routine sert d'interface entre le modele atmospherique et un fichier |
1619 |
! de conditions aux limites |
1620 |
! |
1621 |
! L. Fairhead 02/2000 |
1622 |
! |
1623 |
! input: |
1624 |
! itime numero du pas de temps courant |
1625 |
! dtime pas de temps de la physique (en s) |
1626 |
! jour jour a lire dans l'annee |
1627 |
! nisurf index de la surface a traiter (1 = sol continental) |
1628 |
! knon nombre de points dans le domaine a traiter |
1629 |
! knindex index des points de la surface a traiter |
1630 |
! klon taille de la grille |
1631 |
! debut logical: 1er appel a la physique (initialisation) |
1632 |
! |
1633 |
! output: |
1634 |
! lmt_sst SST lues dans le fichier de CL |
1635 |
! pctsrf_new sous-maille fractionnelle |
1636 |
! |
1637 |
|
1638 |
use abort_gcm_m, only: abort_gcm |
1639 |
use indicesol |
1640 |
|
1641 |
! Parametres d'entree |
1642 |
integer, intent(IN) :: itime |
1643 |
real , intent(IN) :: dtime |
1644 |
integer, intent(IN) :: jour |
1645 |
integer, intent(IN) :: nisurf |
1646 |
integer, intent(IN) :: knon |
1647 |
integer, intent(IN) :: klon |
1648 |
integer, dimension(klon), intent(in) :: knindex |
1649 |
logical, intent(IN) :: debut |
1650 |
|
1651 |
! Parametres de sortie |
1652 |
real, intent(out), dimension(klon) :: lmt_sst |
1653 |
real, intent(out), dimension(klon,nbsrf) :: pctsrf_new |
1654 |
|
1655 |
! Variables locales |
1656 |
integer :: ii |
1657 |
INTEGER,save :: lmt_pas ! frequence de lecture des conditions limites |
1658 |
! (en pas de physique) |
1659 |
logical,save :: deja_lu ! pour indiquer que le jour a lire a deja |
1660 |
! lu pour une surface precedente |
1661 |
integer,save :: jour_lu |
1662 |
integer :: ierr |
1663 |
character (len = 20) :: modname = 'interfoce_lim' |
1664 |
character (len = 80) :: abort_message |
1665 |
logical, save :: newlmt = .TRUE. |
1666 |
logical, save :: check = .FALSE. |
1667 |
! Champs lus dans le fichier de CL |
1668 |
real, allocatable , save, dimension(:) :: sst_lu, rug_lu, nat_lu |
1669 |
real, allocatable , save, dimension(:,:) :: pct_tmp |
1670 |
! |
1671 |
! quelques variables pour netcdf |
1672 |
! |
1673 |
include "netcdf.inc" |
1674 |
integer :: nid, nvarid |
1675 |
integer, dimension(2) :: start, epais |
1676 |
! |
1677 |
! Fin déclaration |
1678 |
! |
1679 |
|
1680 |
if (debut .and. .not. allocated(sst_lu)) then |
1681 |
lmt_pas = nint(86400./dtime * 1.0) ! pour une lecture une fois par jour |
1682 |
jour_lu = jour - 1 |
1683 |
allocate(sst_lu(klon)) |
1684 |
allocate(nat_lu(klon)) |
1685 |
allocate(pct_tmp(klon,nbsrf)) |
1686 |
endif |
1687 |
|
1688 |
if ((jour - jour_lu) /= 0) deja_lu = .false. |
1689 |
|
1690 |
if (check) write(*,*)modname,' :: jour, jour_lu, deja_lu', jour, jour_lu, & |
1691 |
deja_lu |
1692 |
if (check) write(*,*)modname,' :: itime, lmt_pas ', itime, lmt_pas,dtime |
1693 |
|
1694 |
! Tester d'abord si c'est le moment de lire le fichier |
1695 |
if (mod(itime-1, lmt_pas) == 0 .and. .not. deja_lu) then |
1696 |
! |
1697 |
! Ouverture du fichier |
1698 |
! |
1699 |
ierr = NF_OPEN ('limit.nc', NF_NOWRITE,nid) |
1700 |
if (ierr.NE.NF_NOERR) then |
1701 |
abort_message & |
1702 |
= 'Pb d''ouverture du fichier de conditions aux limites' |
1703 |
call abort_gcm(modname,abort_message,1) |
1704 |
endif |
1705 |
! |
1706 |
! La tranche de donnees a lire: |
1707 |
! |
1708 |
start(1) = 1 |
1709 |
start(2) = jour |
1710 |
epais(1) = klon |
1711 |
epais(2) = 1 |
1712 |
! |
1713 |
if (newlmt) then |
1714 |
! |
1715 |
! Fraction "ocean" |
1716 |
! |
1717 |
ierr = NF_INQ_VARID(nid, 'FOCE', nvarid) |
1718 |
if (ierr /= NF_NOERR) then |
1719 |
abort_message = 'Le champ <FOCE> est absent' |
1720 |
call abort_gcm(modname,abort_message,1) |
1721 |
endif |
1722 |
ierr = NF_GET_VARA_REAL(nid,nvarid,start,epais,pct_tmp(1,is_oce)) |
1723 |
if (ierr /= NF_NOERR) then |
1724 |
abort_message = 'Lecture echouee pour <FOCE>' |
1725 |
call abort_gcm(modname,abort_message,1) |
1726 |
endif |
1727 |
! |
1728 |
! Fraction "glace de mer" |
1729 |
! |
1730 |
ierr = NF_INQ_VARID(nid, 'FSIC', nvarid) |
1731 |
if (ierr /= NF_NOERR) then |
1732 |
abort_message = 'Le champ <FSIC> est absent' |
1733 |
call abort_gcm(modname,abort_message,1) |
1734 |
endif |
1735 |
ierr = NF_GET_VARA_REAL(nid,nvarid,start,epais,pct_tmp(1,is_sic)) |
1736 |
if (ierr /= NF_NOERR) then |
1737 |
abort_message = 'Lecture echouee pour <FSIC>' |
1738 |
call abort_gcm(modname,abort_message,1) |
1739 |
endif |
1740 |
! |
1741 |
! Fraction "terre" |
1742 |
! |
1743 |
ierr = NF_INQ_VARID(nid, 'FTER', nvarid) |
1744 |
if (ierr /= NF_NOERR) then |
1745 |
abort_message = 'Le champ <FTER> est absent' |
1746 |
call abort_gcm(modname,abort_message,1) |
1747 |
endif |
1748 |
ierr = NF_GET_VARA_REAL(nid,nvarid,start,epais,pct_tmp(1,is_ter)) |
1749 |
if (ierr /= NF_NOERR) then |
1750 |
abort_message = 'Lecture echouee pour <FTER>' |
1751 |
call abort_gcm(modname,abort_message,1) |
1752 |
endif |
1753 |
! |
1754 |
! Fraction "glacier terre" |
1755 |
! |
1756 |
ierr = NF_INQ_VARID(nid, 'FLIC', nvarid) |
1757 |
if (ierr /= NF_NOERR) then |
1758 |
abort_message = 'Le champ <FLIC> est absent' |
1759 |
call abort_gcm(modname,abort_message,1) |
1760 |
endif |
1761 |
ierr = NF_GET_VARA_REAL(nid,nvarid,start,epais,pct_tmp(1,is_lic)) |
1762 |
if (ierr /= NF_NOERR) then |
1763 |
abort_message = 'Lecture echouee pour <FLIC>' |
1764 |
call abort_gcm(modname,abort_message,1) |
1765 |
endif |
1766 |
! |
1767 |
else ! on en est toujours a rnatur |
1768 |
! |
1769 |
ierr = NF_INQ_VARID(nid, 'NAT', nvarid) |
1770 |
if (ierr /= NF_NOERR) then |
1771 |
abort_message = 'Le champ <NAT> est absent' |
1772 |
call abort_gcm(modname,abort_message,1) |
1773 |
endif |
1774 |
ierr = NF_GET_VARA_REAL(nid,nvarid,start,epais, nat_lu) |
1775 |
if (ierr /= NF_NOERR) then |
1776 |
abort_message = 'Lecture echouee pour <NAT>' |
1777 |
call abort_gcm(modname,abort_message,1) |
1778 |
endif |
1779 |
! |
1780 |
! Remplissage des fractions de surface |
1781 |
! nat = 0, 1, 2, 3 pour ocean, terre, glacier, seaice |
1782 |
! |
1783 |
pct_tmp = 0.0 |
1784 |
do ii = 1, klon |
1785 |
pct_tmp(ii,nint(nat_lu(ii)) + 1) = 1. |
1786 |
enddo |
1787 |
|
1788 |
! |
1789 |
! On se retrouve avec ocean en 1 et terre en 2 alors qu'on veut le contraire |
1790 |
! |
1791 |
pctsrf_new = pct_tmp |
1792 |
pctsrf_new (:,2)= pct_tmp (:,1) |
1793 |
pctsrf_new (:,1)= pct_tmp (:,2) |
1794 |
pct_tmp = pctsrf_new |
1795 |
endif ! fin test sur newlmt |
1796 |
! |
1797 |
! Lecture SST |
1798 |
! |
1799 |
ierr = NF_INQ_VARID(nid, 'SST', nvarid) |
1800 |
if (ierr /= NF_NOERR) then |
1801 |
abort_message = 'Le champ <SST> est absent' |
1802 |
call abort_gcm(modname,abort_message,1) |
1803 |
endif |
1804 |
ierr = NF_GET_VARA_REAL(nid,nvarid,start,epais, sst_lu) |
1805 |
if (ierr /= NF_NOERR) then |
1806 |
abort_message = 'Lecture echouee pour <SST>' |
1807 |
call abort_gcm(modname,abort_message,1) |
1808 |
endif |
1809 |
|
1810 |
! |
1811 |
! Fin de lecture |
1812 |
! |
1813 |
ierr = NF_CLOSE(nid) |
1814 |
deja_lu = .true. |
1815 |
jour_lu = jour |
1816 |
endif |
1817 |
! |
1818 |
! Recopie des variables dans les champs de sortie |
1819 |
! |
1820 |
lmt_sst = 999999999. |
1821 |
do ii = 1, knon |
1822 |
lmt_sst(ii) = sst_lu(knindex(ii)) |
1823 |
enddo |
1824 |
|
1825 |
pctsrf_new(:,is_oce) = pct_tmp(:,is_oce) |
1826 |
pctsrf_new(:,is_sic) = pct_tmp(:,is_sic) |
1827 |
|
1828 |
END SUBROUTINE interfoce_lim |
1829 |
|
1830 |
!************************ |
1831 |
|
1832 |
SUBROUTINE interfsur_lim(itime, dtime, jour, & |
1833 |
& klon, nisurf, knon, knindex, & |
1834 |
& debut, & |
1835 |
& lmt_alb, lmt_rug) |
1836 |
|
1837 |
! Cette routine sert d'interface entre le modèle atmosphérique et |
1838 |
! un fichier de conditions aux limites. |
1839 |
! |
1840 |
! L. Fairhead 02/2000 |
1841 |
! |
1842 |
! input: |
1843 |
! itime numero du pas de temps courant |
1844 |
! dtime pas de temps de la physique (en s) |
1845 |
! jour jour a lire dans l'annee |
1846 |
! nisurf index de la surface a traiter (1 = sol continental) |
1847 |
! knon nombre de points dans le domaine a traiter |
1848 |
! knindex index des points de la surface a traiter |
1849 |
! klon taille de la grille |
1850 |
! debut logical: 1er appel a la physique (initialisation) |
1851 |
! |
1852 |
! output: |
1853 |
! lmt_sst SST lues dans le fichier de CL |
1854 |
! lmt_alb Albedo lu |
1855 |
! lmt_rug longueur de rugosité lue |
1856 |
! pctsrf_new sous-maille fractionnelle |
1857 |
! |
1858 |
|
1859 |
use abort_gcm_m, only: abort_gcm |
1860 |
|
1861 |
! Parametres d'entree |
1862 |
integer, intent(IN) :: itime |
1863 |
real , intent(IN) :: dtime |
1864 |
integer, intent(IN) :: jour |
1865 |
integer, intent(IN) :: nisurf |
1866 |
integer, intent(IN) :: knon |
1867 |
integer, intent(IN) :: klon |
1868 |
integer, dimension(klon), intent(in) :: knindex |
1869 |
logical, intent(IN) :: debut |
1870 |
|
1871 |
! Parametres de sortie |
1872 |
real, intent(out), dimension(klon) :: lmt_alb |
1873 |
real, intent(out), dimension(klon) :: lmt_rug |
1874 |
|
1875 |
! Variables locales |
1876 |
integer :: ii |
1877 |
integer,save :: lmt_pas ! frequence de lecture des conditions limites |
1878 |
! (en pas de physique) |
1879 |
logical,save :: deja_lu_sur! pour indiquer que le jour a lire a deja |
1880 |
! lu pour une surface precedente |
1881 |
integer,save :: jour_lu_sur |
1882 |
integer :: ierr |
1883 |
character (len = 20) :: modname = 'interfsur_lim' |
1884 |
character (len = 80) :: abort_message |
1885 |
logical,save :: newlmt = .false. |
1886 |
logical,save :: check = .false. |
1887 |
! Champs lus dans le fichier de CL |
1888 |
real, allocatable , save, dimension(:) :: alb_lu, rug_lu |
1889 |
! |
1890 |
! quelques variables pour netcdf |
1891 |
! |
1892 |
include "netcdf.inc" |
1893 |
integer ,save :: nid, nvarid |
1894 |
integer, dimension(2),save :: start, epais |
1895 |
! |
1896 |
! Fin déclaration |
1897 |
! |
1898 |
|
1899 |
if (debut) then |
1900 |
lmt_pas = nint(86400./dtime * 1.0) ! pour une lecture une fois par jour |
1901 |
jour_lu_sur = jour - 1 |
1902 |
allocate(alb_lu(klon)) |
1903 |
allocate(rug_lu(klon)) |
1904 |
endif |
1905 |
|
1906 |
if ((jour - jour_lu_sur) /= 0) deja_lu_sur = .false. |
1907 |
|
1908 |
if (check) write(*,*)modname,':: jour_lu_sur, deja_lu_sur', jour_lu_sur, & |
1909 |
deja_lu_sur |
1910 |
if (check) write(*,*)modname,':: itime, lmt_pas', itime, lmt_pas |
1911 |
|
1912 |
! Tester d'abord si c'est le moment de lire le fichier |
1913 |
if (mod(itime-1, lmt_pas) == 0 .and. .not. deja_lu_sur) then |
1914 |
! |
1915 |
! Ouverture du fichier |
1916 |
! |
1917 |
ierr = NF_OPEN ('limit.nc', NF_NOWRITE,nid) |
1918 |
if (ierr.NE.NF_NOERR) then |
1919 |
abort_message & |
1920 |
= 'Pb d''ouverture du fichier de conditions aux limites' |
1921 |
call abort_gcm(modname,abort_message,1) |
1922 |
endif |
1923 |
! |
1924 |
! La tranche de donnees a lire: |
1925 |
|
1926 |
start(1) = 1 |
1927 |
start(2) = jour |
1928 |
epais(1) = klon |
1929 |
epais(2) = 1 |
1930 |
! |
1931 |
! Lecture Albedo |
1932 |
! |
1933 |
ierr = NF_INQ_VARID(nid, 'ALB', nvarid) |
1934 |
if (ierr /= NF_NOERR) then |
1935 |
abort_message = 'Le champ <ALB> est absent' |
1936 |
call abort_gcm(modname,abort_message,1) |
1937 |
endif |
1938 |
ierr = NF_GET_VARA_REAL(nid,nvarid,start,epais, alb_lu) |
1939 |
if (ierr /= NF_NOERR) then |
1940 |
abort_message = 'Lecture echouee pour <ALB>' |
1941 |
call abort_gcm(modname,abort_message,1) |
1942 |
endif |
1943 |
! |
1944 |
! Lecture rugosité |
1945 |
! |
1946 |
ierr = NF_INQ_VARID(nid, 'RUG', nvarid) |
1947 |
if (ierr /= NF_NOERR) then |
1948 |
abort_message = 'Le champ <RUG> est absent' |
1949 |
call abort_gcm(modname,abort_message,1) |
1950 |
endif |
1951 |
ierr = NF_GET_VARA_REAL(nid,nvarid,start,epais, rug_lu) |
1952 |
if (ierr /= NF_NOERR) then |
1953 |
abort_message = 'Lecture echouee pour <RUG>' |
1954 |
call abort_gcm(modname,abort_message,1) |
1955 |
endif |
1956 |
|
1957 |
! |
1958 |
! Fin de lecture |
1959 |
! |
1960 |
ierr = NF_CLOSE(nid) |
1961 |
deja_lu_sur = .true. |
1962 |
jour_lu_sur = jour |
1963 |
endif |
1964 |
! |
1965 |
! Recopie des variables dans les champs de sortie |
1966 |
! |
1967 |
!!$ lmt_alb(:) = 0.0 |
1968 |
!!$ lmt_rug(:) = 0.0 |
1969 |
lmt_alb(:) = 999999. |
1970 |
lmt_rug(:) = 999999. |
1971 |
DO ii = 1, knon |
1972 |
lmt_alb(ii) = alb_lu(knindex(ii)) |
1973 |
lmt_rug(ii) = rug_lu(knindex(ii)) |
1974 |
enddo |
1975 |
|
1976 |
END SUBROUTINE interfsur_lim |
1977 |
|
1978 |
!************************ |
1979 |
|
1980 |
SUBROUTINE calcul_fluxs( klon, knon, nisurf, dtime, & |
1981 |
& tsurf, p1lay, cal, beta, coef1lay, ps, & |
1982 |
& precip_rain, precip_snow, snow, qsurf, & |
1983 |
& radsol, dif_grnd, t1lay, q1lay, u1lay, v1lay, & |
1984 |
& petAcoef, peqAcoef, petBcoef, peqBcoef, & |
1985 |
& tsurf_new, evap, fluxlat, fluxsens, dflux_s, dflux_l) |
1986 |
|
1987 |
! Cette routine calcule les fluxs en h et q a l'interface et eventuellement |
1988 |
! une temperature de surface (au cas ou ok_veget = false) |
1989 |
! |
1990 |
! L. Fairhead 4/2000 |
1991 |
! |
1992 |
! input: |
1993 |
! knon nombre de points a traiter |
1994 |
! nisurf surface a traiter |
1995 |
! tsurf temperature de surface |
1996 |
! p1lay pression 1er niveau (milieu de couche) |
1997 |
! cal capacite calorifique du sol |
1998 |
! beta evap reelle |
1999 |
! coef1lay coefficient d'echange |
2000 |
! ps pression au sol |
2001 |
! precip_rain precipitations liquides |
2002 |
! precip_snow precipitations solides |
2003 |
! snow champs hauteur de neige |
2004 |
! runoff runoff en cas de trop plein |
2005 |
! petAcoef coeff. A de la resolution de la CL pour t |
2006 |
! peqAcoef coeff. A de la resolution de la CL pour q |
2007 |
! petBcoef coeff. B de la resolution de la CL pour t |
2008 |
! peqBcoef coeff. B de la resolution de la CL pour q |
2009 |
! radsol rayonnement net aus sol (LW + SW) |
2010 |
! dif_grnd coeff. diffusion vers le sol profond |
2011 |
! |
2012 |
! output: |
2013 |
! tsurf_new temperature au sol |
2014 |
! qsurf humidite de l'air au dessus du sol |
2015 |
! fluxsens flux de chaleur sensible |
2016 |
! fluxlat flux de chaleur latente |
2017 |
! dflux_s derivee du flux de chaleur sensible / Ts |
2018 |
! dflux_l derivee du flux de chaleur latente / Ts |
2019 |
! |
2020 |
|
2021 |
use indicesol |
2022 |
use abort_gcm_m, only: abort_gcm |
2023 |
use yoethf |
2024 |
use fcttre, only: thermcep, foeew, qsats, qsatl, foede, dqsats, dqsatl |
2025 |
use YOMCST |
2026 |
|
2027 |
! Parametres d'entree |
2028 |
integer, intent(IN) :: knon, nisurf, klon |
2029 |
real , intent(IN) :: dtime |
2030 |
real, dimension(klon), intent(IN) :: petAcoef, peqAcoef |
2031 |
real, dimension(klon), intent(IN) :: petBcoef, peqBcoef |
2032 |
real, dimension(klon), intent(IN) :: ps, q1lay |
2033 |
real, dimension(klon), intent(IN) :: tsurf, p1lay, cal, beta, coef1lay |
2034 |
real, dimension(klon), intent(IN) :: precip_rain, precip_snow |
2035 |
real, dimension(klon), intent(IN) :: radsol, dif_grnd |
2036 |
real, dimension(klon), intent(IN) :: t1lay, u1lay, v1lay |
2037 |
real, dimension(klon), intent(INOUT) :: snow, qsurf |
2038 |
|
2039 |
! Parametres sorties |
2040 |
real, dimension(klon), intent(OUT):: tsurf_new, evap, fluxsens, fluxlat |
2041 |
real, dimension(klon), intent(OUT):: dflux_s, dflux_l |
2042 |
|
2043 |
! Variables locales |
2044 |
integer :: i |
2045 |
real, dimension(klon) :: zx_mh, zx_nh, zx_oh |
2046 |
real, dimension(klon) :: zx_mq, zx_nq, zx_oq |
2047 |
real, dimension(klon) :: zx_pkh, zx_dq_s_dt, zx_qsat, zx_coef |
2048 |
real, dimension(klon) :: zx_sl, zx_k1 |
2049 |
real, dimension(klon) :: zx_q_0 , d_ts |
2050 |
real :: zdelta, zcvm5, zx_qs, zcor, zx_dq_s_dh |
2051 |
real :: bilan_f, fq_fonte |
2052 |
REAL :: subli, fsno |
2053 |
REAL :: qsat_new, q1_new |
2054 |
real, parameter :: t_grnd = 271.35, t_coup = 273.15 |
2055 |
!! PB temporaire en attendant mieux pour le modele de neige |
2056 |
REAL, parameter :: chasno = 3.334E+05/(2.3867E+06*0.15) |
2057 |
! |
2058 |
logical, save :: check = .false. |
2059 |
character (len = 20) :: modname = 'calcul_fluxs' |
2060 |
logical, save :: fonte_neige = .false. |
2061 |
real, save :: max_eau_sol = 150.0 |
2062 |
character (len = 80) :: abort_message |
2063 |
logical,save :: first = .true.,second=.false. |
2064 |
|
2065 |
if (check) write(*,*)'Entree ', modname,' surface = ',nisurf |
2066 |
|
2067 |
IF (check) THEN |
2068 |
WRITE(*,*)' radsol (min, max)' & |
2069 |
& , MINVAL(radsol(1:knon)), MAXVAL(radsol(1:knon)) |
2070 |
!!CALL flush(6) |
2071 |
ENDIF |
2072 |
|
2073 |
if (size(coastalflow) /= knon .AND. nisurf == is_ter) then |
2074 |
write(*,*)'Bizarre, le nombre de points continentaux' |
2075 |
write(*,*)'a change entre deux appels. J''arrete ...' |
2076 |
abort_message='Pb run_off' |
2077 |
call abort_gcm(modname,abort_message,1) |
2078 |
endif |
2079 |
! |
2080 |
! Traitement neige et humidite du sol |
2081 |
! |
2082 |
!!$ WRITE(*,*)'test calcul_flux, surface ', nisurf |
2083 |
!!PB test |
2084 |
!!$ if (nisurf == is_oce) then |
2085 |
!!$ snow = 0. |
2086 |
!!$ qsol = max_eau_sol |
2087 |
!!$ else |
2088 |
!!$ where (precip_snow > 0.) snow = snow + (precip_snow * dtime) |
2089 |
!!$ where (snow > epsilon(snow)) snow = max(0.0, snow - (evap * dtime)) |
2090 |
!!$! snow = max(0.0, snow + (precip_snow - evap) * dtime) |
2091 |
!!$ where (precip_rain > 0.) qsol = qsol + (precip_rain - evap) * dtime |
2092 |
!!$ endif |
2093 |
!!$ IF (nisurf /= is_ter) qsol = max_eau_sol |
2094 |
|
2095 |
! |
2096 |
! Initialisation |
2097 |
! |
2098 |
evap = 0. |
2099 |
fluxsens=0. |
2100 |
fluxlat=0. |
2101 |
dflux_s = 0. |
2102 |
dflux_l = 0. |
2103 |
! |
2104 |
! zx_qs = qsat en kg/kg |
2105 |
! |
2106 |
DO i = 1, knon |
2107 |
zx_pkh(i) = (ps(i)/ps(i))**RKAPPA |
2108 |
IF (thermcep) THEN |
2109 |
zdelta=MAX(0.,SIGN(1.,rtt-tsurf(i))) |
2110 |
zcvm5 = R5LES*RLVTT*(1.-zdelta) + R5IES*RLSTT*zdelta |
2111 |
zcvm5 = zcvm5 / RCPD / (1.0+RVTMP2*q1lay(i)) |
2112 |
zx_qs= r2es * FOEEW(tsurf(i),zdelta)/ps(i) |
2113 |
zx_qs=MIN(0.5,zx_qs) |
2114 |
zcor=1./(1.-retv*zx_qs) |
2115 |
zx_qs=zx_qs*zcor |
2116 |
zx_dq_s_dh = FOEDE(tsurf(i),zdelta,zcvm5,zx_qs,zcor) & |
2117 |
& /RLVTT / zx_pkh(i) |
2118 |
ELSE |
2119 |
IF (tsurf(i).LT.t_coup) THEN |
2120 |
zx_qs = qsats(tsurf(i)) / ps(i) |
2121 |
zx_dq_s_dh = dqsats(tsurf(i),zx_qs)/RLVTT & |
2122 |
& / zx_pkh(i) |
2123 |
ELSE |
2124 |
zx_qs = qsatl(tsurf(i)) / ps(i) |
2125 |
zx_dq_s_dh = dqsatl(tsurf(i),zx_qs)/RLVTT & |
2126 |
& / zx_pkh(i) |
2127 |
ENDIF |
2128 |
ENDIF |
2129 |
zx_dq_s_dt(i) = RCPD * zx_pkh(i) * zx_dq_s_dh |
2130 |
zx_qsat(i) = zx_qs |
2131 |
zx_coef(i) = coef1lay(i) & |
2132 |
& * (1.0+SQRT(u1lay(i)**2+v1lay(i)**2)) & |
2133 |
& * p1lay(i)/(RD*t1lay(i)) |
2134 |
|
2135 |
ENDDO |
2136 |
|
2137 |
! === Calcul de la temperature de surface === |
2138 |
! |
2139 |
! zx_sl = chaleur latente d'evaporation ou de sublimation |
2140 |
! |
2141 |
do i = 1, knon |
2142 |
zx_sl(i) = RLVTT |
2143 |
if (tsurf(i) .LT. RTT) zx_sl(i) = RLSTT |
2144 |
zx_k1(i) = zx_coef(i) |
2145 |
enddo |
2146 |
|
2147 |
do i = 1, knon |
2148 |
! Q |
2149 |
zx_oq(i) = 1. - (beta(i) * zx_k1(i) * peqBcoef(i) * dtime) |
2150 |
zx_mq(i) = beta(i) * zx_k1(i) * & |
2151 |
& (peqAcoef(i) - zx_qsat(i) & |
2152 |
& + zx_dq_s_dt(i) * tsurf(i)) & |
2153 |
& / zx_oq(i) |
2154 |
zx_nq(i) = beta(i) * zx_k1(i) * (-1. * zx_dq_s_dt(i)) & |
2155 |
& / zx_oq(i) |
2156 |
|
2157 |
! H |
2158 |
zx_oh(i) = 1. - (zx_k1(i) * petBcoef(i) * dtime) |
2159 |
zx_mh(i) = zx_k1(i) * petAcoef(i) / zx_oh(i) |
2160 |
zx_nh(i) = - (zx_k1(i) * RCPD * zx_pkh(i))/ zx_oh(i) |
2161 |
|
2162 |
! Tsurface |
2163 |
tsurf_new(i) = (tsurf(i) + cal(i)/(RCPD * zx_pkh(i)) * dtime * & |
2164 |
& (radsol(i) + zx_mh(i) + zx_sl(i) * zx_mq(i)) & |
2165 |
& + dif_grnd(i) * t_grnd * dtime)/ & |
2166 |
& ( 1. - dtime * cal(i)/(RCPD * zx_pkh(i)) * ( & |
2167 |
& zx_nh(i) + zx_sl(i) * zx_nq(i)) & |
2168 |
& + dtime * dif_grnd(i)) |
2169 |
|
2170 |
! |
2171 |
! Y'a-t-il fonte de neige? |
2172 |
! |
2173 |
! fonte_neige = (nisurf /= is_oce) .AND. & |
2174 |
! & (snow(i) > epsfra .OR. nisurf == is_sic .OR. nisurf == is_lic) & |
2175 |
! & .AND. (tsurf_new(i) >= RTT) |
2176 |
! if (fonte_neige) tsurf_new(i) = RTT |
2177 |
d_ts(i) = tsurf_new(i) - tsurf(i) |
2178 |
! zx_h_ts(i) = tsurf_new(i) * RCPD * zx_pkh(i) |
2179 |
! zx_q_0(i) = zx_qsat(i) + zx_dq_s_dt(i) * d_ts(i) |
2180 |
!== flux_q est le flux de vapeur d'eau: kg/(m**2 s) positive vers bas |
2181 |
!== flux_t est le flux de cpt (energie sensible): j/(m**2 s) |
2182 |
evap(i) = - zx_mq(i) - zx_nq(i) * tsurf_new(i) |
2183 |
fluxlat(i) = - evap(i) * zx_sl(i) |
2184 |
fluxsens(i) = zx_mh(i) + zx_nh(i) * tsurf_new(i) |
2185 |
! Derives des flux dF/dTs (W m-2 K-1): |
2186 |
dflux_s(i) = zx_nh(i) |
2187 |
dflux_l(i) = (zx_sl(i) * zx_nq(i)) |
2188 |
! Nouvelle valeure de l'humidite au dessus du sol |
2189 |
qsat_new=zx_qsat(i) + zx_dq_s_dt(i) * d_ts(i) |
2190 |
q1_new = peqAcoef(i) - peqBcoef(i)*evap(i)*dtime |
2191 |
qsurf(i)=q1_new*(1.-beta(i)) + beta(i)*qsat_new |
2192 |
ENDDO |
2193 |
|
2194 |
END SUBROUTINE calcul_fluxs |
2195 |
|
2196 |
!************************ |
2197 |
|
2198 |
SUBROUTINE fonte_neige( klon, knon, nisurf, dtime, & |
2199 |
& tsurf, p1lay, cal, beta, coef1lay, ps, & |
2200 |
& precip_rain, precip_snow, snow, qsol, & |
2201 |
& radsol, dif_grnd, t1lay, q1lay, u1lay, v1lay, & |
2202 |
& petAcoef, peqAcoef, petBcoef, peqBcoef, & |
2203 |
& tsurf_new, evap, fluxlat, fluxsens, dflux_s, dflux_l, & |
2204 |
& fqcalving,ffonte,run_off_lic_0) |
2205 |
|
2206 |
! Routine de traitement de la fonte de la neige dans le cas du traitement |
2207 |
! de sol simplifié |
2208 |
! |
2209 |
! LF 03/2001 |
2210 |
! input: |
2211 |
! knon nombre de points a traiter |
2212 |
! nisurf surface a traiter |
2213 |
! tsurf temperature de surface |
2214 |
! p1lay pression 1er niveau (milieu de couche) |
2215 |
! cal capacite calorifique du sol |
2216 |
! beta evap reelle |
2217 |
! coef1lay coefficient d'echange |
2218 |
! ps pression au sol |
2219 |
! precip_rain precipitations liquides |
2220 |
! precip_snow precipitations solides |
2221 |
! snow champs hauteur de neige |
2222 |
! qsol hauteur d'eau contenu dans le sol |
2223 |
! runoff runoff en cas de trop plein |
2224 |
! petAcoef coeff. A de la resolution de la CL pour t |
2225 |
! peqAcoef coeff. A de la resolution de la CL pour q |
2226 |
! petBcoef coeff. B de la resolution de la CL pour t |
2227 |
! peqBcoef coeff. B de la resolution de la CL pour q |
2228 |
! radsol rayonnement net aus sol (LW + SW) |
2229 |
! dif_grnd coeff. diffusion vers le sol profond |
2230 |
! |
2231 |
! output: |
2232 |
! tsurf_new temperature au sol |
2233 |
! fluxsens flux de chaleur sensible |
2234 |
! fluxlat flux de chaleur latente |
2235 |
! dflux_s derivee du flux de chaleur sensible / Ts |
2236 |
! dflux_l derivee du flux de chaleur latente / Ts |
2237 |
! in/out: |
2238 |
! run_off_lic_0 run off glacier du pas de temps précedent |
2239 |
! |
2240 |
|
2241 |
use indicesol |
2242 |
use YOMCST |
2243 |
use yoethf |
2244 |
use fcttre |
2245 |
!IM cf JLD |
2246 |
|
2247 |
! Parametres d'entree |
2248 |
integer, intent(IN) :: knon, nisurf, klon |
2249 |
real , intent(IN) :: dtime |
2250 |
real, dimension(klon), intent(IN) :: petAcoef, peqAcoef |
2251 |
real, dimension(klon), intent(IN) :: petBcoef, peqBcoef |
2252 |
real, dimension(klon), intent(IN) :: ps, q1lay |
2253 |
real, dimension(klon), intent(IN) :: tsurf, p1lay, cal, beta, coef1lay |
2254 |
real, dimension(klon), intent(IN) :: precip_rain, precip_snow |
2255 |
real, dimension(klon), intent(IN) :: radsol, dif_grnd |
2256 |
real, dimension(klon), intent(IN) :: t1lay, u1lay, v1lay |
2257 |
real, dimension(klon), intent(INOUT) :: snow, qsol |
2258 |
|
2259 |
! Parametres sorties |
2260 |
real, dimension(klon), intent(INOUT):: tsurf_new, evap, fluxsens, fluxlat |
2261 |
real, dimension(klon), intent(INOUT):: dflux_s, dflux_l |
2262 |
! Flux thermique utiliser pour fondre la neige |
2263 |
real, dimension(klon), intent(INOUT):: ffonte |
2264 |
! Flux d'eau "perdue" par la surface et necessaire pour que limiter la |
2265 |
! hauteur de neige, en kg/m2/s |
2266 |
real, dimension(klon), intent(INOUT):: fqcalving |
2267 |
real, dimension(klon), intent(INOUT):: run_off_lic_0 |
2268 |
! Variables locales |
2269 |
! Masse maximum de neige (kg/m2). Au dessus de ce seuil, la neige |
2270 |
! en exces "s'ecoule" (calving) |
2271 |
! real, parameter :: snow_max=1. |
2272 |
!IM cf JLD/GK |
2273 |
real, parameter :: snow_max=3000. |
2274 |
integer :: i |
2275 |
real, dimension(klon) :: zx_mh, zx_nh, zx_oh |
2276 |
real, dimension(klon) :: zx_mq, zx_nq, zx_oq |
2277 |
real, dimension(klon) :: zx_pkh, zx_dq_s_dt, zx_qsat, zx_coef |
2278 |
real, dimension(klon) :: zx_sl, zx_k1 |
2279 |
real, dimension(klon) :: zx_q_0 , d_ts |
2280 |
real :: zdelta, zcvm5, zx_qs, zcor, zx_dq_s_dh |
2281 |
real :: bilan_f, fq_fonte |
2282 |
REAL :: subli, fsno |
2283 |
REAL, DIMENSION(klon) :: bil_eau_s, snow_evap |
2284 |
real, parameter :: t_grnd = 271.35, t_coup = 273.15 |
2285 |
!! PB temporaire en attendant mieux pour le modele de neige |
2286 |
! REAL, parameter :: chasno = RLMLT/(2.3867E+06*0.15) |
2287 |
REAL, parameter :: chasno = 3.334E+05/(2.3867E+06*0.15) |
2288 |
!IM cf JLD/ GKtest |
2289 |
REAL, parameter :: chaice = 3.334E+05/(2.3867E+06*0.15) |
2290 |
! fin GKtest |
2291 |
! |
2292 |
logical, save :: check = .FALSE. |
2293 |
character (len = 20) :: modname = 'fonte_neige' |
2294 |
logical, save :: neige_fond = .false. |
2295 |
real, save :: max_eau_sol = 150.0 |
2296 |
character (len = 80) :: abort_message |
2297 |
logical,save :: first = .true.,second=.false. |
2298 |
real :: coeff_rel |
2299 |
|
2300 |
if (check) write(*,*)'Entree ', modname,' surface = ',nisurf |
2301 |
|
2302 |
! Initialisations |
2303 |
coeff_rel = dtime/(tau_calv * rday) |
2304 |
bil_eau_s(:) = 0. |
2305 |
DO i = 1, knon |
2306 |
zx_pkh(i) = (ps(i)/ps(i))**RKAPPA |
2307 |
IF (thermcep) THEN |
2308 |
zdelta=MAX(0.,SIGN(1.,rtt-tsurf(i))) |
2309 |
zcvm5 = R5LES*RLVTT*(1.-zdelta) + R5IES*RLSTT*zdelta |
2310 |
zcvm5 = zcvm5 / RCPD / (1.0+RVTMP2*q1lay(i)) |
2311 |
zx_qs= r2es * FOEEW(tsurf(i),zdelta)/ps(i) |
2312 |
zx_qs=MIN(0.5,zx_qs) |
2313 |
zcor=1./(1.-retv*zx_qs) |
2314 |
zx_qs=zx_qs*zcor |
2315 |
zx_dq_s_dh = FOEDE(tsurf(i),zdelta,zcvm5,zx_qs,zcor) & |
2316 |
& /RLVTT / zx_pkh(i) |
2317 |
ELSE |
2318 |
IF (tsurf(i).LT.t_coup) THEN |
2319 |
zx_qs = qsats(tsurf(i)) / ps(i) |
2320 |
zx_dq_s_dh = dqsats(tsurf(i),zx_qs)/RLVTT & |
2321 |
& / zx_pkh(i) |
2322 |
ELSE |
2323 |
zx_qs = qsatl(tsurf(i)) / ps(i) |
2324 |
zx_dq_s_dh = dqsatl(tsurf(i),zx_qs)/RLVTT & |
2325 |
& / zx_pkh(i) |
2326 |
ENDIF |
2327 |
ENDIF |
2328 |
zx_dq_s_dt(i) = RCPD * zx_pkh(i) * zx_dq_s_dh |
2329 |
zx_qsat(i) = zx_qs |
2330 |
zx_coef(i) = coef1lay(i) & |
2331 |
& * (1.0+SQRT(u1lay(i)**2+v1lay(i)**2)) & |
2332 |
& * p1lay(i)/(RD*t1lay(i)) |
2333 |
ENDDO |
2334 |
|
2335 |
! === Calcul de la temperature de surface === |
2336 |
! |
2337 |
! zx_sl = chaleur latente d'evaporation ou de sublimation |
2338 |
! |
2339 |
do i = 1, knon |
2340 |
zx_sl(i) = RLVTT |
2341 |
if (tsurf(i) .LT. RTT) zx_sl(i) = RLSTT |
2342 |
zx_k1(i) = zx_coef(i) |
2343 |
enddo |
2344 |
|
2345 |
do i = 1, knon |
2346 |
! Q |
2347 |
zx_oq(i) = 1. - (beta(i) * zx_k1(i) * peqBcoef(i) * dtime) |
2348 |
zx_mq(i) = beta(i) * zx_k1(i) * & |
2349 |
& (peqAcoef(i) - zx_qsat(i) & |
2350 |
& + zx_dq_s_dt(i) * tsurf(i)) & |
2351 |
& / zx_oq(i) |
2352 |
zx_nq(i) = beta(i) * zx_k1(i) * (-1. * zx_dq_s_dt(i)) & |
2353 |
& / zx_oq(i) |
2354 |
|
2355 |
! H |
2356 |
zx_oh(i) = 1. - (zx_k1(i) * petBcoef(i) * dtime) |
2357 |
zx_mh(i) = zx_k1(i) * petAcoef(i) / zx_oh(i) |
2358 |
zx_nh(i) = - (zx_k1(i) * RCPD * zx_pkh(i))/ zx_oh(i) |
2359 |
enddo |
2360 |
|
2361 |
WHERE (precip_snow > 0.) snow = snow + (precip_snow * dtime) |
2362 |
snow_evap = 0. |
2363 |
WHERE (evap > 0. ) |
2364 |
snow_evap = MIN (snow / dtime, evap) |
2365 |
snow = snow - snow_evap * dtime |
2366 |
snow = MAX(0.0, snow) |
2367 |
end where |
2368 |
|
2369 |
! bil_eau_s = bil_eau_s + (precip_rain * dtime) - (evap - snow_evap) * dtime |
2370 |
bil_eau_s = (precip_rain * dtime) - (evap - snow_evap) * dtime |
2371 |
|
2372 |
! |
2373 |
! Y'a-t-il fonte de neige? |
2374 |
! |
2375 |
ffonte=0. |
2376 |
do i = 1, knon |
2377 |
neige_fond = ((snow(i) > epsfra .OR. nisurf == is_sic .OR. nisurf == is_lic) & |
2378 |
& .AND. tsurf_new(i) >= RTT) |
2379 |
if (neige_fond) then |
2380 |
fq_fonte = MIN( MAX((tsurf_new(i)-RTT )/chasno,0.0),snow(i)) |
2381 |
ffonte(i) = fq_fonte * RLMLT/dtime |
2382 |
snow(i) = max(0., snow(i) - fq_fonte) |
2383 |
bil_eau_s(i) = bil_eau_s(i) + fq_fonte |
2384 |
tsurf_new(i) = tsurf_new(i) - fq_fonte * chasno |
2385 |
!IM cf JLD OK |
2386 |
!IM cf JLD/ GKtest fonte aussi pour la glace |
2387 |
IF (nisurf == is_sic .OR. nisurf == is_lic ) THEN |
2388 |
fq_fonte = MAX((tsurf_new(i)-RTT )/chaice,0.0) |
2389 |
ffonte(i) = ffonte(i) + fq_fonte * RLMLT/dtime |
2390 |
bil_eau_s(i) = bil_eau_s(i) + fq_fonte |
2391 |
tsurf_new(i) = RTT |
2392 |
ENDIF |
2393 |
d_ts(i) = tsurf_new(i) - tsurf(i) |
2394 |
endif |
2395 |
! |
2396 |
! s'il y a une hauteur trop importante de neige, elle s'coule |
2397 |
fqcalving(i) = max(0., snow(i) - snow_max)/dtime |
2398 |
snow(i)=min(snow(i),snow_max) |
2399 |
! |
2400 |
IF (nisurf == is_ter) then |
2401 |
qsol(i) = qsol(i) + bil_eau_s(i) |
2402 |
run_off(i) = run_off(i) + MAX(qsol(i) - max_eau_sol, 0.0) |
2403 |
qsol(i) = MIN(qsol(i), max_eau_sol) |
2404 |
else if (nisurf == is_lic) then |
2405 |
run_off_lic(i) = (coeff_rel * fqcalving(i)) + & |
2406 |
& (1. - coeff_rel) * run_off_lic_0(i) |
2407 |
run_off_lic_0(i) = run_off_lic(i) |
2408 |
run_off_lic(i) = run_off_lic(i) + bil_eau_s(i)/dtime |
2409 |
endif |
2410 |
enddo |
2411 |
|
2412 |
END SUBROUTINE fonte_neige |
2413 |
|
2414 |
END MODULE interface_surf |