calc_Prange_xi

despasito.thermodynamics.calc.calc_Prange_xi

calc_Prange_xi(T, xi, yi, Eos, density_opts={}, Pmin=None, Pmax=None, maxiter=200, mole_fraction_options={}, ptol=0.01, xytol=0.01, maxfactor=2, minfactor=0.5, Pmin_allowed=100, **kwargs)[source]

Obtain minimum and maximum pressure values for bubble point calculation.

The liquid mole fraction is set and the objective function at each of those values is of opposite sign.

Parameters:
  • T (float) – Temperature of the system [K]

  • xi (numpy.ndarray) – Liquid mole fraction of each component, sum(xi) should equal 1.0

  • yi (numpy.ndarray) – Vapor mole fraction of each component, sum(xi) should equal 1.0

  • Eos (obj) – An instance of the defined EOS class to be used in thermodynamic computations.

  • density_opts (dict, Optional, default={}) – Dictionary of options used in calculating pressure vs. specific volume in pressure_vs_volume_arrays()

  • maxiter (float, Optional, default=200) – Maximum number of iterations in both the loop to find Pmin and the loop to find Pmax

  • Pmin (float, Optional, default=1000.0) – [Pa] Minimum pressure in pressure range that restricts searched space.

  • Pmax (float, Optional, default=100000) – If no local minima or maxima are identified for the liquid composition at this temperature, this value is used as an initial estimate of the maximum pressure range.

  • Pmin_allowed (float, Optional, default=100) – Minimum allowed pressure in search, before looking for a super critical fluid

  • mole_fraction_options (dict, Optional, default={}) – Options used to solve the inner loop in the solving algorithm

  • ptol (float, Optional, default=1e-2) – If two iterations in the search for the maximum pressure are within this tolerance, the search is discontinued

  • xytol (float, Optional, default=0.01) – If the sum of absolute relative difference between the vapor and liquid mole fractions are less than this total, the pressure is assumed to be super critical and the maximum pressure is sought at a lower value.

  • maxfactor (float, Optional, default=2) – Factor to multiply by the pressure if it is too low (produces liquid or positive objective value). Not used if an unfeasible maximum pressure is found to bound the problem (critical for NaN result).

  • minfactor (float, Optional, default=0.5) – Factor to multiply by the minimum pressure if it is too high (produces critical value).

Returns:

  • Prange (list) – List of min and max pressure range

  • Pguess (float) – An interpolated guess in the equilibrium pressure from Prange