Effective cooling of vertical heat-generating stacks in a cavity with openings