Skip to content

Commit

Permalink
minor convinience
Browse files Browse the repository at this point in the history
  • Loading branch information
yoelcortes committed Nov 20, 2024
1 parent 48c0c0a commit 70def1a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
10 changes: 8 additions & 2 deletions biosteam/_unit.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,17 @@ def phenomena_oriented_run(self):
Ts = [i.T for i in outs]
Q = self.Hnet
Unit.run(self)
self._dmol = sum(
new = sum(
[i.mol for i in outs],
-sum([i.mol for i in ins], 0)
)
self._dmol[np.abs(self._dmol) < 1e-9] = 0.
if hasattr(self, '_dmol'):
old = self._dmol
f = bst.PhasePartition.dmol_relaxation_factor
self._dmol = dmol = f * old + (1 - f) * new
else:
self._dmol = dmol = new
self._dmol[np.abs(dmol) < 1e-9] = 0.
self._duty = self.Hnet
Ts_new = [i.T for i in outs]
if all([i == j for i, j in zip(Ts_new, Ts)]): # T constant
Expand Down
2 changes: 1 addition & 1 deletion biosteam/plots/plots.py
Original file line number Diff line number Diff line change
Expand Up @@ -1043,7 +1043,7 @@ def generate_contour_data(
if filterwarnings:
from warnings import filterwarnings
filterwarnings('ignore')
data0 = z_at_xy(x0, y0, *args)
data0 = np.asarray(z_at_xy(x0, y0, *args))
shape = data0.shape
if len(shape) == 1:
shape = f"({shape[0]})"
Expand Down

0 comments on commit 70def1a

Please sign in to comment.