A streamfunction-vorticity formulation of spatially periodic flows