The following code computes an approximate CFL-number:
from dolfin import *
from numpy import random
# Set up dummy data
mesh = UnitSquareMesh(8,8)
V = VectorFunctionSpace(mesh, "CG", 2)
Q = FunctionSpace(mesh, "CG", 1)
W=V*Q
U = Function(W)
U.vector()[:] = 10*random.random(W.dim())
u,p = split(U)
# Cell size and timestep
h = CellSize(mesh)
dt = Constant(0.01)
# Compute the CFL number cell wise
DG = FunctionSpace(mesh, "DG", 0)
CFL = project(sqrt(inner(u,u))*dt/h, DG)
plot(CFL)
interactive()