Competition of gravity and viscous forces in miscible vertical displacement in a three-dimensional porous medium