Two-dimensional fluid flow near a cavity and a flexible solid boundary is examined in this work. Stokes’ equations are used to describe the fluid flow, while the flexible solid boundary is modeled as a uniformly tensioned membrane. Equations for elliptic mesh generation are solved iteratively along with Stokes’ equations, and the equation describing the membrane is used to update its position during the iterations. Two different configurations are considered. In the first, flow passes through the gap between a moving flexible wall and a rigid cavity. This configuration is studied in order to verify the validity of a lubrication model for this flow which was developed in previous work [X. Yin and S. Kumar, Phys. Fluids 17, 063101 (2005)]. In the second, flow driven by an externally applied pressure gradient passes through the gap between a stationary rigid wall and a cavity with a flexible bottom wall that can be deformed by an external pressure. This configuration is studied in order to explore the effect of boundary deformation on the flow pattern in the cavity. The results for the first configuration indicate that the lubrication model yields good predictions of the pressure profile, position of the flexible wall, and flow rate. The comparison also confirms that the lubrication model can only predict the existence of one primary eddy in the cavity, but not multiple primary eddies or corner eddies. The results for the second configuration indicate that the flow pattern in the cavity is dramatically altered as the external pressure changes. Replacing the bottom of a cavity with a flexible wall and applying a time-periodic pressure to it may thus be a potentially useful way to improve mixing and heat/mass transport in the cavity.