added function for porosity gradient estimation