# Compositional flash calculations

The miscible flow models available in PorousFlow use a compositional flash to determine the amount of each fluid phase present for the given set of persistent primary variables using the Rachford-Rice equation (Rachford and Rice, 1952)

(1) where is the total mass fraction of fluid component summed over all fluid phases (2) is the equilibrium constant (3) that relates the mass fraction of fluid component in the gas phase () to the mass fraction in the liquid phase (), and is the mass fraction of fluid in the gas phase, which for a two-phase model is (4) where and are the saturations of the gas and liquid phases, respectively, and and are the densities of the gas and liquid phases, respectively.

The Rachford-Rice equation, Eq. (1), is solved for , after which the unknown gas saturation can be calculated. The Rachford-Rice equation can be solved analytically for the case where there are two fluid components, whereby is (5)

For cases where there are more than two fluid components, however, Eq. (1) must be solved numerically. Fortunately, the Rachford-Rice equation has the nice numerical property that Eq. (1) is monotonically varying with , so that numerical solution requires only a few iterations, and is therefore numerically inexpensive.

Once the vapor mass fraction has been calculated, the mass fractions of fluid component in each phase can be calculated (6)

## References

1. H. H. Rachford and J. D. Rice. Procedure for use of electrical digital computers in calculating flash vaporisation hydrocarbon equilibrium. Journal of Petroleum Technology, 4:327–328, 1952.[BibTeX]