--- trunk/libf/phylmd/o3_chem_m.f90 2008/02/27 13:16:39 3 +++ trunk/libf/phylmd/Mobidic/o3_chem.f90 2011/09/23 12:28:01 52 @@ -1,7 +1,5 @@ module o3_chem_m - ! This module is clean: no C preprocessor directive, no include line. - IMPLICIT none private o3_prod @@ -13,52 +11,45 @@ ! This procedure evolves the ozone mass fraction through a time ! step taking only chemistry into account. - use nrutil, only: assert + ! All the 2-dimensional arrays are on the "physics" grid. + ! Their shape is "(/klon, llm/)". + ! Index "(i, :)" is for longitude "rlon(i)", latitude "rlat(i)". + + use nr_util, only: assert, pi use dimphy, only: klon use dimens_m, only: llm - 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 use orbite_m, only: orbite, zenang - use nrtype, only: pi integer, intent(in):: julien ! jour julien, 1 <= julien <= 360 real, intent(in):: gmtime ! heure de la journée en fraction de jour - real, intent(in):: t_seri(:, :) ! temperature, in K + real, intent(in):: t_seri(:, :) ! (klon, llm) temperature, in K - real, intent(in):: zmasse(:, :) + real, intent(in):: zmasse(:, :) ! (klon, llm) ! (column-density of mass of air in a cell, in kg m-2) - ! (On the "physics" grid. - ! "zmasse(i, k)" is at longitude "rlon(i)", latitude "rlat(i)", for - ! layer "k".) + ! "zmasse(:, k)" is for layer "k".) real, intent(in):: pdtphys ! time step for physics, in s - real, intent(inout):: q(:, :) ! mass fraction of ozone - ! (On the "physics" grid. - ! "q(i, k)" is at longitude "rlon(i)", latitude "rlat(i)", middle of - ! layer "k".) + real, intent(inout):: q(:, :) ! (klon, llm) mass fraction of ozone + ! "q(:, k)" is at middle of layer "k".) ! Variables local to the procedure: - integer month, k + integer k real c(klon, llm) ! (constant term during a time step in the net mass production ! rate of ozone by chemistry, per unit mass of air, in s-1) - ! (On the "physics" grid. - ! "c(i, k)" is at longitude "rlon(i)", latitude "rlat(i)", middle of - ! layer "k".) + ! "c(:, k)" is at middle of layer "k".) real b(klon, llm) ! (coefficient of "q" in the net mass production ! rate of ozone by chemistry, per unit mass of air, in s-1) - ! (On the "physics" grid. - ! "b(i, k)" is at longitude "rlon(i)", latitude "rlat(i)", middle of - ! layer "k".) + ! "b(:, k)" is at middle of layer "k".) real dq_o3_chem(klon, llm) ! (variation of ozone mass fraction due to chemistry during a time step) - ! (On the "physics" grid. - ! "dq_o3_chem(i, k)" is at longitude "rlon(i)", latitude - ! "rlat(i)", middle of layer "k".) + ! "dq_o3_chem(:, k)" is at middle of layer "k".) real earth_long ! (longitude vraie de la Terre dans son orbite solaire, par @@ -73,14 +64,13 @@ call assert(llm == (/size(q, 2), size(t_seri, 2), size(zmasse, 2)/), & "o3_chem llm") - month = (julien - 1) / 30 + 1 ! compute the month from the day number - c = c_Mob(:, :, month) + a4_mass(:, :, month) * t_seri + c = c_Mob + a4_mass * t_seri ! Compute coefficient "b": ! Heterogeneous chemistry is only at low temperature: where (t_seri < 195.) - b = r_het_interm(:, :, month) + b = r_het_interm elsewhere b = 0. end where @@ -92,14 +82,14 @@ where (pmu0 <= cos(87. / 180. * pi)) b(:, k) = 0. end forall - b = b + a2(:, :, month) + b = b + a2 ! Midpoint method: ! Trial step to the midpoint: - dq_o3_chem = o3_prod(q, month, zmasse, c, b) * pdtphys / 2 + dq_o3_chem = o3_prod(q, zmasse, c, b) * pdtphys / 2 ! "Real" step across the whole interval: - 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 q = q + dq_o3_chem ! Confine the mass fraction: @@ -109,56 +99,46 @@ !************************************************* - function o3_prod(q, month, zmasse, c, b) + function o3_prod(q, zmasse, c, b) ! This function computes the production rate of ozone by chemistry. - use read_coefoz_m, only: a6_mass - use nrutil, only: assert + ! All the 2-dimensional arrays are on the "physics" grid. + ! Their shape is "(/klon, llm/)". + ! Index "(i, :)" is for longitude "rlon(i)", latitude "rlat(i)". + + use regr_pr_comb_coefoz_m, only: a6_mass + use nr_util, only: assert use dimens_m, only: llm use dimphy, only: klon real, intent(in):: q(:, :) ! mass fraction of ozone - ! (On the "physics" grid. - ! "q(i, k)" is at longitude "rlon(i)", latitude "rlat(i)", middle of - ! layer "k".) - - integer, intent(in):: month + ! "q(:, k)" is at middle of layer "k".) real, intent(in):: zmasse(:, :) ! (column-density of mass of air in a layer, in kg m-2) - ! (On the "physics" grid. - ! "zmasse(i, k)" is at longitude "rlon(i)", latitude "rlat(i)", middle of - ! layer "k".) + ! ("zmasse(:, k)" is for layer "k".) real, intent(in):: c(:, :) ! (constant term during a time step in the net mass production ! rate of ozone by chemistry, per unit mass of air, in s-1) - ! (On the "physics" grid. - ! "c(i, k)" is at longitude "rlon(i)", latitude "rlat(i)", middle of - ! layer "k".) + ! "c(:, k)" is at middle of layer "k".) real, intent(in):: b(:, :) - ! (coefficient of "q" in the net mass production - ! rate of ozone by chemistry, per unit mass of air, in s-1) - ! (On the "physics" grid. - ! "b(i, k)" is at longitude "rlon(i)", latitude "rlat(i)", middle of - ! layer "k".) + ! (coefficient of "q" in the net mass production rate of ozone by + ! chemistry, per unit mass of air, in s-1) + ! ("b(:, k)" is at middle of layer "k".) real o3_prod(klon, llm) ! (net mass production rate of ozone by chemistry, per unit mass ! of air, in s-1) - ! (On the "physics" grid. - ! "o3_prod(i, k)" is at longitude "rlon(i)", latitude "rlat(i)", middle of - ! layer "k".) + ! ("o3_prod(:, k)" is at middle of layer "k".) ! Variables local to the procedure: real sigma_mass(klon, llm) ! (mass column-density of ozone above point, in kg m-2) - ! (On the "physics" grid. - ! "sigma_mass(i, k)" is at longitude "rlon(i)", latitude - ! "rlat(i)", middle of layer "k".) + ! ("sigma_mass(:, k)" is at middle of layer "k".) integer k @@ -177,7 +157,7 @@ sigma_mass(:, k) = sigma_mass(:, k+1) + zmasse(:, k) * q(:, k) end do - o3_prod = c + b * q + a6_mass(:, :, month) * sigma_mass + o3_prod = c + b * q + a6_mass * sigma_mass end function o3_prod