Multiscale gradient computation for multiphase flow in porous media