-
Notifications
You must be signed in to change notification settings - Fork 0
/
parametric_residence.py
55 lines (45 loc) · 1.97 KB
/
parametric_residence.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
import uvrct as uv
uv.plt.style.use('seaborn-pastel')
uv.plt.rcParams['axes.labelsize'] = 18
uv.plt.rcParams['legend.fontsize'] = 14
uv.plt.rcParams['xtick.labelsize'] = 14
uv.plt.rcParams['ytick.labelsize'] = 14
uv.plt.rcParams['figure.autolayout'] = True
def run_cstr_uv(mech, T, P, C, case_variables, sim_variables, model):
gas = uv.set_gas(mech, T, P, C)
P, eff, L, r_outer, r_inner, ncr, ncz = case_variables
V_r = uv.reactor_volume(L, r_outer, r_inner)
p_valve_coeff, max_p_rise, residence_t, max_simulation_t = sim_variables
time_history = uv.run_simulation(gas, V_r, residence_t, p_valve_coeff, case_variables,
max_simulation_t, model=model)
# Calculate SO2 removal rate
removal_so2 = (
1-(time_history['SO2'].iloc[-1]/time_history['SO2'].iloc[0]))*100
return removal_so2
if __name__ == "__main__":
# Defining simulation variables
initial_SO2_concentration = 300/1e6
molarity_ratios = uv.np.linspace(0, 1, 21)
mech = 'data/photolysis.cti'
T = 298
P = uv.ct.one_atm
case_variables = [17, 0.33, 0.28, 0.0425, 0.0115, 15, 15]
sim_variables = [0.01, 0.01, 0, 100000]
model = 'LSI'
residence_times = [1, 10, 100, 1000, 10000]
uv.plt.figure()
for rt in residence_times:
removal_so2 = []
for molarity_ratio in molarity_ratios:
C = {'N2': 0.78054 - (initial_SO2_concentration * (1 + molarity_ratio)),
'O2' : 0.20946,
'O3' : initial_SO2_concentration*molarity_ratio,
'SO2': initial_SO2_concentration,
'H2O': 0.01}
sim_variables[2] = rt
removal_so2.append(run_cstr_uv(mech, T, P, C, case_variables, sim_variables, model))
uv.plt.plot(molarity_ratios, removal_so2, '-', label=r'$\tau$='+str(rt), linewidth=2.5)
uv.plt.xlabel('Molarity ratio (O$_3$/SO$_2$)')
uv.plt.ylabel('SO$_2$ removal [%]')
uv.plt.legend(loc='lower right')
uv.plt.show()