How to use the pcsaft.pcsaft_fugcoef 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
# same composition, but with mixture parameters
    #0 = water, 1 = acetic acid
    m = np.asarray([1.2047, 3.9731])
    s = np.asarray([0, 3.0551])
    e = np.asarray([353.95, 259.15])
    volAB = np.asarray([0.0451, 0.0451])
    eAB = np.asarray([2425.67, 0])
    dipm = np.asarray([0, 3.6])
    dip_num = np.asarray([0, 1])
    k_ij = np.asarray([[0, -0.027],
                       [-0.027, 0]])

    x = np.asarray([0, 1])
    s[0] = 3.8395 + 1.2828*np.exp(-0.0074944*t) - 1.3939*np.exp(-0.00056029*t)
    pyargs = {'m':m, 's':s, 'e':e, 'e_assoc':eAB, 'vol_a':volAB, 'dipm':dipm, 'dip_num':dip_num, 'k_ij':k_ij}
    fugcoef_mix = pcsaft_fugcoef(t, rho, x, pyargs)
    if print_result:
        print('\n##########  Test with furfural  ##########')
        print('pure fugcoef:', fugcoef1[0])
        print('mix fugcoef:', fugcoef_mix[1])
        print('deviation', (fugcoef_mix[1] - fugcoef1[0])/ fugcoef1[0] * 100, '%')
    assert abs((fugcoef_mix[1] - fugcoef1)/ fugcoef1 * 100) < 1e-6

    # Mixture: NaCl in water with random 4th component
    # only parameters for water
    x = np.asarray([1.])
    m = np.asarray([1.2047])
    s = np.asarray([0.])
    e = np.asarray([353.9449])
    volAB = np.asarray([0.0451])
    eAB = np.asarray([2425.67])
github zmeri / PC-SAFT / tests / test_cython.py View on Github external
assert abs((fugcoef_mix[1] - fugcoef1)/ fugcoef1 * 100) < 1e-1

    # Binary mixture: water-furfural
    # only parameters for furfural
    x = np.asarray([1.])
    m = np.asarray([3.9731])
    s = np.asarray([3.0551])
    e = np.asarray([259.15])
    dipm = np.asarray([3.6])
    dip_num = np.asarray([1])
    pyargs = {'m':m, 's':s, 'e':e, 'dipm':dipm, 'dip_num':dip_num}

    t = 400 # K
    p = 34914.37778265716 # Pa
    rho = 10657.129498214763
    fugcoef1 = pcsaft_fugcoef(t, rho, x, pyargs)

    # same composition, but with mixture parameters
    #0 = water, 1 = acetic acid
    m = np.asarray([1.2047, 3.9731])
    s = np.asarray([0, 3.0551])
    e = np.asarray([353.95, 259.15])
    volAB = np.asarray([0.0451, 0.0451])
    eAB = np.asarray([2425.67, 0])
    dipm = np.asarray([0, 3.6])
    dip_num = np.asarray([0, 1])
    k_ij = np.asarray([[0, -0.027],
                       [-0.027, 0]])

    x = np.asarray([0, 1])
    s[0] = 3.8395 + 1.2828*np.exp(-0.0074944*t) - 1.3939*np.exp(-0.00056029*t)
    pyargs = {'m':m, 's':s, 'e':e, 'e_assoc':eAB, 'vol_a':volAB, 'dipm':dipm, 'dip_num':dip_num, 'k_ij':k_ij}
github zmeri / PC-SAFT / tests / test_cython.py View on Github external
eAB = np.asarray([0, 0, 2425.67, 0])
    dipm = np.asarray([0, 0, 0, 1.2])
    dip_num = np.asarray([0, 0, 0, 1])
    k_ij = np.asarray([[0, 0.317, 0, 0],
                       [0.317, 0, -0.25, 0],
                        [0, -0.25, 0, 0],
                        [0, 0, 0, 0]])
    k_ij[0,2] = -0.007981*t + 2.37999
    k_ij[2,0] = -0.007981*t + 2.37999
    z = np.asarray([1., -1., 0., 0])
    dielc = dielc_water(t)

    s[2] = 3.8395 + 1.2828*np.exp(-0.0074944*t) - 1.3939*np.exp(-0.00056029*t)
    pyargs = {'m':m, 's':s, 'e':e, 'e_assoc':eAB, 'vol_a':volAB, 'dipm':dipm, 'dip_num':dip_num, 'k_ij':k_ij, 'z':z, 'dielc':dielc}
    # pyargs = {'m':m, 's':s, 'e':e, 'e_assoc':eAB, 'vol_a':volAB, 'k_ij':k_ij, 'z':z, 'dielc':dielc}
    fugcoef_mix = pcsaft_fugcoef(t, rho, x, pyargs)
    if print_result:
        print('\n##########  Test with water  ##########')
        print('pure fugcoef:', fugcoef1[0])
        print('mix fugcoef:', fugcoef_mix[2])
        print('deviation', (fugcoef_mix[2] - fugcoef1[0])/ fugcoef1[0] * 100, '%')
    assert abs((fugcoef_mix[2] - fugcoef1)/ fugcoef1 * 100) < 1e-1
github zmeri / PC-SAFT / tests / test_cython.py View on Github external
# Mixture: NaCl in water with random 4th component
    # only parameters for water
    x = np.asarray([1.])
    m = np.asarray([1.2047])
    s = np.asarray([0.])
    e = np.asarray([353.9449])
    volAB = np.asarray([0.0451])
    eAB = np.asarray([2425.67])

    t = 298.15 # K
    s[0] = 3.8395 + 1.2828*np.exp(-0.0074944*t) - 1.3939*np.exp(-0.00056029*t)
    pyargs = {'m':m, 's':s, 'e':e, 'e_assoc':eAB, 'vol_a':volAB}

    p = 3153.417688548272 # Pa
    rho = 55320.89616248148
    fugcoef1 = pcsaft_fugcoef(t, rho, x, pyargs)

    # same composition, but with mixture parameters
    # Mixture: NaCl in water with random 4th component
    # 0 = Na+, 1 = Cl-, 2 = H2O, 3 = DIMETHOXYMETHANE
    x = np.asarray([0, 0, 1, 0])
    m = np.asarray([1, 1, 1.2047, 2.8454])
    s = np.asarray([2.8232, 2.7599589, 0., 3.4017])
    e = np.asarray([230.00, 170.00, 353.9449, 234.02])
    volAB = np.asarray([0, 0, 0.0451, 0.0451])
    eAB = np.asarray([0, 0, 2425.67, 0])
    dipm = np.asarray([0, 0, 0, 1.2])
    dip_num = np.asarray([0, 0, 0, 1])
    k_ij = np.asarray([[0, 0.317, 0, 0],
                       [0.317, 0, -0.25, 0],
                        [0, -0.25, 0, 0],
                        [0, 0, 0, 0]])
github zmeri / PC-SAFT / tests / test_cython.py View on Github external
whether parameters for additional compounds are included.
    '''
    # Binary mixture: water-acetic acid
    # only parameters for acetic acid
    x = np.asarray([1.])
    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 = {'m':m, 's':s, 'e':e, 'e_assoc':eAB, 'vol_a':volAB}

    ref = 193261.515187248 # source: DIPPR correlation
    t = 413.5385
    rho = 15107.481234283325
    fugcoef1 = pcsaft_fugcoef(t, rho, x, pyargs)

    # same composition, but with mixture parameters
    #0 = water, 1 = acetic acid
    m = np.asarray([1.2047, 1.3403])
    s = np.asarray([0, 3.8582])
    e = np.asarray([353.95, 211.59])
    volAB = np.asarray([0.0451, 0.075550])
    eAB = np.asarray([2425.67, 3044.4])
    k_ij = np.asarray([[0, -0.127],
                       [-0.127, 0]])

    x = np.asarray([0, 1])
    s[0] = 3.8395 + 1.2828*np.exp(-0.0074944*t) - 1.3939*np.exp(-0.00056029*t)
    pyargs = {'m':m, 's':s, 'e':e, 'e_assoc':eAB, 'vol_a':volAB, 'k_ij':k_ij}
    fugcoef_mix = pcsaft_fugcoef(t, rho, x, pyargs)
    if print_result:
github zmeri / PC-SAFT / tests / test_cython.py View on Github external
fugcoef1 = pcsaft_fugcoef(t, rho, x, pyargs)

    # same composition, but with mixture parameters
    #0 = water, 1 = acetic acid
    m = np.asarray([1.2047, 1.3403])
    s = np.asarray([0, 3.8582])
    e = np.asarray([353.95, 211.59])
    volAB = np.asarray([0.0451, 0.075550])
    eAB = np.asarray([2425.67, 3044.4])
    k_ij = np.asarray([[0, -0.127],
                       [-0.127, 0]])

    x = np.asarray([0, 1])
    s[0] = 3.8395 + 1.2828*np.exp(-0.0074944*t) - 1.3939*np.exp(-0.00056029*t)
    pyargs = {'m':m, 's':s, 'e':e, 'e_assoc':eAB, 'vol_a':volAB, 'k_ij':k_ij}
    fugcoef_mix = pcsaft_fugcoef(t, rho, x, pyargs)
    if print_result:
        print('\n##########  Test with acetic acid  ##########')
        print('pure fugcoef:', fugcoef1[0])
        print('mix fugcoef:', fugcoef_mix[1])
        print('deviation', (fugcoef_mix[1] - fugcoef1[0])/ fugcoef1[0] * 100, '%')
    assert abs((fugcoef_mix[1] - fugcoef1)/ fugcoef1 * 100) < 1e-1

    # Binary mixture: water-furfural
    # only parameters for furfural
    x = np.asarray([1.])
    m = np.asarray([3.9731])
    s = np.asarray([3.0551])
    e = np.asarray([259.15])
    dipm = np.asarray([3.6])
    dip_num = np.asarray([1])
    pyargs = {'m':m, 's':s, 'e':e, 'dipm':dipm, 'dip_num':dip_num}

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