Example #1
0
def test_sres():
    """Test the residual entropy 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_sres(x, m, s, e, t, den, pyargs)
    print('Toluene, liquid:\t\t', calc, -96.3692, 'J/mol/K')
    den = pcsaft_den(x, m, s, e, t, p, pyargs, phase='vap')
    calc = pcsaft_sres(x, m, s, e, t, den, pyargs)
    print('Toluene, vapor:\t\t', calc, -0.71398, 'J/mol/K')

    # 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_sres(x, m, s, e, t, den, pyargs)
    print('Acetic acid, liquid:\t\t', calc, -98.1127, 'J/mol/K')
    den = pcsaft_den(x, m, s, e, t, p, pyargs, phase='vap')
    calc = pcsaft_sres(x, m, s, e, t, den, pyargs)
    print('Acetic acid, vapor:\t\t', calc, -40.8743, 'J/mol/K')

    # 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_sres(x, m, s, e, t, den, pyargs)
    print('Butyl acetate, liquid:\t', calc, -108.9615, 'J/mol/K')
    den = pcsaft_den(x, m, s, e, t, p, pyargs, phase='vap')
    calc = pcsaft_sres(x, m, s, e, t, den, pyargs)
    print('Butyl acetate, vapor:\t\t', calc, -1.0361, 'J/mol/K')

    return None
Example #2
0
def test_sres():
    """Test the residual entropy 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_sres(x, m, s, e, t, den, pyargs)
    print('Toluene, liquid:\t\t', calc, -96.3692, 'J/mol/K')
    den = pcsaft_den(x, m, s, e, t, p, pyargs, phase='vap')
    calc = pcsaft_sres(x, m, s, e, t, den, pyargs)
    print('Toluene, vapor:\t\t', calc, -0.71398, 'J/mol/K')
    
    # 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_sres(x, m, s, e, t, den, pyargs)
    print('Acetic acid, liquid:\t\t', calc, -98.1127, 'J/mol/K')
    den = pcsaft_den(x, m, s, e, t, p, pyargs, phase='vap')
    calc = pcsaft_sres(x, m, s, e, t, den, pyargs)
    print('Acetic acid, vapor:\t\t', calc, -40.8743, 'J/mol/K')
    
    # 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])
    pyargs = {'dipm':dpm, 'dip_num':dip_num}
    
    den = pcsaft_den(x, m, s, e, t, p, pyargs, phase='liq')
    calc = pcsaft_sres(x, m, s, e, t, den, pyargs)
    print('Dimethyl ether, liquid:\t', calc, -75.2232, 'J/mol/K')
    den = pcsaft_den(x, m, s, e, t, p, pyargs, phase='vap')
    calc = pcsaft_sres(x, m, s, e, t, den, pyargs)
    print('Dimethyl ether, vapor:\t\t', calc, -0.17854, 'J/mol/K')
    
    return None