A local refinement algorithm for computer simulation of flow through oil filters is presented. The mathematical model is based on laminar incompressible Navier-Stokes-Brinkman equations for flow in pure liquid and in porous zones. A finite volume method based discretization on cell-centered, collocated, locally refined grids is used. Special attention is paid to the conservation of the mass on the interface between the coarse and the fine grid. A projection method, SIMPLEC, is used to decouple momentum and continuity equations. The corresponding software is implemented in a flexible way for arbitrary 3D geometries, approximated by an union of parallelepipeds with different sizes. Results from numerical experiments show that the solver could be successfully used for simulation of coupled flow in plain and in porous media.