We develop and analyze an algorithmic framework and library of parallel automatically differentiable data-types written in the C++ programming language. In addition to representing variables and discretized expressions on a simulation grid, the data-types hide algorithms employed behind the scenes capable of automatically computing the sparse analytical Jacobian. Using the library, reservoir simulators can be developed rapidly by simply writing the residual equations, and without any hand differentiation, loops, or any other low-level constructs. The key challenge addressed is a technical development to enable this to run fast. Faster than if any of several existing automatic differentiation packages were used, faster than any purely Object Oriented implementation, and at least as fast as if a development team implemented hand-optimized residuals, analytical derivatives, and Jacobian assembly routines.
This is achieved by extending a generic programming technique specific to the C++ programming language known as Expression Templates. The extension enables its application to handle nested abstract types including sparse vector composites. Consequently, the library implementation can handle the complexity of any reservoir simulation model with optimal use of microprocessor hardware.
We demonstrate the ease of use of the library by presenting an efficient and rapidly developed fully-implicit simulator. Performance analysis is performed with varying grid size and is bench-marked with structured implementations. The tests are run with widely used compilers on standard microprocessors.
Next generation simulators aim to simultaneously (1) leverage current technology to solve today's problems most efficiently, and (2) be easily extendable to leverage tomorrow's technology to solve tomorrow's problems most efficiently. Towards this, the General Purpose paradigm makes conceptual abstraction of equations and unknowns to achieve extendability to a wide range of formulations and recovery processes 1,2,3,4. Another kind of conceptual abstraction is on numerical formulations and solution processes, and aims to address extendability to evolving computer technologies and solution algorithms.
Motivation. Next generation simulator designs translate both conceptual abstractions into appropriate software-engineering abstractions. In this fashion, typical designs are made up of modules in a multi-layered framework 5,6,7,8. Each layer consists of modules with well defined interfaces that implement a certain level of functionality. Higher-layer modules implement increasingly complex functionality by using lower-layer modules. Apparent advantages of taller hierarchies are greater flexibility, extendability, and reliability.