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.21.0)
18 !   05-feb-07 wig - converted reals to double
19 !   10-jan-07 raz - compatible with mosaic.21.0
20 !   19-dec-05 raz - compatible with mosaic.16.4
21 !   27-apr-05 raz - compatible with mosaic.14.3
22 !   07-jan-05 raz - updated and cleaned up variable lists
23 !   08-jul-03 raz - updated many variables
24 !   07-aug-02 rce - this is rahul's latest version from freshair
25 !   19-aug-02 raz - declared mass_soluble_a and kg as real
26 !   07-oct-02 raz - declared zc and za as integer
27 !   09-oct-02 raz - explicitly declared all variables
28 !   29-oct-02 raz - defined naercomp as the total number of aerosol compounds
29 !----------------------------------------------------------------------
30 
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 = number of bins that are used in a run
34 ! (nbin_a is set at run time, and must be <= nbin_a_maxd)
35       integer, save :: nbin_a = 999888777
36 
37 ! mosaic-specific parameters
38       integer ngas_ioa, ngas_soa, ngas_volatile,	&
39               naer, naercomp, nelectrolyte, nsalt,	&
40               nsoluble, ncation, nanion
41       parameter(ngas_ioa = 5)	! inorganic volatile aerosol species that have a gaseous counterpart
42       parameter(ngas_soa = 8)	! volatile soa species that have a gaseous counterpart
43       parameter(ngas_volatile = ngas_ioa + ngas_soa)
44       parameter(naer = 19)	! num of chemical species per bin (inorg + oc + bc + oin + soa)
45       parameter(naercomp = 34)	! num of electrolytes + oc, bc, oin, & soa
46       parameter(nelectrolyte = 22) ! num of electrolytes
47       parameter(nsalt    = 15)	! num of soluble salts
48       parameter(nsoluble = 20)	! num of soluble electrolytes
49       parameter(ncation = 4)	! num of cations
50       parameter(nanion  = 5)	! num of anions
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 mmodal, msection,   &
59               mon, moff, myes, mno
60       parameter(mmodal  = 1)	! modal size distribution framework
61       parameter(msection= 2)	! sectional size distribution framework
62       parameter(mon     = 1)	! flag: on
63       parameter(moff    = 0)    ! flag:off
64       parameter(myes	= mon)	! flag: yes or true
65       parameter(mno	= moff)	! flag: no or false
66 
67 
68       integer jtotal, jsolid, jliquid
69       parameter(jsolid = 1)
70       parameter(jliquid= 2)
71       parameter(jtotal = 3)
72 
73       integer jhyst_lo, jhyst_up
74       parameter(jhyst_lo = 0)	! lower hysteresis leg
75       parameter(jhyst_up = 1) 	! upper hysteresis leg
76 
77       integer no_aerosol, all_solid, all_liquid, mixed
78       parameter(no_aerosol = 0)	! flag
79       parameter(all_solid  = 1) ! flag
80       parameter(all_liquid = 2) ! flag
81       parameter(mixed      = 3)	! flag
82 
83       integer soluble, insoluble
84       parameter(soluble   = 1)  ! flag
85       parameter(insoluble = 2)  ! flag
86 
87       real(kind=8) mass_cutoff
88       parameter(mass_cutoff = 1.d-15)	! ng/m^3
89 
90 
91 !----------------------------------------------------------------------
92 ! mosaic species indices
93 !
94 ! gas
95       integer, save ::   &
96        ih2so4_g,     ihno3_g,      ihcl_g,      inh3_g,   &
97        imsa_g,                                            &
98        iaro1_g,      iaro2_g,      ialk1_g,     iole1_g,  &
99        iapi1_g,      iapi2_g,      ilim1_g,     ilim2_g
100 
101 ! aerosol generic
102       integer, save ::   &
103        iso4_a,     ino3_a,     icl_a,     inh4_a,     ico3_a,  &
104        imsa_a,     ina_a,      ica_a,     ioc_a,      ibc_a,   &
105        ioin_a,     iaro1_a,    iaro2_a,   ialk1_a,    iole1_a, &
106        iapi1_a,    iapi2_a,    ilim1_a,   ilim2_a
107 
108 ! aerosol elecctrolytes/compounds
109       integer, save ::   &
110        jnh4so4,    jlvcite,    jnh4hso4,   jnh4no3,    jnh4cl,  &
111        jna2so4,    jna3hso4,   jnahso4,    jnano3,     jnacl,   &
112        jcaso4,     jcano3,     jcacl2,     jcaco3,     jh2so4,  &
113        jhno3,      jhcl,       jhhso4,                          &
114        jnh4msa,    jnamsa,     jcamsa2,    jmsa,                &
115        joc,        jbc,        join,       jaro1,      jaro2,   &
116        jalk1,      jole1,      japi1,      japi2,      jlim1,   &
117        jlim2,      jh2o
118 
119 ! aerosol ions
120       integer, save ::   			&
121        jc_h,    jc_nh4, jc_na,  jc_ca,		&
122        ja_hso4, ja_so4, ja_no3, ja_cl, ja_msa     ! , ja_co3
123 
124 
125 !----------------------------------------------------------------------
126 ! mosaic variables
127       integer, save ::			&
128 	iclm_aer,			&  ! i-location
129 	jclm_aer,			&  ! j-location
130 	kclm_aer,			&  ! k-location
131 	kclm_aer_calcbgn,		&  ! k-loc for calc. to begin
132 	kclm_aer_calcend,		&  ! k-loc for calc. to end
133 	mclm_aer,			&  ! m-subarea
134 	mgas_aer_xfer,			&  ! flag: mon, moff
135 	mdynamic_solver,		&  ! flag: masteem, masceem
136 	msize_framework,		&  ! flag: mmodal, msectional
137 	jaerosolstate(nbin_a_maxd),	&  ! flag: no_aerosol, all_solid, all_liquid, mixed
138 	jphase(nbin_a_maxd),		&  ! phase index: jtotal, jsolid, jliquid
139 	jhyst_leg(nbin_a_maxd),		&  ! hysteresis leg: jhyst_up, jhyst_lo
140 	iprint_input,			&  ! flag: mon, moff
141 	lunerr_aer,			&  ! 
142 	ncorecnt_aer			   !
143 
144 ! NOTE: Some of the following informational output defaults are overridden in 
145 !       module_mosaic_driver.F based on the internal MOSAIC debug_level setting.
146       integer, save :: istat_mosaic_fe1       
147                        ! "fatal error status" for current problem (grid cell)
148                        ! negative value means a fatal error has occured
149       integer, save :: nfe1_mosaic_cur = 0
150                        ! fatal error count for current host-code time step
151       integer, save :: nfe1_mosaic_tot = 0
152                        ! fatal error count for all time steps
153       integer, save :: iprint_mosaic_fe1 = 1
154                        ! turns on/off output of fatal error diagnostics & counts
155                        !    if iprint_mosaic_fe1 >= 10, mosaic_aerchem_error_dump
156                        !    is called for each fatal error
157       integer, save :: iprint_mosaic_perform_stats = 1 
158                        ! turns on/off output of mosaic performance statistics
159       integer, save :: iprint_mosaic_diag1 = 1 
160                        ! turns on/off output of other warnings & diagnostics
161       integer, save :: iprint_mosaic_input_ok = 1 
162                        ! turns on/off output of mosaic initial values
163                        ! when a serious error occurs
164 
165 
166       real(kind=8), save ::			&
167       	num_a(nbin_a_maxd),		&  ! #/cc(air)
168       	dpgn_a(nbin_a_maxd),		&  ! cm
169       	dp_dry_a(nbin_a_maxd),		&  ! cm
170       	dp_wet_a(nbin_a_maxd),		&  ! cm
171       	area_dry_a(nbin_a_maxd),	&  ! cm^2/cc(air)
172       	area_wet_a(nbin_a_maxd),	&  ! cm^2/cc(air)
173 	mass_dry_salt(nbin_a_maxd),	&  ! g/cc(air)
174       	mass_dry_a(nbin_a_maxd),	&  ! g/cc(air)
175       	mass_wet_a(nbin_a_maxd),	&  ! g/cc(air)
176       	mass_soluble_a(nbin_a_maxd),	&  ! ng/cc(air)
177       	vol_dry_a(nbin_a_maxd),		&  ! cc/cc(air)
178       	vol_wet_a(nbin_a_maxd),		&  ! cc/cc(air)
179       	dens_dry_a(nbin_a_maxd),	&  ! g/cc
180       	dens_wet_a(nbin_a_maxd),	&  ! g/cc
181       	sigmag_a(nbin_a_maxd),		&  ! -
182       	water_a(nbin_a_maxd), 		&  ! kg(water)/m^3(air)
183       	water_a_hyst(nbin_a_maxd),	&  ! kg(water)/m^3(air) hysteresis (at 60% rh)
184       	water_a_up(nbin_a_maxd),	&  ! kg(water)/m^3(air) at 60% rh
185       	ph(nbin_a_maxd),		&  ! ph
186       	aer(naer,3,nbin_a_maxd),	&  ! nmol/m^3
187 	aer_sum(3,nbin_a_maxd),		&  ! nmol/m^3
188       	aer_percent(naer,3,nbin_a_maxd), &  ! %
189       	comp_a(naercomp),		&  ! g/cc(air)
190       	electrolyte(nelectrolyte,3,nbin_a_maxd),   &  ! nmol/m^3
191       	electrolyte_sum(nelectrolyte,nbin_a_maxd), &  ! nmol/m^3
192       	epercent(nelectrolyte,3,nbin_a_maxd),	   &  ! %
193       	gas(ngas_volatile),		&  ! nmol/m^3
194       	ah2o,				&  ! -
195       	ah2o_a(nbin_a_maxd),		&  ! -
196       	dpmv(nbin_a_maxd),		&  ! 
197       	volume_a(nbin_a_maxd),		&  ! 
198 	volume_bin(nbin_a_maxd),	&  ! dry volume of one particle
199       	kelvin(nbin_a_maxd),		&  ! kelvin factor
200 	kel(ngas_volatile,nbin_a_maxd),	&  ! kelvin factor for condensing species
201 	kelvin_nh4no3,			&  ! -
202 	kelvin_nh4cl,			&  ! - 
203 	total_species(ngas_volatile)	   ! 
204 
205 
206 !----------------------------------------------------------------------
207 ! astem variables
208       integer, save ::			&
209 	idry_case3a(nbin_a_maxd),	&  ! mYES, mNO
210 	ieqblm_bin(nbin_a_maxd),	&  ! myes, mno
211 	ieqblm_astem,			&  ! myes, mno
212 	nastem_call,			&  !
213 	nastem_fail,			&  !
214 	isteps_astem,			&  !
215 	nsteps_astem,			&  !
216 	nsteps_astem_max,		&  !
217 	nmax_ASTEM,			&  !
218 	integrate(ngas_volatile,3,nbin_a_maxd)  ! mYES, mNO
219 
220 
221       real(kind=8), save ::				&
222 	po_soa(ngas_volatile),			&  ! pascal
223 	sat_soa(ngas_volatile),			&  ! nmol/m^3(air)
224 	x_soa(naer),				&  ! soa mole fraction
225 	sfc_a(ngas_volatile),			&  ! nmol/m^3
226 	Heff(ngas_volatile,nbin_a_maxd),	&  ! 
227 	kg(ngas_volatile,nbin_a_maxd),		&  ! 1/s
228 	df_gas_s(ngas_volatile,nbin_a_maxd),	&  ! nmol/m^3 (g-g*) = driving force)
229 	df_gas_l(ngas_volatile,nbin_a_maxd),	&  ! nmol/m^3 (g-g*) = driving force)
230 	flux_s(ngas_volatile,nbin_a_maxd),	&  ! nmol/m^3/s
231 	flux_l(ngas_volatile,nbin_a_maxd),	&  ! nmol/m^3/s
232 	sumkg_h2so4,				&  ! 1/s
233 	sumkg_msa,				&  ! 1/s
234 	sumkg_nh3,				&  ! 1/s
235 	sumkg_hno3,				&  ! 1/s
236 	sumkg_hcl,				&  ! 1/s
237 	delta_nh3_max(nbin_a_maxd),		&  ! nmol/m^3
238 	delta_hno3_max(nbin_a_maxd),		&  ! nmol/m^3
239 	delta_hcl_max(nbin_a_maxd),		&  ! nmol/m^3
240 	keq_nh4no3,				&  ! -
241 	keq_nh4cl,				&  ! -
242 	volatile_s(ngas_volatile,nbin_a_maxd), 	&  ! nmol/m^3
243 	phi_volatile_s(ngas_volatile,nbin_a_maxd),	&  ! relative dr. force = (g-g*)/g
244 	phi_volatile_l(ngas_volatile,nbin_a_maxd),	&  ! relative dr. force = (g-g*)/g
245 	phi_nh4no3_s,				&  ! relative dr. force: 0 to 1
246 	phi_nh4cl_s,				&  ! relative dr. force: 0 to 1
247 	sum_vdf_s(ngas_volatile),		&  ! (nmol/m^3)^2
248 	sum_vol_s(ngas_volatile),		&  ! nmol/m^3
249 	sum_bin_s(ngas_volatile),		&  ! number of bins that have flux_s(iv) < 0
250 	avg_df_gas_s(ngas_volatile),		&  ! nmol/m^3
251 	h_s_i_m(ngas_volatile,nbin_a_maxd),	&  ! s
252 	alpha_gas(ngas_volatile),		&  ! - adaptive
253 	alpha_astem,				&  ! 0.01 to 0.05
254 	rtol_eqb_astem,				&  ! 0.01 to 0.03
255 	ptol_mol_astem,				&  ! 0.01 to 1.0
256 	nsteps_astem_avg			   !
257 
258 !----------------------------------------------------------------------
259 ! mesa variables
260       integer, save ::   		&
261       	jsalt_index(nsalt),		&
262       	jsulf_poor(211),		&
263       	jsulf_rich(71),			&
264       	jsalt_present(nsalt),		&
265       	nmax_mesa,			&
266       	nmesa_call,			&
267       	nmesa_fail,			&
268 	iter_mesa(nbin_a_maxd),		&
269 	niter_mesa,			&
270       	niter_mesa_max
271 
272 
273       real(kind=8), save ::   			&
274 	eleliquid(nelectrolyte),	&
275 	flux_sl(nsalt),			&
276 	phi_salt(nsalt),		&
277 	phi_salt_old(nsalt),		&
278 	phi_bar(nsalt),			&
279 	alpha_salt(nsalt),		&
280 	sat_ratio(nsalt),		&
281 	hsalt(nsalt),			&
282 	hsalt_max,			&
283 	frac_salt_liq(nsalt),		&
284 	frac_salt_solid(nsalt),		&
285 	growth_factor(nbin_a_maxd),	&
286 	d_mdrh(63,4),			&  ! mdrh(t) poly coeffs
287 	mdrh(nbin_a_maxd),		&
288 	mdrh_t(63),			&
289 	molality0(nelectrolyte),	&
290 	rtol_mesa,			&
291 	niter_mesa_avg
292 
293 
294 !----------------------------------------------------------------------
295 ! mosaic physico-chemical constants
296       character(len=8), save ::		&
297 	ename(nelectrolyte),		&  ! electrolyte names
298 	aer_name(naer),			&  ! generic aerosol species name
299 	gas_name(ngas_volatile)		   ! gas species name
300 
301       character(len=6), save ::		&
302 	phasestate(4)
303 
304 
305       real(kind=8), save ::			&
306 	t_k,				&  ! temperature (k)
307 	p_atm,				&  ! pressure (atm)
308 	rh_pc,				&  ! relative humidity (%)
309 	cair_mol_cc,			&  ! air conc in mol/cc
310 	cair_mol_m3,			&  ! air conc in mol/m^3
311 	conv1a,				&
312 	conv1b,				&
313 	conv2a,				&
314 	conv2b,				&
315 	mw_electrolyte(nelectrolyte),	&  ! molecular wt of electrolytes
316 	mw_aer_mac(naer),		&  ! molecular wt of generic species
317 	mw_comp_a(naercomp),		&  ! molecular wt of compounds
318 	mw_c(ncation),			&  ! molecular wt of cations
319 	mw_a(nanion),			&  ! molecular wt of anions
320 	dens_electrolyte(nelectrolyte),	&  ! g/cc
321 	dens_aer_mac(naer),		&  ! g/cc
322 	dens_comp_a(naercomp),		&  ! g/cc (density of compounds)
323 	partial_molar_vol(ngas_volatile), & ! cc/mol
324 	sigma_water,			&  ! water surface tension (n/m)
325 	sigma_soln(nbin_a_maxd),	&  ! solution surface tension (n/m)
326 	keq_gl(nrxn_aer_gl),		&  ! gas-liq eqblm const
327 	keq_ll(nrxn_aer_ll),		&  ! liq-liq eqblm const
328 	keq_sg(nrxn_aer_sg),		&  ! solid-gas eqbln const
329 	keq_sl(nrxn_aer_sl), 		&  ! solid-liq eqblm const
330 	kp_nh3, 			&  !
331 	kp_nh4no3, 			&  !
332 	kp_nh4cl			   !
333 
334 
335       complex, save ::			&
336       		ref_index_a(naercomp),	&  ! refractive index of compounds
337       		ri_avg_a(nbin_a_maxd)	   ! vol avg ref index of bin
338 
339 
340 !----------------------------------------------------------------------
341 ! mosaic activity coefficient models parameters
342 
343       real(kind=8), save ::				&
344 	mc(ncation,nbin_a_maxd),		&  ! mol/kg(water)
345 	ma(nanion,nbin_a_maxd),			&  ! mol/kg(water)
346 	msulf,					&  ! 
347 	zc(ncation),				&  ! real charge
348 	za(nanion),				&  ! real charge
349 	gam(nelectrolyte,nbin_a_maxd),		&
350 	gam_ratio(nbin_a_maxd),			&
351 	log_gamz(nelectrolyte,nelectrolyte),	&
352 	log_gam(nelectrolyte),			&
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_mtem(6,nelectrolyte,nelectrolyte)	! mtem poly coeffs
362 
363 
364 !----------------------------------------------------------------------
365 ! mosaic massbalance variables
366       real(kind=8), save ::	&
367 	tot_so4_in,	&
368 	tot_no3_in,	&
369 	tot_cl_in,	&
370 	tot_nh4_in,	&
371 	tot_na_in,	&
372 	tot_ca_in,	&
373 	tot_so4_out,	&
374 	tot_no3_out,	&
375 	tot_cl_out,	&
376 	tot_nh4_out,	&
377 	tot_na_out,	&
378 	tot_ca_out,	&
379 	diff_so4,	&
380 	diff_no3,	&
381 	diff_cl,	&
382 	diff_nh4,	&
383 	diff_na,	&
384 	diff_ca,	&
385 	reldiff_so4,	&
386 	reldiff_no3,	&
387 	reldiff_cl,	&
388 	reldiff_nh4,	&
389 	reldiff_na,	&
390 	reldiff_ca
391 !----------------------------------------------------------------------
392 
393 
394 
395       end module module_data_mosaic_therm