Fluid mechanics in rectangular cavities — analytical model and numerics