9 |
|
|
10 |
SUBROUTINE phytrac(itap, lmt_pas, julien, gmtime, firstcal, lafin, pdtphys, & |
SUBROUTINE phytrac(itap, lmt_pas, julien, gmtime, firstcal, lafin, pdtphys, & |
11 |
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, da, & |
entr_therm, yu1, yv1, ftsol, pctsrf, frac_impa, frac_nucl, da, phi, & |
13 |
phi, mp, upwd, dnwd, tr_seri, zmasse, ncid_startphy) |
mp, upwd, dnwd, tr_seri, zmasse, ncid_startphy, nid_ins, itau_phy) |
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 |
|
|
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 |
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 |
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) |
|
|
|
|
94 |
! Kerry Emanuel |
! Kerry Emanuel |
95 |
real, intent(in):: 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 |
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 |
integer, intent(in):: ncid_startphy |
integer, intent(in):: ncid_startphy, nid_ins, itau_phy |
106 |
|
|
107 |
! Local: |
! Local: |
108 |
|
|
136 |
SAVE scavtr |
SAVE scavtr |
137 |
|
|
138 |
CHARACTER itn |
CHARACTER itn |
|
INTEGER, save:: nid_tra |
|
139 |
|
|
140 |
! nature du traceur |
! nature du traceur |
141 |
|
|
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(:, 2:) = 0. |
trs(:, 2:) = 0. |
195 |
|
|
196 |
call nf95_inq_varid(ncid_startphy, "trs", varid) |
call nf95_inq_varid(ncid_startphy, "trs", varid) |
197 |
call nf95_get_var(ncid_startphy, varid, trs(:, 1)) |
call nf95_get_var(ncid_startphy, varid, trs(:, 1)) |
198 |
|
if (any(trs(:, 1) == NF90_FILL_float)) call abort_gcm("phytrac", & |
199 |
|
"some missing values in trs(:, 1)") |
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(:, :, it), upwd, & |
call cvltr(pdtphys, da, phi, mp, paprs, tr_seri(:, :, it), upwd, & |
241 |
dnwd, d_tr_cv(:, :, it)) |
dnwd, d_tr_cv(:, :, 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 |
call nf95_inq_varid(ncid_restartphy, "trs", varid) |
call nf95_inq_varid(ncid_restartphy, "trs", varid) |
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 |
|
use temps, only: itau_phy |
|
415 |
use iniadvtrac_m, only: tname |
use iniadvtrac_m, only: tname |
|
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, tname(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"//tname(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_"//tname(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_"//tname(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_"//tname(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 |