Dependence of residual nonwetting liquid on pore topology