Vapor-liquid equilibrium (flash)
MultiComponentFlash.NewtonFlashMultiComponentFlash.SSIFlashMultiComponentFlash.SSINewtonFlashMultiComponentFlash.flash_2phMultiComponentFlash.flash_2ph!MultiComponentFlash.flash_storageMultiComponentFlash.liquid_mole_fractionMultiComponentFlash.stability_2phMultiComponentFlash.vapor_mole_fractionMultiComponentFlash.vapor_mole_fraction
Stability test
MultiComponentFlash.stability_2ph — Functionstability_2ph(eos, c, [K])Determine if mixture is single-phase stable under conditions c.
This is done using a version of Michelsen's stability test.
Two-phase flash
MultiComponentFlash.NewtonFlash — TypeFlash using Newton's method for zero solve.
Only conditionally convergent, but has better convergence rate than SSI.
See also: flash_2ph!, SSIFlash SSINewtonFlash
MultiComponentFlash.SSIFlash — TypeFlash method that uses successive subtition.
Unconditionally convergent, does not require derivatives, but is very slow around critical regions.
See also: flash_2ph!, NewtonFlash SSINewtonFlash
MultiComponentFlash.SSINewtonFlash — TypeSSINewtonFlash([swap_iter = 5])Perform a number of SSI iterations, followed by Newton until convergence.
See also: flash_2ph!, SSIFlash NewtonFlash
MultiComponentFlash.flash_2ph! — Functionflash_2ph!(storage, K, eos, c, [V]; <keyword arguments>)Non-allocating version of flash_2ph where storage is pre-allocated.
Useful if you are performing many flashes of the same system with varying conditions.
Arguments
storage: Should be output fromflash_storage(eos, c, method = method). Preallocated storage.
Remaining arguments documented in flash_2ph.
Keyword arguments
update_forces = true: Update thep, Tdependent forces in storage initially.
MultiComponentFlash.flash_2ph — Methodflash_2ph(eos, c, [K], [V]; <keyword arguments>)Perform two-phase flash with a given EOS under a set of specific conditions. Returns vapor fraction. Modifies K in-place.
Given a mixture with pressure, temperature and mole fractions, this routine performs a vapor-liquid equilibrium calculation after a stability test.
Two outcomes are possible:
- A single-phase condition prevails (returned vapor fraction is
NaN) and a single phase (liquid or vapor) is stable. - A two-phase condition is possible. The routine produces K-values and vapor fraction so that the following holds:
- Isofugacity constraint for all components ($f_{li} = f_{vi}$)
- Molar balance for all components ($(1-V) x_i - V y_i - z_i$)
- Unity condition ($\sum_i (x_i - y_i) = 0$)
Arguments
eos: the equation-of-state to be used for the flashc: conditions to flash the mixture at on the form(p = 10e5, T = 303.15, z = [0.5, 0.3, 0.2])K: optionally a buffer of lengthnumber_of_components(eos)used to hold K-values. Modified in-place.V: optionally the initial guess for V. If this value is notNaN, the stability check will be skipped.
Keyword arguments
method = SSIFlash(): Flash method to use. Can beSSIFlash(),NewtonFlash()orSSINewtonFlash().tolerance = 1e-8: Tolerance for the convergence criterion. Relative to $\|1-R_i\|_\infty$ where $R_i = f_{il}/f_{iv}$maxiter = 10000: Maximum nubmer of iterations for both stability tests and the main flash.verbose = false: Emit extra information during solve.extra_out = false: Return(V, K, conv)whereconvcontains iterations and oncergence status instead of justV.
See also: flash_2ph!, single_phase_label
MultiComponentFlash.flash_storage — Functionflash_storage(eos, [c]; <keyword arguments>)Pre-allocate storage for flash_2ph!.
Arguments
eos: the equation-of-state to be used for the flashc: conditions for the mixture. Types in conditions must match later usage (e.g. for use with ForwardDiff).
Keyword arguments
method = SSIFlash(): Flash method to use. Can beSSIFlash(),NewtonFlash()orSSINewtonFlash().static_size = false: UseSArraysandMArraysfor fast flash, but slower compile times.inc_jac: Allocate storage for Newton/Jacobian. Required for Newton (and defaults totruefor that method) or fordiff_externals.diff_externals = false: Allocate storage for matrix inversion required to produce partial derivatives of flash usingset_partials.
See also: flash_2ph! set_partials
MultiComponentFlash.liquid_mole_fraction — MethodCompute liquid mole fraction from overall mole fraction, K-value and V vapor fraction
MultiComponentFlash.vapor_mole_fraction — MethodCompute vapor mole fraction from overall mole fraction, K-value and V vapor fraction
MultiComponentFlash.vapor_mole_fraction — MethodCompute vapor mole fraction from liquid mole fraction and K-value