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 references and terms of use
8 !**********************************************************************************
10 module module_data_cmu_bulkaqchem
17 ! summary of module **variables**
19 ! the following variables are flags that could be converted to parameters
20 ! integer, save :: maqurxn_all = 1
21 ! integer, save :: maqurxn_sulf1 = 0
22 ! integer, save :: mopt_eqrt_cons = 0
23 ! integer, save :: mequlib_h2o2_ho2m = 0
24 ! integer, save :: mgasrxn = 0
25 ! integer, save :: mdiag_fullequil = 1
26 ! integer, save :: mdiag_hybrd = 1
27 ! integer, save :: mdiag_negconc = 1
28 ! integer, save :: mdiag_rsrate = 1
29 ! integer, save :: mdiag_svode = 1
31 ! the following variables are constants (they are set in subr dropinit, then never changed)
32 ! double precision, save :: wso2, wh2o2, whcho, whcooh, wnh3, whno3, whcl, wh2so4
33 ! double precision, save :: wmol(29), amol(3), gmol(22)
37 !-----------------------------------------------------------------------
39 !-----------------------------------------------------------------------
40 !******************************************************************
42 !******************************************************************
46 double precision, parameter :: pi = 3.14159
47 double precision, parameter :: pi6 = pi/6.0
49 double precision, parameter :: rho = 1.4e12 ! particle density [ug/m^3]
51 ! aerosol components in the aerosol concentration vector
53 integer, parameter :: nas = 1 ! sodium
54 integer, parameter :: nah = 2 ! hydrogen
55 integer, parameter :: naa = 3 ! ammonium
56 integer, parameter :: nan = 4 ! nitrate
57 integer, parameter :: nac = 5 ! chloride
58 integer, parameter :: na4 = 6 ! sulfate
59 integer, parameter :: naw = 7 ! water
60 integer, parameter :: nae = 8 ! elemental carbon
61 integer, parameter :: nao = 9 ! organics
62 integer, parameter :: nar = 10 ! crustal
63 integer, parameter :: nahso5 = 11 ! hso5-
64 integer, parameter :: nahmsa = 12 ! hmsa
65 integer, parameter :: naspec = 12 ! number of aerosol species
67 ! condensible gas-phase components in local arrays
69 integer, parameter :: ngca = 1 ! ammonia
70 integer, parameter :: ngcn = 2 ! nitric acid
71 integer, parameter :: ngcc = 3 ! hydrochloric acid
72 integer, parameter :: ngc4 = 4 ! gas-phase sulfate
73 integer, parameter :: ngco = 5 ! gas-phase organics
74 integer, parameter :: ngcspec = 5 ! number of condensible gas-phase species
76 ! condensible gas-phase components in global gas-phase array
78 ! this must be customized to have the correct addresses
80 integer, parameter :: nga = 1 ! ammonia
81 integer, parameter :: ngn = 2 ! nitric acid
82 integer, parameter :: ngc = 3 ! hydrochloric acid
83 integer, parameter :: ng4 = 4 ! gas-phase sulfate
84 integer, parameter :: ngo = 5 ! gas-phase organics
85 integer, parameter :: ngspec = 5 ! number of condensible gas-phase species
87 ! total number of gas phase species so we know where the aerosol starts
89 ! integer, parameter :: ngtotal = 50
90 integer, parameter :: ngtotal = 26 ! 2004-nov-15 rce
91 integer, parameter :: ngas=ngtotal
92 integer, parameter :: naers=naspec
96 !-----------------------------------------------------------------------
98 !-----------------------------------------------------------------------
99 ! updated droppar.inc for the bulk model
100 ! last update : 10 june 1998
101 !*************************************************************************
103 !*************************************************************************
105 ! aqueous-phase parameters and variables
107 ! aqueous-phase components
109 ! important : all components have the same positions in
110 ! both aerosol and aqueous matrices
111 ! never change this convention because aqmain
114 integer, parameter :: ksod = nas ! na(+)
115 integer, parameter :: khyd = nah ! h(+)
116 integer, parameter :: kamm = naa ! nh4(+)
117 integer, parameter :: knit = nan ! no3(-)
118 integer, parameter :: kchl = nac ! cl(-)
119 integer, parameter :: ksvi = na4 ! s(vi)
120 integer, parameter :: kwat = naw ! h2o
121 integer, parameter :: kec = nae ! ec
122 integer, parameter :: koc = nao ! oc
123 integer, parameter :: kcru = nar ! crustal
124 ! integer, parameter :: khso5 = 1 ! hso5-
125 ! integer, parameter :: khmsa = 2 ! hmsa
126 ! integer, parameter :: kform = 3 ! formic acid
128 ! gases in local array
130 integer, parameter :: ngso2 = 11
131 integer, parameter :: ngh2o2 = 12
132 integer, parameter :: nghcho = 13
133 integer, parameter :: nghcooh = 14
134 integer, parameter :: nghno2 = 15
135 integer, parameter :: ngno = 16
136 integer, parameter :: ngno2 = 17
137 integer, parameter :: ngo3 = 18
138 integer, parameter :: ngpan = 19
139 integer, parameter :: ngoh = 20
140 integer, parameter :: ngho2 = 21
141 integer, parameter :: ngno3 = 22
142 integer, parameter :: ngch3o2 = 23
143 integer, parameter :: ngch3o2h = 24
144 integer, parameter :: ngch3oh = 25
145 integer, parameter :: ngch3co3h = 26
147 ! number of equations for aqueous-phase chemistry solution
149 integer, parameter :: meqn1max = 20
150 ! integer, save :: meqn1 = meqn1max ! rce 2008-mar-12 ELIMINATED
152 ! activation diameter (dry)
154 double precision, parameter :: dactiv = 0.7e-6 ! in m
160 double precision, parameter :: avdiam = 20.e-6
162 ! choice of expression for iron chemistry
163 ! = 0 (no iron/manganese chemistry)
164 ! kiron = 1 (phenomenological, martin et al., 1991)
167 ! integer, parameter :: kiron = 1 ! was 1
168 ! integer, parameter :: kiron = 0 ! rce 2004-mar-24 - turn off metal chem
169 integer, parameter :: kiron = 1 ! rce 2005-jan-17 - turn it back on
171 ! choice of turning on or off radical chemisty
172 ! (it is better to turn it off during the night)
174 ! integer, save :: iradical ! rce 2008-mar-12 ELIMINATED
175 ! integer, parameter :: iradical = 0 ! rce 2004-nov-15 - now a variable
178 ! choice of turning off chlorine chemistry
180 double precision, parameter :: chlorine = 0.0
182 ! parameter for scaling of photolysis rates
184 ! double precision, save :: photo ! rce 2008-mar-12 ELIMINATED
185 ! double precision, parameter :: photo = 1.0
186 ! double precision, parameter :: photo = 0.0 ! rce 2004-mar-24 - turn off photo chem
187 ! rce 2004-nov-15 - now a variable
189 ! fraction of crustal material that is alkaline
191 ! double precision, parameter :: caratio = 0.05 ! was 0.1
192 ! rce 2005-jul-14 - reduce caratio to .001 to get lower ph
193 ! with 0.05 value, ca=.05*oin, and the initial aerosol is alkaline
194 double precision, parameter :: caratio = 0.001
198 ! fraction of liquid water content that goes to each s.r. section
200 double precision, parameter :: frac1 = 0.8 ! fraction of lwc in sect. 1
201 double precision, parameter :: frac2 = 0.2 ! fraction of lwc in sect. 2
204 ! assumption : fe(3+) and mn(2+) = 0.003%, 0.001% of crustal mass
206 ! double precision, parameter :: firon = 0.00003
207 ! double precision, parameter :: fman = 0.00001
208 ! double precision, parameter :: firon = 0.0 ! rce 2004-mar-24 - turn off metal chem
209 ! double precision, parameter :: fman = 0.0 ! rce 2004-mar-24 - turn off metal chem
210 double precision, parameter :: firon = 0.00003 ! rce 2005-jan-17 - turn it back on
211 double precision, parameter :: fman = 0.00001 ! rce 2005-jan-17 - turn it back on
213 ! co2 mixing ratio (ppm)
214 ! double precision, save :: co2_mixrat ! rce 2008-mar-12 ELIMINATED
217 !-----------------------------------------------------------------------
219 !-----------------------------------------------------------------------
221 ! cmn groups and corresponding matrices for aqueous-phase module
223 ! double precision, save :: akeq(17), akhen(21), akre(120) ! rce 2008-mar-12 ELIMINATED
224 double precision, save :: wso2, wh2o2, whcho, whcooh, wnh3, whno3, whcl, wh2so4
225 double precision, save :: wmol(29), amol(3), gmol(22)
227 ! double precision, save :: gcon(22), con(28), cmet(4), rad, wvol, chyd ! rce 2008-mar-12 ELIMINATED
231 !-----------------------------------------------------------------------
233 !-----------------------------------------------------------------------
234 ! include file for svode parameters and non-changing values
238 integer, parameter :: itol = 4
239 integer, parameter :: itask = 1
240 ! integer, parameter :: istate = 1 ! rce 2004-mar-18 - istate is a variable
241 integer, parameter :: iopt = 1
242 integer, parameter :: mf = 22
243 integer, parameter :: worki = 100000 ! maximum steps allowed
245 integer, parameter :: lrw1 = 22+9*meqn1max+2*meqn1max**2
246 integer, parameter :: liw1 = 30+meqn1max
248 ! double precision, parameter :: tola = 1.e-4 ! was 1.e-3
249 ! double precision, parameter :: tola = 1.e-6 ! 17-may-2006 rce - need smaller tola
250 double precision, parameter :: tola = 1.e-8 ! 24-mar-2008 rce - need smaller tola
252 double precision, parameter :: tolr = 1.e-5 ! was 1.e-3
254 double precision, parameter :: workr = 300.0
258 ! itol: 4=use arrays for tolerances
259 ! tola: absolute tolerance in ug/m3
260 ! tolr: relative tolerance
261 ! itask: 1 for normal computation of output values of y at t = tout.
262 ! istate: integer flag (input and output). set istate = 1.
263 ! iopt: 0 to indicate no optional input used.
264 ! rwork: double precision work array of length at least..
265 ! 20 + 16*neq for mf = 10,
266 ! 22 + 9*neq + 2*neq**2 for mf = 21 or 22,
267 ! 22 + 11*neq + (3*ml + 2*mu)*neq for mf = 24 or 25.
268 ! lrw: declared length of rwork (in user's dimension statement).
269 ! iwork: integer work array of length at least..
271 ! 30 + neq for mf = 21, 22, 24, or 25.
272 ! if mf = 24 or 25, input in iwork(1),iwork(2) the lower
273 ! and upper half-bandwidths ml,mu.
274 ! liw: declared length of iwork (in user's dimension statement).
275 ! mf: method flag. standard values are..
276 ! 10 for nonstiff (adams) method, no jacobian used.
277 ! 21 for stiff (bdf) method, user-supplied full jacobian.
278 ! 22 for stiff method, internally generated full jacobian.
279 ! 24 for stiff method, user-supplied banded jacobian.
280 ! 25 for stiff method, internally generated banded jacobian.
281 ! iopt: 1 = some optional parameters used
282 ! here: workr: rwork(6) (max absolute step size allowed -
283 ! default value is infinite.)
284 ! worki: iwork(6) (maximum number of (internally defined)
285 ! steps allowed during one call to the
286 ! solver. the default value is 500.)
290 integer, parameter :: numfunc = 7
291 integer, parameter :: maxfev = 300*(numfunc+1)
292 integer, parameter :: ml = numfunc - 1, mu = numfunc -1
293 integer, parameter :: nprint = 0
294 integer, parameter :: lr = numfunc*(numfunc+1)/2, ldfjac = numfunc
295 integer, parameter :: mode = 2
297 ! double precision, parameter :: xtol = 0.1e0**3
298 double precision, parameter :: xtol = 1.0e-3
299 double precision, parameter :: epsfcn = 0.0e0, factor = 100.
301 ! numfunc : number of functions and variables
302 ! xtol : termination occurs when the rel error between two consecutive
303 ! iterates is at most xtol
304 ! maxfev : termination occurs when the number of calls to fcn is at least maxfev
305 ! ml : specifies the number of subdiagonals within the band of the
306 ! jacobian matrix. if the jacobian is not banded, set ml to at
308 ! mu : specifies the number of superdiagonals within the band of the
309 ! jacobian matrix. if the jacobian is not banded, set mu to at
311 ! epsfcn : used in determining a suitable step length for the
312 ! forward-difference approximation
313 ! factor : used in determining the initial step bound
314 ! mode : if 1, the variables will be scaled internally; if 2, the
315 ! scaling is specified by the input diag.
316 ! nprint : input variable that enables controlled
317 ! printing of iterates if it is positive. in this case,
318 ! fcn is called with iflag = 0 at the beginning of the first
319 ! iteration and every nprint iterations thereafter and
320 ! immediately prior to return, with x and fvec available
321 ! for printing. if nprint is not positive, no special calls
322 ! of fcn with iflag = 0 are made.
326 !-----------------------------------------------------------------------
328 !-----------------------------------------------------------------------
330 ! maqurxn_all - if positive, all reactions are enabled.
331 ! If zero/negative, all reactions rates are zeroed.
332 ! maqurxn_sulf1 - if positive, 4 primary sulfur reactions are enabled.
333 ! This has no effect when maqurxn_all=1.
334 ! When maqurxn_all=0 & maqurxn_sulf1=1, only the 4 primary
335 ! sulfur reactions (rxns 72-75) are enabled.
337 ! mopt_eqrt_cons - if =20, certain equilib. constants and reaction rates
338 ! are modified to allow closer comparison with
339 ! other cloud chemistry codes
340 ! mequlib_h2o2_ho2m - currently not used
341 ! mgasrxn - currently not used
343 ! mdiag_fullequil - if positive, warning messages from subr. fullequil
345 ! mdiag_hybrd - if positive, warning messages from subr. hybrd are enabled
346 ! mdiag_negconc - if positive, warning messages from subr. aqoperator1
347 ! about negative concentrations are enabled
348 ! mdiag_rsrate - if positive, warning messages from subr. aqratesa
349 ! about sulfur mass balance are enabled. This diagnostic is somewhat
350 ! misleading as some reactions do not conserve sulfur.
351 ! mdiag_svode - if positive, warning messages from subr. svode are enabled
353 ! mprescribe_ph - if positive, cloudwater ph is set to xprescribe_ph
355 integer, save :: maqurxn_all = 1
356 integer, save :: maqurxn_sulf1 = 0
357 integer, save :: mopt_eqrt_cons = 0
358 integer, save :: mequlib_h2o2_ho2m = 0
359 integer, save :: mgasrxn = 0
360 integer, save :: mdiag_fullequil = 1
361 integer, save :: mdiag_hybrd = 1
362 integer, save :: mdiag_negconc = 1
363 integer, save :: mdiag_rsrate = 1
364 integer, save :: mdiag_svode = 1
365 ! integer, save :: mprescribe_ph = 0 ! rce 2008-mar-12 ELIMINATED
366 ! double precision, save :: xprescribe_ph = 4.5 ! rce 2008-mar-12 ELIMINATED
368 ! gas constant in [atm/K/(mol/liter)]
369 double precision, parameter :: rideal = 0.082058e0
371 ! indices to wmol array, for molecular weights of aqueous species
372 integer, parameter :: kaqx_siv = 1
373 integer, parameter :: kaqx_svi = 2
374 integer, parameter :: kaqx_no3m = 4
375 integer, parameter :: kaqx_h2o2 = 6
376 integer, parameter :: kaqx_clm = 15
377 integer, parameter :: kaqx_nh4p = 19
378 integer, parameter :: kaqx_hso5m = 26
379 integer, parameter :: kaqx_hmsa = 27
383 end module module_data_cmu_bulkaqchem