Pore Scale Modeling of Three-Phase Flow and the Effects of Wettability