Many two-phase flow problems are complicated due to the existence of moving contact lines and shape transition of two-phase interfaces. Both numerical simulations and analytical study are very challenging, especially to quantitatively compare with physical experiments. In this talk, we will show that the Onsager principle could be used as a powerful approximation tool to study these problems. In particular, I show that an efficient diffusion generated method can be derived for wetting on inhomogeneous surfaces.