Skip to content

Commit

Permalink
aeration demand estimate helper
Browse files Browse the repository at this point in the history
  • Loading branch information
joyxyz1994 committed Feb 6, 2025
1 parent 4c53fd6 commit f0c9ed9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions qsdsan/sanunits/_membrane_bioreactor.py
Original file line number Diff line number Diff line change
Expand Up @@ -1580,6 +1580,7 @@ def dy_dt(t, QC_ins, QC, dQC_ins):
if hasexo: QC = np.append(QC, f_exovars(t))
_dstate[:-1] += r(QC)
if gstrip: _dstate[gas_idx] -= kLa_stripping * (QC[gas_idx] - S_gas_air)
self._cache_OTR = - _dstate[i]
_dstate[i] = 0
_update_dstate()
else:
Expand Down
5 changes: 5 additions & 0 deletions qsdsan/sanunits/_suspended_growth_bioreactor.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ def __init__(self, ID='', ins=None, outs=(), split=None, thermo=None,
self._concs = None
self._mixed = WasteStream()
self.split = split
self._cache_OTR = None

# # Design parameters
# self._W_tank = W_tank
Expand Down Expand Up @@ -370,6 +371,7 @@ def dy_dt(t, QC_ins, QC, dQC_ins):
if hasexo: QC = np.append(QC, f_exovars(t))
_dstate[:-1] += r(QC)
if gstrip: _dstate[gas_idx] -= kLa_stripping * (QC[gas_idx] - S_gas_air)
self._cache_OTR = - _dstate[i]
_dstate[i] = 0
_update_dstate()
elif isa(aer, Process):
Expand Down Expand Up @@ -961,6 +963,7 @@ def __init__(self, ID='', ins=None, outs=(), thermo=None, init_with='WasteStream
self.gas_stripping = gas_stripping
self._concs = None
self._Qs = self.V_tanks * 0
self._cache_OTR = None

@property
def V_tanks(self):
Expand Down Expand Up @@ -1227,6 +1230,7 @@ def Rs(Cs):
return rxn

if any(DO):
_cache_OTR = self._cache_OTR = np.zeros_like(DO)
aerated_zones = (DO > 0)
aerated_DO = DO[aerated_zones]
# @njit
Expand All @@ -1246,6 +1250,7 @@ def dy_dt(t, QC_ins, QC, dQC_ins):
rxn = Rs(Cs)
dy = np.zeros_like(y)
dy[:,:-1] = _1_ov_V @ (M_ins - M_outs) + rxn
_cache_OTR[aerated_zones] = - dy[aerated_zones, DO_idx]
dy[aerated_zones, DO_idx] = 0.
if gstrip:
S_liq = Cs[:, gas_idx]
Expand Down

0 comments on commit f0c9ed9

Please sign in to comment.