source: LMDZ6/branches/Amaury_dev/libf/phylmd/o3_chem_m.F90 @ 5441

Last change on this file since 5441 was 5158, checked in by abarral, 5 months ago

Add missing klon on strataer_emiss_mod.F90
Correct various missing explicit declarations
Replace tabs by spaces (tabs are not part of the fortran charset)
Continue cleaning modules
Removed unused arguments and variables

  • Property copyright set to
    Name of program: LMDZ
    Creation date: 1984
    Version: LMDZ5
    License: CeCILL version 2
    Holder: Laboratoire de m\'et\'eorologie dynamique, CNRS, UMR 8539
    See the license file in the root directory
File size: 5.5 KB
Line 
1! $Id$
2module o3_chem_m
3
4  IMPLICIT NONE
5
6  PRIVATE o3_prod
7
8CONTAINS
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, nbp_lev/)".
17    ! Index "(i, :)" is for longitude "rlon(i)", latitude "rlat(i)".
18
19    USE lmdz_assert, ONLY: assert
20    USE dimphy, ONLY: klon
21    USE regr_pr_comb_coefoz_m, ONLY: c_Mob, a4_mass, a2, r_het_interm
22    USE lmdz_grid_phy, ONLY: nbp_lev
23    USE lmdz_physical_constants, ONLY: pi
24
25    INTEGER, INTENT(IN):: julien ! jour julien, 1 <= julien <= 360
26    REAL, INTENT(IN):: gmtime ! heure de la journée en fraction de jour
27    REAL, INTENT(IN):: t_seri(:, :) ! (klon, nbp_lev) temperature, in K
28
29    REAL, INTENT(IN):: zmasse(:, :) ! (klon, nbp_lev)
30    ! (column-density of mass of air in a cell, in kg m-2)
31    ! "zmasse(:, k)" is for layer "k".)
32
33    REAL, INTENT(IN):: pdtphys ! time step for physics, in s
34
35    REAL, INTENT(IN):: rlat(:), rlon(:)
36    ! (longitude and latitude of each horizontal position, in degrees)
37
38    REAL, INTENT(INOUT):: q(:, :) ! (klon, nbp_lev) mass fraction of ozone
39    ! "q(:, k)" is at middle of layer "k".)
40
41    ! Variables local to the procedure:
42    ! (for "pi")
43    INTEGER k
44
45    REAL c(klon, nbp_lev)
46    ! (constant term during a time step in the net mass production
47    ! rate of ozone by chemistry, per unit mass of air, in s-1)
48    ! "c(:, k)" is at middle of layer "k".)
49
50    REAL b(klon, nbp_lev)
51    ! (coefficient of "q" in the net mass production
52    ! rate of ozone by chemistry, per unit mass of air, in s-1)
53    ! "b(:, k)" is at middle of layer "k".)
54
55    REAL dq_o3_chem(klon, nbp_lev)
56    ! (variation of ozone mass fraction due to chemistry during a time step)
57    ! "dq_o3_chem(:, k)" is at middle of layer "k".)
58
59    REAL earth_long
60    ! (longitude vraie de la Terre dans son orbite solaire, par
61    ! rapport au point vernal (21 mars), en degrés)
62
63    REAL pmu0(klon) ! mean of cosine of solar zenith angle during "pdtphys"
64    REAL trash1
65    REAL trash2(klon)
66
67    !-------------------------------------------------------------
68
69    CALL assert(klon == (/size(q, 1), size(t_seri, 1), size(zmasse, 1), &
70         size(rlat), size(rlon)/), "o3_chem klon")
71    CALL assert(nbp_lev == (/size(q, 2), size(t_seri, 2), size(zmasse, 2)/), &
72         "o3_chem nbp_lev")
73
74    c = c_Mob + a4_mass * t_seri
75
76    ! Compute coefficient "b":
77
78    ! Heterogeneous chemistry is only at low temperature:
79    where (t_seri < 195.)
80       b = r_het_interm
81    elsewhere
82       b = 0.
83    end where
84
85    ! Heterogeneous chemistry is only during daytime:
86    CALL orbite(real(julien), earth_long, trash1)
87    CALL zenang(earth_long, gmtime, 0., pdtphys, rlat, rlon, pmu0, trash2)
88    forall (k = 1: nbp_lev)
89       where (pmu0 <= cos(87. / 180. * pi)) b(:, k) = 0.
90    end forall
91
92    b = b + a2
93
94    ! Midpoint method:
95
96    ! Trial step to the midpoint:
97    dq_o3_chem = o3_prod(q, zmasse, c, b) * pdtphys  / 2
98    ! "Real" step across the whole interval:
99    dq_o3_chem = o3_prod(q + dq_o3_chem, zmasse, c, b) * pdtphys
100    q = q + dq_o3_chem
101
102    ! Confine the mass fraction:
103    q = min(max(q, 0.), .01)
104
105  END SUBROUTINE  o3_chem
106
107  !*************************************************
108
109  function o3_prod(q, zmasse, c, b)
110
111    ! This function computes the production rate of ozone by chemistry.
112
113    ! All the 2-dimensional arrays are on the partial "physics" grid.
114    ! Their shape is "(/klon, nbp_lev/)".
115    ! Index "(i, :)" is for longitude "rlon(i)", latitude "rlat(i)".
116
117    USE regr_pr_comb_coefoz_m, ONLY: a6_mass
118    USE lmdz_assert, ONLY: assert
119    USE dimphy, ONLY: klon
120    USE lmdz_grid_phy, ONLY: nbp_lev
121
122    REAL, INTENT(IN):: q(:, :) ! mass fraction of ozone
123    ! "q(:, k)" is at middle of layer "k".)
124
125    REAL, INTENT(IN):: zmasse(:, :)
126    ! (column-density of mass of air in a layer, in kg m-2)
127    ! ("zmasse(:, k)" is for layer "k".)
128
129    REAL, INTENT(IN):: c(:, :)
130    ! (constant term during a time step in the net mass production
131    ! rate of ozone by chemistry, per unit mass of air, in s-1)
132    ! "c(:, k)" is at middle of layer "k".)
133
134    REAL, INTENT(IN):: b(:, :)
135    ! (coefficient of "q" in the net mass production rate of ozone by
136    ! chemistry, per unit mass of air, in s-1)
137    ! ("b(:, k)" is at middle of layer "k".)
138
139    REAL o3_prod(klon, nbp_lev)
140    ! (net mass production rate of ozone by chemistry, per unit mass
141    ! of air, in s-1)
142    ! ("o3_prod(:, k)" is at middle of layer "k".)
143
144    ! Variables local to the procedure:
145
146    REAL sigma_mass(klon, nbp_lev)
147    ! (mass column-density of ozone above point, in kg m-2)
148    ! ("sigma_mass(:, k)" is at middle of layer "k".)
149
150    INTEGER k
151
152    !-------------------------------------------------------------------
153
154    CALL assert(klon == (/size(q, 1), size(zmasse, 1), size(c, 1), &
155         size(b, 1)/), "o3_prod 1")
156    CALL assert(nbp_lev == (/size(q, 2), size(zmasse, 2), size(c, 2), &
157         size(b, 2)/), "o3_prod 2")
158
159    ! Compute the column-density above the base of layer
160    ! "k", and, as a first approximation, take it as column-density
161    ! above the middle of layer "k":
162    sigma_mass(:, nbp_lev) = zmasse(:, nbp_lev) * q(:, nbp_lev) ! top layer
163    DO k =  nbp_lev - 1, 1, -1
164       sigma_mass(:, k) = sigma_mass(:, k+1) + zmasse(:, k) * q(:, k)
165    END DO
166
167    o3_prod = c + b * q + a6_mass * sigma_mass
168
169  END FUNCTION o3_prod
170
171END MODULE o3_chem_m
Note: See TracBrowser for help on using the repository browser.