Skip to content

Commit

Permalink
minor improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
cortespea committed Dec 18, 2023
1 parent 41c2c9a commit 1028173
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
4 changes: 2 additions & 2 deletions thermosteam/_multi_stream.py
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ def __init__(self,
if vlle: self.vlle(T, P)

@classmethod
def from_streams(cls, streams):
def from_streams(cls, streams, thermo=None):
if not streams: raise ValueError('at least one stream must be passed')
self = cls.__new__(cls)
self._streams = streams_by_phase = {i.phase: i for i in streams}
Expand All @@ -264,7 +264,7 @@ def from_streams(cls, streams):
self.characterization_factors = {}
self._thermal_condition = base._thermal_condition
for i in others: i._thermal_condition = base._thermal_condition
self._load_thermo(base.thermo)
self._load_thermo(thermo or base.thermo)
self.price = 0
self._imol = MolarFlowIndexer.from_data(
[streams_by_phase[i]._imol.data for i in phases], phases,
Expand Down
4 changes: 3 additions & 1 deletion thermosteam/_stream.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@
import biosteam as bst
# from .constants import g

MaterialIndexer = tmo.indexer.MaterialIndexer

__all__ = ('Stream',)

# %% Utilities
Expand Down Expand Up @@ -1632,7 +1634,7 @@ def copy_like(self, other):
flow (kg/hr): Water 2
"""
if isinstance(other, tmo.MultiStream):
if isinstance(other.imol, MaterialIndexer):
phases = other.phases
if len(phases) == 1:
phase, = phases
Expand Down
2 changes: 1 addition & 1 deletion thermosteam/equilibrium/dew_point.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def x_iter(x, x_gamma, T, P, f_gamma, gamma_args):
except:
return x
if (x < 0).any():
raise Exception('liquid phase composition is infeasible')
return x
mask = x > 1e3
if mask.any():
x[mask] = 1e3 + np.log(x[mask] / 1e3) # Avoid crazy numbers
Expand Down

0 comments on commit 1028173

Please sign in to comment.