def test_nitrogen_isothermal_flash(self): # Check the nitrogen-methane testmix at 100K and 101.325kPa ittemp = 100 itpress = 101325 itq = 0.28565156190658192 xcomp = np.array([0.07159525799452401, 0.9284047420054761]) ycomp = np.array([0.6713099814548212, 0.3286900185451789]) mdl = PengRobinson() mix = Mixture(nitrogen_testmix) # Isothermal flash mix = isothermflash(mdl, mix, temperature=ittemp, pressure=itpress) assert_allclose(mix.quality, itq) assert_allclose(mix.composition['liquid'], xcomp) assert_allclose(mix.composition['vapor'], ycomp)
def test_hydrocarbon_isothermal_flash(self): # Check the hydrocarbon testmix at 298K and 101.325kPa ittemp = 298 itpress = 101325 itq = 0.011049882630825729 xcomp = np.array([0.00087042658904387, 0.00494340180198168, 0.01768959253320333, 0.06173402524178485, 0.04350209491558151, 0.20699265644787712, 0.664267802470595]) ycomp = np.array([0.1444436094253236, 0.1443981006680385, 0.14425568308139217, 0.14376355943882044, 0.1439672710866151, 0.1421405346361831, 0.13703124166362632]) mdl = PengRobinson() mix = Mixture(hydrocarbon_testmix) # Isothermal flash with assert_warns(RuntimeWarning): # Initial quality estimate from Raoult's law should be <0 mix = isothermflash(mdl, mix, temperature=ittemp, pressure=itpress) assert_allclose(mix.quality, itq) assert_allclose(mix.composition['liquid'], xcomp) assert_allclose(mix.composition['vapor'], ycomp)