Estimation of an effective Rayleigh number for convection in a vertically inhomogeneous porous medium or clear fluid