Contents
Index
Clapeyron.DETPFlashClapeyron.FlashDataClapeyron.FlashResultClapeyron.FlashSpecificationsClapeyron.GeneralizedXYFlashClapeyron.MCFlashJLClapeyron.MichelsenTPFlashClapeyron.MultiPhaseTPFlashClapeyron.RRQXFlashClapeyron.RRTPFlashClapeyron.RRXYFlashClapeyron.each_active_phase_indexClapeyron.is_active_phaseClapeyron.numphasesClapeyron.ph_flashClapeyron.ps_flashClapeyron.qp_flashClapeyron.qt_flashClapeyron.supports_reductionClapeyron.tp_flashClapeyron.tp_flash2Clapeyron.ts_flashClapeyron.uv_flashClapeyron.vt_flashClapeyron.xy_flash
Flash methods
Quick summary of available flash methods
In the following table:
- P,T represent pressure and temperature.
- X,Y represent any arbitrary specification (enthalpy, volume, internal energy, etc).
- Q represents the (molar) vapour fraction. Q = 1 is the specification of the dew point, Q = 0 corresponds to the bubble point.
| Method Name | Flash Type | maximum phases | Derivative Order | Activity Models | Electrolyte Models | Notes |
|---|---|---|---|---|---|---|
RRTPFlash | P-T | 2 (VLE,LLE) | First order | No (cubic EoS) | Yes | Rachford-Rice (RR) Flash |
MichelsenTPFlash | P-T | 2 (VLE,LLE) | Second order¹ | Yes | No | RR + Gibbs optimization |
MultiPhaseTPFlash | P-T | any (automatic phase detection) | Second order | Yes | No | RR + Gibbs optimization + phase search |
DETPFlash | P-T | any (via numphases) | Zeroth Order | Yes | No | Global Gibbs optimization over fixed phases |
GeneralizedXYFlash | X-Y | 2² (VLE/LLE) | Second Order | No | No | Equilibria conditions as constrained non-linear system |
RRQXFlash | Q-T,Q-P | 2 | First Order | Yes | No | RR update + Root-finding of Q(p)/Q(T) |
RRXYFlash | P-Y,T-Y | 2 (VLE/LLE) | First Order | Yes | No | RR iterations + Root-finding on Y(T)/Y(p) |
MCFlashJL | P-T | 2 (VLE) | Second order | No | No | MultiComponentFlash.jl extension |
Notes:
MichelsenTPFlashcan switch how it can solve the gibbs optimization problem via thesecond_order::Boolkeyword, from L-BFGS (first order method) to Newton (second order Newton) By default,MichelsenTPFlashuses a first order gibbs optimization solver.GeneralizedXYFlashis a wrapper to thexy_flashmethod. Whilexy_flashcan solve an arbitrary, multiphase, X-Y flash problem, `Clapeyron.jl is only capable at the moment of generating 2-phase initial points for some combinations of specifications.MichelsenTPFlashandRRTPFlashwill always return a result with two phases, the phase with zero phase fraction carry information about the converged K value.
The default flash methods are the following:
- Helmholtz models:
MichelsenTPFlash(P-T),GeneralizedXYFlash(X-Y) - Activity Models/Composite models:
MichelsenTPFlash(P-T),RRQXFlash(Q-T,Q-P),RRXYFlash(P-Y,T-Y) - Electrolyte Models:
RRTPFlash(P-T)
Flash API
Clapeyron.supports_reduction — Function
supports_reduction(method::FlashMethod)::BoolChecks if a Flash method supports index reduction (the ability to prune model components with compositions lower than a threshold). All current Clapeyron.jl methods support index reduction, but some methods that alllow passing a cache could have problems.
Clapeyron.FlashResult — Type
FlashResult(compositions,fractions,volumes,data::FlashData)
FlashResult(model,p,T,z,compositions,fractions,volumes,g = nothing;sort = true)
FlashResult(model,p,T,compositions,fractions,volumes,g = nothing;sort = true)
FlashResult(model,p,T,z;phase = :unknown)
FlashResult(p,T,z,compositions,fractions,volumes,g = nothing;sort = true)
FlashResult(p,T,compositions,fractions,volumes,g = nothing;sort = true)
FlashResult(flash::FlashResult,g = nothing;sort = true)Structure used to contain the result of a flash. Contains a list of molar compositions, a list of molar amounts per phase, a list of molar volumes and an auxiliary struct, FlashData, containing the pressure, temperature and reduced Gibbs energy. When an EoSModel is used as an input for a FlashResult, the reduced molar Gibbs energy (g = g/NRT) is calculated, if not provided. By default, the phases are sorted by volume, this can be changed by passing the keyword argument sort = false FlashResult(model,p,T,z;phase) constructs a single phase FlashResult. If the bulk composition z is provided, it will be used to scale the fractions, forcing sum(fractions) == sum(z)
Clapeyron.FlashData — Type
FlashDataAuxiliary struct that contains information about the current FlashResult object. It stores the pressure, temperature and reduced Gibbs energy (g = G/nRT)
Clapeyron.FlashSpecifications — Type
FlashSpecifications(;v,T,p,h,s,u,q)Struct that holds two specifications for a general flash. The keyword arguments have the following meaning:
T: temperature[K]v: total volume[m³]p: pressure[Pa]h: enthalpy[J]s: entropy[J·K⁻¹]u: internal energy[J]q: vapour fraction
Examples:
specs = FlashSpecifications(p = 101325,T = 298.15) #PT flash
specs = FlashSpecifications(Clapeyron.pressure,101325,Clapeyron.temperature,298.15) #equivalentClapeyron.numphases — Function
numphases(method::FlashMethod)Return the number of phases supported by a flash method. By default it is set to 2. If the method allows it, you can set the number of phases by doing method(;numphases = n).
Clapeyron.is_active_phase — Function
is_active_phase(result::FlashResult,i)::BoolReturns a boolean indicating if the phase stored in Result is "active". An active phase is defined as:
- A non-negative volume (some Activity models use zero liquid volume),
- A valid composition (at least one positive phase)
- A positive fraction.
- Nonnegative and finite temperatures and pressures.
A single-phase sucessful flash will have one active phase and zero or more inactive phases. The function Clapeyron.eachactivephase_index returns an iterator of all active phase indices. Inactive phases can still carry relevant information; for example, in a QP flash where Q is 0 (bubble point), the inactive phase stores the gas composition and volume.
Clapeyron.each_active_phase_index — Function
each_active_phase_index(result::FlashResult)Lazy iterator returning the indices of each active phase.
Flash functions
For legacy reasons, the return type of tp_flash does not return a FlashResult. If you want to get a consistent return type for P-T flash, call Clapeyron.tp_flash2 instead.
Clapeyron.tp_flash — Function
tp_flash(model, p, T, n, method::TPFlashMethod = DETPFlash())Routine to solve non-reactive multicomponent flash problem. The default method tries to find all phases. See MultiPhaseTPFlash
Inputs:
- T, Temperature
[K] - p, Pressure
[Pa] - n, vector of number of moles of each species
[mol]
Outputs - Tuple containing:
- xᵢⱼ, Array of mole fractions of species j in phase i
- nᵢⱼ, Array of mole numbers of species j in phase i,
[mol] - G, Gibbs energy of Equilibrium Mixture
[J]
Clapeyron.tp_flash2 — Function
result = tp_flash2(model, p, s, n, method::FlashMethod = GeneralizedXYFlash())
result = tp_flash2(model, p, s, n; kwargs...)Routine to solve non-reactive two-phase multicomponent flash problem. With P-T specifications. The default method tries to find all phases. See MultiPhaseTPFlash
Inputs:
p, pressure[Pa]T, temperature[K]n, vector of number of moles of each species[mol]
Outputs:
result, aFlashResultstruct containing molar fractions, vapour fractions, molar volumes and the equilibrium temperature and pressure.
Clapeyron.ph_flash — Function
result = ph_flash(model, p, h, n, method::FlashMethod = GeneralizedXYFlash())
result = ph_flash(model, p, h, n; kwargs...)Routine to solve non-reactive two-phase multicomponent flash problem. With P-H specifications. Wrapper around Clapeyron.xy_flash, with automatic initial point calculations. Inputs:
p, pressure[Pa]h, enthalpy[J]n, vector of number of moles of each species[mol]
All keyword arguments are forwarded to GeneralizedXYFlash.
Outputs:
result, aFlashResultstruct containing molar fractions, vapour fractions, molar volumes and the equilibrium temperature and pressure.
Clapeyron.ps_flash — Function
result = ps_flash(model, p, s, n, method::FlashMethod = GeneralizedXYFlash())
result = ps_flash(model, p, s, n; kwargs...)Routine to solve non-reactive two-phase multicomponent flash problem. With P-S specifications. Wrapper around Clapeyron.xy_flash, with automatic initial point calculations. Inputs:
p, pressure[Pa]s, entropy[J·K⁻¹]n, vector of number of moles of each species[mol]
All keyword arguments are forwarded to GeneralizedXYFlash.
Outputs:
result, aFlashResultstruct containing molar fractions, vapour fractions, molar volumes and the equilibrium temperature and pressure.
Clapeyron.uv_flash — Function
result = uv_flash(model, u, v, n, method::FlashMethod = GeneralizedXYFlash())
result = uv_flash(model, u, v, n; kwargs...)Routine to solve non-reactive two-phase multicomponent flash problem. With U-V specifications. Wrapper around Clapeyron.xy_flash, with automatic initial point calculations. Inputs:
u, internal energy[J]v, total volume[m³]z, vector of number of moles of each species[mol]
All keyword arguments are forwarded to GeneralizedXYFlash.
Outputs:
result, aFlashResultstruct containing molar fractions, vapour fractions, molar volumes and the equilibrium temperature and pressure.
Clapeyron.qt_flash — Function
result = qt_flash(model, q, T, n, method::FlashMethod = GeneralizedXYFlash())
result = qt_flash(model, q, T, n; kwargs...)Routine to solve non-reactive two-phase multicomponent flash problem. With vapour fraction - T specifications. Wrapper around Clapeyron.xy_flash, with automatic initial point calculations. Inputs:
q, vapour fractionT, temperature[K]n, vector of number of moles of each species[mol]
All keyword arguments are forwarded to GeneralizedXYFlash.
Outputs:
result, aFlashResultstruct containing molar fractions, vapour fractions, molar volumes and the equilibrium temperature and pressure.
Using qt_flash with q = 0 or q = 1 is equivalent to calculating bubble or dew pressures. Passing GeneralizedXYFlash as a method to bubble_pressure of dew_pressure will use qt_flash to calculate the bubble/dew point.
Clapeyron.qp_flash — Function
result = qp_flash(model, q, p, n, method::FlashMethod = GeneralizedXYFlash())
result = qp_flash(model, q, p, n; kwargs...)Routine to solve non-reactive two-phase multicomponent flash problem. With vapour fraction - P specifications. Wrapper around Clapeyron.xy_flash, with automatic initial point calculations. Inputs:
q, vapour fractionp, pressure[Pa]n, vector of number of moles of each species[mol]
All keyword arguments are forwarded to GeneralizedXYFlash.
Outputs:
result, aFlashResultstruct containing molar fractions, vapour fractions, molar volumes and the equilibrium temperature and pressure.
Using qp_flash with q = 0 or q = 1 is equivalent to calculating bubble or dew temperatures. Passing GeneralizedXYFlash as a method to bubble_temperature of dew_temperature will use qp_flash to calculate the bubble/dew point.
Clapeyron.ts_flash — Function
result = ts_flash(model, T, s, n, method::FlashMethod = GeneralizedXYFlash())
result = ts_flash(model, T, s, n; kwargs...)Routine to solve non-reactive two-phase multicomponent flash problem. With T-S specifications. Wrapper around Clapeyron.xy_flash, with automatic initial point calculations. Inputs:
T, temperature[K]s, entropy[J·K⁻¹]n, vector of number of moles of each species[mol]
All keyword arguments are forwarded to GeneralizedXYFlash.
Outputs:
result, aFlashResultstruct containing molar fractions, vapour fractions, molar volumes and the equilibrium temperature and pressure.
Clapeyron.vt_flash — Function
result = vt_flash(model, v, T, n, method::FlashMethod = GeneralizedXYFlash())
result = vt_flash(model, v, T, n; kwargs...)Routine to solve non-reactive two-phase multicomponent flash problem. With V-T specifications. Wrapper around Clapeyron.xy_flash, with automatic initial point calculations. Inputs:
v, volume[m³]T, temperature[K]n, vector of number of moles of each species[mol]
All keyword arguments are forwarded to GeneralizedXYFlash.
Outputs:
result, aFlashResultstruct containing molar fractions, vapour fractions, molar volumes and the equilibrium temperature and pressure.
Clapeyron.xy_flash — Function
xy_flash(model,spec::FlashSpecifications,z,w0::FlashResult,method::GeneralizedXYFlash)
xy_flash(model,spec::FlashSpecifications,z,w0::FlashResult;rtol = 1e-12,atol = 1e-10,max_iters = 50)Routine to solve a non-reactive multiphase, multicomponent flash problem with arbitrary specifications. Based on the unified formulation proposed by Ben Gharbia (2021). The two necessary specifications are taken from specs, the initial point is obtained from w0. Returns a FlashResult struct containing molar fractions, vapour fractions, molar volumes and the equilibrium temperature and pressure.
Examples
spec = FlashSpecifications(p = 101325.0, T = 200.15) #p-T flash
model = cPR(["ethane","propane"],idealmodel=ReidIdeal)
z = [0.5,0.5] #bulk composition
x1 = [0.25,0.75] #liquid composition
x2 = [0.75,0.25] #gas composition
compositions = [x1,x2]
volumes = [6.44e-5,0.016]
fractions = [0.5,0.5]
p0,T0 = NaN,NaN #in p-T flash, pressure and temperature are already specifications
data = FlashData(p0,T0)
result0 = FlashResult(compositions,fractions,volumes,data) #a FlashResult containing all necessary information
result = xy_flash(model,spec,z,result0) #perform the flashGeneral methods
Clapeyron.DETPFlash — Type
DETPFlash(; numphases = 2,
max_steps = 3000(numphases-1),
population_size = 50,
time_limit = Inf,
seed = 1,
stagnation_evals = 0,
stagnation_tol = 0.0,
backend = :sass,
verbose = false,
logspace = false,
equilibrium = :auto)Method to solve a non-reactive multicomponent TP-flash problem by global optimization of the Gibbs free energy.
This implementation uses an ask–tell metaheuristic backend. The current default backend is :sass (Self-adaptive spherical search, SASS). The optimizer stops when it reaches max_steps function evaluations, exceeds time_limit seconds, or triggers stagnation-based early stopping controlled by stagnation_evals and stagnation_tol.
Note: the file name is historical; the original implementation used differential evolution.
User must assume a number of phases, numphases. If true number of phases is smaller than numphases, model should predict either (a) identical composition in two or more phases, or (b) one phase with negligible total number of moles. If true number of phases is larger than numphases, a thermodynamically unstable solution will be predicted.
The equilibrium keyword allows to restrict the search of phases to just liquid-liquid equilibria (equilibrium = :lle). The default searches for liquid and gas phases.
Clapeyron.RRTPFlash — Type
RRTPFlash{T}(;kwargs...)Method to solve non-reactive multicomponent flash problem by Rachford-Rice equation.
Only two phases are supported. If K0 is nothing, it will be calculated via the Wilson correlation.
Keyword Arguments:
equilibrium::vlefor liquid vapor equilibria,:llefor liquid liquid equilibria,:unknownif not specified.K0: initial guess for the K-values.x0: initial guess for the composition of phase x.y0: initial guess for the composition of phase y.vol0: initial guesses for phase x and phase y volumes.K_tol: tolerance to stop the calculation.ss_iters: number of Successive Substitution iterations to perform.nacc: accelerate successive substitution method every nacc steps. Should be an integer bigger than 3. Set to 0 for no acceleration.second_order: wheter to solve the Gibbs energy minimization using the analytical hessian or not.noncondensables: arrays with names (strings) of components non allowed on the liquid phase. In the case of LLE equilibria, corresponds to thexphase.nonvolatiles: arrays with names (strings) of components non allowed on the vapour phase. In the case of LLE equilibria, corresponds to theyphase.flash_result::FlashResult: can be provided instead ofx0,y0andvol0for initial guesses.
Result values
This flash method will always return two phases, independently of the amount of actual phases in equilibria. The phase in the first index is considered the x phase (always liquid), whereas the phase on the second index is considered the y phase (vapour phase in VLE, liquid phase in LLE). In this way, one can recover the converged K value by dividing the compositions in the following way:
x,y = result.compositions
K = y ./ xOn two-phase equilibria, there are two different phases, with non-zero phase fractions and compositions, whereas on one-phase equilibria, one phase will have a zero phase fraction and one phase will have a phase fraction equal to sum(z_bulk). We will name the phase with non-zero phase fraction "active phase"; the phase with null phase fraction will be named "incipient" phase. A two-phase equilibria result will have two active phases and zero incipient phases, a one-phase equilibria result will have one active phase and one incipient phase. We can get the amount of active phases using Clapeyron.numphases(result,true), and check whatever phase is active via Clapeyron.is_active_phase.
K-values on results with incipient phases
On a one-phase equilibria result, the K value calculated via K = y ./ x is not a valid equilibrium K with respect to the bulk composition. This value is still useful, but some care is needed while handling this result. we can identify three cases:
- "hard" liquid and "hard" vapour: In those cases, the converged K value has all Kᵢ > 1 (vapour result), or all Kᵢ < 1 (liquid result). Because compositions in a
FlashResultare normalized, the K obtained viay ./ xwill have at least one value equal to1. - "soft" liquid and "soft" vapour: In those cases, while K converged, no vapour fraction
βin the range (0,1) can satisfyβ = Clapeyron.rachfordrice(K,z). In this case,minimum(K) < 1andmaximum(K) > 1. - "trivial" result: No separation could be done, and the flash procedure converged to the trivial result
K .= 1. The phase is still identified (so the active phase can still be identified as liquid or vapour), no incipient phase could be found. In this case,all(isone,K) == true.
Clapeyron.MichelsenTPFlash — Type
MichelsenTPFlash{T}(;kwargs...)Method to solve non-reactive multicomponent flash problem by Michelsen's method.
Only two phases are supported. If K0 is nothing, it will be calculated via the Wilson correlation.
Keyword Arguments:
equilibrium::vlefor liquid vapor equilibria,:llefor liquid liquid equilibria,:unknownif not specified.K0: initial guess for the K-values.x0: initial guess for the composition of phase x.y0: initial guess for the composition of phase y.vol0: initial guesses for phase x and phase y volumes.K_tol: tolerance to stop the calculation.ss_iters: number of Successive Substitution iterations to perform.nacc: accelerate successive substitution method every nacc steps. Should be an integer bigger than 3. Set to 0 for no acceleration.second_order: whether to solve the Gibbs energy minimization using the analytical hessian or not.noncondensables: arrays with names (strings) of components non allowed on the liquid phase. In the case of LLE equilibria, corresponds to thexphase.nonvolatiles: arrays with names (strings) of components non allowed on the vapour phase. In the case of LLE equilibria, corresponds to theyphase.flash_result::FlashResult: can be provided instead ofx0,y0andvol0for initial guesses.verbose: if set totrue, the method will display additional information in the REPL.
Result values
This flash method will always return two phases, independently of the amount of actual phases in equilibria. The phase in the first index is considered the x phase (always liquid), whereas the phase on the second index is considered the y phase (vapour phase in VLE, liquid phase in LLE). In this way, one can recover the converged K value by dividing the compositions in the following way:
x,y = result.compositions
K = y ./ xOn two-phase equilibria, there are two different phases, with non-zero phase fractions and compositions, whereas on one-phase equilibria, one phase will have a zero phase fraction and one phase will have a phase fraction equal to sum(z_bulk). We will name the phase with non-zero phase fraction "active phase"; the phase with null phase fraction will be named "incipient" phase. A two-phase equilibria result will have two active phases and zero incipient phases, a one-phase equilibria result will have one active phase and one incipient phase. We can get the amount of active phases using Clapeyron.numphases(result,true), and check whatever phase is active via Clapeyron.is_active_phase.
K-values on results with incipient phases
On a one-phase equilibria result, the K value calculated via K = y ./ x is not a valid equilibrium K with respect to the bulk composition. This value is still useful, but some care is needed while handling this result. we can identify three cases:
- "hard" liquid and "hard" vapour: In those cases, the converged K value has all Kᵢ > 1 (vapour result), or all Kᵢ < 1 (liquid result). Because compositions in a
FlashResultare normalized, the K obtained viay ./ xwill have at least one value equal to1. - "soft" liquid and "soft" vapour: In those cases, while K converged, no vapour fraction
βin the range (0,1) can satisfyβ = Clapeyron.rachfordrice(K,z). In this case,minimum(K) < 1andmaximum(K) > 1. - "trivial" result: No separation could be done, and the flash procedure converged to the trivial result
K .= 1. The phase is still identified (so the active phase can still be identified as liquid or vapour), no incipient phase could be found. In this case,all(isone,K) == true.
Clapeyron.MultiPhaseTPFlash — Type
MultiPhaseTPFlash(;kwargs...)Method to solve non-reactive multiphase (np phases), multicomponent (nc components) flash problem.
The flash algorithm uses successive stability tests to find new phases [1], and then tries to solve the system via Rachford-Rice and succesive substitution for nc * np * ss_iters iterations.
If the Rachford-Rice SS fails to converge, it proceeds to solve the system via Gibbs minimization in VT-space using lnK-β-ρ as variables [3].
The algorithm finishes when SS or the Gibbs minimization converges and all resulting phases are stable.
If the result of the phase equilibria is not stable, then it proceeds to add/remove phases again, for a maximum of phase_iters iterations.
Keyword Arguments:
K0(optional), initial guess for the constants K.x0(optional), initial guess for the composition of phase x.y0(optional), initial guess for the composition of phase y.n0(optional), initial guess for all compositions. It can be a matrix or a vector of vectors.K_tol = sqrt(eps(Float64)), tolerance to stop the calculation (norm(lnK,1) < K_tol).ss_iters = 6, number of Successive Substitution iterations to perform.nacc = 5, accelerate successive substitution method every nacc steps. Should be an integer bigger than 3. Set to 0 for no acceleration.second_order = true, whether to solve the Gibbs energy minimization using the analytical hessian or not. If set tofalse, the Gibbs minimization will be done using L-BFGS.full_tpd= false, whether to start with a simple K-split or using an intensive TPD search first.max_phases = typemax(Int), the algorithm stops if there are more thanmin(max_phases,nc)phases.phase_iters = 20, the maximum number of solve-add/remove-phase iterations.
References
- Thermopack - Thermodynamic equilibrium algorithms reimplemented in a new framework. (2020, September 08). https://github.com/thermotools/thermopack. Retrieved May 4, 2024, from https://github.com/thermotools/thermopack/blob/main/docs/memo/flash/flash.pdf
- Okuno, R., Johns, R. T. T., & Sepehrnoori, K. (2010). A new algorithm for Rachford-Rice for multiphase compositional simulation. SPE Journal, 15(02), 313–325. doi:10.2118/117752-pa
- Adhithya, T. B., & Venkatarathnam, G. (2021). New pressure and density based methods for isothermal-isobaric flash calculations. Fluid Phase Equilibria, 537(112980), 112980. doi:10.1016/j.fluid.2021.112980
Clapeyron.MCFlashJL — Type
MCFlashJL(; method = MultiComponentFlash.SSIFlash(), storage = nothing, V = NaN, K = nothing, kwargs.... )
Uses MultiComponentFlash.jl two-phase flash solver. Allows passing storage to minimize allocations. That storage can be created by calling MultiComponentFlash.flash_storage(model,p,T,z,method::MCFlashJL)
Clapeyron.GeneralizedXYFlash — Type
GeneralizedXYFlash{T}(;kwargs...)Method to solve non-reactive multicomponent, two-phase flash problem, using a generalized formulation.
Only two phases are supported. If K0 is nothing, it will be calculated via fugacity coefficients at p,T conditions.
Keyword Arguments:
equilibrium(optional) = equilibrium type ":vle" for liquid vapor equilibria, ":lle" for liquid liquid equilibria,:unknownif not specified.p0(optional), initial guess pressure, ignored if pressure is one of the flash specifications.T0(optional), initial guess temperature, ignored if temperature is one of the flash specifications.K0(optional), initial guess for the K-values.x0(optional), initial guess for the composition of phase x.y0= optional, initial guess for the composition of phase y.vol0= optional, initial guesses for phase x and phase y volumes.atol= absolute tolerance to stop the calculation.rtol= relative tolerance to stop the calculation.max_iters= maximum number of iterations.flash_result::FlashResult: can be provided instead ofx0,y0andvol0for initial guesses.
Clapeyron.RRQXFlash — Type
RRQXFlash{T}(;kwargs...)Method to solve non-reactive multicomponent, two-phase flash problem, using a generalized formulation.
Only two phases are supported. If K0 is nothing, it will be calculated via fugacity coefficients at p,T conditions.
Keyword Arguments:
equilibrium(optional) = equilibrium type ":vle" for liquid vapor equilibria, ":lle" for liquid liquid equilibria,:unknownif not specifiedp0(optional), initial guess pressure, ignored if pressure is one of the flash specifications.T0(optional), initial guess temperature, ignored if temperature is one of the flash specifications.K0(optional), initial guess for the K-values.x0(optional), initial guess for the composition of phase x.y0= optional, initial guess for the composition of phase y.vol0= optional, initial guesses for phase x and phase y volumes.atol= absolute tolerance to stop the calculation.rtol= relative tolerance to stop the calculation.max_iters= maximum number of iterationsflash_result::FlashResult: can be provided instead ofx0,y0andvol0for initial guesses.
Clapeyron.RRXYFlash — Type
RRXYFlash{T}(;kwargs...)Method to solve non-reactive multicomponent, two-phase flash problem, using a generalized succesive substitution formulation.
Only two phases are supported. If K0 is nothing, it will be calculated via fugacity coefficients at p,T conditions.
Keyword Arguments:
equilibrium(optional) = equilibrium type ":vle" for liquid vapor equilibria, ":lle" for liquid liquid equilibria,:unknownif not specified.p0(optional), initial guess pressure, ignored if pressure is one of the flash specifications.T0(optional), initial guess temperature, ignored if temperature is one of the flash specifications.K0(optional), initial guess for the K-values.x0(optional), initial guess for the composition of phase x.y0= optional, initial guess for the composition of phase y.vol0= optional, initial guesses for phase x and phase y volumes.tol_xy= absolute composition tolerancetol_pT= relative temperature or pressure tolerance.tol_of= absolute objective property tolerance.max_iters= maximum number of iterations.ss_iters= maximum number of inner sucessive substitution iterations.flash_result::FlashResult: can be provided instead ofx0,y0andvol0for initial guesses.