Esempio n. 1
0
def test_hres():
    """Test the residual enthalpy 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_hres(x, m, s, e, t, den, pyargs)
    print('Toluene, liquid:\t\t', calc, -36809.39, 'J/mol')
    den = pcsaft_den(x, m, s, e, t, p, pyargs, phase='vap')
    calc = pcsaft_hres(x, m, s, e, t, den, pyargs)
    print('Toluene, vapor:\t\t', calc, -362.6777, '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_hres(x, m, s, e, t, den, pyargs)
    print('Acetic acid, liquid:\t\t', calc, -38924.64, 'J/mol')
    den = pcsaft_den(x, m, s, e, t, p, pyargs, phase='vap')
    calc = pcsaft_hres(x, m, s, e, t, den, pyargs)
    print('Acetic acid, vapor:\t\t', calc, -15393.63, '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_hres(x, m, s, e, t, den, pyargs)
    print('Butyl acetate, liquid:\t', calc, -43443.19, 'J/mol')
    den = pcsaft_den(x, m, s, e, t, p, pyargs, phase='vap')
    calc = pcsaft_hres(x, m, s, e, t, den, pyargs)
    print('Butyl acetate, vapor:\t\t', calc, -516.4779, 'J/mol')

    return None
Esempio n. 2
0
def test_hres():
    """Test the residual enthalpy 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_hres(x, m, s, e, t, den, pyargs)
    print('Toluene, liquid:\t\t', calc, -36809.39, 'J/mol')
    den = pcsaft_den(x, m, s, e, t, p, pyargs, phase='vap')
    calc = pcsaft_hres(x, m, s, e, t, den, pyargs)
    print('Toluene, vapor:\t\t', calc, -362.6777, '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_hres(x, m, s, e, t, den, pyargs)
    print('Acetic acid, liquid:\t\t', calc, -38924.64, 'J/mol')
    den = pcsaft_den(x, m, s, e, t, p, pyargs, phase='vap')
    calc = pcsaft_hres(x, m, s, e, t, den, pyargs)
    print('Acetic acid, vapor:\t\t', calc, -15393.63, '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])
    pyargs = {'dipm':dpm, 'dip_num':dip_num}
    
    den = pcsaft_den(x, m, s, e, t, p, pyargs, phase='liq')
    calc = pcsaft_hres(x, m, s, e, t, den, pyargs)
    print('Dimethyl ether, liquid:\t', calc, -18242.5, 'J/mol')
    den = pcsaft_den(x, m, s, e, t, p, pyargs, phase='vap')
    calc = pcsaft_hres(x, m, s, e, t, den, pyargs)
    print('Dimethyl ether, vapor:\t\t', calc, -89.6574, 'J/mol')
    
    return None