Phase changes are known to cause convergence problems for integration of stiff kinetics in thermal and compositional reservoir simulations. We propose an algorithm for detection and location of phase changes based on discrete event system theory. The algorithm provides a robust way for handling the switching of variables and equations required when the number of phases changes. We extend the method to handle full phase equilibrium described by an equation of state. Experiments show that the new algorithm improves the robustness of the integration process near phase boundaries by lowering the number of convergence and error test failures by more than 50% compared to direct integration without the new algorithm.
To facilitate the algorithmic development we construct a virtual kinetic cell model. We use implicit one-step ESDIRK (Explicit Singly Diagonal Implicit Runge-Kutta) methods for integration of the kinetics. The kinetic cell model serves both as a tool for the development and testing of tailored solvers as well as a testbed for studying the interactions between chemical kinetics and phase behavior. A comparison between a K-value correlation based approach and a more rigorous equation of state based approach to phase equilibrium shows that phase behavior may significantly impact the reaction paths.