How to use the pcsaft.pcsaft_ares 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
# 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 = {'m':m, 's':s, 'e':e, 'dipm':dpm, 'dip_num':dip_num}

    p = 100000.
    t = 370.

    rho = pcsaft_den(t, p, x, pyargs, phase='liq')
    dadt_eos = pcsaft_dadt(t, rho, x, pyargs)

    # calculating numerical derivative
    der1 = pcsaft_ares(t-1, rho, x, pyargs)
    der2 = pcsaft_ares(t+1, rho, x, pyargs)
    dadt_num = (der2-der1)/2.
    if print_result:
        print('\n##########  Test with dimethyl ether  ##########')
        print('    Numerical derivative:', dadt_num)
        print('    PC-SAFT derivative:', dadt_eos)
        print('    Relative deviation:', (dadt_eos-dadt_num)/dadt_num*100, '%')
    assert abs((dadt_eos-dadt_num)/dadt_num*100) < 2e-2

    # Aqueous NaCl
    # 0 = Na+, 1 = Cl-, 2 = H2O
    x = np.asarray([0.0907304774758426, 0.0907304774758426, 0.818539045048315])
    m = np.asarray([1, 1, 1.2047])
    s = np.asarray([2.8232, 2.7599589, 0.])
    e = np.asarray([230.00, 170.00, 353.9449])
    volAB = np.asarray([0, 0, 0.0451])
github zmeri / PC-SAFT / tests / test_cython.py View on Github external
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 = {'m':m, 's':s, 'e':e, 'dipm':dpm, 'dip_num':dip_num}

    p = 100000.
    t = 370.

    rho = pcsaft_den(t, p, x, pyargs, phase='liq')
    dadt_eos = pcsaft_dadt(t, rho, x, pyargs)

    # calculating numerical derivative
    der1 = pcsaft_ares(t-1, rho, x, pyargs)
    der2 = pcsaft_ares(t+1, rho, x, pyargs)
    dadt_num = (der2-der1)/2.
    if print_result:
        print('\n##########  Test with dimethyl ether  ##########')
        print('    Numerical derivative:', dadt_num)
        print('    PC-SAFT derivative:', dadt_eos)
        print('    Relative deviation:', (dadt_eos-dadt_num)/dadt_num*100, '%')
    assert abs((dadt_eos-dadt_num)/dadt_num*100) < 2e-2

    # Aqueous NaCl
    # 0 = Na+, 1 = Cl-, 2 = H2O
    x = np.asarray([0.0907304774758426, 0.0907304774758426, 0.818539045048315])
    m = np.asarray([1, 1, 1.2047])
    s = np.asarray([2.8232, 2.7599589, 0.])
    e = np.asarray([230.00, 170.00, 353.9449])
    volAB = np.asarray([0, 0, 0.0451])
    eAB = np.asarray([0, 0, 2425.67])

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