PRST - Python Reservoir Simulation Toolbox
Abstract
In this thesis I have developed a prototype for a software framework for thesimulation of flow in porous media,based on the MATLAB Reservoir Simulation Toolkit (MRST).The software -- Python Reservoir Simulation Toolkit -- is written in the Pythonprogramming language.First,the equations for single-phase flow in porous media are developed anddiscretized using the finite-volume method.%TODO dsicertte?The nonlinear systems of equations that arise are solved using Newton's method,with Jacobian matrices found using automatic differentiation.
Automatic differentiation is a method for finding gradients and Jacobians ofprogramatically defined functions.It is based on decomposing a function into elementary operations such asaddition and multiplication,and then using the chain rule repeatedly.
Then, MATLAB and Python's capabilities are compared.Software unit testing is introduced as a tool to ensure the correctness of PRSTfunctions compared to the equivalent MRST functions.Unstructured grids are introduced-- and several tools for visualizing unstructured grids are investigated.After that, an example of how compilation and just-in-time compilation can beused to improve Python performance is shown, using Cython and Numba.Finally, a flow simulator example from MRST is converted to use PRST, and thevisualization capability and performance is compared.