def test_gres(): """Test the residual Gibbs energy function to see if it is working correctly.""" print('------ 325 K ------') print('\t\t\t PC-SAFT\t Reference') t = 325 # K p = 101325 # Pa # all reference values are from PC-SAFT implemented in Aspen Plus # Toluene ---------- x = np.asarray([1.]) m = np.asarray([2.8149]) s = np.asarray([3.7169]) e = np.asarray([285.69]) pyargs = {} den = pcsaft_den(x, m, s, e, t, p, pyargs, phase='liq') calc = pcsaft_gres(x, m, s, e, t, den, pyargs) print('Toluene, liquid:\t\t', calc, -5489.384, 'J/mol') den = pcsaft_den(x, m, s, e, t, p, pyargs, phase='vap') calc = pcsaft_gres(x, m, s, e, t, den, pyargs) print('Toluene, vapor:\t\t', calc, -130.6339, 'J/mol') # Acetic acid --------- m = np.asarray([1.3403]) s = np.asarray([3.8582]) e = np.asarray([211.59]) volAB = np.asarray([0.075550]) eAB = np.asarray([3044.4]) pyargs = {'e_assoc': eAB, 'vol_a': volAB} den = pcsaft_den(x, m, s, e, t, p, pyargs, phase='liq') calc = pcsaft_gres(x, m, s, e, t, den, pyargs) print('Acetic acid, liquid:\t\t', calc, -7038.004, 'J/mol') den = pcsaft_den(x, m, s, e, t, p, pyargs, phase='vap') calc = pcsaft_gres(x, m, s, e, t, den, pyargs) print('Acetic acid, vapor:\t\t', calc, -2109.459, 'J/mol') # Butyl acetate --------- m = np.asarray([2.76462805]) s = np.asarray([4.02244938]) e = np.asarray([263.69902915]) dpm = np.asarray([1.84]) dip_num = np.asarray([4.99688339]) pyargs = {'dipm': dpm, 'dip_num': dip_num} den = pcsaft_den(x, m, s, e, t, p, pyargs, phase='liq') calc = pcsaft_gres(x, m, s, e, t, den, pyargs) print('Butyl acetate, liquid:\t', calc, -8030.709, 'J/mol') den = pcsaft_den(x, m, s, e, t, p, pyargs, phase='vap') calc = pcsaft_gres(x, m, s, e, t, den, pyargs) print('Butyl acetate, vapor:\t\t', calc, -179.7519, 'J/mol') return None
def test_gres(): """Test the residual Gibbs energy function to see if it is working correctly.""" print('------ 325 K ------') print('\t\t\t PC-SAFT\t Reference') t = 325 # K p = 101325 # Pa # all reference values are from PC-SAFT implemented in Aspen Plus # Toluene ---------- x = np.asarray([1.]) m = np.asarray([2.8149]) s = np.asarray([3.7169]) e = np.asarray([285.69]) den = pcsaft_den(x, m, s, e, t, p, phase='liq') calc = pcsaft_gres(x, m, s, e, t, den) print('Toluene, liquid:\t\t', calc, -5489.384, 'J/mol') den = pcsaft_den(x, m, s, e, t, p, phase='vap') calc = pcsaft_gres(x, m, s, e, t, den) print('Toluene, vapor:\t\t', calc, -130.6339, 'J/mol') # Acetic acid --------- m = np.asarray([1.3403]) s = np.asarray([3.8582]) e = np.asarray([211.59]) volAB = np.asarray([0.075550]) eAB = np.asarray([3044.4]) den = pcsaft_den(x, m, s, e, t, p, phase='liq', e_assoc=eAB, vol_a=volAB) calc = pcsaft_gres(x, m, s, e, t, den, e_assoc=eAB, vol_a=volAB) print('Acetic acid, liquid:\t\t', calc, -7038.004, 'J/mol') den = pcsaft_den(x, m, s, e, t, p, phase='vap', e_assoc=eAB, vol_a=volAB) calc = pcsaft_gres(x, m, s, e, t, den, e_assoc=eAB, vol_a=volAB) print('Acetic acid, vapor:\t\t', calc, -2109.459, 'J/mol') # dimethyl ether --------- m = np.asarray([2.2634]) s = np.asarray([3.2723]) e = np.asarray([210.29]) dpm = np.asarray([1.3]) dip_num = np.asarray([1.0]) den = pcsaft_den(x, m, s, e, t, p, phase='liq', dipm=dpm, dip_num=dip_num) calc = pcsaft_gres(x, m, s, e, t, den, dipm=dpm, dip_num=dip_num) print('dimethyl ether, liquid:\t', calc, -6205.02, 'J/mol') den = pcsaft_den(x, m, s, e, t, p, phase='vap', dipm=dpm, dip_num=dip_num) calc = pcsaft_gres(x, m, s, e, t, den, dipm=dpm, dip_num=dip_num) print('dimethyl ether, vapor:\t\t', calc, -31.6322, 'J/mol') return None
def gres(x, m, s, e, t=325, p=101325): den = pcsaft_den(x, m, s, e, t, p, phase='liq') calc = pcsaft_gres(x, m, s, e, t, den) return calc