Skip to content

Commit

Permalink
extra spin up option
Browse files Browse the repository at this point in the history
spin up can now be done over just the time period of the simulation and just over one run, i.e. without needing to iterate to reach 10 % agreement in RO2 pool value
  • Loading branch information
simonom committed Nov 25, 2024
1 parent 04b0bdb commit ca47c9b
Show file tree
Hide file tree
Showing 48 changed files with 71,513 additions and 1,989 deletions.
Binary file modified PyCHAM/__pycache__/accom_coeff_calc.cpython-39.pyc
Binary file not shown.
Binary file modified PyCHAM/__pycache__/cham_up.cpython-39.pyc
Binary file not shown.
Binary file modified PyCHAM/__pycache__/def_mod_var.cpython-39.pyc
Binary file not shown.
Binary file modified PyCHAM/__pycache__/dydt_rec.cpython-39.pyc
Binary file not shown.
Binary file modified PyCHAM/__pycache__/eqn_pars.cpython-39.pyc
Binary file not shown.
Binary file modified PyCHAM/__pycache__/gui.cpython-39.pyc
Binary file not shown.
Binary file modified PyCHAM/__pycache__/hyst_eq.cpython-39.pyc
Binary file not shown.
Binary file modified PyCHAM/__pycache__/init_conc.cpython-39.pyc
Binary file not shown.
Binary file modified PyCHAM/__pycache__/middle.cpython-39.pyc
Binary file not shown.
Binary file modified PyCHAM/__pycache__/mod_var_read.cpython-39.pyc
Binary file not shown.
Binary file modified PyCHAM/__pycache__/obs_file_open.cpython-39.pyc
Binary file not shown.
Binary file modified PyCHAM/__pycache__/ode_solv.cpython-39.pyc
Binary file not shown.
Binary file modified PyCHAM/__pycache__/ode_solv_wat.cpython-39.pyc
Binary file not shown.
Binary file modified PyCHAM/__pycache__/ode_updater.cpython-39.pyc
Binary file not shown.
Binary file modified PyCHAM/__pycache__/ode_updater_su.cpython-39.pyc
Binary file not shown.
Binary file modified PyCHAM/__pycache__/partit_var.cpython-39.pyc
Binary file not shown.
Binary file modified PyCHAM/__pycache__/plotter_ct.cpython-39.pyc
Binary file not shown.
Binary file modified PyCHAM/__pycache__/pp_dursim.cpython-39.pyc
Binary file not shown.
Binary file modified PyCHAM/__pycache__/pp_intro.cpython-39.pyc
Binary file not shown.
Binary file modified PyCHAM/__pycache__/rate_coeffs.cpython-39.pyc
Binary file not shown.
Binary file modified PyCHAM/__pycache__/retr_out.cpython-39.pyc
Binary file not shown.
11 changes: 10 additions & 1 deletion PyCHAM/cham_up.py
Original file line number Diff line number Diff line change
Expand Up @@ -542,7 +542,6 @@ def cham_up(sumt, Pnow,

# index for mole fraction of seed particles
self.seedx_tcnt = seedt_cnt

[y[num_comp:num_comp*(num_sb-self.wall_on+1)],
N_perbin, _,_] = pp_dursim.pp_dursim(
yp0, N_perbin0, mean_radn, pconcn, lowsize,
Expand Down Expand Up @@ -861,6 +860,16 @@ def cham_up(sumt, Pnow,
if (ic_red == 1 and bc_red == 0):
bc_red = 1

# if equilibrium gas-particle partitioning turned on
if (self.equi_gtop_partit == 1):
# effective saturation concentrations of
# components (ug/m3)
# eq. 1 of O'Meara et al. (2014)
# doi.org/10.1039/C4CP00857J
self.Cstar = (10.**6*y_mw.reshape(1, -1)*
self.Psat_Pa/
(8.314*temp_now))

return(temp_now, Pnow, light_time_cnt, tnew, bc_red, update_count,
Cinfl_now, seedt_cnt, Cfactor, infx_cnt, gasinj_cnt, DStar_org, y, tempt_cnt,
RHt_cnt, N_perbin, x, pconcn_frac, pcontf, tot_in_res, self)
9 changes: 7 additions & 2 deletions PyCHAM/def_mod_var.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,9 @@ def def_mod_var(caller, self): # define function
# known to partition inside
# prop_calc.py and volat_calc.py
self.inorg_part_flag = 0
# whether (1) or not (0) to treat gas-particle paritioning as equilibrium, i.e.
# not dynamic partitioning
self.equi_gtop_partit = 0

# gas inputs ------------------------------------------------------------
# chemical scheme name of components present initially
Expand All @@ -164,8 +167,10 @@ def def_mod_var(caller, self): # define function
self.con_infl_tf = 0

# chemical scheme name of components with constant concentration
self.const_comp = []
# Chemical scheme names of components injected instantaneously after start of experiment
self.const_comp = np.zeros((0, 0)).astype('str')
# times that constant concentration applies to
self.const_compt = np.zeros((1)).astype('float')
# chemical scheme names of components injected instantaneously after start of experiment
Compt = []
# times at which instantaneous injection of component(s) occur after
# experiment start (s)
Expand Down
2 changes: 1 addition & 1 deletion PyCHAM/dydt_rec.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
# changes due to gas-phase photochemistry and partitioning are included;
# generated in init_conc and treats loss from gas-phase as negative

# File Created at 2024-11-18 11:42:12.348731
# File Created at 2024-11-25 13:30:41.338052

import numpy as np

Expand Down
58 changes: 34 additions & 24 deletions PyCHAM/eqn_pars.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,8 @@ def extr_mech(int_tol, num_sb, drh_str, erh_str, self):
# get index of components with continuous influx/concentration -----------
# empty array for storing index of components with constant influx
self.con_infl_indx = np.zeros((len(self.con_infl_nam)))
self.con_C_indx = np.zeros((len(self.const_comp))).astype('int')
self.con_C_indx = np.zeros((self.const_comp.shape[0],
self.const_comp.shape[1])).astype('int')
delete_row_list = [] # prepare for removing rows of unrecognised components

icon = 0 # count on constant influxes
Expand Down Expand Up @@ -185,29 +186,38 @@ def extr_mech(int_tol, num_sb, drh_str, erh_str, self):
self.con_infl_nam = (self.con_infl_nam[si])

# components with constant concentration
for i in range (len(self.const_comp)):
try:
# index of where constant concentration components occur in list
# of components
self.con_C_indx[i] = self.comp_namelist.index(self.const_comp[i])
except:
# if water then we know it will be the next
# component to
# be appended to the component list
if (self.const_comp[i] == 'H2O'):
self.con_C_indx[i] = len(
self.comp_namelist)
else: # if not water
erf = 1 # raise error
err_mess = str('''Error: constant
concentration
component with name ''' +
str(self.const_comp[i]) + '''
has not been identified in the
chemical scheme,
please check it is present and the
chemical scheme markers are correct''')

for i in range(self.const_comp.shape[0]):
for it in range(self.const_comp.shape[1]):
try:
# index of where constant concentration components occur in list
# of components
self.con_C_indx[i, it] = self.comp_namelist.index(
self.const_comp[i, it])

except:
# if a component doesn't appear at a given time then provide
# a marker for no component
if (self.const_comp[i, it] == ''):
self.con_C_indx[i, it] = -1e6
continue

# if water then we know it will be the next
# component to
# be appended to the component list
if (self.const_comp[i, it] == 'H2O'):
self.con_C_indx[i] = len(
self.comp_namelist)
else: # if not water
erf = 1 # raise error
err_mess = str('''Error: constant
concentration
component with name ''' +
str(self.const_comp[i]) + '''
has not been identified in the
chemical scheme,
please check it is present and the
chemical scheme markers are correct''')

# -------------------------------------------------------------
# check if water in continuous influx components
if ('H2O' in self.con_infl_nam):
Expand Down
2 changes: 1 addition & 1 deletion PyCHAM/err_log.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
/Users/user/Documents/GitHub/PyCHAM/PyCHAM/output/mcmAP_scheme/20Nov_0900_0959_Base
/Users/user/Documents/GitHub/PyCHAM/PyCHAM/output/AP_BZ_MCM_PRAMAP_autoAPRAMBZ_scheme/method_ex_dynpart_1.e-8zpc_1e3inttol_RO2pool
4 changes: 2 additions & 2 deletions PyCHAM/gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -1343,7 +1343,8 @@ def SECtab(self): # more detailed plotting tab definition
# drop down button to select units for change tendencies
self.b220e = QComboBox(self)
self.b220e.addItem('Molar Mass (g/mol)')
self.b220e.addItem('Pure component saturation vapour pressure at starting temperature of simulation (Pa)')
self.b220e.addItem(str('Pure component saturation vapour pressure at ' +
'starting temperature of simulation (Pa)'))
self.b220e.addItem('Pure component saturation vapour pressure at 298.15 K (Pa)')
self.SEClayout.addWidget(self.b220e, 8, 2, 1, 1)

Expand Down Expand Up @@ -3503,7 +3504,6 @@ def on_click220c(self):
def on_click220d(self):

self.dir_path = self.l201.text() # name of folder with results

# get name of single component
self.mm_comp_name = self.e218c.text().strip()

Expand Down
2 changes: 1 addition & 1 deletion PyCHAM/hyst_eq.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
##########################################################################################
'''solution of deliquescence and efflorescence RH, generated by eqn_pars.py in fully functioning mode, or by ui_check.py in testing mode'''
# module to estimate deliquescence and efflorescence relative humidity as a function of temperature
# File Created at 2024-11-18 11:42:12.349062
# File Created at 2024-11-25 13:30:41.256636

# function for deliquescence
def drh(TEMP):
Expand Down
Binary file modified PyCHAM/input/.DS_Store
Binary file not shown.
Loading

0 comments on commit ca47c9b

Please sign in to comment.