Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
'''
y = flash()
Output: Flash object
P = Pressure (Pa)
T = Temperature (K)
Q = Heat input (J/sec)
gamma = Activity coefficients for each compound
inlet = inlet stream name
vapor = vapor outlet stream name
liquid = liquid outlet stream name
'''
self._thermo_obj = True
# create flash object
y = FlashObj()
y.name = self.add_obj('Flash')
if self.sl==0:
raise Exception('Stream level required >=1 for flash calculation')
# names of inlet stream (1) and outlet streams (2)
y.inlet = y.name + '.inlet'
y.vapor = y.name + '.outlet_vap'
y.liquid = y.name + '.outlet_liq'
# pressure
y.P = self.cxn(y.P,101325.0,y.inlet+'.P')
# temperature
y.T = self.cxn(y.T,300.0,y.liquid+'.T',fixed=False)
# heat input
y.Q = self.cxn(y.Q,0.0,y.name+'.Q')
y = flash_column()
Output: Flash object
P = Pressure (Pa)
T = Temperature (K)
Q = Heat input (J/sec)
n = Holdup (kmol)
gamma = Activity coefficients for each compound
inlet = inlet stream name
vapor = vapor outlet stream name
liquid = liquid outlet stream name
'''
self._thermo_obj = True
# create flash_column object
y = FlashObj()
y.name = self.add_obj('Flash_Column')
if self.sl==0:
raise Exception('Stream level required >=1 for flash calculation')
# names of inlet stream (1) and outlet streams (2)
y.inlet = y.name + '.feed'
y.reserve = y.name + '.holdup.reserve'
y.vapor = y.name + '.flash.outlet_vap'
y.liquid = y.name + '.flash.outlet_liq'
# pressure
y.P = self.cxn(y.P,101325.0,y.inlet+'.P')
# temperature
y.T = self.cxn(y.T,300.0,y.liquid+'.T',fixed=False)
# heat input