Skip to content

Commit

Permalink
minor bug fix
Browse files Browse the repository at this point in the history
  • Loading branch information
joyxyz1994 committed Aug 13, 2024
1 parent a669658 commit f0809e2
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 7 deletions.
4 changes: 2 additions & 2 deletions qsdsan/sanunits/_junction.py
Original file line number Diff line number Diff line change
Expand Up @@ -893,7 +893,7 @@ def _compile_reactions(self):
atol = self.atol

cmps_asm = ins.components
S_NO_i_COD = cmps_asm.S_NO.i_COD
S_NO_i_COD = -40/14
X_BH_i_N = cmps_asm.X_BH.i_N
X_BA_i_N = cmps_asm.X_BA.i_N
asm_X_I_i_N = cmps_asm.X_I.i_N
Expand Down Expand Up @@ -1054,7 +1054,7 @@ def asm2adm(asm_vals):
S_IN = adm_vals[adm_ions_idx[0]]
S_IC = (asm_charge_tot - S_IN*alpha_IN)/alpha_IC
net_Scat = asm_charge_tot + proton_charge
if net_Scat > 0:
if net_Scat > 0:
S_cat = net_Scat
S_an = 0
else:
Expand Down
5 changes: 1 addition & 4 deletions qsdsan/sanunits/_suspended_growth_bioreactor.py
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ def _init_state(self):

def _update_state(self):
arr = self._state
arr[arr < 2.2e-16] = 0.
arr[arr < 1e-16] = 0.
arr[-1] = sum(ws.state[-1] for ws in self.ins)
if self.split is None: self._outs[0].state = arr
else:
Expand Down Expand Up @@ -364,7 +364,6 @@ def _compile_ODE(self):
i = self.components.index(self._DO_ID)
fixed_DO = self._aeration
def dy_dt(t, QC_ins, QC, dQC_ins):
# QC[QC < 2.2e-16] = 0.
QC[i] = fixed_DO
dydt_cstr(QC_ins, QC, V, _dstate)
if hasexo: QC = np.append(QC, f_exovars(t))
Expand All @@ -376,15 +375,13 @@ def dy_dt(t, QC_ins, QC, dQC_ins):
aer_stoi = aer._stoichiometry
aer_frho = aer.rate_function
def dy_dt(t, QC_ins, QC, dQC_ins):
# QC[QC < 2.2e-16] = 0.
dydt_cstr(QC_ins, QC, V, _dstate)
if hasexo: QC = np.append(QC, f_exovars(t))
_dstate[:-1] += r(QC) + aer_stoi * aer_frho(QC)
if gstrip: _dstate[gas_idx] -= kLa_stripping * (QC[gas_idx] - S_gas_air)
_update_dstate()
else:
def dy_dt(t, QC_ins, QC, dQC_ins):
# QC[QC < 2.2e-16] = 0.
dydt_cstr(QC_ins, QC, V, _dstate)
if hasexo: QC = np.append(QC, f_exovars(t))
_dstate[:-1] += r(QC)
Expand Down
2 changes: 1 addition & 1 deletion tests/test_exposan.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def test_exposan():
from exposan.bsm1 import create_system as create_bsm1_system, biomass_IDs
bsm1_sys = create_bsm1_system()
bsm1_sys.simulate(t_span=(0,10), method='BDF')
print(get_SRT(bsm1_sys, biomass_IDs=biomass_IDs)) # to test the `get_SRT` function
print(get_SRT(bsm1_sys, biomass_IDs=biomass_IDs['asm1'])) # to test the `get_SRT` function

#!!! Will use bsm2 to test the junction models
# from exposan.interface import create_system as create_inter_system
Expand Down

0 comments on commit f0809e2

Please sign in to comment.