An Introduction to the Numerics of Flow in Porous Media using Matlab Jørg E. Aarnes, Tore Gimse, and Knut–Andreas Lie SINTEF ICT, Dept. of Applied Mathematics, Oslo Summary. Even though the art of reservoir simulation has evolved through more than four decades, there is still a substantial research activity that aims toward faster, more robust, and more accurate reservoir simulators. Here we attempt to give the reader an introduction to the mathematics and the numerics behind reser- voir simulation. We assume that the reader has a basic mathematical background at the undergraduate level and is acquainted with numerical methods, but no prior knowledge of the mathematics or physics that govern the reservoir flow process is needed. To give the reader an intuitive understanding of the equations that model filtration through porous media, we start with incompressible single-phase flow and move step-by-step to the black-oil model and compressible two-phase flow. For each case, we present a basic numerical scheme in detail, before we discuss a few alter- native schemes that reflect trends in state-of-the-art reservoir simulation. Two and three-dimensional test cases are presented and discussed. Finally, for the most basic methods we include simple Matlab codes so that the reader can easily implement and become familiar with the basics of reservoir simulation. 1 Introduction For nearly half a century, reservoir simulation has been an integrated part of oil-reservoir management. Today, simulations are used to estimate pro- duction characteristics, calibrate reservoir parameters, visualise reservoir flow patterns, etc. The main purpose is to provide an information database that can help the oil companies to position and manage wells and well trajectories in order to maximise the oil and gas recovery. Unfortunately, obtaining an accurate prediction of reservoir flow scenarios is a difficult task. One of the reasons is that we can never get a complete and accurate characterization of the rock parameters that influence the flow pattern. And even if we did, we would not be able to run simulations that exploit all available information, since this would require a tremendous amount of computer resources that exceed by far the capabilities of modern multi-processor computers. On the other hand, we do not need, nor do we seek a simultaneous description of the