Stream¶
-
class
thermosteam.
Stream
(ID='', flow=(), phase='l', T=298.15, P=101325.0, units='kmol/hr', price=0.0, thermo=None, **chemical_flows)[source]¶ Create a Stream object that defines material flow rates along with its thermodynamic state. Thermodynamic and transport properties of a stream are available as properties, while thermodynamic equilbrium (e.g. VLE, and bubble and dew points) are available as methods.
- Parameters
ID='' (str) – A unique identification. If ID is None, stream will not be registered. If no ID is given, stream will be registered with a unique ID.
flow=() (Iterable[float]) – All flow rates corresponding to chemical IDs.
phase='l' ('l', 'g', or 's') – Either gas (g), liquid (l), or solid (s).
T=298.15 (float) – Temperature [K].
P=101325 (float) – Pressure [Pa].
units='kmol/hr' (str) – Flow rate units of measure (only mass, molar, and volumetric flow rates are valid).
price=0 (float) – Price per unit mass [USD/kg].
thermo=None (Thermo) – Thermo object to initialize input and output streams. Defaults to biosteam.settings.get_thermo().
**chemical_flows (float) – ID - flow pairs.
Examples
Before creating a stream, first set the chemicals:
>>> import thermosteam as tmo >>> tmo.settings.set_thermo(['Water', 'Ethanol'])
Create a stream, defining the thermodynamic condition and flow rates:
>>> s1 = tmo.Stream(ID='s1', ... Water=20, Ethanol=10, units='kg/hr', ... T=298.15, P=101325, phase='l') >>> s1.show(flow='kg/hr') # Use the show method to select units of display Stream: s1 phase: 'l', T: 298.15 K, P: 101325 Pa flow (kg/hr): Water 20 Ethanol 10
All flow rates are stored as an array in the mol attribute:
>>> s1.mol # Molar flow rates [kmol/hr] array([1.11 , 0.217])
Mass and volumetric flow rates are available as property arrays:
>>> s1.mass property_array([<Water: 20 kg/hr>, <Ethanol: 10 kg/hr>]) >>> s1.vol property_array([<Water: 0.02006 m^3/hr>, <Ethanol: 0.012722 m^3/hr>])
These arrays work just like ordinary arrays, but the data is linked to the molar flows:
>>> # Mass flows are always up to date with molar flows >>> s1.mol[0] = 1 >>> s1.mass[0] <Water: 18.015 kg/hr> >>> # Changing mass flows changes molar flows >>> s1.mass[0] *= 2 >>> s1.mol[0] 2.0 >>> # Property arrays act just like normal arrays >>> s1.mass + 2 array([38.031, 12. ])
The temperature, pressure and phase are attributes as well:
>>> (s1.T, s1.P, s1.phase) (298.15, 101325, 'l')
The most convinient way to get and set flow rates is through the get_flow and set_flow methods:
>>> # Set flow >>> s1.set_flow(1, 'gpm', 'Water') >>> s1.get_flow('gpm', 'Water') 1.0 >>> # Set multiple flows >>> s1.set_flow([10, 20], 'kg/hr', ('Ethanol', 'Water')) >>> s1.get_flow('kg/hr', ('Ethanol', 'Water')) array([10., 20.])
It is also possible to index using IDs through the imol, imass, and ivol indexers:
>>> s1.imol.show() ChemicalMolarFlowIndexer (kmol/hr): (l) Water 1.11 Ethanol 0.2171 >>> s1.imol['Water'] 1.1101687012358397 >>> s1.imol['Ethanol', 'Water'] array([0.217, 1.11 ])
Thermodynamic properties are available as stream properties:
>>> s1.H # Enthalpy (kJ/hr) 0.0
Note that the reference enthalpy is 0.0 at the reference temperature of 298.15 K, and pressure of 101325 Pa. Retrive the enthalpy at a 10 degC above the reference.
>>> s1.T += 10 >>> s1.H 1083.4675869330183
Other thermodynamic properties are temperature and pressure dependent as well:
>>> s1.rho # Density [kg/m3] 908.8914226175468
It may be more convinient to get properties with different units:
>>> s1.get_property('rho', 'g/cm3') 0.9088914226175471
It is also possible to set some of the properties in different units:
>>> s1.set_property('T', 40, 'degC') >>> s1.T 313.15
Bubble point and dew point computations can be performed through stream methods:
>>> bp = s1.bubble_point_at_P() # Bubble point at constant pressure >>> bp BubblePointValues(T=357.0881141715846, P=101325, IDs=('Water', 'Ethanol'), z=[0.836 0.164], y=[0.49 0.51])
The bubble point results contain all results as attributes:
>>> bp.T # Temperature [K] 357.0881141715846 >>> bp.y # Vapor composition array([0.49, 0.51])
Vapor-liquid equilibrium can be performed by setting 2 degrees of freedom from the following list: T [Temperature; in K], P [Pressure; in Pa], V [Vapor fraction], H [Enthalpy; in kJ/hr].
Set vapor fraction and pressure of the stream:
>>> s1.vle(P=101325, V=0.5) >>> s1.show() MultiStream: s1 phases: ('g', 'l'), T: 364.8 K, P: 101325 Pa flow (kmol/hr): (g) Water 0.4721 Ethanol 0.1916 (l) Water 0.6381 Ethanol 0.02552
Note that the stream is a now a MultiStream to manage multiple phases. Each phase can be accessed separately too:
>>> s1['l'].show() Stream: phase: 'l', T: 364.8 K, P: 101325 Pa flow (kmol/hr): Water 0.638 Ethanol 0.0255
>>> s1['g'].show() Stream: phase: 'g', T: 364.8 K, P: 101325 Pa flow (kmol/hr): Water 0.472 Ethanol 0.192
-
display_units
= DisplayUnits(T='K', P='Pa', flow='kmol/hr', composition=False, N=7)¶ [DisplayUnits] Units of measure for IPython display (class attribute)
-
property
vapor_fraction
¶ Molar vapor fraction.
-
get_flow
(units, key=Ellipsis)[source]¶ Return an flow rates in requested units.
- Parameters
units (str) – Units of measure.
key (tuple[str] or str, optional) – Chemical identifiers.
Examples
>>> import thermosteam as tmo >>> tmo.settings.set_thermo(['Water', 'Ethanol']) >>> s1 = tmo.Stream('s1', Water=20, Ethanol=10, units='kg/hr') >>> s1.get_flow('kg/hr', 'Water') 20.0
-
set_flow
(data, units, key=Ellipsis)[source]¶ Set flow rates in given units.
- Parameters
data (1d ndarray or float) – Flow rate data.
units (str) – Units of measure.
key (Iterable[str] or str, optional) – Chemical identifiers.
Examples
>>> import thermosteam as tmo >>> tmo.settings.set_thermo(['Water', 'Ethanol']) >>> s1 = tmo.Stream(ID='s1', Water=20, Ethanol=10, units='kg/hr') >>> s1.set_flow(10, 'kg/hr', 'Water') >>> s1.get_flow('kg/hr', 'Water') 10.0
-
get_total_flow
(units)[source]¶ Get total flow rate in given units.
- Parameters
units (str) – Units of measure.
Examples
>>> import thermosteam as tmo >>> tmo.settings.set_thermo(['Water', 'Ethanol']) >>> s1 = tmo.Stream('s1', Water=20, Ethanol=10, units='kg/hr') >>> s1.get_total_flow('kg/hr') 30.0
-
set_total_flow
(value, units)[source]¶ Set total flow rate in given units keeping the composition constant.
- Parameters
value (float) – New total flow rate.
units (str) – Units of measure.
Examples
>>> import thermosteam as tmo >>> tmo.settings.set_thermo(['Water', 'Ethanol']) >>> s1 = tmo.Stream('s1', Water=20, Ethanol=10, units='kg/hr') >>> s1.set_total_flow(1.0,'kg/hr') >>> s1.get_total_flow('kg/hr') 0.9999999999999999
-
get_property
(name, units)[source]¶ Return property in requested units.
- Parameters
name (str) – Name of stream property.
units (str) – Units of measure.
Examples
>>> import thermosteam as tmo >>> tmo.settings.set_thermo(['Water', 'Ethanol']) >>> s1 = tmo.Stream('s1', Water=20, Ethanol=10, units='kg/hr') >>> s1.get_property('sigma', 'N/m') # Surface tension 0.06384967976396348
-
set_property
(name, value, units)[source]¶ Set property in given units.
- Parameters
name (str) – Name of stream property.
value (str) – New value of stream property.
units (str) – Units of measure.
Examples
>>> import thermosteam as tmo >>> tmo.settings.set_thermo(['Water', 'Ethanol']) >>> s1 = tmo.Stream('s1', Water=20, Ethanol=10, units='kg/hr') >>> s1.set_property('P', 2, 'atm') >>> s1.P 202650.0
-
property
source
¶ [Unit] Outlet location.
-
property
sink
¶ [Unit] Inlet location.
-
property
thermal_condition
¶ [ThermalCondition] Contains the temperature and pressure conditions of the stream.
-
property
T
¶ [float] Temperature in Kelvin.
-
property
P
¶ [float] Pressure in Pascal.
-
property
phase
¶ Phase of stream.
-
property
mol
¶ [array] Molar flow rates in kmol/hr.
-
property
mass
¶ [property_array] Mass flow rates in kg/hr.
-
property
vol
¶ [property_array] Volumetric flow rates in m3/hr.
-
property
imol
¶ [Indexer] Flow rate indexer with data in kmol/hr.
-
property
imass
¶ [Indexer] Flow rate indexer with data in kg/hr.
-
property
ivol
¶ [Indexer] Flow rate indexer with data in m3/hr.
-
property
cost
¶ [float] Total cost of stream in USD/hr.
-
property
F_mol
¶ [float] Total molar flow rate in kmol/hr.
-
property
F_mass
¶ [float] Total mass flow rate in kg/hr.
-
property
F_vol
¶ [float] Total volumetric flow rate in m3/hr.
-
property
H
¶ [float] Enthalpy flow rate in kJ/hr.
-
property
S
¶ [float] Entropy flow rate in kJ/hr.
-
property
Hnet
¶ [float] Total enthalpy flow rate (including heats of formation) in kJ/hr.
-
property
Hf
¶ [float] Enthalpy of formation flow rate in kJ/hr.
-
property
LHV
¶ [float] Lower heating value flow rate in kJ/hr.
-
property
HHV
¶ [float] Higher heating value flow rate in kJ/hr.
-
property
Hvap
¶ [float] Enthalpy of vaporization flow rate in kJ/hr.
-
property
C
¶ [float] Heat capacity flow rate in kJ/K/hr.
-
property
z_mol
¶ [1d array] Molar composition.
-
property
z_mass
¶ [1d array] Mass composition.
-
property
z_vol
¶ [1d array] Volumetric composition.
-
property
MW
¶ [float] Overall molecular weight.
-
property
V
¶ [float] Molar volume [m^3/mol].
-
property
kappa
¶ [float] Thermal conductivity [W/m/k].
-
property
Cn
¶ [float] Molar heat capacity [J/mol/K].
-
property
mu
¶ [float] Hydrolic viscosity [Pa*s].
-
property
sigma
¶ [float] Surface tension [N/m].
-
property
epsilon
¶ [float] Relative permittivity [-].
-
property
Cp
¶ [float] Heat capacity [J/g/K].
-
property
alpha
¶ [float] Thermal diffusivity [m^2/s].
-
property
rho
¶ [float] Density [kg/m^3].
-
property
nu
¶ [float] Kinematic viscosity [-].
-
property
Pr
¶ [float] Prandtl number [-].
-
property
available_chemicals
¶ list[Chemical] All chemicals with nonzero flow.
-
in_thermal_equilibrium
(other)[source]¶ Return whether or not stream is in thermal equilibrium with another stream.
Examples
>>> import thermosteam as tmo >>> tmo.settings.set_thermo(['Water', 'Ethanol']) >>> stream = Stream(Water=1, T=300) >>> other = Stream(Water=1, T=300) >>> stream.in_thermal_equilibrium(other) True
-
mix_from
(others)[source]¶ Mix all other streams into this one, ignoring its initial contents.
Examples
>>> import thermosteam as tmo >>> tmo.settings.set_thermo(['Water', 'Ethanol']) >>> s1 = tmo.Stream('s1', Water=20, Ethanol=10, units='kg/hr') >>> s2 = s1.copy() >>> s1.mix_from([s1, s2]) >>> s1.show(flow='kg/hr') Stream: s1 phase: 'l', T: 298.15 K, P: 101325 Pa flow (kg/hr): Water 40 Ethanol 20
-
split_to
(s1, s2, split)[source]¶ Split molar flow rate from this stream to two others given the split fraction or an array of split fractions.
Examples
>>> import thermosteam as tmo >>> chemicals = tmo.Chemicals(['Water', 'Ethanol']) >>> tmo.settings.set_thermo(chemicals) >>> s = tmo.Stream('s', Water=20, Ethanol=10, units='kg/hr') >>> s1 = tmo.Stream('s1') >>> s2 = tmo.Stream('s2') >>> split = chemicals.kwarray(dict(Water=0.5, Ethanol=0.1)) >>> s.split_to(s1, s2, split) >>> s1.show(flow='kg/hr') Stream: s1 phase: 'l', T: 298.15 K, P: 101325 Pa flow (kg/hr): Water 10 Ethanol 1
>>> s2.show(flow='kg/hr') Stream: s2 phase: 'l', T: 298.15 K, P: 101325 Pa flow (kg/hr): Water 10 Ethanol 9
-
link_with
(other, flow=True, phase=True, TP=True)[source]¶ Link with another stream.
- Parameters
other (Stream) –
flow (bool, defaults to True) – Whether to link the flow rate data.
phase (bool, defaults to True) – Whether to link the phase.
TP (bool, defaults to True) – Whether to link the temperature and pressure.
Examples
>>> import thermosteam as tmo >>> tmo.settings.set_thermo(['Water', 'Ethanol']) >>> s1 = tmo.Stream('s1', Water=20, Ethanol=10, units='kg/hr') >>> s2 = tmo.Stream('s2') >>> s2.link_with(s1) >>> s1.mol is s2.mol True >>> s2.thermal_condition is s1.thermal_condition True >>> s1.phase = 'g' >>> s2.phase 'g'
-
unlink
()[source]¶ Unlink stream from other streams.
Examples
>>> import thermosteam as tmo >>> tmo.settings.set_thermo(['Water', 'Ethanol']) >>> s1 = tmo.Stream('s1', Water=20, Ethanol=10, units='kg/hr') >>> s2 = tmo.Stream('s2') >>> s2.link_with(s1) >>> s1.unlink() >>> s2.mol is s1.mol False
-
copy_like
(other)[source]¶ Copy all conditions of another stream.
Examples
>>> import thermosteam as tmo >>> tmo.settings.set_thermo(['Water', 'Ethanol']) >>> s1 = tmo.Stream('s1', Water=20, Ethanol=10, units='kg/hr') >>> s2 = tmo.Stream('s2', Water=2, units='kg/hr') >>> s1.copy_like(s2) >>> s1.show(flow='kg/hr') Stream: s1 phase: 'l', T: 298.15 K, P: 101325 Pa flow (kg/hr): Water 2
-
copy_thermal_condition
(other)[source]¶ Copy thermal conditions (T and P) of another stream.
Examples
>>> import thermosteam as tmo >>> tmo.settings.set_thermo(['Water', 'Ethanol']) >>> s1 = tmo.Stream('s1', Water=2, units='kg/hr') >>> s2 = tmo.Stream('s2', Water=1, units='kg/hr', T=300.00) >>> s1.copy_thermal_condition(s2) >>> s1.show(flow='kg/hr') Stream: s1 phase: 'l', T: 300 K, P: 101325 Pa flow (kg/hr): Water 2
-
copy_flow
(stream, IDs=Ellipsis, *, remove=False, exclude=False)[source]¶ Copy flow rates of stream to self.
- Parameters
stream (Stream) – Flow rates will be copied from here.
IDs=... (Iterable[str], defaults to all chemicals.) – Chemical IDs.
remove=False (bool, optional) – If True, copied chemicals will be removed from stream.
exclude=False (bool, optional) – If True, exclude designated chemicals when copying.
Examples
Initialize streams:
>>> import thermosteam as tmo >>> tmo.settings.set_thermo(['Water', 'Ethanol']) >>> s1 = tmo.Stream('s1', Water=20, Ethanol=10, units='kg/hr') >>> s2 = tmo.Stream('s2')
Copy all flows:
>>> s2.copy_flow(s1) >>> s2.show(flow='kg/hr') Stream: s2 phase: 'l', T: 298.15 K, P: 101325 Pa flow (kg/hr): Water 20 Ethanol 10
Reset and copy just water flow:
>>> s2.empty() >>> s2.copy_flow(s1, 'Water') >>> s2.show(flow='kg/hr') Stream: s2 phase: 'l', T: 298.15 K, P: 101325 Pa flow (kg/hr): Water 20
Reset and copy all flows except water:
>>> s2.empty() >>> s2.copy_flow(s1, 'Water', exclude=True) >>> s2.show(flow='kg/hr') Stream: s2 phase: 'l', T: 298.15 K, P: 101325 Pa flow (kg/hr): Ethanol 10
Cut and paste flows:
>>> s2.copy_flow(s1, remove=True) >>> s1.show() Stream: s1 phase: 'l', T: 298.15 K, P: 101325 Pa flow: 0
-
copy
(ID=None)[source]¶ Return a copy of the stream.
Examples
Create a copy of a new stream:
>>> import thermosteam as tmo >>> tmo.settings.set_thermo(['Water', 'Ethanol']) >>> s1 = tmo.Stream('s1', Water=20, Ethanol=10, units='kg/hr') >>> s1_copy = s1.copy('s1_copy') >>> s1_copy.show(flow='kg/hr') Stream: s1_copy phase: 'l', T: 298.15 K, P: 101325 Pa flow (kg/hr): Water 20 Ethanol 10
Warning
Prices are not copied.
-
flow_proxy
()[source]¶ Return a new stream that shares flow rate data with this one.
Examples
>>> import thermosteam as tmo >>> tmo.settings.set_thermo(['Water', 'Ethanol']) >>> s1 = tmo.Stream('s1', Water=20, Ethanol=10, units='kg/hr') >>> s2 = s1.flow_proxy() >>> s2.mol is s1.mol True
-
proxy
()[source]¶ Return a new stream that shares all data with this one.
Examples
>>> import thermosteam as tmo >>> tmo.settings.set_thermo(['Water', 'Ethanol']) >>> s1 = tmo.Stream('s1', Water=20, Ethanol=10, units='kg/hr') >>> s2 = s1.proxy() >>> s2.imol is s1.imol and s2.thermal_condition is s1.thermal_condition True
-
empty
()[source]¶ Empty stream flow rates.
Examples
>>> import thermosteam as tmo >>> tmo.settings.set_thermo(['Water', 'Ethanol']) >>> s1 = tmo.Stream('s1', Water=20, Ethanol=10, units='kg/hr') >>> s1.empty() >>> s1.F_mol 0.0
-
property
vle
¶ [VLE] An object that can perform vapor-liquid equilibrium on the stream.
-
property
lle
¶ [LLE] An object that can perform liquid-liquid equilibrium on the stream.
-
property
vle_chemicals
¶ list[Chemical] Chemicals cabable of liquid-liquid equilibrium.
-
property
lle_chemicals
¶ list[Chemical] Chemicals cabable of vapor-liquid equilibrium.
-
get_bubble_point
(IDs=None)[source]¶ Return a BubblePoint object capable of computing bubble points.
- Parameters
IDs (Iterable[str], optional) – Chemicals that participate in equilibrium. Defaults to all chemicals in equilibrium.
Examples
>>> import thermosteam as tmo >>> tmo.settings.set_thermo(['Water', 'Ethanol']) >>> s1 = tmo.Stream('s1', Water=20, Ethanol=10, T=350, units='kg/hr') >>> s1.get_bubble_point() BubblePoint([Water, Ethanol])
-
get_dew_point
(IDs=None)[source]¶ Return a DewPoint object capable of computing dew points.
- Parameters
IDs (Iterable[str], optional) – Chemicals that participate in equilibrium. Defaults to all chemicals in equilibrium.
Examples
>>> import thermosteam as tmo >>> tmo.settings.set_thermo(['Water', 'Ethanol']) >>> s1 = tmo.Stream('s1', Water=20, Ethanol=10, T=350, units='kg/hr') >>> s1.get_dew_point() DewPoint([Water, Ethanol])
-
bubble_point_at_T
(T=None, IDs=None)[source]¶ Return a BubblePointResults object with all data on the bubble point at constant temperature.
- Parameters
IDs (Iterable[str], optional) – Chemicals that participate in equilibrium. Defaults to all chemicals in equilibrium.
Examples
>>> import thermosteam as tmo >>> tmo.settings.set_thermo(['Water', 'Ethanol']) >>> s1 = tmo.Stream('s1', Water=20, Ethanol=10, T=350, units='kg/hr') >>> s1.bubble_point_at_T() BubblePointValues(T=350, P=76621.54388128179, IDs=('Water', 'Ethanol'), z=[0.836 0.164], y=[0.486 0.514])
-
bubble_point_at_P
(P=None, IDs=None)[source]¶ Return a BubblePointResults object with all data on the bubble point at constant pressure.
- Parameters
IDs (Iterable[str], optional) – Chemicals that participate in equilibrium. Defaults to all chemicals in equilibrium.
Examples
>>> import thermosteam as tmo >>> tmo.settings.set_thermo(['Water', 'Ethanol']) >>> s1 = tmo.Stream('s1', Water=20, Ethanol=10, T=350, units='kg/hr') >>> s1.bubble_point_at_P() BubblePointValues(T=357.0881141715846, P=101325.0, IDs=('Water', 'Ethanol'), z=[0.836 0.164], y=[0.49 0.51])
-
dew_point_at_T
(T=None, IDs=None)[source]¶ Return a DewPointResults object with all data on the dew point at constant temperature.
- Parameters
IDs (Iterable[str], optional) – Chemicals that participate in equilibrium. Defaults to all chemicals in equilibrium.
Examples
>>> import thermosteam as tmo >>> tmo.settings.set_thermo(['Water', 'Ethanol']) >>> s1 = tmo.Stream('s1', Water=20, Ethanol=10, T=350, units='kg/hr') >>> s1.dew_point_at_T() DewPointValues(T=350, P=48990.56398459762, IDs=('Water', 'Ethanol'), z=[0.836 0.164], x=[0.984 0.016])
-
dew_point_at_P
(P=None, IDs=None)[source]¶ Return a DewPointResults object with all data on the dew point at constant pressure.
- Parameters
IDs (Iterable[str], optional) – Chemicals that participate in equilibrium. Defaults to all chemicals in equilibrium.
Examples
>>> import thermosteam as tmo >>> tmo.settings.set_thermo(['Water', 'Ethanol']) >>> s1 = tmo.Stream('s1', Water=20, Ethanol=10, T=350, units='kg/hr') >>> s1.dew_point_at_P() DewPointValues(T=368.6573659718087, P=101325.0, IDs=('Water', 'Ethanol'), z=[0.836 0.164], x=[0.984 0.016])
-
get_normalized_mol
(IDs)[source]¶ Return normalized molar fractions of given chemicals. The sum of the result is always 1.
- Parameters
IDs (tuple[str]) – IDs of chemicals to be normalized.
Examples
>>> import thermosteam as tmo >>> tmo.settings.set_thermo(['Water', 'Ethanol', 'Methanol']) >>> s1 = tmo.Stream('s1', Water=20, Ethanol=10, Methanol=10, units='kmol/hr') >>> s1.get_normalized_mol(('Water', 'Ethanol')) array([0.667, 0.333])
-
get_normalized_mass
(IDs)[source]¶ Return normalized mass fractions of given chemicals. The sum of the result is always 1.
- Parameters
IDs (tuple[str]) – IDs of chemicals to be normalized.
Examples
>>> import thermosteam as tmo >>> tmo.settings.set_thermo(['Water', 'Ethanol', 'Methanol']) >>> s1 = tmo.Stream('s1', Water=20, Ethanol=10, Methanol=10, units='kg/hr') >>> s1.get_normalized_mass(('Water', 'Ethanol')) array([0.667, 0.333])
-
get_normalized_vol
(IDs)[source]¶ Return normalized mass fractions of given chemicals. The sum of the result is always 1.
- Parameters
IDs (tuple[str]) – IDs of chemicals to be normalized.
Examples
>>> import thermosteam as tmo >>> tmo.settings.set_thermo(['Water', 'Ethanol', 'Methanol']) >>> s1 = tmo.Stream('s1', Water=20, Ethanol=10, Methanol=10, units='m3/hr') >>> s1.get_normalized_vol(('Water', 'Ethanol')) array([0.667, 0.333])
-
get_molar_composition
(IDs)[source]¶ Return molar composition of given chemicals.
- Parameters
IDs (tuple[str]) – IDs of chemicals.
Examples
>>> import thermosteam as tmo >>> tmo.settings.set_thermo(['Water', 'Ethanol', 'Methanol']) >>> s1 = tmo.Stream('s1', Water=20, Ethanol=10, Methanol=10, units='kmol/hr') >>> s1.get_molar_composition(('Water', 'Ethanol')) array([0.5 , 0.25])
-
get_mass_composition
(IDs)[source]¶ Return mass composition of given chemicals.
- Parameters
IDs (tuple[str]) – IDs of chemicals.
Examples
>>> import thermosteam as tmo >>> tmo.settings.set_thermo(['Water', 'Ethanol', 'Methanol']) >>> s1 = tmo.Stream('s1', Water=20, Ethanol=10, Methanol=10, units='kg/hr') >>> s1.get_mass_composition(('Water', 'Ethanol')) array([0.5 , 0.25])
-
property
ID
¶ Unique identification (str). If set as ‘’, it will choose a default ID.
-
get_volumetric_composition
(IDs)[source]¶ Return volumetric composition of given chemicals.
- Parameters
IDs (tuple[str]) – IDs of chemicals.
Examples
>>> import thermosteam as tmo >>> tmo.settings.set_thermo(['Water', 'Ethanol', 'Methanol']) >>> s1 = tmo.Stream('s1', Water=20, Ethanol=10, Methanol=10, units='m3/hr') >>> s1.get_volumetric_composition(('Water', 'Ethanol')) array([0.5 , 0.25])
-
get_concentration
(IDs)[source]¶ Return concentration of given chemicals in kmol/m3.
- Parameters
IDs (tuple[str]) – IDs of chemicals.
Examples
>>> import thermosteam as tmo >>> tmo.settings.set_thermo(['Water', 'Ethanol', 'Methanol']) >>> s1 = tmo.Stream('s1', Water=20, Ethanol=10, Methanol=10, units='m3/hr') >>> s1.get_concentration(('Water', 'Ethanol')) array([27.671, 4.266])
-
property
P_vapor
¶ Vapor pressure of liquid.
-
receive_vent
(other, accumulate=False, fraction=1.0)[source]¶ Receive vapors from another stream as if in equilibrium.
Notes
Disregards energy balance. Assumes liquid composition will not change significantly.
Examples
>>> import thermosteam as tmo >>> chemicals = tmo.Chemicals(['Water', 'Ethanol', 'Methanol', 'N2']) >>> chemicals.N2.at_state(phase='g') >>> tmo.settings.set_thermo(chemicals) >>> s1 = tmo.Stream('s1', N2=10, units='m3/hr', phase='g', T=330) >>> s2 = tmo.Stream('s2', Water=10, Ethanol=2, T=330) >>> s1.receive_vent(s2, accumulate=True) >>> s1.show(flow='kmol/hr') Stream: s1 phase: 'g', T: 330 K, P: 101325 Pa flow (kmol/hr): Water 0.0557 Ethanol 0.0616 N2 0.369
-
property
phases
¶ tuple[str] All phases present.
-
show
(T=None, P=None, flow=None, composition=None, N=None)[source]¶ Print all specifications.
- Parameters
T (str, optional) – Temperature units.
P (str, optional) – Pressure units.
flow (str, optional) – Flow rate units.
composition (bool, optional) – Whether to show composition.
N (int, optional) – Number of compounds to display.
Notes
Default values are stored in Stream.display_units.