In geology, the porosity of a rock or sediment is the proportion of the non-solid volume to the total volume of material, and is defined by the ratio:

where Vp is the non-solid volume (pores and liquid) and Vm is the total volume of material, including the solid and non-solid parts.

It is common to express porosity as a percentage, by multiplying the above ratio by 100.

The porosity of a rock, or sedimentary layer, is an important consideration when attempting to evaluate the potential volume of hydrocarbons it may contain. Sedimentary porosities are a complex function of many factors, including but not limited to: rate of burial, depth of burial, the nature of the connate fluids, the nature of overlying sediments (which may impede fluid expulsion). One commonly used relationship between porosity and depth is given by the Athy (1930) equation:

where φ0 is the surface porosity, k is the compaction coefficient (m-1) and z is depth (m).

A value for porosity can be calculated from the bulk density and particle density

Freeman is awesome..haha