1 |
module phytrac_m |
module phytrac_m |
2 |
|
|
|
! This module is clean: no C preprocessor directive, no include line. |
|
|
|
|
3 |
IMPLICIT none |
IMPLICIT none |
4 |
|
|
5 |
private |
private |
7 |
|
|
8 |
contains |
contains |
9 |
|
|
10 |
SUBROUTINE phytrac(rnpb, itap, lmt_pas, julien, gmtime, firstcal, lafin, & |
SUBROUTINE phytrac(itap, lmt_pas, julien, gmtime, firstcal, lafin, pdtphys, & |
11 |
nq_phys, pdtphys, u, v, t_seri, paprs, pplay, pmfu, pmfd, pen_u, & |
t_seri, paprs, pplay, pmfu, pmfd, pde_u, pen_d, coefh, fm_therm, & |
12 |
pde_u, pen_d, pde_d, coefh, fm_therm, entr_therm, yu1, yv1, ftsol, & |
entr_therm, yu1, yv1, ftsol, pctsrf, frac_impa, frac_nucl, pphis, da, & |
13 |
pctsrf, frac_impa, frac_nucl, pphis, pphi, albsol, rh, cldfra, rneb, & |
phi, mp, upwd, dnwd, tr_seri, zmasse, ncid_startphy) |
|
diafra, cldliq, itop_con, ibas_con, pmflxr, pmflxs, prfl, psfl, da, & |
|
|
phi, mp, upwd, dnwd, tr_seri, zmasse) |
|
14 |
|
|
15 |
! 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 (SVN revision 679) |
16 |
|
|
17 |
! Authors: Frédéric Hourdin, Abderrahmane Idelkadi, Marie-Alice |
! Authors: Fr\'ed\'eric Hourdin, Abderrahmane Idelkadi, Marie-Alice |
18 |
! Foujols, Olivia |
! Foujols, Olivia |
|
! Objet : moniteur général des tendances des traceurs |
|
19 |
|
|
20 |
! Remarques : |
! Objet : moniteur g\'en\'eral des tendances des traceurs |
|
! 1/ L'appel de "phytrac" se fait avec "nq-2" donc nous avons bien |
|
|
! les vrais traceurs (en nombre "nbtr", sans la vapeur d'eau ni l'eau |
|
|
! liquide) dans "phytrac". |
|
|
! 2/ Le choix du radon et du plomb se fait juste avec un "data" |
|
|
! (peu propre). |
|
|
! Pourrait-on avoir une variable qui indiquerait le type de traceur ? |
|
21 |
|
|
22 |
use dimens_m, only: llm |
! L'appel de "phytrac" se fait avec "nqmx - 2" donc nous avons |
23 |
use indicesol, only: nbsrf |
! bien les vrais traceurs, sans la vapeur d'eau ni l'eau liquide. |
24 |
use dimphy, only: klon, nbtr |
|
25 |
|
! Modifications pour les traceurs : |
26 |
|
! - uniformisation des parametrisations dans phytrac |
27 |
|
! - stockage des moyennes des champs n\'ecessaires en mode traceur off-line |
28 |
|
|
29 |
|
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 abort_gcm_m, only: abort_gcm |
use cltrac_m, only: cltrac |
33 |
use YOMCST, only: rg |
use cltracrn_m, only: cltracrn |
34 |
use ctherm, only: iflag_thermals |
use ctherm, only: iflag_thermals |
35 |
use regr_pr_comb_coefoz_m, only: regr_pr_comb_coefoz |
use cvltr_m, only: cvltr |
36 |
use phyetat0_m, only: rlat |
use dimens_m, only: llm, nqmx |
37 |
use o3_chem_m, only: o3_chem |
use dimphy, only: klon |
38 |
use ini_hist, only: ini_histrac |
use indicesol, only: nbsrf |
39 |
use radiornpb_m, only: radiornpb |
use ini_histrac_m, only: ini_histrac |
40 |
|
use initrrnpb_m, only: initrrnpb |
41 |
use minmaxqfi_m, only: minmaxqfi |
use minmaxqfi_m, only: minmaxqfi |
42 |
use numer_rec, only: assert |
use netcdf95, only: nf95_inq_varid, nf95_get_var, nf95_put_var |
43 |
|
use nflxtr_m, only: nflxtr |
44 |
|
use nr_util, only: assert |
45 |
|
use o3_chem_m, only: o3_chem |
46 |
|
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 |
50 |
|
use regr_pr_comb_coefoz_m, only: regr_pr_comb_coefoz |
51 |
|
use SUPHEC_M, only: rg |
52 |
|
|
53 |
! Arguments: |
integer, intent(in):: itap ! number of calls to "physiq" |
|
|
|
|
! EN ENTREE: |
|
|
|
|
|
! divers: |
|
|
|
|
|
logical, intent(in):: rnpb |
|
|
|
|
|
integer, intent(in):: nq_phys |
|
|
! (nombre de traceurs auxquels on applique la physique) |
|
|
|
|
|
integer, intent(in):: itap ! number of calls to "physiq" |
|
54 |
integer, intent(in):: lmt_pas ! number of time steps of "physics" per day |
integer, intent(in):: lmt_pas ! number of time steps of "physics" per day |
55 |
integer, intent(in):: julien !jour julien, 1 <= julien <= 360 |
integer, intent(in):: julien !jour julien, 1 <= julien <= 360 |
56 |
integer itop_con(klon) |
real, intent(in):: gmtime ! heure de la journ\'ee en fraction de jour |
57 |
integer ibas_con(klon) |
logical, intent(in):: firstcal ! first call to "calfis" |
58 |
real, intent(in):: gmtime ! heure de la journée en fraction de jour |
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) |
60 |
real, intent(in):: t_seri(klon, llm) ! temperature, in K |
real, intent(in):: t_seri(klon, llm) ! temperature, in K |
61 |
|
|
|
real, intent(inout):: tr_seri(:, :, :) ! (klon, llm, nbtr) |
|
|
! (mass fractions of tracers, excluding water, at mid-layers) |
|
|
|
|
|
real u(klon, llm) |
|
|
real v(klon, llm) |
|
|
real rh(klon, llm) ! humidite relative |
|
|
real cldliq(klon, llm) ! eau liquide nuageuse |
|
|
real cldfra(klon, llm) ! fraction nuageuse (tous les nuages) |
|
|
|
|
|
real diafra(klon, llm) |
|
|
! (fraction nuageuse (convection ou stratus artificiels)) |
|
|
|
|
|
real rneb(klon, llm) ! fraction nuageuse (grande echelle) |
|
|
real albsol(klon) ! albedo surface |
|
|
|
|
62 |
real, intent(in):: paprs(klon, llm+1) |
real, intent(in):: paprs(klon, llm+1) |
63 |
! (pression pour chaque inter-couche, en Pa) |
! (pression pour chaque inter-couche, en Pa) |
64 |
|
|
65 |
real, intent(in):: pplay(klon, llm) |
real, intent(in):: pplay(klon, llm) |
66 |
! (pression pour le mileu de chaque couche, en Pa) |
! (pression pour le mileu de chaque couche, en Pa) |
67 |
|
|
68 |
real pphi(klon, llm) ! geopotentiel |
! convection: |
|
real pphis(klon) |
|
|
logical, intent(in):: firstcal ! first call to "calfis" |
|
|
logical, intent(in):: lafin ! fin de la physique |
|
|
|
|
|
REAL pmflxr(klon, llm+1), pmflxs(klon, llm+1) !--lessivage convection |
|
|
REAL prfl(klon, llm+1), psfl(klon, llm+1) !--lessivage large-scale |
|
69 |
|
|
70 |
! convection: |
REAL, intent(in):: pmfu(klon, llm) ! flux de masse dans le panache montant |
|
REAL pmfu(klon, llm) ! flux de masse dans le panache montant |
|
|
REAL pmfd(klon, llm) ! flux de masse dans le panache descendant |
|
|
REAL pen_u(klon, llm) ! flux entraine dans le panache montant |
|
71 |
|
|
72 |
! thermiques: |
REAL, intent(in):: pmfd(klon, llm) |
73 |
|
! flux de masse dans le panache descendant |
|
real fm_therm(klon, llm+1), entr_therm(klon, llm) |
|
74 |
|
|
75 |
REAL pde_u(klon, llm) ! flux detraine dans le panache montant |
REAL pde_u(klon, llm) ! flux detraine dans le panache montant |
76 |
REAL pen_d(klon, llm) ! flux entraine dans le panache descendant |
REAL pen_d(klon, llm) ! flux entraine dans le panache descendant |
77 |
REAL pde_d(klon, llm) ! flux detraine dans le panache descendant |
REAL coefh(klon, llm) ! coeff melange couche limite |
|
! KE |
|
|
real da(klon, llm), phi(klon, llm, llm), mp(klon, llm) |
|
|
REAL upwd(klon, llm) ! saturated updraft mass flux |
|
|
REAL dnwd(klon, llm) ! saturated downdraft mass flux |
|
78 |
|
|
79 |
! Couche limite: |
! thermiques: |
80 |
|
real fm_therm(klon, llm+1), entr_therm(klon, llm) |
|
REAL coefh(klon, llm) ! coeff melange CL |
|
|
REAL yu1(klon) ! vents au premier niveau |
|
|
REAL yv1(klon) ! vents au premier niveau |
|
|
|
|
|
! Lessivage: |
|
81 |
|
|
82 |
! pour le ON-LINE |
! Couche limite: |
83 |
|
REAL yu1(klon) ! vents au premier niveau |
84 |
|
REAL yv1(klon) ! vents au premier niveau |
85 |
|
|
86 |
REAL frac_impa(klon, llm) ! fraction d'aerosols impactes |
! Arguments n\'ecessaires pour les sources et puits de traceur : |
87 |
REAL frac_nucl(klon, llm) ! fraction d'aerosols nuclees |
real, intent(in):: ftsol(klon, nbsrf) ! Temperature du sol (surf)(Kelvin) |
88 |
|
real pctsrf(klon, nbsrf) ! Pourcentage de sol f(nature du sol) |
89 |
|
|
90 |
! Arguments necessaires pour les sources et puits de traceur: |
! Lessivage pour le on-line |
91 |
|
REAL frac_impa(klon, llm) ! fraction d'aerosols impactes |
92 |
|
REAL frac_nucl(klon, llm) ! fraction d'aerosols nuclees |
93 |
|
|
94 |
|
real, intent(in):: pphis(klon) |
95 |
|
|
96 |
|
! Kerry Emanuel |
97 |
|
real, intent(in):: da(klon, llm), phi(klon, llm, llm), mp(klon, llm) |
98 |
|
REAL, intent(in):: upwd(klon, llm) ! saturated updraft mass flux |
99 |
|
REAL, intent(in):: dnwd(klon, llm) ! saturated downdraft mass flux |
100 |
|
|
101 |
real ftsol(klon, nbsrf) ! Temperature du sol (surf)(Kelvin) |
real, intent(inout):: tr_seri(:, :, :) ! (klon, llm, nqmx - 2) |
102 |
real pctsrf(klon, nbsrf) ! Pourcentage de sol f(nature du sol) |
! (mass fractions of tracers, excluding water, at mid-layers) |
103 |
|
|
104 |
real, intent(in):: zmasse(:, :) ! (klon, llm) |
real, intent(in):: zmasse(:, :) ! (klon, llm) |
105 |
! (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) |
106 |
|
|
107 |
! Variables local to the procedure: |
integer, intent(in):: ncid_startphy |
108 |
|
|
109 |
|
! Local: |
110 |
|
|
111 |
integer nsplit |
integer nsplit |
112 |
|
|
113 |
! TRACEURS |
! TRACEURS |
114 |
|
|
115 |
! Sources et puits des traceurs: |
! Sources et puits des traceurs: |
116 |
|
|
117 |
! Pour l'instant seuls les cas du rn et du pb ont ete envisages. |
! Pour l'instant seuls les cas du rn et du pb ont ete envisages. |
118 |
|
|
119 |
REAL source(klon) ! a voir lorsque le flux est prescrit |
REAL source(klon) ! a voir lorsque le flux est prescrit |
120 |
! |
! |
121 |
! Pour la source de radon et son reservoir de sol |
! Pour la source de radon et son reservoir de sol |
122 |
|
|
123 |
REAL, save:: trs(klon, nbtr) ! Concentration de radon dans le sol |
REAL, save:: trs(klon, nqmx - 2) ! Concentration de traceur dans le sol |
124 |
|
|
125 |
REAL masktr(klon, nbtr) ! Masque reservoir de sol traceur |
REAL masktr(klon, nqmx - 2) ! Masque reservoir de sol traceur |
126 |
! Masque de l'echange avec la surface |
! Masque de l'echange avec la surface |
127 |
! (1 = reservoir) ou (possible => 1 ) |
! (1 = reservoir) ou (possible => 1) |
128 |
SAVE masktr |
SAVE masktr |
129 |
REAL fshtr(klon, nbtr) ! Flux surfacique dans le reservoir de sol |
REAL fshtr(klon, nqmx - 2) ! Flux surfacique dans le reservoir de sol |
130 |
SAVE fshtr |
SAVE fshtr |
131 |
REAL hsoltr(nbtr) ! Epaisseur equivalente du reservoir de sol |
REAL hsoltr(nqmx - 2) ! Epaisseur equivalente du reservoir de sol |
132 |
SAVE hsoltr |
SAVE hsoltr |
133 |
REAL tautr(nbtr) ! Constante de decroissance radioactive |
REAL tautr(nqmx - 2) ! Constante de decroissance radioactive |
134 |
SAVE tautr |
SAVE tautr |
135 |
REAL vdeptr(nbtr) ! Vitesse de depot sec dans la couche Brownienne |
REAL vdeptr(nqmx - 2) ! Vitesse de depot sec dans la couche Brownienne |
136 |
SAVE vdeptr |
SAVE vdeptr |
137 |
REAL scavtr(nbtr) ! Coefficient de lessivage |
REAL scavtr(nqmx - 2) ! Coefficient de lessivage |
138 |
SAVE scavtr |
SAVE scavtr |
139 |
|
|
140 |
CHARACTER itn |
CHARACTER itn |
142 |
|
|
143 |
! nature du traceur |
! nature du traceur |
144 |
|
|
145 |
logical aerosol(nbtr) ! Nature du traceur |
logical aerosol(nqmx - 2) ! Nature du traceur |
146 |
! ! aerosol(it) = true => aerosol |
! ! aerosol(it) = true => aerosol |
147 |
! ! aerosol(it) = false => gaz |
! ! aerosol(it) = false => gaz |
148 |
logical clsol(nbtr) ! couche limite sol calculée |
logical clsol(nqmx - 2) ! couche limite sol calcul\'ee |
149 |
logical radio(nbtr) ! décroisssance radioactive |
logical radio(nqmx - 2) ! d\'ecroisssance radioactive |
150 |
save aerosol, clsol, radio |
save aerosol, clsol, radio |
151 |
|
|
152 |
! convection tiedtke |
! convection tiedtke |
158 |
! Variables locales pour effectuer les appels en serie |
! Variables locales pour effectuer les appels en serie |
159 |
|
|
160 |
REAL d_tr(klon, llm), d_trs(klon) ! tendances de traceurs |
REAL d_tr(klon, llm), d_trs(klon) ! tendances de traceurs |
161 |
REAL d_tr_cl(klon, llm, nbtr) ! tendance de traceurs couche limite |
REAL d_tr_cl(klon, llm, nqmx - 2) ! tendance de traceurs couche limite |
162 |
REAL d_tr_cv(klon, llm, nbtr) ! tendance de traceurs conv pour chq traceur |
|
163 |
REAL d_tr_th(klon, llm, nbtr) ! la tendance des thermiques |
REAL d_tr_cv(klon, llm, nqmx - 2) |
164 |
|
! tendance de traceurs conv pour chq traceur |
165 |
|
|
166 |
|
REAL d_tr_th(klon, llm, nqmx - 2) ! la tendance des thermiques |
167 |
REAL d_tr_dec(klon, llm, 2) ! la tendance de la decroissance |
REAL d_tr_dec(klon, llm, 2) ! la tendance de la decroissance |
168 |
! ! radioactive du rn - > pb |
! ! radioactive du rn - > pb |
169 |
REAL d_tr_lessi_impa(klon, llm, nbtr) ! la tendance du lessivage |
REAL d_tr_lessi_impa(klon, llm, nqmx - 2) ! la tendance du lessivage |
170 |
! ! par impaction |
! ! par impaction |
171 |
REAL d_tr_lessi_nucl(klon, llm, nbtr) ! la tendance du lessivage |
REAL d_tr_lessi_nucl(klon, llm, nqmx - 2) ! la tendance du lessivage |
172 |
! ! par nucleation |
! ! par nucleation |
173 |
REAL flestottr(klon, llm, nbtr) ! flux de lessivage |
REAL flestottr(klon, llm, nqmx - 2) ! flux de lessivage |
174 |
! ! dans chaque couche |
! ! dans chaque couche |
175 |
|
|
176 |
real ztra_th(klon, llm) |
real ztra_th(klon, llm) |
177 |
integer isplit |
integer isplit, varid |
178 |
|
|
179 |
! Controls: |
! Controls: |
180 |
logical:: couchelimite = .true. |
logical:: couchelimite = .true. |
185 |
!-------------------------------------- |
!-------------------------------------- |
186 |
|
|
187 |
call assert(shape(zmasse) == (/klon, llm/), "phytrac zmasse") |
call assert(shape(zmasse) == (/klon, llm/), "phytrac zmasse") |
188 |
call assert(shape(tr_seri) == (/klon, llm, nbtr/), "phytrac tr_seri") |
call assert(shape(tr_seri) == (/klon, llm, nqmx - 2/), "phytrac tr_seri") |
189 |
|
|
190 |
if (firstcal) then |
if (firstcal) then |
191 |
print *, 'phytrac: pdtphys = ', pdtphys |
print *, 'phytrac: pdtphys = ', pdtphys |
192 |
PRINT *, 'Fréquence de sortie des traceurs : ecrit_tra = ', ecrit_tra |
PRINT *, 'Frequency of tracer output: ecrit_tra = ', ecrit_tra |
193 |
if (nbtr < nq_phys) call abort_gcm('phytrac', 'nbtr < nq_phys', 1) |
inirnpb = .true. |
|
inirnpb=rnpb |
|
194 |
|
|
195 |
! Initialisation des sorties : |
! Initialisation des sorties : |
196 |
call ini_histrac(nid_tra, pdtphys, nq_phys, lessivage) |
call ini_histrac(nid_tra, pdtphys, nqmx - 2, lessivage) |
197 |
|
|
198 |
! Initialisation de certaines variables pour le radon et le plomb |
! Initialisation de certaines variables pour le radon et le plomb |
199 |
! Initialisation du traceur dans le sol (couche limite radonique) |
! Initialisation du traceur dans le sol (couche limite radonique) |
200 |
trs(:, :) = 0. |
trs(:, 2:) = 0. |
201 |
|
|
202 |
open (unit=99, file='starttrac', status='old', err=999, & |
call nf95_inq_varid(ncid_startphy, "trs", varid) |
203 |
form='formatted') |
call nf95_get_var(ncid_startphy, varid, trs(:, 1)) |
|
read(unit=99, fmt=*) (trs(i, 1), i=1, klon) |
|
|
999 continue |
|
|
close(unit=99) |
|
204 |
|
|
205 |
! Initialisation de la fraction d'aerosols lessivee |
! Initialisation de la fraction d'aerosols lessivee |
206 |
|
|
207 |
d_tr_lessi_impa(:, :, :) = 0. |
d_tr_lessi_impa = 0. |
208 |
d_tr_lessi_nucl(:, :, :) = 0. |
d_tr_lessi_nucl = 0. |
209 |
|
|
210 |
! Initialisation de la nature des traceurs |
! Initialisation de la nature des traceurs |
211 |
|
|
212 |
DO it = 1, nq_phys |
DO it = 1, nqmx - 2 |
213 |
aerosol(it) = .FALSE. ! Tous les traceurs sont des gaz par defaut |
aerosol(it) = .FALSE. ! Tous les traceurs sont des gaz par defaut |
214 |
radio(it) = .FALSE. ! par défaut pas de passage par "radiornpb" |
radio(it) = .FALSE. ! par d\'efaut pas de passage par "radiornpb" |
215 |
clsol(it) = .FALSE. ! Par defaut couche limite avec flux prescrit |
clsol(it) = .FALSE. ! Par defaut couche limite avec flux prescrit |
216 |
ENDDO |
ENDDO |
217 |
|
|
218 |
if (nq_phys >= 3) then |
if (nqmx >= 5) then |
219 |
call press_coefoz ! read input pressure levels for ozone coefficients |
call press_coefoz ! read input pressure levels for ozone coefficients |
220 |
end if |
end if |
221 |
ENDIF |
ENDIF |
222 |
|
|
|
! Initialisation du traceur dans le sol (couche limite radonique) |
|
223 |
if (inirnpb) THEN |
if (inirnpb) THEN |
224 |
|
! Initialisation du traceur dans le sol (couche limite radonique) |
225 |
radio(1)= .true. |
radio(1)= .true. |
226 |
radio(2)= .true. |
radio(2)= .true. |
227 |
clsol(1)= .true. |
clsol(1)= .true. |
228 |
clsol(2)= .true. |
clsol(2)= .true. |
229 |
aerosol(2) = .TRUE. ! le Pb est un aerosol |
aerosol(2) = .TRUE. ! le Pb est un aerosol |
230 |
|
call initrrnpb(pctsrf, masktr, fshtr, hsoltr, tautr, vdeptr, scavtr) |
|
call initrrnpb(ftsol, pctsrf, masktr, fshtr, hsoltr, tautr, vdeptr, & |
|
|
scavtr) |
|
231 |
inirnpb=.false. |
inirnpb=.false. |
232 |
endif |
endif |
233 |
|
|
|
! Calcul de l'effet de la convection |
|
|
|
|
234 |
if (convection) then |
if (convection) then |
235 |
DO it=1, nq_phys |
! Calcul de l'effet de la convection |
236 |
if (iflag_con.eq.2) then |
DO it=1, nqmx - 2 |
237 |
! tiedke |
if (iflag_con == 2) then |
238 |
CALL nflxtr(pdtphys, pmfu, pmfd, pen_u, pde_u, pen_d, pde_d, & |
! Tiedke |
239 |
paprs, tr_seri(1, 1, it), d_tr_cv(1, 1, it)) |
CALL nflxtr(pdtphys, pmfu, pmfd, pde_u, pen_d, paprs, & |
240 |
else if (iflag_con.eq.3) then |
tr_seri(:, :, it), d_tr_cv(:, :, it)) |
241 |
! KE |
else if (iflag_con == 3) then |
242 |
call cvltr(pdtphys, da, phi, mp, paprs, & |
! Emanuel |
243 |
tr_seri(1, 1, it), upwd, dnwd, d_tr_cv(1, 1, it)) |
call cvltr(pdtphys, da, phi, mp, paprs, tr_seri(:, :, it), upwd, & |
244 |
|
dnwd, d_tr_cv(:, :, it)) |
245 |
endif |
endif |
246 |
|
|
247 |
DO k = 1, llm |
DO k = 1, llm |
250 |
ENDDO |
ENDDO |
251 |
ENDDO |
ENDDO |
252 |
WRITE(unit=itn, fmt='(i1)') it |
WRITE(unit=itn, fmt='(i1)') it |
253 |
CALL minmaxqfi(tr_seri(:, :, it), 0., 1.e33, & |
CALL minmaxqfi(tr_seri(:, :, it), 0., 1e33, & |
254 |
'convection, tracer index = ' // itn) |
'convection, tracer index = ' // itn) |
255 |
ENDDO |
ENDDO |
256 |
endif |
endif |
257 |
|
|
258 |
! Calcul de l'effet des thermiques |
! Calcul de l'effet des thermiques |
259 |
|
|
260 |
do it=1, nq_phys |
do it=1, nqmx - 2 |
261 |
do k=1, llm |
do k=1, llm |
262 |
do i=1, klon |
do i=1, klon |
263 |
d_tr_th(i, k, it)=0. |
d_tr_th(i, k, it)=0. |
264 |
tr_seri(i, k, it)=max(tr_seri(i, k, it), 0.) |
tr_seri(i, k, it)=max(tr_seri(i, k, it), 0.) |
265 |
tr_seri(i, k, it)=min(tr_seri(i, k, it), 1.e10) |
tr_seri(i, k, it)=min(tr_seri(i, k, it), 1e10) |
266 |
enddo |
enddo |
267 |
enddo |
enddo |
268 |
enddo |
enddo |
269 |
|
|
270 |
if (iflag_thermals > 0) then |
if (iflag_thermals > 0) then |
271 |
nsplit=10 |
nsplit=10 |
272 |
DO it=1, nq_phys |
DO it=1, nqmx - 2 |
273 |
do isplit=1, nsplit |
do isplit=1, nsplit |
274 |
! Thermiques |
! Thermiques |
275 |
call dqthermcell(klon, llm, pdtphys/nsplit & |
call dqthermcell(klon, llm, pdtphys/nsplit & |
287 |
ENDDO |
ENDDO |
288 |
endif |
endif |
289 |
|
|
290 |
! Calcul de l'effet de la couche limite |
! Calcul de l'effet de la couche limite |
291 |
|
|
292 |
if (couchelimite) then |
if (couchelimite) then |
|
|
|
293 |
DO k = 1, llm |
DO k = 1, llm |
294 |
DO i = 1, klon |
DO i = 1, klon |
295 |
delp(i, k) = paprs(i, k)-paprs(i, k+1) |
delp(i, k) = paprs(i, k)-paprs(i, k+1) |
296 |
ENDDO |
ENDDO |
297 |
ENDDO |
ENDDO |
298 |
|
|
299 |
! MAF modif pour tenir compte du cas rnpb + traceur |
! MAF modif pour tenir compte du cas traceur |
300 |
DO it=1, nq_phys |
DO it=1, nqmx - 2 |
301 |
if (clsol(it)) then |
if (clsol(it)) then |
302 |
! couche limite avec quantite dans le sol calculee |
! couche limite avec quantite dans le sol calculee |
303 |
CALL cltracrn(it, pdtphys, yu1, yv1, & |
CALL cltracrn(it, pdtphys, yu1, yv1, coefh, t_seri, ftsol, & |
304 |
coefh, t_seri, ftsol, pctsrf, & |
pctsrf, tr_seri(:, :, it), trs(:, it), paprs, pplay, delp, & |
305 |
tr_seri(1, 1, it), trs(1, it), & |
masktr(1, it), fshtr(1, it), hsoltr(it), tautr(it), & |
306 |
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) |
|
307 |
DO k = 1, llm |
DO k = 1, llm |
308 |
DO i = 1, klon |
DO i = 1, klon |
309 |
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) |
310 |
ENDDO |
ENDDO |
311 |
ENDDO |
ENDDO |
312 |
|
|
313 |
! Traceur ds sol |
trs(:, it) = trs(:, it) + d_trs |
314 |
|
else |
315 |
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 |
|
316 |
!MAF provisoire source / traceur a creer |
!MAF provisoire source / traceur a creer |
317 |
DO i=1, klon |
DO i=1, klon |
318 |
source(i) = 0.0 ! pas de source, pour l'instant |
source(i) = 0. ! pas de source, pour l'instant |
319 |
ENDDO |
ENDDO |
320 |
|
|
321 |
CALL cltrac(pdtphys, coefh, t_seri, & |
CALL cltrac(pdtphys, coefh, t_seri, tr_seri(:, :, it), source, & |
322 |
tr_seri(1, 1, it), source, & |
paprs, pplay, delp, d_tr_cl(1, 1, it)) |
|
paprs, pplay, delp, & |
|
|
d_tr_cl(1, 1, it)) |
|
323 |
DO k = 1, llm |
DO k = 1, llm |
324 |
DO i = 1, klon |
DO i = 1, klon |
325 |
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) |
327 |
ENDDO |
ENDDO |
328 |
endif |
endif |
329 |
ENDDO |
ENDDO |
330 |
|
endif |
331 |
|
|
332 |
endif ! couche limite |
! Calcul de l'effet du puits radioactif |
|
|
|
|
! Calcul de l'effet du puits radioactif |
|
333 |
|
|
334 |
! MAF il faudrait faire une modification pour passer dans radiornpb |
! MAF il faudrait faire une modification pour passer dans radiornpb |
335 |
! si radio=true mais pour l'instant radiornpb propre au cas rnpb |
! si radio=true |
336 |
if (rnpb) then |
d_tr_dec = radiornpb(tr_seri, pdtphys, tautr) |
337 |
d_tr_dec(:, :, :) = radiornpb(tr_seri, pdtphys, tautr) |
DO it = 1, nqmx - 2 |
338 |
DO it=1, nq_phys |
if (radio(it)) then |
339 |
if (radio(it)) then |
tr_seri(:, :, it) = tr_seri(:, :, it) + d_tr_dec(:, :, it) |
340 |
tr_seri(:, :, it) = tr_seri(:, :, it) + d_tr_dec(:, :, it) |
WRITE(unit=itn, fmt='(i1)') it |
341 |
WRITE(unit=itn, fmt='(i1)') it |
CALL minmaxqfi(tr_seri(:, :, it), 0., 1e33, 'puits rn it='//itn) |
342 |
CALL minmaxqfi(tr_seri(:, :, it), 0., 1.e33, 'puits rn it='//itn) |
endif |
343 |
endif |
ENDDO |
|
ENDDO |
|
|
endif ! rnpb decroissance radioactive |
|
344 |
|
|
345 |
if (nq_phys >= 3) then |
if (nqmx >= 5) then |
346 |
! Ozone as a tracer: |
! Ozone as a tracer: |
347 |
if (mod(itap - 1, lmt_pas) == 0) then |
if (mod(itap - 1, lmt_pas) == 0) then |
348 |
! Once per day, update the coefficients for ozone chemistry: |
! Once per day, update the coefficients for ozone chemistry: |
354 |
! Calcul de l'effet de la precipitation |
! Calcul de l'effet de la precipitation |
355 |
|
|
356 |
IF (lessivage) THEN |
IF (lessivage) THEN |
357 |
d_tr_lessi_nucl(:, :, :) = 0. |
d_tr_lessi_nucl = 0. |
358 |
d_tr_lessi_impa(:, :, :) = 0. |
d_tr_lessi_impa = 0. |
359 |
flestottr(:, :, :) = 0. |
flestottr = 0. |
360 |
|
|
361 |
! tendance des aerosols nuclees et impactes |
! tendance des aerosols nuclees et impactes |
362 |
|
|
363 |
DO it = 1, nq_phys |
DO it = 1, nqmx - 2 |
364 |
IF (aerosol(it)) THEN |
IF (aerosol(it)) THEN |
365 |
DO k = 1, llm |
DO k = 1, llm |
366 |
DO i = 1, klon |
DO i = 1, klon |
367 |
d_tr_lessi_nucl(i, k, it) = d_tr_lessi_nucl(i, k, it) + & |
d_tr_lessi_nucl(i, k, it) = d_tr_lessi_nucl(i, k, it) + & |
368 |
( 1 - frac_nucl(i, k) )*tr_seri(i, k, it) |
(1 - frac_nucl(i, k))*tr_seri(i, k, it) |
369 |
d_tr_lessi_impa(i, k, it) = d_tr_lessi_impa(i, k, it) + & |
d_tr_lessi_impa(i, k, it) = d_tr_lessi_impa(i, k, it) + & |
370 |
( 1 - frac_impa(i, k) )*tr_seri(i, k, it) |
(1 - frac_impa(i, k))*tr_seri(i, k, it) |
371 |
ENDDO |
ENDDO |
372 |
ENDDO |
ENDDO |
373 |
ENDIF |
ENDIF |
376 |
! Mises a jour des traceurs + calcul des flux de lessivage |
! Mises a jour des traceurs + calcul des flux de lessivage |
377 |
! Mise a jour due a l'impaction et a la nucleation |
! Mise a jour due a l'impaction et a la nucleation |
378 |
|
|
379 |
DO it = 1, nq_phys |
DO it = 1, nqmx - 2 |
380 |
IF (aerosol(it)) THEN |
IF (aerosol(it)) THEN |
381 |
DO k = 1, llm |
DO k = 1, llm |
382 |
DO i = 1, klon |
DO i = 1, klon |
383 |
tr_seri(i, k, it)=tr_seri(i, k, it) & |
tr_seri(i, k, it) = tr_seri(i, k, it) * frac_impa(i, k) & |
384 |
*frac_impa(i, k)*frac_nucl(i, k) |
* frac_nucl(i, k) |
385 |
ENDDO |
ENDDO |
386 |
ENDDO |
ENDDO |
387 |
ENDIF |
ENDIF |
389 |
|
|
390 |
! Flux lessivage total |
! Flux lessivage total |
391 |
|
|
392 |
DO it = 1, nq_phys |
DO it = 1, nqmx - 2 |
393 |
DO k = 1, llm |
DO k = 1, llm |
394 |
DO i = 1, klon |
DO i = 1, klon |
395 |
flestottr(i, k, it) = flestottr(i, k, it) - & |
flestottr(i, k, it) = flestottr(i, k, it) & |
396 |
( d_tr_lessi_nucl(i, k, it) + & |
- (d_tr_lessi_nucl(i, k, it) + d_tr_lessi_impa(i, k, it)) & |
397 |
d_tr_lessi_impa(i, k, it) ) * & |
* (paprs(i, k)-paprs(i, k+1)) / (RG * pdtphys) |
|
( paprs(i, k)-paprs(i, k+1) ) / & |
|
|
(RG * pdtphys) |
|
398 |
ENDDO |
ENDDO |
399 |
ENDDO |
ENDDO |
400 |
ENDDO |
ENDDO |
401 |
ENDIF |
ENDIF |
402 |
|
|
403 |
! Ecriture des sorties |
! Ecriture des sorties |
404 |
call write_histrac(lessivage, nq_phys, itap, nid_tra) |
call write_histrac(lessivage, itap, nid_tra) |
405 |
|
|
406 |
if (lafin) then |
if (lafin) then |
407 |
print *, "C'est la fin de la physique." |
call nf95_inq_varid(ncid_restartphy, "trs", varid) |
408 |
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(99) |
|
409 |
endif |
endif |
410 |
|
|
411 |
contains |
contains |
412 |
|
|
413 |
subroutine write_histrac(lessivage, nq_phys, itap, nid_tra) |
subroutine write_histrac(lessivage, itap, nid_tra) |
414 |
|
|
415 |
! 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 |
416 |
|
|
417 |
use dimens_m, only: iim, jjm, llm |
use dimens_m, only: iim, jjm, llm |
418 |
use histcom, only: histsync |
use histsync_m, only: histsync |
419 |
use histwrite_m, only: histwrite |
use histwrite_m, only: histwrite |
420 |
use temps, only: itau_phy |
use temps, only: itau_phy |
421 |
use iniadvtrac_m, only: tnom |
use iniadvtrac_m, only: tname |
422 |
use comgeomphy, only: airephy |
use comgeomphy, only: airephy |
423 |
use dimphy, only: klon |
use dimphy, only: klon |
424 |
use grid_change, only: gr_phy_write_2d, gr_phy_write_3d |
use grid_change, only: gr_phy_write_2d |
425 |
|
use gr_phy_write_3d_m, only: gr_phy_write_3d |
426 |
|
|
427 |
logical, intent(in):: lessivage |
logical, intent(in):: lessivage |
428 |
|
integer, intent(in):: itap ! number of calls to "physiq" |
|
integer, intent(in):: nq_phys |
|
|
! (nombre de traceurs auxquels on applique la physique) |
|
|
|
|
|
integer, intent(in):: itap ! number of calls to "physiq" |
|
429 |
integer, intent(in):: nid_tra |
integer, intent(in):: nid_tra |
430 |
|
|
431 |
! Variables local to the procedure: |
! Variables local to the procedure: |
432 |
integer it |
integer it |
433 |
integer itau_w ! pas de temps ecriture |
integer itau_w ! pas de temps ecriture |
434 |
logical, parameter:: ok_sync = .true. |
logical, parameter:: ok_sync = .true. |
435 |
|
|
436 |
!----------------------------------------------------- |
!----------------------------------------------------- |
441 |
CALL histwrite(nid_tra, "aire", itau_w, gr_phy_write_2d(airephy)) |
CALL histwrite(nid_tra, "aire", itau_w, gr_phy_write_2d(airephy)) |
442 |
CALL histwrite(nid_tra, "zmasse", itau_w, gr_phy_write_3d(zmasse)) |
CALL histwrite(nid_tra, "zmasse", itau_w, gr_phy_write_3d(zmasse)) |
443 |
|
|
444 |
DO it=1, nq_phys |
DO it=1, nqmx - 2 |
445 |
CALL histwrite(nid_tra, tnom(it+2), itau_w, & |
CALL histwrite(nid_tra, tname(it+2), itau_w, & |
446 |
gr_phy_write_3d(tr_seri(:, :, it))) |
gr_phy_write_3d(tr_seri(:, :, it))) |
447 |
if (lessivage) THEN |
if (lessivage) THEN |
448 |
CALL histwrite(nid_tra, "fl"//tnom(it+2), itau_w, & |
CALL histwrite(nid_tra, "fl"//tname(it+2), itau_w, & |
449 |
gr_phy_write_3d(flestottr(:, :, it))) |
gr_phy_write_3d(flestottr(:, :, it))) |
450 |
endif |
endif |
451 |
CALL histwrite(nid_tra, "d_tr_th_"//tnom(it+2), itau_w, & |
CALL histwrite(nid_tra, "d_tr_th_"//tname(it+2), itau_w, & |
452 |
gr_phy_write_3d(d_tr_th(:, :, it))) |
gr_phy_write_3d(d_tr_th(:, :, it))) |
453 |
CALL histwrite(nid_tra, "d_tr_cv_"//tnom(it+2), itau_w, & |
CALL histwrite(nid_tra, "d_tr_cv_"//tname(it+2), itau_w, & |
454 |
gr_phy_write_3d(d_tr_cv(:, :, it))) |
gr_phy_write_3d(d_tr_cv(:, :, it))) |
455 |
CALL histwrite(nid_tra, "d_tr_cl_"//tnom(it+2), itau_w, & |
CALL histwrite(nid_tra, "d_tr_cl_"//tname(it+2), itau_w, & |
456 |
gr_phy_write_3d(d_tr_cl(:, :, it))) |
gr_phy_write_3d(d_tr_cl(:, :, it))) |
457 |
ENDDO |
ENDDO |
458 |
|
|