We present a flexible general-purpose reservoir simulation framework based on Automatic Differentiation (AD). The new AD-based simulator supports unstructured grids, employs a generalized Multi-Point Flux Approximation (MPFA) for spatial discretization, and uses a multi-level Adaptive Implicit Method (AIM) for time discretization. Given the discrete form of the governing nonlinear residual equations and a declaration of the independent variables, the AD library employs advanced expression templates with block data-structures to automatically generate compact computer code for the Jacobian matrix. Test results indicate that the construction of the Jacobian matrix with MPFA is efficient, and the overhead associated with treating a two-point flux approximation (TPFA) as a special case of MPFA is negligible. Our AIM implementation is designed to facilitate a systematic application of the method to new fluid models and variable formulations. The AD simulator allows for any combination of TPFA (Two-Point Flux Approximation), MPFA, FIM (Fully Implicit Method), and AIM. The generic and modular design is amenable to extension, both in terms of modeling additional flow processes and implementing new numerical methods. The AD-based modeling capability is demonstrated for highly nonlinear compositional problems using challenging large-scale reservoir models that include full-tensor permeability fields and non-orthogonal grids. The behaviors of TPFA and several MPFA schemes are analyzed for both FIM and AIM simulations. The implications of using MPFA and AIM on both the nonlinear and linear solvers are discussed and analyzed.

You can access this article if you purchase or spend a download.