A finite element cavitation algorithm to Reynolds equation is presented for the calculation of the flow field in the film between the faces of the mechanical seal. As using free mesh, the algorithm is particularly useful for the computational domain which shape is complex. The JFO boundary condition which satisfies mass conservation is implemented by introducing Kumar and Booker’s algorithm. A non-traditional finite element method is derived to avoid the process of the functional analysis and can obtain the flow rate on boundaries conveniently. The results show that the algorithm is reliable, effective and correspond to the literature results. Moreover, the algorithm can be also used for the sliding bearings lubrication problem which shows the well adaptability.