10 |
contains |
contains |
11 |
|
|
12 |
SUBROUTINE phytrac(rnpb, itap, lmt_pas, julien, gmtime, firstcal, lafin, & |
SUBROUTINE phytrac(rnpb, itap, lmt_pas, julien, gmtime, firstcal, lafin, & |
13 |
nqmax, pdtphys, u, v, t_seri, paprs, pplay, pmfu, pmfd, pen_u, & |
nq_phys, pdtphys, u, v, t_seri, paprs, pplay, pmfu, pmfd, pen_u, & |
14 |
pde_u, pen_d, pde_d, coefh, fm_therm, entr_therm, yu1, yv1, ftsol, & |
pde_u, pen_d, pde_d, coefh, fm_therm, entr_therm, yu1, yv1, ftsol, & |
15 |
pctsrf, frac_impa, frac_nucl, presnivs, pphis, & |
pctsrf, frac_impa, frac_nucl, pphis, pphi, albsol, rh, cldfra, rneb, & |
16 |
pphi, albsol, rh, cldfra, rneb, diafra, cldliq, itop_con, & |
diafra, cldliq, itop_con, ibas_con, pmflxr, pmflxs, prfl, psfl, da, & |
17 |
ibas_con, pmflxr, pmflxs, prfl, psfl, da, phi, mp, upwd, dnwd, & |
phi, mp, upwd, dnwd, tr_seri, zmasse) |
|
tr_seri, zmasse) |
|
18 |
|
|
19 |
! From phylmd/phytrac.F, version 1.15 2006/02/21 08:08:30 |
! From phylmd/phytrac.F, version 1.15 2006/02/21 08:08:30 |
20 |
|
|
21 |
! Authors : Frédéric Hourdin, Abderrahmane Idelkadi, Marie-Alice |
! Authors: Frédéric Hourdin, Abderrahmane Idelkadi, Marie-Alice |
22 |
! Foujols, Olivia |
! Foujols, Olivia |
23 |
! Objet : moniteur général des tendances des traceurs |
! Objet : moniteur général des tendances des traceurs |
24 |
|
|
55 |
|
|
56 |
logical, intent(in):: rnpb |
logical, intent(in):: rnpb |
57 |
|
|
58 |
integer, intent(in):: nqmax |
integer, intent(in):: nq_phys |
59 |
! (nombre de traceurs auxquels on applique la physique) |
! (nombre de traceurs auxquels on applique la physique) |
60 |
|
|
61 |
integer, intent(in):: itap ! number of calls to "physiq" |
integer, intent(in):: itap ! number of calls to "physiq" |
67 |
real, intent(in):: pdtphys ! pas d'integration pour la physique (s) |
real, intent(in):: pdtphys ! pas d'integration pour la physique (s) |
68 |
real, intent(in):: t_seri(klon, llm) ! temperature, in K |
real, intent(in):: t_seri(klon, llm) ! temperature, in K |
69 |
|
|
70 |
real, intent(inout):: tr_seri(klon, llm, nbtr) |
real, intent(inout):: tr_seri(:, :, :) ! (klon, llm, nbtr) |
71 |
! (mass fractions of tracers, excluding water, at mid-layers) |
! (mass fractions of tracers, excluding water, at mid-layers) |
72 |
|
|
73 |
real u(klon, llm) |
real u(klon, llm) |
90 |
|
|
91 |
real pphi(klon, llm) ! geopotentiel |
real pphi(klon, llm) ! geopotentiel |
92 |
real pphis(klon) |
real pphis(klon) |
|
REAL, intent(in):: presnivs(llm) |
|
93 |
logical, intent(in):: firstcal ! first call to "calfis" |
logical, intent(in):: firstcal ! first call to "calfis" |
94 |
logical, intent(in):: lafin ! fin de la physique |
logical, intent(in):: lafin ! fin de la physique |
95 |
|
|
209 |
|
|
210 |
!-------------------------------------- |
!-------------------------------------- |
211 |
|
|
212 |
call assert(shape(zmasse) == (/klon, llm/), "phytrac") |
call assert(shape(zmasse) == (/klon, llm/), "phytrac zmasse") |
213 |
|
call assert(shape(tr_seri) == (/klon, llm, nbtr/), "phytrac tr_seri") |
214 |
|
|
215 |
if (firstcal) then |
if (firstcal) then |
216 |
print *, 'phytrac: pdtphys = ', pdtphys |
print *, 'phytrac: pdtphys = ', pdtphys |
217 |
PRINT *, 'Fréquence de sortie des traceurs : ecrit_tra = ', ecrit_tra |
PRINT *, 'Fréquence de sortie des traceurs : ecrit_tra = ', ecrit_tra |
218 |
if (nbtr < nqmax) call abort_gcm('phytrac', 'See above', 1) |
if (nbtr < nq_phys) call abort_gcm('phytrac', 'nbtr < nq_phys', 1) |
219 |
inirnpb=rnpb |
inirnpb=rnpb |
220 |
|
|
221 |
! Initialisation des sorties : |
! Initialisation des sorties : |
222 |
call ini_histrac(nid_tra, pdtphys, presnivs, nqmax, lessivage) |
call ini_histrac(nid_tra, pdtphys, nq_phys, lessivage) |
223 |
|
|
224 |
! Initialisation de certaines variables pour le radon et le plomb |
! Initialisation de certaines variables pour le radon et le plomb |
225 |
! Initialisation du traceur dans le sol (couche limite radonique) |
! Initialisation du traceur dans le sol (couche limite radonique) |
238 |
|
|
239 |
! Initialisation de la nature des traceurs |
! Initialisation de la nature des traceurs |
240 |
|
|
241 |
DO it = 1, nqmax |
DO it = 1, nq_phys |
242 |
aerosol(it) = .FALSE. ! Tous les traceurs sont des gaz par defaut |
aerosol(it) = .FALSE. ! Tous les traceurs sont des gaz par defaut |
243 |
radio(it) = .FALSE. ! par défaut pas de passage par "radiornpb" |
radio(it) = .FALSE. ! par défaut pas de passage par "radiornpb" |
244 |
clsol(it) = .FALSE. ! Par defaut couche limite avec flux prescrit |
clsol(it) = .FALSE. ! Par defaut couche limite avec flux prescrit |
245 |
ENDDO |
ENDDO |
246 |
|
|
247 |
if (nqmax >= 3) then |
if (nq_phys >= 3) then |
248 |
call press_coefoz ! read input pressure levels for ozone coefficients |
call press_coefoz ! read input pressure levels for ozone coefficients |
249 |
end if |
end if |
250 |
ENDIF |
ENDIF |
266 |
! Calcul de l'effet de la convection |
! Calcul de l'effet de la convection |
267 |
|
|
268 |
if (convection) then |
if (convection) then |
269 |
DO it=1, nqmax |
DO it=1, nq_phys |
270 |
if (iflag_con.eq.2) then |
if (iflag_con.eq.2) then |
271 |
! tiedke |
! tiedke |
272 |
CALL nflxtr(pdtphys, pmfu, pmfd, pen_u, pde_u, pen_d, pde_d, & |
CALL nflxtr(pdtphys, pmfu, pmfd, pen_u, pde_u, pen_d, pde_d, & |
290 |
|
|
291 |
! Calcul de l'effet des thermiques |
! Calcul de l'effet des thermiques |
292 |
|
|
293 |
do it=1, nqmax |
do it=1, nq_phys |
294 |
do k=1, llm |
do k=1, llm |
295 |
do i=1, klon |
do i=1, klon |
296 |
d_tr_th(i, k, it)=0. |
d_tr_th(i, k, it)=0. |
302 |
|
|
303 |
if (iflag_thermals > 0) then |
if (iflag_thermals > 0) then |
304 |
nsplit=10 |
nsplit=10 |
305 |
DO it=1, nqmax |
DO it=1, nq_phys |
306 |
do isplit=1, nsplit |
do isplit=1, nsplit |
307 |
! Thermiques |
! Thermiques |
308 |
call dqthermcell(klon, llm, pdtphys/nsplit & |
call dqthermcell(klon, llm, pdtphys/nsplit & |
331 |
ENDDO |
ENDDO |
332 |
|
|
333 |
! MAF modif pour tenir compte du cas rnpb + traceur |
! MAF modif pour tenir compte du cas rnpb + traceur |
334 |
DO it=1, nqmax |
DO it=1, nq_phys |
335 |
if (clsol(it)) then |
if (clsol(it)) then |
336 |
! couche limite avec quantite dans le sol calculee |
! couche limite avec quantite dans le sol calculee |
337 |
CALL cltracrn(it, pdtphys, yu1, yv1, & |
CALL cltracrn(it, pdtphys, yu1, yv1, & |
379 |
! si radio=true mais pour l'instant radiornpb propre au cas rnpb |
! si radio=true mais pour l'instant radiornpb propre au cas rnpb |
380 |
if (rnpb) then |
if (rnpb) then |
381 |
d_tr_dec(:, :, :) = radiornpb(tr_seri, pdtphys, tautr) |
d_tr_dec(:, :, :) = radiornpb(tr_seri, pdtphys, tautr) |
382 |
DO it=1, nqmax |
DO it=1, nq_phys |
383 |
if (radio(it)) then |
if (radio(it)) then |
384 |
tr_seri(:, :, it) = tr_seri(:, :, it) + d_tr_dec(:, :, it) |
tr_seri(:, :, it) = tr_seri(:, :, it) + d_tr_dec(:, :, it) |
385 |
WRITE(unit=itn, fmt='(i1)') it |
WRITE(unit=itn, fmt='(i1)') it |
388 |
ENDDO |
ENDDO |
389 |
endif ! rnpb decroissance radioactive |
endif ! rnpb decroissance radioactive |
390 |
|
|
391 |
if (nqmax >= 3) then |
if (nq_phys >= 3) then |
392 |
! Ozone as a tracer: |
! Ozone as a tracer: |
393 |
if (mod(itap - 1, lmt_pas) == 0) then |
if (mod(itap - 1, lmt_pas) == 0) then |
394 |
! Once per day, update the coefficients for ozone chemistry: |
! Once per day, update the coefficients for ozone chemistry: |
406 |
|
|
407 |
! tendance des aerosols nuclees et impactes |
! tendance des aerosols nuclees et impactes |
408 |
|
|
409 |
DO it = 1, nqmax |
DO it = 1, nq_phys |
410 |
IF (aerosol(it)) THEN |
IF (aerosol(it)) THEN |
411 |
DO k = 1, llm |
DO k = 1, llm |
412 |
DO i = 1, klon |
DO i = 1, klon |
422 |
! Mises a jour des traceurs + calcul des flux de lessivage |
! Mises a jour des traceurs + calcul des flux de lessivage |
423 |
! Mise a jour due a l'impaction et a la nucleation |
! Mise a jour due a l'impaction et a la nucleation |
424 |
|
|
425 |
DO it = 1, nqmax |
DO it = 1, nq_phys |
426 |
IF (aerosol(it)) THEN |
IF (aerosol(it)) THEN |
427 |
DO k = 1, llm |
DO k = 1, llm |
428 |
DO i = 1, klon |
DO i = 1, klon |
435 |
|
|
436 |
! Flux lessivage total |
! Flux lessivage total |
437 |
|
|
438 |
DO it = 1, nqmax |
DO it = 1, nq_phys |
439 |
DO k = 1, llm |
DO k = 1, llm |
440 |
DO i = 1, klon |
DO i = 1, klon |
441 |
flestottr(i, k, it) = flestottr(i, k, it) - & |
flestottr(i, k, it) = flestottr(i, k, it) - & |
449 |
ENDIF |
ENDIF |
450 |
|
|
451 |
! Ecriture des sorties |
! Ecriture des sorties |
452 |
call write_histrac(lessivage, nqmax, itap, nid_tra) |
call write_histrac(lessivage, nq_phys, itap, nid_tra) |
453 |
|
|
454 |
if (lafin) then |
if (lafin) then |
455 |
print *, "C'est la fin de la physique." |
print *, "C'est la fin de la physique." |
463 |
|
|
464 |
contains |
contains |
465 |
|
|
466 |
subroutine write_histrac(lessivage, nqmax, itap, nid_tra) |
subroutine write_histrac(lessivage, nq_phys, itap, nid_tra) |
467 |
|
|
468 |
! 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 |
469 |
|
|
470 |
use dimens_m, only: iim, jjm, llm |
use dimens_m, only: iim, jjm, llm |
471 |
use ioipsl, only: histwrite, histsync |
use ioipsl, only: histwrite, histsync |
472 |
use temps, only: itau_phy |
use temps, only: itau_phy |
473 |
use advtrac_m, only: tnom |
use iniadvtrac_m, only: tnom |
474 |
use comgeomphy, only: airephy |
use comgeomphy, only: airephy |
475 |
use dimphy, only: klon |
use dimphy, only: klon |
476 |
|
use grid_change, only: gr_phy_write_2d, gr_phy_write_3d |
477 |
|
|
478 |
logical, intent(in):: lessivage |
logical, intent(in):: lessivage |
479 |
|
|
480 |
integer, intent(in):: nqmax |
integer, intent(in):: nq_phys |
481 |
! (nombre de traceurs auxquels on applique la physique) |
! (nombre de traceurs auxquels on applique la physique) |
482 |
|
|
483 |
integer, intent(in):: itap ! number of calls to "physiq" |
integer, intent(in):: itap ! number of calls to "physiq" |
486 |
! Variables local to the procedure: |
! Variables local to the procedure: |
487 |
integer it |
integer it |
488 |
integer itau_w ! pas de temps ecriture |
integer itau_w ! pas de temps ecriture |
|
REAL zx_tmp_2d(iim, jjm+1), zx_tmp_3d(iim, jjm+1, llm) |
|
489 |
logical, parameter:: ok_sync = .true. |
logical, parameter:: ok_sync = .true. |
490 |
|
|
491 |
!----------------------------------------------------- |
!----------------------------------------------------- |
492 |
|
|
493 |
itau_w = itau_phy + itap |
itau_w = itau_phy + itap |
494 |
|
|
495 |
CALL gr_fi_ecrit(1, klon, iim, jjm+1, pphis, zx_tmp_2d) |
CALL histwrite(nid_tra, "phis", itau_w, gr_phy_write_2d(pphis)) |
496 |
CALL histwrite(nid_tra, "phis", itau_w, zx_tmp_2d) |
CALL histwrite(nid_tra, "aire", itau_w, gr_phy_write_2d(airephy)) |
497 |
|
CALL histwrite(nid_tra, "zmasse", itau_w, gr_phy_write_3d(zmasse)) |
498 |
CALL gr_fi_ecrit(1, klon, iim, jjm+1, airephy, zx_tmp_2d) |
|
499 |
CALL histwrite(nid_tra, "aire", itau_w, zx_tmp_2d) |
DO it=1, nq_phys |
500 |
|
CALL histwrite(nid_tra, tnom(it+2), itau_w, & |
501 |
CALL gr_fi_ecrit(llm, klon, iim, jjm+1, zmasse, zx_tmp_3d) |
gr_phy_write_3d(tr_seri(:, :, it))) |
|
CALL histwrite(nid_tra, "zmasse", itau_w, zx_tmp_3d) |
|
|
|
|
|
DO it=1, nqmax |
|
|
CALL gr_fi_ecrit(llm, klon, iim, jjm+1, tr_seri(1, 1, it), zx_tmp_3d) |
|
|
CALL histwrite(nid_tra, tnom(it+2), itau_w, zx_tmp_3d) |
|
502 |
if (lessivage) THEN |
if (lessivage) THEN |
503 |
CALL gr_fi_ecrit(llm, klon, iim, jjm+1, flestottr(1, 1, it), & |
CALL histwrite(nid_tra, "fl"//tnom(it+2), itau_w, & |
504 |
zx_tmp_3d) |
gr_phy_write_3d(flestottr(:, :, it))) |
|
CALL histwrite(nid_tra, "fl"//tnom(it+2), itau_w, zx_tmp_3d) |
|
505 |
endif |
endif |
506 |
|
CALL histwrite(nid_tra, "d_tr_th_"//tnom(it+2), itau_w, & |
507 |
CALL gr_fi_ecrit(llm, klon, iim, jjm+1, d_tr_th(1, 1, it), zx_tmp_3d) |
gr_phy_write_3d(d_tr_th(:, :, it))) |
508 |
CALL histwrite(nid_tra, "d_tr_th_"//tnom(it+2), itau_w, zx_tmp_3d) |
CALL histwrite(nid_tra, "d_tr_cv_"//tnom(it+2), itau_w, & |
509 |
CALL gr_fi_ecrit(llm, klon, iim, jjm+1, d_tr_cv(1, 1, it), zx_tmp_3d) |
gr_phy_write_3d(d_tr_cv(:, :, it))) |
510 |
CALL histwrite(nid_tra, "d_tr_cv_"//tnom(it+2), itau_w, zx_tmp_3d) |
CALL histwrite(nid_tra, "d_tr_cl_"//tnom(it+2), itau_w, & |
511 |
CALL gr_fi_ecrit(llm, klon, iim, jjm+1, d_tr_cl(1, 1, it), zx_tmp_3d) |
gr_phy_write_3d(d_tr_cl(:, :, it))) |
|
CALL histwrite(nid_tra, "d_tr_cl_"//tnom(it+2), itau_w, zx_tmp_3d) |
|
512 |
ENDDO |
ENDDO |
513 |
|
|
514 |
CALL gr_fi_ecrit(llm, klon, iim, jjm+1, pplay, zx_tmp_3d) |
CALL histwrite(nid_tra, "pplay", itau_w, gr_phy_write_3d(pplay)) |
515 |
CALL histwrite(nid_tra, "pplay", itau_w, zx_tmp_3d) |
CALL histwrite(nid_tra, "T", itau_w, gr_phy_write_3d(t_seri)) |
|
|
|
|
CALL gr_fi_ecrit(llm, klon, iim, jjm+1, t_seri, zx_tmp_3d) |
|
|
CALL histwrite(nid_tra, "t", itau_w, zx_tmp_3d) |
|
516 |
|
|
517 |
if (ok_sync) then |
if (ok_sync) then |
518 |
call histsync(nid_tra) |
call histsync(nid_tra) |