1 |
module regr_pr_comb_coefoz_m |
module regr_pr_comb_coefoz_m |
2 |
|
|
|
! This module is clean: no C preprocessor directive, no include line. |
|
|
|
|
3 |
use dimens_m, only: llm |
use dimens_m, only: llm |
4 |
use dimphy, only: klon |
use dimphy, only: klon |
5 |
|
|
6 |
implicit none |
implicit none |
7 |
|
|
8 |
|
! The five module variables declared here are on the "physics" grid. |
9 |
|
! The value of each variable for index "(i, k)" is at longitude |
10 |
|
! "rlon(i)", latitude "rlat(i)" and middle of layer "k". |
11 |
|
|
12 |
real, save:: c_Mob(klon, llm) |
real, save:: c_Mob(klon, llm) |
13 |
! (sum of Mobidic terms in the net mass production rate of ozone |
! (sum of Mobidic terms in the net mass production rate of ozone |
14 |
! by chemistry, per unit mass of air, in s-1) |
! by chemistry, per unit mass of air, in s-1) |
|
! (On the "physics" grid. |
|
|
! "c_Mob(i, k)" is at longitude "rlon(i)", latitude "rlat(i)", |
|
|
! middle of layer "k".) |
|
15 |
|
|
16 |
real, save:: a2(klon, llm) |
real, save:: a2(klon, llm) |
17 |
! (derivative of mass production rate of ozone per unit mass of |
! (derivative of mass production rate of ozone per unit mass of |
18 |
! air with respect to ozone mass fraction, in s-1) |
! air with respect to ozone mass fraction, in s-1) |
|
! (On the "physics" grid. |
|
|
! "a2(i, k)" is at longitude "rlon(i)", latitude "rlat(i)", |
|
|
! middle of layer "k".) |
|
19 |
|
|
20 |
real, save:: a4_mass(klon, llm) |
real, save:: a4_mass(klon, llm) |
21 |
! (derivative of mass production rate of ozone per unit mass of |
! (derivative of mass production rate of ozone per unit mass of |
22 |
! air with respect to temperature, in s-1 K-1) |
! air with respect to temperature, in s-1 K-1) |
|
! (On the "physics" grid. |
|
|
! "a4_mass(i, k)" is at longitude "rlon(i)", latitude "rlat(i)", |
|
|
! middle of layer "k".) |
|
23 |
|
|
24 |
real, save:: a6_mass(klon, llm) |
real, save:: a6_mass(klon, llm) |
25 |
! (derivative of mass production rate of ozone per unit mass of |
! (derivative of mass production rate of ozone per unit mass of |
26 |
! 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. |
|
|
! "a6_mass(i, k)" is at longitude "rlon(i)", latitude "rlat(i)", |
|
|
! middle of layer "k".) |
|
27 |
|
|
28 |
real, save:: r_het_interm(klon, llm) |
real, save:: r_het_interm(klon, llm) |
29 |
! (net mass production rate by heterogeneous chemistry, per unit |
! (net mass production rate by heterogeneous chemistry, per unit |
30 |
! mass of ozone, corrected for chlorine content and latitude, but |
! mass of ozone, corrected for chlorine content and latitude, but |
31 |
! not for temperature and sun direction, in s-1) |
! not for temperature and sun direction, in s-1) |
|
! (On the "physics" grid. |
|
|
! "r_het_interm(i, k)" is at longitude "rlon(i)", latitude "rlat(i)", |
|
|
! middle of layer "k".) |
|
32 |
|
|
33 |
private klon, llm |
private klon, llm |
34 |
|
|
35 |
contains |
contains |
36 |
|
|
37 |
subroutine regr_pr_comb_coefoz(julien) |
subroutine regr_pr_comb_coefoz(julien, paprs, pplay) |
38 |
|
|
39 |
! "regr_pr_comb_coefoz" stands for "regrid pressure combine |
! "regr_pr_comb_coefoz" stands for "regrid pressure combine |
40 |
! coefficients ozone". |
! coefficients ozone". |
41 |
|
|
42 |
! This subroutine : |
! This subroutine : |
43 |
! -- reads from a file all eight parameters for ozone chemistry, |
! -- reads from a file all eight coefficients for ozone chemistry, |
44 |
! at the current day ; |
! at the current day ; |
45 |
! -- regrids the parameters in pressure to the LMDZ vertical grid ; |
! -- regrids the coefficients in pressure to the LMDZ vertical grid ; |
46 |
! -- packs the parameters to the "physics" horizontal grid ; |
! -- packs the coefficients to the "physics" horizontal grid ; |
47 |
! -- combines the eight parameters to define the five module variables. |
! -- combines the eight coefficients to define the five module variables. |
48 |
|
|
|
! We assume that, in "coefoz_LMDZ.nc", the pressure levels are in hPa |
|
|
! and strictly increasing. |
|
|
|
|
|
use netcdf95, only: nf95_open, nf95_close, nf95_get_coord |
|
49 |
use netcdf, only: nf90_nowrite |
use netcdf, only: nf90_nowrite |
50 |
use regr_pr_coefoz, only: regr_pr_av_coefoz, regr_pr_int_coefoz |
use netcdf95, only: nf95_open, nf95_close |
51 |
use phyetat0_m, only: rlat |
use phyetat0_m, only: rlat |
52 |
|
use regr_pr_av_m, only: regr_pr_av |
53 |
|
use regr_pr_int_m, only: regr_pr_int |
54 |
|
|
55 |
integer, intent(in):: julien ! jour julien, 1 <= julien <= 360 |
integer, intent(in):: julien ! jour julien, 1 <= julien <= 360 |
56 |
|
|
57 |
|
real, intent(in):: paprs(:, :) ! (klon, llm + 1) |
58 |
|
! (pression pour chaque inter-couche, en Pa) |
59 |
|
|
60 |
|
real, intent(in):: pplay(:, :) ! (klon, llm) |
61 |
|
! (pression pour le mileu de chaque couche, en Pa) |
62 |
|
|
63 |
! Variables local to the procedure: |
! Variables local to the procedure: |
|
integer ncid ! for NetCDF |
|
64 |
|
|
65 |
real, pointer:: plev(:) |
integer ncid ! for NetCDF |
|
! (pressure level of input data, converted to Pa, in strictly |
|
|
! increasing order) |
|
|
|
|
|
integer n_plev ! number of pressure levels in the input data |
|
|
|
|
|
real, allocatable:: press_in_edg(:) |
|
|
! (edges of pressure intervals for input data, in Pa, in strictly |
|
|
! increasing order) |
|
66 |
|
|
67 |
real coefoz(klon, llm) |
real coefoz(klon, llm) |
68 |
! (temporary storage for an ozone coefficient) |
! (temporary storage for an ozone coefficient) |
86 |
|
|
87 |
!------------------------------------ |
!------------------------------------ |
88 |
|
|
89 |
print *, "Call sequence information: read_coefoz" |
print *, "Call sequence information: regr_pr_comb_coefoz" |
90 |
|
|
91 |
call nf95_open("coefoz_LMDZ.nc", nf90_nowrite, ncid) |
call nf95_open("coefoz_LMDZ.nc", nf90_nowrite, ncid) |
92 |
|
|
93 |
call nf95_get_coord(ncid, "plev", plev) |
call regr_pr_av(ncid, "a2", julien, paprs, a2) |
|
! Convert from hPa to Pa because "regr_pr_av" and "regr_pr_int" require so: |
|
|
plev = plev * 100. |
|
|
n_plev = size(plev) |
|
|
|
|
|
! Compute edges of pressure intervals: |
|
|
allocate(press_in_edg(n_plev + 1)) |
|
|
press_in_edg(1) = 0. |
|
|
! We choose edges halfway in logarithm: |
|
|
forall (k = 2:n_plev) press_in_edg(k) = sqrt(plev(k - 1) * plev(k)) |
|
|
press_in_edg(n_plev + 1) = huge(0.) |
|
|
! (infinity, but any value guaranteed to be greater than the |
|
|
! surface pressure would do) |
|
|
|
|
|
call regr_pr_av_coefoz(ncid, "a2", julien, press_in_edg, a2) |
|
94 |
|
|
95 |
call regr_pr_av_coefoz(ncid, "a4", julien, press_in_edg, a4_mass) |
call regr_pr_av(ncid, "a4", julien, paprs, a4_mass) |
96 |
a4_mass = a4_mass * 48. / 29. |
a4_mass = a4_mass * 48. / 29. |
97 |
|
|
98 |
call regr_pr_av_coefoz(ncid, "a6", julien, press_in_edg, a6) |
call regr_pr_av(ncid, "a6", julien, paprs, a6) |
99 |
|
|
100 |
! Compute "a6_mass" avoiding underflow, do not divide by 1e4 |
! Compute "a6_mass" avoiding underflow, do not divide by 1e4 |
101 |
! before dividing by molecular mass: |
! before dividing by molecular mass: |
106 |
! (We use as few local variables as possible, in order to spare |
! (We use as few local variables as possible, in order to spare |
107 |
! main memory.) |
! main memory.) |
108 |
|
|
109 |
call regr_pr_av_coefoz(ncid, "P_net_Mob", julien, press_in_edg, c_Mob) |
call regr_pr_av(ncid, "P_net_Mob", julien, paprs, c_Mob) |
110 |
|
|
111 |
call regr_pr_av_coefoz(ncid, "r_Mob", julien, press_in_edg, coefoz) |
call regr_pr_av(ncid, "r_Mob", julien, paprs, coefoz) |
112 |
c_mob = c_mob - a2 * coeofoz |
c_mob = c_mob - a2 * coefoz |
113 |
|
|
114 |
call regr_pr_int_coefoz(ncid, "Sigma_Mob", julien, plev, top_value=0., & |
call regr_pr_int(ncid, "Sigma_Mob", julien, pplay, top_value=0., v3=coefoz) |
|
coefoz) |
|
115 |
c_mob = (c_mob - a6 * coefoz) * 48. / 29. |
c_mob = (c_mob - a6 * coefoz) * 48. / 29. |
116 |
|
|
117 |
call regr_pr_av_coefoz(ncid, "temp_Mob", julien, press_in_edg, coefoz) |
call regr_pr_av(ncid, "temp_Mob", julien, paprs, coefoz) |
118 |
c_mob = c_mob - a4_mass * coefoz |
c_mob = c_mob - a4_mass * coefoz |
119 |
|
|
120 |
call regr_pr_av_coefoz(ncid, "R_Het", julien, press_in_edg, r_het_interm) |
call regr_pr_av(ncid, "R_Het", julien, paprs, r_het_interm) |
121 |
! Heterogeneous chemistry is only at high latitudes: |
! Heterogeneous chemistry is only at high latitudes: |
122 |
forall (k = 1: llm) |
forall (k = 1: llm) |
123 |
where (abs(rlat) <= 45.) r_het_interm(:, k) = 0. |
where (abs(rlat) <= 45.) r_het_interm(:, k) = 0. |
124 |
end forall |
end forall |
125 |
where (r_het_interm /= 0.) r_het_interm = r_het_interm * (Clx / 3.8e-9)**2 |
r_het_interm = r_het_interm * (Clx / 3.8e-9)**2 |
126 |
|
|
|
deallocate(plev) ! pointer |
|
127 |
call nf95_close(ncid) |
call nf95_close(ncid) |
128 |
|
|
129 |
end subroutine regr_pr_comb_coefoz |
end subroutine regr_pr_comb_coefoz |