/[lmdze]/trunk/phylmd/Mobidic/regr_pr_comb_coefoz.f
ViewVC logotype

Diff of /trunk/phylmd/Mobidic/regr_pr_comb_coefoz.f

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

trunk/libf/phylmd/Mobidic/regr_pr_comb_coefoz.f90 revision 11 by guez, Thu Jun 5 12:43:08 2008 UTC trunk/phylmd/Mobidic/regr_pr_comb_coefoz.f90 revision 76 by guez, Fri Nov 15 18:45:49 2013 UTC
# Line 1  Line 1 
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    
# Line 48  contains Line 46  contains
46      ! -- packs the coefficients to the "physics" horizontal grid ;      ! -- packs the coefficients to the "physics" horizontal grid ;
47      ! -- combines the eight coefficients to define the five module variables.      ! -- combines the eight coefficients to define the five module variables.
48    
49      ! We assume that, in "coefoz_LMDZ.nc", the pressure levels are in hPa      use netcdf95, only: nf95_open, nf95_close
     ! and strictly increasing.  
   
     use netcdf95, only: nf95_open, nf95_close, nf95_get_coord  
50      use netcdf, only: nf90_nowrite      use netcdf, only: nf90_nowrite
51      use regr_pr_coefoz, only: regr_pr_av_coefoz, regr_pr_int_coefoz      use regr_pr_coefoz, only: regr_pr_av_coefoz, regr_pr_int_coefoz
52      use phyetat0_m, only: rlat      use phyetat0_m, only: rlat
# Line 59  contains Line 54  contains
54      integer, intent(in):: julien ! jour julien, 1 <= julien <= 360      integer, intent(in):: julien ! jour julien, 1 <= julien <= 360
55    
56      ! Variables local to the procedure:      ! Variables local to the procedure:
     integer ncid ! for NetCDF  
57    
58      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)  
59    
60      real coefoz(klon, llm)      real coefoz(klon, llm)
61      ! (temporary storage for an ozone coefficient)      ! (temporary storage for an ozone coefficient)
# Line 97  contains Line 83  contains
83    
84      call nf95_open("coefoz_LMDZ.nc", nf90_nowrite, ncid)      call nf95_open("coefoz_LMDZ.nc", nf90_nowrite, ncid)
85    
86      call nf95_get_coord(ncid, "plev", plev)      call regr_pr_av_coefoz(ncid, "a2", julien, 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)  
87    
88      call regr_pr_av_coefoz(ncid, "a4", julien, press_in_edg, a4_mass)      call regr_pr_av_coefoz(ncid, "a4", julien, a4_mass)
89      a4_mass = a4_mass * 48. / 29.      a4_mass = a4_mass * 48. / 29.
90    
91      call regr_pr_av_coefoz(ncid, "a6", julien, press_in_edg, a6)      call regr_pr_av_coefoz(ncid, "a6", julien, a6)
92    
93      ! Compute "a6_mass" avoiding underflow, do not divide by 1e4      ! Compute "a6_mass" avoiding underflow, do not divide by 1e4
94      ! before dividing by molecular mass:      ! before dividing by molecular mass:
# Line 127  contains Line 99  contains
99      ! (We use as few local variables as possible, in order to spare      ! (We use as few local variables as possible, in order to spare
100      ! main memory.)      ! main memory.)
101    
102      call regr_pr_av_coefoz(ncid, "P_net_Mob", julien, press_in_edg, c_Mob)      call regr_pr_av_coefoz(ncid, "P_net_Mob", julien, c_Mob)
103    
104      call regr_pr_av_coefoz(ncid, "r_Mob", julien, press_in_edg, coefoz)      call regr_pr_av_coefoz(ncid, "r_Mob", julien, coefoz)
105      c_mob = c_mob - a2 * coefoz      c_mob = c_mob - a2 * coefoz
106    
107      call regr_pr_int_coefoz(ncid, "Sigma_Mob", julien, plev, top_value=0., &      call regr_pr_int_coefoz(ncid, "Sigma_Mob", julien, top_value=0., v3=coefoz)
          v3=coefoz)  
108      c_mob = (c_mob - a6 * coefoz) * 48. / 29.      c_mob = (c_mob - a6 * coefoz) * 48. / 29.
109    
110      call regr_pr_av_coefoz(ncid, "temp_Mob", julien, press_in_edg, coefoz)      call regr_pr_av_coefoz(ncid, "temp_Mob", julien, coefoz)
111      c_mob = c_mob - a4_mass * coefoz      c_mob = c_mob - a4_mass * coefoz
112    
113      call regr_pr_av_coefoz(ncid, "R_Het", julien, press_in_edg, r_het_interm)      call regr_pr_av_coefoz(ncid, "R_Het", julien, r_het_interm)
114      ! Heterogeneous chemistry is only at high latitudes:      ! Heterogeneous chemistry is only at high latitudes:
115      forall (k = 1: llm)      forall (k = 1: llm)
116         where (abs(rlat) <= 45.) r_het_interm(:, k) = 0.         where (abs(rlat) <= 45.) r_het_interm(:, k) = 0.
117      end forall      end forall
118      r_het_interm = r_het_interm * (Clx / 3.8e-9)**2      r_het_interm = r_het_interm * (Clx / 3.8e-9)**2
119    
     deallocate(plev) ! pointer  
120      call nf95_close(ncid)      call nf95_close(ncid)
121    
122    end subroutine regr_pr_comb_coefoz    end subroutine regr_pr_comb_coefoz

Legend:
Removed from v.11  
changed lines
  Added in v.76

  ViewVC Help
Powered by ViewVC 1.1.21