1 |
module read_coefoz_m |
module regr_pr_comb_coefoz_m |
2 |
|
|
3 |
! This module is clean: no C preprocessor directive, no include line. |
! This module is clean: no C preprocessor directive, no include line. |
4 |
|
|
7 |
|
|
8 |
implicit none |
implicit none |
9 |
|
|
10 |
real, save:: c_Mob(klon, llm, 12) |
! The five module variables declared here are on the "physics" grid. |
11 |
|
! The value of each variable for index "(i, k)" is at longitude |
12 |
|
! "rlon(i)", latitude "rlat(i)" and middle of layer "k". |
13 |
|
|
14 |
|
real, save:: c_Mob(klon, llm) |
15 |
! (sum of Mobidic terms in the net mass production rate of ozone |
! (sum of Mobidic terms in the net mass production rate of ozone |
16 |
! by chemistry, per unit mass of air, in s-1) |
! by chemistry, per unit mass of air, in s-1) |
|
! (On the "physics" grid. |
|
|
! Third dimension is the number of the month in the year. |
|
|
! "c_Mob(i, k, month)" is at longitude "rlon(i)", latitude "rlat(i)", |
|
|
! middle of layer "k".) |
|
17 |
|
|
18 |
real, save:: a2(klon, llm, 12) |
real, save:: a2(klon, llm) |
19 |
! (derivative of mass production rate of ozone per unit mass of |
! (derivative of mass production rate of ozone per unit mass of |
20 |
! air with respect to ozone mass fraction, in s-1) |
! air with respect to ozone mass fraction, in s-1) |
|
! (On the "physics" grid. |
|
|
! Third dimension is the number of the month in the year. |
|
|
! "a2(i, k, month)" is at longitude "rlon(i)", latitude "rlat(i)", |
|
|
! middle of layer "k".) |
|
21 |
|
|
22 |
real, save:: a4_mass(klon, llm, 12) |
real, save:: a4_mass(klon, llm) |
23 |
! (derivative of mass production rate of ozone per unit mass of |
! (derivative of mass production rate of ozone per unit mass of |
24 |
! air with respect to temperature, in s-1 K-1) |
! air with respect to temperature, in s-1 K-1) |
|
! (On the "physics" grid. |
|
|
! Third dimension is the number of the month in the year. |
|
|
! "a4_mass(i, k, month)" is at longitude "rlon(i)", latitude "rlat(i)", |
|
|
! middle of layer "k".) |
|
25 |
|
|
26 |
real, save:: a6_mass(klon, llm, 12) |
real, save:: a6_mass(klon, llm) |
27 |
! (derivative of mass production rate of ozone per unit mass of |
! (derivative of mass production rate of ozone per unit mass of |
28 |
! air with respect to mass column-density of ozone above, in m2 s-1 kg-1) |
! air with respect to mass column-density of ozone above, in m2 s-1 kg-1) |
|
! (On the "physics" grid. |
|
|
! Third dimension is the number of the month in the year. |
|
|
! "a6_mass(i, k, month)" is at longitude "rlon(i)", latitude "rlat(i)", |
|
|
! middle of layer "k".) |
|
29 |
|
|
30 |
real, save:: r_het_interm(klon, llm, 12) |
real, save:: r_het_interm(klon, llm) |
31 |
! (net mass production rate by heterogeneous chemistry, per unit |
! (net mass production rate by heterogeneous chemistry, per unit |
32 |
! mass of ozone, corrected for chlorine content and latitude, but |
! mass of ozone, corrected for chlorine content and latitude, but |
33 |
! not for temperature and sun direction, in s-1) |
! not for temperature and sun direction, in s-1) |
|
! (On the "physics" grid. |
|
|
! Third dimension is the number of the month in the year. |
|
|
! "r_het_interm(i, k, month)" is at longitude "rlon(i)", latitude "rlat(i)", |
|
|
! middle of layer "k".) |
|
34 |
|
|
35 |
private klon, llm |
private klon, llm |
36 |
|
|
37 |
contains |
contains |
38 |
|
|
39 |
subroutine read_coefoz |
subroutine regr_pr_comb_coefoz(julien) |
40 |
|
|
41 |
! This subroutine reads from a file all eight parameters for ozone |
! "regr_pr_comb_coefoz" stands for "regrid pressure combine |
42 |
! chemistry, at all months. |
! coefficients ozone". |
|
! The parameters are packed to the "physics" grid. |
|
|
! Finally, the eight parameters are combined to define the five |
|
|
! module variables. |
|
43 |
|
|
44 |
use netcdf95, only: nf95_open, nf95_close, nf90_nowrite |
! This subroutine : |
45 |
use o3_Mob_ph_m, only: o3_Mob_ph |
! -- reads from a file all eight coefficients for ozone chemistry, |
46 |
|
! at the current day ; |
47 |
|
! -- regrids the coefficients in pressure to the LMDZ vertical grid ; |
48 |
|
! -- packs the coefficients to the "physics" horizontal grid ; |
49 |
|
! -- combines the eight coefficients to define the five module variables. |
50 |
|
|
51 |
|
! We assume that, in "coefoz_LMDZ.nc", the pressure levels are in hPa |
52 |
|
! and strictly increasing. |
53 |
|
|
54 |
|
use netcdf95, only: nf95_open, nf95_close, nf95_get_coord |
55 |
|
use netcdf, only: nf90_nowrite |
56 |
|
use regr_pr_coefoz, only: regr_pr_av_coefoz, regr_pr_int_coefoz |
57 |
use phyetat0_m, only: rlat |
use phyetat0_m, only: rlat |
58 |
|
|
59 |
|
integer, intent(in):: julien ! jour julien, 1 <= julien <= 360 |
60 |
|
|
61 |
! Variables local to the procedure: |
! Variables local to the procedure: |
62 |
integer ncid ! for NetCDF |
integer ncid ! for NetCDF |
63 |
|
|
64 |
real a6(klon, llm, 12) |
real coefoz(klon, llm) |
65 |
! (derivative of P_net_Mob with respect to column-density of ozone |
! (temporary storage for an ozone coefficient) |
66 |
|
! (On the "physics" grid. |
67 |
|
! "coefoz(i, k)" is at longitude "rlon(i)", latitude "rlat(i)", |
68 |
|
! middle of layer "k".) |
69 |
|
|
70 |
|
real a6(klon, llm) |
71 |
|
! (derivative of "P_net_Mob" with respect to column-density of ozone |
72 |
! above, in cm2 s-1) |
! above, in cm2 s-1) |
73 |
! (On the "physics" grid. |
! (On the "physics" grid. |
74 |
! Third dimension is the number of the month in the year. |
! "a6(i, k)" is at longitude "rlon(i)", latitude "rlat(i)", |
|
! "a6(i, k, month)" is at longitude "rlon(i)", latitude "rlat(i)", |
|
75 |
! middle of layer "k".) |
! middle of layer "k".) |
76 |
|
|
77 |
real, parameter:: amu = 1.6605402e-27 ! atomic mass unit, in kg |
real, parameter:: amu = 1.6605402e-27 ! atomic mass unit, in kg |
79 |
real, parameter:: Clx = 3.8e-9 |
real, parameter:: Clx = 3.8e-9 |
80 |
! (total chlorine content in the upper stratosphere) |
! (total chlorine content in the upper stratosphere) |
81 |
|
|
82 |
integer k, month |
integer k |
83 |
|
|
84 |
!------------------------------------ |
!------------------------------------ |
85 |
|
|
86 |
print *, "Call sequence information: read_coefoz" |
print *, "Call sequence information: regr_pr_comb_coefoz" |
87 |
|
|
88 |
call nf95_open("coefoz_LMDZ.nc", nf90_nowrite, ncid) |
call nf95_open("coefoz_LMDZ.nc", nf90_nowrite, ncid) |
89 |
|
|
90 |
a2 = o3_Mob_ph(ncid, "a2") |
call regr_pr_av_coefoz(ncid, "a2", julien, a2) |
91 |
a4_mass = o3_Mob_ph(ncid, "a4") * 48. / 29. |
|
92 |
a6 = o3_Mob_ph(ncid, "a6") |
call regr_pr_av_coefoz(ncid, "a4", julien, a4_mass) |
93 |
|
a4_mass = a4_mass * 48. / 29. |
94 |
|
|
95 |
|
call regr_pr_av_coefoz(ncid, "a6", julien, a6) |
96 |
|
|
97 |
! Compute "a6_mass" avoiding underflow, do not divide by 1e4 |
! Compute "a6_mass" avoiding underflow, do not divide by 1e4 |
98 |
! before dividing by molecular mass: |
! before dividing by molecular mass: |
99 |
a6_mass = a6 / (1e4 * 29. * amu) |
a6_mass = a6 / (1e4 * 29. * amu) |
100 |
! (factor 1e4: conversion from cm2 to m2) |
! (factor 1e4: conversion from cm2 to m2) |
101 |
|
|
102 |
c_Mob = 48. / 29. * (o3_Mob_ph(ncid, "P_net_Mob") & |
! Combine coefficients to get "c_Mob": |
103 |
- a2 * o3_Mob_ph(ncid, "r_Mob") - a6 * o3_Mob_ph(ncid, "Sigma_Mob")) & |
! (We use as few local variables as possible, in order to spare |
104 |
- a4_mass * o3_Mob_ph(ncid, "temp_Mob") |
! main memory.) |
105 |
|
|
106 |
|
call regr_pr_av_coefoz(ncid, "P_net_Mob", julien, c_Mob) |
107 |
|
|
108 |
|
call regr_pr_av_coefoz(ncid, "r_Mob", julien, coefoz) |
109 |
|
c_mob = c_mob - a2 * coefoz |
110 |
|
|
111 |
|
call regr_pr_int_coefoz(ncid, "Sigma_Mob", julien, top_value=0., v3=coefoz) |
112 |
|
c_mob = (c_mob - a6 * coefoz) * 48. / 29. |
113 |
|
|
114 |
|
call regr_pr_av_coefoz(ncid, "temp_Mob", julien, coefoz) |
115 |
|
c_mob = c_mob - a4_mass * coefoz |
116 |
|
|
117 |
r_het_interm = o3_Mob_ph(ncid, "R_Het") * (Clx / 3.8e-9)**2 |
call regr_pr_av_coefoz(ncid, "R_Het", julien, r_het_interm) |
118 |
! Heterogeneous chemistry is only at high latitudes: |
! Heterogeneous chemistry is only at high latitudes: |
119 |
forall (k = 1: llm, month = 1: 12) |
forall (k = 1: llm) |
120 |
where (abs(rlat) <= 45.) r_het_interm(:, k, month) = 0. |
where (abs(rlat) <= 45.) r_het_interm(:, k) = 0. |
121 |
end forall |
end forall |
122 |
|
r_het_interm = r_het_interm * (Clx / 3.8e-9)**2 |
123 |
|
|
124 |
call nf95_close(ncid) |
call nf95_close(ncid) |
125 |
|
|
126 |
end subroutine read_coefoz |
end subroutine regr_pr_comb_coefoz |
127 |
|
|
128 |
end module read_coefoz_m |
end module regr_pr_comb_coefoz_m |