Original WRF subgrid support version from John Michalakes without fire
[wrffire.git] / wrfv2_fire / chem / module_data_mosaic_asect.F
blob504496568830be830ae0093144b31cdd26c43624
1 !**********************************************************************************  
2 ! This computer software was prepared by Battelle Memorial Institute, hereinafter
3 ! the Contractor, under Contract No. DE-AC05-76RL0 1830 with the Department of 
4 ! Energy (DOE). NEITHER THE GOVERNMENT NOR THE CONTRACTOR MAKES ANY WARRANTY,
5 ! EXPRESS OR IMPLIED, OR ASSUMES ANY LIABILITY FOR THE USE OF THIS SOFTWARE.
7 ! MOSAIC module: see module_mosaic_driver.F for information and terms of use
8 !**********************************************************************************  
9         module module_data_mosaic_asect
12         implicit none
15 !-----------------------------------------------------------------------
17 !   The variables in this module provide a means of organizing and accessing
18 !   aerosol species in the "chem" array by their chemical component, 
19 !   size bin (or mode), "type", and "phase"
21 !   Their purpose is to allow flexible coding of process modules, 
22 !   compared to "hard-coding" using the chem array p_xxx indices
23 !   (e.g., p_so4_a01, p_so4_a02, ...; p_num_a01, ...)
25 !-----------------------------------------------------------------------
27 !   rce & sg 2004-dec-03 - added phase and type capability,
28 !       which changed this module almost completely
30 !-----------------------------------------------------------------------
32 !   maxd_atype = maximum allowable number of aerosol types
33 !   maxd_asize = maximum allowable number of aerosol size bins
34 !   maxd_acomp = maximum allowable number of chemical components
35 !       in each aerosol size bin
36 !   maxd_aphase = maximum allowable number of aerosol phases 
37 !       (gas, cloud, ice, rain, ...)
39 !   ntype_aer = number of aerosol types
40 !       The aerosol type will allow treatment of an externally mixed 
41 !       aerosol.  The current MOSAIC code has only 1 type, with the implicit
42 !       assumption of internal mixing.  Eventually, multiple types 
43 !       could treat fresh primary BC/OC, fresh SO4 from nucleation, 
44 !       aged BC/OC/SO4/... mixture, soil dust, sea salt, ... 
46 !   nphase_aer = number of aerosol phases
48 !   ai_phase = phase (p) index for interstitial (unactivated) aerosol particles
49 !   cw_phase = phase (p) index for aerosol particles in cloud water
50 !   ci_phase = phase (p) index for aerosol particles in cloud ice
51 !   rn_phase = phase (p) index for aerosol particles in rain
52 !   sn_phase = phase (p) index for aerosol particles in snow
53 !   gr_phase = phase (p) index for aerosol particles in graupel
54 !   [Note:  the value of "xx_phase" will be between 1 and nphase_aer 
55 !       for phases that are active in a simulation.  The others
56 !       will have non-positive values.]
58 !   nsize_aer(t) = number of aerosol size bins for aerosol type t
60 !   ncomp_aer(t) = number of "regular" chemical components for aerosol type t
61 !   ncomp_plustracer_aer(t) = number of "regular" plus "tracer"
62 !       chemical components for aerosol type t
63 !   [Note:  only "regular" components are used for calculating
64 !       aerosol physical (mass, volume) and chemical properties.
65 !       "Tracer" components are optional, and can be used to track source 
66 !       regions, source mechanisms, etc.]
67 !   [Note:  for aerosol type t, all phases have the same number of size
68 !       bins, and all size bins have the same number of 
69 !       both regular and tracer components.]
71 !   ntot_mastercomp_aer = number of aerosol chemical components defined
72 !       in the "master component list".
73 !   [Note:  each aerosol type will use some but not necessarily all
74 !       of the components in the "master component list".]
76 !   mastercompptr_aer(c,t) = the position/index/i.d. in the 
77 !       "master component list" for chemical component c of aerosol type t.
78 !       (1=sulfate, others to be defined by user.)
80 !   massptr_aer(c,s,t,p) = the position/index in the chem array for mixing- 
81 !       ratio for chemical component c, size bin s, type t, and phase p.
83 !   lptr_so4_aer(s,t,p) = the position/index in the chem array for mixing-
84 !       ratio for sulfate for aerosol size bin s, type t, and phase p
85 !   (similar lptr's are defined for no3, cl, msa, co3, 
86 !       nh4, na, ca, oin, oc, bc, ...)
87 !   [Note:  the massptr_aer allow you to loop over all species of 
88 !       an aerosol type.  The lptr_so4_aer, etc., allow you to access
89 !       a specific chemical component.]
91 !   waterptr_aer(s,t) = the position/index in the chem array for mixing-
92 !       ratio of aerosol water content for size bin s, type t.
93 !       [Note:  water content is only carried for the interstitial aerosol
94 !       phase, so there is no p dimension.]
96 !   hyswptr_aer(s,t) = the position/index in the chem array for mixing-
97 !       ratio of aerosol "hysteresis water" content for size bin s, type t.
98 !       This is used to determine if aerosol is in the dry or wet state, when
99 !       the ambient RH is between the crystallization and deliquescence RH.
100 !       [Note:  hysteresis water content is only carried for the 
101 !       interstitial aerosol phase, so there is no p dimension.]
103 !   numptr_aer(s,t,p) = the position/index in the chem array for mixing- 
104 !       ratio of particle number for size bin s, type t, and phase p.
106 !   mprognum_aer(s,t,p) - if positive, number mixing-ratio for size s, type t,
107 !       and phase p will be prognosed.  Otherwise, it is diagnosed using
108 !       mass mixing-ratio add assumed/prescribed size.
110 !       mixing ratio (moles-water/mole-air) for water
111 !       associated with aerosol size bin s and type t
114 !   mastercompindx_so4_aer = the position/index in the 
115 !       "master component list" for sulfate.  
116 !   (similar lptr's are defined for no3, cl, msa, co3, 
117 !       nh4, na, ca, oin, oc, bc, ...)
118 !   [Note:  the mastercompindx_xxx_aer are used primarily in 
119 !       initialization routines, and generally aren't needed elsewhere.]
121 !-----------------------------------------------------------------------
123 !   dens_mastercomp_aer(mc) = dry density (g/cm^3) of component mc 
124 !       of the master component list.
125 !   dens_aer(c,t) = dry density (g/cm^3) of aerosol chemical component 
126 !       c of type t
127 !   [Note:  dens_aer(c,t) == dens_mastercomp_aer(mastercompptr_aer(c,t))
128 !       The dens_mastercomp_aer is used in some initialization routines.
129 !       The dens_aer is used in most other places because of convenience.]
131 !   mw_mastercomp_aer(mc) = molecular weight (g/mole) of component mc 
132 !       of the master component list.
133 !   mw_aer(c,t) = molecular weight (g/mole) of aerosol chemical component 
134 !       c of type t
135 !   [Note:  mw_aer(c,t) == mw_mastercomp_aer(mastercompptr_aer(c,t)) ]
137 !   name_mastercomp_aer(mc) = name of component mc of the 
138 !       master component list (e.g., "sulfate", "nitrate", ...).
139 !   name_aer(c,t) = molecular weight (g/mole) of aerosol chemical component 
140 !       c of type t
141 !   [Note:  name_aer(c,t) == name_mastercomp_aer(mastercompptr_aer(c,t)) ]
143 !   hygro_mastercomp_aer(mc) = bulk hygroscopicity (--) at dilute conditions
144 !       (RH near 100%) of component mc of the master component list.
145 !   hygro_aer(c,t) = bulk hygroscopicity (--) at dilute conditions 
146 !       (RH near 100%) of aerosol chemical component c of type t
147 !   [For definition of bulk hygroscopicity, 
148 !       see Abdul-Razzak and Ghan, 2004, J Geophys Res, V105, p. 6837-6844.]
149 !   [Note:  hygro_aer(c,t) == hygro_mastercomp_aer(mastercompptr_aer(c,t)) ]
151 !-----------------------------------------------------------------------
153 !   volumlo_sect(s,t) = 1-particle volume (cm^3) at lower boundary of section m
154 !   volumhi_sect(s,t) = 1-particle volume (cm^3) at upper boundary of section m
155 !   volumcen_sect(s,t)= 1-particle volume (cm^3) at "center" of section m
157 !   dlo_sect(s,t) = 1-particle diameter (cm) at lower boundary of section m
158 !   dhi_sect(s,t) = 1-particle diameter (cm) at upper boundary of section m
159 !   dcen_sect(s,t) = 1-particle diameter (cm) at "center" section m
161 !   [Note:  the "center" values are defined as follows:
162 !       volumcen_sect == 0.5*(volumlo_sect + volumhi_sect)
163 !                     == (pi/6) * (dcen_sect**3) ]
165 !-----------------------------------------------------------------------
167 !   msectional - if positive, each aerosol size bin is a section.
168 !   if equals 10, use jacobson moving center
169 !   if equals 20, use tzivion mass-number advection 
170 !       if zero/negative, each size bin is a mode (aitken, accumulation, ...)
172 !   maerosolincw - if positive, both unactivated/interstitial and activated
173 !       aerosol species are simulated.  if zero/negative, only the
174 !       unactivated are simulated.  [maerosolincw>0 only when cw_phase>0]
176 !   maerocoag - if positive, aerosol coagulation is done.
177 !       If zero/negative, it is skipped.
178 !       (This is not yet implemented in WRF-Chem.)
180 !   maerchem - if positive, aerosol gas-particle condensation/evaporation
181 !       of inorganic species is done.  If zero/negative, it is skipped.
182 !       (This is not yet implemented in WRF-Chem.)
184 !   maerchem_boxtest_output - if positive, "boxtest" output is done from
185 !       the aerchemistry routine.  If zero/negative, it is skipped.
186 !       (This is not yet implemented in WRF-Chem.)
188 !   maeroptical - if positive, aerosol optical properties are calculated. 
189 !       If zero/negative, it is skipped.
190 !       (This is not yet implemented in WRF-Chem.)
192 !-----------------------------------------------------------------------
194         integer, parameter :: maxd_atype = 1
195         integer, parameter :: maxd_asize = 8
196         integer, parameter :: maxd_acomp = 12
197         integer, parameter :: maxd_aphase = 2
199         integer, save :: ai_phase = -999888777
200         integer, save :: cw_phase = -999888777
201         integer, save :: ci_phase = -999888777
202         integer, save :: rn_phase = -999888777
203         integer, save :: sn_phase = -999888777
204         integer, save :: gr_phase = -999888777
206         integer, save :: ntype_aer = 0 ! number of types
207         integer, save :: ntot_mastercomp_aer = 0 ! number of master components
208         integer, save :: nphase_aer = 0 ! number of phases
210         integer, save ::   &
211           nsize_aer( maxd_atype ),   & ! number of size bins
212           ncomp_aer( maxd_atype ),   & ! number of chemical components
213           ncomp_plustracer_aer( maxd_atype ),   &
214           mastercompptr_aer(maxd_acomp, maxd_atype), &   !  mastercomp index
215           massptr_aer( maxd_acomp, maxd_asize, maxd_atype, maxd_aphase ), & 
216                 ! index for mixing ratio
217           waterptr_aer( maxd_asize, maxd_atype ), & ! index for aerosol water
218           hyswptr_aer( maxd_asize, maxd_atype ), &
219           numptr_aer( maxd_asize, maxd_atype, maxd_aphase ), & 
220                 ! index for the number mixing ratio
221           mprognum_aer(maxd_asize,maxd_atype,maxd_aphase)
224 !   these indices give the location in the "mastercomp list" of
225 !   the different aerosol chemical (or tracer) components
226         integer, save :: mastercompindx_so4_aer = -999888777
227         integer, save :: mastercompindx_no3_aer = -999888777
228         integer, save :: mastercompindx_cl_aer  = -999888777
229         integer, save :: mastercompindx_msa_aer = -999888777
230         integer, save :: mastercompindx_co3_aer = -999888777
231         integer, save :: mastercompindx_nh4_aer = -999888777
232         integer, save :: mastercompindx_na_aer  = -999888777
233         integer, save :: mastercompindx_ca_aer  = -999888777
234         integer, save :: mastercompindx_oin_aer = -999888777
235         integer, save :: mastercompindx_oc_aer  = -999888777
236         integer, save :: mastercompindx_bc_aer  = -999888777
239         real, save ::   &
240           dens_aer( maxd_acomp, maxd_atype ),   &
241           dens_mastercomp_aer( maxd_acomp ),   &
242           mw_mastercomp_aer( maxd_acomp ),   &
243           mw_aer( maxd_acomp, maxd_atype ),   &
244           hygro_mastercomp_aer( maxd_acomp ),   &
245           hygro_aer( maxd_acomp, maxd_atype )
247 !  added by Yang Zhang
248         real, save ::   &
249           volumcen_sect( maxd_asize, maxd_atype ),   &
250           volumlo_sect( maxd_asize, maxd_atype ),   &
251           volumhi_sect( maxd_asize, maxd_atype ),   &
252           dcen_sect( maxd_asize, maxd_atype ),   &
253           dlo_sect( maxd_asize, maxd_atype ),   &
254           dhi_sect( maxd_asize, maxd_atype ),   &
255           sigmag_aer(maxd_asize, maxd_atype)
257         character*10, save ::   &
258           name_mastercomp_aer( maxd_acomp ),  &
259           name_aer( maxd_acomp, maxd_atype )
261         integer, save ::                     &
262           lptr_so4_aer(maxd_asize, maxd_atype, maxd_aphase),      &
263           lptr_msa_aer(maxd_asize, maxd_atype, maxd_aphase),      &
264           lptr_no3_aer(maxd_asize, maxd_atype, maxd_aphase),      &
265           lptr_cl_aer(maxd_asize, maxd_atype, maxd_aphase),       &
266           lptr_co3_aer(maxd_asize, maxd_atype, maxd_aphase),      &
267           lptr_nh4_aer(maxd_asize, maxd_atype, maxd_aphase),      &
268           lptr_na_aer(maxd_asize, maxd_atype, maxd_aphase),       &
269           lptr_ca_aer(maxd_asize, maxd_atype, maxd_aphase),       &
270           lptr_oin_aer(maxd_asize, maxd_atype, maxd_aphase),      &
271           lptr_oc_aer(maxd_asize, maxd_atype, maxd_aphase),       &
272           lptr_bc_aer(maxd_asize, maxd_atype, maxd_aphase)
274 ! rce 11-sep-2004 - eliminated all of the "..._wrfch" pointers
275 !    so now there is only one set of pointers ("..._amode")
276 ! sg/rce nov-2004 - totally new pointer system  - "..._aer"
279 !   molecular weights (g/mol)
280         real, parameter :: mw_so4_aer = 96.066
281         real, parameter :: mw_no3_aer = 62.007
282         real, parameter :: mw_cl_aer  = 35.450
283         real, parameter :: mw_msa_aer = 96.109
284         real, parameter :: mw_co3_aer = 60.007
285         real, parameter :: mw_nh4_aer = 18.042
286         real, parameter :: mw_na_aer  = 22.990
287         real, parameter :: mw_ca_aer  = 40.080
288         real, parameter :: mw_oin_aer = 1.0
289         real, parameter :: mw_oc_aer  = 1.0
290         real, parameter :: mw_bc_aer  = 1.0
291         real, parameter :: mw_water_aer  = 18.016
292         
293 !   dry densities (g/cm3)
294         real, parameter :: dens_so4_aer = 1.80
295         real, parameter :: dens_no3_aer = 1.80
296         real, parameter :: dens_cl_aer  = 2.20
297         real, parameter :: dens_msa_aer = 1.80
298         real, parameter :: dens_co3_aer = 2.60
299         real, parameter :: dens_nh4_aer = 1.80
300         real, parameter :: dens_na_aer  = 2.20
301         real, parameter :: dens_ca_aer  = 2.60
302         real, parameter :: dens_oin_aer = 2.60
303         real, parameter :: dens_oc_aer  = 1.00
304         real, parameter :: dens_bc_aer  = 1.70
306 !   water density (g/cm3)
307 !       real, parameter :: dens_water_asize  = 1.0
308         real, parameter :: dens_water_aer  = 1.0
310 !   hygroscopicities (dimensionless)
311         real, parameter :: hygro_so4_aer = 0.5
312         real, parameter :: hygro_no3_aer = 0.5
313         real, parameter :: hygro_ca_aer  = 0.1
314         real, parameter :: hygro_co3_aer = 0.1
315         real, parameter :: hygro_nh4_aer = 0.5
316         real, parameter :: hygro_msa_aer = 0.58
317         real, parameter :: hygro_cl_aer  = 1.16
318         real, parameter :: hygro_na_aer  = 1.16
319         real, parameter :: hygro_oin_aer = 0.14
320         real, parameter :: hygro_oc_aer  = 0.14
321         real, parameter :: hygro_bc_aer  = 1.e-6
324         integer, save ::   &
325           msectional, maerosolincw,   &
326           maerocoag, maerchem, maeroptical, maerchem_boxtest_output
329 !-----------------------------------------------------------------------
330 !   the following arrays are used during "column calculations" within
331 !       mosaic modules
333 !   aqvoldry_sub(n,k,m) = dry-volume (cm^3-aerosol/mole-air) for mode n,
334 !                       layer k, subarea m
335 !   aqmassdry_sub(n,k,m) = dry-mass (g-aerosol/mole-air) for mode n, ...
336 !   adrydens_sub(n,k,m) = dry-density (g-aerosol/cm^3-aerosol) for mode n, ...
337 !                       == amassdry_sub/avoldry_sub
338 !   awetdens_sub(n,k,m) = wet-density (g-aerosol/cm^3-aerosol) for mode n, ...
340 !   admeandry_sub(n,k,m) = current mean dry-diameter (cm) 
341 !       for unactivated aerosol in mode n, layer k, subarea m.  
342 !       (Used in sectional code)
343 !   admeanwet_sub(n,k,m) = current mean wet-diameter (cm) 
344 !       for unactivated aerosol in mode n, layer k, subarea m.  
345 !       (Used in sectional code)
347 !   awetdens_sfc(n,i,j) = wet-density for mode n and k=1.  This value is 
348 !       saved after the second pass thru subr. aerosol_wetsize 
349 !       for use in subr. bounds
350 !   admeanwet_sfc(n,i,j) = mean wet-diameter for mode n and k=1.  
351 !       This value is saved after the second pass thru 
352 !       subr. aerosol_wetsize for use in subr. bounds
355 !   following are used in aerosol growth routine and are locally
356 !   defined for the current layer (k) and subarea (m)
357 !       drymass_pregrow(n) = dry-mass (g/mole-air) for section n
358 !                       before the aerosol growth
359 !       drymass_aftgrow(n) = dry-mass (g/mole-air) for section n
360 !                       after the growth but before inter-section transfer
361 !       drydens_pregrow(n) = dry-density (g/cm3) for section n
362 !                       before the aerosol growth
363 !       drydens_aftgrow(n) = dry-density (g/cm3) for section n
364 !                       after the growth but before inter-section transfer
366 !-----------------------------------------------------------------------
368 !       integer, parameter :: imaxd_asize = 78
369 !       integer, parameter :: jmaxd_asize = 28
370         integer, parameter :: kmaxd_asize = 100
371         integer, parameter :: nsubareamaxd_asize = 5
373 ! rce 22-jul-2006 - added maxd_atype dimension to following 6 arrays
374 !    and changed avoldry_sub,amassdry_sub to aqvoldry_sub,aqmassdry_sub
375         real, save :: aqvoldry_sub( maxd_asize,maxd_atype,kmaxd_asize,nsubareamaxd_asize)
376         real, save :: aqmassdry_sub(maxd_asize,maxd_atype,kmaxd_asize,nsubareamaxd_asize)
377         real, save :: adrydens_sub( maxd_asize,maxd_atype,kmaxd_asize,nsubareamaxd_asize)
378         real, save :: awetdens_sub( maxd_asize,maxd_atype,kmaxd_asize,nsubareamaxd_asize)
379         real, save :: admeandry_sub(maxd_asize,maxd_atype,kmaxd_asize,nsubareamaxd_asize)
380         real, save :: admeanwet_sub(maxd_asize,maxd_atype,kmaxd_asize,nsubareamaxd_asize)
382 !       real, save :: awetdens_sfc(maxd_asize,imaxd_asize,jmaxd_asize)
383 !       real, save :: admeanwet_sfc(maxd_asize,imaxd_asize,jmaxd_asize)
385         real, save :: drymass_pregrow(maxd_asize,maxd_atype)
386         real, save :: drydens_pregrow(maxd_asize,maxd_atype)
387         real, save :: drymass_aftgrow(maxd_asize,maxd_atype)
388         real, save :: drydens_aftgrow(maxd_asize,maxd_atype)
390 ! table lookup of aerosol impaction/interception
391 ! scavenging rates
392         real dlndg_nimptblgrow
393         integer nimptblgrow_mind, nimptblgrow_maxd
394         parameter (nimptblgrow_mind=-7, nimptblgrow_maxd=12)
395         real scavimptblnum(4, nimptblgrow_mind:nimptblgrow_maxd, maxd_asize, maxd_atype), &
396              scavimptblvol(4, nimptblgrow_mind:nimptblgrow_maxd, maxd_asize, maxd_atype)
399         end module module_data_mosaic_asect