How to use the pcsaft.dielc_water 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
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]])
    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
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])
    k_ij = np.asarray([[0, 0.317, 0],
                       [0.317, 0, -0.25],
                        [0, -0.25, 0]])
    z = np.asarray([1., -1., 0.])

    ref = 101325 # Pa
    t = 298.15 # K
    s[2] = 2.7927 + 10.11*np.exp(-0.01775*t) - 1.417*np.exp(-0.01146*t) # temperature dependent segment diameter for water
    k_ij[0,2] = -0.007981*t + 2.37999
    k_ij[2,0] = -0.007981*t + 2.37999
    dielc = dielc_water(t)
    rho = 55756.672755424515 # mol m^-3 From density calculation with working PC-SAFT density function

    pyargs = {'m':m, 's':s, 'e':e, 'e_assoc':eAB, 'vol_a':volAB, 'k_ij':k_ij, 'z':z, 'dielc':dielc}

    calc = pcsaft_p(t, rho, x, pyargs)
    if print_result:
        print('\n##########  Test with aqueous NaCl  ##########')
        print('----- Pressure at {} K -----'.format(t))
        print('    Reference:', ref, 'Pa')
        print('    PC-SAFT:', calc, 'Pa')
        print('    Relative deviation:', (calc-ref)/ref*100, '%')
    assert abs((calc-ref)/ref*100) < 1e-6
github zmeri / PC-SAFT / tests / test_cython.py View on Github external
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])
    k_ij = np.asarray([[0, 0.317, 0],
                       [0.317, 0, -0.25],
                        [0, -0.25, 0]])
    z = np.asarray([1., -1., 0.])

    p = 2393.8 # Pa
    ref = 298.15 # K, average of repeat data points from source: A. Apelblat and E. Korin, “The vapour pressures of saturated aqueous solutions of sodium chloride, sodium bromide, sodium nitrate, sodium nitrite, potassium iodate, and rubidium chloride at temperatures from 227 K to 323 K,” J. Chem. Thermodyn., vol. 30, no. 1, pp. 59–71, Jan. 1998. (Solubility calculated using equation from Yaws, Carl L.. (2008). Yaws' Handbook of Properties for Environmental and Green Engineering.)
    s[2] = 2.7927 + 10.11*np.exp(-0.01775*ref) - 1.417*np.exp(-0.01146*ref) # temperature dependent segment diameter for water
    k_ij[0,2] = -0.007981*ref + 2.37999
    k_ij[2,0] = -0.007981*ref + 2.37999
    dielc = dielc_water(ref)

    pyargs = {'m':m, 's':s, 'e':e, 'e_assoc':eAB, 'vol_a':volAB, 'k_ij':k_ij, 'z':z, 'dielc':dielc}

    xv_guess = np.asarray([0., 0., 1.])
    calc, xl, xv = flashPQ(p, 0, x, pyargs, ref)
    if print_result:
        print('\n##########  Test with aqueous NaCl  ##########')
        print('----- Bubble point temperature at 2393.8 Pa -----')
        print('    Reference:', ref, 'K')
        print('    PC-SAFT:', calc, 'K')
        print('    Relative deviation:', (calc-ref)/ref*100, '%')
    assert abs((calc-ref)/ref*100) < 1
github zmeri / PC-SAFT / tests / test_cython.py View on Github external
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])
    k_ij = np.asarray([[0, 0.317, 0],
                       [0.317, 0, -0.25],
                        [0, -0.25, 0]])
    z = np.asarray([1., -1., 0.])

    ref = 55507.23 # source: Rodriguez H.; Soto A.; Arce A.; Khoshkbarchi M.K.: Apparent Molar Volume, Isentropic Compressibility, Refractive Index, and Viscosity of DL-Alanine in Aqueous NaCl Solutions. J.Solution Chem. 32 (2003) 53-63
    t = 298.15 # K
    s[2] = 2.7927 + 10.11*np.exp(-0.01775*t) - 1.417*np.exp(-0.01146*t) # temperature dependent segment diameter for water
    k_ij[0,2] = -0.007981*t + 2.37999
    k_ij[2,0] = -0.007981*t + 2.37999
    dielc = dielc_water(t)

    pyargs = {'m':m, 's':s, 'e':e, 'e_assoc':eAB, 'vol_a':volAB, 'k_ij':k_ij, 'z':z, 'dielc':dielc}

    calc = pcsaft_den(t, 101325, x, pyargs, phase='liq')
    if print_result:
        print('\n##########  Test with aqueous NaCl  ##########')
        print('----- Density at 298.15 K and 101325 Pa -----')
        print('    Reference:', ref, 'mol m^-3')
        print('    PC-SAFT:', calc, 'mol m^-3')
        print('    Relative deviation:', (calc-ref)/ref*100, '%')
    assert abs((calc-ref)/ref*100) < 2

    # Propane
    x = np.asarray([1.])
    m = np.asarray([2.0020])
    s = np.asarray([3.6184])
github zmeri / PC-SAFT / tests / test_cython.py View on Github external
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])
    k_ij = np.asarray([[0, 0.317, 0],
                       [0.317, 0, -0.25],
                        [0, -0.25, 0]])
    z = np.asarray([1., -1., 0.])

    t = 298.15 # K
    p = 100000. # Pa
    s[2] = 2.7927 + 10.11*np.exp(-0.01775*t) - 1.417*np.exp(-0.01146*t) # temperature dependent segment diameter for water
    k_ij[0,2] = -0.007981*t + 2.37999
    k_ij[2,0] = -0.007981*t + 2.37999
    dielc = dielc_water(t)

    pyargs = {'m':m, 's':s, 'e':e, 'e_assoc':eAB, 'vol_a':volAB, 'k_ij':k_ij, 'z':z, 'dielc':dielc}

    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 aqueous NaCl  ##########')
        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
github zmeri / PC-SAFT / tests / test_cython.py View on Github external
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])
    k_ij = np.asarray([[0, 0.317, 0],
                       [0.317, 0, -0.25],
                        [0, -0.25, 0]])
    z = np.asarray([1., -1., 0.])

    ref = 1.116 # source: R. A. Robinson and R. H. Stokes, Electrolyte Solutions: Second Revised Edition. Dover Publications, 1959.
    t = 293.15 # K
    s[2] = 2.7927 + 10.11*np.exp(-0.01775*t) - 1.417*np.exp(-0.01146*t) # temperature dependent segment diameter for water
    k_ij[0,2] = -0.007981*t + 2.37999
    k_ij[2,0] = -0.007981*t + 2.37999
    dielc = dielc_water(t)

    pyargs = {'m':m, 's':s, 'e':e, 'e_assoc':eAB, 'vol_a':volAB, 'k_ij':k_ij, 'z':z, 'dielc':dielc}

    rho = pcsaft_den(t, 2339.3, x, pyargs, phase='liq')
    result = pcsaft_osmoticC(t, rho, x, pyargs)
    calc = result[0]
    if print_result:
        print('\n##########  Test with aqueous NaCl  ##########')
        print('----- Osmotic coefficient at 293.15 K -----')
        print('    Reference:', ref)
        print('    PC-SAFT:', calc)
        print('    Relative deviation:', (calc-ref)/ref*100, '%')
    assert abs((calc-ref)/ref*100) < 2
github zmeri / PC-SAFT / tests / test_cython.py View on Github external
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])
    k_ij = np.asarray([[0, 0.317, 0],
                       [0.317, 0, -0.25],
                        [0, -0.25, 0]])
    z = np.asarray([1., -1., 0.])

    ref = 2393.8 # average of repeat data points from source: A. Apelblat and E. Korin, “The vapour pressures of saturated aqueous solutions of sodium chloride, sodium bromide, sodium nitrate, sodium nitrite, potassium iodate, and rubidium chloride at temperatures from 227 K to 323 K,” J. Chem. Thermodyn., vol. 30, no. 1, pp. 59–71, Jan. 1998. (Solubility calculated using equation from Yaws, Carl L.. (2008). Yaws' Handbook of Properties for Environmental and Green Engineering.)
    t = 298.15 # K
    s[2] = 2.7927 + 10.11*np.exp(-0.01775*t) - 1.417*np.exp(-0.01146*t) # temperature dependent segment diameter for water
    k_ij[0,2] = -0.007981*t + 2.37999
    k_ij[2,0] = -0.007981*t + 2.37999
    dielc = dielc_water(t)

    pyargs = {'m':m, 's':s, 'e':e, 'e_assoc':eAB, 'vol_a':volAB, 'k_ij':k_ij, 'z':z, 'dielc':dielc}

    xv_guess = np.asarray([0., 0., 1.])
    calc, xl, xv = flashTQ(t, 0, x, pyargs)
    if print_result:
        print('\n##########  Test with aqueous NaCl  ##########')
        print('----- Bubble point pressure at 298.15 K -----')
        print('    Reference:', ref, 'Pa')
        print('    PC-SAFT:', calc, 'Pa')
        print('    Relative deviation:', (calc-ref)/ref*100, '%')
    assert abs((calc-ref)/ref*100) < 10

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