# A Collection of Analytical Solutions for the Flash Equilibrium Calculation Problem

- 61 Downloads

## Abstract

We describe an interesting family of closed-form solutions for the flash equilibrium calculation problem. These solutions can be used as benchmark solutions for verification of numerical solvers of the flash equilibrium problem for multicomponent mixtures. To obtain a problem possessing an analytical solution, we consider a special form of the free energy. Although this form of the free energy is artificial, it captures qualitatively several features that are present in the realistic cases too. The procedure is first illustrated on a 1-D two-phase case and is further generalized to multicomponent mixtures in two and more phases, and also to a problem including the capillary pressure effect.

## Keywords

Phase equilibrium problem Multicomponent mixtures Flash equilibrium calculation Analytical solution Closed-form solution Capillary pressure effect## 1 Introduction

Phase stability testing and phase equilibrium calculation are important problems in reservoir simulation with many applications including enhanced oil recovery or \(\hbox {CO}_2\) sequestration. Most of the existing codes use a kind of the so-called PTN-flash, i.e., calculation of phase equilibrium of a multicomponent mixture in a system with prescribed pressure, temperature, and overall mole numbers (or mole fractions) (Michelsen 1982a, b; Michelsen and Mollerup 2004; Firoozabadi 1999, 2015). Recently, alternative flash formulations have received some attention including the VTN-formulation (with prescribed total volume, temperature, and mole numbers) (Mikyška and Firoozabadi 2012; Jindrová and Mikyška 2013, 2015a, b; Polívka and Mikyška 2014; Michelsen 1999; Castier 2014) and UVN formulation (prescribed total internal energy, volume, and mole numbers) (Castier 2010; Qiu et al. 2014; Saha and Carroll 1997; Castier 2009). The development of alternative flash formulations can be partially motivated by their relevance for modeling unconventional reservoirs, in which capillary effects are strong and cannot be neglected. For a formulation of the flash equilibrium calculation including the capillary effects in the VTN-settings, we refer the reader to Kou and Sun (2018).

With the development of new formulations of the equilibrium flash problem and their new implementations, we are faced with the problem of how to verify the correct function of the implemented code. In other fields of applied mathematics, say computational fluid dynamics or flow and transport in porous media, the common practice is to test a numerical code on a simple problem with known analytical solution (Buckley and Leverett 1942; McWhorter and Sunada 1990; Chen et al. 1992; McWhorter and Sunada 1992; Fučík et al. 2007, 2008, 2016). The numerical solution obtained by a numerical model is compared to the analytical solution and convergence of the numerical solutions toward the analytical one can be established (Fučík and Mikyška 2011). To the best of author’s knowledge, it seems that in the context of phase equilibrium calculations such a comparison of numerically computed solutions with analytical benchmark solutions has never been done. This is probably caused by the fact that the development of flash equilibrium calculators is directed toward models using cubic or more complex realistic equations of state, while the flash equilibrium cannot be solved analytically even for a two-component system described by the van der Waals equation of state.

The main goal of this paper is to develop a collection of suitable problems with known analytical (or closed-form) solutions which can be used as benchmark solutions when testing convergence of the numerical solutions computed by flash equilibrium calculation codes. The procedure will be based on a unified formulation of the phase equilibrium problem described recently in Smejkal and Mikyška (2018), which can include all the three formulations (PTN, VTN, and UVN) mentioned above. To obtain an analytical solution, we assume that the energy function in this formulation is piecewise quadratic. Although such a form does not correspond to realistic equations of state, it mimics some important features of realistic free energies in the PTN-flash problem, which is discussed in the text. Next, we describe the benchmark problem in the simplest case—1D-flash with two phases. The solution procedure is then generalized to more dimensions and more phases. Other possible generalizations are discussed in the text. Then, we introduce another benchmark solution whose free energy function is a polynomial of order 4. As this function is smooth, this problem can be used for testing VTN-flash solvers. Moreover, the VTN-formulation allows for an easy formulation of the phase equilibrium problem with capillary pressure effect, which may play an important role if the fluid is confined in a nanoporous medium. We present an analytical solution for a simplified VTN-flash problem including capillarity in the last section.

## 2 Unified Formulation of the Phase Equilibrium Problem

*f*defined on a convex domain \(D\subset \mathbb {R}^n\) and a point \(\mathbf{x}^*\in D\), we are searching for \(p\in \mathbb {N}\) and affine independent vectors \(\mathbf{x}_1,\dots ,\mathbf{x}_p\in D\) and coefficients \(\alpha _1,\dots ,\alpha _p>0\) such that

*f*is the Helmholtz free energy density

*A*/

*V*written as a function of the molar concentrations \(N_i/V\) of individual components (temperature is assumed to be constant), \(\mathbf{x}_i\) is the vector of molar concentrations of individual components in phase

*i*,

*n*is equal to the number of components, and \(\alpha _i\) is the volume fraction (or saturation) of phase

*i*, and \(\mathbf{x}^*\) is the prescribed vector of overall concentrations of all components in the mixture. For realistic equations of state, such as the Peng–Robinson equation (Peng and Robinson 1976), the function

*f*is a smooth (at least twice continuously differentiable) function which is bounded from below. For the PTN-flash,

*f*is the Gibbs free energy per one mole

*G*/

*N*written as a function of \(n_c-1\) independent mole fractions where \(n_c\) is the number of mixture components (pressure and temperature are assumed to be constant). Obviously, the case \(n_c=1\) is excluded by this formulation. The flash dimension

*n*is thus equal to \(n_c-1\). The coefficient \(\alpha _i\) is now the molar fraction of phase

*i*, and finally \(\mathbf{x}^*\) is the vector of prescribed overall mole fractions of the \(n_c-1\) independent components. Compared to the VTN-flash, in the PTN-formulation, there is a complication caused by the fact that for a given pressure, temperature, and mole fractions, the molar volume of the system is not given uniquely. One has to find all roots of the equation of state, where different roots correspond to different phases and the root with the lowest value of the Gibbs free energy of the system is accepted. Therefore, the definition of the Gibbs free energy has the following form

*c*such that \(P^{(EOS)}(cx_1,\dots ,cx_{n_c})=P^*\). In the equations above, \(\mu _i\) denotes the chemical potential of component

*i*, which can be derived from a given equation of state \(P^{(EOS)}\) (Firoozabadi 1999), \(\mathbf{x}=(x_1,\dots ,x_{n_c-1})^T\), and \(x_{n_c}=1-x_1-\dots -x_{n_c-1}\). Both functions \(P^{(EOS)}\) and \(\mu _i\) additionally depend on temperature, but this dependence is not indicated as the temperature in the PTN-flash is assumed to be constant. In the PTN-flash, the function

*f*is also bounded from below, continuous, but because of the root-selection procedure [minimization in Eq. (3)] only piecewise continuously differentiable. The points in which

*f*is not differentiable are exactly the points at which different branches corresponding to different phases intersect. This form of the Gibbs free energy gave the motivation for the family of benchmark problems described below.

Fortunately, the points of non-differentiability are inside the unstable region. The stable phases occur at the points at which *f* is differentiable. Therefore, using the unified formulation, the following first-order necessary conditions for optimality can be derived:

### Theorem 1

^{1}\(p\le n+1\). For the VTN-flash, \(\nabla f(x)\) is the vector of chemical potentials of all components, and equations (4a) state the equality of chemical potentials of each component in all phases. From the definition of the Helmholtz free energy density, it follows that \(\nabla f(\mathbf{x})\cdot \mathbf{x} - f(\mathbf{x})\) is equal to minus pressure, and thus, equation (4b) states the equality of pressures in all phases. For the PTN-flash, it follows from the Gibbs–Duhem relation that

## 3 Benchmark Solution for the 1D Two-Phase Flash

*f*in the following form

*f*non-convex, parameters \(a_i\), \(b_i\), and \(c_i\) have to be selected so that the graphs of \(f_1\) and \(f_2\) intersect each other at some point. The intersection point is given by the following equation

*f*is convex. No two-phase region appears in this case. If \(D>0\), then we have two intersection points given by

*a*denotes the common value of \(a_1\) and \(a_2\). For any \(x^*\in (x_1,x_2)\), the phase properties are given by \(x_1\) and \(x_2\). For all other \(x^*\), the system remains in a single phase.

*D*is given by (8). As \(\tilde{D}>0\), we get two roots \(x_2\) corresponding to two different two-phase regions

## 4 Extension of the Benchmark Solution to the Multidimensional Case

*f*to be in the form of (5) with

*f*non-convex, parameters \(\mathbb {A}_i\), \(\mathbf{b}_i\), and \(c_i\) have to be selected so that the graphs of \(f_1\) and \(f_2\) intersect each other at some point. The intersection points are given by the following equation

## 5 Examples of Benchmark Solutions

In this section, we provide an example of a benchmark solution for each case discussed above.

### Example 1

In the first example, we consider a one-dimensional flash problem with parameters \(a_1=a_2=10\), \(b_1=-10\), \(b_2=0\), \(c_1=5\), and \(c_2=0.5\). For this settings, Eq. (13) provides \(x_1=0.2\), \(x_2=0.7\), and for \(x^*=0.4\) we get \(\alpha _1=0.6\) and \(\alpha _2=0.4\). This solution is shown in Fig. 1.

### Example 2

### Example 3

Finally, we consider a two-dimensional flash problem with \(n=2\), \(\mathbb {A}_1=\mathbb {A}_2=\mathbb {A}=10\mathbb {I}_2\), \(\mathbf{b}_1=3\mathbf{e}\), \(c_1=1\), \(\mathbf{b}_2=5\mathbf{e}\), \(c_2=0\), where \(\mathbb {I}_2\) is the identity matrix on dimension 2, and \(\mathbf{e}=(1,1)^T\). This may represent the PTN-flash problem with 3 components and two phases. In Fig. 3, we present the resulting two-phase region, taking into account Eq. (30) and the non-negativity of the mole fractions. In Fig. 3, we also present resulting phase splits for different values of \(\mathbf{x}^*\). The values of \(\mathbf{x}^*\) are indicated by the black points in the two-phase zone, while the resulting phase properties are denoted by the colored points. The arrows indicate the tie-lines along which we obtain the same split phases.

## 6 Further Generalizations

### Example 4

Let us consider a one-dimensional flash problem with \(n=1\), \(p=3\), \(a_1=a_2=a_3=10\), \(b_1=-10\), \(c_1 = 5\), \(b_2 = 0\), \(c_2 = 0.5\), \(b_3 = -5\), and \(c_3 = 2.4\). This may represent the PTN-flash problem with 2 components and two phases. In Fig. 4, we present the resulting phase properties.

*i*and

*j*, where \(i\ne j\in \widehat{3}\). The true solution corresponds to the pair of functions \(f_i\) and \(f_j\) with the minimum value of the objective function. As can be seen in Fig. 4, the optimal phase split properties are

### 6.1 Three-Phase Flash Problem

*n*-dimensional flash problem with 3 functions \(f_i\) of the form

*F*is preferred).

### Example 5

In the last example, we investigate the two-dimensional flash problem with 3 functions \(f_i\) of the form as described in the previous section with \(n=2\), \(p=3\), \(\mathbb {A} = 16\mathbb {I}_2\), \(\mathbf{b}_1=(-16,-8)^T\), \(\mathbf{b}_2=(-8,-16)^T\), \(\mathbf{b}_3=(-8,-8)^T\), \(c_1 = 5\), \(c_2=5\), \(c_3=2\). This may represent a PTN-flash problem with three components splitting up to three phases. In Fig. 5, we present the resulting three-phase region (the cyan region in the middle) and connected two-phase regions (yellow regions). In Fig. 5, we also present resulting phase splits for different values of \(\mathbf{x}^*\). The values of \(\mathbf{x}^*\) are indicated by the black points in the two-phase zone, while the resulting phase properties are denoted by the colored points. The arrows indicate the tie-lines along which we obtain the same split phases. Note that in the 3-phase region, the phase split properties are constant.

## 7 Benchmark Solution for the VTN-Flash Equilibrium Calculation

*f*to be a polynomial of order 4. Using a suitable rescaling, the coefficient at the highest order term can be set to one. Therefore, we have

*c*and

*d*, which can be, without loss of generality, chosen arbitrarily, e.g., \(c=d=0\). As we are seeking the non-trivial solutions of this system, we can divide by the nonzero factor \((x_1-x_2)\) to yield

### Example 6

We consider the one-dimensional VTN-flash problem with the free energy of the form (46) and parameters \(a=-2000\), \(b=1.18\times 10^6\), \(c=0\), and \(d=0\). For this settings, Eq. (52) provides \(x_1=100\), \(x_2=900\), and for \(x^*=220\) we get \(\alpha _1=0.85\) and \(\alpha _2=0.15\). This solution is shown in Fig. 6.

## 8 Benchmark Solution for the VTN-Flash Problem with Capillarity

*r*and wetting angle \(\theta \), the capillary pressure is given by the Young-Laplace equation of capillarity which reads as:

*P*is the parachor of the component. Combining the last three equations, we end up with the following system of equations describing the VTN-equilibrium including the capillary pressure effect:

*x*-variables, we derive the following pair of solutions

### Example 7

We consider the one-dimensional VTN-flash problem with the free energy of the form (46) with parameters \(a=-2000\), \(b=1.18\times 10^6\), \(c=0\) and \(d=0\), and various capillary pressure parameters *C*. For \(C=0\), we get the same result as in the previous example. Next, we evaluate solutions for parameters \(C\in \{0.2,0.4,0.6,0.8\}\). These solutions are displayed in Fig. 7. As we can see from Fig. 7, for \(C\in (0,\frac{1}{3})\), the phase split consists from a stable vapor phase and the metastable liquid. For \(C\in (\frac{1}{3},1)\), we get equilibrium between the stable vapor and an unstable phase (note that the point \(x_2\) lies in the concave part of the free energy). Such a splitting is not physically relevant. If we increase the value *C* above one, we would get equilibrium between the metastable vapor and an unstable phase. This is not physically realistic either. Therefore, to get physically relevant examples, the values of *C* should be kept within the interval \((0,\frac{1}{3})\).

## 9 Summary and Conclusions

In this paper, a family of simple flash problems has been introduced for which the properties of the split phases are solvable exactly. Although the concept and the involved algebra are very simple, the flash problems can be derived which have desirable features for testing purposes such as multiple two-phase zones, three-phase zone, or existence of local solutions that are not global. The concept introduced here can be generalized readily to multiphase flash problems with any number of components and phases. An alternative formulation of the flash problem has been introduced which mimics properties of the Helmholtz free energy density in the VTN-flash problem. The corresponding benchmark solution can be used for testing the VTN-flash solvers. The VTN-based formulation can be extended to treat problems in a confined medium for which capillarity plays a major role. An open question remains whether the simplicity of such solutions allows for using them for derivation of an analytical solution of a transport problem in a porous medium with multiple phases and components, albeit in a very simplified physical settings. Such a solution would be very useful for testing compositional models, for which no analytical solutions with multiple components in two phases are, to the best of author’s knowledge, available. This may be a topic of further research.

## Footnotes

- 1.
If

*X*is an arbitrary subset of \(\mathbb {R}^n\), then any point \(\mathbf x\) from the convex hull of*X*can be written as a convex combination of at most \(n+1\) points in*X*, i.e., there exist \(\mathbf{x}_1,\dots ,\mathbf{x}_{n+1}\in X\) and \(\alpha _1,\dots ,\alpha _{n+1}\ge 0\) such that \(\mathbf{x}=\sum \nolimits _{i=1}^{n+1}\alpha _i\mathbf{x}_i\) and \(\sum \nolimits _{i=1}^{n+1}\alpha _i=1\). The proof can be found in Rockafellar (1970).

## References

- Buckley, S.E., Leverett, M.C.: Mechanism of fluid displacement in sands. Trans. Am. Inst. Min. Metall. Eng.
**146**, 107–116 (1942)Google Scholar - Castier, M.: Solution of the isochoric-isoenergetic flash problem by direct entropy maximization. Fluid Phase Equilib.
**276**, 7–17 (2009)CrossRefGoogle Scholar - Castier, M.: Dynamic simulation of fluids in vessel via entropy maximization. J. Ind. Eng. Chem.
**16**, 122–129 (2010)CrossRefGoogle Scholar - Castier, M.: Helmholtz function-based global phase stability test and its link to the isothermal-isochoric flash problem. Fluid Phase Equilib.
**379**, 104–111 (2014)CrossRefGoogle Scholar - Chen, Z.X., Bodvarsson, G.S., Witherspoon, P.A.: Exact integral solutions for 2-phase flow—comment. Water Resour. Res.
**28**(5), 1477–1478 (1992)CrossRefGoogle Scholar - Firoozabadi, A.: Thermodynamics of Hydrocarbon Reservoirs. McGraw-Hill (1999)Google Scholar
- Firoozabadi, A.: Thermodynamics and Applications of Hydrocarbons Energy Production. McGraw-Hill Education (2015)Google Scholar
- Fučík, R., Mikyška, J.: Discontinous Galerkin and mixed-hybrid finite element approach to two-phase flow in heterogeneous porous media with different capillary pressures. Procedia Comput. Sci.
**4**, 908–917 (2011). https://doi.org/10.1016/j.procs.2011.04.096 CrossRefGoogle Scholar - Fučík, R., Mikyška, J., Beneš, M., Illangasekare, T.H.: An improved semi-analytical solution for verification of numerical models of two-phase flow in porous media. Vadose Zone J.
**6**(1), 93–104 (2007). https://doi.org/10.2136/vzj2006.0024 CrossRefGoogle Scholar - Fučík, R., Mikyška, J., Beneš, M., Illangasekare, T.H.: Semianalytical solution for two-phase flow in porous media with a discontinuity. Vadose Zone J.
**7**(3), 1001–1007 (2008). https://doi.org/10.2136/vzj2008.0155 CrossRefGoogle Scholar - Fučík, R., Beneš, M., Illangasekare, T.H.: Multidimensional self-similar analytical solutions of two-phase flow in porous media. Adv. Water Res.
**90**, 51–56 (2016). https://doi.org/10.1016/j.advwatres.2016.02.007 CrossRefGoogle Scholar - Jindrová, T., Mikyška, J.: Fast and robust algorithm for calculation of two-phase equilibria at given volume, temperature, and moles. Fluid Phase Equilib.
**353**, 101–114 (2013)CrossRefGoogle Scholar - Jindrová, T., Mikyška, J.: General algorithm for multiphase equilibria calculation at given volume, temperature, and moles. Fluid Phase Equilib.
**393**, 7–25 (2015)CrossRefGoogle Scholar - Jindrová, T., Mikyška, J.: Phase equilibria calculation of \(\text{ CO }_{2}\text{-H }_2\text{ O }\) system at given volume, temperature, and moles in \(\text{ CO }_2\) sequestration. IAENG J. Appl. Math.
**45**(3), 183–192 (2015)Google Scholar - Kou, J., Sun, S.: A stable algorithm for calculating phase equilibria with capillarity at specified moles, volume, and temperature using a dynamic model. Fluid Phase Equilib.
**456**, 7–24 (2018)CrossRefGoogle Scholar - Locatelli, M., Schoen, F.: Global Optimization—Theory, Algorithms, and Applications. MOS-SIAM Series on Optimization, vol. MO15. SIAM, Philadelphia (2013). ISBN: 978-1-611972-66-5CrossRefGoogle Scholar
- McWhorter, D.B., Sunada, D.K.: Exact integral solutions for 2-phase flow. Water Resour. Res.
**26**(3), 399–413 (1990)CrossRefGoogle Scholar - McWhorter, D.B., Sunada, D.K.: Exact integral solutions for 2-phase flow. Water Resour. Res.
**28**(5), 1479–1479 (1992)CrossRefGoogle Scholar - Michelsen, M.L.: The isothermal flash problem, Part 1. Stability. Fluid Phase Equilib.
**9**(1), 1–19 (1982)CrossRefGoogle Scholar - Michelsen, M.L.: The isothermal flash problem, Part 2. Phase-split computation. Fluid Phase Equilib.
**9**, 21–40 (1982)CrossRefGoogle Scholar - Michelsen, M.L.: State function based flash specifications. Fluid Phase Equilib.
**158**, 617–626 (1999)CrossRefGoogle Scholar - Michelsen, M.L., Mollerup, J.M.: Thermodynamic Models: Fundamentals and Computational Aspects. Tie-Line Publications, Holte (2004)Google Scholar
- Mikyška, J., Firoozabadi, A.: Investigation of mixture stability at given volume, temperature, and number of moles. Fluid Phase Equilib.
**321**, 1–9 (2012)CrossRefGoogle Scholar - Peng, D.E., Robinson, D.B.: A new two-constant equation of state. Ind. Eng. Chem. Fundam.
**15**, 59–64 (1976)CrossRefGoogle Scholar - Polívka, O., Mikyška, J.: Compositional modeling in porous media using constant volume flash and flux computation without the need for phase identification. J. Comput. Phys.
**272**, 149–179 (2014)CrossRefGoogle Scholar - Qiu, L., Wang, Y., Reitz, R.D.: Multiphase dynamic flash simulations using entropy maximization and application to compressible flow with phase change. AIChE J.
**60**(8), 3013–3024 (2014)CrossRefGoogle Scholar - Saha, S., Carroll, J.J.: The isoenergetic-isochoric flash. Fluid Phase Equilib.
**138**, 23–41 (1997)CrossRefGoogle Scholar - Smejkal, T., Mikyška, J.: Unified presentation and comparison of various formulations of the phase stability and phase equilibrium calculation problems. Fluid Phase Equilib.
**476**, 61–88 (2018). https://doi.org/10.1016/j.fluid.2018.03.013 CrossRefGoogle Scholar - Rockafellar, R.T.: Convex Analysis. Princeton University Press, Princeton (1970)CrossRefGoogle Scholar
- Weinaug, C.F., Katz, D.L.: Surface tension of methane–propane mixtures. Ind. Eng. Chem.
**36**, 243 (1943)Google Scholar