8 |
contains |
contains |
9 |
|
|
10 |
SUBROUTINE phytrac(itap, lmt_pas, julien, gmtime, firstcal, lafin, pdtphys, & |
SUBROUTINE phytrac(itap, lmt_pas, julien, gmtime, firstcal, lafin, pdtphys, & |
11 |
u, t_seri, paprs, pplay, pmfu, pmfd, pde_u, pen_d, coefh, fm_therm, & |
t_seri, paprs, pplay, pmfu, pmfd, pde_u, pen_d, coefh, fm_therm, & |
12 |
entr_therm, yu1, yv1, ftsol, pctsrf, frac_impa, frac_nucl, pphis, & |
entr_therm, yu1, yv1, ftsol, pctsrf, frac_impa, frac_nucl, da, phi, & |
13 |
albsol, rh, cldfra, rneb, diafra, cldliq, pmflxr, pmflxs, prfl, psfl, & |
mp, upwd, dnwd, tr_seri, zmasse, ncid_startphy, nid_ins, itau_phy) |
|
da, phi, mp, upwd, dnwd, tr_seri, zmasse) |
|
14 |
|
|
15 |
! From phylmd/phytrac.F, version 1.15 2006/02/21 08:08:30 (SVN revision 679) |
! From phylmd/phytrac.F, version 1.15 2006/02/21 08:08:30 (SVN revision 679) |
16 |
|
|
29 |
use abort_gcm_m, only: abort_gcm |
use abort_gcm_m, only: abort_gcm |
30 |
use clesphys, only: ecrit_tra |
use clesphys, only: ecrit_tra |
31 |
use clesphys2, only: iflag_con |
use clesphys2, only: iflag_con |
32 |
|
use cltrac_m, only: cltrac |
33 |
use cltracrn_m, only: cltracrn |
use cltracrn_m, only: cltracrn |
34 |
use ctherm, only: iflag_thermals |
use ctherm, only: iflag_thermals |
35 |
|
use cvltr_m, only: cvltr |
36 |
use dimens_m, only: llm, nqmx |
use dimens_m, only: llm, nqmx |
37 |
use dimphy, only: klon |
use dimphy, only: klon |
38 |
use indicesol, only: nbsrf |
use indicesol, only: nbsrf |
|
use ini_histrac_m, only: ini_histrac |
|
39 |
use initrrnpb_m, only: initrrnpb |
use initrrnpb_m, only: initrrnpb |
40 |
use minmaxqfi_m, only: minmaxqfi |
use minmaxqfi_m, only: minmaxqfi |
41 |
|
use netcdf, only: NF90_FILL_float |
42 |
|
use netcdf95, only: nf95_inq_varid, nf95_get_var, nf95_put_var |
43 |
use nflxtr_m, only: nflxtr |
use nflxtr_m, only: nflxtr |
44 |
use nr_util, only: assert |
use nr_util, only: assert |
45 |
use o3_chem_m, only: o3_chem |
use o3_chem_m, only: o3_chem |
46 |
use phyetat0_m, only: rlat |
use phyetat0_m, only: rlat |
47 |
|
use phyredem0_m, only: ncid_restartphy |
48 |
use press_coefoz_m, only: press_coefoz |
use press_coefoz_m, only: press_coefoz |
49 |
use radiornpb_m, only: radiornpb |
use radiornpb_m, only: radiornpb |
50 |
use regr_pr_comb_coefoz_m, only: regr_pr_comb_coefoz |
use regr_pr_comb_coefoz_m, only: regr_pr_comb_coefoz |
57 |
logical, intent(in):: firstcal ! first call to "calfis" |
logical, intent(in):: firstcal ! first call to "calfis" |
58 |
logical, intent(in):: lafin ! fin de la physique |
logical, intent(in):: lafin ! fin de la physique |
59 |
real, intent(in):: pdtphys ! pas d'integration pour la physique (s) |
real, intent(in):: pdtphys ! pas d'integration pour la physique (s) |
|
real, intent(in):: u(klon, llm) |
|
60 |
real, intent(in):: t_seri(klon, llm) ! temperature, in K |
real, intent(in):: t_seri(klon, llm) ! temperature, in K |
61 |
|
|
62 |
real, intent(in):: paprs(klon, llm+1) |
real, intent(in):: paprs(klon, llm+1) |
84 |
REAL yv1(klon) ! vents au premier niveau |
REAL yv1(klon) ! vents au premier niveau |
85 |
|
|
86 |
! Arguments n\'ecessaires pour les sources et puits de traceur : |
! Arguments n\'ecessaires pour les sources et puits de traceur : |
87 |
real ftsol(klon, nbsrf) ! Temperature du sol (surf)(Kelvin) |
real, intent(in):: ftsol(klon, nbsrf) ! Temperature du sol (surf)(Kelvin) |
88 |
real pctsrf(klon, nbsrf) ! Pourcentage de sol f(nature du sol) |
real pctsrf(klon, nbsrf) ! Pourcentage de sol f(nature du sol) |
89 |
|
|
90 |
! Lessivage pour le on-line |
! Lessivage pour le on-line |
91 |
REAL frac_impa(klon, llm) ! fraction d'aerosols impactes |
REAL frac_impa(klon, llm) ! fraction d'aerosols impactes |
92 |
REAL frac_nucl(klon, llm) ! fraction d'aerosols nuclees |
REAL frac_nucl(klon, llm) ! fraction d'aerosols nuclees |
93 |
|
|
|
real, intent(in):: pphis(klon) |
|
|
real albsol(klon) ! albedo surface |
|
|
real rh(klon, llm) ! humidite relative |
|
|
real cldfra(klon, llm) ! fraction nuageuse (tous les nuages) |
|
|
real rneb(klon, llm) ! fraction nuageuse (grande echelle) |
|
|
|
|
|
real diafra(klon, llm) |
|
|
! (fraction nuageuse (convection ou stratus artificiels)) |
|
|
|
|
|
real cldliq(klon, llm) ! eau liquide nuageuse |
|
|
REAL pmflxr(klon, llm+1), pmflxs(klon, llm+1) !--lessivage convection |
|
|
REAL prfl(klon, llm+1), psfl(klon, llm+1) !--lessivage large-scale |
|
|
|
|
94 |
! Kerry Emanuel |
! Kerry Emanuel |
95 |
real da(klon, llm), phi(klon, llm, llm), mp(klon, llm) |
real, intent(in):: da(klon, llm), phi(klon, llm, llm), mp(klon, llm) |
96 |
REAL, intent(in):: upwd(klon, llm) ! saturated updraft mass flux |
REAL, intent(in):: upwd(klon, llm) ! saturated updraft mass flux |
97 |
REAL, intent(in):: dnwd(klon, llm) ! saturated downdraft mass flux |
REAL, intent(in):: dnwd(klon, llm) ! saturated downdraft mass flux |
98 |
|
|
102 |
real, intent(in):: zmasse(:, :) ! (klon, llm) |
real, intent(in):: zmasse(:, :) ! (klon, llm) |
103 |
! (column-density of mass of air in a cell, in kg m-2) |
! (column-density of mass of air in a cell, in kg m-2) |
104 |
|
|
105 |
! Variables local to the procedure: |
integer, intent(in):: ncid_startphy, nid_ins, itau_phy |
106 |
|
|
107 |
|
! Local: |
108 |
|
|
109 |
integer nsplit |
integer nsplit |
110 |
|
|
118 |
! |
! |
119 |
! Pour la source de radon et son reservoir de sol |
! Pour la source de radon et son reservoir de sol |
120 |
|
|
121 |
REAL, save:: trs(klon, nqmx - 2) ! Concentration de radon dans le sol |
REAL, save:: trs(klon, nqmx - 2) ! Concentration de traceur dans le sol |
122 |
|
|
123 |
REAL masktr(klon, nqmx - 2) ! Masque reservoir de sol traceur |
REAL masktr(klon, nqmx - 2) ! Masque reservoir de sol traceur |
124 |
! Masque de l'echange avec la surface |
! Masque de l'echange avec la surface |
136 |
SAVE scavtr |
SAVE scavtr |
137 |
|
|
138 |
CHARACTER itn |
CHARACTER itn |
|
INTEGER, save:: nid_tra |
|
139 |
|
|
140 |
! nature du traceur |
! nature du traceur |
141 |
|
|
156 |
|
|
157 |
REAL d_tr(klon, llm), d_trs(klon) ! tendances de traceurs |
REAL d_tr(klon, llm), d_trs(klon) ! tendances de traceurs |
158 |
REAL d_tr_cl(klon, llm, nqmx - 2) ! tendance de traceurs couche limite |
REAL d_tr_cl(klon, llm, nqmx - 2) ! tendance de traceurs couche limite |
159 |
REAL d_tr_cv(klon, llm, nqmx - 2) ! tendance de traceurs conv pour chq traceur |
|
160 |
|
REAL d_tr_cv(klon, llm, nqmx - 2) |
161 |
|
! tendance de traceurs conv pour chq traceur |
162 |
|
|
163 |
REAL d_tr_th(klon, llm, nqmx - 2) ! la tendance des thermiques |
REAL d_tr_th(klon, llm, nqmx - 2) ! la tendance des thermiques |
164 |
REAL d_tr_dec(klon, llm, 2) ! la tendance de la decroissance |
REAL d_tr_dec(klon, llm, 2) ! la tendance de la decroissance |
165 |
! ! radioactive du rn - > pb |
! ! radioactive du rn - > pb |
171 |
! ! dans chaque couche |
! ! dans chaque couche |
172 |
|
|
173 |
real ztra_th(klon, llm) |
real ztra_th(klon, llm) |
174 |
integer isplit |
integer isplit, varid |
175 |
|
|
176 |
! Controls: |
! Controls: |
177 |
logical:: couchelimite = .true. |
logical:: couchelimite = .true. |
189 |
PRINT *, 'Frequency of tracer output: ecrit_tra = ', ecrit_tra |
PRINT *, 'Frequency of tracer output: ecrit_tra = ', ecrit_tra |
190 |
inirnpb = .true. |
inirnpb = .true. |
191 |
|
|
|
! Initialisation des sorties : |
|
|
call ini_histrac(nid_tra, pdtphys, nqmx - 2, lessivage) |
|
|
|
|
192 |
! Initialisation de certaines variables pour le radon et le plomb |
! Initialisation de certaines variables pour le radon et le plomb |
193 |
! Initialisation du traceur dans le sol (couche limite radonique) |
! Initialisation du traceur dans le sol (couche limite radonique) |
194 |
trs(:, :) = 0. |
trs(:, 2:) = 0. |
195 |
|
|
196 |
open (unit=99, file='starttrac', status='old', err=999, & |
call nf95_inq_varid(ncid_startphy, "trs", varid) |
197 |
form='formatted') |
call nf95_get_var(ncid_startphy, varid, trs(:, 1)) |
198 |
read(unit=99, fmt=*) (trs(i, 1), i=1, klon) |
if (any(trs(:, 1) == NF90_FILL_float)) call abort_gcm("phytrac", & |
199 |
999 continue |
"some missing values in trs(:, 1)") |
|
close(unit=99) |
|
200 |
|
|
201 |
! Initialisation de la fraction d'aerosols lessivee |
! Initialisation de la fraction d'aerosols lessivee |
202 |
|
|
234 |
! Tiedke |
! Tiedke |
235 |
CALL nflxtr(pdtphys, pmfu, pmfd, pde_u, pen_d, paprs, & |
CALL nflxtr(pdtphys, pmfu, pmfd, pde_u, pen_d, paprs, & |
236 |
tr_seri(:, :, it), d_tr_cv(:, :, it)) |
tr_seri(:, :, it), d_tr_cv(:, :, it)) |
237 |
else if (iflag_con == 3) then |
else |
238 |
|
! iflag_con >= 3 |
239 |
! Emanuel |
! Emanuel |
240 |
call cvltr(pdtphys, da, phi, mp, paprs, tr_seri(1, 1, it), upwd, & |
call cvltr(pdtphys, da, phi, mp, paprs, tr_seri(:, :, it), upwd, & |
241 |
dnwd, d_tr_cv(1, 1, it)) |
dnwd, d_tr_cv(:, :, it)) |
242 |
endif |
endif |
243 |
|
|
244 |
DO k = 1, llm |
DO k = 1, llm |
297 |
DO it=1, nqmx - 2 |
DO it=1, nqmx - 2 |
298 |
if (clsol(it)) then |
if (clsol(it)) then |
299 |
! couche limite avec quantite dans le sol calculee |
! couche limite avec quantite dans le sol calculee |
300 |
CALL cltracrn(it, pdtphys, yu1, yv1, & |
CALL cltracrn(it, pdtphys, yu1, yv1, coefh, t_seri, ftsol, & |
301 |
coefh, t_seri, ftsol, pctsrf, & |
pctsrf, tr_seri(:, :, it), trs(:, it), paprs, pplay, delp, & |
302 |
tr_seri(:, :, it), trs(1, it), & |
masktr(1, it), fshtr(1, it), hsoltr(it), tautr(it), & |
303 |
paprs, pplay, delp, & |
vdeptr(it), rlat, d_tr_cl(1, 1, it), d_trs) |
|
masktr(1, it), fshtr(1, it), hsoltr(it), & |
|
|
tautr(it), vdeptr(it), & |
|
|
rlat, & |
|
|
d_tr_cl(1, 1, it), d_trs) |
|
304 |
DO k = 1, llm |
DO k = 1, llm |
305 |
DO i = 1, klon |
DO i = 1, klon |
306 |
tr_seri(i, k, it) = tr_seri(i, k, it) + d_tr_cl(i, k, it) |
tr_seri(i, k, it) = tr_seri(i, k, it) + d_tr_cl(i, k, it) |
307 |
ENDDO |
ENDDO |
308 |
ENDDO |
ENDDO |
309 |
|
|
310 |
! Traceur ds sol |
trs(:, it) = trs(:, it) + d_trs |
311 |
|
else |
312 |
DO i = 1, klon |
! couche limite avec flux prescrit |
|
trs(i, it) = trs(i, it) + d_trs(i) |
|
|
END DO |
|
|
else ! couche limite avec flux prescrit |
|
313 |
!MAF provisoire source / traceur a creer |
!MAF provisoire source / traceur a creer |
314 |
DO i=1, klon |
DO i=1, klon |
315 |
source(i) = 0.0 ! pas de source, pour l'instant |
source(i) = 0. ! pas de source, pour l'instant |
316 |
ENDDO |
ENDDO |
317 |
|
|
318 |
CALL cltrac(pdtphys, coefh, t_seri, & |
CALL cltrac(pdtphys, coefh, t_seri, tr_seri(:, :, it), source, & |
319 |
tr_seri(1, 1, it), source, & |
paprs, pplay, delp, d_tr_cl(1, 1, it)) |
|
paprs, pplay, delp, & |
|
|
d_tr_cl(1, 1, it)) |
|
320 |
DO k = 1, llm |
DO k = 1, llm |
321 |
DO i = 1, klon |
DO i = 1, klon |
322 |
tr_seri(i, k, it) = tr_seri(i, k, it) + d_tr_cl(i, k, it) |
tr_seri(i, k, it) = tr_seri(i, k, it) + d_tr_cl(i, k, it) |
343 |
! Ozone as a tracer: |
! Ozone as a tracer: |
344 |
if (mod(itap - 1, lmt_pas) == 0) then |
if (mod(itap - 1, lmt_pas) == 0) then |
345 |
! Once per day, update the coefficients for ozone chemistry: |
! Once per day, update the coefficients for ozone chemistry: |
346 |
call regr_pr_comb_coefoz(julien) |
call regr_pr_comb_coefoz(julien, paprs, pplay) |
347 |
end if |
end if |
348 |
call o3_chem(julien, gmtime, t_seri, zmasse, pdtphys, tr_seri(:, :, 3)) |
call o3_chem(julien, gmtime, t_seri, zmasse, pdtphys, tr_seri(:, :, 3)) |
349 |
end if |
end if |
398 |
ENDIF |
ENDIF |
399 |
|
|
400 |
! Ecriture des sorties |
! Ecriture des sorties |
401 |
call write_histrac(lessivage, itap, nid_tra) |
call write_histrac(lessivage, itap, nid_ins) |
402 |
|
|
403 |
if (lafin) then |
if (lafin) then |
404 |
print *, "C'est la fin de la physique." |
call nf95_inq_varid(ncid_restartphy, "trs", varid) |
405 |
open(unit=99, file='restarttrac', form='formatted') |
call nf95_put_var(ncid_restartphy, varid, trs(:, 1)) |
|
do i=1, klon |
|
|
write(unit=99, fmt=*) trs(i, 1) |
|
|
enddo |
|
|
PRINT *, 'Ecriture du fichier restarttrac' |
|
|
close(unit=99) |
|
406 |
endif |
endif |
407 |
|
|
408 |
contains |
contains |
409 |
|
|
410 |
subroutine write_histrac(lessivage, itap, nid_tra) |
subroutine write_histrac(lessivage, itap, nid_ins) |
411 |
|
|
412 |
! From phylmd/write_histrac.h, version 1.9 2006/02/21 08:08:30 |
! From phylmd/write_histrac.h, version 1.9 2006/02/21 08:08:30 |
413 |
|
|
|
use dimens_m, only: iim, jjm, llm |
|
|
use histsync_m, only: histsync |
|
414 |
use histwrite_m, only: histwrite |
use histwrite_m, only: histwrite |
415 |
use temps, only: itau_phy |
use iniadvtrac_m, only: tname |
|
use iniadvtrac_m, only: tnom |
|
|
use comgeomphy, only: airephy |
|
|
use dimphy, only: klon |
|
|
use grid_change, only: gr_phy_write_2d |
|
416 |
use gr_phy_write_3d_m, only: gr_phy_write_3d |
use gr_phy_write_3d_m, only: gr_phy_write_3d |
417 |
|
|
418 |
logical, intent(in):: lessivage |
logical, intent(in):: lessivage |
419 |
integer, intent(in):: itap ! number of calls to "physiq" |
integer, intent(in):: itap ! number of calls to "physiq" |
420 |
integer, intent(in):: nid_tra |
integer, intent(in):: nid_ins |
421 |
|
|
422 |
! Variables local to the procedure: |
! Variables local to the procedure: |
423 |
integer it |
integer it |
424 |
integer itau_w ! pas de temps ecriture |
integer itau_w ! pas de temps ecriture |
|
logical, parameter:: ok_sync = .true. |
|
425 |
|
|
426 |
!----------------------------------------------------- |
!----------------------------------------------------- |
427 |
|
|
428 |
itau_w = itau_phy + itap |
itau_w = itau_phy + itap |
429 |
|
|
430 |
CALL histwrite(nid_tra, "phis", itau_w, gr_phy_write_2d(pphis)) |
CALL histwrite(nid_ins, "zmasse", itau_w, gr_phy_write_3d(zmasse)) |
|
CALL histwrite(nid_tra, "aire", itau_w, gr_phy_write_2d(airephy)) |
|
|
CALL histwrite(nid_tra, "zmasse", itau_w, gr_phy_write_3d(zmasse)) |
|
431 |
|
|
432 |
DO it=1, nqmx - 2 |
DO it=1, nqmx - 2 |
433 |
CALL histwrite(nid_tra, tnom(it+2), itau_w, & |
CALL histwrite(nid_ins, tname(it+2), itau_w, & |
434 |
gr_phy_write_3d(tr_seri(:, :, it))) |
gr_phy_write_3d(tr_seri(:, :, it))) |
435 |
if (lessivage) THEN |
if (lessivage) THEN |
436 |
CALL histwrite(nid_tra, "fl"//tnom(it+2), itau_w, & |
CALL histwrite(nid_ins, "fl"//tname(it+2), itau_w, & |
437 |
gr_phy_write_3d(flestottr(:, :, it))) |
gr_phy_write_3d(flestottr(:, :, it))) |
438 |
endif |
endif |
439 |
CALL histwrite(nid_tra, "d_tr_th_"//tnom(it+2), itau_w, & |
CALL histwrite(nid_ins, "d_tr_th_"//tname(it+2), itau_w, & |
440 |
gr_phy_write_3d(d_tr_th(:, :, it))) |
gr_phy_write_3d(d_tr_th(:, :, it))) |
441 |
CALL histwrite(nid_tra, "d_tr_cv_"//tnom(it+2), itau_w, & |
CALL histwrite(nid_ins, "d_tr_cv_"//tname(it+2), itau_w, & |
442 |
gr_phy_write_3d(d_tr_cv(:, :, it))) |
gr_phy_write_3d(d_tr_cv(:, :, it))) |
443 |
CALL histwrite(nid_tra, "d_tr_cl_"//tnom(it+2), itau_w, & |
CALL histwrite(nid_ins, "d_tr_cl_"//tname(it+2), itau_w, & |
444 |
gr_phy_write_3d(d_tr_cl(:, :, it))) |
gr_phy_write_3d(d_tr_cl(:, :, it))) |
445 |
ENDDO |
ENDDO |
446 |
|
|
|
CALL histwrite(nid_tra, "pplay", itau_w, gr_phy_write_3d(pplay)) |
|
|
CALL histwrite(nid_tra, "T", itau_w, gr_phy_write_3d(t_seri)) |
|
|
|
|
|
if (ok_sync) then |
|
|
call histsync(nid_tra) |
|
|
endif |
|
|
|
|
447 |
end subroutine write_histrac |
end subroutine write_histrac |
448 |
|
|
449 |
END SUBROUTINE phytrac |
END SUBROUTINE phytrac |