Overview phase equilibrium (flash)
A phase equilibrium calculation determines subject to specified constraint, e.g. fixed pressure and temperature, present phases and the composition and fraction of each present phase. It is an iterative calculation which often use specialized algorithms; see (Parekh et al, 1998; Gernert et al, 2014).
Phase equilibrium calculations are time consuming and will dominate the total CPU usage, up to 95% according to (Trapp, 2014). Similar numbers have also been observed in this work.
To achieve competitive performance:
The flash calculation is an integrated part of following models:
But it's only in MultiPhaseProperties and SatPhaseEquilibriumProperties that contain variables that specfiy which phases that are available and the amount and composition of each phase. This information is available in the record eqProperties.
The phase equilibrium calculation can in the general case be computed faster and be robuster if good start values can be provided (note: when using external medium not all property packages support this functionality). Start values can be set by modyfing the init record.
Faster calculations
For a fluid with many supported phases, the calculation will be faster if this set of potential phases can be minimized. This is supported by presentPhases
that specifies which possible phases the equilibrium calculation should be searching for, it needs to be a sub-set of the phases defined in the phases and presentPhasesStatus
that specify the status of the possible present phases.
Example 1: A pipe simulation that use complex fluids that has many supported phases, e.g. vapor, liquid1, liquid2 etc. But at a downstream position in the simulation model we know in advance that the only possible phases are vapor,liquid. It is then possible to specify that the only possible phases (presentPhases
) are vapor and liquid (but we don't know if both always exist) which makes the equilibrium calculation faster.
The equilibrium calculation can be even faster if we have more information, e.g. we know that the vapor and liquid always exist, i.e. we can assume that we are always in the two-phase zone. This extra information can be provided by specifying presentPhasesStatus=alwaysPresent
.
Example 2: If we don't have information about the phases, general flash calculations are used in RefProp. But it's possible to use the faster flash calculations flash2ph or flash1ph if we know in advance the region it's operate in.
Example 3: The equilibrium phase calculations can be skipped if we know in advance that only one phase is present, i.e. size(presentPhase,1) ==1 . In this special case the value of presentPhasesStatus can be ignored as there are no other possible phase combinations (i.e. the phase is always present)
[1] Vipul Parekh and Paul Mathias, Efficient flash calculations for chemical process design – extension to the Boston-Britt Inside-Out flash algorithm to extreme conditions and new flash types, Computers and chemical engineering, vol 22 pp 1371-1380 (1998)
[2] Johannes Gernert, Andreas Jäger and Roland Span. Calculation of phase equilibria for multi-component mixtures using highly accurate Helmholtz energy equations of state, Fluid Phase Equilibria 375 (2014) 209–218.
[3] C. Trapp, F.Casella, T. Stelt, P. Colonna. Use of External Fluid property Code in Modelica of a Pre-combustion Co2 Capture Process Involving Multi-Component, Two-Phase Fluids, Proceedings of the 10th International Modelica 2014 Conference, Lund, Sweden, March 10-12 2014.