Filtration through a porous non-homogeneous medium with variable cross-section