Linear stability of natural convection in a multilayer system of fluid and porous layers with internal heat sources