Fluid flows in square and cubic cavities