Application of an automatic differentiation tool in the development of a compositional reservoir simulator

Automatic differentiation is an approach to numerically compute derivatives both accurately and efficiently. This can be quite valuable, for example, in the fully implicit solution of compositional reservoir equations. We describe the procedures necessary to apply the ADIFOR (Automatic Differentiation of Fortran) tool to the IPARS (Integrated Parallel Accurate Reservoir Simulator) compositional reservoir simulator and the approaches used to exploit the sparsity in the required Jacobian matrix. Values and execution times of the ADIFOR-generated derivatives are compared with a handwritten code that implements analytically derived expressions for the derivatives. Copyright © 1999 John Wiley & Sons, Ltd.