How to use the pcsaft.pcsaft_cp function in pcsaft

To help you get started, we’ve selected a few pcsaft examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github zmeri / PC-SAFT / tests / test_cython.py View on Github external
# # print('    Relative deviation:', (calc-ref)/ref*100, '%')

    # 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])
    cnsts = np.asarray([57431., 94494, 895.51, 65065, 2467.4]) # constants for Aly-Lee equation (obtained from DIPPR)
    pyargs = {'m':m, 's':s, 'e':e, 'dipm':dpm, 'dip_num':dip_num}

    ref = 102.2 # source: DIPPR correlation
    p = 100000.
    t = 240.
    rho = pcsaft_den(t, p, x, pyargs, phase='liq')
    calc = pcsaft_cp(t, rho, cnsts, x, pyargs)
    if print_result:
        print('\n##########  Test with dimethyl ether  ##########')
        print('----- Heat capacity at 240 K -----')
        print('    Reference:', ref, 'J mol^-1 K^-1')
        print('    PC-SAFT:', calc, 'J mol^-1 K^-1')
        print('    Relative deviation:', (calc-ref)/ref*100, '%')
    assert abs((calc-ref)/ref*100) < 3
github zmeri / PC-SAFT / tests / test_cython.py View on Github external
print('    Relative deviation:', (calc-ref)/ref*100, '%')
    assert abs((calc-ref)/ref*100) < 3

    # Toluene
    x = np.asarray([1.])
    m = np.asarray([2.8149])
    s = np.asarray([3.7169])
    e = np.asarray([285.69])
    cnsts = np.asarray([58140., 286300, 1440.6, 189800, 650.43]) # constants for Aly-Lee equation (obtained from DIPPR)
    pyargs = {'m':m, 's':s, 'e':e}

    ref = 179.79 # source: Equation of state from Polt et al. (1992) (available at https://webbook.nist.gov/chemistry/fluid/)
    p = 100000.
    t = 370.
    rho = pcsaft_den(t, p, x, pyargs, phase='liq')
    calc = pcsaft_cp(t, rho, cnsts, x, pyargs)
    if print_result:
        print('\n##########  Test with toluene  ##########')
        print('----- Heat capacity at 370 K -----')
        print('    Reference:', ref, 'J mol^-1 K^-1')
        print('    PC-SAFT:', calc, 'J mol^-1 K^-1')
        print('    Relative deviation:', (calc-ref)/ref*100, '%')
    assert abs((calc-ref)/ref*100) < 3

    # # Acetic acid
    # # print('\n##########  Test with 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])
    # cnsts = np.asarray([40200., 136750, 1262, 70030, 569.7]) # constants for Aly-Lee equation (obtained from DIPPR)
github zmeri / PC-SAFT / tests / test_cython.py View on Github external
def test_cp(print_result=False):
    """Test the heat capacity function to see if it is working correctly."""
    # Benzene
    x = np.asarray([1.])
    m = np.asarray([2.4653])
    s = np.asarray([3.6478])
    e = np.asarray([287.35])
    cnsts = np.asarray([55238., 173380, 764.25, 72545, 2445.7]) # constants for Aly-Lee equation (obtained from DIPPR)
    pyargs = {'m':m, 's':s, 'e':e}

    ref = 140.78 # source: Equation of state from Polt et al. (1992) (available at https://webbook.nist.gov/chemistry/fluid/)
    p = 100000.
    t = 330.
    rho = pcsaft_den(t, p, x, pyargs, phase='liq')
    calc = pcsaft_cp(t, rho, cnsts, x, pyargs)
    if print_result:
        print('\n##########  Test with benzene  ##########')
        print('----- Heat capacity at 330 K -----')
        print('    Reference:', ref, 'J mol^-1 K^-1')
        print('    PC-SAFT:', calc, 'J mol^-1 K^-1')
        print('    Relative deviation:', (calc-ref)/ref*100, '%')
    assert abs((calc-ref)/ref*100) < 3

    # Toluene
    x = np.asarray([1.])
    m = np.asarray([2.8149])
    s = np.asarray([3.7169])
    e = np.asarray([285.69])
    cnsts = np.asarray([58140., 286300, 1440.6, 189800, 650.43]) # constants for Aly-Lee equation (obtained from DIPPR)
    pyargs = {'m':m, 's':s, 'e':e}

pcsaft

The PC-SAFT equation of state, including dipole, association and ion terms.

GPL-3.0
Latest version published 2 years ago

Package Health Score

39 / 100
Full package analysis

Similar packages