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