We present a novel nonlinear formulation for modeling reactive-compositional flow and transport in the presence of complex phase behavior due to a combination of thermodynamic and chemical equilibria in multi-phase systems. We apply this formulation to model precipitation/dissolution of minerals in reactive multiphase flow in subsurface reservoirs. The proposed formulation is based on the consistent element balance reduction of the molar (overall composition) formulation. To predict the complex phase behavior in such systems, we include the chemical equilibrium constraints to the multiphase multicomponent negative flash calculations and solve the thermodynamic phase and chemical phase equilibria simultaneously. In this solution, the phase equilibrium is represented by the partition coefficients, whereas the chemical equilibrium reaction is represented by the activity coefficients model. This provides a generic treatment of chemical and thermodynamic equilibrium within the successive substitution loop of multiphase flash to accommodate chemical equilibrium reactions (precipitation and dissolution reactions). Equilibrium Rate Annihilation matrix allows us to reduce the governing component conservation equations to element conservation equations, while the coupling between chemical and thermodynamic equilibrium is captured by a simultaneous solution of modified multiphase flash equations. The element balance equation written in terms of overall component mole fractions is modified and defined in terms of element mole fractions. Therefore, the primary set of governing equations are the element balance equations and the kinetic equations. This element composition of the mixture serves as an input to the modified multiphase flash computations, whereas the output is fractions of components in each phase, including solids. The nonlinear element-based governing equations are solved with the modified version of the operator-based linearization (OBL) approach where the governing equations are formulated in terms of space-and state-dependent parameters constrained by the solution of the extended multiphase flash. The element balance molar formulation along with the modified multiphase flash has been tested in a simple transport model with dissolution and precipitation reactions. The simulation of multidimensional problems of practical interest has been performed using the adaptive OBL technique. This is the first time when a robust multiphase multicomponent flash based on element fractions is coupled with an element balance-based compositional formulation and tested for multidimensional problems of practical interest. The proposed technique improves both robustness and performance of complex chemical models. simulation being the main tool in this process. Therefore, there are continuous efforts to improve the performance of the reservoir simulators and also implement a higher degree of physics into them in order to capture detailed subsurface processes with greater accuracy and without loss of computational efficiency. Reser...