1 |
module o3_chem_m |
2 |
|
3 |
! This module is clean: no C preprocessor directive, no include line. |
4 |
|
5 |
IMPLICIT none |
6 |
|
7 |
private o3_prod |
8 |
|
9 |
contains |
10 |
|
11 |
subroutine o3_chem(julien, gmtime, t_seri, zmasse, pdtphys, q) |
12 |
|
13 |
! This procedure evolves the ozone mass fraction through a time |
14 |
! step taking only chemistry into account. |
15 |
|
16 |
use nrutil, only: assert |
17 |
use dimphy, only: klon |
18 |
use dimens_m, only: llm |
19 |
use read_coefoz_m, only: c_Mob, a4_mass, a2, r_het_interm |
20 |
use orbite_m, only: orbite, zenang |
21 |
use nrtype, only: pi |
22 |
|
23 |
integer, intent(in):: julien ! jour julien, 1 <= julien <= 360 |
24 |
real, intent(in):: gmtime ! heure de la journée en fraction de jour |
25 |
real, intent(in):: t_seri(:, :) ! temperature, in K |
26 |
|
27 |
real, intent(in):: zmasse(:, :) |
28 |
! (column-density of mass of air in a cell, in kg m-2) |
29 |
! (On the "physics" grid. |
30 |
! "zmasse(i, k)" is at longitude "rlon(i)", latitude "rlat(i)", for |
31 |
! layer "k".) |
32 |
|
33 |
real, intent(in):: pdtphys ! time step for physics, in s |
34 |
|
35 |
real, intent(inout):: q(:, :) ! mass fraction of ozone |
36 |
! (On the "physics" grid. |
37 |
! "q(i, k)" is at longitude "rlon(i)", latitude "rlat(i)", middle of |
38 |
! layer "k".) |
39 |
|
40 |
! Variables local to the procedure: |
41 |
integer month, k |
42 |
|
43 |
real c(klon, llm) |
44 |
! (constant term during a time step in the net mass production |
45 |
! rate of ozone by chemistry, per unit mass of air, in s-1) |
46 |
! (On the "physics" grid. |
47 |
! "c(i, k)" is at longitude "rlon(i)", latitude "rlat(i)", middle of |
48 |
! layer "k".) |
49 |
|
50 |
real b(klon, llm) |
51 |
! (coefficient of "q" in the net mass production |
52 |
! rate of ozone by chemistry, per unit mass of air, in s-1) |
53 |
! (On the "physics" grid. |
54 |
! "b(i, k)" is at longitude "rlon(i)", latitude "rlat(i)", middle of |
55 |
! layer "k".) |
56 |
|
57 |
real dq_o3_chem(klon, llm) |
58 |
! (variation of ozone mass fraction due to chemistry during a time step) |
59 |
! (On the "physics" grid. |
60 |
! "dq_o3_chem(i, k)" is at longitude "rlon(i)", latitude |
61 |
! "rlat(i)", middle of layer "k".) |
62 |
|
63 |
real earth_long |
64 |
! (longitude vraie de la Terre dans son orbite solaire, par |
65 |
! rapport au point vernal (21 mars), en degrés) |
66 |
|
67 |
real pmu0(klon) ! mean of cosine of solar zenith angle during "pdtphys" |
68 |
|
69 |
!------------------------------------------------------------- |
70 |
|
71 |
call assert(klon == (/size(q, 1), size(t_seri, 1), size(zmasse, 1)/), & |
72 |
"o3_chem klon") |
73 |
call assert(llm == (/size(q, 2), size(t_seri, 2), size(zmasse, 2)/), & |
74 |
"o3_chem llm") |
75 |
|
76 |
month = (julien - 1) / 30 + 1 ! compute the month from the day number |
77 |
c = c_Mob(:, :, month) + a4_mass(:, :, month) * t_seri |
78 |
|
79 |
! Compute coefficient "b": |
80 |
|
81 |
! Heterogeneous chemistry is only at low temperature: |
82 |
where (t_seri < 195.) |
83 |
b = r_het_interm(:, :, month) |
84 |
elsewhere |
85 |
b = 0. |
86 |
end where |
87 |
|
88 |
! Heterogeneous chemistry is only during daytime: |
89 |
call orbite(real(julien), earth_long) |
90 |
call zenang(earth_long, gmtime, pdtphys, pmu0) |
91 |
forall (k = 1: llm) |
92 |
where (pmu0 <= cos(87. / 180. * pi)) b(:, k) = 0. |
93 |
end forall |
94 |
|
95 |
b = b + a2(:, :, month) |
96 |
|
97 |
! Midpoint method: |
98 |
|
99 |
! Trial step to the midpoint: |
100 |
dq_o3_chem = o3_prod(q, month, zmasse, c, b) * pdtphys / 2 |
101 |
! "Real" step across the whole interval: |
102 |
dq_o3_chem = o3_prod(q + dq_o3_chem, month, zmasse, c, b) * pdtphys |
103 |
q = q + dq_o3_chem |
104 |
|
105 |
! Confine the mass fraction: |
106 |
q = min(max(q, 0.), .01) |
107 |
|
108 |
end subroutine o3_chem |
109 |
|
110 |
!************************************************* |
111 |
|
112 |
function o3_prod(q, month, zmasse, c, b) |
113 |
|
114 |
! This function computes the production rate of ozone by chemistry. |
115 |
|
116 |
use read_coefoz_m, only: a6_mass |
117 |
use nrutil, only: assert |
118 |
use dimens_m, only: llm |
119 |
use dimphy, only: klon |
120 |
|
121 |
real, intent(in):: q(:, :) ! mass fraction of ozone |
122 |
! (On the "physics" grid. |
123 |
! "q(i, k)" is at longitude "rlon(i)", latitude "rlat(i)", middle of |
124 |
! layer "k".) |
125 |
|
126 |
integer, intent(in):: month |
127 |
|
128 |
real, intent(in):: zmasse(:, :) |
129 |
! (column-density of mass of air in a layer, in kg m-2) |
130 |
! (On the "physics" grid. |
131 |
! "zmasse(i, k)" is at longitude "rlon(i)", latitude "rlat(i)", middle of |
132 |
! layer "k".) |
133 |
|
134 |
real, intent(in):: c(:, :) |
135 |
! (constant term during a time step in the net mass production |
136 |
! rate of ozone by chemistry, per unit mass of air, in s-1) |
137 |
! (On the "physics" grid. |
138 |
! "c(i, k)" is at longitude "rlon(i)", latitude "rlat(i)", middle of |
139 |
! layer "k".) |
140 |
|
141 |
real, intent(in):: b(:, :) |
142 |
! (coefficient of "q" in the net mass production |
143 |
! rate of ozone by chemistry, per unit mass of air, in s-1) |
144 |
! (On the "physics" grid. |
145 |
! "b(i, k)" is at longitude "rlon(i)", latitude "rlat(i)", middle of |
146 |
! layer "k".) |
147 |
|
148 |
real o3_prod(klon, llm) |
149 |
! (net mass production rate of ozone by chemistry, per unit mass |
150 |
! of air, in s-1) |
151 |
! (On the "physics" grid. |
152 |
! "o3_prod(i, k)" is at longitude "rlon(i)", latitude "rlat(i)", middle of |
153 |
! layer "k".) |
154 |
|
155 |
! Variables local to the procedure: |
156 |
|
157 |
real sigma_mass(klon, llm) |
158 |
! (mass column-density of ozone above point, in kg m-2) |
159 |
! (On the "physics" grid. |
160 |
! "sigma_mass(i, k)" is at longitude "rlon(i)", latitude |
161 |
! "rlat(i)", middle of layer "k".) |
162 |
|
163 |
integer k |
164 |
|
165 |
!------------------------------------------------------------------- |
166 |
|
167 |
call assert(klon == (/size(q, 1), size(zmasse, 1), size(c, 1), & |
168 |
size(b, 1)/), "o3_prod 1") |
169 |
call assert(llm == (/size(q, 2), size(zmasse, 2), size(c, 2), & |
170 |
size(b, 2)/), "o3_prod 2") |
171 |
|
172 |
! Compute the column-density above the base of layer |
173 |
! "k", and, as a first approximation, take it as column-density |
174 |
! above the middle of layer "k": |
175 |
sigma_mass(:, llm) = zmasse(:, llm) * q(:, llm) ! top layer |
176 |
do k = llm - 1, 1, -1 |
177 |
sigma_mass(:, k) = sigma_mass(:, k+1) + zmasse(:, k) * q(:, k) |
178 |
end do |
179 |
|
180 |
o3_prod = c + b * q + a6_mass(:, :, month) * sigma_mass |
181 |
|
182 |
end function o3_prod |
183 |
|
184 |
end module o3_chem_m |