From f0809e2428104aac21940a789317419a63323ca2 Mon Sep 17 00:00:00 2001 From: Joy Zhang Date: Tue, 13 Aug 2024 16:05:12 -0700 Subject: [PATCH] minor bug fix --- qsdsan/sanunits/_junction.py | 4 ++-- qsdsan/sanunits/_suspended_growth_bioreactor.py | 5 +---- tests/test_exposan.py | 2 +- 3 files changed, 4 insertions(+), 7 deletions(-) diff --git a/qsdsan/sanunits/_junction.py b/qsdsan/sanunits/_junction.py index 8151d17d..85fc14ac 100644 --- a/qsdsan/sanunits/_junction.py +++ b/qsdsan/sanunits/_junction.py @@ -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 @@ -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: diff --git a/qsdsan/sanunits/_suspended_growth_bioreactor.py b/qsdsan/sanunits/_suspended_growth_bioreactor.py index 0b46da8a..5c305a59 100644 --- a/qsdsan/sanunits/_suspended_growth_bioreactor.py +++ b/qsdsan/sanunits/_suspended_growth_bioreactor.py @@ -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: @@ -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)) @@ -376,7 +375,6 @@ 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) @@ -384,7 +382,6 @@ def dy_dt(t, QC_ins, QC, dQC_ins): _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) diff --git a/tests/test_exposan.py b/tests/test_exposan.py index 5be8c89d..5f645ba3 100644 --- a/tests/test_exposan.py +++ b/tests/test_exposan.py @@ -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