Numerical algorithm for calculating thin film cavitational effects is presented in this paper. Cavitation is a common phenomenon in diverging parts of thin film contacts, such as: journal bearings, ball bearings, seals, etc. Locating and calculating cavitational effects is very important for their applicability, efficiency and safety. The thin film flow solver based on the Reynolds equation, together with cavitation algorithm is implemented using the Finite Area Method inside the OpenFOAM framework. OpenFOAM is an open source C++ toolbox for computational fluid dynamics (CFD). The Finite Area Method is a two-dimensional counterpart of the Finite Volume Method, used for discretising partial differential equations over curved surfaces. Discretisation is performed on user selected patches of computational mesh, with values calculated at face centres and fluxes calculated at edge centres of each finite area face. Reynolds equation is a 2D partial differential pressure equation used for calculating thin film flows between two surfaces in relative motion, with the following assumptions: fluid viscous forces dominate over body, inertia and surface tensions forces; fluid film curvature can be neglected; variation of pressure across the fluid film is negligibly small. The implemented cavitation algorithm is capable of capturing both rupture and reformation boundaries during cavitation, therefore it is considered to be mass conserving. The implemented solver is validated on three test cases: single parabolic slider (1D), twin parabolic slider (1D) and microtexture pocket bearing (2D).