module_data_mosaic_therm.F
References to this file elsewhere.
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.
6 !
7 ! MOSAIC module: see module_mosaic_driver.F for information and terms of use
8 !**********************************************************************************
9 module module_data_mosaic_therm
10
11
12
13 implicit none
14
15
16
17 ! mosaic.h (mosaic.14.3)
18 ! 29-apr-05 rce - converted to f90 module; changed nbin_a to nbin_a_maxd;
19 ! added kclm_aer_calcbgn/end, lunerr_aer, ncorecnt_aer, masbalout_...
20 ! 27-apr-05 raz - compatible with mosaic.14.3
21 ! 07-jan-05 raz - updated and cleaned up variable lists
22 ! 08-jul-03 raz - updated many variables
23 ! 07-aug-02 rce - this is rahul's latest version from freshair
24 ! 19-aug-02 raz - declared mass_soluble_a and kg as real
25 ! 07-oct-02 raz - declared zc and za as integer
26 ! 09-oct-02 raz - explicitly declared all variables
27 ! 29-oct-02 raz - defined naercomp as the total number of aerosol compounds
28 !----------------------------------------------------------------------
29
30 ! rce 11-sep-2004
31 ! nbin_a_maxd = maximum num of aerosol bins and is used to dimension arrays
32 integer, parameter :: nbin_a_maxd = 8
33 ! nbin_a = ntot_amode = number of bins that are used in a run
34 ! (nbin_a is set = ntot_amode at run time, and must be <= nbin_a_maxd)
35 integer, save :: nbin_a = 999888777
36
37
38 ! mosaic-specific parameters
39 integer naer_vol, naer, naercomp, nelectrolyte, nsalt, &
40 nsoluble, ncation, nanion, ncation_clegg, nanion_clegg
41 parameter(naer_vol = 4) ! volatile aerosol species that have a gaseous counterpart
42 parameter(naer = 11) ! num of chemical species per bin
43 parameter(naercomp = 22) ! num of electrolytes + oc, bc, and oin
44 parameter(nelectrolyte = 18) ! num of electrolytes
45 parameter(nsalt = 12) ! num of soluble salts
46 parameter(nsoluble = 16) ! num of soluble electrolytes
47 parameter(ncation = 4) ! num of cations
48 parameter(nanion = 4) ! num of anions
49 parameter(ncation_clegg = ncation) ! num of cations in clegg's model
50 parameter(nanion_clegg = nanion) ! num of anions in clegg's model
51
52 integer nrxn_aer_gl, nrxn_aer_ll, nrxn_aer_sg, nrxn_aer_sl
53 parameter(nrxn_aer_gl = 4) ! num of gas-liquid equilibria
54 parameter(nrxn_aer_ll = 3) ! num of liquid-liquid equilibria
55 parameter(nrxn_aer_sg = 2) ! num of solid-gas equilibria
56 parameter(nrxn_aer_sl = nsalt)! num of solid-liquid equilibria
57
58 integer mmtem, mpsc, mkm, mbrom, masteem, masceem, &
59 mmodal, msection, &
60 mon, moff, myes, mno
61 parameter(mmtem = 1) ! multicomponent taylor expansion method
62 parameter(mpsc = 2) ! pitzer-simonson-clegg model
63 parameter(mkm = 3) ! kusik and meissner mixing rule
64 parameter(mbrom = 4) ! bromley mixing rule
65 parameter(masteem = 1) ! adaptive step time-split explicit euler method
66 parameter(masceem = 2) ! adaptive step coupled explicit euler method
67 parameter(mmodal = 1) ! modal size distribution framework
68 parameter(msection= 2) ! sectional size distribution framework
69 parameter(mon = 1) ! flag: on
70 parameter(moff = 0) ! flag:off
71 parameter(myes = mon) ! flag: yes or true
72 parameter(mno = moff) ! flag: no or false
73
74
75 integer jtotal, jsolid, jliquid
76 parameter(jtotal = 1)
77 parameter(jsolid = 2)
78 parameter(jliquid= 3)
79
80 integer jhyst_lo, jhyst_up
81 parameter(jhyst_lo = 0) ! lower hysteresis leg
82 parameter(jhyst_up = 1) ! upper hysteresis leg
83
84 integer no_aerosol, all_solid, all_liquid, mixed
85 parameter(no_aerosol = 0) ! flag
86 parameter(all_solid = 1) ! flag
87 parameter(all_liquid = 2) ! flag
88 parameter(mixed = 3) ! flag
89
90 integer soluble, insoluble
91 parameter(soluble = 1) ! flag
92 parameter(insoluble = 2) ! flag
93
94 real mass_cutoff
95 parameter(mass_cutoff = 1.e-3) ! ng/m^3
96
97 real smallp
98 parameter(smallp = 1.0) ! percent
99
100
101 !----------------------------------------------------------------------
102 ! box
103 ! real, save :: &
104 ! & statelo_a(nbin_a_maxd),
105 ! & stateup_a(nbin_a_maxd)
106
107
108
109
110
111 ! mosaic species indices
112 !
113 ! gas
114 integer, save :: &
115 ih2so4_g, ihno3_g, ihcl_g, inh3_g
116
117 ! aerosol generic
118 integer, save :: &
119 iso4_a, ino3_a, icl_a, inh4_a, ico3_a, &
120 imsa_a, ina_a, ica_a, ioc_a, ibc_a, &
121 ioin_a
122
123 ! aerosol elecctrolytes/compounds
124 integer, save :: &
125 jnh4so4, jlvcite, jnh4hso4, jnh4no3, jnh4cl, &
126 jna2so4, jna3hso4, jnahso4, jnano3, jnacl, &
127 jcaso4, jcano3, jcacl2, jcaco3, jh2so4, &
128 jhno3, jhcl, jhhso4, &
129 joc, jbc, join, jh2o
130
131 ! aerosol ions
132 integer, save :: &
133 jc_h, jc_nh4, jc_na, jc_ca, &
134 ja_hso4, ja_so4, ja_no3, ja_cl ! , ja_co3
135
136
137 !----------------------------------------------------------------------
138 ! mosaic variables
139 integer, save :: &
140 iclm_aer, & ! i-location
141 jclm_aer, & ! j-location
142 kclm_aer, & ! k-location
143 kclm_aer_calcbgn, & ! k-location for calc. to begin
144 kclm_aer_calcend, & ! k-location for calc. to end
145 mclm_aer, & ! m-subarea
146 mgas_aer_xfer, & ! flag: mon, moff
147 mdynamic_solver, & ! flag: masteem, masceem
148 msize_framework, & ! flag: mmodal, msectional
149 mactivity_coeff, & ! flag: mmtem, mpsc, mkm, mbrom
150 madapt_alpha, & ! flag: mon, moff
151 jaerosolstate(nbin_a_maxd), & ! flag: no_aerosol, all_solid, all_liquid, mixed
152 jphase(nbin_a_maxd), & ! phase index: jtotal, jsolid, jliquid
153 jhyst_leg(nbin_a_maxd), & ! hysteresis leg: jhyst_up, jhyst_lo
154 iprint_input, & ! flag: mon, moff
155 lunerr_aer, &
156 ncorecnt_aer
157
158
159 real, save :: &
160 num_a(nbin_a_maxd), & ! #/cc(air)
161 dpgn_a(nbin_a_maxd), & ! cm
162 dp_dry_a(nbin_a_maxd), & ! cm
163 dp_wet_a(nbin_a_maxd), & ! cm
164 mass_dry_a(nbin_a_maxd), & ! g/cc(air)
165 mass_wet_a(nbin_a_maxd), & ! g/cc(air)
166 mass_soluble_a(nbin_a_maxd), & ! ng/cc(air)
167 vol_dry_a(nbin_a_maxd), & ! cc/cc(air)
168 vol_wet_a(nbin_a_maxd), & ! cc/cc(air)
169 dens_dry_a(nbin_a_maxd), & ! g/cc
170 dens_wet_a(nbin_a_maxd), & ! g/cc
171 sigmag_a(nbin_a_maxd), & ! -
172 water_a(nbin_a_maxd), & ! kg(water)/m^3(air)
173 water_a_hyst(nbin_a_maxd), & ! kg(water)/m^3(air) hysteresis (at 60% rh)
174 water_a_up(nbin_a_maxd), & ! kg(water)/m^3(air) at 60% rh
175 ph(nbin_a_maxd), & ! ph
176 ph_est(nbin_a_maxd), & ! ph (estimated)
177 aer(naer,3,nbin_a_maxd), & ! nmol/m^3
178 aer_percent(naer,3,nbin_a_maxd), & ! %
179 comp_a(naercomp), & ! g/cc(air)
180 electrolyte(nelectrolyte,3,nbin_a_maxd), & ! nmol/m^3
181 electrolyte_sum(nelectrolyte,nbin_a_maxd), & ! nmol/m^3
182 epercent(nelectrolyte,3,nbin_a_maxd), & ! %
183 gas(naer_vol), & ! nmol/m^3
184 volatile_a(naer_vol), & ! nmol/m^3
185 ctot_a(naer_vol), & ! nmol/m^3
186 ah2o, &
187 ah2o_a(nbin_a_maxd), &
188 dry_vol(nbin_a_maxd), &
189 dpmv(nbin_a_maxd), &
190 volume_a(nbin_a_maxd), &
191 kelvin(nbin_a_maxd) ! kelvin factor
192
193
194 !----------------------------------------------------------------------
195 ! asteem (asceem) variables
196 integer, save :: &
197 mxfer_massbal(nbin_a_maxd), & ! mon, moff
198 ieqblm_bin(nbin_a_maxd), & ! myes, mno
199 jasteem_call, &
200 jasteem_fail
201
202
203 real, save :: &
204 sfc_a(naer_vol), & ! nmol/m^3
205 kg(naer_vol,nbin_a_maxd), & ! 1/s
206 df_gas(naer_vol,nbin_a_maxd), & ! nmol/m^3 (g-g*) = driving force)
207 flux(naer_vol,nbin_a_maxd), & ! nmol/m^3/s
208 aer_nh4_max(nbin_a_maxd), & ! nmol/m^3
209 phi_volatile(naer_vol,nbin_a_maxd), & ! relative dr. force = (g-g*)/g
210 phi_nh4no3(nbin_a_maxd), & ! relative dr. force: 0 to 1
211 phi_nh4cl(nbin_a_maxd), & ! relative dr. force: 0 to 1
212 alpha_gas(naer_vol), & ! 0.01 to 0.05
213 alpha_aer(naer_vol,nbin_a_maxd), & ! 0.01 to 4.0
214 alpha_asteem, & ! 0.01 to 0.05
215 steps_asteem(nbin_a_maxd), &
216 steps_asteem_avg(nbin_a_maxd), &
217 steps_asteem_max(nbin_a_maxd)
218
219
220
221 !----------------------------------------------------------------------
222 ! mesa variables
223 integer, save :: &
224 jsalt_index(nsalt), &
225 jsulf_poor(211), &
226 jsulf_rich(71), &
227 jsalt_present(nsalt), &
228 jmesa_call_tot, &
229 jmesa_call, &
230 jmesa_fail
231
232
233 real, save :: &
234 eleliquid(nelectrolyte), &
235 flux_sl(nsalt), &
236 phi_salt(nsalt), &
237 sat_ratio(nsalt), &
238 hsalt(nsalt), &
239 hsalt_max, &
240 frac_salt_liq(nsalt), &
241 frac_salt_solid(nsalt), &
242 dry_mass(nbin_a_maxd), &
243 total_dry_mass(nbin_a_maxd), &
244 growth_factor(nbin_a_maxd), &
245 d_mdrh(63,4), & ! mdrh(t) poly coeffs
246 mdrh(nbin_a_maxd), &
247 iter_mesa, &
248 iter_mesa_avg
249
250
251 !----------------------------------------------------------------------
252 ! mosaic physico-chemical constants
253 character*8, save :: &
254 ename(nelectrolyte), & ! electrolyte names
255 aer_name(naer), & ! generic aerosol species name
256 gas_name(naer_vol) ! gas species name
257
258 real, save :: &
259 t_k, & ! temperature (k)
260 p_atm, & ! pressure (atm)
261 rh_pc, & ! relative humidity (%)
262 cair_mol_cc, & ! air conc in mol/cc
263 cair_mol_m3, & ! air conc in mol/m^3
264 conv1a, &
265 conv1b, &
266 conv2a, &
267 conv2b, &
268 mw_electrolyte(nelectrolyte), & ! molecular wt of electrolytes
269 mw_aer_mac(naer), & ! molecular wt of generic species
270 mw_comp_a(naercomp), & ! molecular wt of compounds
271 mw_c(ncation), & ! molecular wt of cations
272 mw_a(nanion), & ! molecular wt of anions
273 dens_electrolyte(nelectrolyte), & ! g/cc
274 dens_aer_mac(naer), & ! g/cc
275 dens_comp_a(naercomp), & ! g/cc (density of compounds)
276 sigma_water, & ! water surface tension (n/m)
277 sigma_soln(nbin_a_maxd), & ! solution surface tension (n/m)
278 keq_gl(nrxn_aer_gl), & ! gas-liq eqblm const
279 keq_ll(nrxn_aer_ll), & ! liq-liq eqblm const
280 keq_sg(nrxn_aer_sg), & ! solid-gas eqbln const
281 keq_sl(nrxn_aer_sl), & ! solid-liq eqblm const
282 keq_nh4no3_0, & ! pure lumped nh4no3 const
283 keq_nh4cl_0, & ! pure lumped nh4cl const
284 kp_nh3, & !
285 kp_nh4no3, & !
286 kp_nh4cl !
287
288
289 complex, save :: &
290 ref_index_a(naercomp), & ! refractive index of compounds
291 ri_avg_a(nbin_a_maxd) ! vol avg ref index of bin
292
293
294 !----------------------------------------------------------------------
295 ! mosaic activity coefficient models parameters
296 integer, save :: &
297 izc(ncation), & ! integer charge
298 iza(nanion) ! integer charge
299
300
301 real, save :: &
302 mc(ncation,nbin_a_maxd), & ! mol/kg(water)
303 ma(nanion,nbin_a_maxd), & ! mol/kg(water)
304 mh2o, & ! mol/kg(water)
305 msulf, &
306 zc(ncation), & ! real charge
307 za(nanion), & ! real charge
308 xc(ncation), &
309 xa(nanion), &
310 xh2o, &
311 fc(ncation,nbin_a_maxd), &
312 fa(nanion,nbin_a_maxd), &
313 fh2o, &
314 gam_cation(ncation,nbin_a_maxd), &
315 gam_anion(nanion,nbin_a_maxd), &
316 gh2o, &
317 acation(ncation), &
318 aanion(nanion), &
319 ec(ncation), &
320 ea(nanion), &
321 emc(ncation,ncation), &
322 exa(nanion,nanion), &
323 ix, &
324 ff, &
325 thetahoe(2,2), &
326 dthetahoe(2,2), &
327 k_dash(nbin_a_maxd), &
328 ax, &
329 rho, &
330 bc_a(ncation,nanion), &
331 b1_c_a(ncation,nanion), &
332 alpha_c_a(ncation,nanion), &
333 alpha1_c_a(ncation,nanion), &
334 u1_c_a(ncation,nanion), &
335 v1_c_a(ncation,nanion), &
336 w1_c_a(ncation,nanion), &
337 uc_cp_a(ncation,ncation,nanion), &
338 wc_cp_a(ncation,ncation,nanion), &
339 q1_c_cp_a(ncation,ncation,nanion), &
340 ua_ap_c(nanion,nanion,ncation), &
341 wa_ap_c(nanion,nanion,ncation), &
342 q1_a_ap_c(nanion,nanion,ncation), &
343 xnuc(ncation,nanion), &
344 xnua(nanion,ncation), &
345 gam(nelectrolyte,nbin_a_maxd), &
346 gam_ratio(nbin_a_maxd), &
347 im(nbin_a_maxd), &
348 log_gam0(nelectrolyte), &
349 log_gamz(nelectrolyte,nelectrolyte), &
350 log_gam(nelectrolyte), &
351 gam_nh4no3_0, &
352 gam_nh4cl_0, &
353 activity(nelectrolyte,nbin_a_maxd), &
354 xeq_a(nanion), &
355 xeq_c(ncation), &
356 na_ma(nanion), &
357 nc_mc(ncation), &
358 a_zsr(6,nelectrolyte), & ! binary molality polynomial coeffs
359 b_zsr(nelectrolyte), & ! binary molality coeff
360 aw_min(nelectrolyte), & ! minimum frh at which molality polynomial can be used
361 b_km(5,nelectrolyte), & ! kusik and meissner poly coeffs
362 im_max(nelectrolyte), & ! max valid im for b_km ploy
363 b_mtem(6,nelectrolyte,nelectrolyte) ! mtem poly coeffs
364
365
366 !----------------------------------------------------------------------
367 ! mosaic massbalance variables
368 real, save :: &
369 total_so4_in, &
370 total_no3_in, &
371 total_cl_in, &
372 total_nh4_in, &
373 total_na_in, &
374 total_ca_in, &
375 total_so4, &
376 total_no3, &
377 total_cl, &
378 total_nh4, &
379 total_na, &
380 total_ca, &
381 rel_diff_so4, &
382 rel_diff_no3, &
383 rel_diff_cl, &
384 rel_diff_nh4, &
385 rel_diff_na, &
386 rel_diff_ca, &
387 aersav(naer), &
388 gassav(naer_vol), &
389 tot_so4_in, tot_no3_in, tot_cl_in, tot_nh4_in, &
390 tot_na_in, tot_ca_in, &
391 tot_so4_out,tot_no3_out, tot_cl_out, tot_nh4_out, &
392 tot_na_out, tot_ca_out, &
393 diff_so4, diff_no3, diff_cl, diff_nh4, &
394 diff_na, diff_ca, &
395 reldiff_so4,reldiff_no3, reldiff_cl, reldiff_nh4, &
396 reldiff_na, reldiff_ca, &
397 masbalout_maxreldiff_so4(nbin_a_maxd), &
398 masbalout_maxreldiff_nh4(nbin_a_maxd), &
399 masbalout_maxreldiff_no3(nbin_a_maxd), &
400 masbalout_maxreldiff_cl(nbin_a_maxd), &
401 masbalout_maxreldiff_na(nbin_a_maxd), &
402 masbalout_maxreldiff_ca(nbin_a_maxd)
403
404 integer, save :: &
405 masbalout_err_count(nbin_a_maxd)
406
407 !----------------------------------------------------------------------
408
409
410
411
412 !----------------------------------------------------------------------
413
414
415
416 end module module_data_mosaic_therm