Lawrence Berkeley National Laboratory
Application of automatic differentiation in TOUGH2
- Author(s): Kim, Jong G.
- Finsterle, Stefan
- et al.
Automatic differentiation (AD) is a way to accurately and efficiently compute derivatives of a function written in computer codes. We describe the procedures necessary to apply the AD method to the multiphase, multicomponent, nonisothermal flow simulator TOUGH2. In particular, we apply the AD method to the ECO2 module of the TOUGH2 code to explore a scheme for efficiently calculating the Jacobian matrix, which is required by the Newton-Raphson method for handling the nonlinearities arising at each iteration. The ECO2 module allows TOUGH2 to accurately simulate CO2 sequestration in aquifers. The robustness and efficiency of the AD-generated derivative codes are compared to the conventional derivative computation approach based on first-order finite differences (FD). Our result with the test problem set indicates that the AD-generated derivative code could improve the convergence behavior in the linear solution step, taking less computational time to compute one linear matrix system.