With an increasing demand for oil and diculties in nding new major oil elds, research on methods to improve oil recovery from existing elds is more necessary now than ever. The subject of this thesis is to construct ecient numerical methods for simulation and optimization of oil recovery with emphasis on optimal control of water ooding with the use of smartwell technology. We have implemented immiscible ow of water and oil in isothermal reservoirs with isotropic heterogenous permeability elds. We use the method of lines for solution of the partial differential equation (PDE) system that governs the uid ow. We discretize the the two-phase ow model spatially using the nite volume method (FVM), and we use the two point ux approximation (TPFA) and the single-point upstream (SPU) scheme for computing the uxes. We propose a new formulation of the differential equation system that arise as a consequence of the spatial discretization of the two-phase ow model. Upon discretization in time, the proposed equation system ensures the mass conserving property of the two-phase ow model. For the solution of the spatially discretized two-phase ow model, we develop mass conserving explicit singly diagonally implicit Runge-Kutta (ESDIRK) methods with embedded error estimators for adaptive step size control. We demonstrate that high order ESDIRK methods are more ecient than the low-order methods most commonly used in reservoir simulators. Most commercial reservoir simulation tools use step size control, which is based on heuristics. These can neither deliver solutions with predetermined accuracy or guarantee the convergence in the modied Newton iterations. We have established predictive step size control based on error estimates, which can be calculated from the embedded ESDIRK methods. We change the step size control in order to minimize the computational cost per simulation. We implement a numerical method for nonlinear model predictive control (NMPC) along with smart-well technology to maximize the net present value (NPV) of an oil reservoir. The optimization is based on quasi-Newton sequential quadratic programming (SQP) with line-search and BFGS approximations of the Hessian, and the adjoint method for ecient computation of the gradients. We demonstrate that the application of NMPC for optimal control of smart-wells has the potential to increase the economic value of an oil reservoir.