/[lmdze]/trunk/Sources/phylmd/Mobidic/o3_chem.f
ViewVC logotype

Diff of /trunk/Sources/phylmd/Mobidic/o3_chem.f

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

trunk/libf/phylmd/o3_chem_m.f90 revision 3 by guez, Wed Feb 27 13:16:39 2008 UTC trunk/Sources/phylmd/Mobidic/o3_chem.f revision 134 by guez, Wed Apr 29 15:47:56 2015 UTC
# Line 1  Line 1 
1  module o3_chem_m  module o3_chem_m
2    
   ! This module is clean: no C preprocessor directive, no include line.  
   
3    IMPLICIT none    IMPLICIT none
4    
5    private o3_prod    private o3_prod
# Line 13  contains Line 11  contains
11      ! This procedure evolves the ozone mass fraction through a time      ! This procedure evolves the ozone mass fraction through a time
12      ! step taking only chemistry into account.      ! step taking only chemistry into account.
13    
14      use nrutil, only: assert      ! All the 2-dimensional arrays are on the "physics" grid.
15        ! Their shape is "(/klon, llm/)".
16        ! Index "(i, :)" is for longitude "rlon(i)", latitude "rlat(i)".
17    
18        use nr_util, only: assert, pi
19      use dimphy, only: klon      use dimphy, only: klon
20      use dimens_m, only: llm      use dimens_m, only: llm
21      use read_coefoz_m, only: c_Mob, a4_mass, a2, r_het_interm      use regr_pr_comb_coefoz_m, only: c_Mob, a4_mass, a2, r_het_interm
22      use orbite_m, only: orbite, zenang      use orbite_m, only: orbite
23      use nrtype, only: pi      use zenang_m, only: zenang
24    
25      integer, intent(in):: julien ! jour julien, 1 <= julien <= 360      integer, intent(in):: julien ! jour julien, 1 <= julien <= 360
26      real, intent(in):: gmtime ! heure de la journée en fraction de jour      real, intent(in):: gmtime ! heure de la journée en fraction de jour
27      real, intent(in):: t_seri(:, :) ! temperature,  in K      real, intent(in):: t_seri(:, :) ! (klon, llm) temperature, in K
28    
29      real, intent(in):: zmasse(:, :)      real, intent(in):: zmasse(:, :) ! (klon, llm)
30      ! (column-density of mass of air in a cell, in kg m-2)      ! (column-density of mass of air in a cell, in kg m-2)
31      ! (On the "physics" grid.      ! "zmasse(:, k)" is for layer "k".)
     ! "zmasse(i, k)" is at longitude "rlon(i)", latitude "rlat(i)", for  
     ! layer "k".)  
32    
33      real, intent(in):: pdtphys ! time step for physics, in s      real, intent(in):: pdtphys ! time step for physics, in s
34    
35      real, intent(inout):: q(:, :) ! mass fraction of ozone      real, intent(inout):: q(:, :) ! (klon, llm) mass fraction of ozone
36      ! (On the "physics" grid.      ! "q(:, k)" is at middle of layer "k".)
     ! "q(i, k)" is at longitude "rlon(i)", latitude "rlat(i)", middle of  
     ! layer "k".)  
37    
38      ! Variables local to the procedure:      ! Variables local to the procedure:
39      integer month, k      integer k
40    
41      real c(klon, llm)      real c(klon, llm)
42      ! (constant term during a time step in the net mass production      ! (constant term during a time step in the net mass production
43      ! rate of ozone by chemistry, per unit mass of air, in s-1)      ! rate of ozone by chemistry, per unit mass of air, in s-1)
44      ! (On the "physics" grid.      ! "c(:, k)" is at middle of layer "k".)
     ! "c(i, k)" is at longitude "rlon(i)", latitude "rlat(i)", middle of  
     ! layer "k".)  
45    
46      real b(klon, llm)      real b(klon, llm)
47      ! (coefficient of "q" in the net mass production      ! (coefficient of "q" in the net mass production
48      ! rate of ozone by chemistry, per unit mass of air, in s-1)      ! rate of ozone by chemistry, per unit mass of air, in s-1)
49      ! (On the "physics" grid.      ! "b(:, k)" is at middle of layer "k".)
     ! "b(i, k)" is at longitude "rlon(i)", latitude "rlat(i)", middle of  
     ! layer "k".)  
50    
51      real dq_o3_chem(klon, llm)      real dq_o3_chem(klon, llm)
52      ! (variation of ozone mass fraction due to chemistry during a time step)      ! (variation of ozone mass fraction due to chemistry during a time step)
53      ! (On the "physics" grid.      ! "dq_o3_chem(:, k)" is at middle of layer "k".)
     ! "dq_o3_chem(i, k)" is at longitude "rlon(i)", latitude  
     ! "rlat(i)", middle of layer "k".)  
54    
55      real earth_long      real earth_long
56      ! (longitude vraie de la Terre dans son orbite solaire, par      ! (longitude vraie de la Terre dans son orbite solaire, par
# Line 73  contains Line 65  contains
65      call assert(llm == (/size(q, 2), size(t_seri, 2), size(zmasse, 2)/), &      call assert(llm == (/size(q, 2), size(t_seri, 2), size(zmasse, 2)/), &
66           "o3_chem llm")           "o3_chem llm")
67    
68      month = (julien - 1) / 30 + 1 ! compute the month from the day number      c = c_Mob + a4_mass * t_seri
     c = c_Mob(:, :, month) + a4_mass(:, :, month) * t_seri  
69    
70      ! Compute coefficient "b":      ! Compute coefficient "b":
71    
72      ! Heterogeneous chemistry is only at low temperature:      ! Heterogeneous chemistry is only at low temperature:
73      where (t_seri < 195.)      where (t_seri < 195.)
74         b = r_het_interm(:, :, month)         b = r_het_interm
75      elsewhere      elsewhere
76         b = 0.         b = 0.
77      end where      end where
# Line 92  contains Line 83  contains
83         where (pmu0 <= cos(87. / 180. * pi)) b(:, k) = 0.         where (pmu0 <= cos(87. / 180. * pi)) b(:, k) = 0.
84      end forall      end forall
85    
86      b = b + a2(:, :, month)      b = b + a2
87    
88      ! Midpoint method:      ! Midpoint method:
89    
90      ! Trial step to the midpoint:      ! Trial step to the midpoint:
91      dq_o3_chem = o3_prod(q, month, zmasse, c, b) * pdtphys  / 2      dq_o3_chem = o3_prod(q, zmasse, c, b) * pdtphys  / 2
92      ! "Real" step across the whole interval:      ! "Real" step across the whole interval:
93      dq_o3_chem = o3_prod(q + dq_o3_chem, month, zmasse, c, b) * pdtphys      dq_o3_chem = o3_prod(q + dq_o3_chem, zmasse, c, b) * pdtphys
94      q = q + dq_o3_chem      q = q + dq_o3_chem
95    
96      ! Confine the mass fraction:      ! Confine the mass fraction:
# Line 109  contains Line 100  contains
100    
101    !*************************************************    !*************************************************
102    
103    function o3_prod(q, month, zmasse, c, b)    function o3_prod(q, zmasse, c, b)
104    
105      ! This function computes the production rate of ozone by chemistry.      ! This function computes the production rate of ozone by chemistry.
106    
107      use read_coefoz_m, only: a6_mass      ! All the 2-dimensional arrays are on the "physics" grid.
108      use nrutil, only: assert      ! Their shape is "(/klon, llm/)".
109        ! Index "(i, :)" is for longitude "rlon(i)", latitude "rlat(i)".
110    
111        use regr_pr_comb_coefoz_m, only: a6_mass
112        use nr_util, only: assert
113      use dimens_m, only: llm      use dimens_m, only: llm
114      use dimphy, only: klon      use dimphy, only: klon
115    
116      real, intent(in):: q(:, :) ! mass fraction of ozone      real, intent(in):: q(:, :) ! mass fraction of ozone
117      ! (On the "physics" grid.      ! "q(:, k)" is at middle of layer "k".)
     ! "q(i, k)" is at longitude "rlon(i)", latitude "rlat(i)", middle of  
     ! layer "k".)  
   
     integer, intent(in):: month  
118    
119      real, intent(in):: zmasse(:, :)      real, intent(in):: zmasse(:, :)
120      ! (column-density of mass of air in a layer, in kg m-2)      ! (column-density of mass of air in a layer, in kg m-2)
121      ! (On the "physics" grid.      ! ("zmasse(:, k)" is for layer "k".)
     ! "zmasse(i, k)" is at longitude "rlon(i)", latitude "rlat(i)", middle of  
     ! layer "k".)  
122    
123      real, intent(in):: c(:, :)      real, intent(in):: c(:, :)
124      ! (constant term during a time step in the net mass production      ! (constant term during a time step in the net mass production
125      ! rate of ozone by chemistry, per unit mass of air, in s-1)      ! rate of ozone by chemistry, per unit mass of air, in s-1)
126      ! (On the "physics" grid.      ! "c(:, k)" is at middle of layer "k".)
     ! "c(i, k)" is at longitude "rlon(i)", latitude "rlat(i)", middle of  
     ! layer "k".)  
127    
128      real, intent(in):: b(:, :)      real, intent(in):: b(:, :)
129      ! (coefficient of "q" in the net mass production      ! (coefficient of "q" in the net mass production rate of ozone by
130      ! rate of ozone by chemistry, per unit mass of air, in s-1)      ! chemistry, per unit mass of air, in s-1)
131      ! (On the "physics" grid.      ! ("b(:, k)" is at middle of layer "k".)
     ! "b(i, k)" is at longitude "rlon(i)", latitude "rlat(i)", middle of  
     ! layer "k".)  
132    
133      real o3_prod(klon, llm)      real o3_prod(klon, llm)
134      ! (net mass production rate of ozone by chemistry, per unit mass      ! (net mass production rate of ozone by chemistry, per unit mass
135      ! of air, in s-1)      ! of air, in s-1)
136      ! (On the "physics" grid.      ! ("o3_prod(:, k)" is at middle of layer "k".)
     ! "o3_prod(i, k)" is at longitude "rlon(i)", latitude "rlat(i)", middle of  
     ! layer "k".)  
137    
138      ! Variables local to the procedure:      ! Variables local to the procedure:
139    
140      real sigma_mass(klon, llm)      real sigma_mass(klon, llm)
141      ! (mass column-density of ozone above point, in kg m-2)      ! (mass column-density of ozone above point, in kg m-2)
142      ! (On the "physics" grid.      ! ("sigma_mass(:, k)" is at middle of layer "k".)
     ! "sigma_mass(i, k)" is at longitude "rlon(i)", latitude  
     ! "rlat(i)", middle of layer "k".)  
143    
144      integer k      integer k
145    
# Line 177  contains Line 158  contains
158         sigma_mass(:, k) = sigma_mass(:, k+1) + zmasse(:, k) * q(:, k)         sigma_mass(:, k) = sigma_mass(:, k+1) + zmasse(:, k) * q(:, k)
159      end do      end do
160    
161      o3_prod = c + b * q + a6_mass(:, :, month) * sigma_mass      o3_prod = c + b * q + a6_mass * sigma_mass
162    
163    end function o3_prod    end function o3_prod
164    

Legend:
Removed from v.3  
changed lines
  Added in v.134

  ViewVC Help
Powered by ViewVC 1.1.21