In this work the numerical solution of three cases of flow in a two-dimensional square cavity filled with air is presented. Case 1 corresponds to the problem of mixed flow with the upper wall at a constant speed and the other three walls fixed, the temperature of the moving wall is constant and greater than the lower wall, the other two vertical walls remain thermally insulated; Case 2 is similar to Case 1, but considering the four walls are fixed and the bottom wall is the hot one, and in Case 3 all 4 walls are fixed, one vertical wall is kept at a constant higher temperature than the opposite vertical wall , and the other two horizontal walls are thermally insulated. The solution of the equations of conservation of mass, momentum and energy is done with the free software OpenFOAM. The results are compared with those reported in the bibliography, obtaining satisfactory results.