An efficient finite element method for modeling multiphase flow