Example #1
0
def test_sres(print_result=False):
    """Test the residual entropy function to see if it is working correctly."""
    if print_result:
        print('------ 325 K ------')
        print('\t\t\t PC-SAFT\t Reference \tRelative error')
    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 = {'x': x, 'm': m, 's': s, 'e': e}

    den = pcsaft_den(t, p, pyargs, phase='liq')
    ref = -96.3692  # J mol^-1 K^-1
    calc = pcsaft_sres(t, den, pyargs)
    assert abs((calc - ref) / ref * 100) < 1e-2
    if print_result:
        print('Toluene, liquid:\t\t', calc, ref, (calc - ref) / ref * 100,
              'J/mol/K')
    den = pcsaft_den(t, p, pyargs, phase='vap')
    ref = -0.71398  # J mol^-1 K^-1
    calc = pcsaft_sres(t, den, pyargs)
    assert abs((calc - ref) / ref * 100) < 1e-2
    if print_result:
        print('Toluene, vapor:\t\t', calc, ref, (calc - ref) / ref * 100,
              'J/mol/K')

    # 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 = {'x': x, 'm': m, 's': s, 'e': e, 'e_assoc': eAB, 'vol_a': volAB}

    den = pcsaft_den(t, p, pyargs, phase='liq')
    ref = -98.1127  # J mol^-1 K^-1
    calc = pcsaft_sres(t, den, pyargs)
    assert abs((calc - ref) / ref * 100) < 1e-2
    if print_result:
        print('Acetic acid, liquid:\t\t', calc, ref, (calc - ref) / ref * 100,
              'J/mol/K')
    den = pcsaft_den(t, p, pyargs, phase='vap')
    ref = -40.8743  # J mol^-1 K^-1
    calc = pcsaft_sres(t, den, pyargs)
    assert abs((calc - ref) / ref * 100) < 1e-2
    if print_result:
        print('Acetic acid, vapor:\t\t', calc, ref, (calc - ref) / ref * 100,
              'J/mol/K')
Example #2
0
def test_osmoticC(print_result=False):
    """Test the function for calculating osmotic coefficients to see if it is working correctly."""
    # NaCl in water
    # 0 = Na+, 1 = Cl-, 2 = H2O
    x = np.asarray([0.0629838206, 0.0629838206, 0.8740323588])
    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 = {
        'x': x,
        '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, pyargs, phase='liq')
    result = pcsaft_osmoticC(t, rho, pyargs)
    calc = result[0]
    assert abs((calc - ref) / ref * 100) < 2
    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, '%')
Example #3
0
import numpy as np
from pcsaft import pcsaft_den

# Toluene
x = np.asarray([1.])
m = np.asarray([2.8149])
s = np.asarray([3.7169])
e = np.asarray([285.69])
pyargs = {'m':m, 's':s, 'e':e}

t = 320 # K
p = 101325 # Pa
den = pcsaft_den(t, p, x, pyargs, phase='liq')
print('Density of toluene at {} K:'.format(t), den, 'mol m^-3')

# Water using default 2B association scheme
x = np.asarray([1.])
m = np.asarray([1.2047])
e = np.asarray([353.95])
volAB = np.asarray([0.0451])
eAB = np.asarray([2425.67])

t = 274
p = 101325
s = np.asarray([2.7927 + 10.11*np.exp(-0.01775*t) - 1.417*np.exp(-0.01146*t)]) # temperature dependent sigma is used for better accuracy
pyargs = {'m':m, 's':s, 'e':e, 'e_assoc':eAB, 'vol_a':volAB}
den = pcsaft_den(t, p, x, pyargs, phase='liq')
print('Density of water at {} K:'.format(t), den, 'mol m^-3')

# Water using 4C association scheme
x = np.asarray([1.])
Example #4
0
def test_dadt(print_result=False):
    """Test the function for the temperature derivative of the Helmholtz energy."""
    # Toluene
    x = np.asarray([1.])
    m = np.asarray([2.8149])
    s = np.asarray([3.7169])
    e = np.asarray([285.69])
    pyargs = {'x': x, 'm': m, 's': s, 'e': e}

    p = 100000.
    t = 330.

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

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

    # 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 = {'x': x, 'm': m, 's': s, 'e': e, 'e_assoc': eAB, 'vol_a': volAB}

    p = 100000.
    t = 310.

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

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

    # Water
    m = np.asarray([1.2047])
    e = np.asarray([353.95])
    volAB = np.asarray([0.0451])
    eAB = np.asarray([2425.67])

    p = 100000.
    t = 290.

    s = np.asarray(
        [2.7927 + 10.11 * np.exp(-0.01775 * t) - 1.417 * np.exp(-0.01146 * t)])
    pyargs = {'x': x, 'm': m, 's': s, 'e': e, 'e_assoc': eAB, 'vol_a': volAB}

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

    # calculating numerical derivative
    der1 = pcsaft_ares(t - 1, rho, pyargs)
    der2 = pcsaft_ares(t + 1, rho, pyargs)
    dadt_num = (der2 - der1) / 2.
    assert abs((dadt_eos - dadt_num) / dadt_num * 100) < 2e-2
    if print_result:
        print('\n##########  Test with water  ##########')
        print('    Numerical derivative:', dadt_num)
        print('    PC-SAFT derivative:', dadt_eos)
        print('    Relative deviation:',
              (dadt_eos - dadt_num) / dadt_num * 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])
    pyargs = {'x': x, 'm': m, 's': s, 'e': e, 'dipm': dpm, 'dip_num': dip_num}

    p = 100000.
    t = 370.

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

    # calculating numerical derivative
    der1 = pcsaft_ares(t - 1, rho, pyargs)
    der2 = pcsaft_ares(t + 1, rho, pyargs)
    dadt_num = (der2 - der1) / 2.
    assert abs((dadt_eos - dadt_num) / dadt_num * 100) < 2e-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, '%')

    # 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])
    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 = {
        'x': x,
        '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, pyargs, phase='liq')
    dadt_eos = pcsaft_dadt(t, rho, pyargs)

    # calculating numerical derivative
    der1 = pcsaft_ares(t - 1, rho, pyargs)
    der2 = pcsaft_ares(t + 1, rho, pyargs)
    dadt_num = (der2 - der1) / 2.
    assert abs((dadt_eos - dadt_num) / dadt_num * 100) < 2e-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, '%')
Example #5
0
def test_density(print_result=False):
    """Test the density function to see if it is working correctly."""
    # Toluene
    x = np.asarray([1.])
    m = np.asarray([2.8149])
    s = np.asarray([3.7169])
    e = np.asarray([285.69])
    pyargs = {'x': x, 'm': m, 's': s, 'e': e}

    ref = 9135.590853014008  # source: reference EOS in CoolProp
    calc = pcsaft_den(320, 101325, pyargs, phase='liq')
    assert abs((calc - ref) / ref * 100) < 2
    if print_result:
        print('##########  Test with toluene  ##########')
        print('----- Density at 320 K and 101325 Pa -----')
        print('    Reference:', ref, 'mol m^-3')
        print('    PC-SAFT:', calc, 'mol m^-3')
        print('    Relative deviation:', (calc - ref) / ref * 100, '%')

    # Water
    m = np.asarray([1.2047])
    e = np.asarray([353.95])
    volAB = np.asarray([0.0451])
    eAB = np.asarray([2425.67])

    ref = 55502.5970532902  # source: IAWPS95 EOS
    t = 274
    s = np.asarray(
        [2.7927 + 10.11 * np.exp(-0.01775 * t) - 1.417 * np.exp(-0.01146 * t)])
    pyargs = {'x': x, 'm': m, 's': s, 'e': e, 'e_assoc': eAB, 'vol_a': volAB}
    calc = pcsaft_den(t, 101325, pyargs, phase='liq')
    assert abs((calc - ref) / ref * 100) < 2
    if print_result:
        print('\n##########  Test with water  ##########')
        print('----- Density at 274 K and 101325 Pa -----')
        print('    Reference:', ref, 'mol m^-3')
        print('    PC-SAFT:', calc, 'mol m^-3')
        print('    Relative deviation:', (calc - ref) / ref * 100, '%')

    # 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 = {'x': x, 'm': m, 's': s, 'e': e, 'e_assoc': eAB, 'vol_a': volAB}

    ref = 17240.  # source: DIPPR correlation
    calc = pcsaft_den(305, 101325, pyargs, phase='liq')
    assert abs((calc - ref) / ref * 100) < 2
    if print_result:
        print('\n##########  Test with acetic acid  ##########')
        print('----- Density at 305 K and 101325 Pa -----')
        print('    Reference:', ref, 'mol m^-3')
        print('    PC-SAFT:', calc, 'mol m^-3')
        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])
    pyargs = {'x': x, 'm': m, 's': s, 'e': e, 'dipm': dpm, 'dip_num': dip_num}

    ref = 16110.  # source: DIPPR correlation
    calc = pcsaft_den(240, 101325, pyargs, phase='liq')
    assert abs((calc - ref) / ref * 100) < 2
    if print_result:
        print('\n##########  Test with dimethyl ether  ##########')
        print('----- Density at 240 K and 101325 Pa -----')
        print('    Reference:', ref, 'mol m^-3')
        print('    PC-SAFT:', calc, 'mol m^-3')
        print('    Relative deviation:', (calc - ref) / ref * 100, '%')

    # Binary mixture: methanol-cyclohexane
    #0 = methanol, 1 = cyclohexane
    x = np.asarray([0.0550, 0.945])
    m = np.asarray([1.5255, 2.5303])
    s = np.asarray([3.2300, 3.8499])
    e = np.asarray([188.90, 278.11])
    volAB = np.asarray([0.035176, 0.])
    eAB = np.asarray([2899.5, 0.])
    k_ij = np.asarray([[0, 0.051], [0.051, 0]])
    pyargs = {
        'x': x,
        'm': m,
        's': s,
        'e': e,
        'e_assoc': eAB,
        'vol_a': volAB,
        'k_ij': k_ij
    }

    ref = 9506.1  # source: J. Canosa, A. Rodríguez, and J. Tojo, “Liquid−Liquid Equilibrium and Physical Properties of the Ternary Mixture (Dimethyl Carbonate + Methanol + Cyclohexane) at 298.15 K,” J. Chem. Eng. Data, vol. 46, no. 4, pp. 846–850, Jul. 2001.
    calc = pcsaft_den(298.15, 101325, pyargs, phase='liq')
    assert abs((calc - ref) / ref * 100) < 2
    if print_result:
        print(
            '\n##########  Test with methanol-cyclohexane mixture  ##########')
        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, '%')

    # NaCl in water
    # 0 = Na+, 1 = Cl-, 2 = H2O
    x = np.asarray([0.010579869455908, 0.010579869455908, 0.978840261088184])
    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 = {
        'x': x,
        '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, pyargs, phase='liq')
    assert abs((calc - ref) / ref * 100) < 2
    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, '%')

    # Propane
    x = np.asarray([1.])
    m = np.asarray([2.0020])
    s = np.asarray([3.6184])
    e = np.asarray([208.11])
    pyargs = {'x': x, 'm': m, 's': s, 'e': e}

    t = 85.525  # K
    p = 1.7551e-4  # Pa
    ref = 16621.0  # source: reference EOS in CoolProp
    calc = pcsaft_den(t, p, pyargs, phase='liq')
    assert abs((calc - ref) / ref * 100) < 2
    if print_result:
        print('##########  Test with propane  ##########')
        print('----- Density at {} K and {} Pa -----'.format(t, p))
        print('    Reference:', ref, 'mol m^-3')
        print('    PC-SAFT:', calc, 'mol m^-3')
        print('    Relative deviation:', (calc - ref) / ref * 100, '%')

    t = 85.525  # K
    p = 1.39e-4  # Pa
    ref = 1.9547e-7  # source: reference EOS in CoolProp
    calc = pcsaft_den(t, p, pyargs, phase='vap')
    assert abs((calc - ref) / ref * 100) < 2
    if print_result:
        print('----- Density at {} K and {} Pa -----'.format(t, p))
        print('    Reference:', ref, 'mol m^-3')
        print('    PC-SAFT:', calc, 'mol m^-3')
        print('    Relative deviation:', (calc - ref) / ref * 100, '%')

    t = 293  # K
    p = 833240  # Pa
    ref = 11346.0  # source: reference EOS in CoolProp
    calc = pcsaft_den(t, p, pyargs, phase='liq')
    assert abs((calc - ref) / ref * 100) < 2
    if print_result:
        print('----- Density at {} K and {} Pa -----'.format(t, p))
        print('    Reference:', ref, 'mol m^-3')
        print('    PC-SAFT:', calc, 'mol m^-3')
        print('    Relative deviation:', (calc - ref) / ref * 100, '%')

    t = 430  # K
    p = 2000000  # Pa
    ref = 623.59  # source: reference EOS in CoolProp
    calc = pcsaft_den(t, p, pyargs, phase='liq')
    assert abs((calc - ref) / ref * 100) < 2
    if print_result:
        print('----- Density at {} K and {} Pa -----'.format(t, p))
        print('    Reference:', ref, 'mol m^-3')
        print('    PC-SAFT:', calc, 'mol m^-3')
        print('    Relative deviation:', (calc - ref) / ref * 100, '%')
Example #6
0
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 = {'x': x, '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, pyargs, phase='liq')
    calc = pcsaft_cp(t, rho, cnsts, pyargs)
    assert abs((calc - ref) / ref * 100) < 3
    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, '%')

    # 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 = {'x': x, '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, pyargs, phase='liq')
    calc = pcsaft_cp(t, rho, cnsts, pyargs)
    assert abs((calc - ref) / ref * 100) < 3
    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, '%')

    # # 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)
    # pyargs = {'x':x, 'm':m, 's':s, 'e':e, 'e_assoc':eAB, 'vol_a':volAB}
    #
    # ref = 130.3 # source: DIPPR
    # p = 100000.
    # t = 325.
    # rho = pcsaft_den(t, p, pyargs, phase='liq')
    # calc = pcsaft_cp(t, rho, cnsts, pyargs)
    # """ Note: Large deviations occur with acetic acid and water. This behavior
    # has been observed before and was described in R. T. C. S. Ribeiro, A. L.
    # Alberton, M. L. L. Paredes, G. M. Kontogeorgis, and X. Liang, “Extensive
    # Study of the Capabilities and Limitations of the CPA and sPC-SAFT Equations
    # of State in Modeling a Wide Range of Acetic Acid Properties,” Ind. Eng.
    # Chem. Res., vol. 57, no. 16, pp. 5690–5704, Apr. 2018. """
    # # print('----- Heat capacity at 325 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, '%')

    # 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 = {'x': x, '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, pyargs, phase='liq')
    calc = pcsaft_cp(t, rho, cnsts, pyargs)
    assert abs((calc - ref) / ref * 100) < 3
    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, '%')