pcsaft.flashPQ

pcsaft.flashPQ()

Calculate the temperature of the system where vapor and liquid phases are in equilibrium.

Parameters:
  • p (float) – Pressure (Pa)
  • q (float) – Mole fraction of the fluid in the vapor phase
  • x (ndarray, shape (n,)) – Mole fractions of each component. It has a length of n, where n is the number of components in the system.
  • params (dict) –

    A dictionary containing PC-SAFT parameters that can be passed for use in PC-SAFT:

    m : ndarray, shape (n,)
    Segment number for each component.
    s : ndarray, shape (n,)
    Segment diameter for each component. For ions this is the diameter of the hydrated ion. Units of Angstrom.
    e : ndarray, shape (n,)
    Dispersion energy of each component. For ions this is the dispersion energy of the hydrated ion. Units of K.
    k_ij : ndarray, shape (n,n)
    Binary interaction parameters between components in the mixture. (dimensions: ncomp x ncomp)
    e_assoc : ndarray, shape (n,)
    Association energy of the associating components. For non associating compounds this is set to 0. Units of K.
    vol_a : ndarray, shape (n,)
    Effective association volume of the associating components. For non associating compounds this is set to 0.
    dipm : ndarray, shape (n,)
    Dipole moment of the polar components. For components where the dipole term is not used this is set to 0. Units of Debye.
    dip_num : ndarray, shape (n,)
    The effective number of dipole functional groups on each component molecule. Generally this is set to 1, but some implementations use this as an adjustable parameter that is fit to data.
    z : ndarray, shape (n,)
    Charge number of the ions
    dielc : float
    Dielectric constant of the medium to be used for electrolyte calculations.
    assoc_scheme : list, shape (n,)
    The types of association sites for each component. Use None for molecules without association sites. If a molecule has multiple association sites, use a nested list for that component to specify the association scheme for each site. The accepted association schemes are those given by Huang and Radosz (1990): 1, 2A, 2B, 3A, 3B, 4A, 4B, 4C. If e_assoc and vol_a are given but assoc_scheme is not, the 2B association scheme is assumed (which would, for example, correspond to one hydroxyl functional group).
  • t_guess (float) – Initial guess for the temperature (K) (optional)
Returns:

  • t (float) – Temperature (K)
  • xl (ndarray, shape (n,)) – Liquid mole fractions after flash
  • xv (ndarray, shape (n,)) – Vapor mole fractions after flash

Notes

To solve the PQ flash the temperature must be varied. This adds additional complexity for water and electrolyte mixtures. For water, a temperature dependent sigma is often used. However, there does not appear to be a way to pass a Python function to the C++ code without requiring the user to compile it using Cython. To avoid this, the flashPQ function uses the following relationship internally to calculate sigma for water as a function of temperature:

3.8395 + 1.2828 * exp(-0.0074944 * t) - 1.3939 * exp(-0.00056029 * t);

For electrolyte solutions the dielectric constant is calculated using the dielc_water function. This means that the sigma value for water and the dielectric constant given by the user are not used by the flashPQ function.

The code identifies which component is water by the epsilon/k value. Therefore, when using flashPQ with water e must be exactly 353.9449, if you want the temperature dependence of sigma to be accounted for.

If you want to use different functions for temperature dependent parameters with flashPQ then you will need to modify the source code and recompile it.